Merge branch 'static-build' into 'master'

Optional local source builds of OSG, MyGUI, Bullet

See merge request OpenMW/openmw!547
pull/3047/head
psi29a 3 years ago
commit 5c0214142b

2
.gitignore vendored

@ -5,7 +5,7 @@ CMakeCache.txt
cmake_install.cmake
Makefile
makefile
build*
build*/
prebuilt
##windows build process

@ -1,19 +1,20 @@
# Note: We set `needs` on each job to control the job DAG.
# See https://docs.gitlab.com/ee/ci/yaml/#needs
stages:
- build
.Debian:
.Debian_Image:
tags:
- docker
- linux
image: debian:bullseye
.Debian:
extends: .Debian_Image
cache:
paths:
- apt-cache/
- ccache/
before_script:
- export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
- apt-get update -yq
- apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake build-essential libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-iostreams-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libsdl2-dev libqt5opengl5-dev libopenal-dev libopenscenegraph-dev libunshield-dev libtinyxml-dev libmygui-dev libbullet-dev liblz4-dev ccache git clang
stage: build
script:
- export CCACHE_BASEDIR="`pwd`"
@ -33,6 +34,8 @@ Debian_GCC:
extends: .Debian
cache:
key: Debian_GCC.v2
before_script:
- CI/install_debian_deps.sh gcc openmw-deps openmw-deps-dynamic
variables:
CC: gcc
CXX: g++
@ -41,31 +44,52 @@ Debian_GCC:
timeout: 2h
Debian_GCC_tests:
extends: .Debian
extends: Debian_GCC
cache:
key: Debian_GCC_tests.v2
variables:
CC: gcc
CXX: g++
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
Debian_GCC_Static_Deps:
extends: Debian_GCC
cache:
key: Debian_GCC_Static_Deps
paths:
- apt-cache/
- ccache/
- build/extern/fetched/
before_script:
- CI/install_debian_deps.sh gcc openmw-deps openmw-deps-static
variables:
CI_OPENMW_USE_STATIC_DEPS: 1
Debian_GCC_Static_Deps_tests:
extends: Debian_GCC_Static_Deps
cache:
key: Debian_GCC_Static_Deps_tests
variables:
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
Debian_Clang:
extends: .Debian
before_script:
- CI/install_debian_deps.sh clang openmw-deps openmw-deps-dynamic
cache:
key: Debian_Clang.v2
variables:
CC: clang
CXX: clang++
CCACHE_SIZE: 2G
# When CCache doesn't exist (e.g. first build on a fork), build takes more than 1h, which is the default for forks.
timeout: 2h
Debian_Clang_tests:
extends: .Debian
extends: Debian_Clang
cache:
key: Debian_Clang_tests.v2
variables:
CC: clang
CXX: clang++
CCACHE_SIZE: 1G
BUILD_TESTS_ONLY: 1
@ -286,16 +310,17 @@ Debian_AndroidNDK_arm64-v8a:
variables:
CCACHE_SIZE: 3G
cache:
key: Debian_AndroidNDK_arm64-v8a.v2
key: Debian_AndroidNDK_arm64-v8a.v3
paths:
- apt-cache/
- ccache/
- build/extern/fetched/
before_script:
- export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
- echo "deb http://deb.debian.org/debian unstable main contrib" > /etc/apt/sources.list
- echo "google-android-ndk-installer google-android-installers/mirror select https://dl.google.com" | debconf-set-selections
- apt-get update -yq
- apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake ccache curl unzip git build-essential google-android-ndk-installer
- apt-get -q -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake ccache curl unzip git build-essential google-android-ndk-installer
stage: build
script:
- export CCACHE_BASEDIR="`pwd`"
@ -310,3 +335,5 @@ Debian_AndroidNDK_arm64-v8a:
artifacts:
paths:
- build/install/
# When CCache doesn't exist (e.g. first build on a fork), build takes more than 1h, which is the default for forks.
timeout: 1h30m

