Install brew on OSX.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After installing brew, we can use brew to install wget (so you can download files from the command-line):
brew install wget
We need cmake to configure and build OpenMesh and MeshMonk. We're copying here the installation instructions from this page:
- Download the latest binary distribution for Mac OSX from the Downloads page
- Open the resulting .dmg-file you just downloaded
- Drag and drop the CMake icon to the Applications folder icon.
- Launch CMake (from you Applications folder, for example)
- Add CMake to your path so you can call it from command-line:
sudo mkdir -p /usr/local/bin
sudo /Applications/CMake.app/Contents/bin/cmake-gui --install=/usr/local/bin
- Verify your installation (you might have to close and open a new Terminal):
cmake --version
- Use brew to install eigen
brew install eigen
or upgrade:
brew upgrade eigen
- Make a symlink to the main 'Eigen' folder from /usr/local/include/ so that you can include Eigen in your projects.
ln -s /usr/local/Cellar/eigen/3.3.7/include/eigen3/Eigen /usr/local/include/Eigen
Like Eigen, nanoflann is also a header-only library. There is only one header file you need, so we deliver that in the meshmonk repository under '/vendor' directory. So all that's left is to copy that to /usr/local/include:
sudo cp /home/user/projects/meshmonk/vendor/nanoflann.hpp /usr/local/include/
cd /Users/user/Downloads/
wget http://www.openmesh.org/media/Releases/6.3/OpenMesh-6.3.zip
unzip OpenMesh-6.3.zip
cd OpenMesh-6.3
mkdir build
cd build
cmake ..
make
Copy/paste the .dylib files:
sudo sudo cp Build/lib/*.* /usr/local/lib/
Copy/paste the header files
cp -R /Users/user/Downloads/OpenMesh-6.3/src/OpenMesh /usr/local/include/
Make a 'projects' folder in your home directory and go into it(or go into a directory you are already using for GitHub projects):
cd
mkdir projects
cd projects
Clone the online MeshMonk repository
git clone https://github.com/TheWebMonks/meshmonk.git
Enter the subfolder with the c++ sourcecode and use make
to compile it. As an alternative to this step, you may use the precompiled version of 'libmeshmonk.dylib' in the 'builds' folder of the meshmonk download.
cd meshmonk
make
From the meshmonk folder, copy the shared library object libmeshmonk.dylib to /usr/local/lib
cp libmeshmonk.dylib /usr/local/lib
Copy the header files to /usr/local/include/
(cd /Users/user/projects/meshmonk/ && find . -name '*.hpp' -print | tar --create --files-from -) | (cd /usr/local/include/ && sudo tar xvfp -)