Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8622


Ignore:
Timestamp:
May 27, 2011, 5:38:43 AM (13 years ago)
Author:
rgrieder
Message:

Added implementation of full build units.
Please refer to r8569 or OrxonoxConfig.cmake for an explanation of the new option.

Location:
code/branches/unity_build
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/unity_build/cmake/tools/TargetUtilities.cmake

    r8569 r8622  
    6262 #
    6363
     64INCLUDE(BuildUnits)
    6465INCLUDE(CMakeDependentOption)
    6566INCLUDE(CapitaliseName)
     
    120121        ENDIF()
    121122        LIST(APPEND _${_target_name}_source_files ${_build_unit_file})
     123        LIST(APPEND _${_target_name}_build_units ${_build_unit_file})
     124        # Store the number of files included. May be used for full build units.
     125        SET_SOURCE_FILES_PROPERTIES(${_build_unit_file}
     126          PROPERTIES BUILD_UNIT_SIZE "${_build_unit_count}")
    122127      ENDIF()
    123128      SET(_add_to_build_unit FALSE)
    124129    ELSEIF(_get_build_unit_file)
     130      # Note: ${_file} is relative to the binary directory
    125131      SET(_build_unit_file ${CMAKE_BINARY_DIR}/${_file})
    126132      SET(_get_build_unit_file FALSE)
    127133      SET(_add_to_build_unit TRUE)
    128134      SET(_build_unit_include_string)
     135      SET(_build_unit_count "0")
    129136    ELSE()
    130137      # Default, add source file
     
    150157        IF(_file MATCHES "\\.(c|cc|cpp|cxx)$")
    151158          SET(_build_unit_include_string "${_build_unit_include_string}#include \"${_file}\"\n")
     159          MATH(EXPR _build_unit_count "1 + ${_build_unit_count}")
    152160        ENDIF()
    153161        # Don't compile these files, even if they are source files
     
    169177  # Remove potential duplicates
    170178  LIST(REMOVE_DUPLICATES _${_target_name}_files)
     179
     180  # Full build units
     181  IF(NOT _arg_ORXONOX_EXTERNAL AND ENABLE_BUILD_UNITS MATCHES "full")
     182    GENERATE_BUILD_UNITS(${_target_name} _${_target_name}_files)
     183  ENDIF()
    171184
    172185  # TOLUA_FILES
  • code/branches/unity_build/src/OrxonoxConfig.cmake

    r8569 r8622  
    4444SET(ENABLE_BUILD_UNITS "partial" CACHE STRING "Enables building multiple source files as one.")
    4545IF(ENABLE_BUILD_UNITS)
     46  IF(NOT "${ENABLE_BUILD_UNITS}" STREQUAL "partial")
     47    STRING(REGEX REPLACE "^full([1-9][0-9]?)$" "\\1" _nr_of_units "${ENABLE_BUILD_UNITS}")
     48    IF("${_nr_of_units}" STREQUAL "${ENABLE_BUILD_UNITS}") # Regex match failed
     49      MESSAGE(FATAL_ERROR "Unrecognised option for ENABLE_BUILD_UNITS: ${ENABLE_BUILD_UNITS}")
     50    ELSE()
     51      SET(NR_OF_BUILD_UNITS ${_nr_of_units})
     52    ENDIF()
     53  ENDIF()
    4654  INCLUDE(BuildUnitsConfig.cmake)
    4755ENDIF()
Note: See TracChangeset for help on using the changeset viewer.