I’m trying to compile a project that uses the CGAL Library (http://www.cgal.org/index.html).
I have installed the latest version of CGAL and Boost using homebrew and I can compile and run all the examples that comes with CGAL-4.7
In order to compile the examples as command-line applications in Xcode 6.4, All I have to do is to set the correct header and library paths in project build settings, and add the correct .dylib files in project build phases. This works great and I get them compiled and running.
When I try to do the same with an OF9.2 project, I can compile some CGAL headers but others not. Mostly it complains at the point where it tries to link to some Boost files.
I know there is an ofxCGAL addon, but I have the same problems with it.
I am in OSX 10.10 Xcode 6.4 OF 0.9.2
Can anyone help me ?
these are some of the compiling/linking errors (too many to post here):
/aligned_storage.hpp:31:7: error: redefinition of ‘alignment_of_max_align’
, alignment_of_max_align = ::boost::alignment_ofboost::detail::max_align::value
usr/local/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp:30:29: error: no type named ‘enable_if_has_type’ in namespace ‘boost’
, typename boost::enable_if_has_type<BOOST_FUSION_FOLD_IMPL_ENABLER(State)>::type
/usr/local/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp:56:17: error: cannot combine with previous ‘(error)’ declaration specifier
, typename result_of::next::type
I finally figured it out. The problem was that OF was already building and linking boost, however, the one that comes with the OF dist is incomplete.
So the steps to get this going was:
1 - Use homebrew to install CGAL and Boost (brew install cgal)
Check that you have it correctly installed in folder /usr/local/lib and /usr/local/include
2 - Create (or duplicate) a new OF project
3 - In the project (and target) build settings, set C++ Language Dialect to GNU++11 and C++ Standard Library to libc++
4 - Add /usr/local/include and /usr/local/lib to User Headers and Libs search paths at project build settings
5 - In CoreOF.xconfig change the lines where it looks for the boos lib and headers to this:
HEADER_BOOST = “/usr/local/include”
LIB_BOOST_SYSTEM = “/usr/local/lib/libboost_system.a”
LIB_BOOST_FS = “/usr/local/lib/libboost_filesystem.a”
6 - Add the following libs in target build phases (click on the “+”, click on “add other”, when the finder window opens do “option + /” to type a folder name, type /usr/local/lib)
This steps are enough to get CGAL working inside an OF project.
If you want to compile the ofxCGAL addon (https://github.com/yusuketomoto/ofxCGAL)
You have also to install the Eigen3 library (http://eigen.tuxfamily.org/). I use CMAKE Gui version to create the build files for Xcode and then compile it.
After that you should add the folder /opt/local/include/eigen3 to your header search paths in build settings
Hope this helps !