-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_cmake.sh
More file actions
executable file
·49 lines (44 loc) · 1.15 KB
/
setup_cmake.sh
File metadata and controls
executable file
·49 lines (44 loc) · 1.15 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
#!/usr/bin/env zsh
# Default build folder name
build_folder="build"
unset fresh
# Parse command line options
while getopts ":fb:" opt; do
case $opt in
b)
build_folder="$OPTARG"
;;
f)
fresh="--fresh"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
# Create the build folder if it doesn't exist
if [ ! -d "$build_folder" ]; then
echo "Creating build folder: $build_folder"
mkdir "$build_folder"
fi
name=$(./scripts/query_manifest.sh name)
version=$(./scripts/query_manifest.sh version)
# Run CMake inside the build folder
(
pushd "$build_folder" || exit 1
CC=cl CXX=cl cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Windows \
-DPROJ_NAME=$name \
-DPROJECT_VERSION=$version \
.. $fresh
sed -i -e "s@SHELL = /bin/sh@SHELL = /usr/bin/zsh@g;" "$PWD/../build/Makefile"
# Check the exit code of the CMake command
if [ $? -eq 0 ]; then
echo "CMake configuration successful. Build folder: $PWD"
else
echo "CMake configuration failed."
fi
popd
)