Compiling - Mac OS X


1. Install Mac Developer Tools (Xcode)
2. Install Cmake. (If using the Mac package installer, click on "Install Link" to enable command-line access.
3. Install Glib2 and its dependencies.
4. Download and unpack OpenCPN source code
5. cd into the opencpn (top level) directory
6. Edit CMakeLists.txt and comment out the line (around 163) that reads "ADD_DEFINITIONS("`pkg-config --cflags --libs gtk+-2.0`") as clang doesn't like these options
7. mkdir build
8. cd build
9. cmake -G Xcode ../
10. Open Xcode and File->Open the OpenCPN.xcodeproj that should have been created in the build directory.
11. Select the "opencpn" active target & the "i386" active architecture.
12. Edit the source file tri.c and remove the 'inline' declaration from the function 
13. Hit "Build & Run" There will be a series of warnings from wxWidgets which can be dismissed by clicking on "Cancel".


OSX - Lion (Work in progress)

  1. Install XCode from App Store
  2. download wxWidgets-2.9.3.tar.bz2
  3. open terminal and make a source directory:
  4. mkdir ~/src
  5. cd ~/src
  6. tar jxf ~/Downloads/wxWidgets-2.9.3.tar.bz2
  7. cd wxWidgets-2.9.3
  8. mkdir macbuild
  9. cd macbuild/
  10. ../configure --enable-unicode --enable-debug --disable-shared --with-osx_cocoa --with-macosx-sdk=/Developer/SDKs/MacOSX10.7.sdk --with-macosx-version-min=10.7
  11. make
  12. sudo make install
  13. Download gettext-0.18.1.1.tar.gz
  14. cd ~/src
  15. tar zxf ~/Downloads/gettext-0.18.1.1.tar
  16. cd gettext-0.18.1.1/
  17. You need to patch gettext for Lion. Edit the file gettext-tools/gnulib-lib/stpncpy.c to add "#undef stpncpy" just before "#ifndef weak_alias". vim ../gettext-tools/gnulib-lib/stpncpy.c
  18. mkdir build_macos
  19. cd build_macos/
  20. ../configure
  21. make
  22. sudo make install
  23. Clone the OpenCPN source.
  24. Fix some code issues with 2.9.4... git remote add balp git@github.com:balp/OpenCPN.git ; git fetch --all ; git checkout balp/mac_osx_lion
  25. ./build_mac.sh