Skip to content

Building WindNinja on Windows using the MSVC compiler and gisinternals.com dependencies

Natalie Wagenbrenner edited this page Jul 5, 2024 · 10 revisions

gisinternals.com builds gdal and most of the dependencies needed for WindNinja. It is simpler than building everything from source, and is preferred. Boost and Qt still need to be built, but all other dependencies are available.

Download GDAL from gisinternals.com

You can choose the proper architecture (x86 or amd64) and compiler version (MSVC 2008-2017).

  1. Download the proper package from here.
  2. Unzip the package into a known place, such as C:\src\x64
  3. The zip file will create a folder named release-1600-x64.

You might need to edit release-1600-x64\include\boost\config\auto_link.hpp to find the correct boost libs. For example, to link to boost built with MSVC 2010, change line 136 to:

#define BOOST_LIB_TOOLSET "vc100"

Your GIS_INTERNALS_HOME value will point to C:\src\x64\release-1600-x64.

Build boost

cd into C:\src\x86\src\boost and run

bootstrap

Then, for 32-bit, run

bjam install --prefix=C:/src/x86 --with-date_time --with-program_options --with-test --type=complete

For 64-bit, run:

bjam install --prefix=C:/src/x64 --with-date_time --with-program_options --with-test --type=complete --toolset=msvc-10.0 address-model=64

Building Qt with OpenSSL support

NOTE: Building qt-4.8.5 with VS2013 requires the following changes:

http://stackoverflow.com/questions/18080625/qt-4-8-visual-studio-2013-compiling-error

Download the openssl-1.0.1u-vs2010 binaries to C:\src:

https://www.npcglib.org/~stathis/blog/precompiled-openssl/

From C:\src\x86\src\qt-everywhere-opensource-src-4.8.5 run:

configure -prefix C:\src\x64 -opensource -openssl -I C:\src\openssl-1.0.1u-vs2010\include64 -L C:\src\openssl-1.0.1u-vs2010\lib64

nmake

nmake install

Build WindNinja

The SRTM client API keys for the GUI and CLI must be set. Set the default keys for the CLI in cmake_cli.cpp lines 56 and 58 and for the GUI in line 47 of srtmclient.cpp.

Note: in order to generate a proper NINJA_SCM_VERSION value, git must be installed and GITCOMMAND must be set.

Downloads: https://git-scm.com/downloads

cd into C:\src\windninja\build64 and run:

cmake-gui ../

  1. Click Configure.
  2. Check USE_GIS_INTERNALS.
  3. Click Configure.
  4. The variable GIS_INTERNALS_HOME will appear. Set it to the value mentioned in the first step.
  5. Click Configure. There will still be errors.
  6. Add a new entry called BOOST_ROOT=C:/src/x64 and click Configure again. This should set all the other boost paths correctly.
  7. Set the following values:
    • NINJA/NINJA_CLI = checked
    • NINJA/NINJA_QTGUI = checked
    • WITH/WITH_LCP_CLIENT = checked
    • WITH/WITH_NOMADS_SUPPORT = checked
    • Ungrouped Entries/ENABLE_GMTED = checked
    • Ungrouped Entries/FIRELAB_PACKAGE = checked (if building installer)
    • Ungrouped Entries/STABILITY = checked
    • If necessary, set Ungrouped Entries/GITCOMMAND to C:/Program Files/Git/cmd/git.exe (default)
    • BUILD/BUILD_FETCH_DEM = checked
    • BUILD/BUILD_TESTING = unchecked
  8. Click Configure
  9. Set QT_QMAKE_EXECUTABLE to C:/src/x64/bin/qmake.exe
  10. Click Configure
  11. Append /DNINJA_ENABLE_CALL_HOME to the CMAKE/CMAKE_CXX_FLAGS entry.
  12. Click Configure
  13. Set FOAM_MINGW_PATH to C:/src/windninja/OpenFOAM-2.2.x/
  14. Click Generate
  15. Run nmake in the console
  16. Optionally run nmake package