-
Notifications
You must be signed in to change notification settings - Fork 78
Building libcmaes on Mac OSX
Emmanuel Benazera edited this page Jan 7, 2015
·
21 revisions
Instructions for compiling on OSX Maverick (10.9) [untested on other versions] with Mac Ports. Similar instructions should work for Homebrew users as well.
- install macports
- install required packages
sudo port install autoconf
sudo port install automake
sudo port install eigen3
sudo port install gflags
- build libcmaes
git clone https://github.com/beniz/libcmaes.git
cd libcmaes
./autogen.sh
./configure --with-eigen3-include=/opt/local/include/eigen3 CXXFLAGS="-I/opt/local/include -O3" LDADD=-lgflags LDFLAGS=-L/opt/local/lib
make
- test libcmaes
./tests/test_functions
should return results of a run on fsphere in 2-D.
To use the Python bindings:
- install the additional packages:
sudo port install boost +gcc48
sudo port install py-numpy
- configure and compile:
./configure --with-eigen3-include=/opt/local/include/eigen3 CXXFLAGS="-I/opt/local/include -O3 -I/opt/local//Library/Frameworks/Python.framework/Versions/2.7/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include" LDADD=-lgflags LDFLAGS="-L/opt/local/lib" BOOST_LDFLAGS=-L/opt/local/lib --enable-python PYTHON=/opt/local/bin/python PYTHON_EXTRA_LDFLAGS="-u _PyMac_Error" LDFLAGS="-L/opt/local/lib `python-config --ldflags` `python-config --libs`"
make
- run:
cd python
export DYLD_LIBRARY_PATH=../src/.libs
/opt/local/bin/python ptest_bounds.py
- install macports and export PATH:
export PATH=$PATH:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/local/git/bin
- install gcc-47 or higher (gcc-48, gcc-49) from macports
sudo port install gcc48
sudo port install autoconf
sudo port install automake
- install eigen3 from macports
sudo port install eigen3
- install gflags from macports:
sudo port install gflags +gcc48
- get libcmaes from github:
git clone https://github.com/beniz/libcmaes.git
- configure libcmaes:
./autogen.sh
./configure CC=/opt/local/bin/gcc CXX=/opt/local/bin/g++ --with-eigen3-include=/opt/local/include/eigen3 CXXFLAGS="-lstdc++ -I/opt/local/include -O4" LDADD=-lgflags LDFLAGS=-L/opt/local/lib
- build libcmaes
make
- test libcmaes
./tests/test_functions
should return results of a run on fsphere in 2-D.
The bindings have dependencies on:
- boost-python
- numpy Install both as needed:
sudo port install boost +gcc48
sudo port install py-numpy
Configure and build:
./autogen.sh
./configure CC=/opt/local/bin/gcc CXX=/opt/local/bin/g++ --with-eigen3-include=/opt/local/include/eigen3 CXXFLAGS="-lstdc++ -I/opt/local/include -O4 -I/opt/local/include/ -I/opt/local//Library/Frameworks/Python.framework/Versions/2.7/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include" LDADD=-lgflags LDFLAGS="-L/opt/local/lib" BOOST_LDFLAGS=-L/opt/local/lib --enable-python PYTHON=/opt/local/bin/python PYTHON_EXTRA_LDFLAGS="-u _PyMac_Error" LDFLAGS="-L/opt/local/lib `python-config --ldflags` `python-config --libs`"
make
Test your bindings:
cd python
export DYLD_LIBRARY_PATH=../src/.libs
/opt/local/bin/python ptest_bounds.py