ARCH=$(patsubst aarch64,arm64,$(shell uname -m)) BLENDER = ../../blender-3.6.20-linux-x64/blender SERVER = src/godot/bin/godot_server.x11.opt.tools.$(ARCH) EDITOR_PLATFORM=x11es EDITOR2_PLATFORM=x11 DEMO_PLATFORMS=x11 x11es EDITOR = src/godot/bin/godot.$(EDITOR_PLATFORM).opt.tools.$(ARCH) EDITOR_DBG = src/godot/bin/godot.$(EDITOR_PLATFORM).tools.$(ARCH) EDITOR2 = src/godot/bin/godot.$(EDITOR2_PLATFORM).opt.tools.$(ARCH) EDITOR2_DBG = src/godot/bin/godot.$(EDITOR2_PLATFORM).tools.$(ARCH) .PHONY: all godot-editor-main godot-editor-debug export export-models export-clothes \ export-clean export-linux-demo export-windows-demo \ export-binaries patch tests import-vrm export-buildings all: godot-editor-main godot-editor-debug godot-main SCONS_EXTRA=-j16 define build_godot $(4): $(5) @echo Building $(4) cd src/godot; \ scons platform=$(1) arch=$(ARCH) target=$(2) tools=$(3) custom_modules=../modules $(SCONS_EXTRA) endef define build_godot_platform $(eval $(call build_godot,$(1),release,no,godot-main-release-$(1),patch)) $(eval $(call build_godot,$(1),debug,no,godot-main-debug-$(1),patch)) $(eval $(call build_godot,$(1),release_debug,no,godot-main-rdebug-$(1),patch)) GODOT_MAIN_TARGETS += godot-main-release-$(1) godot-main-debug-$(1) godot-main-rdebug-$(1) endef $(foreach pt,$(DEMO_PLATFORMS),$(eval $(call build_godot_platform,$(pt)))) godot-main: $(GODOT_MAIN_TARGETS) godot-editor-main godot-server-main godot-server-main: $(SERVER) godot-editor-main: $(EDITOR) $(EDITOR2) godot-editor-debug: $(EDITOR_DBG) $(EDITOR2_DBG) #$(SERVER): patch # cd src/godot; \ # scons platform=server arch=$(ARCH) target=release_debug tools=yes custom_modules=../modules -j16 $(eval $(call build_godot,server,release_debug,yes,$(SERVER),patch)) $(eval $(call build_godot,x11es,release_debug,yes,$(EDITOR),patch)) $(eval $(call build_godot,x11es,debug,yes,$(EDITOR_DBG),patch)) $(eval $(call build_godot,x11,release_debug,yes,$(EDITOR2),patch)) $(eval $(call build_godot,x11,debug,yes,$(EDITOR2_DBG),patch)) patch: ./src/godot/scene/animation/skeleton_ik.cpp cd ./src/godot && git reset --hard HEAD && rm -Rf platform/x11es && for p in ../patches/*.patch; do git apply $$p; done sed -e 's/ERR_FAIL_COND_V(-1 == p_task->root_bone, false);//g' -i ./src/godot/scene/animation/skeleton_ik.cpp cd ./src/modules/voxel && git reset --hard HEAD && for p in ../../patches/voxel/*.patch; do git apply $$p; done export: export-models export-clothes rm -Rf godot/.import export-clean: rm -Rf godot/character-data/* rm -f assets/blender/scripts/tmp-*.blend install-addons: $(BLENDER) -b -Y -P assets/blender/scripts/install_addons.py import-vrm: install-addons export-clean mkdir -p assets/blender/scripts/shapes/male assets/blender/scripts/shapes/female $(BLENDER) -b -Y -P assets/blender/scripts/import_vrm.py export2edit: import-vrm $(BLENDER) -b -Y -P assets/blender/scripts/export_for_modelling.py BLENDDIR_BUILDINGS=assets/blender/buildings GLTFDIR_BUILDINGS=godot/astream/terrain/details BUILDINGS_BUSINESS=business-bar1 business-cafe1 business-office1 business-store1 BUILDINGS_RESIDENTAL=residental-house1 residental-house2 residental-house3 \ residental-house4 residental-house5 residental-house6 \ residental-house7 residental-house8 residental-house9 \ residental-house10 residental-house11 residental-house13 \ residental-hut1 residental-hut1-lod \ residental-garage-door \ residental-garage-enterance residental-garage \ residental-parking residental-wall1 \ residental-wall-corner residental-garage-roof1 BUILDINGS_MAIN=gym-exterior home-exterior \ logistics-center-exterior office-exterior townhall-exterior BUILDINGS=bus-stop power-in-box power-pole power-pole-wire $(BUILDINGS_BUSINESS) \ $(BUILDINGS_RESIDENTAL) $(BUILDINGS_MAIN) \ zebra define export_building $(GLTFDIR_BUILDINGS)/$(1).gltf: $(BLENDDIR_BUILDINGS)/$(1).blend assets/blender/scripts/export_buildings.py $(BLENDER) -b $(BLENDDIR_BUILDINGS)/$(1).blend -Y -P ./assets/blender/scripts/export_buildings.py -- $(GLTFDIR_BUILDINGS)/$(1).gltf ALL_BUILDINGS += $(GLTFDIR_BUILDINGS)/$(1).gltf CLEAN_BUILDINGS += $(GLTFDIR_BUILDINGS)/$(1).gltf \ $(GLTFDIR_BUILDINGS)/$(1).bin endef $(foreach prog,$(BUILDINGS),$(eval $(call export_building,$(prog)))) export-buildings: $(ALL_BUILDINGS) @echo $(ALL_BUILDINGS) clean-buildings: rm -f $(CLEAN_BUILDINGS) $(GLTFDIR_BUILDINGS)/material_atlas*.material export-models: export-clean import-vrm $(BLENDER) -b -Y -P assets/blender/scripts/export_models.py export-clothes: export-clean $(BLENDER) -b -Y -P assets/blender/scripts/export_clothes.py export-binaries: mkdir -p export $(SERVER) --path godot --export linux_demo ../export/office-demo-linux.x86_64 $(SERVER) --path godot --export-debug linux_demo ../export/office-demo-debug-linux.x86_64 $(SERVER) --path godot --export windows_demo ../export/office-demo-windows.x86_64.exe $(SERVER) --path godot --export-debug windows_demo ../export/office-demo-debug-windows.x86_64.exe pack-terrain: godot-server-main $(SERVER) --path ./godot --import --quit $(SERVER) --path ./godot -s make_terrain_pck.gd --quit tests: make -C tests all