@ -3,7 +3,7 @@
# hack to work around: FFmpeg version is too old, 3.2 is required
sed -i s/"NOT FFVER_OK"/"FALSE"/ CMakeLists.txt
mkdir build
mkdir -p build
cd build
cmake \
@ -21,5 +21,7 @@ cmake \
-DBUILD_ESSIMPORTER=0 \
-DBUILD_OPENCS=0 \
-DBUILD_WIZARD=0 \
-DMyGUI_LIBRARY="/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/libMyGUIEngineStatic.a" \
-DOPENMW_USE_SYSTEM_MYGUI=OFF \
-DOPENMW_USE_SYSTEM_OSG=OFF \
-DOPENMW_USE_SYSTEM_BULLET=OFF \
..

@ -1,44 +1,54 @@
#!/bin/bash -ex
#!/bin/bash
set -xeo pipefail
free -m
if [[ "${BUILD_TESTS_ONLY}" ]]; then
export GOOGLETEST_DIR="$(pwd)/googletest/build/install"
export GOOGLETEST_DIR="${PWD}/googletest/build/install"
env GENERATOR='Unix Makefiles' CONFIGURATION=Release CI/build_googletest.sh
fi
mkdir build
declare -a CMAKE_CONF_OPTS=(
-DCMAKE_C_COMPILER="${CC:-/usr/bin/cc}"
-DCMAKE_CXX_COMPILER="${CXX:-/usr/bin/c++}"
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_INSTALL_PREFIX=install
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DBUILD_SHARED_LIBS=OFF
-DUSE_SYSTEM_TINYXML=ON
-DCMAKE_INSTALL_PREFIX=install
)
if [[ $CI_OPENMW_USE_STATIC_DEPS ]]; then
CMAKE_CONF_OPTS+=(
-DOPENMW_USE_SYSTEM_MYGUI=OFF
-DOPENMW_USE_SYSTEM_OSG=OFF
-DOPENMW_USE_SYSTEM_BULLET=OFF
)
fi
mkdir -p build
cd build
if [[ "${BUILD_TESTS_ONLY}" ]]; then
${ANALYZE} cmake \
-D CMAKE_C_COMPILER="${CC}" \
-D CMAKE_CXX_COMPILER="${CXX}" \
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D CMAKE_INSTALL_PREFIX=install \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D USE_SYSTEM_TINYXML=TRUE \
-D BUILD_OPENMW=OFF \
-D BUILD_BSATOOL=OFF \
-D BUILD_ESMTOOL=OFF \
-D BUILD_LAUNCHER=OFF \
-D BUILD_MWINIIMPORTER=OFF \
-D BUILD_ESSIMPORTER=OFF \
-D BUILD_OPENCS=OFF \
-D BUILD_WIZARD=OFF \
-D BUILD_UNITTESTS=ON \
-D GTEST_ROOT="${GOOGLETEST_DIR}" \
-D GMOCK_ROOT="${GOOGLETEST_DIR}" \
"${CMAKE_CONF_OPTS[@]}" \
-DBUILD_OPENMW=OFF \
-DBUILD_BSATOOL=OFF \
-DBUILD_ESMTOOL=OFF \
-DBUILD_LAUNCHER=OFF \
-DBUILD_MWINIIMPORTER=OFF \
-DBUILD_ESSIMPORTER=OFF \
-DBUILD_OPENCS=OFF \
-DBUILD_WIZARD=OFF \
-DBUILD_UNITTESTS=ON \
-DGTEST_ROOT="${GOOGLETEST_DIR}" \
-DGMOCK_ROOT="${GOOGLETEST_DIR}" \
..
else
${ANALYZE} cmake \
-D CMAKE_C_COMPILER="${CC}" \
-D CMAKE_CXX_COMPILER="${CXX}" \
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D USE_SYSTEM_TINYXML=TRUE \
-D CMAKE_INSTALL_PREFIX=install \
-D CMAKE_BUILD_TYPE=Debug \
"${CMAKE_CONF_OPTS[@]}" \
..
fi

