Menu

MacBuild

Build (2) Mac (3)
Adam Richards Russell Shilling

MacOSX Build

Prerequisites

To build, you will need to install the following dependencies - I recommend using <www.macports.org> to obtain them:
* gtk2
* libzip
* freeimage
* cmocka
* mxml
* inkscape
* zlib
* dbus - this is actually a runtime dependency</www.macports.org>

If you intend to build to use the internal webhelp (and not either a browser or the AppleHelp system) you will need
* webkit2-gtk

You will also need to install these tools
* Mercurial SCM - I recommend the TortoiseHg client which includes the Hg code
* CMake UI
* OSX compilers and other XCode command line developer tools that you can obtain for free from the App Store. Look for XCode Command Line Tools

If you want to package an .app file and make it into a .dmg so others can install it, you will also need to install this dependency with macports, or the equivalent
* gtk-mac-bundler

Create a source library directory and clone the Mercurial repo into it (I assume you create an src directory and you put an xtrkcad directory under it

mkdir src
cd src
hq clone sourceforge-repo xtrkcad
cd xtrkcad

Pull the branch you need

hg update branch-name

Build

Create a build and install directories

cd ~
mkdir build
cd build
mkdir xtrkcad
cd ~
mkdir install
cd install
mkdir xtrkcad

Configure the build

1) If you installed the GTK libraries from MacPorts you need to set export LIBRARY_PATH="/opt/local/lib"
2) Open the CMake App, set the build directory to ~/build/xtrkcad, and the install directory, set the build type to "Debug" and do ##Configure##.
3) Select default OSX toolchain options, then make sure GTK is selected redo ##Configure## and ##Generate##.

Make and install the code using a Terminal

make
make install

Run

Remember that to run XTrackCAD on OSX, you must have XQuartz installed - see MacInstall. Once you have this, you can navigate to the install directory, navigate to the bin directory inside it and then just run the binary.

If you want to interactively debug, you can use LLDB, the Mac debugger.

lldb xtrkcad

r

Package

To package the app for distribution

cd [builddirectory]/distribution/osx/gtk-bundle
bash xtrkcad-bundle -i [Cmake_install_directory] -v [version]

The TARed DMG will be in the [builddirectory]/bin folder with the name xtrkcad-OSX-[version].dmg.tar.gz


Related

Wiki: BuildNotes