Menu

MacBuild

Mac (3) build (5)
strobelight Martin Fischer Adam Richards Russell Shilling

MacOSX Build

Prerequisites

Note: these steps are known to work on an Intel MAC running 14.7 (Sonoma)

To build, you will need to install the following dependencies - I recommend using <www.macports.org> to obtain them:</www.macports.org>

  • gtk2
  • libzip
  • freeimage
  • cmocka
  • mxml
  • inkscape
  • zlib
  • dbus - this is actually a runtime dependency

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

cd ~
mkdir -p src
cd src
# this is to make sure cloning into non-existant directory, skip if using a different name
rm -rf xtrkcad
# clone source from options branch or tag into xtrkcad directory, change name if desired
hg clone http://hg.code.sf.net/p/xtrkcad-fork/xtrkcad  [-u "V5.3.0 GA" ]  xtrkcad

Pull the branch you need if you didn't use the -u option on clone

cd ~/src/xtrkcad
hg update branch-name

Build

Create build and install directories

cd ~
mkdir -p build/xtrkcad
mkdir -p install/xtrkcad/bin

Configure and build

export LIBRARY_PATH=/opt/local/lib
cmake \
      -DCMAKE_BUILD_TYPE=Debug \
      -DCMAKE_INSTALL_PREFIX=~/install/xtrkcad \
      -S ~/src/xtrkcad -B ~/build/xtrkcad
cd ~/build/xtrkcad
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. Note: ensure the XQuartz version is compatible with the OSX version.

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

lldb xtrkcad
>r

Package

To package the app for distribution

cd ~/build/xtrkcad/distribution/osx/gtk-bundle
mkdir bin
mkdir share
./xtrkcad-bundler.sh -i ~/install/xtrkcad -v [version]

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


Related

Wiki: BuildNotes
Wiki: MacInstall

MongoDB Logo MongoDB