Changeset 8558 for code/branches/unity_build/cmake/tools
- Timestamp:
- May 24, 2011, 4:15:19 AM (13 years ago)
- Location:
- code/branches/unity_build/cmake/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/unity_build/cmake/tools/SourceFileUtilities.cmake
r7818 r8558 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/branches/unity_build/cmake/tools/TargetUtilities.cmake
r8421 r8558 95 95 PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN}) 96 96 97 # Process source files with support for compilations97 # Process source files with support for build units 98 98 # Note: All file paths are relative to the root source directory, even the 99 # name of the compilation file.99 # name of the build unit. 100 100 SET(_${_target_name}_source_files) 101 SET(_get_ compilation_file FALSE)102 SET(_add_to_ compilationFALSE)101 SET(_get_build_unit_file FALSE) 102 SET(_add_to_build_unit FALSE) 103 103 FOREACH(_file ${_arg_SOURCE_FILES}) 104 IF(_file STREQUAL " COMPILATION_BEGIN")105 # Next file is the name of the compilation106 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_ compilationFALSE)124 ELSEIF(_get_ compilation_file)125 SET(_ compilation_file ${CMAKE_BINARY_DIR}/${_file})126 SET(_get_ compilation_file FALSE)127 SET(_add_to_ compilationTRUE)128 SET(_ compilation_include_string)104 IF(_file STREQUAL "BUILD_UNIT") 105 # Next file is the name of the build unit 106 SET(_get_build_unit_file TRUE) 107 ELSEIF(_file STREQUAL "END_BUILD_UNIT") 108 IF(NOT _build_unit_file) 109 MESSAGE(FATAL_ERROR "No name provided for build unit") 110 ENDIF() 111 IF(NOT DISABLE_BUILD_UNITS) 112 IF(NOT _build_unit_include_string) 113 MESSAGE(STATUS "Warning: Empty build unit!") 114 ENDIF() 115 IF(EXISTS ${_build_unit_file}) 116 FILE(READ ${_build_unit_file} _include_string_file) 117 ENDIF() 118 IF(NOT _build_unit_include_string STREQUAL "${_include_string_file}") 119 FILE(WRITE ${_build_unit_file} "${_build_unit_include_string}") 120 ENDIF() 121 LIST(APPEND _${_target_name}_source_files ${_build_unit_file}) 122 ENDIF() 123 SET(_add_to_build_unit FALSE) 124 ELSEIF(_get_build_unit_file) 125 SET(_build_unit_file ${CMAKE_BINARY_DIR}/${_file}) 126 SET(_get_build_unit_file FALSE) 127 SET(_add_to_build_unit TRUE) 128 SET(_build_unit_include_string) 129 129 ELSE() 130 130 # Default, add source file … … 146 146 LIST(APPEND _${_target_name}_source_files ${_file}) 147 147 148 # Handle compilations149 IF(_add_to_ compilation AND NOT DISABLE_COMPILATIONS)148 # Handle build units 149 IF(_add_to_build_unit AND NOT DISABLE_BUILD_UNITS) 150 150 IF(_file MATCHES "\\.(c|cc|cpp|cxx)$") 151 SET(_ compilation_include_string "${_compilation_include_string}#include \"${_file}\"\n")151 SET(_build_unit_include_string "${_build_unit_include_string}#include \"${_file}\"\n") 152 152 ENDIF() 153 153 # Don't compile these files, even if they are source files
Note: See TracChangeset
for help on using the changeset viewer.