@ -0,0 +1,64 @@
#!/bin/bash
set -euo pipefail
print_help() {
echo "usage: $0 [group]..."
echo
echo " available groups: "${!GROUPED_DEPS[@]}""
}
declare -rA GROUPED_DEPS=(
[gcc]="binutils gcc g++ libc-dev"
[clang]="binutils clang"
# Common dependencies for building OpenMW.
[openmw-deps]="
make cmake ccache git pkg-config
libboost-filesystem-dev libboost-program-options-dev
libboost-system-dev libboost-iostreams-dev
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev
libsdl2-dev libqt5opengl5-dev libopenal-dev libunshield-dev libtinyxml-dev
libbullet-dev liblz4-dev libpng-dev libjpeg-dev
"
# These dependencies can alternatively be built and linked statically.
[openmw-deps-dynamic]="libmygui-dev libopenscenegraph-dev"
# Pre-requisites for building MyGUI and OSG for static linking.
#
# * MyGUI and OSG: libsdl2-dev liblz4-dev libfreetype6-dev
# * OSG: libgl-dev
#
# Plugins:
# * DAE: libcollada-dom-dev libboost-system-dev libboost-filesystem-dev
# * JPEG: libjpeg-dev
# * PNG: libpng-dev
[openmw-deps-static]="
make cmake
ccache curl unzip libcollada-dom-dev libfreetype6-dev libjpeg-dev libpng-dev
libsdl2-dev libboost-system-dev libboost-filesystem-dev libgl-dev
"
)
if [[ $# -eq 0 ]]; then
>&2 print_help
exit 1
fi
deps=()
for group in "$@"; do
if [[ ! -v GROUPED_DEPS[$group] ]]; then
>&2 echo "error: unknown group ${group}"
exit 1
fi
deps+=(${GROUPED_DEPS[$group]})
done
export APT_CACHE_DIR="${PWD}/apt-cache"
set -x
mkdir -pv "$APT_CACHE_DIR"
apt-get update -yq
apt-get -q -o dir::cache::archives="$APT_CACHE_DIR" install -y "${deps[@]}"

@ -3,14 +3,19 @@ cmake_minimum_required(VERSION 3.1.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Detect OS
include(cmake/OSIdentity.cmake)
# for link time optimization, remove if cmake version is >= 3.9
if(POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
if(POLICY CMP0069) # LTO
cmake_policy(SET CMP0069 NEW)
endif()
# for position-independent executable, remove if cmake version is >= 3.14
if(POLICY CMP0083)
cmake_policy(SET CMP0083 NEW)
endif()
# Detect OS
include(cmake/OSIdentity.cmake)
# Apps and tools
option(BUILD_OPENMW "Build OpenMW" ON)
option(BUILD_LAUNCHER "Build Launcher" ON)
@ -52,7 +57,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
if (ANDROID)
set(CMAKE_FIND_ROOT_PATH ${OPENMW_DEPENDENCIES_DIR} "${CMAKE_FIND_ROOT_PATH}")
set (OSG_PLUGINS_DIR CACHE STRING "")
endif()
# Version
@ -95,17 +99,34 @@ endif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
# Macros
include(OpenMWMacros)
include(WholeArchive)
# doxygen main page
configure_file ("${OpenMW_SOURCE_DIR}/docs/mainpage.hpp.cmake" "${OpenMW_BINARY_DIR}/docs/mainpage.hpp")
option(MYGUI_STATIC "Link static build of Mygui into the binaries" FALSE)
option(BOOST_STATIC "Link static build of Boost into the binaries" FALSE)
option(SDL2_STATIC "Link static build of SDL into the binaries" FALSE)
option(OSG_STATIC "Link static build of OpenSceneGraph into the binaries" FALSE)
option(QT_STATIC "Link static build of QT into the binaries" FALSE)
option(OPENMW_USE_SYSTEM_BULLET "Use system provided bullet physics library" ON)
option(OPENMW_USE_SYSTEM_OSG "Use system provided OpenSceneGraph libraries" ON)
if(OPENMW_USE_SYSTEM_OSG)
set(_osg_static_default OFF)
else()
set(_osg_static_default ON)
endif()
option(OSG_STATIC "Link static build of OpenSceneGraph into the binaries" ${_osg_static_default})
option(OPENMW_USE_SYSTEM_MYGUI "Use system provided mygui library" ON)
if(OPENMW_USE_SYSTEM_MYGUI)
set(_mygui_static_default OFF)
else()
set(_mygui_static_default ON)
endif()
option(MYGUI_STATIC "Link static build of Mygui into the binaries" ${_mygui_static_default})
option(OPENMW_UNITY_BUILD "Use fewer compilation units to speed up compile time" FALSE)
option(OPENMW_LTO_BUILD "Build OpenMW with Link-Time Optimization (Needs ~2GB of RAM)" OFF)
@ -168,6 +189,28 @@ if (USE_QT)
#set(CMAKE_AUTOMOC ON)
endif()
set(USED_OSG_COMPONENTS
osgDB
osgViewer
osgText
osgGA
osgParticle
osgUtil
osgFX
osgShadow
osgAnimation)
set(USED_OSG_PLUGINS
osgdb_bmp
osgdb_dds
osgdb_freetype
osgdb_jpeg
osgdb_osg
osgdb_png
osgdb_serializers_osg
osgdb_tga)
add_subdirectory(extern)
# Sound setup
# Require at least ffmpeg 3.2 for now
@ -243,6 +286,15 @@ if (WIN32)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
endif()
if(OPENMW_USE_SYSTEM_BULLET)
set(REQUIRED_BULLET_VERSION 286) # Bullet 286 required due to runtime bugfixes for btCapsuleShape
if (DEFINED ENV{TRAVIS_BRANCH} OR DEFINED ENV{APPVEYOR})
set(REQUIRED_BULLET_VERSION 283) # but for build testing, 283 is fine
endif()
find_package(Bullet ${REQUIRED_BULLET_VERSION} REQUIRED COMPONENTS BulletCollision LinearMath)
endif()
if (NOT WIN32 AND BUILD_WIZARD) # windows users can just run the morrowind installer
find_package(LIBUNSHIELD REQUIRED) # required only for non win32 when building openmw-wizard
set(OPENMW_USE_UNSHIELD TRUE)
@ -261,35 +313,25 @@ if(NOT HAVE_STDINT_H)
message(FATAL_ERROR "stdint.h was not found" )
endif()
if(OPENMW_USE_SYSTEM_OSG)
find_package(OpenSceneGraph 3.3.4 REQUIRED ${USED_OSG_COMPONENTS})
if(OSG_STATIC)
unset(OSGPlugins_LIB_DIR)
foreach(OSGDB_LIB ${OSGDB_LIBRARY})
# Skip library type names
if(EXISTS ${OSGDB_LIB} AND NOT IS_DIRECTORY ${OSGDB_LIB})
get_filename_component(OSG_LIB_DIR ${OSGDB_LIB} DIRECTORY)
list(APPEND OSGPlugins_LIB_DIR "${OSG_LIB_DIR}/osgPlugins-${OPENSCENEGRAPH_VERSION}")
endif()
endforeach(OSGDB_LIB)
find_package(OSGPlugins REQUIRED COMPONENTS ${USED_OSG_PLUGINS})
endif()
endif()
find_package(OpenSceneGraph 3.3.4 REQUIRED osgDB osgViewer osgText osgGA osgParticle osgUtil osgFX osgShadow osgAnimation)
include_directories(SYSTEM ${OPENSCENEGRAPH_INCLUDE_DIRS})
set(USED_OSG_PLUGINS
osgdb_bmp
osgdb_dds
osgdb_freetype
osgdb_jpeg
osgdb_osg
osgdb_png
osgdb_serializers_osg
osgdb_tga
)
set(OSGPlugins_LIB_DIR "")
foreach(OSGDB_LIB ${OSGDB_LIBRARY})
# Skip library type names
if(EXISTS ${OSGDB_LIB} AND NOT IS_DIRECTORY ${OSGDB_LIB})
get_filename_component(OSG_LIB_DIR ${OSGDB_LIB} DIRECTORY)
list(APPEND OSGPlugins_LIB_DIR "${OSG_LIB_DIR}/osgPlugins-${OPENSCENEGRAPH_VERSION}")
endif()
endforeach(OSGDB_LIB)
include_directories(BEFORE SYSTEM ${OPENSCENEGRAPH_INCLUDE_DIRS})
if(OSG_STATIC)
add_definitions(-DOSG_LIBRARY_STATIC)
find_package(OSGPlugins REQUIRED COMPONENTS ${USED_OSG_PLUGINS})
list(APPEND OPENSCENEGRAPH_LIBRARIES ${OSGPlugins_LIBRARIES})
endif()
set(BOOST_COMPONENTS system filesystem program_options iostreams)
@ -304,21 +346,18 @@ IF(BOOST_STATIC)
set(Boost_USE_STATIC_LIBS ON)
endif()
set(REQUIRED_BULLET_VERSION 286) # Bullet 286 required due to runtime bugfixes for btCapsuleShape
if (DEFINED ENV{TRAVIS_BRANCH} OR DEFINED ENV{APPVEYOR})
set(REQUIRED_BULLET_VERSION 283) # but for build testing, 283 is fine
endif()
set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost 1.6.2 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
find_package(MyGUI 3.2.2 REQUIRED)
if(OPENMW_USE_SYSTEM_MYGUI)
find_package(MyGUI 3.2.2 REQUIRED)
endif()
find_package(SDL2 2.0.9 REQUIRED)
find_package(OpenAL REQUIRED)
find_package(Bullet ${REQUIRED_BULLET_VERSION} REQUIRED COMPONENTS BulletCollision LinearMath)
include_directories("."
SYSTEM
include_directories(
BEFORE SYSTEM
"."
${SDL2_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${MyGUI_INCLUDE_DIRS}
@ -846,11 +885,7 @@ elseif(NOT APPLE)
# Install binaries
IF(BUILD_OPENMW)
IF(ANDROID)
INSTALL(PROGRAMS "${INSTALL_SOURCE}/libopenmw.so" DESTINATION "${BINDIR}" )
ELSE(ANDROID)
INSTALL(PROGRAMS "${INSTALL_SOURCE}/openmw" DESTINATION "${BINDIR}" )
ENDIF(ANDROID)
INSTALL(PROGRAMS "$<TARGET_FILE:openmw>" DESTINATION "${BINDIR}" )
ENDIF(BUILD_OPENMW)
IF(BUILD_LAUNCHER)
INSTALL(PROGRAMS "${INSTALL_SOURCE}/openmw-launcher" DESTINATION "${BINDIR}" )

@ -228,6 +228,20 @@ target_link_libraries(openmw-cs
components
)
if(OSG_STATIC)
unset(_osg_plugins_static_files)
add_library(openmw_cs_osg_plugins INTERFACE)
foreach(_plugin ${USED_OSG_PLUGINS})
string(TOUPPER ${_plugin} _plugin_uc)
list(APPEND _osg_plugins_static_files $<TARGET_FILE:${${_plugin_uc}_LIBRARY}>)
target_link_libraries(openmw_cs_osg_plugins INTERFACE ${${_plugin_uc}_LIBRARY})
endforeach()
# We use --whole-archive because OSG plugins use registration.
get_whole_archive_options(_opts ${_osg_plugins_static_files})
target_link_options(openmw_cs_osg_plugins INTERFACE ${_opts})
target_link_libraries(openmw-cs openmw_cs_osg_plugins)
endif(OSG_STATIC)
target_link_libraries(openmw-cs Qt5::Widgets Qt5::Core Qt5::Network Qt5::OpenGL)
if (WIN32)

@ -143,29 +143,22 @@ target_link_libraries(openmw
components
)
if (ANDROID)
set (OSG_PLUGINS
-Wl,--whole-archive
)
foreach(PLUGIN_NAME ${USED_OSG_PLUGINS})
set(OSG_PLUGINS ${OSG_PLUGINS} ${OSG_PLUGINS_DIR}/lib${PLUGIN_NAME}.a)
if(OSG_STATIC)
unset(_osg_plugins_static_files)
add_library(openmw_osg_plugins INTERFACE)
foreach(_plugin ${USED_OSG_PLUGINS})
string(TOUPPER ${_plugin} _plugin_uc)
list(APPEND _osg_plugins_static_files $<TARGET_FILE:${${_plugin_uc}_LIBRARY}>)
target_link_libraries(openmw_osg_plugins INTERFACE ${${_plugin_uc}_LIBRARY})
endforeach()
# We use --whole-archive because OSG plugins use registration.
get_whole_archive_options(_opts ${_osg_plugins_static_files})
target_link_options(openmw_osg_plugins INTERFACE ${_opts})
target_link_libraries(openmw openmw_osg_plugins)
endif(OSG_STATIC)
set (OSG_PLUGINS
${OSG_PLUGINS} -Wl,--no-whole-archive
)
target_link_libraries(openmw
EGL
android
log
dl
z
${OPENSCENEGRAPH_LIBRARIES}
freetype
jpeg
png
)
if (ANDROID)
target_link_libraries(openmw EGL android log z)
endif (ANDROID)
if (USE_SYSTEM_TINYXML)

@ -0,0 +1,10 @@
function (get_whole_archive_options OUT_VAR)
# We use --whole-archive because OSG plugins use registration.
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(${OUT_VAR} -Wl,--whole-archive ${ARGN} -Wl,--no-whole-archive PARENT_SCOPE)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(${OUT_VAR} -Wl,-all_load ${ARGN} -Wl,-noall_load PARENT_SCOPE)
else ()
message(FATAL_ERROR "get_whole_archive_options not implemented for CMAKE_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER_ID}")
endif()
endfunction ()

@ -245,7 +245,7 @@ target_link_libraries(components
RecastNavigation::Recast
)
if (BULLET_USE_DOUBLES AND (UBUNTU_FOUND OR DEBIAN_FOUND))
if (BULLET_USE_DOUBLES AND (UBUNTU_FOUND OR DEBIAN_FOUND) AND OPENMW_USE_SYSTEM_BULLET)
target_link_libraries(components BulletCollision-float64 LinearMath-float64)
else()
target_link_libraries(components ${BULLET_LIBRARIES})

@ -0,0 +1,131 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Like `FetchContent_MakeAvailable` but passes EXCLUDE_FROM_ALL to `add_subdirectory`.
macro(FetchContent_MakeAvailableExcludeFromAll)
foreach(contentName IN ITEMS ${ARGV})
string(TOLOWER ${contentName} contentNameLower)
FetchContent_GetProperties(${contentName})
if(NOT ${contentNameLower}_POPULATED)
FetchContent_Populate(${contentName})
if(EXISTS ${${contentNameLower}_SOURCE_DIR}/CMakeLists.txt)
add_subdirectory(${${contentNameLower}_SOURCE_DIR}
${${contentNameLower}_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endif()
endforeach()
endmacro()
if(NOT OPENMW_USE_SYSTEM_BULLET)
cmake_minimum_required(VERSION 3.11) # for FetchContent
set(BUILD_BULLET3 OFF CACHE BOOL "")
set(BUILD_EXTRAS OFF CACHE BOOL "")
set(BUILD_OPENGL3_DEMOS OFF CACHE BOOL "")
set(BUILD_UNIT_TESTS OFF CACHE BOOL "")
set(BUILD_BULLET2_DEMOS OFF CACHE BOOL "")
set(BUILD_CLSOCKET OFF CACHE BOOL "")
set(BUILD_ENET OFF CACHE BOOL "")
set(BUILD_CPU_DEMOS OFF CACHE BOOL "")
set(BUILD_EGL OFF CACHE BOOL "")
set(USE_DOUBLE_PRECISION ${BULLET_USE_DOUBLES} CACHE BOOL "")
set(BULLET2_MULTITHREADING ON CACHE BOOL "")
# Version 3.08 with the following changes:
# 1. Fixes the linking of Threads:
# https://github.com/bulletphysics/bullet3/pull/3237
# 2. Removes ~300 MiB of files not used here:
# rm -rf build3 data docs examples test Doxyfile
include(FetchContent)
FetchContent_Declare(bullet
URL https://github.com/glebm/bullet3/archive/ed5256454f4f84bd2c1728c88ddb0405d614e7d2.zip
URL_HASH MD5=e3c94fac35a7be885ad8843f828a0f96
SOURCE_DIR fetched/bullet
)
FetchContent_MakeAvailableExcludeFromAll(bullet)
set(BULLET_INCLUDE_DIRS ${bullet_SOURCE_DIR}/src PARENT_SCOPE)
# The order here is important to work around a bug in Bullet:
# https://github.com/bulletphysics/bullet3/issues/3233
set(BULLET_LIBRARIES BulletCollision LinearMath PARENT_SCOPE)
endif()
if(NOT OPENMW_USE_SYSTEM_MYGUI)
cmake_minimum_required(VERSION 3.11) # for FetchContent
set(MYGUI_RENDERSYSTEM 4 CACHE STRING "")
set(MYGUI_DISABLE_PLUGINS TRUE CACHE BOOL "")
set(MYGUI_BUILD_DEMOS OFF CACHE BOOL "")
set(MYGUI_BUILD_PLUGINS OFF CACHE BOOL "")
set(MYGUI_BUILD_TOOLS OFF CACHE BOOL "")
if(MYGUI_STATIC)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
endif()
include(FetchContent)
FetchContent_Declare(mygui
URL https://github.com/MyGUI/mygui/archive/MyGUI3.4.0.zip
URL_HASH MD5=9e990a4240430cbf567bfe73488a274e
SOURCE_DIR fetched/mygui
)
FetchContent_MakeAvailableExcludeFromAll(mygui)
set(MyGUI_INCLUDE_DIRS ${mygui_SOURCE_DIR}/MyGUIEngine/include PARENT_SCOPE)
set(MyGUI_LIBRARIES MyGUIEngine PARENT_SCOPE)
endif()
if(NOT OPENMW_USE_SYSTEM_OSG)
cmake_minimum_required(VERSION 3.11) # for FetchContent
set(DYNAMIC_OPENTHREADS OFF CACHE BOOL "")
set(DYNAMIC_OPENSCENEGRAPH OFF CACHE BOOL "")
set(BUILD_OSG_APPLICATIONS OFF CACHE BOOL "")
set(BUILD_OSG_DEPRECATED_SERIALIZERS OFF CACHE BOOL "")
set(OSG_FIND_3RD_PARTY_DEPS OFF CACHE BOOL "")
set(BUILD_OSG_PLUGINS_BY_DEFAULT OFF CACHE BOOL "")
set(BUILD_OSG_PLUGIN_BMP ON CACHE BOOL "")
set(BUILD_OSG_PLUGIN_DDS ON CACHE BOOL "")
set(BUILD_OSG_PLUGIN_FREETYPE ON CACHE BOOL "")
set(BUILD_OSG_PLUGIN_JPEG ON CACHE BOOL "")
set(BUILD_OSG_PLUGIN_OSG ON CACHE BOOL "")
set(BUILD_OSG_PLUGIN_PNG ON CACHE BOOL "")
set(BUILD_OSG_PLUGIN_TGA ON CACHE BOOL "")
set(BUILD_OSG_PLUGIN_KTX ON CACHE BOOL "")
set(OSG_USE_FLOAT_MATRIX ON CACHE BOOL "")
set(OSG_USE_FLOAT_PLANE ON CACHE BOOL "")
set(OSG_USE_FLOAT_QUAT ON CACHE BOOL "")
set(OPENGL_PROFILE "GL2" CACHE STRING "")
if(OSG_STATIC)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
endif()
# branch OpenSceneGraph-3.6 on 23 Jan 2021.
include(FetchContent)
FetchContent_Declare(osg
URL https://github.com/OpenMW/osg/archive/e65f47c4ab3a0b53cc19f517961671e5f840a08d.zip
URL_HASH MD5=0c967fe48d80744f6956f6b0b67ef7c6
SOURCE_DIR fetched/osg
)
FetchContent_MakeAvailableExcludeFromAll(osg)
set(OPENSCENEGRAPH_INCLUDE_DIRS ${osg_SOURCE_DIR}/include ${osg_BINARY_DIR}/include PARENT_SCOPE)
set(OSG_LIBRARIES OpenThreads osg PARENT_SCOPE)
foreach(_name ${USED_OSG_COMPONENTS})
string(TOUPPER ${_name} _name_uc)
set(${_name_uc}_LIBRARIES ${_name} PARENT_SCOPE)
endforeach()
foreach(_name ${USED_OSG_PLUGINS})
string(TOUPPER ${_name} _name_uc)
set(${_name_uc}_LIBRARY ${_name} PARENT_SCOPE)
endforeach()
endif()

@ -13,5 +13,6 @@ set(OSG_FFMPEG_VIDEOPLAYER_SOURCE_FILES
include_directories(${FFmpeg_INCLUDE_DIRS})
add_library(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} STATIC ${OSG_FFMPEG_VIDEOPLAYER_SOURCE_FILES})
target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} ${FFmpeg_LIBRARIES} ${Boost_THREAD_LIBRARY})
target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} ${OSG_LIBRARIES})
link_directories(${CMAKE_CURRENT_BINARY_DIR})

Loading…
Cancel
Save