Changeset 7143
- Timestamp:
- Jun 10, 2010, 1:44:21 PM (14 years ago)
- Location:
- code/branches/presentation3
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/cmake/tools/TargetUtilities.cmake
r7139 r7143 34 34 # NO_DLL_INTERFACE: Link statically with MSVC 35 35 # NO_SOURCE_GROUPS: Don't create msvc source groups 36 # STATIC/SHARED: Inherited from ADD_LIBRARY 37 # MODULE: For dynamic module libraries 38 # WIN32: Inherited from ADD_EXECUTABLE 36 # MODULE: For dynamic module libraries (libraries only) 37 # WIN32: Inherited from ADD_EXECUTABLE (executables only) 39 38 # PCH_NO_DEFAULT: Do not make precompiled header files default if 40 39 # specified with PCH_FILE … … 47 46 # SOURCE_FILES: Source files for the target 48 47 # DEFINE_SYMBOL: Sets the DEFINE_SYMBOL target property 49 # Usage: DEFINE_SYMBOL static "symbol" shared "symbol2"50 # (or shared "symbol2" static "symbol")51 48 # TOLUA_FILES: Files with tolua interface 52 49 # PCH_FILE: Precompiled header file … … 71 68 72 69 MACRO(ORXONOX_ADD_LIBRARY _target_name) 73 TU_ADD_TARGET(${_target_name} LIBRARY " STATIC;SHARED" ${ARGN})70 TU_ADD_TARGET(${_target_name} LIBRARY "MODULE" ${ARGN}) 74 71 ENDMACRO(ORXONOX_ADD_LIBRARY) 75 72 … … 85 82 # Specify all possible options (either switch or with add. arguments) 86 83 SET(_switches FIND_HEADER_FILES EXCLUDE_FROM_ALL ORXONOX_EXTERNAL 87 NO_DLL_INTERFACE NO_SOURCE_GROUPS ${_additional_switches}88 PCH_NO_DEFAULT NO_INSTALL MODULE NO_VERSION)84 NO_DLL_INTERFACE NO_SOURCE_GROUPS PCH_NO_DEFAULT 85 NO_INSTALL NO_VERSION ${_additional_switches}) 89 86 SET(_list_names LINK_LIBRARIES VERSION SOURCE_FILES DEFINE_SYMBOL 90 TOLUA_FILES PCH_FILE PCH_EXCLUDE OUTPUT_NAME)87 TOLUA_FILES PCH_FILE PCH_EXCLUDE OUTPUT_NAME) 91 88 PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN}) 92 89 … … 149 146 ENDIF() 150 147 151 # Certain libraries don't have dllexport/dllimport and can't be linked shared with msvc148 # Set link mode (SHARED/STATIC) 152 149 IF(MSVC AND _arg_NO_DLL_INTERFACE) 153 SET(_arg_SHARED) 154 SET(_arg_STATIC STATIC) 150 # Certain libraries don't have dllexport/dllimport and can't be linked shared with MSVC 151 SET(_link_mode STATIC) 152 ELSEIF(_arg_ORXONOX_EXTERNAL) 153 # Externals can be linked shared or statically 154 SET(_link_mode ${ORXONOX_EXTERNAL_LINK_MODE}) 155 ELSE() 156 # All our own libraries are linked dynamically because of static symbols 157 SET(_link_mode SHARED) 155 158 ENDIF() 156 159 … … 161 164 ENDIF() 162 165 163 # Set default linking if required164 IF(NOT _arg_SHARED AND NOT _arg_STATIC)165 IF("${ORXONOX_DEFAULT_LINK}" STREQUAL "STATIC")166 SET(_arg_STATIC STATIC)167 ELSEIF("${ORXONOX_DEFAULT_LINK}" STREQUAL "SHARED")168 SET(_arg_SHARED SHARED)169 ENDIF()170 ENDIF()171 172 # MODULE A173 # Always create shared libraries174 IF(_arg_MODULE)175 SET(_arg_SHARED SHARED)176 SET(_arg_STATIC)177 ENDIF()178 179 166 # Don't compile header files 180 167 FOREACH(_file ${_${_target_name}_files}) … … 188 175 # Add the library/executable 189 176 IF("${_target_type}" STREQUAL "LIBRARY") 190 ADD_LIBRARY(${_target_name} ${_ arg_STATIC} ${_arg_SHARED}177 ADD_LIBRARY(${_target_name} ${_link_mode} 191 178 ${_arg_EXCLUDE_FROM_ALL} ${_${_target_name}_files}) 192 179 ELSE() … … 215 202 ENDIF() 216 203 217 # MODULE B204 # Configure modules 218 205 IF (_arg_MODULE) 219 206 SET_TARGET_PROPERTIES(${_target_name} PROPERTIES … … 230 217 231 218 # DEFINE_SYMBOL 232 IF(_arg_DEFINE_SYMBOL OR NOT _arg_ORXONOX_EXTERNAL) 233 IF(_arg_DEFINE_SYMBOL) 234 # Format is: static "static_symbol" shared "shared_symbol" 235 # but the order doesn't matter 236 LIST(LENGTH _arg_DEFINE_SYMBOL _define_symbol_length) 237 IF (_define_symbol_length LESS 2) 238 MESSAGE(FATAL_ERROR "Number of expected arguments for DEFINE_SYMBOL is at least 2: static \"STATIC_SYMBOL\" shared \"SHARED_SYMBOL\"") 239 ENDIF() 240 STRING(TOLOWER "${_arg_STATIC}${_arg_SHARED}" _static_shared_lower) 241 LIST(FIND _arg_DEFINE_SYMBOL ${_static_shared_lower} _symbol_definition_index) 242 MATH(EXPR _symbol_definition_index "${_symbol_definition_index} + 1") 243 IF(_symbol_definition_index LESS _define_symbol_length) 244 LIST(GET _arg_DEFINE_SYMBOL ${_symbol_definition_index} _symbol_definition) 245 ENDIF() 246 ELSE() 247 # Automatically add the macro definitions for our own libraries 248 SET(_symbol_definition "${_target_name_upper}_${_arg_STATIC}${_arg_SHARED}_BUILD") 249 ENDIF() 250 251 # Use the DEFINE_SYMBOL property for shared builds (not used by CMake for static builds), 252 # but if we only use COMPILE_FLAGS, CMake will define a symbol anyway. 253 IF(_arg_SHARED) 254 SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL ${_symbol_definition}) 255 ELSE() 256 GET_TARGET_PROPERTY(_compile_flags ${_target_name} COMPILE_FLAGS) 257 IF(NOT _compile_flags) 258 SET(_compile_flags) 259 ENDIF() 260 SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "${_compile_flags} -D${_symbol_definition}") 261 ENDIF() 219 IF(_arg_DEFINE_SYMBOL) 220 SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL ${_arg_DEFINE_SYMBOL}) 221 ELSEIF(NOT _arg_ORXONOX_EXTERNAL) 222 # Automatically add the macro definitions for our own libraries 223 SET_TARGET_PROPERTIES(${_target_name} PROPERTIES DEFINE_SYMBOL "${_target_name_upper}_SHARED_BUILD") 262 224 ENDIF() 263 225 … … 279 241 ENDIF() 280 242 281 IF((${_target_type} STREQUAL "EXECUTABLE" OR NOT _arg_STATIC) AND NOT _arg_NO_INSTALL) 243 # Install all targets except for static ones (executables also have SHARED in _link_mode) 244 IF((${_link_mode} STREQUAL "SHARED") AND NOT _arg_NO_INSTALL) 282 245 IF(_arg_MODULE) 283 246 INSTALL(TARGETS ${_target_name} -
code/branches/presentation3/src/CMakeLists.txt
r7142 r7143 31 31 INCLUDE(OrxonoxConfig.cmake) 32 32 33 ####### ######### Library Defines ################33 ####### Library Behaviour (dependencies) ######## 34 34 35 35 # Disable Boost auto linking completely … … 46 46 ADD_COMPILER_FLAGS("-DSTATIC_BUILD" WIN32 NOT LINK_TCL_DYNAMIC) 47 47 48 ######### Library Behaviour (external) ########## 49 48 50 # Use TinyXML++ 49 51 ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP") 52 53 # Default linking for externals is SHARED 54 SET(ORXONOX_EXTERNAL_LINK_MODE SHARED CACHE STRING "Link mode for external libraries that we build ourselves. Note: on Windows, some libraries cannot be linked shared.") 55 56 IF(ORXONOX_EXTERNAL_LINK_MODE STREQUAL "SHARED") 57 SET(_external_shared_link TRUE) 58 ELSE() 59 SET(_external_shared_link FALSE) 60 ENDIF() 61 # If no defines are specified, these libs get linked dynamically 62 ADD_COMPILER_FLAGS("-DCEGUILUA_STATIC" WIN32 NOT _external_shared_link) 63 ADD_COMPILER_FLAGS("-DOGRE_GUIRENDERER_STATIC_LIB" WIN32 NOT _external_shared_link) 64 ADD_COMPILER_FLAGS("-DOIS_STATIC_LIB" WIN32 NOT _external_shared_link) 65 ADD_COMPILER_FLAGS("-DTOLUA_STATIC_BUILD" WIN32 NOT _external_shared_link) 50 66 51 67 ############## Include Directories ############## -
code/branches/presentation3/src/OrxonoxConfig.cmake
r5929 r7143 27 27 28 28 #################### Options #################### 29 30 # Default linking is SHARED31 SET(ORXONOX_DEFAULT_LINK SHARED)32 29 33 30 # Use, i.e. don't skip the full RPATH for the build tree -
code/branches/presentation3/src/external/ceguilua/CMakeLists.txt
r7135 r7143 75 75 NO_SOURCE_GROUPS 76 76 DEFINE_SYMBOL 77 shared "CEGUILUA_EXPORTS" static "CEGUILUA_STATIC"77 "CEGUILUA_EXPORTS" 78 78 VERSION 79 79 ${CEGUI_VERSION} -
code/branches/presentation3/src/external/ogreceguirenderer/CMakeLists.txt
r7135 r7143 32 32 ORXONOX_ADD_LIBRARY(ogreceguirenderer_orxonox 33 33 ORXONOX_EXTERNAL 34 DEFINE_SYMBOL 35 "OGRE_GUIRENDERER_EXPORTS" 36 VERSION 37 1.4.9 34 38 LINK_LIBRARIES 35 39 ${OGRE_LIBRARY} 36 40 ${CEGUI_LIBRARY} 37 DEFINE_SYMBOL38 shared "OGRE_GUIRENDERER_EXPORTS" static "OGRE_GUIRENDERER_STATIC_LIB"39 VERSION40 1.4.941 41 SOURCE_FILES 42 42 ${OCR_FILES} -
code/branches/presentation3/src/external/ois/CMakeLists.txt
r7142 r7143 57 57 ORXONOX_EXTERNAL 58 58 DEFINE_SYMBOL 59 shared "OIS_NONCLIENT_BUILD" static "OIS_STATIC_LIB"59 "OIS_NONCLIENT_BUILD" 60 60 VERSION 61 61 1.2 -
code/branches/presentation3/src/external/tolua/CMakeLists.txt
r7135 r7143 35 35 ORXONOX_EXTERNAL 36 36 DEFINE_SYMBOL 37 shared "TOLUA_SHARED_BUILD" static "TOLUA_STATIC_BUILD"37 "TOLUA_SHARED_BUILD" 38 38 VERSION 39 39 1.0.92
Note: See TracChangeset
for help on using the changeset viewer.