We’re happy to introduce a technology that helps us build our software more effectively – NextGIS Borsch. NextGIS Borsch is a new build system for GIS software and a ready to use set of CMake-based libraries at Github. Borsch allows developer to simply include necessary libraries in the projects, setup libraries in flexible way, add them to installations. Borsch builds software and libraries the same way under several platforms (Linux, Windows, Mac OS).
Let’s have a look into details.
Intro
Modern software consists of the great number of building blocks – different libraries. Libraries have different dependencies and dependency tree can become rather complicated. To build program with dependencies you need to have all libraries in your system. Everything gets complicated if you need specific library version or special build with some nonstandard input parameters.
The problem of dependencies is less prominent in Unix systems compared to Windows. Under Windows if any library was updated all dependent libraries will need to be rebuild.
It would be nice to have a build system with the following features:
- Cross-platform (works on Linux, Windows, Mac OS).
- Simple library inclusion. If required library already exists in the system, it must be included, if not – library package must be fetched from the Internet.
- Build system must keep track of library updates.
- Automatic dependency resolution.
- Build options and input parameters must transfer from upper project to dependent libraries.
- Optionally, library packaging process for the build system should be as simple as possible.
The problem: modern C/C++ build systems just partially meet above requirements. In GIS software the most modern and widely used build system is CMake. We decided to extend it with needed functionality and developed NextGIS Borsch.
What is NextGIS Borsch?
In a nutshell NextGIS Borsch is a:
- Set of CMake extension scripts that solve dependency and configuring problems.
- Set of specially prepared libraries ready to use with NextGIS Borsch.
The build system uses Github as storage for libraries. But it is possible to modify system to use other version control system, supported by ExternalProject. You can clone separate libraries, build them and include them to the project like a local ones.
Usage
To activate build system you will only need three files that define new functions:
- FindAnyProject.cmake;
- FindExtProject.cmake;
- ExternalProject.cmake (fixed CMake script).
Also you will need files named FindExtXXX.cmake (where XXX is library name). They contain included library options.
You’ll only need four steps in your CMake script to use Borsch:
- Set additional path to search modules:
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) - Include main Borsch file:
include(FindAnyProject) - Specify necessary libraries:
find_anyproject(TIFF REQUIRED) - Link you software with libraries:
target_link_extlibraries(${LIB_NAME})
Ready to use libraries
More than 30 libraries (full list) are currently supported by Borsch, including:
- proj4
- geos
- gdal
- zlib
- json-c
- libpq
- tiff
- geotiff
- etc.
We are building several products using libraries from Borsch:
- GDAL (most drivers are already available);
- NextGIS QGIS;
- Our desktop products (NextGIS Formbuilder, Manager);
- Mobile SDK for Android;
- PostGIS
How can I contribute?
NextGIS Borsch is open source and there are ways to contribute:
- Try using this approach in your build process
- Try including one of Borsch libraries in your CMake project
- Adapt to Borsch one of the libraries missing from the list
Together we can make building process faster and much more predictable, please join our effort and let us know what you think!
Links
Repositories: https://github.com/nextgis-borsch
Scripts: https://github.com/nextgis-borsch/borsch
FOSS4G 2016 Presentation video: http://ftp5.gwdg.de/pub/misc/openstreetmap/FOSS4G-2016/foss4g-2016-1231-borsch_modern_build_system_for_c_c_gis_projects-hd.webm
Borsch image by Шнапс – Own work, CC0, https://commons.wikimedia.org/w/index.php?curid=14861271