Skip to content

Commit

Permalink
Merge pull request #26 from stuarthayhurst/build-system-fixes
Browse files Browse the repository at this point in the history
Build system improvements
  • Loading branch information
stuarthayhurst authored Jul 12, 2024
2 parents cb9a931 + caad828 commit 3ac599a
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CXX ?= $(shell command -v g++)
SHELL = bash
SHELL = bash -O globstar

LIBS = glm glfw3 glew stb assimp
BUILD_DIR = build
Expand All @@ -8,31 +8,27 @@ INSTALL_DIR ?= /usr/local/lib
HEADER_DIR ?= /usr/local/include
LIBRARY_NAME = libammonite.so.1

AMMONITE_OBJECTS_SOURCE = $(wildcard ./src/ammonite/*.cpp) \
$(wildcard ./src/ammonite/*/*.cpp) \
$(wildcard ./src/ammonite/*/*/*.cpp)
AMMONITE_HEADER_SOURCE = $(wildcard ./src/ammonite/*.hpp) \
$(wildcard ./src/ammonite/*/*.hpp) \
$(wildcard ./src/ammonite/*/*/*.hpp)
AMMONITE_OBJECTS_SOURCE = $(shell ls ./src/ammonite/**/*.cpp)
AMMONITE_HEADER_SOURCE = $(shell ls ./src/ammonite/**/*.hpp)
AMMONITE_HEADER_INSTALL := $(subst src/ammonite,$(HEADER_DIR)/ammonite,$(AMMONITE_HEADER_SOURCE))

HELPER_OBJECTS_SOURCE = $(wildcard ./src/helper/*.cpp)
HELPER_HEADER_SOURCE = $(wildcard ./src/helper/*.hpp)
HELPER_OBJECTS_SOURCE = $(shell ls ./src/helper/**/*.cpp)
HELPER_HEADER_SOURCE = $(shell ls ./src/helper/**/*.hpp)

DEMO_OBJECTS_SOURCE = $(wildcard ./src/demos/*.cpp)
DEMO_HEADER_SOURCE = $(wildcard ./src/demos/*.hpp)
DEMO_OBJECTS_SOURCE = $(shell ls ./src/demos/**/*.cpp)
DEMO_HEADER_SOURCE = $(shell ls ./src/demos/**/*.hpp)

OBJECT_DIR = $(BUILD_DIR)/objects
AMMONITE_OBJECTS = $(subst ./src,$(OBJECT_DIR),$(subst .cpp,.o,$(AMMONITE_OBJECTS_SOURCE)))
HELPER_OBJECTS = $(subst ./src,$(OBJECT_DIR),$(subst .cpp,.o,$(HELPER_OBJECTS_SOURCE)))
DEMO_OBJECTS = $(subst ./src,$(OBJECT_DIR),$(subst .cpp,.o,$(DEMO_OBJECTS_SOURCE)))

CXXFLAGS := $(shell pkg-config --cflags $(LIBS))
CXXFLAGS += $(shell pkg-config --cflags $(LIBS))
CXXFLAGS += -Wall -Wextra -Werror -std=c++23 -flto=auto
LDFLAGS := $(shell pkg-config --libs $(LIBS)) -lstdc++ -lm -pthread
LDFLAGS := $(shell pkg-config --libs $(LIBS)) -lstdc++ -lm -latomic -pthread

ifeq ($(FAST),true)
CXXFLAGS += -Ofast -march=native -DFAST
CXXFLAGS += -march=native -DFAST
else
CXXFLAGS += -O3
endif
Expand Down

0 comments on commit 3ac599a

Please sign in to comment.