-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·196 lines (156 loc) · 5.54 KB
/
Copy pathbootstrap
File metadata and controls
executable file
·196 lines (156 loc) · 5.54 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/usr/bin/env bash
# This script creates a build directory and sticks a config.sh script into it.
# Then config.sh can be edited and run within the build directory.
# Print usage info.
if [ "$1" = "" ]; then
echo "Usage: bootstrap build_dir"
exit 1
fi
# Create the build directory if it doesn't exist.
if [ ! -d $1 ]; then
mkdir -p $1
fi
# Copy our template config script into place.
echo "SOURCE_DIR=$PWD" > $1/config.sh
cat <<EOT >> $1/config.sh
# ^^^^^^ location of polytope source code.
# config.sh -- A CMake configuration script.
# Edit this file to change the parameters in your build. Uncomment exactly one
# value for each parameter.
# Set this to the location where you want to install polytope.
PREFIX=\$HOME/opt
#-----------------------------------------------------------------------------
# Parallelism
#-----------------------------------------------------------------------------
# Build with MPI for parallel simulations.
#MPI=ON
#-----------------------------------------------------------------------------
# Compilers
#-----------------------------------------------------------------------------
if [ "\$MPI" = "ON" ]; then
CC=mpicc
CXX=mpic++
else
CC=cc
CXX=c++
fi
# Override compilers here (ONLY if you know what you're doing!).
# C compiler.
#CC=cc
# C++ compiler.
#CXX=c++
#-----------------------------------------------------------------------------
# Build type
#-----------------------------------------------------------------------------
# Choose one of the following.
# Debug executable (debugging symbols, no optimization).
BUILD_TYPE=Debug
# Release executable (No symbols, optimization).
#BUILD_TYPE=Release
#-----------------------------------------------------------------------------
# Build options
#-----------------------------------------------------------------------------
# Uncomment to build libraries as shared libraries.
#SHARED_LIBS=ON
# Uncomment this to build Polytope as a header-only library.
#HEADER_ONLY=ON
# Uncomment this to build Polytope's C interface.
#BUILD_C_INTERFACE=ON
# Change this to set the type of real numbers in the C interface.
C_REAL_TYPE=double
# Change this to decide whether tests get built.
TESTING=ON
# Uncomment this if you want really verbose builds.
VERBOSE=ON
#-----------------------------------------------------------------------------
# Third-party libraries and bindings
#-----------------------------------------------------------------------------
# Uncomment this to provide the root location for the Boost C++ libraries.
#BOOST_ROOT=
# Change this to enable support for the Silo I/O library.
USE_SILO=ON
# Set this to provide the root location for the HDF5 I/O libraries.
# Only used if Silo is enabled.
HDF5_ROOT=
# Change this to enable support for Python bindings.
USE_PYTHON=OFF
# Change this to provide an absolute path for the Python interpreter.
# Currently, polytope assumes the following Python directory structure:
# 1) <root>/bin for the executable
# 2) <root>/include/python<version>/ to find Python.h
# 3) <root>/lib/python/ or <root>/lib/python<version>/ to find
# libpython<version>.a and site-packages/pybindgen
PYTHON_EXE=`which python`
#-----------------------------------------------------------------------------
# Build generator
#-----------------------------------------------------------------------------
# Choose one of the following.
# Good old-fashioned UNIX makefiles.
GENERATOR="Unix Makefiles"
# Ninja, a speedy make replacement. Use if available!
#GENERATOR="Ninja"
# Code::Blocks (with UNIX makefiles underneath).
#GENERATOR="CodeBlocks - Unix Makefiles"
# Code::Blocks (with Ninja underneath).
#GENERATOR="CodeBlocks - Ninja"
#-----------------------------------------------------------------------------
# Don't change anything below here.
#-----------------------------------------------------------------------------
OPTIONS=""
if [ "\$MPI" = "ON" ]; then
OPTIONS="-DHAVE_MPI=ON"
fi
if [ "\$HEADER_ONLY" = "ON" ]; then
OPTIONS="\$OPTIONS -DHEADER_ONLY=ON"
fi
if [ "\$SHARED_LIBS" = "ON" ]; then
OPTIONS="\$OPTIONS -DBUILD_SHARED_LIBS=ON"
fi
if [ "\$BUILD_C_INTERFACE" = "ON" ]; then
OPTIONS="\$OPTIONS -DBUILD_C_INTERFACE=ON -DC_REAL_TYPE=\$C_REAL_TYPE"
fi
if [ "\$TESTING" = "ON" ]; then
OPTIONS="\$OPTIONS -DTESTING=ON"
else
OPTIONS="\$OPTIONS -DTESTING=OFF"
fi
if [ "\$VERBOSE" = "ON" ]; then
OPTIONS="\$OPTIONS -DCMAKE_VERBOSE_MAKEFILE=ON"
fi
if [ ! "\$BOOST_ROOT" = "" ]; then
OPTIONS="\$OPTIONS -DBOOST_ROOT=\$BOOST_ROOT"
fi
if [ ! "\$HDF5_ROOT" = "" ]; then
OPTIONS="\$OPTIONS -DHDF5_ROOT=\$HDF5_ROOT"
fi
OPTIONS="\$OPTIONS -DUSE_SILO=\$USE_SILO"
if [ "\$USE_PYTHON" = "ON" ]; then
OPTIONS="\$OPTIONS -DUSE_PYTHON=ON -DPYTHON_EXE=\$PYTHON_EXE"
fi
# Remove any existing cached data.
rm -f CMakeCache.txt
# Configure the build.
echo "Executing: cmake -Wno-dev \
-DCMAKE_INSTALL_PREFIX:PATH=\$PREFIX \
-DCMAKE_BUILD_TYPE=\$BUILD_TYPE \
-DCMAKE_C_COMPILER=\$CC \
-DCMAKE_CXX_COMPILER=\$CXX \
\$OPTIONS \
-G "\$GENERATOR" \
\$SOURCE_DIR"
cmake -Wno-dev \
-DCMAKE_INSTALL_PREFIX:PATH=\$PREFIX \
-DCMAKE_BUILD_TYPE=\$BUILD_TYPE \
-DCMAKE_C_COMPILER=\$CC \
-DCMAKE_CXX_COMPILER=\$CXX \
\$OPTIONS \
-G "\$GENERATOR" \
\$SOURCE_DIR
EOT
# Give instructions.
echo "Your build directory $1 is ready."
echo "To configure your build:"
echo " 1. cd $1"
echo " 2. Edit config.sh"
echo " 3. sh config.sh"
echo " 4. Build using 'make', 'ninja', or your selected IDE."