Building static GUIs on macOS - nrc-cnrc/EGSnrc GitHub Wiki

To compile standalone versions of EGSnrc Qt graphical user interfaces on macOS for a release:

  1. Clone a copy of EGSnrc, preferably on a fresh macOS install
  2. Configure EGSnrc as usual, using HEN_HOUSE/scripts/configure with configuration file name macos.conf
  3. Install homebrew with the following command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  4. Use homebrew to install qt4: brew install cartr/qt4/qt
    On newer OS X versions, try: brew install qt
  5. Find out the path to the Qt installation directory: brew info qt | grep Cellar
  6. Define a corresponding QTDIR environment variable: export QTDIR=/path/to/qt/
  7. Go to $HEN_HOUSE/gui/egs_gui and issue the make command
  8. Go to $HEN_HOUSE/bin/macos/ and issue the command macdeployqt egs_gui.app to create a portable bundle (with self-contained Qt run time libraries).
  9. Repeat steps 7-8 for $HEN_HOUSE/gui/egs_inprz
  10. Go to $HEN_HOUSE/egs++/view and issue the make command
  11. It is not possible to bundle egs_view, so extract the executable from the $HEN_HOUSE/bin/macos/egs_view.app/Contents/MacOS directory
  12. Find out the egs_view library path for the libegspp dynamic library: otool -L egs_view
  13. Update the egs_view library path for the libegspp library: install_name_tool -change /whatever/path/libegspp.dylib libegspp.dylib egs_view
  14. Put the binaries inside a directory EGSnrc-guis-macos and zip it

Note that qmake uses its own compiler configuration, in $QTDIR/mkspecs.