Changeset 7818 for code/trunk/cmake
- Timestamp:
- Dec 26, 2010, 9:07:43 PM (14 years ago)
- Location:
- code/trunk/cmake
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/cmake/CompilerConfigMSVC.cmake
r7810 r7818 35 35 36 36 ######################## Options ######################## 37 38 # Currently VLD has a problem with MSVC9 although it actually is supported39 IF(MSVC80)40 OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" off)41 ENDIF()42 # Make sure the value is "on" or "off" for vld.ini43 IF(VISUAL_LEAK_DETECTOR_ENABLE)44 SET(VISUAL_LEAK_DETECTOR_ENABLE on)45 ELSE()46 SET(VISUAL_LEAK_DETECTOR_ENABLE off)47 ENDIF()48 37 49 38 # Orxonox only supports MSVC 8 and above, which gets asserted above … … 159 148 IF(ORXONOX_RELEASE) 160 149 ADD_LINKER_FLAGS("-INCREMENTAL:NO -OPT:ICF -OPT:REF -LTCG" ReleaseAll CACHE) 150 # Static linker flags have to be added manually to a target 151 SET(ORXONOX_STATIC_LINKER_FLAGS "/LTCG") 161 152 ELSE() 162 153 ADD_LINKER_FLAGS("-INCREMENTAL:YES" RelWithDebInfo CACHE) -
code/trunk/cmake/PackageConfigMSVC.cmake
r5781 r7818 57 57 SET(ZLIB_LIBRARY ${DEP_LIBRARY_DIR}/zdll.lib CACHE FILEPATH "") 58 58 59 # Visual Leak Detector60 SET(VLD_INCLUDE_DIR ${DEP_INCLUDE_DIR}/vld CACHE PATH "")61 SET(VLD_LIBRARY_DIR ${DEP_LIBRARY_DIR} CACHE PATH "")62 LINK_DIRECTORIES(${VLD_LIBRARY_DIR}) # Used for auto-linking63 MARK_AS_ADVANCED(VLD_INCLUDE_DIR VLD_LIBRARY_DIR)64 65 59 ENDIF(MSVC) -
code/trunk/cmake/tools/SourceFileUtilities.cmake
r7415 r7818 34 34 35 35 FUNCTION(PREPARE_SOURCE_FILES) 36 SET(_ fullpath_sources)36 SET(_source_files) 37 37 FOREACH(_file ${ARGN}) 38 IF(_file STREQUAL "COMPILATION_BEGIN") 39 SET(_compile TRUE) 40 # Next file is the name of the compilation 41 SET(_get_name TRUE) 42 ELSEIF(_get_name) 43 SET(_get_name FALSE) 44 SET(_compilation_name ${_file}) 45 ELSEIF(_file STREQUAL "COMPILATION_END") 46 IF(NOT _compilation_name) 47 MESSAGE(FATAL_ERROR "No name provided for source file compilation") 48 ENDIF() 49 IF(NOT DISABLE_COMPILATIONS) 50 SET(_compilation_file ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name}) 51 SET(_include_string) 52 FOREACH(_file2 ${_compilation}) 53 SET(_include_string "${_include_string}#include \"${_file2}\"\n") 54 ENDFOREACH(_file2) 55 IF(EXISTS ${_compilation_file}) 56 FILE(READ ${_compilation_file} _include_string_file) 57 ENDIF() 58 IF(NOT _include_string STREQUAL "${_include_string_file}") 59 FILE(WRITE ${_compilation_file} "${_include_string}") 60 ENDIF() 61 LIST(APPEND _fullpath_sources ${_compilation_file}) 62 # MSVC hack that excludes the compilations from the intellisense database 63 # (There is a bug with the "-" instead of "/". Only works for "Zm#" argument) 64 # 2nd Note: Exploiting this results in a strange separation of the compilation 65 # file, causing the compiler not to use multi processing --> slower compiling. 66 #IF(MSVC) 67 # SET_SOURCE_FILES_PROPERTIES(${_compilation_file} PROPERTIES COMPILE_FLAGS "-Zm1000") 68 #ENDIF() 69 ENDIF() 70 SET(_compilation_name) 71 SET(_compilation) 72 SET(_compile FALSE) 38 IF(_file MATCHES "^(COMPILATION_BEGIN|COMPILATION_END)$") 39 # Append keywords verbatim 40 LIST(APPEND _source_files ${_file}) 73 41 ELSE() 74 # Prefix the full path 75 GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION) 76 LIST(APPEND _fullpath_sources ${_filepath}) 77 IF(_compile AND NOT DISABLE_COMPILATIONS) 78 LIST(APPEND _compilation ${_filepath}) 79 LIST(APPEND _fullpath_sources "H") 80 ENDIF() 42 # Store file with path relative to the root source directory 43 FILE(RELATIVE_PATH _file_rel ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) 44 LIST(APPEND _source_files ./${_file_rel}) 81 45 ENDIF() 82 46 ENDFOREACH(_file) 83 SET(_ fullpath_sources ${_fullpath_sources} PARENT_SCOPE)47 SET(_source_files ${_source_files} PARENT_SCOPE) 84 48 ENDFUNCTION(PREPARE_SOURCE_FILES) 85 49 … … 89 53 PREPARE_SOURCE_FILES(${ARGN}) 90 54 # Write into the cache to avoid variable scoping in subdirs 91 SET(${_varname} ${${_varname}} ${_ fullpath_sources} CACHE INTERNAL "Do not edit")55 SET(${_varname} ${${_varname}} ${_source_files} CACHE INTERNAL "Do not edit") 92 56 ENDFUNCTION(ADD_SOURCE_FILES) 93 57 … … 97 61 PREPARE_SOURCE_FILES(${ARGN}) 98 62 # Write into the cache to avoid variable scoping in subdirs 99 SET(${_varname} ${_ fullpath_sources} CACHE INTERNAL "Do not edit")63 SET(${_varname} ${_source_files} CACHE INTERNAL "Do not edit") 100 64 ENDFUNCTION(SET_SOURCE_FILES) 101 65 … … 113 77 GET_SOURCE_FILE_PROPERTY(_full_filepath ${_file} LOCATION) 114 78 FILE(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_SOURCE_DIR} ${_full_filepath}) 115 IF(NOT _relative_path MATCHES "^\\.\\. ")79 IF(NOT _relative_path MATCHES "^\\.\\./") # Has "../" at the beginning 116 80 GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH) 117 81 STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}") -
code/trunk/cmake/tools/TargetUtilities.cmake
r7416 r7818 90 90 PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN}) 91 91 92 93 # Workaround: Source file properties get lost when leaving a subdirectory 94 # Therefore an "H" after a file means we have to set it as HEADER_FILE_ONLY 92 # Process source files with support for compilations 93 # Note: All file paths are relative to the root source directory, even the 94 # name of the compilation file. 95 SET(_${_target_name}_source_files) 96 SET(_get_compilation_file FALSE) 97 SET(_add_to_compilation FALSE) 95 98 FOREACH(_file ${_arg_SOURCE_FILES}) 96 IF(_file STREQUAL "H") 97 SET_SOURCE_FILES_PROPERTIES(${_last_file} PROPERTIES HEADER_FILE_ONLY TRUE) 99 IF(_file STREQUAL "COMPILATION_BEGIN") 100 # Next file is the name of the compilation 101 SET(_get_compilation_file TRUE) 102 ELSEIF(_file STREQUAL "COMPILATION_END") 103 IF(NOT _compilation_file) 104 MESSAGE(FATAL_ERROR "No name provided for source file compilation") 105 ENDIF() 106 IF(NOT _compilation_include_string) 107 MESSAGE(STATUS "Warning: Empty source file compilation!") 108 ENDIF() 109 IF(NOT DISABLE_COMPILATIONS) 110 IF(EXISTS ${_compilation_file}) 111 FILE(READ ${_compilation_file} _include_string_file) 112 ENDIF() 113 IF(NOT _compilation_include_string STREQUAL "${_include_string_file}") 114 FILE(WRITE ${_compilation_file} "${_compilation_include_string}") 115 ENDIF() 116 LIST(APPEND _${_target_name}_source_files ${_compilation_file}) 117 ENDIF() 118 SET(_add_to_compilation FALSE) 119 ELSEIF(_get_compilation_file) 120 SET(_compilation_file ${CMAKE_BINARY_DIR}/${_file}) 121 SET(_get_compilation_file FALSE) 122 SET(_add_to_compilation TRUE) 123 SET(_compilation_include_string) 98 124 ELSE() 99 SET(_last_file ${_file}) 125 # Default, add source file 126 127 # Prepare relative paths 128 IF(NOT _file MATCHES "^(.\\:|\\/)") 129 # Path can be relative to the current source directory if the file was 130 # not added with the source file macros. Otherwise there is a "./" at 131 # the beginning of each file and the filename is relative 132 # to the CMAKE_SOURCE_DIR 133 STRING(REGEX REPLACE "^\\.\\/(.+)$" "\\1" _temp ${_file}) 134 IF(NOT ${_temp} STREQUAL ${_file}) 135 SET(_file ${CMAKE_SOURCE_DIR}/${_temp}) 136 ELSE() 137 SET(_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) 138 ENDIF() 139 ENDIF() 140 100 141 LIST(APPEND _${_target_name}_source_files ${_file}) 142 143 # Handle compilations 144 IF(_add_to_compilation AND NOT DISABLE_COMPILATIONS) 145 IF(_file MATCHES "\\.(c|cc|cpp|cxx)$") 146 SET(_compilation_include_string "${_compilation_include_string}#include \"${_file}\"\n") 147 ENDIF() 148 # Don't compile these files, even if they are source files 149 SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE) 150 ENDIF() 101 151 ENDIF() 102 152 ENDFOREACH(_file) … … 172 222 # Don't compile header files 173 223 FOREACH(_file ${_${_target_name}_files}) 174 IF(NOT _file MATCHES "\\.(c|cc|cpp )")224 IF(NOT _file MATCHES "\\.(c|cc|cpp|cxx)$") 175 225 SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE) 176 226 ENDIF() … … 217 267 # Ensure that the main program depends on the module 218 268 SET(ORXONOX_MODULES ${ORXONOX_MODULES} ${_target_name} CACHE STRING "" FORCE) 269 ENDIF() 270 271 # Static library flags are not globally available 272 IF(ORXONOX_STATIC_LINKER_FLAGS) 273 SET_TARGET_PROPERTIES(${_target_name} PROPERTIES STATIC_LIBRARY_FLAGS ${ORXONOX_STATIC_LINKER_FLAGS}) 219 274 ENDIF() 220 275
Note: See TracChangeset
for help on using the changeset viewer.