opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
759 stars 308 forks source link

Fix SWIG binding generation fails if cmake is ran from opensim-core #3704

Closed adamkewley closed 4 months ago

adamkewley commented 4 months ago

Encountered when building opensim-core from within its source dir. Error:

gmake[2]: *** No rule to make target 'Bindings/Python/Bindings/preliminaries.i', needed by 'Bindings/Python/simbody.py'.  Stop.
gmake[1]: *** [CMakeFiles/Makefile2:6844: Bindings/Python/CMakeFiles/_simbody.dir/all] Error 2

Invocation Example:

cmake -S . -LAH -B ../opensim-build -DOPENSIM_DEPENDENCIES_DIR=${PWD}/../deps-install -DOPENSIM_WITH_CASADI=OFF -DOPENSIM_WITH_TROPTER=OFF -DBUILD_JAVA_WRAPPING=ON -DBUILD_PYTHON_WRAPPING=ON -DSWIG_DIR=~/swig/share/swig -DSWIG_EXECUTABLE=~/swig/bin/swig -DCMAKE_BUILD_TYPE=Release -DOPENSIM_DOXYGEN_USE_MATHJAX=OFF

The failure is because execute_process's working directory is wherever cmake is ran, and this can cause extra entries to be added to the swig invocation

Brief summary of changes

Testing I've completed

Looking for feedback on...

CHANGELOG.md (choose one)


This change is Reviewable