-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
48 lines (42 loc) · 1.48 KB
/
build.sh
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
#!/bin/bash
############################################################
# Build variables -- change these to suit your build env #
############################################################
SDL_INSTALL_PATH="E:/SDL/install"
GENERATOR="Visual Studio 17 2022"
############################################################
# Usage #
############################################################
Usage()
{
# Display Help
echo "Build this vulkan project."
echo
echo "Syntax: build.sh [-h|r|s]"
echo "options:"
echo "h Print this help message."
echo "r Build in release configuration. Debug is default if this is not specified."
echo "s Compile shaders."
echo
}
############################################################
# Main program #
############################################################
mkdir -p build && cd build
BUILD_CONFIGURATION="Debug"
while getopts "hrs" option; do
case $option in
h) # display Help
Usage
exit;;
r) # release configuration
BUILD_CONFIGURATION="Release";;
s) # compile shaders
SHADER_CONFIG="-DCOMPILE_SHADERS=1";;
\?) # Invalid option
echo "Error: Invalid option \"$OPTARG\""
exit;;
esac
done
cmake ../ -G "$GENERATOR" -DCMAKE_BUILD_TYPE=$BUILD_CONFIGURATION -DCMAKE_PREFIX_PATH=$SDL_INSTALL_PATH ${SHADER_CONFIG}
cmake --build . --config $BUILD_CONFIGURATION