build: Add shell file support

This commit is contained in:
Huseyn Ismayilov 2024-11-22 04:56:31 +04:00
parent ab49f1e533
commit 5fa8dda890
3 changed files with 58 additions and 24 deletions

View File

@ -1,24 +0,0 @@
BUILD_DIR = build
EDITOR_DIR = editor
NAME = ferx
RM += -r
all: debug run
release:
cmake -S . -B $(BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build $(BUILD_DIR) -j8
debug:
cmake -S . -B $(BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build $(BUILD_DIR) -j8
run:
cd $(BUILD_DIR)/${EDITOR_DIR} && ./${NAME}
clean:
cmake --build $(BUILD_DIR) --target clean
clean-all:
$(RM) $(BUILD_DIR)

34
scripts/BuildProject.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
BUILD_DIR="build"
EDITOR_DIR="editor"
NAME="ferx"
case $1 in
release)
cmake -S .. -B ../"$BUILD_DIR" -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build ../"$BUILD_DIR" -j8
;;
debug)
cmake -S .. -B ../"$BUILD_DIR" -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build ../"$BUILD_DIR" -j8
;;
run)
cd "../$BUILD_DIR/$EDITOR_DIR" && ./"$NAME"
;;
clean)
cmake --build ../"$BUILD_DIR" --target clean
;;
clean-all)
rm -r ../"$BUILD_DIR"
;;
all)
bash $0 enter_dir
bash $0 debug
bash $0 run
;;
*)
echo "Usage: $0 {release|debug|run|clean|clean-all|all}"
exit 1
;;
esac

24
scripts/Makefile Normal file
View File

@ -0,0 +1,24 @@
BUILD_DIR = build
EDITOR_DIR = editor
NAME = ferx
RM += -r
all: debug run
release:
cmake -S .. -B ../$(BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build ../$(BUILD_DIR) -j8
debug:
cmake -S .. -B ../$(BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build ../$(BUILD_DIR) -j8
run:
cd ../$(BUILD_DIR)/${EDITOR_DIR} && ./${NAME}
clean:
cmake --build ../$(BUILD_DIR) --target clean
clean-all:
$(RM) ../$(BUILD_DIR)