## ===================================================================================================================== ## fennec, a free and open source game engine ## Copyright © 2025 Medusa Slockbower ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . ## ===================================================================================================================== ## Help ================================================================================================================ Help() { echo "Bash script for building fennec from source." echo echo "GNU long options:" echo "--help (-h) = Print this help info." echo "--debug (-d) = Build in debug mode, provides full debugging information to use with a debugger." echo "--release (-r) = Build in release mode, provides full optimizations, eliminating debug info." echo "--relwithdebinfo (-i) = Build in release mode with extra debug info, provides partial optimizations." echo "--minsizerel (-m) = Build in release mode but optimizing for minimum binary size." echo "--all (-a) = Build all profiles." } ## Build Profiles ====================================================================================================== Debug() { mkdir -p build/debug cd ./build/debug cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -S ../.. -B . cmake --build . --target fennec cd ../.. } Release() { mkdir -p build/release cd ./build/release cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S ../.. -B . cmake --build . --target fennec cd ../.. } RelWithDebInfo() { mkdir -p build/relwithdebinfo cd ./build/relwithdebinfo cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -S ../.. -B . cmake --build . --target fennec cd ../.. } MinSizeRel() { mkdir -p build/minsizerel cd ./build/minsizerel cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -S ../.. -B . cmake --build . --target fennec cd ../.. } All() { Debug Release RelWithDebInfo MinSizeRel } # Main Program ========================================================================================================= while [ "${1:-}" != '' ]; do case "$1" in '--debug' | '-d') Debug exit;; '--release' | '-r') Release exit;; '--relwithdebinfo' | '-i') RelWithDebInfo exit;; '--minsizerel' | '-m') MinSizeRel exit;; '--all' | '-a') All exit;; *) echo "Error: Invalid option" exit;; esac done