Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 24, 2009, 1:57:27 PM (15 years ago)
Author:
rgrieder
Message:

Merged revision 5610 to resource3:
Improved CMake performance for runs after the first one.
There are some optimisations in the macro argument parser and I manually added the header files for util and network (since they don't change too much and it still compiles with a missing header files).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource3/cmake/ParseMacroArguments.cmake

    r3196 r5676  
    3636
    3737MACRO(PARSE_MACRO_ARGUMENTS _switches _list_names)
     38
     39  # Using LIST(FIND ...) speeds up the process
     40  SET(_keywords ${_switches} ${_list_names})
     41
    3842  # Parse all the arguments and set the corresponding variable
    3943  # If the option is just a switch, set the variable to its name for later use
    4044  FOREACH(_arg ${ARGN})
    41     SET(_arg_found FALSE)
    4245
    43     # Switches
    44     FOREACH(_switch ${_switches})
    45       IF(${_switch} STREQUAL ${_arg})
    46         SET(_arg_${_switch} ${_switch})
    47         SET(_arg_found TRUE)
    48         # Avoid interpreting arguments after this one as options args for the previous one
    49         SET(_storage_var)
    50         BREAK()
    51       ENDIF()
    52     ENDFOREACH(_switch)
     46    # Is the argument a keyword?
     47    LIST(FIND _keywords ${_arg} _keyword_index)
     48    IF(NOT _keyword_index EQUAL -1)
    5349
    54     # Input options
    55     IF(NOT _arg_found)
    56       FOREACH(_list_name ${_list_names})
    57         IF(${_list_name} STREQUAL ${_arg})
    58           SET(_storage_var _arg_${_list_name})
    59           SET(_arg_found TRUE)
     50      # Another optimisation
     51      SET(_arg_found FALSE)
     52      # Switches
     53      FOREACH(_switch ${_switches})
     54        IF(${_switch} STREQUAL ${_arg})
     55          SET(_arg_${_switch} ${_switch})
     56          SET(_arg_found TRUE)
     57          # Avoid interpreting arguments after this one as options args for the previous one
     58          SET(_storage_var)
    6059          BREAK()
    6160        ENDIF()
    62       ENDFOREACH(_list_name)
    63     ENDIF(NOT _arg_found)
     61      ENDFOREACH(_switch)
    6462
    65     # Arguments of an input option (like source files for SOURCE_FILES)
    66     IF(NOT _arg_found)
     63      # Input options
     64      IF(NOT _arg_found)
     65        FOREACH(_list_name ${_list_names})
     66          IF(${_list_name} STREQUAL ${_arg})
     67            SET(_storage_var _arg_${_list_name})
     68            BREAK()
     69          ENDIF()
     70        ENDFOREACH(_list_name)
     71      ENDIF(NOT _arg_found)
     72
     73    ELSE()
     74
     75      # Arguments of an input option (like source files for SOURCE_FILES)
    6776      IF(_storage_var)
    6877        # Store in variable define above in the foreach loop
     
    7180        MESSAGE(FATAL_ERROR "ORXONOX_ADD_${_target_type} was given a non compliant argument: ${_arg}")
    7281      ENDIF(_storage_var)
    73     ENDIF(NOT _arg_found)
     82
     83    ENDIF()
    7484
    7585  ENDFOREACH(_arg)
Note: See TracChangeset for help on using the changeset viewer.