last updated: 2021-02-08
Back to the Gaia-SINS home page

Index of contents


Setting up the MSVC environment

MSVC is a closed, proprietary C/C++ compiler developed and distributed by Microsoft; there is no real good reason justifying to use this proprietary compiler when a wonderful genuine free sw standard compiler is available on Windows as well [MinGW, MinGW].
Anyway MSVC is widely used by many Windows developers, and a no cost version is available: Visual Studio Community

As a general rule, building open source packages under MSVC is a little bit difficultiest as you can expect, mainly because this compiler lacks anything like ./configure scripts, and nmake only offers a minimal support roughly equivalent to make.
As a practical consequence, may well be that the supplied build scripts makefile.vc and nmake.opt would require some manual adjustment, so to accommodate for your specific platform layout.

I've succesfully built the following packages using this configuration:

Building 32 bit code on MSVC

MSVC 32 bit
  1. Start first a session of Developer Command Prompt for Visual Studio (the MSVC own command shell).
  2. Then execute the vcvars32.bat script.
    This will initialize your build environment for 32 bit (x86).
  3. Now you'll be ready for executing nmake /f makefile.vc in order to compile and link 32 bit libraries and executables.

Building 64 bit code on MSVC

MSVC 64 bit
  1. Start first a session of Developer Command Prompt for Visual Studio (the MSVC own command shell).
  2. Then execute the vcvars64.bat script.
    This will initialize your build environment for 64 bit (x64).
  3. Now you'll be ready for executing nmake /f makefile64.vc in order to compile and link 64 bit libraries and executables.


Step 1) building FreeXL

FreeXL is an utility library implementing read-access for Excel (.xls) spreadsheets
Depends on: libiconv
Required by: spatialite-tools, libspatialite cd freexl-1.0.6
nmake /f makefile.vc
nmake /f makefile.vc install

This will build and install both the static library and the DLL as well (32 bit).

In order to build and install the 64 bit library you are just required to open the MSVC command shell configured for 64 bit (x64):
cd freexl-1.0.6
nmake /f makefile64.vc
nmake /f makefile64.vc install

This will build and install both the static library and the DLL as well (64 bit).


Step 2) building ReadOSM

RadOSM is an utility library supporting OSM datasets parsing
Depends on: libz, expat
Required by: spatialite-tools cd readosm-1.0.0a
nmake /f makefile.vc
nmake /f makefile.vc install

This will build and install both the static library and the DLL as well (32 bit).

In order to build and install the 64 bit library you are just required to open the MSVC command shell configured for 64 bit (x64):
cd readosm-1.0.0a
nmake /f makefile64.vc
nmake /f makefile64.vc install

This will build and install both the static library and the DLL as well (64 bit).


Step 3) building librttopo

librttopo is a new library implementing several useful geometry functions and fully supporting ISO Topology operators.
Depends on: libgeos
Required by: libspatialite

Warning: the source tarballs you can download from the RtTopo GitHub repository do not contain valid build scripts supporting the MSVC compiler.
SpatiaLite deploys its own tarballs, that are exactly the original ones but including valid scripts for building using MSVC, both for 32 and 64 bit libraries.
cd librttopo-1.1.0
nmake /f makefile.vc
nmake /f makefile.vc install

This will build and install both the static library and the DLL as well (32 bit).

In order to build and install the 64 bit library you are just required to open the MSVC command shell configured for 64 bit (x64):
cd librttopo-1.1.0
nmake /f makefile64.vc
nmake /f makefile64.vc install

This will build and install both the static library and the DLL as well (64 bit).


Step 4) building libspatialite

libspatialite is the main core of SpatiaLite
Depends on: libiconv, libproj, libgeos
Required by: spatialite-tools cd libspatialite-5.0.1
nmake /f makefile.vc
nmake /f makefile.vc install

This will build and install both the static library and the DLL as well (32 bit).

In order to build and install the 64 bit library you are just required to open the MSVC command shell configured for 64 bit (x64):
cd libspatialite-5.0.1
nmake /f makefile64.vc
nmake /f makefile64.vc install

This will build and install both the static library and the DLL as well (64 bit).

Note: you have not yet finished, becuase for now you've only built the classic library intended for C/C++ apps.
You have now to build the dynamically loadable module required by any other programming language such as Java, Python, PHP and so on.

cd libspatialite-5.0.1
nmake /f makefile_mod.vc clean
nmake /f makefile_mod.vc
nmake /f makefile_mod.vc install

This will build and install the dynamically loadable module (32 bit). as well (32 bit).

In order to build and install the 64 bit dynamically loadable module you are just required to open the MSVC command shell configured for 64 bit (x64):
cd libspatialite-5.0.1
nmake /f makefile_mod64.vc clean
nmake /f makefile_mod64.vc
nmake /f makefile_mod64.vc install

This will build and install the dynamically loadable module (64 bit).


Step 3) building spatialite-tools

spatialite-tools the SpatiaLite command-line management tools
Depends on: libiconv, libproj, libgeos, libspatialite, libexpat cd spatialite-tools-5.0.1
nmake /f makefile.vc
nmake /f makefile.vc install

In order to build and install the 64 bit executable you are just required to open the MSVC command shell configured for 64 bit (x64):
cd spatialite-tools-5.0.1
nmake /f makefile64.vc
nmake /f makefile64.vc install


Back to the Gaia-SINS home page
last updated: 2021-02-08