@ -75,6 +75,11 @@ option(BUILD_MYGUI_PLUGIN "build MyGUI plugin for OpenMW resources, to use with
# O S X d e p l o y m e n t
option ( OPENMW_OSX_DEPLOYMENT OFF )
if ( MSVC )
option ( OPENMW_MP_BUILD "Build OpenMW with /MP flag" OFF )
option ( OPENMW_LTO_BUILD "Build OpenMW with Link-Time Optimization (Needs ~2GB of RAM)" OFF )
endif ( )
# L o c a t i o n o f m o r r o w i n d d a t a f i l e s
if ( APPLE )
set ( MORROWIND_DATA_FILES "./data" CACHE PATH "location of Morrowind data files" )
@ -138,6 +143,9 @@ if (WIN32)
# S u p p r e s s WinMain ( ) , p r o v i d e d b y S D L
add_definitions ( -DSDL_MAIN_HANDLED )
# G e t r i d o f u s e l e s s c r u d f r o m w i n d o w s . h
add_definitions ( -DNOMINMAX -DWIN32_LEAN_AND_MEAN )
endif ( )
# D e p e n d e n c i e s
@ -268,10 +276,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
endif ( CMAKE_CXX_COMPILER_ID STREQUAL GNU AND "${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6 )
elseif ( MSVC )
# E n a b l e l i n k - t i m e c o d e g e n e r a t i o n g l o b a l l y f o r a l l l i n k i n g
if ( OPENMW_LTO_BUILD )
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL" )
set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
set ( CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG" )
set ( CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG" )
endif ( )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /FORCE:MULTIPLE" )
endif ( CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang )
IF ( NOT WIN32 AND NOT APPLE )
@ -380,6 +392,8 @@ if(WIN32)
ENDIF ( BUILD_MYGUI_PLUGIN )
INSTALL ( DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "." )
FILE ( GLOB plugin_dir "${OpenMW_BINARY_DIR}/Release/osgPlugins-*" )
INSTALL ( DIRECTORY ${ plugin_dir } DESTINATION "." )
SET ( CPACK_GENERATOR "NSIS" )
SET ( CPACK_PACKAGE_NAME "OpenMW" )
@ -492,9 +506,9 @@ endif()
if ( WIN32 )
if ( MSVC )
if ( MULTITHREADED _BUILD)
if ( OPENMW_MP _BUILD)
set ( MT_BUILD "/MP" )
endif ( MULTITHREADED_BUILD )
endif ( )
foreach ( OUTPUTCONFIG ${ CMAKE_CONFIGURATION_TYPES } )
string ( TOUPPER ${ OUTPUTCONFIG } OUTPUTCONFIG )
@ -502,20 +516,22 @@ if (WIN32)
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY_ ${ OUTPUTCONFIG } "$(ProjectDir)$(Configuration)" )
endforeach ( OUTPUTCONFIG )
if ( USE_DEBUG_CONSOLE )
if ( USE_DEBUG_CONSOLE AND BUILD_OPENMW )
set_target_properties ( openmw PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE" )
set_target_properties ( openmw PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE" )
set_target_properties ( openmw PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE" )
else ( )
else if ( BUILD_OPENMW )
# T u r n o f f d e b u g c o n s o l e , d e b u g o u t p u t w i l l b e w r i t t e n t o v i s u a l s t u d i o o u t p u t i n s t e a d
set_target_properties ( openmw PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS" )
set_target_properties ( openmw PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:WINDOWS" )
endif ( )
if ( BUILD_OPENMW )
# R e l e a s e b u i l d s u s e t h e d e b u g c o n s o l e
set_target_properties ( openmw PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE" )
set_target_properties ( openmw PROPERTIES COMPILE_DEFINITIONS_RELEASE "_CONSOLE" )
set_target_properties ( openmw PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:CONSOLE" )
endif ( )
# P l a y a b i t w i t h t h e w a r n i n g l e v e l s
@ -524,8 +540,8 @@ if (WIN32)
set ( WARNINGS_DISABLE
# W a r n i n g s t h a t a r e n ' t e n a b l e d n o r m a l l y a n d d o n ' t n e e d t o b e e n a b l e d
# T h e y ' r e u n n e e d e d a n d s o m e t i m e s c o m p l e t e l y r e t a r d e d w a r n i n g s t h a t / W a l l e n a b l e s
# N o t g o i n g t o b o t h e r c o m m e n t i n g t h e m a s t h e y t e n d t o w a r n o n e v e r y s t a n d a r d l i b r a r y f i l e s
4 0 6 1 4 2 6 3 4 2 6 4 4 2 6 6 4 3 5 0 4 3 7 1 4 51 4 4 5 4 8 4 5 7 1 4 6 1 0 4 6 1 9 4 6 2 3 4 6 2 5 4 6 2 6 4 6 2 8 4 6 4 0 4 6 6 8 4 7 1 0 4 7 1 1 4 8 2 0 4 8 2 6 4 9 1 7 4 9 4 6
# N o t g o i n g t o b o t h e r c o m m e n t i n g t h e m a s t h e y t e n d t o w a r n o n e v e r y s t a n d a r d l i b r a r y f i l e
4 0 6 1 4 2 6 3 4 2 6 4 4 2 6 6 4 3 5 0 4 3 7 1 4 43 5 4 51 4 4 5 4 8 4 5 7 1 4 6 1 0 4 6 1 9 4 6 2 3 4 6 2 5 4 6 2 6 4 6 2 8 4 6 4 0 4 6 6 8 4 7 1 0 4 7 1 1 4 8 2 0 4 8 2 6 4 9 1 7 4 9 4 6
# W a r n i n g s t h a t a r e t h r o w n o n s t a n d a r d l i b r a r i e s a n d n o t O p e n M W
4 3 4 7 # N o n - t e m p l a t e f u n c t i o n w i t h s a m e n a m e a n d p a r a m e t e r c o u n t a s t e m p l a t e f u n c t i o n
@ -547,6 +563,7 @@ if (WIN32)
4 1 2 7 # C o n d i t i o n a l e x p r e s s i o n i s c o n s t a n t
4 2 4 2 # S t o r i n g v a l u e i n a v a r i a b l e o f a s m a l l e r t y p e , p o s s i b l e l o s s o f d a t a
4 2 4 4 # S t o r i n g v a l u e o f o n e t y p e i n v a r i a b l e o f another ( size_t in int, for example )
4 2 4 5 # S i g n e d / u n s i g n e d m i s m a t c h
4 2 6 7 # C o n v e r s i o n f r o m ' s i z e _ t ' t o ' i n t ' , p o s s i b l e l o s s o f d a t a
4 3 0 5 # T r u n c a t i n g value ( double to float, for example )
4 3 0 9 # V a r i a b l e o v e r f l o w , t r y i n g t o s t o r e 1 2 8 i n a s i g n e d c h a r f o r e x a m p l e
@ -562,17 +579,42 @@ if (WIN32)
set ( WARNINGS "${WARNINGS} /wd${d}" )
endforeach ( d )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS} ${MT_BUILD}" )
set_target_properties ( components PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
# o i c s u s e s t i n y x m l , w h i c h h a s a n i n i t i a l i z e d b u t u n u s e d v a r i a b l e
set ( OICS_WARNINGS "${WARNINGS} /wd4189" )
set_target_properties ( oics PROPERTIES COMPILE_FLAGS "${OICS_WARNINGS} ${MT_BUILD}" )
set_target_properties ( oics PROPERTIES COMPILE_FLAGS "${WARNINGS} /wd4189 ${MT_BUILD}" )
set_target_properties ( osg-ffmpeg-videoplayer PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
if ( BUILD_BSATOOL )
set_target_properties ( bsatool PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
endif ( )
if ( BUILD_ESMTOOL )
set_target_properties ( esmtool PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
endif ( )
if ( BUILD_ESSIMPORTER )
set_target_properties ( openmw-essimporter PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
endif ( )
if ( BUILD_LAUNCHER )
set_target_properties ( openmw-launcher PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
endif ( )
if ( BUILD_MWINIIMPORTER )
set_target_properties ( openmw-iniimporter PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
endif ( )
if ( BUILD_OPENCS )
# Q T t r i g g e r s a n i n f o r m a t i o n a l w a r n i n g t h a t t h e o b j e c t l a y o u t m a y d i f f e r w h e n c o m p i l e d w i t h / v d 2
set ( OPENCS_WARNINGS "${WARNINGS} ${MT_BUILD} /wd4435" )
set_target_properties ( openmw-cs PROPERTIES COMPILE_FLAGS ${ OPENCS_WARNINGS } )
endif ( BUILD_OPENCS )
set_target_properties ( openmw-cs PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
endif ( )
if ( BUILD_OPENMW )
set_target_properties ( openmw PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
endif ( )
if ( BUILD_WIZARD )
set_target_properties ( openmw-wizard PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}" )
endif ( )
endif ( MSVC )
# T O D O : A t s o m e p o i n t r e l e a s e b u i l d s s h o u l d n o t u s e t h e c o n s o l e b u t r a t h e r w r i t e t o a l o g f i l e