godot-module-template/justfile

51 lines
2.2 KiB
Makefile

set export
BUILD_NAME := "change_me"
tree_hash := `tree ./modules | md5sum`
compiledb := if tree_hash == `cat .tree.hash` { "no" } else { "yes" }
build: format
# Compiling Editor
cd engine/ && scons target=editor symbols=yes optimization=debug dev_build=yes linker=mold use_llvm=yes compiledb={{compiledb}} custom_modules="../modules"
run: build
# Running Editor
engine/bin/godot.linuxbsd.editor.dev.x86_64.llvm --editor --path project
package-project:
mkdir -p build/
engine/bin/godot.linuxbsd.editor.dev.x86_64.llvm --editor --path project --headless --export-pack "Linux" ../build/{{BUILD_NAME}}.pck
compile-release platform: build
# Compiling {{platform}} Release
cd engine/ && scons platform={{platform}} target=template_release arch=x86_64 linker=mold use_llvm=yes compiledb=yes custom_modules="../modules"
package-release-linuxbsd: (compile-release "linuxbsd") package-project
# Prepare build output
mkdir -p build/linuxbsd
# Copy required files
cp engine/bin/godot.linuxbsd.template_release.x86_64.llvm build/linuxbsd/{{BUILD_NAME}}.x86_64
cp build/{{BUILD_NAME}}.pck build/linuxbsd/
cd build/ && zip -r {{BUILD_NAME}}-linuxbsd-x86_64.zip linuxbsd
# Completed Linux Release Build
package-release-windows: (compile-release "windows") package-project
# Prepare build output
mkdir -p build/windows
# Copy required files
cp engine/bin/godot.windows.template_release.x86_64.exe build/windows/{{BUILD_NAME}}.exe
cp build/{{BUILD_NAME}}.pck build/windows/
cd build/ && zip -r {{BUILD_NAME}}-windows-x86_64.zip windows
# Completed Windows Release Build
package-release-all: package-release-windows package-release-linuxbsd
initialize-template projectname:
# Initializing Template {{projectname}}
sed -i -e "s/PROJECT/{{projectname}}/g" ./modules/PROJECT/register_types.h ./modules/PROJECT/register_types.cpp ./project/project.godot ./project/export_presets.cfg .gitignore
sed -i -e "s/change_me/{{projectname}}/" ./justfile
mv ./modules/PROJECT ./modules/{{projectname}}
format:
# Formatting Custom Modules
clang-format -i $(find modules/ -iname '*.h' -o -iname '*.c' -o -iname '*.hpp' -o -iname '*.cpp' -o -iname '*.hxx' -o -iname '*.cxx')