Fix MYGUI/OSG_STATIC and BUILD_SHARED_LIBS

pull/3047/head
Gleb Mazovetskiy 4 years ago
parent 99061345cc
commit 3d334dae75

@ -109,19 +109,23 @@ 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(SDL2_STATIC "Link static build of SDL into the binaries" FALSE)
option(QT_STATIC "Link static build of QT 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) option(OPENMW_USE_SYSTEM_OSG "Use system provided OpenSceneGraph libraries" ON)
option(OSG_STATIC "Link static build of OpenSceneGraph into the binaries" OFF) if(OPENMW_USE_SYSTEM_OSG)
if(NOT OPENMW_USE_SYSTEM_OSG) set(_osg_static_default OFF)
set(OSG_STATIC ON CACHE BOOL "") else()
set(_osg_static_default ON)
endif() endif()
option(OSG_STATIC "Link static build of OpenSceneGraph into the binaries" ${_osg_static_default})
option(OPENMW_USE_SYSTEM_BULLET "Use system provided bullet physics library" ON)
option(OPENMW_USE_SYSTEM_MYGUI "Use system provided mygui library" ON) option(OPENMW_USE_SYSTEM_MYGUI "Use system provided mygui library" ON)
option(MYGUI_STATIC "Link static build of Mygui into the binaries" OFF) if(OPENMW_USE_SYSTEM_MYGUI)
if(NOT OPENMW_USE_SYSTEM_MYGUI) set(_mygui_static_default OFF)
set(MYGUI_STATIC ON CACHE BOOL "") else()
set(_mygui_static_default ON)
endif() 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_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) option(OPENMW_LTO_BUILD "Build OpenMW with Link-Time Optimization (Needs ~2GB of RAM)" OFF)

@ -60,13 +60,18 @@ if(NOT OPENMW_USE_SYSTEM_MYGUI)
set(MYGUI_BUILD_PLUGINS OFF CACHE BOOL "") set(MYGUI_BUILD_PLUGINS OFF CACHE BOOL "")
set(MYGUI_BUILD_TOOLS 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) include(FetchContent)
FetchContent_Declare(mygui FetchContent_Declare(mygui
URL https://github.com/MyGUI/mygui/archive/MyGUI3.4.0.zip URL https://github.com/MyGUI/mygui/archive/MyGUI3.4.0.zip
URL_HASH MD5=9e990a4240430cbf567bfe73488a274e URL_HASH MD5=9e990a4240430cbf567bfe73488a274e
SOURCE_DIR fetched/mygui SOURCE_DIR fetched/mygui
) )
set(BUILD_SHARED_LIBS ${MYGUI_STATIC})
FetchContent_MakeAvailableExcludeFromAll(mygui) FetchContent_MakeAvailableExcludeFromAll(mygui)
set(MyGUI_INCLUDE_DIRS ${mygui_SOURCE_DIR}/MyGUIEngine/include PARENT_SCOPE) set(MyGUI_INCLUDE_DIRS ${mygui_SOURCE_DIR}/MyGUIEngine/include PARENT_SCOPE)
@ -98,6 +103,12 @@ if(NOT OPENMW_USE_SYSTEM_OSG)
set(OPENGL_PROFILE "GL2" CACHE STRING "") 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 18 Jan 2021. # branch OpenSceneGraph-3.6 on 18 Jan 2021.
# + https://github.com/openscenegraph/OpenSceneGraph/pull/1032 # + https://github.com/openscenegraph/OpenSceneGraph/pull/1032
# + https://github.com/openscenegraph/OpenSceneGraph/pull/1033 # + https://github.com/openscenegraph/OpenSceneGraph/pull/1033
@ -108,7 +119,6 @@ if(NOT OPENMW_USE_SYSTEM_OSG)
URL_HASH MD5=d67088aeb976486287343c1287b56ba3 URL_HASH MD5=d67088aeb976486287343c1287b56ba3
SOURCE_DIR fetched/osg SOURCE_DIR fetched/osg
) )
set(BUILD_SHARED_LIBS ${OSG_STATIC})
FetchContent_MakeAvailableExcludeFromAll(osg) FetchContent_MakeAvailableExcludeFromAll(osg)
set(OPENSCENEGRAPH_INCLUDE_DIRS ${osg_SOURCE_DIR}/include ${osg_BINARY_DIR}/include PARENT_SCOPE) set(OPENSCENEGRAPH_INCLUDE_DIRS ${osg_SOURCE_DIR}/include ${osg_BINARY_DIR}/include PARENT_SCOPE)

Loading…
Cancel
Save