Browse Source

update Makefile and build instructions

render_group_fix
cinnaboot 5 years ago
parent
commit
338addacca
  1. 10
      Makefile
  2. 13
      README
  3. 10
      examples/Makefile

10
Makefile

@ -19,6 +19,7 @@ ASSIMP_DIR=ext/assimp
ifeq ($(USE_INTERNAL_ASSIMP), y) ifeq ($(USE_INTERNAL_ASSIMP), y)
CXXFLAGS += -I$(ASSIMP_DIR)/include CXXFLAGS += -I$(ASSIMP_DIR)/include
ASSIMP_LIB := $(ASSIMP_DIR)/build/code/libassimp.a
BUILD_ASSIMP_TARGET := build_assimp BUILD_ASSIMP_TARGET := build_assimp
endif endif
@ -35,8 +36,13 @@ build_assimp:
git checkout -q v5.0.1; \ git checkout -q v5.0.1; \
fi fi
cmake -S $(ASSIMP_DIR) -B $(ASSIMP_DIR) cmake -S $(ASSIMP_DIR) -B $(ASSIMP_DIR)/build \
$(MAKE) -C $(ASSIMP_DIR) -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 .PHONY: build_assimp
mkdirs: mkdirs:

13
README

@ -26,8 +26,7 @@ Build Instructions:
Arch) Arch)
$ sudo pacman -S assimp glew glm sd2 catch2 gcc make $ sudo pacman -S assimp glew glm sd2 catch2 gcc make
Fedora) Fedora)
NOTE: Fedora (33) ships with assimp v3.3.1 which doesn't support NOTE: Fedora (33) see note below about building assimp
glTF2: https://en.wikipedia.org/wiki/GlTF
$ sudo dnf install glew-devel glm-devel catch-devel SDL2-devel \ $ sudo dnf install glew-devel glm-devel catch-devel SDL2-devel \
gcc-c++ make cmake gcc-c++ make cmake
checkout, and initialize submodules: (stb_image) checkout, and initialize submodules: (stb_image)
@ -39,13 +38,11 @@ Build Instructions:
build: build:
$ make $ make
examples will be in examples/bin
NOTE: if build fails with errors from assimp or mesh.cpp, you can build 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 $ 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

10
examples/Makefile

@ -9,8 +9,8 @@ BINDIR = bin
ifeq ($(USE_INTERNAL_ASSIMP), y) ifeq ($(USE_INTERNAL_ASSIMP), y)
CXXFLAGS += -I../$(ASSIMP_DIR)/include CXXFLAGS += -I../$(ASSIMP_DIR)/include
LDFLAGS = -lSDL2 -lGLEW -lGL \ LDFLAGS = -lSDL2 -lGLEW -lGL
-L../$(ASSIMP_DIR)/bin -L../$(ASSIMP_DIR)/lib -lassimp ASSIMP_LIB := ../$(ASSIMP_DIR)/build/code/libassimp.a
endif endif
@ -28,15 +28,15 @@ mkdirs:
$(OBJDIR)/hello_world.o: $(LIB) $(OBJDIR)/hello_world.o: $(LIB)
$(CXX) $(CXXFLAGS) -c -MMD hello_world/main.cpp -o $@ $(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) $(OBJDIR)/assimp_loading.o: $(LIB)
$(CXX) $(CXXFLAGS) -c -MMD assimp_loading/main.cpp -o $@ $(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) $(OBJDIR)/simple_mesh.o: $(LIB)
$(CXX) $(CXXFLAGS) -c -MMD simple_mesh/main.cpp -o $@ $(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: clean:
rm -rf $(OBJDIR)/* bin/* rm -rf $(OBJDIR)/* bin/*

Loading…
Cancel
Save