diff --git a/ci/install_dart_latest.sh b/ci/install_dart_latest.sh index ce2a104f..8e10e431 100755 --- a/ci/install_dart_latest.sh +++ b/ci/install_dart_latest.sh @@ -1,9 +1,3 @@ -mkdir -p ~/.deps -cd ~/.deps - -python_dist_dir=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True, prefix=''))") -mkdir -p ~/.dart_install/$python_dist_dir - # Select Compiler if [ "$COMPILER" = "gcc" ]; then export CC=/usr/bin/gcc && export CXX=/usr/bin/g++ @@ -12,26 +6,58 @@ if [ "$COMPILER" = "clang" ]; then export CC=/usr/bin/clang && export CXX=/usr/bin/clang++ fi +PREFIX=/usr +DEPS_FOLDER=~/.deps +DART_TAG=v6.13.1 +SUDOCMD=sudo + +PREFIX=${1:-$PREFIX} +DEPS_FOLDER=${2:-$DEPS_FOLDER} +DART_TAG=${3:-$DART_TAG} +SUDOCMD=${4:-$SUDOCMD} + +python_dist_dir=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True, prefix=''))") +${SUDOCMD} mkdir -p ${PREFIX}/$python_dist_dir + +mkdir -p ${DEPS_FOLDER} +cd ${DEPS_FOLDER} + +if [ ! -d "dart" ] +then git clone https://github.com/dartsim/dart.git +fi cd dart git checkout $DART_TAG -mkdir build +git pull +mkdir -p build cd build # Build DART if [ "$BUILD_PYTHON" = "ON" ]; then -cmake -DDART_BUILD_DARTPY=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/home/runner/.dart_install .. +cmake -DDART_TREAT_WARNINGS_AS_ERRORS=OFF -DDART_BUILD_DARTPY=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=${PREFIX} .. else -cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/home/runner/.dart_install .. +cmake -DDART_TREAT_WARNINGS_AS_ERRORS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=${PREFIX} .. fi make -j4 -sudo make install +${SUDOCMD} make install +# We are inside the CI +if [ "$PREFIX" = "/home/runner/.dart_install" ]; then sudo ldconfig cd $CI_HOME # Hack for dartpy installation python_file=/usr/lib/python3/dist-packages/dartpy.cpython-310-x86_64-linux-gnu.so if [ -f "$python_file" ]; then -cp $python_file ~/.dart_install/$python_dist_dir +cp $python_file ${PREFIX}/$python_dist_dir +fi + +else +# Hack for dartpy installation +python_dot_version=$(python -c "import sys; print('.'.join(str(s) for s in sys.version_info[:2]))") +python_version=$(python -c "import sys; print(''.join(str(s) for s in sys.version_info[:2]))") +python_global_install=/usr/lib/python${python_dot_version}/site-packages/dartpy.cpython-${python_version}-x86_64-linux-gnu.so +if [ -f "$python_global_install" ]; then +${SUDOCMD} mv $python_global_install ${PREFIX}/$python_dist_dir +fi fi diff --git a/ci/install_magnum.sh b/ci/install_magnum.sh index a80aa1ab..654c41ba 100755 --- a/ci/install_magnum.sh +++ b/ci/install_magnum.sh @@ -7,8 +7,12 @@ export CC=/usr/bin/clang && export CXX=/usr/bin/clang++ fi PREFIX=/usr +DEPS_FOLDER=~/.deps +SUDOCMD=sudo PREFIX=${1:-$PREFIX} +DEPS_FOLDER=${2:-$DEPS_FOLDER} +SUDOCMD=${3:-$SUDOCMD} unameOut="$(uname -s)" case "${unameOut}" in @@ -30,43 +34,84 @@ if [ "$machine" == "Mac" ]; then PNGIMPORTER=OFF fi -mkdir -p ~/.deps -cd ~/.deps +mkdir -p ${DEPS_FOLDER} +cd ${DEPS_FOLDER} # install Corrade +if [ ! -d "corrade" ] +then git clone https://github.com/mosra/corrade.git cd corrade -mkdir build && cd build +else +cd corrade +git pull +fi +mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=${PREFIX} .. make -j -sudo make install +${SUDOCMD} make install cd ../.. # install Magnum +if [ ! -d "magnum" ] +then git clone https://github.com/mosra/magnum.git cd magnum -mkdir build && cd build +else +cd magnum +git pull +fi +mkdir -p build && cd build # Ubuntu/OSX -cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DMAGNUM_WITH_AUDIO=ON -DMAGNUM_WITH_DEBUGTOOLS=ON -DMAGNUM_WITH_GL=ON -DMAGNUM_WITH_MESHTOOLS=ON -DMAGNUM_WITH_PRIMITIVES=ON -DMAGNUM_WITH_SCENEGRAPH=ON -DMAGNUM_WITH_SHADERS=ON -DMAGNUM_WITH_TEXT=ON -DMAGNUM_WITH_TEXTURETOOLS=ON -DMAGNUM_WITH_TRADE=ON -DMAGNUM_WITH_GLFWAPPLICATION=ON -${WINDOWLESS}=ON -DMAGNUM_WITH_OPENGLTESTER=ON -DMAGNUM_WITH_ANYAUDIOIMPORTER=ON -DMAGNUM_WITH_ANYIMAGECONVERTER=ON -DMAGNUM_WITH_ANYIMAGEIMPORTER=ON -DMAGNUM_WITH_ANYSCENEIMPORTER=ON -DMAGNUM_WITH_MAGNUMFONT=ON -DMAGNUM_WITH_OBJIMPORTER=ON -DMAGNUM_WITH_TGAIMPORTER=ON -DMAGNUM_WITH_WAVAUDIOIMPORTER=ON -DMAGNUM_TARGET_EGL=${EGLTARGET} -DCMAKE_INSTALL_PREFIX=${PREFIX} .. +cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DMAGNUM_WITH_AUDIO=ON -DMAGNUM_WITH_DEBUGTOOLS=ON -DMAGNUM_WITH_GL=ON -DMAGNUM_WITH_MESHTOOLS=ON -DMAGNUM_WITH_PRIMITIVES=ON -DMAGNUM_WITH_SCENEGRAPH=ON -DMAGNUM_WITH_SHADERS=ON -DMAGNUM_WITH_TEXT=ON -DMAGNUM_WITH_TEXTURETOOLS=ON -DMAGNUM_WITH_TRADE=ON -DMAGNUM_WITH_SDL2APPLICATION=ON -DMAGNUM_WITH_GLFWAPPLICATION=ON -${WINDOWLESS}=ON -DMAGNUM_WITH_OPENGLTESTER=ON -DMAGNUM_WITH_ANYAUDIOIMPORTER=ON -DMAGNUM_WITH_ANYIMAGECONVERTER=ON -DMAGNUM_WITH_ANYIMAGEIMPORTER=ON -DMAGNUM_WITH_ANYSCENEIMPORTER=ON -DMAGNUM_WITH_MAGNUMFONT=ON -DMAGNUM_WITH_OBJIMPORTER=ON -DMAGNUM_WITH_TGAIMPORTER=ON -DMAGNUM_WITH_WAVAUDIOIMPORTER=ON -DMAGNUM_TARGET_EGL=${EGLTARGET} -DCMAKE_INSTALL_PREFIX=${PREFIX} .. make -j -sudo make install +${SUDOCMD} make install cd ../.. +# install Magnum Bindings +if [ ! -d "magnum-bindings" ] +then +git clone https://github.com/mosra/magnum-bindings.git +cd magnum-bindings +else +cd magnum-bindings +git pull +fi +mkdir -p build && cd build +cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DMAGNUM_WITH_GLFWAPPLICATION=ON -${WINDOWLESS}=ON -DMAGNUM_TARGET_EGL=${EGLTARGET} -DMAGNUM_WITH_PYTHON=ON -DCMAKE_INSTALL_PREFIX=${PREFIX} .. +make -j +${SUDOCMD} make install +cd src/python +${SUDOCMD} python setup.py install --root=${PREFIX} --prefix='' +cd ../../../.. + # install MagnumPlugins +if [ ! -d "magnum-plugins" ] +then git clone https://github.com/mosra/magnum-plugins.git cd magnum-plugins -mkdir build && cd build +else +cd magnum-plugins +git pull +fi +mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DMAGNUM_WITH_ASSIMPIMPORTER=ON -DMAGNUM_WITH_DDSIMPORTER=ON -DMAGNUM_WITH_JPEGIMPORTER=ON -DMAGNUM_WITH_OPENGEXIMPORTER=ON -DMAGNUM_WITH_PNGIMPORTER=${PNGIMPORTER} -DMAGNUM_WITH_TINYGLTFIMPORTER=ON -DMAGNUM_WITH_STBTRUETYPEFONT=ON -DCMAKE_INSTALL_PREFIX=${PREFIX} .. make -j -sudo make install +${SUDOCMD} make install cd ../.. # install MagnumIntegration +if [ ! -d "magnum-integration" ] +then git clone https://github.com/mosra/magnum-integration.git cd magnum-integration -mkdir build && cd build +else +cd magnum-integration +git pull +fi +mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DMAGNUM_WITH_DART=ON -DMAGNUM_WITH_EIGEN=ON -DCMAKE_INSTALL_PREFIX=${PREFIX} -DDART_DIR=$DART_DIR .. make -j -sudo make install +${SUDOCMD} make install cd ../.. if [ "$PREFIX" = "/usr" ]; then diff --git a/waf_tools/corrade.py b/waf_tools/corrade.py index 88372226..5f36d35e 100644 --- a/waf_tools/corrade.py +++ b/waf_tools/corrade.py @@ -48,6 +48,10 @@ def find_in_string(data, text): includes_check = [conf.options.corrade_install_dir + '/include'] libs_check = [conf.options.corrade_install_dir + '/lib'] bins_check = [conf.options.corrade_install_dir + '/bin'] + elif conf.options.magnum: + includes_check = [conf.options.magnum + '/include'] + libs_check = [conf.options.magnum + '/lib'] + bins_check = [conf.options.magnum + '/bin'] requested_components = kw.get('components', None) if requested_components == None: diff --git a/waf_tools/magnum.py b/waf_tools/magnum.py index 4a4677d9..88e241ac 100644 --- a/waf_tools/magnum.py +++ b/waf_tools/magnum.py @@ -134,6 +134,10 @@ def fatal(required, msg): includes_check = [conf.options.magnum_install_dir + '/include'] + includes_check libs_check = [conf.options.magnum_install_dir + '/lib'] + libs_check bins_check = [conf.options.magnum_install_dir + '/bin'] + bins_check + elif conf.options.magnum: + includes_check = [conf.options.magnum + '/include'] + includes_check + libs_check = [conf.options.magnum + '/lib'] + libs_check + bins_check = [conf.options.magnum + '/bin'] + bins_check requested_components = kw.get('components', None) if requested_components == None: diff --git a/waf_tools/magnum_integration.py b/waf_tools/magnum_integration.py index 4425f5a2..39980605 100644 --- a/waf_tools/magnum_integration.py +++ b/waf_tools/magnum_integration.py @@ -107,6 +107,10 @@ def find_in_string(data, text): includes_check = [conf.options.magnum_integration_install_dir + '/include'] + includes_check libs_check = [conf.options.magnum_integration_install_dir + '/lib'] + libs_check bins_check = [conf.options.magnum_integration_install_dir + '/bin'] + bins_check + elif conf.options.magnum: + includes_check = [conf.options.magnum + '/include'] + includes_check + libs_check = [conf.options.magnum + '/lib'] + libs_check + bins_check = [conf.options.magnum + '/bin'] + bins_check # OSX/Mac uses .dylib and GNU/Linux .so suffix = 'dylib' if conf.env['DEST_OS'] == 'darwin' else 'so' diff --git a/waf_tools/magnum_plugins.py b/waf_tools/magnum_plugins.py index 09c79ea2..39ae742e 100644 --- a/waf_tools/magnum_plugins.py +++ b/waf_tools/magnum_plugins.py @@ -113,6 +113,10 @@ def find_in_string(data, text): includes_check = [conf.options.magnum_plugins_install_dir + '/include'] + includes_check libs_check = [conf.options.magnum_plugins_install_dir + '/lib'] + libs_check bins_check = [conf.options.magnum_plugins_install_dir + '/bin'] + bins_check + elif conf.options.magnum: + includes_check = [conf.options.magnum + '/include'] + includes_check + libs_check = [conf.options.magnum + '/lib'] + libs_check + bins_check = [conf.options.magnum + '/bin'] + bins_check # OSX/Mac uses .dylib and GNU/Linux .so suffix = 'dylib' if conf.env['DEST_OS'] == 'darwin' else 'so' diff --git a/wscript b/wscript index 5f7d1cbd..306ebc91 100644 --- a/wscript +++ b/wscript @@ -45,6 +45,7 @@ def options(opt): opt.add_option('--python', action='store_true', help='compile python bindings', dest='pybind') opt.add_option('--no-robot_dart', action='store_true', help='only install the URDF library (utheque) / deactivate RobotDART', dest='utheque_only') opt.add_option('--no-pic', action='store_true', help='do not compile with position independent code', dest='no_pic') + opt.add_option('--magnum', type='string', help='path to all magnum related deps installation path', dest='magnum') def configure(conf):