Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 4, 2011, 2:47:44 AM (13 years ago)
Author:
rgrieder
Message:

Merged unity_build branch back to trunk.

Features:

  • Implemented fully automatic build units to speed up compilation if requested
  • Added DOUT macro for quick debug output
  • Activated text colouring in the POSIX IOConsole
  • DeclareToluaInterface is not necessary anymore

Improvements:

  • Output levels now change appropriately when switch back and forth from dev mode
  • Log level for the file output is now also correct during startup
  • Removed some header file dependencies in core and tools to speed up compilation

no more file for command line options

  • Improved util::tribool by adapting some concepts from boost::tribool

Regressions:

  • It is not possible anymore to specify command line arguments in an extra file because we've got config values for that purpose.
Location:
code/trunk
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/cmake/tools/GenerateToluaBindings.cmake

    r8363 r8729  
    4949  SET(_tolua_pkgfile "${CMAKE_CURRENT_BINARY_DIR}/tolua.pkg")
    5050  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")
    5252
    5353  SET(${_target_source_files}
    5454    ${${_target_source_files}}
    5555    ${_tolua_cxxfile}
    56     ${_tolua_hfile}
    5756    PARENT_SCOPE
    5857  )
    5958
    60   # Disable annoying GCC warnings
    6159  IF(CMAKE_COMPILER_IS_GNU)
     60    # Disable annoying GCC warnings
    6261    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)
    6368  ENDIF()
    6469
     
    7075  ENDFOREACH(_tolua_inputfile)
    7176
     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
    7282  ADD_CUSTOM_COMMAND(
    73     OUTPUT ${_tolua_cxxfile} ${_tolua_hfile}
     83    OUTPUT ${_tolua_cxxfile}
    7484    COMMAND toluaapp_orxonox -n ${_tolua_package}
    7585                             -w ${CMAKE_CURRENT_SOURCE_DIR}
    7686                             -o ${_tolua_cxxfile}
    77                              -H ${_tolua_hfile}
    7887                             -s ${TOLUA_PARSER_SOURCE}
     88                                ${_hook_script}
    7989                                ${_tolua_pkgfile}
    8090    DEPENDS           ${TOLUA_PARSER_DEPENDENCIES}
  • code/trunk/cmake/tools/SourceFileUtilities.cmake

    r7818 r8729  
    2525 #                             adds the current directory.
    2626 #                             Also compiles multiple source files into a single
    27  #                             one by including them
    28  #                             Use COMPILATION_[BEGIN|END] in
     27 #                             translation unit (faster)
     28 #                             Use [END_]BUILD_UNIT in
    2929 #                             [ADD|SET]_SOURCE_FILES and specify the name of
    30  #                             the new source file after COMPILATION_BEGIN
     30 #                             the new source file after BUILD_UNIT
    3131 #    GET_ALL_HEADER_FILES   - Finds all header files recursively.
    3232 #    GENERATE_SOURCE_GROUPS - Set Visual Studio source groups.
     
    3636  SET(_source_files)
    3737  FOREACH(_file ${ARGN})
    38     IF(_file MATCHES "^(COMPILATION_BEGIN|COMPILATION_END)$")
     38    IF(_file MATCHES "^(BUILD_UNIT|END_BUILD_UNIT)$")
    3939      # Append keywords verbatim
    4040      LIST(APPEND _source_files ${_file})
  • code/trunk/cmake/tools/TargetUtilities.cmake

    r8421 r8729  
    4040 #      NO_INSTALL:        Do not install the target at all
    4141 #      NO_VERSION:        Prevents adding any version to a target
     42 #      NO_BUILD_UNITS:    Disables automatic (full) build units
    4243 #
    4344 #    Lists:
     
    5455 #      PCH_EXCLUDE:       Source files to be excluded from PCH support
    5556 #      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)
    5660 #  Note:
    5761 #    This function also installs the target!
     
    6266 #
    6367
     68INCLUDE(BuildUnits)
    6469INCLUDE(CMakeDependentOption)
    6570INCLUDE(CapitaliseName)
     
    8792  SET(_switches   FIND_HEADER_FILES  EXCLUDE_FROM_ALL  ORXONOX_EXTERNAL
    8893                  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})
    9096  SET(_list_names LINK_LIBRARIES     VERSION           SOURCE_FILES
    9197                  DEFINE_SYMBOL      TOLUA_FILES       PCH_FILE
    9298                  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)
    94101
    95102  PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
    96103
    97   # Process source files with support for compilations
     104  # Process source files with support for build units
    98105  # 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.
    100107  SET(_${_target_name}_source_files)
    101   SET(_get_compilation_file FALSE)
    102   SET(_add_to_compilation FALSE)
     108  SET(_get_build_unit_file FALSE)
     109  SET(_add_to_build_unit FALSE)
    103110  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")
    129142    ELSE()
    130143      # Default, add source file
     
    146159      LIST(APPEND _${_target_name}_source_files ${_file})
    147160
    148       # Handle compilations
    149       IF(_add_to_compilation AND NOT DISABLE_COMPILATIONS)
     161      # Handle build units
     162      IF(_add_to_build_unit AND ENABLE_BUILD_UNITS)
    150163        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}")
    152166        ENDIF()
    153167        # Don't compile these files, even if they are source files
     
    183197  ENDIF()
    184198
     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
    185213  # First part (pre target) of precompiled header files
    186214  IF(PCH_COMPILER_SUPPORT AND _arg_PCH_FILE)
     
    196224    MARK_AS_ADVANCED(PCH_ENABLE_${_target_name_upper})
    197225
    198     IF(PCH_ENABLE_${_target_name_upper})
     226    IF(PCH_ENABLE_${_target_name_upper} AND NOT PCH_DISABLE_${_target_name})
    199227      PRECOMPILED_HEADER_FILES_PRE_TARGET(${_target_name} ${_arg_PCH_FILE} _${_target_name}_files EXCLUDE ${_arg_PCH_EXCLUDE})
    200228    ENDIF()
     
    344372
    345373  # 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})
    347375    PRECOMPILED_HEADER_FILES_POST_TARGET(${_target_name} ${_arg_PCH_FILE})
    348376  ENDIF()
Note: See TracChangeset for help on using the changeset viewer.