PositionBasedDynamics icon indicating copy to clipboard operation
PositionBasedDynamics copied to clipboard

macOS compatibility

Open ruberith opened this issue 2 years ago • 3 comments

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.

ruberith avatar Apr 08 '22 17:04 ruberith

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: Screen Shot 2022-04-14 at 12 50 18 PM

amirhmk avatar Apr 14 '22 19:04 amirhmk

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.

ruberith avatar Apr 15 '22 10:04 ruberith

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.

ruberith avatar Apr 16 '22 12:04 ruberith