Home / For Developers / libs4saga
Name Modified Size InfoDownloads / Week
Parent folder
older_versions 2024-09-01
libs4saga_2024-09-01_x64.zip 2024-09-03 235.9 MB
readme.txt 2024-09-01 5.0 kB
Totals: 3 Items   235.9 MB 5
Compiling SAGA under MSW with MS Visual C++

-- Library Dependencies --
The 'libs4saga' zip files contain the headers and library interfaces as well as the binaries of most of the program libraries, from which SAGA or parts of it are dependent (i.e. have to be linked to). Exception is the wxWidgets library, for which we suggest to compile it from source by yourself (it's really easy to do nowadays) or to get the necessary files directly from www.wxwidgets.org.

-- Software Requirements --
+ Microsoft Visual Studio / Visual C++
  - Visual Studio is an integrated development environment (IDE).
  - https://visualstudio.microsoft.com/
  - the Community Edition is more than sufficient (=> 'free, fully-featured IDE for students, open-source and individual developers')
+ CMake
  - CMake is an open-source, cross-platform family of tools designed to build, test and package software.
  - https://cmake.org/
+ Git (optional)
  - Git is a free and open source distributed version control system.
  - https://git-scm.com/
___________________________________________
1. Unzip library interfaces needed for SAGA compilation
- 'libs4saga_2024-09-01_x64.zip'   (64-bit versions)
___________________________________________
2. Define environment variables used by SAGA to locate library installations
(e.g.: SET WXWIN=C:\wxWidgets-3.2.5)

WXWIN        - wxWidgets [absolutely necessary]

GDAL         - Geodata Abstraction Library (GDAL), Cartographic Projections (Proj.4), PostgeSQL [very recommended]
HARU         - Haru PDF library
OPENCV       - Computer Vision
VIGRA        - Visualisation and Graphics
RIEGL_RDB    - Riegl RDB import
PDAL         - Point Data Abstraction Library (PDAL)
___________________________________________
3. SAGA compilation
+ get the sources
  - with git e.g.: 'git clone https://git.code.sf.net/p/saga-gis/code saga-gis-code'
  - or download from 'https://sourceforge.net/projects/saga-gis/files/')
+ configure the Visual C++ projects and solution with CMake
  - if environment variables have been set according to section 2 CMake will automatically configure the appropriate library dependencies
+ start developer studio and open the solution 'saga.sln'
+ build solution
___________________________________________
4. copy libraries to SAGA target folder
You find the binaries (DLLs) in the 'dll' folder of the unzipped libs4saga folder. Just copy the 'dll' folder to your SAGA installation.

Remark: The Visual C redistributable DLLs (OpenMP and C/C++ runtime libraries) should be copied from the 'dll_vcredist' folder to the SAGA installation folder (i.e. the directory, where saga_gui.exe/saga_cmd.exe/saga_api.dll are located). This allows to run your SAGA binaries portable on systems that are missing these files.

Remark: The wxWidgets DLLs have to be copied to the SAGA installation folder too. You do not need to copy all wxWidgets libraries, but the following are used by SAGA and therefore essential:
- wxbase3x.dll
- wxbase3x_net.dll
- wxbase3x_xml.dll
- wxmsw3x_adv.dll
- wxmsw3x_aui.dll
- wxmsw3x_core.dll
- wxmsw3x_html.dll
- wxmsw3x_propgrid.dll
___________________________________________
5. Remarks and known issues
The workflow has been elaborated for Visual Studio 2019 (aka vs16), Community/Express Edition. It should work with later versions of Visual Studio too.

The binaries of the GDAL and related libraries (i.e. Proj.4 and PostgeSQL) have been originally provided by the GISInternals Support Site (https://www.gisinternals.com/). At this site you can also find binaries compiled for other Visual Studio versions than 2019.

This description applies to SAGA versions >= 9.6.0. For older versions you might have to add additional environment variables for PostgreSQL (PGSQL) and Proj (PROJ4) libraries, if you want to include these in your build. In both cases the environment variables have to point to the GDAL installation directory (i.e. the same value as for GDAL).

If you want to link to older Proj version supplied with the GDAL dependencies coming with this installation, you do not need to add the PROJ4 environment variables, but you have to delete the C/C++ preprocessor define 'PROJ6' from the Visual-C projects (vcxprj), to change the header include '$(GDAL)/include/proj6' to '$(GDAL)/include' and the library input 'proj_6_1.lib' to 'proj.lib'.
___________________________________________
6. Library path examples

WXWIN        = C:\wxWidgets-3.2.5

GDAL         = C:\libs4saga_x64\gdal-3.9.2
HARU         = C:\libs4saga_x64\libharu-2.4.2
OPENCV       = C:\libs4saga_x64\opencv-4.3.0
PDAL         = C:\libs4saga_x64\pdal-2.7.2
RIEGL_RDB    = C:\libs4saga_x64\rdblib-2.3.5
VIGRA        = C:\libs4saga_x64\vigra-1.11.1
___________________________________________
Library versions of the latest files:
GDAL   - 3.9.2
PROJ   - 9.4.1
HARU   - 2.4.2
OpenCV - 4.3.0
VIGRA  - 1.11.1
RDBLIB - 2.3.5
PDAL   - 2.7.2

vc_redist (CRT, OpenMP)- VS2019 (v142)
Source: readme.txt, updated 2024-09-01