Changeset 5929 for code/trunk/cmake
- Timestamp:
- Oct 12, 2009, 8:20:07 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core5 (added) merged: 5768-5769,5772,5775-5780,5783-5785,5791-5792,5795-5807,5809-5814,5816-5832,5836-5839,5842-5853,5855-5899,5904-5922,5924-5928
- Property svn:mergeinfo changed
-
code/trunk/cmake/CompilerConfigMSVC.cmake
r5695 r5929 70 70 71 71 # Overwrite CMake default flags here. 72 SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG - Gm-RTC1" Debug CACHE)73 SET_COMPILER_FLAGS("-MD -O2 -DNDEBUG -MP2" Release CACHE)74 SET_COMPILER_FLAGS("-MD -O2 -Zi -DNDEBUG -MP2" RelWithDebInfo CACHE)75 SET_COMPILER_FLAGS("-MD -O1 -DNDEBUG -MP2" MinSizeRel CACHE)72 SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG -MP2 -RTC1" Debug CACHE) 73 SET_COMPILER_FLAGS("-MD -O2 -DNDEBUG -MP2" Release CACHE) 74 SET_COMPILER_FLAGS("-MD -O2 -Zi -DNDEBUG -MP2" RelWithDebInfo CACHE) 75 SET_COMPILER_FLAGS("-MD -O1 -DNDEBUG -MP2" MinSizeRel CACHE) 76 76 77 77 # Use Link time code generation for Release config if ORXONOX_RELEASE is defined -
code/trunk/cmake/ParseMacroArguments.cmake
r5695 r5929 39 39 # Using LIST(FIND ...) speeds up the process 40 40 SET(_keywords ${_switches} ${_list_names}) 41 42 # Reset all arguments 43 FOREACH(_arg ${_switches} ${_list_names}) 44 SET(_arg_${_arg}) 45 ENDFOREACH(_arg) 41 46 42 47 # Parse all the arguments and set the corresponding variable -
code/trunk/cmake/PrecompiledHeaderFiles.cmake
r3251 r5929 110 110 GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags) 111 111 # Make sure we recompile the pch file even if only the flags change 112 IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" )112 IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" OR NOT EXISTS "${_pch_dep_helper_file}") 113 113 SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "") 114 114 FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */") -
code/trunk/cmake/SourceFileUtilities.cmake
r2710 r5929 24 24 # [ADD/SET]_SOURCE_FILES - Writes source files to the cache by force and 25 25 # adds the current directory. 26 # GET_ALL_HEADER_FILES - Finds all header files recursively. 26 # Also compiles multiple source files into a single 27 # one by including them 28 # Use COMPILATION_[BEGIN|END] in 29 # [ADD|SET]_SOURCE_FILES and specify the name of 30 # the new source file after COMPILATION_BEGIN 31 # GET_ALL_HEADER_FILES - Finds all header files recursively. 27 32 # GENERATE_SOURCE_GROUPS - Set Visual Studio source groups. 28 33 # 29 34 35 FUNCTION(PREPARE_SOURCE_FILES) 36 SET(_fullpath_sources) 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(_include_string) 51 FOREACH(_file2 ${_compilation}) 52 SET(_include_string "${_include_string}#include \"${_file2}\"\n") 53 ENDFOREACH(_file2) 54 IF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name}) 55 FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name} _include_string_file) 56 ENDIF() 57 IF(NOT _include_string STREQUAL "${_include_string_file}") 58 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name} "${_include_string}") 59 ENDIF() 60 LIST(APPEND _fullpath_sources ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name}) 61 ENDIF() 62 SET(_compilation_name) 63 SET(_compilation) 64 SET(_compile FALSE) 65 ELSE() 66 # Prefix the full path 67 GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION) 68 LIST(APPEND _fullpath_sources ${_filepath}) 69 IF(_compile AND NOT DISABLE_COMPILATIONS) 70 LIST(APPEND _compilation ${_filepath}) 71 LIST(APPEND _fullpath_sources "H") 72 ENDIF() 73 ENDIF() 74 ENDFOREACH(_file) 75 SET(_fullpath_sources ${_fullpath_sources} PARENT_SCOPE) 76 ENDFUNCTION(PREPARE_SOURCE_FILES) 77 78 30 79 # Adds source files with the full path to a list 31 80 FUNCTION(ADD_SOURCE_FILES _varname) 32 # Prefix the full path 33 SET(_fullpath_sources) 34 FOREACH(_file ${ARGN}) 35 GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION) 36 LIST(APPEND _fullpath_sources ${_filepath}) 37 ENDFOREACH(_file) 81 PREPARE_SOURCE_FILES(${ARGN}) 38 82 # Write into the cache to avoid variable scoping in subdirs 39 83 SET(${_varname} ${${_varname}} ${_fullpath_sources} CACHE INTERNAL "Do not edit") … … 43 87 # Sets source files with the full path 44 88 FUNCTION(SET_SOURCE_FILES _varname) 45 # Prefix the full path 46 SET(_fullpath_sources) 47 FOREACH(_file ${ARGN}) 48 GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION) 49 LIST(APPEND _fullpath_sources ${_filepath}) 50 ENDFOREACH(_file) 89 PREPARE_SOURCE_FILES(${ARGN}) 51 90 # Write into the cache to avoid variable scoping in subdirs 52 91 SET(${_varname} ${_fullpath_sources} CACHE INTERNAL "Do not edit") … … 66 105 GET_SOURCE_FILE_PROPERTY(_full_filepath ${_file} LOCATION) 67 106 FILE(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_SOURCE_DIR} ${_full_filepath}) 68 GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH) 69 STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}") 70 SOURCE_GROUP("Source\\${_group_path}" FILES ${_file}) 107 IF(NOT _relative_path MATCHES "^\\.\\.") 108 GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH) 109 STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}") 110 SOURCE_GROUP("Source\\${_group_path}" FILES ${_file}) 111 ELSE() 112 # Has to be a compilation 113 SOURCE_GROUP("Compilations" FILES ${_file}) 114 ENDIF() 71 115 ENDFOREACH(_file) 72 116 -
code/trunk/cmake/TargetUtilities.cmake
r5901 r5929 67 67 ENDIF() 68 68 69 FUNCTION(ORXONOX_ADD_LIBRARY _target_name)69 MACRO(ORXONOX_ADD_LIBRARY _target_name) 70 70 TU_ADD_TARGET(${_target_name} LIBRARY "STATIC;SHARED" ${ARGN}) 71 END FUNCTION(ORXONOX_ADD_LIBRARY)72 73 FUNCTION(ORXONOX_ADD_EXECUTABLE _target_name)71 ENDMACRO(ORXONOX_ADD_LIBRARY) 72 73 MACRO(ORXONOX_ADD_EXECUTABLE _target_name) 74 74 TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN}) 75 END FUNCTION(ORXONOX_ADD_EXECUTABLE)76 77 78 FUNCTION(TU_ADD_TARGET _target_name _target_type _additional_switches)75 ENDMACRO(ORXONOX_ADD_EXECUTABLE) 76 77 78 MACRO(TU_ADD_TARGET _target_name _target_type _additional_switches) 79 79 CAPITALISE_NAME(${_target_name} _target_name_capitalised) 80 80 … … 88 88 89 89 90 # GET_HEADER_FILES 90 # Workaround: Source file properties get lost when leaving a subdirectory 91 # Therefore an "H" after a file means we have to set it as HEADER_FILE_ONLY 92 FOREACH(_file ${_arg_SOURCE_FILES}) 93 IF(_file STREQUAL "H") 94 SET_SOURCE_FILES_PROPERTIES(${_last_file} PROPERTIES HEADER_FILE_ONLY TRUE) 95 ELSE() 96 SET(_last_file ${_file}) 97 LIST(APPEND _${_target_name}_source_files ${_file}) 98 ENDIF() 99 ENDFOREACH(_file) 100 101 # Assemble all header files of the library 91 102 IF(_arg_FIND_HEADER_FILES) 92 GET_ALL_HEADER_FILES(_${ target_name}_header_files)103 GET_ALL_HEADER_FILES(_${_target_name}_header_files) 93 104 ENDIF() 94 105 95 106 # Remove potential duplicates 96 SET(_${_target_name}_files ${_${ target_name}_header_files} ${_arg_SOURCE_FILES})107 SET(_${_target_name}_files ${_${_target_name}_header_files} ${_${_target_name}_source_files}) 97 108 LIST(REMOVE_DUPLICATES _${_target_name}_files) 98 109 … … 141 152 ENDIF() 142 153 154 # No warnings needed from third party libraries 155 IF(_arg_ORXONOX_EXTERNAL) 156 REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC) 157 ADD_COMPILER_FLAGS("-w") 158 ENDIF() 159 143 160 # Set default linking if required 144 161 IF(NOT _arg_SHARED AND NOT _arg_STATIC) … … 171 188 ADD_EXECUTABLE(${_target_name} ${_arg_WIN32} ${_arg_EXCLUDE_FROM_ALL} 172 189 ${_${_target_name}_files}) 190 ENDIF() 191 192 # Change library prefix to "lib" 193 IF(MSVC AND ${_target_type} STREQUAL "LIBRARY") 194 SET_TARGET_PROPERTIES(${_target_name} PROPERTIES 195 PREFIX "lib" 196 ) 173 197 ENDIF() 174 198 … … 223 247 ENDIF() 224 248 225 END FUNCTION(TU_ADD_TARGET)249 ENDMACRO(TU_ADD_TARGET) 226 250 227 251
Note: See TracChangeset
for help on using the changeset viewer.