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

  • OGS_CPU_ARCHITECTURE: possible values AMD64 or INTEL64 (sets /favor:{AMD64 | INTEL64} flag)

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
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.

Package the build

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

make package

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.122.0 in CI job 504124 | Last revision: December 11, 2024
Commit: [web] Fixed two links. 15d11dc  | Edit this page on