-
Notifications
You must be signed in to change notification settings - Fork 7
/
configure
executable file
·44 lines (38 loc) · 1.4 KB
/
configure
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
# This script is executed automatically by R when
# a user installs osqp from the R command line using
# "R CMD install .". It builds the osqp static Library
# via cmake so that R can link to it if cmake exists
# in this system. Otherwise it will be built via
# the R Makevars system (e.g. because it is being
# built on the CRAN build farm)
# terminate on failure
set -e
set -x
# Per R-exts section on using CMAKE
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
CC=`"${R_HOME}/bin/R" CMD config CC`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
CXX=`"${R_HOME}/bin/R" CMD config CXX`
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
LDFLAGS=`"${R_HOME}/bin/R" CMD config LDFLAGS`
if [ -x "$(command -v cmake)" ]; then
echo "Making fixes to osqp_sources for CRAN"
(cd src && ${R_HOME}/bin/Rscript ../inst/58f00bd_fixes/make_fixes.R)
echo "-- Trying to build libosqp.a via cmake ..."
cd src/osqp_sources
mkdir -p build
cd build
cmake -DR_HOME="${R_HOME}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:bool=OFF -DCMAKE_POSITION_INDEPENDENT_CODE:bool=ON -DR_LANG=TRUE -DCMAKE_INSTALL_PREFIX:PATH=../../ ..
cmake --build . --target install
cd ..
rm -rf build/
cd ../../
echo "-- Built libosqp.a"
else
echo "-- cmake is not installed on this system. OSQP library libosqp.a will be built via custom makefile."
fi