-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-casadi-static.sh
46 lines (40 loc) · 1.11 KB
/
install-casadi-static.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
#!/usr/bin/env bash
cd "$( dirname "${BASH_SOURCE[0]}" )"/..
prefix="$1" # Installation directory prefix
build_type="${2:-RelWithDebInfo}"
version="3.5.5"
if [ -z "$prefix" ]; then
if [ -z "$VIRTUAL_ENV" ]; then
echo "No active virtual environment, refusing to install."
exit 1
else
prefix="$VIRTUAL_ENV"
fi
fi
set -ex
export CMAKE_PREFIX_PATH="$prefix:$CMAKE_PREFIX_PATH"
export PKG_CONFIG_PATH="$prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
pushd /tmp
# CasADi
[ -d casadi ] \
|| git clone --single-branch --depth=1 --branch "$version" --recursive \
https://github.com/casadi/casadi
pushd casadi
cmake -S. -Bbuild \
-G "Ninja Multi-Config" \
-D CMAKE_INSTALL_PREFIX="$prefix" \
-D CMAKE_POSITION_INDEPENDENT_CODE=On \
-D WITH_COMMON=Off \
-D WITH_PYTHON=Off \
-D WITH_PYTHON3=Off \
-D WITH_OPENMP=Off \
-D WITH_THREAD=On \
-D WITH_DL=On \
-D WITH_IPOPT=Off \
-D ENABLE_STATIC=On \
-D ENABLE_SHARED=Off \
-D CMAKE_OSX_ARCHITECTURES="arm64;x86_64"
cmake --build build -j --config $build_type
cmake --install build --config $build_type
popd
popd