CopperSpice Overview  1.5.1
Building for Mac OS X

This information pertains to building CopperSpice to develop applications on Mac OS X. To compile your applications with the CopperSpice libraries you will need to use the same utilities and compilers used to build CopperSpice.

The minimum supported version is Mac OS 10.12.

Note
Building with Autotools requires specifying a flag for C++14. Refer to Mac OS X Flags for specifics.

Xcode

Xcode is an IDE that contains software development tools for Mac OS X. The minimum supported version is 8.2.1 and is available for free from the App Store. There are several GNU tools in Xcode that are used for building CopperSpice and your applications.

To download Xcode go to the App Store and search for Xcode.

Compiler

CopperSpice and applications built with CopperSpice require Apple clang version 9.0.0 or newer.

If you want to use the Autotools build system you will need to install Automake, Autoconf, LibTool, and pkg-config. These are not supplied with Xcode. The required version information is listed in Building CopperSpice - Autotools.

If you want to use the CMake build system you will need to install CMake, which is not supplied with Xcode. The required version information is listed in Building CopperSpice - CMake.

Use Homebrew or MacPorts to install these utilities.

  • Homebrew can be downloaded and installed from: Homebrew
  • MacPorts can be downloaded and installed from: MacPorts

Building CopperSpice

For a typical CopperSpice setup refer to the table below.

Description Folder Name
CS source cs
CS build cs_build
CS install cs_lib

(1)    This step only needs to be run if CopperSpice has been checked out from the Git repository or the configure.ac file or any Makefile.am files have been modified. Running this command unnecessarily will not do any harm. This command is run from a Terminal window in the CopperSpice source directory (cs folder).

autoreconf -i


(2)    On Mac OS X clang is used to compile CopperSpice and your applications. To use clang you will need to add the following environment variables.

  • CC=clang
  • CXX=clang++
  • OBJCXX=clang++ -std=c++14

The CopperSpice libraries can be installed to a unique folder leaving the source, build, and system library folders untouched. The value for ––prefix specifies the CopperSpice install path.

../cs/configure --prefix $HOME/cs_lib


An alternative to typing the prior command repeatedly or adding the clang values to your environment, is to create a file like config-cs in your CS build folder. This file can pass the prefix and any other required options to configure. The following is a sample of a typical config-cs file.

../cs/configure CC=clang CXX=clang++ OBJCXX=clang++ --prefix $HOME/cs_lib


To run configure using the config-cs file, use the following command and syntax from the CopperSpice build directory (cs_build folder).

./config-cs


Note
If you want to override the CXXFLAGS you can not pass the changes to make on the command line. Instead, create a file like config-cs and pass the changes when running configure.
make CXXFLAGS='-O2' // does not do what you think


(3)    To compile the CopperSpice libraries use the following syntax from your CopperSpice build directory (cs_build folder). This step is run every time CopperSpice source code is changed.

make

From the build folder run the following command to delete all of the object and intermediate files. The next time 'make' is run every file will be compiled, since they were deleted.

make clean


(4)    To install the CopperSpice libraries and deploy to the location specified in ––prefix, use the following syntax. This step is done every time CopperSpice is deployed.

make install