diff --git a/Makefile b/Makefile index a26b208..bbd84a8 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ ASSIMP_DIR=ext/assimp ifeq ($(USE_INTERNAL_ASSIMP), y) CXXFLAGS += -I$(ASSIMP_DIR)/include +ASSIMP_LIB := $(ASSIMP_DIR)/build/code/libassimp.a BUILD_ASSIMP_TARGET := build_assimp endif @@ -35,8 +36,13 @@ build_assimp: git checkout -q v5.0.1; \ fi - cmake -S $(ASSIMP_DIR) -B $(ASSIMP_DIR) - $(MAKE) -C $(ASSIMP_DIR) + cmake -S $(ASSIMP_DIR) -B $(ASSIMP_DIR)/build \ + -DBUILD_SHARED_LIBS=OFF \ + -DASSIMP_BUILD_TOOLS=OFF -DASSIMP_BUILD_TESTS=OFF \ + -DASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT=OFF \ + -DASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT=OFF \ + -DASSIMP_BUILD_GLTF_IMPORTER=ON ./ + $(MAKE) -C $(ASSIMP_DIR)/build .PHONY: build_assimp mkdirs: diff --git a/README b/README index 5179591..421f1d7 100644 --- a/README +++ b/README @@ -26,8 +26,7 @@ Build Instructions: Arch) $ sudo pacman -S assimp glew glm sd2 catch2 gcc make Fedora) - NOTE: Fedora (33) ships with assimp v3.3.1 which doesn't support - glTF2: https://en.wikipedia.org/wiki/GlTF + NOTE: Fedora (33) see note below about building assimp $ sudo dnf install glew-devel glm-devel catch-devel SDL2-devel \ gcc-c++ make cmake checkout, and initialize submodules: (stb_image) @@ -39,13 +38,11 @@ Build Instructions: build: $ make + examples will be in examples/bin + NOTE: if build fails with errors from assimp or mesh.cpp, you can build - a recent version of assimp first. Requires cmake + a recent version of assimp that supports glTF2 + https://en.wikipedia.org/wiki/GlTF. Requires cmake $ make build_assimp && USE_INTERNAL_ASSIMP=y make - to run examples without installing assimp as a system library: - - $ cd examples/bin - $ LD_LIBRARY_PATH=../../ext/assimp/lib ./assimp_loading - diff --git a/examples/Makefile b/examples/Makefile index a6990cf..9587f4b 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -9,8 +9,8 @@ BINDIR = bin ifeq ($(USE_INTERNAL_ASSIMP), y) CXXFLAGS += -I../$(ASSIMP_DIR)/include -LDFLAGS = -lSDL2 -lGLEW -lGL \ - -L../$(ASSIMP_DIR)/bin -L../$(ASSIMP_DIR)/lib -lassimp +LDFLAGS = -lSDL2 -lGLEW -lGL +ASSIMP_LIB := ../$(ASSIMP_DIR)/build/code/libassimp.a endif @@ -28,15 +28,15 @@ mkdirs: $(OBJDIR)/hello_world.o: $(LIB) $(CXX) $(CXXFLAGS) -c -MMD hello_world/main.cpp -o $@ - $(CXX) -o $(BINDIR)/hello_world $(LDFLAGS) $@ $(LIB) + $(CXX) -o $(BINDIR)/hello_world $(LDFLAGS) $@ $(LIB) $(ASSIMP_LIB) $(OBJDIR)/assimp_loading.o: $(LIB) $(CXX) $(CXXFLAGS) -c -MMD assimp_loading/main.cpp -o $@ - $(CXX) -o $(BINDIR)/assimp_loading $(LDFLAGS) $@ $(LIB) + $(CXX) -o $(BINDIR)/assimp_loading $(LDFLAGS) $@ $(LIB) $(ASSIMP_LIB) $(OBJDIR)/simple_mesh.o: $(LIB) $(CXX) $(CXXFLAGS) -c -MMD simple_mesh/main.cpp -o $@ - $(CXX) -o $(BINDIR)/simple_mesh $(LDFLAGS) $@ $(LIB) + $(CXX) -o $(BINDIR)/simple_mesh $(LDFLAGS) $@ $(LIB) $(ASSIMP_LIB) clean: rm -rf $(OBJDIR)/* bin/*