diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml new file mode 100644 index 0000000..b9f63f2 --- /dev/null +++ b/.github/workflows/continuous_integration.yml @@ -0,0 +1,260 @@ +name: continuous-integration + +# syntax https://help.github.com/en/articles/workflow-syntax-for-github-actions +on: + # Run at 2am every night. + schedule: + - cron: '0 2 * * *' + pull_request: + branches: + - '*' + +jobs: + windows37: + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v1 + + - name: Install Python packages + uses: actions/setup-python@v2 + with: + python-version: '3.7' + + - name: Install numpy + #Need numpy to use SWIG numpy typemaps. + run: python -m pip install numpy==1.20 + + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + - name: Install conda-build + run: conda install conda-build + + - name: Conda build + run: | + chdir $env:GITHUB_WORKSPACE + conda build . + + - name: upload artifact + uses: actions/upload-artifact@v2 + with: + name: win64-opensim-moco-4.4-py37np120.tar.bz2 + path: C:/Miniconda3/envs/test/conda-bld/win-64/opensim-moco-4.4-py37np120.tar.bz2 + windows38: + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v1 + + - name: Install Python packages + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install numpy + #Need numpy to use SWIG numpy typemaps. + run: python -m pip install numpy==1.20 + + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + - name: Install conda-build + run: conda install conda-build + + - name: Conda build + run: | + chdir $env:GITHUB_WORKSPACE + conda build . + + - name: upload artifact + uses: actions/upload-artifact@v2 + with: + name: win64-opensim-moco-4.4-py38np120.tar.bz2 + path: C:/Miniconda3/envs/test/conda-bld/win-64/opensim-moco-4.4-py38np120.tar.bz2 + windows39: + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v1 + + - name: Install Python packages + uses: actions/setup-python@v2 + with: + python-version: '3.9' + + - name: Install numpy + #Need numpy to use SWIG numpy typemaps. + run: python -m pip install numpy==1.20 + + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + - name: Install conda-build + run: conda install conda-build + + - name: Conda build + run: | + chdir $env:GITHUB_WORKSPACE + conda build . + + - name: upload artifact + uses: actions/upload-artifact@v2 + with: + name: win64-opensim-moco-4.4-py39np120.tar.bz2 + path: C:/Miniconda3/envs/test/conda-bld/win-64/opensim-moco-4.4-py39np120.tar.bz2 + + mac: + name: Mac + + runs-on: macos-10.15 + + steps: + - uses: actions/checkout@v1 + + - name: Install Homebrew packages + # Save the gfortran version to a file so we can use it in the cache key. + run: | + brew install cmake pkgconfig autoconf libtool automake wget pcre doxygen python@3.8 + brew reinstall gcc + pip3 install numpy==1.20.2 + gfortran -v + mkdir gfortran_version + gfortran -v &> gfortran_version/gfortran_version.txt + + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + + - name: Install conda-build + run: conda install conda-build + + - name: Conda build + run: | + cd $GITHUB_WORKSPACE + conda build . + + ubuntu37: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + + - name: Install packages + run: sudo apt-get update && sudo apt-get install --yes build-essential libtool autoconf pkg-config gfortran libopenblas-dev liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen python3.7 python3-dev python3-numpy python3-setuptools + + - name: Install SWIG + run: | + mkdir ~/swig-source && cd ~/swig-source + wget https://github.com/swig/swig/archive/refs/tags/rel-4.0.2.tar.gz + tar xzf rel-4.0.2.tar.gz && cd swig-rel-4.0.2 + sh autogen.sh && ./configure --prefix=$HOME/swig --disable-ccache + make && make -j4 install + + - name: Install conda-build + run: conda install conda-build + + - name: Conda build + run: | + cd $GITHUB_WORKSPACE/opensim + conda build . + + - name: upload artifact + uses: actions/upload-artifact@v2 + with: + name: linux64-opensim-moco-4.4-py37np120.tar.bz2 + path: /usr/share/miniconda3/conda-bld/linux-64/opensim-moco-4.4-py37np120.tar.bz2 + ubuntu38: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + + - name: Install packages + run: sudo apt-get update && sudo apt-get install --yes build-essential libtool autoconf pkg-config gfortran libopenblas-dev liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen python3.8 python3-dev python3-numpy python3-setuptools + + - name: Install SWIG + run: | + mkdir ~/swig-source && cd ~/swig-source + wget https://github.com/swig/swig/archive/refs/tags/rel-4.0.2.tar.gz + tar xzf rel-4.0.2.tar.gz && cd swig-rel-4.0.2 + sh autogen.sh && ./configure --prefix=$HOME/swig --disable-ccache + make && make -j4 install + + - name: Install conda-build + run: conda install conda-build + + - name: Conda build + run: | + cd $GITHUB_WORKSPACE/opensim-moco + conda build . + + - name: upload artifact + uses: actions/upload-artifact@v2 + with: + name: linux64-opensim-moco-4.4-py38np120.tar.bz2 + path: /usr/share/miniconda3/conda-bld/linux-64/opensim-moco-4.4-py38np120.tar.bz2 + ubuntu39: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + miniconda-version: "latest" + + - name: Install packages + run: sudo apt-get update && sudo apt-get install --yes build-essential libtool autoconf pkg-config gfortran libopenblas-dev liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen python3 python3-dev python3-numpy python3-setuptools + + - name: Install SWIG + run: | + mkdir ~/swig-source && cd ~/swig-source + wget https://github.com/swig/swig/archive/refs/tags/rel-4.0.2.tar.gz + tar xzf rel-4.0.2.tar.gz && cd swig-rel-4.0.2 + sh autogen.sh && ./configure --prefix=$HOME/swig --disable-ccache + make && make -j4 install + + - name: Install conda-build + run: conda install conda-build + + - name: Conda build + run: | + cd $GITHUB_WORKSPACE/opensim + conda build . + + - name: upload artifact + uses: actions/upload-artifact@v2 + with: + name: linux64-opensim-moco-4.4-py39np120.tar.bz2 + path: /usr/share/miniconda3/conda-bld/linux-64/opensim-moco-4.4-py39np120.tar.bz2 + + style: + name: Style + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + + - name: Check for tabs + # Ensure that there are no tabs in source code. + # GREP returns 0 (true) if there are any matches, and + # we don't want any matches. If there are matches, + # print a helpful message, and make the test fail by using "false". + # The GREP command here checks for any tab characters in the the files + # that match the specified pattern. GREP does not pick up explicit tabs + # (e.g., literally a \t in a source file). + run: if grep --line-num --recursive --exclude-dir="*dependencies*" --exclude-dir="*snopt*" --include={CMakeLists.txt,*.cpp,*.c,*.h} -P "\t" . ; then echo "Tabs found in the lines shown above. See CONTRIBUTING.md about tabs."; false; fi diff --git a/.gitignore b/.gitignore index e4e5f6c..ebac222 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -*~ \ No newline at end of file +*~ +/opensim/.vs/ProjectSettings.json +/opensim/.vs/VSWorkspaceState.json +/opensim/.vs/opensim/v16/.suo +/opensim/.vs/slnx.sqlite diff --git a/.travis.yml b/.travis.yml index 1ca3c35..2f6bd73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python python: # We don't actually use the Travis Python, but this keeps it organized. - - "2.7" + - "3.7" install: - sudo apt-get update # We do this conditionally because it saves us some downloading if the @@ -24,4 +24,4 @@ install: - conda-build opensim script: - # Your test script goes here \ No newline at end of file + # Your test script goes here diff --git a/README.md b/README.md index ee45ebc..8bc12e0 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ # conda-opensim -Unofficial conda recipe for OpenSim 4.0-alpha +Unofficial conda recipe for OpenSim 4.4 Usage: cd conda-opensim conda build opensim -For python 3, use the python3 branch and - - conda build opensim --python 3.5 +Only python 3 is supported. Default settings/package doesn't include Moco diff --git a/opensim/bld.bat b/opensim/bld.bat index 2676419..56ee279 100644 --- a/opensim/bld.bat +++ b/opensim/bld.bat @@ -1,21 +1,42 @@ mkdir opensim_dependencies_build cd .\opensim_dependencies_build cmake ..\dependencies^ - -G"Visual Studio 14 2015 Win64"^ - -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" + -G"Visual Studio 16 2019"^ + -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%"^ + -DSUPERBUILD_ezc3d=ON^ + -DOPENSIM_WITH_TROPTER=ON^ + -DOPENSIM_WITH_CASADI=ON + cmake --build . --config Release -- /maxcpucount:8 cd .. - mkdir opensim_build cd .\opensim_build cmake ..\^ - -G"Visual Studio 14 2015 Win64"^ + -G"Visual Studio 16 2019"^ -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%"^ -DOPENSIM_DEPENDENCIES_DIR="%LIBRARY_PREFIX%"^ + -DCMAKE_INSTALL_INCLUDEDIR="%LIBRARY_PREFIX%/include"^ + -DCMAKE_INSTALL_LIBDIR="%LIBRARY_PREFIX%/lib"^ + -DCMAKE_INSTALL_DOCDIR="%LIBRARY_PREFIX%/doc"^ + -DCMAKE_INSTALL_SYSCONFDIR="%LIBRARY_PREFIX%/Library"^ + -DOPENSIM_INSTALL_PYTHONDIR="%LIBRARY_PREFIX%/Lib/site-packages"^ + -DOPENSIM_INSTALL_SIMBODYDIR="%LIBRARY_PREFIX%/Library/Simbody"^ + -DOPENSIM_INSTALL_SPDLOGDIR="%LIBRARY_PREFIX%/Library/spdlog"^ + -DOPENSIM_INSTALL_CASADIDIR="%LIBRARY_PREFIX%/Library"^ -DBUILD_PYTHON_WRAPPING=ON^ - -DWITH_BTK=ON + -DOPENSIM_C3D_PARSER=ezc3d^ + -DOPENSIM_PYTHON_STANDALONE=ON^ + -DOPENSIM_WITH_CASADI=ON^ + -DOPENSIM_WITH_TROPTER=ON^ + -DBUILD_TESTING=OFF^ + -DBUILD_API_EXAMPLES=OFF^ + -DOPENSIM_BUILD_INDIVIDUAL_APPS=OFF^ + -DOPENSIM_PYTHON_CONDA=ON cmake --build . --target install --config Release -- /maxcpucount:8 -cp %LIBRARY_PREFIX%\simbody\bin\simbody-visualizer.exe %PREFIX%\simbody-visualizer.exe -cd %LIBRARY_PREFIX%\sdk\python +Rem move Library\sdk\Python Lib +move %LIBRARY_PREFIX%\sdk\Python %LIBRARY_PREFIX%\..\Lib +cd %LIBRARY_PREFIX%\..\Lib +Rem python setup_win_python38.py conda python setup.py install + diff --git a/opensim/build.sh b/opensim/build.sh index 663be19..2bdc03c 100644 --- a/opensim/build.sh +++ b/opensim/build.sh @@ -1,30 +1,52 @@ #!/bin/bash - -export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - # TODO: Dependencies should be separate packages... mkdir opensim_dependencies_build cd opensim_dependencies_build -cmake ../dependencies/ \ +cmake ../dependencies/ -LAH \ -DCMAKE_INSTALL_PREFIX="$PREFIX" \ - -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT} \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \ + -DSUPERBUILD_docopt=ON \ + -DSUPERBUILD_simbody=ON \ + -DSUPERBUILD_spdlog=ON \ + -DSUPERBUILD_ezc3d=ON \ + -DOPENSIM_WITH_TROPTER=ON \ + -DOPENSIM_WITH_CASADI=ON + make -j8 cd .. -cp -r $PREFIX/BTK/lib/btk-0.4dev/* $PREFIX/lib/ -cp -r $PREFIX/simbody/libexec/simbody/* $PREFIX/bin/ +# cp -r $PREFIX/simbody/libexec/simbody/* $PREFIX/bin/ +if [ "$(uname)" == "Darwin" ]; then + SWIG_DIR_SPEC=/usr/local/Cellar/swig/4.0.2 +else + SWIG_DIR_SPEC=~/swig/share/swig +fi # TODO: Tests are missing! mkdir opensim_build cd opensim_build cmake ../ \ -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DCMAKE_INSTALL_LIBDIR=lib \ -DCMAKE_BUILD_TYPE=Release \ -DOPENSIM_DEPENDENCIES_DIR="$PREFIX" \ + -DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT} \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \ + -DSWIG_DIR=${SWIG_DIR_SPEC} \ + -DSWIG_EXECUTABLE=~/swig/bin/swig \ -DBUILD_PYTHON_WRAPPING=ON \ - -DBUILD_JAVA_WRAPPING=OFF \ - -DPYTHON_VERSION_MAJOR=3 \ - -DPYTHON_VERSION_MINOR=6 \ - -DWITH_BTK=ON + -DOPENSIM_DISABLE_LOG_FILE=ON \ + -DOPENSIM_C3D_PARSER=ezc3d \ + -DBUILD_TESTING=OFF \ + -DOPENSIM_PYTHON_STANDALONE=ON \ + -DOPENSIM_INSTALL_UNIX_FHS=ON \ + -DBUILD_API_ONLY=ON \ + -DOPENSIM_BUILD_INDIVIDUAL_APPS_DEFAULT=OFF \ + -DOPENSIM_COPY_DEPENDENCIES=ON \ + -DOPENSIM_WITH_TROPTER=ON \ + -DOPENSIM_WITH_CASADI=ON make -j8 make install diff --git a/opensim/conda_build_config.yaml b/opensim/conda_build_config.yaml new file mode 100644 index 0000000..3164d1d --- /dev/null +++ b/opensim/conda_build_config.yaml @@ -0,0 +1,18 @@ +MACOSX_DEPLOYMENT_TARGET: '10.10' +python: + - 3.7 + - 3.8 + - 3.9 +numpy: + - 1.20 +c_compiler: + - vs2019 # [win] + - clang # [osx] + - gcc # [linux] +cxx_compiler: + - vs2019 # [win] + - clangxx # [osx] + - gxx # [linux] +CONDA_BUILD_SYSROOT: + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk + diff --git a/opensim/meta.yaml b/opensim/meta.yaml index c4c048d..0606c96 100644 --- a/opensim/meta.yaml +++ b/opensim/meta.yaml @@ -1,40 +1,46 @@ -package: - name: opensim - version: "4.0.0" +{% set version = "4.4" %} -#source: -# fn: OpenSim-40-source.zip -# url: https://github.com/opensim-org/opensim-core/archive/v4.0.0_alpha.zip -# sha256: dd425e886f394098533142652e246b375c8fb4d69246f0ffffcdd63bbbdb39c3 +package: + name: opensim-moco + version: {{ version }} source: -# path: /home/kidzik/workspace/opensim-core git_url: https://github.com/opensim-org/opensim-core.git - git_rev: 399c8d57a779dd5dde2916192f8b92bfc959e269 #beta - + git_rev: branch_4.4 build: - number: 12 - # NOTE : For C++11 builds, vc14/VS 2015 are the only acceptable targets - # which only Python 3.5 supports. So skip previous Python versions. - # skip: true # [win and not py35] + number: 2 + # NOTE : For C++11 builds, vc16/VS 2019 are the only acceptable targets features: - - vc14 # [win and py35] + - vc16 # [win and py39] # NOTE : This is needed to ensure the paths to Simbody's binaries, like # simbody-visualizer, are corrected. detect_binary_files_with_prefix: true - + string: py{{ CONDA_PY }}np{{ CONDA_NPY }} requirements: - run: - - python - - openblas - - freeglut - build: - - swig - - toolchain - - cmake >=2.8.6 + host: + - openblas # [not win] + build: + - toolchain 2.4.0 0 # [win] + - wheel 0.36.2 pyhd3eb1b0_0 + - swig 4.0.2 + - cmake >=3.15 + - numpy {{ numpy }} + - python {{ python }} + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - openblas # [not win] + - make # [not win] + + run: - python - # - python # [win] + - numpy + - freeglut # [win] + - openblas # [not win] +test: + # imports: + # - opensim + about: home: http://opensim.stanford.edu license: Apache-2.0 @@ -44,4 +50,5 @@ about: extra: recipe-maintainers: + - aymanhab - kidzik