forked from KCL-Planning/VAL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_win64.sh
65 lines (56 loc) · 1.45 KB
/
build_win64.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
echo "Build for win64"
BUILD_GENERATOR="Unix Makefiles"
BUILD_TARGET=$1 # all
BUILD_CONFIGURATION=$2 # Debug / Release
BUILD_THREAD=4
PWD=`pwd`
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_DIR=$DIR/../../build
TARGET_DIR=linux_win64
mkdir $BUILD_DIR
cd $BUILD_DIR
mkdir $TARGET_DIR
cd $TARGET_DIR
mkdir $BUILD_CONFIGURATION
cd $BUILD_CONFIGURATION
# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/cross_compiling/Mingw
echo "Generate scripts"
cmake -G "$BUILD_GENERATOR" -DCMAKE_BUILD_TYPE=$BUILD_CONFIGURATION -DCMAKE_INSTALL_PREFIX=`pwd`/install ../../.. -DCMAKE_TOOLCHAIN_FILE=$DIR/toolchain/Toolchain-Ubuntu-mingw64.cmake
generateStatus=$?
if [ $generateStatus -ne 0 ]; then
echo "Scripts generation failed."
exit $generateStatus
else
echo "Scripts generation succesful."
fi
echo "Build using the scripts"
cmake --build . --config $BUILD_CONFIGURATION --target $BUILD_TARGET -- -j $BUILD_THREAD
buildStatus=$?
if [ $buildStatus -ne 0 ]; then
echo "Build failed."
exit $buildStatus
else
echo "Build succesful."
fi
echo "Install using the scripts"
cmake --build . --target install
installStatus=$?
if [ $installStatus -ne 0 ]; then
echo "Install failed."
exit $installStatus
else
echo "Install succesful."
fi
echo "Package using the scripts"
cpack ../../..
packageStatus=$?
if [ $packageStatus -ne 0 ]; then
echo "Package failed."
exit $packageStatus
else
echo "Package succesful."
fi
cd ..
cd ..
cd $PWD