CopperSpice Overview
Building for Windows (MSVC)

This following information pertains to building CopperSpice from source and developing C++ applications on Windows using Visual Studio.

Installing MSVC

Download and install Visual Studio 2019 community edition version 16.6.x or newer.

Support for Visual Studio 2017 has been discontinued. It was discovered and confirmed by Microsoft their compiler was unable to handle valid C++11 and C++17 standards compliant code. These issues were resolved by the Microsoft development team however is was not back ported to prior versions of MSVC.

We are grateful for their willingness to continue compiler improvements by using CopperSpice in their conformance testing.

Building CopperSpice with MSVC

The following information explains how to build the CopperSpice libraries using MSVC. Developers should be familiar with the basic usage and layout of the Visual Studio IDE.

  • Building CopperSpice from source

    1. Import the CopperSpice source code and create a new project

      • Using the source located on our CopperSpice download page

        1. Download either the Tar or Zip source and then extract the archive
          https://download.copperspice.com/copperspice/source/
        2. In Visual Studio select File, Open, CMake
        3. Navigate to the CS source code and select the CMakeLists.txt file, which is located in the root folder

      • Using the source from the CopperSpice GitHub repository

        1. In Visual Studio select View, Team Explorer
        2. Select Projects, New Repository
        3. Select Clone option
        4. Enter the URL https://github.com/copperspice/copperspice.git
        5. Click on the "clone" button

    2. Now highlight the CMake menu option (located on the menu bar) and then select "Build All"
  • To change the build from Debug to Release mode.

    1. Highlight the CMake (located on the menu bar) and then select the "Change CMake Settings" option
    2. Select "copperspice"
    3. In the editor window change from Debug to Release mode as needed
      "configurationType": "Debug" to "configurationType": "Release"
    4. In the editor window modify the command line arguments as needed, adding "-k 0" will force the compile to keep going even when errors are encountered. The -v in the following command is for verbose mode.
      "buildCommandArgs": "-v -k 0"
Warning
If CopperSpice is built in Debug mode on MSVC you must also build your application in Debug mode.

Installing CopperSpice with MSVC

The following steps will configure MSVC to install CopperSpice to your specific path. This process is required for other C++ projects to find the CopperSpice libraries.

The following table is our suggested setup of folder names, there is no requirement to use this exact structure. The CopperSpice source code is located in cs_source directory. The CMake and Ninja files will be generated during the build process and saved in the cs_build directory. The cs_lib directory will be created during the Ninja install step.

Description Directory Name
CopperSpice Source cs_source
CopperSpice Build cs_build
CopperSpice Install cs_lib
  1. Highlight the project menu then select the "CMake Settings for CopperSpice" option
  2. In the editor window add or change the path for CMAKE_INSTALL_PREFIX to YOUR_INSTALL_PATH
    "cmakeCommandArgs": "-DCMAKE_INSTALL_PREFIX=c:\\cs_lib"