CopperSpice Overview  1.5.2
Building for Windows (MinGW)

This information pertains to building CopperSpice and developing applications on Windows. CopperSpice and your applications can be developed using any editor such as VI, emacs, or Diamond and built using CMake or Autotools. For an integrated environment Visual Studio or Qt Creator can be used for development, building, testing, and deployment.

There are two supported approaches to build CopperSpice and your applications. You can use MSVC or MinGW.

  • If you are using MinGW you will need to install MSYS and MinGW as described below.
Note
Windows does not provide a Bourne shell as a standard component. In order to build CopperSpice a shell program is required to run the configure scripts. This is installed as part of the MSYS project.

Utilities (MSYS)

We recommend installing this version of MSYS as it provides GNU Make and several other tools designed to work with the MinGW version of GCC. The same version of MSYS is used for 32-bit and 64-bit systems.

We are using MSYS revision 13 dated May 2013 msys+7za+wget+svn+git+mercurial+cvs-rev13.7z MSYS

MSYS uses your Windows path and adds an entry for the MSYS bin folder. If you want to change your MSYS path, do not specify a drive letter in your path. The MSYS BASH utility treats the path where MSYS resides as the 'root'. As an example, if MSYS was installed to C:\Msys you need to add '/bin' to your path. Internally MSYS will expand this to C:\Msys\bin.

The proper way to add or change your MSYS path is by altering the .bash_profile file. This file will be located in the location specified in USERPROFILE%. This is normally C:\Documents and Settings\<user> or C:\Users\<user>.

Add or modify the path entry to include the path where MSYS and MinGW where installed. In the following line '/bin' refers to MSYS\bin folder.

export PATH=/bin:/c/MinGW/bin:/c/windows/system32

As a Windows developer some of this configuration may seem odd, but this is a result of overlaying Unix file system behavior in a Windows environment. Once the configuration is set up and working it normally does not to be changed.

Compiler (MinGW)

MinGW is a development environment for Windows applications. It includes the GNU Compiler and other required tools. Since MinGW does not rely on any runtime DLL files, it is not necessary to distribute the source code with applications built using the GNU Compiler.

One of the tools in MinGW is GCC, which is the compiler for C, C++, and several other computer languages.

There are several different build versions of MinGW. We selected the "MinGW-Builds" project as it appears to be the most widely used and supported. The posix version was selected instead of the win32 version as the latter does not support modern C++ threads.

On Windows the binary files for CopperSpice are built using MinGW. There are links to the the exact version of MinGW on our website. MinGW Files

Building CS

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 the MSYS BASH prompt in the CopperSpice source directory (cs folder).

autoreconf -i


(2)    To configure CopperSpice using the default options, run configure from the MSYS BASH command line in the CopperSpice build folder. This syntax will leave the CopperSpice source untouched in the cs folder and put the CopperSpice build in cs_build folder during the make process.

../cs/configure


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

../cs/configure --prefix /f/cs_lib


An alternative to typing the prior command repeatedly, is to create a file like config-cs in the 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=gcc-7.3 CXX=g++-7.3 --prefix /f/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 library 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