-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
cmake_macosx.sh
61 lines (52 loc) · 1.76 KB
/
cmake_macosx.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
#!/bin/bash
#move to project directory
BASEDIR=$(dirname $0);
set -e
cd $BASEDIR/projects
#treat script parameter (if there is one, then directly use it for cases)
if [ -z "$1" ]
then
echo "Which choice would you like?"
echo " -> Generate a makefile (m)"
echo " -> Generate a makefile RELEASE (r)"
echo " -> Generate a makefile for crosscompilation (osxcroos) (c)"
echo " -> Generate a makefile for crosscompilation (osxcroos) RELEASE (d)"
echo " -> Generate a xcode project (x)"
read choice
else
choice=$1
fi
#run cmake depending on user choice (or script parameter)
case "$choice" in
m)
# cmake for makefile
cmake -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ ../sources
;;
r)
# cmake for makefile
cmake -DCMAKE_BUILD_TYPE="Release" -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ ../sources
;;
c)
#run osxcross-conf to get all env var and set OSXCROSS_HOST (needed by osxcross)
eval "`$YADOMS_CCMACOS_CONFTOOL`"
export OSXCROSS_HOST="$YADOMS_CCMACOS_TRIPLET"
# cmake for makefile (cross compilation)
cmake -D CMAKE_C_COMPILER=$YADOMS_CCMACOS_TRIPLET-clang -D CMAKE_CXX_COMPILER=$YADOMS_CCMACOS_TRIPLET-clang++ -DCMAKE_TOOLCHAIN_FILE=../sources/cmake/ccmacos.cmake ../sources
;;
d)
#run osxcross-conf to get all env var and set OSXCROSS_HOST (needed by osxcross)
eval "`$YADOMS_CCMACOS_CONFTOOL`"
export OSXCROSS_HOST="$YADOMS_CCMACOS_TRIPLET"
# cmake for makefile (cross compilation)
cmake -DCMAKE_BUILD_TYPE="Release" -D CMAKE_C_COMPILER=$YADOMS_CCMACOS_TRIPLET-clang -D CMAKE_CXX_COMPILER=$YADOMS_CCMACOS_TRIPLET-clang++ -DCMAKE_TOOLCHAIN_FILE=../sources/cmake/ccmacos.cmake ../sources
;;
x)
# cmake for xcode
cmake -GXcode ../sources
;;
*)
# generate an error and return 1
echo "$choice is not a valid choice"
exit 1
;;
esac