Skip to content

Fix linking with `-DOPENMW_USE_SYSTEM_OSG=ON -DOSG_STATIC=ON`

Gleb Mazovetskiy requested to merge glebm/openmw:fix-build into master

This combination of flags is used by the Android port.

  1. CMake's built-in OSG finder does not use pkgconfig, so we have to manually ensure the order is correct for inter-library dependencies.

    https://gitlab.kitware.com/cmake/cmake/-/issues/21701

  2. OSG plugin pkgconfig files are missing dependencies on the underlying libraries (e.g. freetype, png, jpeg), so we have to link them manually.

    https://github.com/openscenegraph/OpenSceneGraph/issues/1052

  3. For -DOPENMW_USE_SYSTEM_OSG=OFF -DOSG_STATIC=ON, cleans up the linker command a bit so that the plugins are no longer pased twice (previously: once with --whole-archive and once without)

/cc @akortunov @thexyz

Edited by Gleb Mazovetskiy

Merge request reports