PositionBasedDynamics
PositionBasedDynamics copied to clipboard
macOS compatibility
These adaptations allow builds using Clang on recent versions of macOS (tested on Apple silicon):
- An updated and adapted version of Discregrid is used (see Discregrid#19). If the pull requests are accepted,
CMakeLists.txt
has to be updated to point to the original repository again. - Clang seems to mistake some version files for headers, so these are given an extension.
- The optimization flag
-mcpu=apple-m1
is used for Apple silicon, for which-march=native
is not yet supported. - OpenGL is deprecated for years on macOS, but still supported, so the corresponding warnings are silenced.
-
_NSGetExecutablePath
is used to find program paths on macOS. - numpy is available for Apple silicon since version 1.21.0. The highest supported version can possibly be updated in
setup.py
. - Recent versions of CMake automatically determine the correct flags for OpenMP and provide a target to link against. Nevertheless, Clang does not include an OpenMP implementation on macOS by default, but the user can easily install a build of LLVM libomp (e.g. via Homebrew) to be shared by all projects requiring OpenMP which is then detected by CMake.
Hi @ruberith, thank you for getting this to work on Mac! I'm a noob in C++, could you please tell me how you build and run the demos on MacOS? (M1 as well).
I can successfully generate the makefiles using cmake and build on the terminal, but I don't see any executables for the demos...
Which compiler do you use? GCC or clang (Apple's own version)
EDIT:
Actually I found the executables in the bin
folder. However, when I run the ClothDemo for example, the TweekBar is very small and hard to interact with. The rendering isn't super smooth either, is that to be expected?
See screenshot below:
If you hover over the TweakBar, you can find a small button at the top left to toggle between a few sizes. The bar also has an option to reduce the # time steps / update
of the visualization.
I previously did not notice the incorrect rendering of the bar, as I had an external monitor connected. Thank you for mentioning that issue, @amirhmk. AntTweakBar does not seem to handle the Framebuffer scale on Retina displays well, so the last commit should fix that.