-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathconfigure.sh
executable file
·164 lines (135 loc) · 3.91 KB
/
configure.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/sh
# This file for Linux users,
# launches CMake and creates configuration for
# Release and Debug modes.
# Check for the presence of geogram
if [ ! -f geogram/cmake/options/CMakeOptions.txt.graphite ]; then
echo "geogram is missing, you need to install it as well with:"
echo "git clone https://github.com/BrunoLevy/geogram.git"
echo "(or clone Graphite repo with the --recursive option)"
exit
fi
# geogram configuration for Graphite
if [ -f geogram/CMakeOptions.txt ]; then
echo "Using user-supplied CMakeOptions.txt in geogram"
else
echo "Using Graphite default CMakeOptions.txt in geogram"
cp geogram/cmake/options/CMakeOptions.txt.graphite geogram/CMakeOptions.txt
fi
echo
echo ============= Checking for CMake ============
echo
if (cmake --version); then
echo "Found CMake"
echo
else
echo "Error: CMake not found, please install it (see http://www.cmake.org/)"
exit 1
fi
# Parse command line arguments
cmake_options=
build_name_suffix=
while [ -n "$1" ]; do
case "$1" in
--with-*=*)
cmake_option=`echo "$1" | sed 's/--with-\([^=]*\)=\(.*\)$/-DVORPALINE_WITH_\U\1\E:STRING="\2"/'`
cmake_options="$cmake_options $cmake_option"
shift
;;
--with-*)
cmake_option=`echo "$1" | sed 's/--with-\(.*\)$/-DVORPALINE_WITH_\U\1:BOOL=TRUE/'`
cmake_options="$cmake_options $cmake_option"
shift
;;
--help-platforms)
echo "Supported platforms:"
for i in `find geogram/cmake/platforms/* -type d`
do
if [ $i != "xxxgeogram/cmake/platforms" ]
then
echo "*" `basename $i`
fi
done
exit
;;
--build_name_suffix=*)
build_name_suffix=`echo "$1" | sed 's/--build_name_suffix=\(.*\)$/\1/'`
shift
;;
--help)
cat <<END
NAME
configure.sh
SYNOPSIS
Prepares the build environment for Graphite/Vorpaline.
- For Unix builds, the script creates 2 build trees for Debug and Release
build in a 'build' sub directory under the project root.
USAGE
configure.sh [options] [build-platform]
OPTIONS
--help
Prints this page.
--build_name_suffix=suffix-dir
Add a suffix to define the build directory
PLATFORM
Build platforms supported by Graphite: use configure.sh --help-platforms
END
exit
;;
-*)
echo "Error: unrecognized option: $1"
return 1
;;
*)
break;
;;
esac
done
# Check the current OS
os="$1"
if [ -z "$os" ]; then
os=`uname -a`
case "$os" in
Linux*x86_64*)
os=Linux64-gcc-dynamic
;;
Linux*amd64*)
os=Linux64-gcc-dynamic
;;
Linux*i586*|Linux*i686*)
os=Linux32-gcc-dynamic
;;
Darwin*)
os=Darwin-clang-dynamic
;;
*)
echo "Error: OS not supported: $os"
exit 1
;;
esac
fi
# Generate the Makefiles
for config in Release Debug; do
platform=$os-$config
echo
echo ============= Creating makefiles for $platform ============
echo
build_dir=build/$platform$build_name_suffix
mkdir -p $build_dir
(cd $build_dir;
cmake \
-DCMAKE_BUILD_TYPE:STRING=$config \
-DVORPALINE_PLATFORM:STRING=$os \
$cmake_options ../../)
done
echo
echo ============== Graphite build configured ==================
echo
cat << EOF
To build graphite:
- go to build/$os-Release$build_name_suffix or build/$os-Debug$build_name_suffix
- run 'make' or 'cmake --build .'
Note: local configuration can be specified in CMakeOptions.txt
(see CMakeOptions.txt.sample for an example)
You'll need to re-run configure.sh if you create or modify CMakeOptions.txt
EOF