Redistributable builds

Introduction

If a binary runs on a different machine depends on a lot of factors. The following sections provide some tips to maximize portability. In general Windows binaries are more portable than *nix binaries.

CPU Architecture Optimization

Default compiler flags

  • /favor:blend: Optimizes for AMD and Intel architectures, see MSDN docs
  • /arch:sse2 on 32-bit, /arch undefined on 64-bit

Optimization CMake options

Default compiler flags

  • -march=native: Optimizes for current cpu

CMake options

For redistribution

  • OGS_CPU_ARCHITECTURE: set to generic for good balance between optimization and portability; set to core2 for maximum portability, more info on gcc docs

For optimization

  • OGS_CPU_ARCHITECTURE: tot to native for best optimization for your current cpu, possible values are listed here, more info on gcc docs
  • OGS_ENABLE_AVX2: boolean (sets -march=core-avx2 when set to true), requires at least Haswell processors

See Linux-tab!

Shared vs. static libraries

Try to use static libraries as much as possible. For OGS itself use BUILD_SHARED_LIBS=OFF, which already defaults to OFF.

Third-party libraries installed via the systems package package manager are often provided as shared libraries. You may want to use Conan which provides lots of libraries (e.g. VTK) as static libs.

Package the build

Use the package-target which tries to gather all dependencies and fixes up shared library paths:

This creates a zip- or tar-archive which should be redistributable.


This article was written by Lars Bilke. If you are missing something or you find an error please let us know. Generated with Hugo 0.47.1. Last revision: August 20, 2018
Commit: [web] Fixed old CMS-style links. 89b32b8bf  | Edit this page on

Creative Commons License | Privacy policy / Legal statements / Impressum