1
- mkdir -p ~ /.deps
2
- cd ~ /.deps
3
-
4
- python_dist_dir=$( python -c " from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True, prefix=''))" )
5
- mkdir -p ~ /.dart_install/$python_dist_dir
6
-
7
1
# Select Compiler
8
2
if [ " $COMPILER " = " gcc" ]; then
9
3
export CC=/usr/bin/gcc && export CXX=/usr/bin/g++
@@ -12,26 +6,58 @@ if [ "$COMPILER" = "clang" ]; then
12
6
export CC=/usr/bin/clang && export CXX=/usr/bin/clang++
13
7
fi
14
8
9
+ PREFIX=/usr
10
+ DEPS_FOLDER=~ /.deps
11
+ DART_TAG=v6.13.1
12
+ SUDOCMD=sudo
13
+
14
+ PREFIX=${1:- $PREFIX }
15
+ DEPS_FOLDER=${2:- $DEPS_FOLDER }
16
+ DART_TAG=${3:- $DART_TAG }
17
+ SUDOCMD=${4:- $SUDOCMD }
18
+
19
+ python_dist_dir=$( python -c " from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True, prefix=''))" )
20
+ ${SUDOCMD} mkdir -p ${PREFIX} /$python_dist_dir
21
+
22
+ mkdir -p ${DEPS_FOLDER}
23
+ cd ${DEPS_FOLDER}
24
+
25
+ if [ ! -d " dart" ]
26
+ then
15
27
git clone https://github.com/dartsim/dart.git
28
+ fi
16
29
cd dart
17
30
git checkout $DART_TAG
18
- mkdir build
31
+ git pull
32
+ mkdir -p build
19
33
cd build
20
34
21
35
# Build DART
22
36
if [ " $BUILD_PYTHON " = " ON" ]; then
23
- cmake -DDART_BUILD_DARTPY=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/home/runner/.dart_install ..
37
+ cmake -DDART_TREAT_WARNINGS_AS_ERRORS=OFF - DDART_BUILD_DARTPY=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=${PREFIX} ..
24
38
else
25
- cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/home/runner/.dart_install ..
39
+ cmake -DDART_TREAT_WARNINGS_AS_ERRORS=OFF - DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=${PREFIX} ..
26
40
fi
27
41
make -j4
28
- sudo make install
42
+ ${SUDOCMD} make install
29
43
44
+ # We are inside the CI
45
+ if [ " $PREFIX " = " /home/runner/.dart_install" ]; then
30
46
sudo ldconfig
31
47
cd $CI_HOME
32
48
33
49
# Hack for dartpy installation
34
50
python_file=/usr/lib/python3/dist-packages/dartpy.cpython-310-x86_64-linux-gnu.so
35
51
if [ -f " $python_file " ]; then
36
- cp $python_file ~ /.dart_install/$python_dist_dir
52
+ cp $python_file ${PREFIX} /$python_dist_dir
53
+ fi
54
+
55
+ else
56
+ # Hack for dartpy installation
57
+ python_dot_version=$( python -c " import sys; print('.'.join(str(s) for s in sys.version_info[:2]))" )
58
+ python_version=$( python -c " import sys; print(''.join(str(s) for s in sys.version_info[:2]))" )
59
+ python_global_install=/usr/lib/python${python_dot_version} /site-packages/dartpy.cpython-${python_version} -x86_64-linux-gnu.so
60
+ if [ -f " $python_global_install " ]; then
61
+ ${SUDOCMD} mv $python_global_install ${PREFIX} /$python_dist_dir
62
+ fi
37
63
fi
0 commit comments