vengi/Makefile

251 lines
11 KiB
Makefile
Raw Normal View History

2020-08-23 04:24:35 -07:00
# Allow to override settings
CONFIG ?= Makefile.local
-include $(CONFIG)
2019-04-04 00:13:32 -07:00
Q ?= @
UPDATEDIR := /tmp
2019-08-11 10:20:26 -07:00
BUILDTYPE ?= Debug
BUILDDIR ?= ./build/$(BUILDTYPE)
2020-05-12 13:16:56 -07:00
INSTALL_DIR ?= $(BUILDDIR)
2020-01-21 09:45:56 -08:00
GENERATOR := Ninja
CMAKE ?= cmake
2020-05-13 13:56:30 -07:00
CMAKE_OPTIONS ?= -DCMAKE_BUILD_TYPE=$(BUILDTYPE) -G$(GENERATOR) --graphviz=$(BUILDDIR)/deps.dot
2016-05-13 11:56:58 -07:00
2020-05-12 13:16:56 -07:00
all:
2020-05-13 13:56:30 -07:00
$(Q)if [ ! -f $(BUILDDIR)/CMakeCache.txt ]; then $(CMAKE) -H$(CURDIR) -B$(BUILDDIR) $(CMAKE_OPTIONS); fi
2020-05-12 13:16:56 -07:00
$(Q)$(CMAKE) --build $(BUILDDIR) --target $@
2021-11-06 12:43:21 -07:00
$(Q)$(CMAKE) -E create_symlink $(BUILDDIR)/compile_commands.json compile_commands.json
2019-04-04 00:13:32 -07:00
2020-01-15 14:09:55 -08:00
release:
$(Q)$(MAKE) BUILDTYPE=Release
2020-01-21 01:48:58 -08:00
clean:
$(Q)rm -rf $(BUILDDIR)
distclean:
$(Q)git clean -fdx
2020-05-12 13:01:49 -07:00
deb:
$(Q)debuild -b -ui -uc -us
2020-05-12 13:01:49 -07:00
2022-01-07 12:55:16 -08:00
.PHONY: cmake
cmake:
$(Q)$(CMAKE) -H$(CURDIR) -B$(BUILDDIR) $(CMAKE_OPTIONS)
.PHONY: ccmake
2020-12-02 09:30:01 -08:00
ccmake:
$(Q)ccmake -B$(BUILDDIR) -S.
crosscompile:
$(Q)dockcross $(CMAKE) -H. -B$(BUILDDIR) $(CMAKE_OPTIONS)
$(Q)dockcross $(CMAKE) --build $(BUILDDIR) --target all
windows:
$(Q)$(MAKE) crosscompile TARGET_OS=$@ BUILDDIR=$(BUILDDIR)/$@
release-%:
$(Q)$(MAKE) BUILDTYPE=Release $(subst release-,,$@)
2018-09-09 02:04:47 -07:00
%:
2020-05-13 13:56:30 -07:00
$(Q)if [ ! -f $(BUILDDIR)/CMakeCache.txt ]; then $(CMAKE) -H$(CURDIR) -B$(BUILDDIR) $(CMAKE_OPTIONS); fi
$(Q)$(CMAKE) --build $(BUILDDIR) --target $@
2020-05-12 13:16:56 -07:00
$(Q)$(CMAKE) --install $(BUILDDIR) --component $@ --prefix $(INSTALL_DIR)/install-$@
2021-11-06 12:43:21 -07:00
$(Q)$(CMAKE) -E create_symlink $(BUILDDIR)/compile_commands.json compile_commands.json
2020-05-13 13:56:30 -07:00
dependency-%:
$(Q)$(CMAKE) -H$(CURDIR) -B$(BUILDDIR) $(CMAKE_OPTIONS)
$(Q)dot -Tsvg $(BUILDDIR)/deps.dot.$(subst dependency-,,$@) -o $(BUILDDIR)/deps.dot.$(subst dependency-,,$@).svg;
$(Q)xdg-open $(BUILDDIR)/deps.dot.$(subst dependency-,,$@).svg;
2016-12-03 10:38:38 -08:00
define UPDATE_GIT
$(Q)if [ ! -d $(UPDATEDIR)/$(1).sync ]; then \
2017-08-08 23:54:36 -07:00
git clone --depth=1 $(2) $(UPDATEDIR)/$(1).sync; \
2016-12-03 10:38:38 -08:00
else \
2017-08-08 23:54:36 -07:00
cd $(UPDATEDIR)/$(1).sync && git pull --depth=1 --rebase; \
2016-12-03 10:38:38 -08:00
fi;
endef
2021-09-29 15:47:30 -07:00
tracy:
$(Q)git submodule update --init --recursive
$(Q)$(MAKE) -C src/modules/core/tracy/profiler/build/unix release
$(Q)src/modules/core/tracy/profiler/build/unix/Tracy-release
2017-09-10 21:47:47 -07:00
update-libuv:
2017-09-06 10:34:12 -07:00
$(call UPDATE_GIT,libuv,https://github.com/libuv/libuv.git)
2018-06-29 11:04:39 -07:00
rm -rf contrib/libs/libuv/include/uv/*.[ch]
rm -rf contrib/libs/libuv/include/*.[ch]
rm -rf contrib/libs/libuv/src/unix/*.[ch]
rm -rf contrib/libs/libuv/src/win32/*.[ch]
rm -rf contrib/libs/libuv/src/*.[ch]
2017-09-06 10:34:12 -07:00
cp $(UPDATEDIR)/libuv.sync/include/*.h contrib/libs/libuv/include
2018-06-29 11:04:39 -07:00
cp $(UPDATEDIR)/libuv.sync/include/uv/*.h contrib/libs/libuv/include/uv
2017-09-06 10:34:12 -07:00
cp $(UPDATEDIR)/libuv.sync/src/unix/*.[ch] contrib/libs/libuv/src/unix
cp $(UPDATEDIR)/libuv.sync/src/win/*.[ch] contrib/libs/libuv/src/win
cp $(UPDATEDIR)/libuv.sync/src/*.[ch] contrib/libs/libuv/src
2017-09-10 21:47:47 -07:00
update-stb:
2017-08-20 11:25:59 -07:00
$(call UPDATE_GIT,stb,https://github.com/nothings/stb.git)
cp $(UPDATEDIR)/stb.sync/stb_image.h src/modules/image/stb_image.h
cp $(UPDATEDIR)/stb.sync/stb_image_write.h src/modules/image/stb_image_write.h
2018-05-07 16:59:56 -07:00
cp $(UPDATEDIR)/stb.sync/stb_truetype.h src/modules/voxelfont/stb_truetype.h
2017-09-10 21:47:47 -07:00
update-googletest:
2017-06-26 20:58:18 -07:00
$(call UPDATE_GIT,googletest,https://github.com/google/googletest.git)
2017-07-24 12:40:17 -07:00
rm -rf contrib/libs/gtest/src
rm -rf contrib/libs/gtest/include
2018-10-14 11:48:45 -07:00
mkdir -p contrib/libs/gtest/src
mkdir -p contrib/libs/gtest/include
cp -r $(UPDATEDIR)/googletest.sync/googletest/src/ contrib/libs/gtest
cp -r $(UPDATEDIR)/googletest.sync/googletest/include/ contrib/libs/gtest
cp -r $(UPDATEDIR)/googletest.sync/googlemock/src/ contrib/libs/gtest
cp -r $(UPDATEDIR)/googletest.sync/googlemock/include/ contrib/libs/gtest
git checkout -f contrib/libs/gtest/include/gtest/internal/custom
2018-07-06 07:19:49 -07:00
git checkout -f contrib/libs/gtest/include/gmock/internal/custom
2017-09-10 21:47:47 -07:00
update-benchmark:
2017-06-20 11:35:23 -07:00
$(call UPDATE_GIT,benchmark,https://github.com/google/benchmark.git)
cp -r $(UPDATEDIR)/benchmark.sync/src/* contrib/libs/benchmark/src
cp -r $(UPDATEDIR)/benchmark.sync/include/* contrib/libs/benchmark/include
2017-09-10 21:47:47 -07:00
update-backward:
2017-06-11 10:41:00 -07:00
$(call UPDATE_GIT,backward-cpp,https://github.com/bombela/backward-cpp.git)
cp $(UPDATEDIR)/backward-cpp.sync/backward.cpp contrib/libs/backward
cp -f $(UPDATEDIR)/backward-cpp.sync/backward.hpp contrib/libs/backward/backward.h
sed -i 's/backward.hpp/backward.h/g' contrib/libs/backward/backward.cpp
2017-09-10 21:47:47 -07:00
update-imguizmo:
$(call UPDATE_GIT,imguizmo,https://github.com/CedricGuillemet/ImGuizmo.git)
2022-03-29 12:14:17 -07:00
cp $(UPDATEDIR)/imguizmo.sync/ImGuizmo.* src/modules/ui/imgui/dearimgui
dos2unix src/modules/ui/imgui/dearimgui/ImGuizmo*
2022-03-29 12:24:54 -07:00
update-im-neo-sequencer:
$(call UPDATE_GIT,im-neo-sequencer,https://gitlab.com/GroGy/im-neo-sequencer.git)
cp $(UPDATEDIR)/im-neo-sequencer.sync/imgui*.cpp $(UPDATEDIR)/im-neo-sequencer.sync/imgui*.h src/modules/ui/imgui/dearimgui
cp $(UPDATEDIR)/im-neo-sequencer.sync/LICENSE src/modules/ui/imgui/dearimgui/LICENSE-sequencer
2021-09-22 13:25:16 -07:00
# the backend code is just copied to merge in potiential changes
2017-09-10 21:47:47 -07:00
update-dearimgui:
2020-12-31 02:32:16 -08:00
$(call UPDATE_GIT,imgui,https://github.com/ocornut/imgui.git -b docking)
cp $(UPDATEDIR)/imgui.sync/im*.h $(UPDATEDIR)/imgui.sync/im*.cpp $(UPDATEDIR)/imgui.sync/misc/cpp/* src/modules/ui/imgui/dearimgui
cp $(UPDATEDIR)/imgui.sync/backends/imgui_impl_sdl.* src/modules/ui/imgui/dearimgui/backends
2022-01-26 07:27:25 -08:00
cp $(UPDATEDIR)/imgui.sync/backends/imgui_impl_opengl3.* src/modules/ui/imgui/dearimgui/backends
cp $(UPDATEDIR)/imgui.sync/examples/example_sdl_opengl3/main.cpp src/modules/ui/imgui/dearimgui/backends/example_sdl_opengl3.cpp
cp $(UPDATEDIR)/imgui.sync/misc/fonts/binary_to_compressed_c.cpp tools/binary_to_compressed_c
mv src/modules/ui/imgui/dearimgui/imgui_demo.cpp src/tests/testimgui/Demo.cpp
2017-09-10 21:47:47 -07:00
update-flatbuffers:
2016-12-03 10:38:38 -08:00
$(call UPDATE_GIT,flatbuffers,https://github.com/google/flatbuffers.git)
rm -rf contrib/libs/flatbuffers/flatbuffers/* contrib/libs/flatbuffers/compiler/*
mkdir -p contrib/libs/flatbuffers/compiler/src
cp -r $(UPDATEDIR)/flatbuffers.sync/include/flatbuffers/* contrib/libs/flatbuffers/flatbuffers
cp -r $(UPDATEDIR)/flatbuffers.sync/src/* contrib/libs/flatbuffers/compiler
cp -r $(UPDATEDIR)/flatbuffers.sync/grpc/src/* contrib/libs/flatbuffers/compiler/src
2016-12-03 10:38:38 -08:00
rm contrib/libs/flatbuffers/compiler/flathash.cpp
2017-09-10 21:47:47 -07:00
update-enet:
2016-12-03 10:38:38 -08:00
$(call UPDATE_GIT,libenet,https://github.com/lsalzman/enet.git)
cp -r $(UPDATEDIR)/libenet.sync/*.[ch] contrib/libs/libenet
cp -r $(UPDATEDIR)/libenet.sync/include/* contrib/libs/libenet/include
2017-09-10 21:47:47 -07:00
update-glm:
2016-12-03 10:38:38 -08:00
$(call UPDATE_GIT,glm,https://github.com/g-truc/glm.git)
rm -rf contrib/libs/glm/glm/*
cp -r $(UPDATEDIR)/glm.sync/glm/* contrib/libs/glm/glm
2016-12-03 10:38:38 -08:00
rm contrib/libs/glm/glm/CMakeLists.txt
2017-09-10 21:47:47 -07:00
update-sdl2:
2021-02-17 13:19:38 -08:00
$(call UPDATE_GIT,sdl2,https://github.com/libsdl-org/SDL.git)
2017-10-15 03:55:18 -07:00
rm -rf contrib/libs/sdl2/src/* contrib/libs/sdl2/include/* contrib/libs/sdl2/cmake/*
cp -r $(UPDATEDIR)/sdl2.sync/src/* contrib/libs/sdl2/src
2018-11-25 08:23:30 -08:00
cp -r $(UPDATEDIR)/sdl2.sync/wayland-protocols/* contrib/libs/sdl2/wayland-protocols
cp -r $(UPDATEDIR)/sdl2.sync/include/* contrib/libs/sdl2/include
2017-10-15 03:55:18 -07:00
cp -r $(UPDATEDIR)/sdl2.sync/cmake/* contrib/libs/sdl2/cmake
2017-09-10 21:47:47 -07:00
2019-12-12 13:26:42 -08:00
update-sdl2mixer:
2021-04-27 12:08:33 -07:00
$(call UPDATE_GIT,sdl2_mixer,https://github.com/libsdl-org/SDL_mixer)
2022-01-24 09:33:00 -08:00
rm -rf contrib/libs/SDL2_mixer/*
cp -r $(UPDATEDIR)/sdl2_mixer.sync/src/* contrib/libs/SDL2_mixer
cp -r $(UPDATEDIR)/sdl2_mixer.sync/include/* contrib/libs/SDL2_mixer
cp -r $(UPDATEDIR)/sdl2_mixer.sync/external/libogg* contrib/libs/SDL2_mixer
cp -r $(UPDATEDIR)/sdl2_mixer.sync/external/libvorbis* contrib/libs/SDL2_mixer
git checkout -f contrib/libs/SDL2_mixer/CMakeLists.txt
2019-12-12 13:26:42 -08:00
2017-09-11 07:54:07 -07:00
update-glslang:
$(call UPDATE_GIT,glslang,https://github.com/KhronosGroup/glslang.git)
2020-09-23 10:57:21 -07:00
rm -rf tools/glslang/External
cp -r $(UPDATEDIR)/glslang.sync/External tools/glslang/
rm -rf tools/glslang/glslang
cp -r $(UPDATEDIR)/glslang.sync/glslang tools/glslang/
rm -rf tools/glslang/OGLCompilersDLL
cp -r $(UPDATEDIR)/glslang.sync/OGLCompilersDLL tools/glslang/
rm -rf tools/glslang/SPIRV
cp -r $(UPDATEDIR)/glslang.sync/SPIRV tools/glslang/
rm -rf tools/glslang/StandAlone
cp -r $(UPDATEDIR)/glslang.sync/StandAlone tools/glslang/
2021-11-08 09:55:48 -08:00
cp $(UPDATEDIR)/glslang.sync/gen_extension_headers.py tools/glslang/
cp $(UPDATEDIR)/glslang.sync/*.cmake tools/glslang/
cp $(UPDATEDIR)/glslang.sync/README* tools/glslang/
2022-01-05 03:29:03 -08:00
dos2unix tools/glslang/SPIRV/spirv.hpp
2022-01-22 11:03:14 -08:00
python3 tools/glslang/gen_extension_headers.py -i tools/glslang/glslang/ExtensionHeaders -o tools/glslang/glslang/glsl_intrinsic_header.h
git checkout -f tools/glslang/glslang/build_info.h
2017-09-11 07:54:07 -07:00
2020-04-18 23:12:44 -07:00
update-simplecpp:
$(call UPDATE_GIT,simplecpp,https://github.com/danmar/simplecpp.git)
cp $(UPDATEDIR)/simplecpp.sync/simplecpp.* contrib/libs/simplecpp
update-miniz:
$(call UPDATE_GIT,miniz,https://github.com/richgel999/miniz.git)
2021-04-27 14:03:00 -07:00
cd $(UPDATEDIR)/miniz.sync; ./amalgamate.sh
cp $(UPDATEDIR)/miniz.sync/amalgamation/miniz.[ch] src/modules/core
update-nuklear:
$(call UPDATE_GIT,nuklear,https://github.com/Immediate-Mode-UI/Nuklear)
cp $(UPDATEDIR)/nuklear.sync/nuklear.h src/modules/ui/nuklear/private
cp $(UPDATEDIR)/nuklear.sync/demo/overview.c src/tests/testnuklear
2017-09-10 21:47:47 -07:00
# currently not part of updatelibs - intentional - we adopted the original code.
update-simplexnoise:
$(call UPDATE_GIT,simplexnoise,https://github.com/simongeilfus/SimplexNoise.git)
cp $(UPDATEDIR)/simplexnoise.sync/include/Simplex.h src/modules/noise
2020-05-21 12:45:51 -07:00
update-flextgl:
$(call UPDATE_GIT,flextgl,https://github.com/mosra/flextgl.git)
cp $(UPDATEDIR)/flextgl.sync/*.py tools/flextGL
cp $(UPDATEDIR)/flextgl.sync/README.md tools/flextGL
cp $(UPDATEDIR)/flextgl.sync/COPYING tools/flextGL
rm -rf tools/flextGL/templates/sdl
rm -rf tools/flextGL/templates/vulkan
cp -r $(UPDATEDIR)/flextgl.sync/templates/sdl tools/flextGL/templates
cp -r $(UPDATEDIR)/flextgl.sync/templates/vulkan tools/flextGL/templates
2022-01-28 08:42:57 -08:00
update-ogt_vox:
$(call UPDATE_GIT,ogl_vox,https://github.com/jpaver/opengametools)
cp $(UPDATEDIR)/ogl_vox.sync/src/ogt_vox.h src/modules/voxelformat/external
sed -i 's/[ \t]*$$//' src/modules/voxelformat/external/ogt_vox.h
2022-03-08 07:21:43 -08:00
update-tinygltf:
$(call UPDATE_GIT,tinygltf,https://github.com/syoyo/tinygltf.git)
cp $(UPDATEDIR)/tinygltf.sync/tiny_gltf.h $(UPDATEDIR)/tinygltf.sync/json.hpp src/modules/voxelformat/external
update-tinyobjloader:
$(call UPDATE_GIT,tinyobjloader,https://github.com/tinyobjloader/tinyobjloader.git)
cp $(UPDATEDIR)/tinyobjloader.sync/tiny_obj_loader.h src/modules/voxelformat/external
2018-01-12 06:15:04 -08:00
# TODO simpleai support
# TODO lua support
2020-04-18 23:12:44 -07:00
updatelibs: update-nuklear update-libuv update-stb update-googletest update-benchmark update-backward update-dearimgui update-flatbuffers update-enet update-glm update-sdl2 update-glslang update-simplecpp
$(MAKE) -C $(BUILDDIR) update-libs
2021-02-02 13:48:59 -08:00
update-icons:
$(call UPDATE_GIT,font-awesome,https://github.com/FortAwesome/Font-Awesome)
$(call UPDATE_GIT,iconfontcppheaders,https://github.com/juliettef/IconFontCppHeaders)
2021-09-21 10:45:41 -07:00
$(call UPDATE_GIT,fork-awesome,https://github.com/ForkAwesome/Fork-Awesome)
2021-02-02 13:48:59 -08:00
cp $(UPDATEDIR)/iconfontcppheaders.sync/IconsFontAwesome5.h src/modules/ui/imgui/
cp $(UPDATEDIR)/font-awesome.sync/webfonts/fa-solid-900.ttf data/imgui
2021-09-21 10:45:41 -07:00
cp $(UPDATEDIR)/iconfontcppheaders.sync/IconsForkAwesome.h src/modules/ui/imgui/
cp $(UPDATEDIR)/fork-awesome.sync/fonts/forkawesome-webfont.ttf data/imgui
2021-02-02 13:48:59 -08:00
update-fonts:
curl -o $(UPDATEDIR)/arimo.zip https://fonts.google.com/download?family=Arimo
unzip -jo $(UPDATEDIR)/arimo.zip static/Arimo-Regular.ttf -d data/imgui