-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·74 lines (68 loc) · 2.61 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·74 lines (68 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# ----------------------------------------------------------------------------------------------------------------------
# Usage: `./build.sh [target] [options]`
# Help: `./build.sh help`
# Build: `./build.sh`
#
# This script is used to assist in building the allacrost game and map editor using cmake. It provides some custom
# "targets" not provided in the cmake-generated makefile and generally helps to create a simple building interface
# that also hides all the generated build files in the cmake/build/ directory.
# ----------------------------------------------------------------------------------------------------------------------
#!/bin/bash
# Absolute path to where this script file resides
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
# Absolute path where cmake places all build files (except for binaries)
BUILD_PATH=$SCRIPT_PATH/build/cmake
# Prints usage about the script, including the list of possible targets and options
PrintUsage() {
echo "Usage: $0 [target] [options]"
echo ""
echo "The most common usage pattern is running the script without a target"
echo ""
echo "Targets:"
echo " (no target): build the binaries. The makefile will be automatically generated by cmake if required"
echo " cmake: run cmake to generate or regenerate the build makefile"
echo " clean: remove built object files"
echo " distclean: remove all cmake-generated build files"
echo " install: install application and data on user's system"
echo " uninstall: uninstall application and data on user's system"
echo " help: print this usage screen"
echo " help-targets: print the full list of available targets that can be run through this script to the makefile"
echo ""
echo "Options:"
echo " -DEDITOR=false: Do not build the map editor along with the game (default is true)"
echo " -DUSEPCH=false: Use precompiled header for compilation with compiler (default is true)"
}
# Cleans up all cmake-generated files (since cmake does not provide this functionality itself)
DistClean() {
rm $BUILD_PATH/Makefile
rm $BUILD_PATH/*.cmake
rm $BUILD_PATH/CMakeCache.txt
rm $BUILD_PATH/moc*.cpp
rm -r $BUILD_PATH/CMakeFiles
echo "Cleaned all cmake-generated files in $BUILD_PATH."
}
# Check the [target] argument to the script and take any special actions needed. Otherwise pass all script arguments to the Makefile
case "$1" in
help)
PrintUsage
;;
help-targets)
cd $BUILD_PATH
make help
;;
cmake)
cd $BUILD_PATH
cmake ../..
;;
distclean)
DistClean
;;
*)
cd $BUILD_PATH
# If the Makefile doesn't exist, generate it with cmake first
if [ ! -r $BUILD_PATH/Makefile ]; then
cmake ../..
fi
make $@
esac
exit 0