Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking CGAL Library with XCode

Tags:

c++

xcode

cgal

I have installed CGAL using macports. I run CMake on an example and its running fine. So I tried to create a new project and pasted the code I needed from an example. So I have not link the CGAL libraries yet and unable to run the code. Im not sure how to link it in the build settings. Hope someone can guide me through.

Im trying to run the envelope2.cpp.

like image 506
user3266188 Avatar asked Jan 17 '15 03:01

user3266188


1 Answers

You mentioned MacPorts but here are instructions for Homebrew. They should be pretty similar but you might need to alter some of the paths from /usr/local to /opt/local.

Install libraries

brew install cgal

Add the includes

  • Open the project settings.
  • Select the project.
  • Choose the Build Settings tab.
  • Select the All filter.
  • Search for header search and you'll find the right setting: Found the setting
  • Double click on the path(s) next to Header Search Paths
  • Click the + button on the detail popup: enter image description here
  • Enter /usr/local/include/.
  • Click outside the detail popup to close it.

Add the libraries

  • Open the project settings.
  • Select the target.
  • Choose the General tab.
  • In the Linked Frameworks and Libraries section click the + button: enter image description here
  • You'll get a selection dialog:
    Add Framework and Library dialog
  • Click the Add Other... button and you'll get an open file dialog.
  • Hit Option + / to go to a specific a directory: Switch to /usr/local/lib
  • Enter /usr/local/lib, and click Go.
  • Select the following files (hold Command while clicking to select more than one at at time):
    • libboost_thread-mt.dylib
    • libCGAL.dylib
    • libCGAL_Core.dylib
    • libgmp.dylib
    • libmpfr.dylib
like image 143
drewish Avatar answered Nov 15 '22 03:11

drewish