Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 12, 2010, 12:47:30 AM (14 years ago)
Author:
rgrieder
Message:

Basic stuff up and running for the Qt sandbox.
No GUI support yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox_qt/cmake/tools/TargetUtilities.cmake

    r7416 r7421  
    3434 #      NO_DLL_INTERFACE:  Link statically with MSVC
    3535 #      NO_SOURCE_GROUPS:  Don't create msvc source groups
    36  #      MODULE:            For dynamic module libraries (libraries only)
    3736 #      WIN32:             Inherited from ADD_EXECUTABLE (executables only)
    3837 #      PCH_NO_DEFAULT:    Do not make precompiled header files default if
     
    4645 #      SOURCE_FILES:      Source files for the target
    4746 #      DEFINE_SYMBOL:     Sets the DEFINE_SYMBOL target property
    48  #      TOLUA_FILES:       Files with tolua interface
    4947 #      PCH_FILE:          Precompiled header file
    5048 #      PCH_EXCLUDE:       Source files to be excluded from PCH support
    5149 #      OUTPUT_NAME:       If you want a different name than the target name
     50 #      QT_MOC_FILES:      List of files to be processed by Qt MOC
     51 #      QT_UIC_FILES:      List of files to be processed by Qt UIC
    5252 #  Note:
    5353 #    This function also installs the target!
     
    6060INCLUDE(CMakeDependentOption)
    6161INCLUDE(CapitaliseName)
    62 INCLUDE(GenerateToluaBindings)
    6362INCLUDE(ParseMacroArguments)
    6463INCLUDE(SourceFileUtilities)
     
    6867
    6968MACRO(ORXONOX_ADD_LIBRARY _target_name)
    70   TU_ADD_TARGET(${_target_name} LIBRARY "MODULE" ${ARGN})
     69  TU_ADD_TARGET(${_target_name} LIBRARY "" ${ARGN})
    7170ENDMACRO(ORXONOX_ADD_LIBRARY)
    7271
     
    8584                  NO_INSTALL         NO_VERSION        ${_additional_switches})
    8685  SET(_list_names LINK_LIBRARIES     VERSION           SOURCE_FILES
    87                   DEFINE_SYMBOL      TOLUA_FILES       PCH_FILE
    88                   PCH_EXCLUDE        OUTPUT_NAME)
     86                  DEFINE_SYMBOL      PCH_FILE          PCH_EXCLUDE
     87                  OUTPUT_NAME        QT_MOC_FILES      QT_UIC_FILES)
    8988
    9089  PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
     
    107106  ENDIF()
    108107
    109   # Combine source and header files
     108  # Combine source, header and QT designer files
    110109  SET(_${_target_name}_files
    111110    ${_${_target_name}_header_files}
    112111    ${_${_target_name}_source_files}
     112    ${_arg_QT_UIC_FILES}
    113113  )
    114114  # Remove potential duplicates
    115115  LIST(REMOVE_DUPLICATES _${_target_name}_files)
    116116
    117   # TOLUA_FILES
    118   IF(_arg_TOLUA_FILES)
    119     GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files
    120                             INPUTFILES ${_arg_TOLUA_FILES})
     117  # QT MOC and UIC preprocessing
     118  IF(_arg_QT_MOC_FILES)
     119      QT4_WRAP_CPP(_${_target_name}_files ${_arg_QT_MOC_FILES})
     120  ENDIF()
     121  IF(_arg_QT_UIC_FILES)
     122      QT4_WRAP_UI(_${_target_name}_files ${_arg_QT_UIC_FILES})
    121123  ENDIF()
    122124
     
    208210  ENDIF()
    209211
    210   # Configure modules
    211   IF (_arg_MODULE)
    212     SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
    213       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows
    214       LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
    215     )
    216     ADD_MODULE(${_target_name})
    217     # Ensure that the main program depends on the module
    218     SET(ORXONOX_MODULES ${ORXONOX_MODULES} ${_target_name} CACHE STRING "" FORCE)
    219   ENDIF()
    220 
    221212  # LINK_LIBRARIES
    222213  IF(_arg_LINK_LIBRARIES)
     
    251242  # Install all targets except for static ones (executables also have SHARED in _link_mode)
    252243  IF(${_link_mode} STREQUAL "SHARED" AND NOT _arg_NO_INSTALL)
    253     IF(_arg_MODULE)
    254       INSTALL(TARGETS ${_target_name}
    255         RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY}
    256         LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY}
    257       )
    258     ELSE()
    259       INSTALL(TARGETS ${_target_name}
    260         RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
    261         LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY}
    262       )
    263     ENDIF()
     244    INSTALL(TARGETS ${_target_name}
     245      RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
     246      LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY}
     247    )
    264248  ENDIF()
    265249
    266250ENDMACRO(TU_ADD_TARGET)
    267 
    268 
    269 # Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
    270 # This helps finding dynamically loadable modules at runtime
    271 
    272 FUNCTION(ADD_MODULE _target)
    273   # We use the properties to get the name because the librarys name may differ from
    274   # the target name (for example orxonox <-> liborxonox)
    275 
    276   GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)
    277   GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)
    278 
    279   IF(CMAKE_CONFIGURATION_TYPES)
    280     FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
    281       SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
    282 
    283       FILE(WRITE ${_module_filename})
    284 
    285       INSTALL(
    286         FILES ${_module_filename}
    287         DESTINATION ${MODULE_INSTALL_DIRECTORY}
    288         CONFIGURATIONS ${_config}
    289       )
    290     ENDFOREACH()
    291   ELSE()
    292     SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
    293 
    294     FILE(WRITE ${_module_filename})
    295 
    296     INSTALL(
    297       FILES ${_module_filename}
    298       DESTINATION ${MODULE_INSTALL_DIRECTORY}
    299     )
    300   ENDIF()
    301 ENDFUNCTION(ADD_MODULE)
Note: See TracChangeset for help on using the changeset viewer.