Changeset 8729 for code/trunk/cmake
- Timestamp:
- Jul 4, 2011, 2:47:44 AM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/cmake/CompilerConfigGCC.cmake
r8368 r8729 43 43 IF(_compare_result GREATER -1) 44 44 SET(PCH_COMPILER_SUPPORT TRUE) 45 ENDIF() 46 47 # __COUNTER__ macro was only added in GCC 4.3 48 # It might be required to make full build units work 49 COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.3.0" _compare_result) 50 IF(_compare_result GREATER -1) 51 SET(HAVE_COUNTER_MACRO TRUE) 45 52 ENDIF() 46 53 -
code/trunk/cmake/CompilerConfigMSVC.cmake
r8368 r8729 33 33 # Orxonox only supports MSVC 8 and above, which gets asserted above 34 34 SET(PCH_COMPILER_SUPPORT TRUE) 35 36 # __COUNTER__ macro has been around since VS 2005 37 # It might be required to make full build units work 38 SET(HAVE_COUNTER_MACRO TRUE) 35 39 36 40 -
code/trunk/cmake/tools/GenerateToluaBindings.cmake
r8363 r8729 49 49 SET(_tolua_pkgfile "${CMAKE_CURRENT_BINARY_DIR}/tolua.pkg") 50 50 SET(_tolua_cxxfile "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.cc") 51 SET(_tolua_hfile "${CMAKE_BINARY_DIR}/src/toluabind/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.h")51 #SET(_tolua_hfile "${CMAKE_BINARY_DIR}/src/toluabind/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.h") 52 52 53 53 SET(${_target_source_files} 54 54 ${${_target_source_files}} 55 55 ${_tolua_cxxfile} 56 ${_tolua_hfile}57 56 PARENT_SCOPE 58 57 ) 59 58 60 # Disable annoying GCC warnings61 59 IF(CMAKE_COMPILER_IS_GNU) 60 # Disable annoying GCC warnings 62 61 SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES COMPILE_FLAGS "-w") 62 ENDIF() 63 64 IF(MSVC) 65 # Including the file in a build unit is impossible because CMAKE_CFG_INTDIR 66 # exands to an expression that the compiler doesn't understand 67 SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES EXCLUDE_FROM_BUILD_UNITS TRUE) 63 68 ENDIF() 64 69 … … 70 75 ENDFOREACH(_tolua_inputfile) 71 76 77 IF(TOLUA_PARSER_HOOK_SCRIPT) 78 # Hook scripts may contain functions that act as Tolua hooks 79 SET(_hook_script -L "${TOLUA_PARSER_HOOK_SCRIPT}") 80 ENDIF() 81 72 82 ADD_CUSTOM_COMMAND( 73 OUTPUT ${_tolua_cxxfile} ${_tolua_hfile}83 OUTPUT ${_tolua_cxxfile} 74 84 COMMAND toluaapp_orxonox -n ${_tolua_package} 75 85 -w ${CMAKE_CURRENT_SOURCE_DIR} 76 86 -o ${_tolua_cxxfile} 77 -H ${_tolua_hfile}78 87 -s ${TOLUA_PARSER_SOURCE} 88 ${_hook_script} 79 89 ${_tolua_pkgfile} 80 90 DEPENDS ${TOLUA_PARSER_DEPENDENCIES} -
code/trunk/cmake/tools/SourceFileUtilities.cmake
r7818 r8729 25 25 # adds the current directory. 26 26 # Also compiles multiple source files into a single 27 # one by including them28 # Use COMPILATION_[BEGIN|END]in27 # translation unit (faster) 28 # Use [END_]BUILD_UNIT in 29 29 # [ADD|SET]_SOURCE_FILES and specify the name of 30 # the new source file after COMPILATION_BEGIN30 # the new source file after BUILD_UNIT 31 31 # GET_ALL_HEADER_FILES - Finds all header files recursively. 32 32 # GENERATE_SOURCE_GROUPS - Set Visual Studio source groups. … … 36 36 SET(_source_files) 37 37 FOREACH(_file ${ARGN}) 38 IF(_file MATCHES "^( COMPILATION_BEGIN|COMPILATION_END)$")38 IF(_file MATCHES "^(BUILD_UNIT|END_BUILD_UNIT)$") 39 39 # Append keywords verbatim 40 40 LIST(APPEND _source_files ${_file}) -
code/trunk/cmake/tools/TargetUtilities.cmake
r8421 r8729 40 40 # NO_INSTALL: Do not install the target at all 41 41 # NO_VERSION: Prevents adding any version to a target 42 # NO_BUILD_UNITS: Disables automatic (full) build units 42 43 # 43 44 # Lists: … … 54 55 # PCH_EXCLUDE: Source files to be excluded from PCH support 55 56 # OUTPUT_NAME: If you want a different name than the target name 57 # EXCLUDE_FROM_BUILD_UNITS: Specifies files that are not put into 58 # automatic (full) build units. They can still 59 # explicitely be included in a BUILD_UNIT (partial) 56 60 # Note: 57 61 # This function also installs the target! … … 62 66 # 63 67 68 INCLUDE(BuildUnits) 64 69 INCLUDE(CMakeDependentOption) 65 70 INCLUDE(CapitaliseName) … … 87 92 SET(_switches FIND_HEADER_FILES EXCLUDE_FROM_ALL ORXONOX_EXTERNAL 88 93 NO_DLL_INTERFACE NO_SOURCE_GROUPS PCH_NO_DEFAULT 89 NO_INSTALL NO_VERSION ${_additional_switches}) 94 NO_INSTALL NO_VERSION NO_BUILD_UNITS 95 ${_additional_switches}) 90 96 SET(_list_names LINK_LIBRARIES VERSION SOURCE_FILES 91 97 DEFINE_SYMBOL TOLUA_FILES PCH_FILE 92 98 PCH_EXCLUDE OUTPUT_NAME LINK_LIBS_LINUX 93 LINK_LIBS_WIN32 LINK_LIBS_APPLE LINK_LIBS_UNIX) 99 LINK_LIBS_WIN32 LINK_LIBS_APPLE LINK_LIBS_UNIX 100 EXCLUDE_FROM_BUILD_UNITS) 94 101 95 102 PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN}) 96 103 97 # Process source files with support for compilations104 # Process source files with support for build units 98 105 # Note: All file paths are relative to the root source directory, even the 99 # name of the compilation file.106 # name of the build unit. 100 107 SET(_${_target_name}_source_files) 101 SET(_get_ compilation_file FALSE)102 SET(_add_to_ compilationFALSE)108 SET(_get_build_unit_file FALSE) 109 SET(_add_to_build_unit FALSE) 103 110 FOREACH(_file ${_arg_SOURCE_FILES}) 104 IF(_file STREQUAL "COMPILATION_BEGIN") 105 # Next file is the name of the compilation 106 SET(_get_compilation_file TRUE) 107 ELSEIF(_file STREQUAL "COMPILATION_END") 108 IF(NOT _compilation_file) 109 MESSAGE(FATAL_ERROR "No name provided for source file compilation") 110 ENDIF() 111 IF(NOT DISABLE_COMPILATIONS) 112 IF(NOT _compilation_include_string) 113 MESSAGE(STATUS "Warning: Empty source file compilation!") 114 ENDIF() 115 IF(EXISTS ${_compilation_file}) 116 FILE(READ ${_compilation_file} _include_string_file) 117 ENDIF() 118 IF(NOT _compilation_include_string STREQUAL "${_include_string_file}") 119 FILE(WRITE ${_compilation_file} "${_compilation_include_string}") 120 ENDIF() 121 LIST(APPEND _${_target_name}_source_files ${_compilation_file}) 122 ENDIF() 123 SET(_add_to_compilation FALSE) 124 ELSEIF(_get_compilation_file) 125 SET(_compilation_file ${CMAKE_BINARY_DIR}/${_file}) 126 SET(_get_compilation_file FALSE) 127 SET(_add_to_compilation TRUE) 128 SET(_compilation_include_string) 111 IF(_file STREQUAL "BUILD_UNIT") 112 # Next file is the name of the build unit 113 SET(_get_build_unit_file TRUE) 114 ELSEIF(_file STREQUAL "END_BUILD_UNIT") 115 IF(NOT _build_unit_file) 116 MESSAGE(FATAL_ERROR "No name provided for build unit") 117 ENDIF() 118 IF(ENABLE_BUILD_UNITS) 119 IF(NOT _build_unit_include_string) 120 MESSAGE(STATUS "Warning: Empty build unit!") 121 ENDIF() 122 IF(EXISTS ${_build_unit_file}) 123 FILE(READ ${_build_unit_file} _include_string_file) 124 ENDIF() 125 IF(NOT _build_unit_include_string STREQUAL "${_include_string_file}") 126 FILE(WRITE ${_build_unit_file} "${_build_unit_include_string}") 127 ENDIF() 128 LIST(APPEND _${_target_name}_source_files ${_build_unit_file}) 129 LIST(APPEND _${_target_name}_build_units ${_build_unit_file}) 130 # Store the number of files included. May be used for full build units. 131 SET_SOURCE_FILES_PROPERTIES(${_build_unit_file} 132 PROPERTIES BUILD_UNIT_SIZE "${_build_unit_count}") 133 ENDIF() 134 SET(_add_to_build_unit FALSE) 135 ELSEIF(_get_build_unit_file) 136 # Note: ${_file} is relative to the binary directory 137 SET(_build_unit_file ${CMAKE_BINARY_DIR}/${_file}) 138 SET(_get_build_unit_file FALSE) 139 SET(_add_to_build_unit TRUE) 140 SET(_build_unit_include_string) 141 SET(_build_unit_count "0") 129 142 ELSE() 130 143 # Default, add source file … … 146 159 LIST(APPEND _${_target_name}_source_files ${_file}) 147 160 148 # Handle compilations149 IF(_add_to_ compilation AND NOT DISABLE_COMPILATIONS)161 # Handle build units 162 IF(_add_to_build_unit AND ENABLE_BUILD_UNITS) 150 163 IF(_file MATCHES "\\.(c|cc|cpp|cxx)$") 151 SET(_compilation_include_string "${_compilation_include_string}#include \"${_file}\"\n") 164 SET(_build_unit_include_string "${_build_unit_include_string}#include \"${_file}\"\n") 165 MATH(EXPR _build_unit_count "1 + ${_build_unit_count}") 152 166 ENDIF() 153 167 # Don't compile these files, even if they are source files … … 183 197 ENDIF() 184 198 199 # Mark files to be excluded from build units 200 IF(_arg_EXCLUDE_FROM_BUILD_UNITS) 201 SET_SOURCE_FILES_PROPERTIES(${_arg_EXCLUDE_FROM_BUILD_UNITS} 202 PROPERTIES EXCLUDE_FROM_BUILD_UNITS TRUE) 203 ENDIF() 204 205 # Full build units 206 IF(ENABLE_BUILD_UNITS AND NOT _arg_NO_BUILD_UNITS) 207 # Use full build units even in partial mode for externals 208 IF(ENABLE_BUILD_UNITS MATCHES "full" OR _arg_ORXONOX_EXTERNAL) 209 GENERATE_BUILD_UNITS(${_target_name} _${_target_name}_files) 210 ENDIF() 211 ENDIF() 212 185 213 # First part (pre target) of precompiled header files 186 214 IF(PCH_COMPILER_SUPPORT AND _arg_PCH_FILE) … … 196 224 MARK_AS_ADVANCED(PCH_ENABLE_${_target_name_upper}) 197 225 198 IF(PCH_ENABLE_${_target_name_upper} )226 IF(PCH_ENABLE_${_target_name_upper} AND NOT PCH_DISABLE_${_target_name}) 199 227 PRECOMPILED_HEADER_FILES_PRE_TARGET(${_target_name} ${_arg_PCH_FILE} _${_target_name}_files EXCLUDE ${_arg_PCH_EXCLUDE}) 200 228 ENDIF() … … 344 372 345 373 # Second part of precompiled header files 346 IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE )374 IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE AND NOT PCH_DISABLE_${_target_name}) 347 375 PRECOMPILED_HEADER_FILES_POST_TARGET(${_target_name} ${_arg_PCH_FILE}) 348 376 ENDIF()
Note: See TracChangeset
for help on using the changeset viewer.