Build PyGamma Wheels (OS X)

This document describes how to build PyGamma wheels for OS X.

Introduction

This document assumes you are building a 64-bit PyGamma.

Setup Compiler and Python

  1. Install XCode to get the OS X build toolchain.
  2. Ensure a modern 64-bit Python is in your path.
    • I used the Miniconda 64 bit Python 3 installer script for OSX.
    • Once miniconda is installed, use the conda create --name python37 python=3.7 command to set up a python 3.7 environment. Change the name or python version as needed for your compile
    • (optional) You can also compile for any other Python version for which you set up an environment.
  3. Install the wheel package in your conda environment. One of the below steps should work:
    • conda install wheel
    • conda install -c conda-forge wheel
    • pip install wheel
  4. Switch to the desired miniconda environment before doing the "Build PyGamma" steps below.

Download and Build SWIG.

  1. Download and untar the SWIG source code. I was able to use the latest (4.0.2 as of this writing).
  2. Build with sudo ./configure && sudo make && sudo make install

Build PyGamma

  1. Get the GAMMA source code via SVN.
  2. cd gamma/platforms/OSX
  3. (optional) make clean remove previous compile files
  4. make pysgdist
  5. cd ../../pygamma
  6. python setup.py bdist_wheel

The wheel file will be in the dist directory.

Note that the OS X Makefile and PyGamma's setup.py contain some special code to ensure the PyGamma wheel automatically gets the correct name.