2024-11-22 00:56:31 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-11-27 16:52:57 +00:00
|
|
|
# Set variables
|
2024-11-22 13:40:41 +00:00
|
|
|
RELEASE_BUILD_DIR="build-release"
|
|
|
|
DEBUG_BUILD_DIR="build-debug"
|
2024-11-27 16:52:57 +00:00
|
|
|
EXECUTABLE_PATH="editor/ferx"
|
2024-11-22 00:56:31 +00:00
|
|
|
|
2024-11-27 16:52:57 +00:00
|
|
|
# Run commands
|
2024-11-22 00:56:31 +00:00
|
|
|
case $1 in
|
2024-11-22 13:40:41 +00:00
|
|
|
build-release)
|
2024-11-27 16:52:57 +00:00
|
|
|
cmake -S .. -B ../"$RELEASE_BUILD_DIR" -G Ninja -DCMAKE_BUILD_TYPE=Release -DGLFW_BUILD_WAYLAND=OFF -DGLFW_BUILD_X11=ON
|
2024-11-22 13:40:41 +00:00
|
|
|
cmake --build ../"$RELEASE_BUILD_DIR" -j8
|
2024-11-22 00:56:31 +00:00
|
|
|
;;
|
2024-11-22 13:40:41 +00:00
|
|
|
build-debug)
|
2024-11-27 16:52:57 +00:00
|
|
|
cmake -S .. -B ../"$DEBUG_BUILD_DIR" -G Ninja -DCMAKE_BUILD_TYPE=Debug -DGLFW_BUILD_WAYLAND=OFF -DGLFW_BUILD_X11=ON
|
2024-11-22 13:40:41 +00:00
|
|
|
cmake --build ../"$DEBUG_BUILD_DIR" -j8
|
2024-11-22 00:56:31 +00:00
|
|
|
;;
|
2024-11-22 13:40:41 +00:00
|
|
|
run-release)
|
2024-11-27 16:52:57 +00:00
|
|
|
"../$RELEASE_BUILD_DIR/$EXECUTABLE_PATH"
|
2024-11-22 00:56:31 +00:00
|
|
|
;;
|
2024-11-22 13:40:41 +00:00
|
|
|
run-debug)
|
2024-11-27 16:52:57 +00:00
|
|
|
"../$DEBUG_BUILD_DIR/$EXECUTABLE_PATH"
|
2024-11-22 00:56:31 +00:00
|
|
|
;;
|
2024-11-22 13:40:41 +00:00
|
|
|
clean-release)
|
|
|
|
cmake --build ../"$RELEASE_BUILD_DIR" --target clean
|
|
|
|
;;
|
|
|
|
clean-debug)
|
|
|
|
cmake --build ../"$DEBUG_BUILD_DIR" --target clean
|
|
|
|
;;
|
|
|
|
clean-release-all)
|
|
|
|
rm -r ../"$RELEASE_BUILD_DIR"
|
|
|
|
;;
|
|
|
|
clean-debug-all)
|
|
|
|
rm -r ../"$DEBUG_BUILD_DIR"
|
2024-11-22 00:56:31 +00:00
|
|
|
;;
|
|
|
|
all)
|
2024-11-22 13:40:41 +00:00
|
|
|
bash $0 build-debug
|
|
|
|
bash $0 run-debug
|
2024-11-22 00:56:31 +00:00
|
|
|
;;
|
2024-11-27 16:52:57 +00:00
|
|
|
--help)
|
|
|
|
echo "Usage: $0 <command>"
|
|
|
|
echo
|
|
|
|
echo "Commands:"
|
|
|
|
echo " all Build and run the project in Debug mode"
|
|
|
|
echo " build-release Build the project in Release mode"
|
|
|
|
echo " build-debug Build the project in Debug mode"
|
|
|
|
echo " run-release Run the Release build"
|
|
|
|
echo " run-debug Run the Debug build"
|
|
|
|
echo " clean-release Clean Release build files"
|
|
|
|
echo " clean-debug Clean Debug build files"
|
|
|
|
echo " clean-release-all Remove all Release build files"
|
|
|
|
echo " clean-debug-all Remove all Debug build files"
|
|
|
|
;;
|
2024-11-22 00:56:31 +00:00
|
|
|
*)
|
2024-11-27 16:52:57 +00:00
|
|
|
echo "Unknown command: $1"
|
|
|
|
echo "Use --help for a list of available commands"
|
2024-11-22 00:56:31 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|