@ -56,6 +56,8 @@ configure_file ("${OpenMW_SOURCE_DIR}/docs/mainpage.hpp.cmake" "${OpenMW_BINARY_
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_UNITY_BUILD "Use fewer compilation units to speed up compile time" FALSE )
@ -199,9 +201,67 @@ IF(BOOST_STATIC)
set ( Boost_USE_STATIC_LIBS ON )
endif ( )
find_package ( OpenSceneGraph 3.2.0 REQUIRED osgDB osgViewer osg GA osgAnimation osgParticle osgQt osgUtil osgFX )
find_package ( OpenSceneGraph 3.2.0 REQUIRED osgDB osgViewer osg Text osg GA osgAnimation osgParticle osgQt osgUtil osgFX )
include_directories ( ${ OPENSCENEGRAPH_INCLUDE_DIRS } )
if ( OSG_STATIC )
macro ( use_static_osg_plugin_library PLUGIN_NAME )
set ( PLUGIN_NAME_DBG ${ PLUGIN_NAME } d ${ PLUGIN_NAME } D ${ PLUGIN_NAME } _d ${ PLUGIN_NAME } _D ${ PLUGIN_NAME } _debug ${ PLUGIN_NAME } )
# F o r n o w , u s e r s w i s h i n g t o d o a s t a t i c b u i l d w i l l n e e d t o p a s s t h e p a t h t o w h e r e t h e p l u g i n s r e s i d e
# M o r e c l e v e r l o g i c w o u l d n e e d t o d e d u c e t h e p a t h , p r o b a b l y i n s t a l l e d u n d e r < O p e n S c e n e G r a p h > / l i b / o s g P l u g i n s - < X . X . X >
find_library ( ${ PLUGIN_NAME } _LIBRARY_REL NAMES ${ PLUGIN_NAME } HINTS ${ OSG_PLUGIN_LIB_SEARCH_PATH } )
find_library ( ${ PLUGIN_NAME } _LIBRARY_DBG NAMES ${ PLUGIN_NAME_DBG } HINTS ${ OSG_PLUGIN_LIB_SEARCH_PATH } )
make_library_set ( ${ PLUGIN_NAME } _LIBRARY )
if ( "${${PLUGIN_NAME}_LIBRARY}" STREQUAL "" )
message ( FATAL_ERROR "Unable to find static OpenSceneGraph plugin: ${PLUGIN_NAME}" )
endif ( )
set ( OPENSCENEGRAPH_LIBRARIES ${ OPENSCENEGRAPH_LIBRARIES } ${ ${PLUGIN_NAME } _LIBRARY} )
endmacro ( )
macro ( use_static_osg_plugin_dep DEPENDENCY )
find_package ( ${ DEPENDENCY } REQUIRED )
set ( OPENSCENEGRAPH_LIBRARIES ${ OPENSCENEGRAPH_LIBRARIES } ${ ${DEPENDENCY } _LIBRARIES} )
endmacro ( )
add_definitions ( -DOSG_LIBRARY_STATIC )
set ( PLUGIN_LIST
o s g d b _ p n g # d e p e n d s o n l i b p n g , z l i b
o s g d b _ t g a
o s g d b _ d d s
o s g d b _ j p e g # d e p e n d s o n l i b j p e g
)
foreach ( PLUGIN ${ PLUGIN_LIST } )
use_static_osg_plugin_library ( ${ PLUGIN } )
endforeach ( )
# O S G s t a t i c p l u g i n s n e e d t o l i n k e d a g a i n s t t h e i r r e s p e c t i v e d e p e n d e n c i e s
set ( PLUGIN_DEPS_LIST
P N G # n e e d e d b y o s g d b _ p n g
Z L I B # n e e d e d b y o s g d b _ p n g
J P E G # n e e d e d b y o s g d b _ j p e g
)
foreach ( DEPENDENCY ${ PLUGIN_DEPS_LIST } )
use_static_osg_plugin_dep ( ${ DEPENDENCY } )
endforeach ( )
endif ( )
if ( QT_STATIC )
if ( WIN32 )
if ( DESIRED_QT_VERSION MATCHES 4 )
# Q t C o r e n e e d s W S A A s y n c S e l e c t f r o m W s 2 _ 3 2 . l i b
set ( QT_QTCORE_LIBRARY ${ QT_QTCORE_LIBRARY } Ws2_32.lib )
message ( "QT_QTCORE_LIBRARY: ${QT_QTCORE_LIBRARY}" )
endif ( )
endif ( )
endif ( )
find_package ( MyGUI REQUIRED )
if ( ${ MYGUI_VERSION } VERSION_LESS "3.2.1" )
message ( FATAL_ERROR "OpenMW requires MyGUI 3.2.1 or later, please install the latest version from http://mygui.info" )