Optional static builds of OSG, MyGUI, Bullet
parent
f917037ead
commit
99ba45a308
@ -1,44 +1,55 @@
|
|||||||
#!/bin/bash -ex
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -xeo pipefail
|
||||||
|
|
||||||
free -m
|
free -m
|
||||||
|
|
||||||
if [[ "${BUILD_TESTS_ONLY}" ]]; then
|
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
|
env GENERATOR='Unix Makefiles' CONFIGURATION=Release CI/build_googletest.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
declare -a CMAKE_CONF_ENV=()
|
||||||
|
|
||||||
|
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
|
fi
|
||||||
|
|
||||||
mkdir build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
if [[ "${BUILD_TESTS_ONLY}" ]]; then
|
if [[ "${BUILD_TESTS_ONLY}" ]]; then
|
||||||
${ANALYZE} cmake \
|
env "${CMAKE_CONF_ENV[@]}" ${ANALYZE} cmake \
|
||||||
-D CMAKE_C_COMPILER="${CC}" \
|
"${CMAKE_CONF_OPTS[@]}" \
|
||||||
-D CMAKE_CXX_COMPILER="${CXX}" \
|
-DBUILD_OPENMW=OFF \
|
||||||
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
|
-DBUILD_BSATOOL=OFF \
|
||||||
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
-DBUILD_ESMTOOL=OFF \
|
||||||
-D CMAKE_INSTALL_PREFIX=install \
|
-DBUILD_LAUNCHER=OFF \
|
||||||
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
|
-DBUILD_MWINIIMPORTER=OFF \
|
||||||
-D USE_SYSTEM_TINYXML=TRUE \
|
-DBUILD_ESSIMPORTER=OFF \
|
||||||
-D BUILD_OPENMW=OFF \
|
-DBUILD_OPENCS=OFF \
|
||||||
-D BUILD_BSATOOL=OFF \
|
-DBUILD_WIZARD=OFF \
|
||||||
-D BUILD_ESMTOOL=OFF \
|
-DBUILD_UNITTESTS=ON \
|
||||||
-D BUILD_LAUNCHER=OFF \
|
-DGTEST_ROOT="${GOOGLETEST_DIR}" \
|
||||||
-D BUILD_MWINIIMPORTER=OFF \
|
-DGMOCK_ROOT="${GOOGLETEST_DIR}" \
|
||||||
-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}" \
|
|
||||||
..
|
|
||||||
else
|
else
|
||||||
${ANALYZE} cmake \
|
env "${CMAKE_CONF_ENV[@]}" ${ANALYZE} cmake \
|
||||||
-D CMAKE_C_COMPILER="${CC}" \
|
"${CMAKE_CONF_OPTS[@]}" \
|
||||||
-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 \
|
|
||||||
..
|
|
||||||
fi
|
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[@]}"
|
@ -0,0 +1,139 @@
|
|||||||
|
# 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)
|
||||||
|
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)
|
||||||
|
set(MYGUI_STATIC ON CACHE BOOL "")
|
||||||
|
|
||||||
|
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 "")
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
set(USED_OSG_COMPONENTS
|
||||||
|
osgDB
|
||||||
|
osgViewer
|
||||||
|
osgText
|
||||||
|
osgGA
|
||||||
|
osgParticle
|
||||||
|
osgUtil
|
||||||
|
osgFX
|
||||||
|
osgShadow
|
||||||
|
osgAnimation)
|
||||||
|
set(USED_OSG_COMPONENTS ${USED_OSG_COMPONENTS} PARENT_SCOPE)
|
||||||
|
set(USED_OSG_PLUGINS
|
||||||
|
osgdb_bmp
|
||||||
|
osgdb_dds
|
||||||
|
osgdb_freetype
|
||||||
|
osgdb_jpeg
|
||||||
|
osgdb_osg
|
||||||
|
osgdb_png
|
||||||
|
osgdb_serializers_osg
|
||||||
|
osgdb_tga)
|
||||||
|
set(USED_OSG_PLUGINS ${USED_OSG_PLUGINS} PARENT_SCOPE)
|
||||||
|
if(NOT OPENMW_USE_SYSTEM_OSG)
|
||||||
|
set(OSG_STATIC ON CACHE BOOL "")
|
||||||
|
|
||||||
|
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(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 "")
|
||||||
|
|
||||||
|
# branch OpenSceneGraph-3.6 on 18 Jan 2021.
|
||||||
|
# + https://github.com/openscenegraph/OpenSceneGraph/pull/1032
|
||||||
|
# + https://github.com/openscenegraph/OpenSceneGraph/pull/1033
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(osg
|
||||||
|
URL https://github.com/glebm/OpenSceneGraph/archive/041090d84d9d4b72f1202457fceae0ec6f79b663.zip
|
||||||
|
URL_HASH MD5=2cbf8126b27a45a2a44efe9fa39090f3
|
||||||
|
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()
|
Loading…
Reference in New Issue