Compiling on Windows O5 - nohal/OpenCPN GitHub Wiki

Compiling on Windows

Prerequisities

Visual Studio 2017

  • Get Visual Studio Community 2017 https://www.visualstudio.com/downloads/
  • Install. During the installation, select Desktop development with C++ workload and make sure to include Windows XP support for C++ component.

Git

  • Get Git for Windows from https://gitforwindows.org
  • Install. We strongly suggest letting the installer register git in your PATH and selecting Checkout as-is, Commit Unix LF option as the CR/LF behavior.

CMake

  • Get the latest CMake installation packages from https://cmake.org
  • Install and let it register in the PATH environment variable

POedit

  • Get the latest POedit installation package from https://poedit.net
  • Install. Add C:\Program Files (x86)\Poedit\GettextTools\bin to your PATH.

NSIS

wxWidgets development libraries

Prebuilt

  • Fast way to get started but not suitable for serious development as only release configuration libraries are included.
  • Get the prebuilt wxWidgets dependencies used by OpenCPN's CI builds from wxWidgets-3.1.1.7z or from the SF mirror
  • Extract to somewhere on your disk.
  • (Optional, but recommended) Create the wxWIDGETS_ROOT_DIR environment variable with a value of the path to which the archive above was just extracted.

Building from source

  • All the command to be used have to be executed from x86 Native Tools Command Prompt for VS 2017 command prompt
  • Download the current source code release from https://github.com/wxWidgets/wxWidgets/releases (Read the instructions there, the Github source code zipball is not what you want) or clone the git repository (do not forget git submodule init and git submodule update to get the external dependencies)
  • Switch to the build\msw subdirectory
  • Build release version: nmake /f makefile.vc BUILD=release SHARED=1 CXXFLAGS=/D_USING_V110_SDK71_ CFLAGS=/D_USING_V110_SDK71_ LDFLAGS=/SUBSYSTEM:WINDOWS",5.01"
  • Build debug version: nmake /f makefile.vc BUILD=debug SHARED=1 CXXFLAGS=/D_USING_V110_SDK71_ CFLAGS=/D_USING_V110_SDK71_ LDFLAGS=/SUBSYSTEM:WINDOWS",5.01"
  • (Optional, but recommended) Create/change the wxWIDGETS_ROOT_DIR environment variable with a value of the top level directory of your wxWidgets source tree.

Getting and building OpenCPN source

Get the source code

  • git clone https://github.com/OpenCPN/OpenCPN

Get prebuilt Windows dependencies

Building OpenCPN

  • All the command to be used have to be executed from x86 Native Tools Command Prompt for VS 2017 command prompt
  • cd <Your OpenCPN source tree>
  • mkdir build
  • cd build
  • Generate the solution files: cmake -G "Visual Studio 15 2017" -T v141_xp ..
  • Do your stuff
    • Open the generated OpenCPN.sln solution in Visual Studio or
    • Build debug version from the command line: cmake --build . or
    • Build release version from the command line cmake --build . --config release or
    • Build setup package from the command line cmake --build . --config release --target package