Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7582 for code


Ignore:
Timestamp:
Oct 25, 2010, 11:05:34 PM (14 years ago)
Author:
rgrieder
Message:

Added CMake code for OS X package configuration.
Not guaranteed to work… Mainly because it requires several adjustments of the paths.

Location:
code/branches/ois_update/cmake
Files:
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/branches/ois_update/cmake/LibraryConfig.cmake

    r7521 r7582  
    4040# On Windows using a package causes way less problems
    4141SET(_option_msg "Set this to true to use precompiled dependecy archives")
    42 IF(WIN32)
     42IF(WIN32 OR APPLE)
    4343  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" ON)
    44 ELSE(WIN32)
     44ELSE()
    4545  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
    46 ENDIF(WIN32)
     46ENDIF()
    4747
    4848# Scripts for specific library and CMake config
    4949INCLUDE(LibraryConfigTardis)
    50 INCLUDE(LibraryConfigApple)
    5150
    5251IF(DEPENDENCY_PACKAGE_ENABLE)
     
    7372                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
    7473  ELSE()
    75     INCLUDE(PackageConfigMinGW)
    76     INCLUDE(PackageConfigMSVC)
    77     INCLUDE(PackageConfig) # For both msvc and mingw
     74    IF(WIN32)
     75      INCLUDE(PackageConfigMinGW)
     76      INCLUDE(PackageConfigMSVC)
     77      INCLUDE(PackageConfig) # For both msvc and mingw
     78    ELSEIF(APPLE)
     79      INCLUDE(PackageConfigOSX)
     80    ENDIF(WIN32)
    7881  ENDIF()
    7982ENDIF(DEPENDENCY_PACKAGE_ENABLE)
  • code/branches/ois_update/cmake/PackageConfig.cmake

    r7459 r7582  
    2525 #
    2626
    27 # Check package version info
    28 # MAJOR: Breaking change
    29 # MINOR: No breaking changes by the dependency package
    30 #        For example any code running on 3.0 should still run on 3.1
    31 #        But you can specify that the code only runs on 3.1 and higher
    32 #        or 4.0 and higher (so both 3.1 and 4.0 will work).
    33 SET(ALLOWED_MINIMUM_VERSIONS 3.1 4.0 5.0)
     27INCLUDE(CheckPackageVersion)
    3428
    35 IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
    36   SET(DEPENDENCY_VERSION 1.0)
    37 ELSE()
    38   # Get version from file
    39   FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content)
    40   SET(_match)
    41   STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content})
    42   IF(_match)
    43     SET(DEPENDENCY_VERSION ${_match})
    44   ELSE()
    45     MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.")
    46   ENDIF()
    47 ENDIF()
    48 
    49 INCLUDE(CompareVersionStrings)
    50 SET(_version_match FALSE)
    51 FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS})
    52   # Get major version
    53   STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
    54   COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
    55   IF(_result EQUAL 0)
    56     COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
    57     IF(NOT _result LESS 0)
    58       SET(_version_match TRUE)
    59     ENDIF()
    60   ENDIF()
    61 ENDFOREACH(_version)
    62 IF(NOT _version_match)
    63   MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
    64           "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n"
    65           "You can get a new version from www.orxonox.net")
    66 ENDIF()
     29CHECK_PACKAGE_VERSION(3.1 4.0 5.0)
    6730
    6831IF(NOT _INTERNAL_PACKAGE_MESSAGE)
  • code/branches/ois_update/cmake/PackageConfigOSX.cmake

    r7581 r7582  
    2121 #    Reto Grieder
    2222 #  Description:
    23  #    General package configuration. Merely sets the include paths.
    24  #    Library files are treated separately.
     23 #    OS X package configuration
    2524 #
    2625
    27 # Check package version info
    28 # MAJOR: Breaking change
    29 # MINOR: No breaking changes by the dependency package
    30 #        For example any code running on 3.0 should still run on 3.1
    31 #        But you can specify that the code only runs on 3.1 and higher
    32 #        or 4.0 and higher (so both 3.1 and 4.0 will work).
    33 SET(ALLOWED_MINIMUM_VERSIONS 3.1 4.0 5.0)
     26INCLUDE(CheckPackageVersion)
    3427
    35 IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
    36   SET(DEPENDENCY_VERSION 1.0)
    37 ELSE()
    38   # Get version from file
    39   FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content)
    40   SET(_match)
    41   STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content})
    42   IF(_match)
    43     SET(DEPENDENCY_VERSION ${_match})
    44   ELSE()
    45     MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.")
    46   ENDIF()
    47 ENDIF()
    48 
    49 INCLUDE(CompareVersionStrings)
    50 SET(_version_match FALSE)
    51 FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS})
    52   # Get major version
    53   STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
    54   COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
    55   IF(_result EQUAL 0)
    56     COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
    57     IF(NOT _result LESS 0)
    58       SET(_version_match TRUE)
    59     ENDIF()
    60   ENDIF()
    61 ENDFOREACH(_version)
    62 IF(NOT _version_match)
    63   MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
    64           "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n"
    65           "You can get a new version from www.orxonox.net")
    66 ENDIF()
     28CHECK_PACKAGE_VERSION(1.0)
    6729
    6830IF(NOT _INTERNAL_PACKAGE_MESSAGE)
     
    7133ENDIF()
    7234
    73 # Ogre versions >= 1.7 require the POCO library on Windows with MSVC for threading
    74 COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} 5 _result TRUE)
    75 IF(NOT _result EQUAL -1 AND NOT MINGW)
    76     SET(POCO_REQUIRED TRUE)
    77 ENDIF()
     35SET(DEP_INCLUDE_DIR ${DEPENDENCY_PACKAGE_DIR}/include)
     36SET(DEP_LIBRARY_DIR ${DEPENDENCY_PACKAGE_DIR}/lib)
     37SET(DEP_BINARY_DIR  ${DEPENDENCY_PACKAGE_DIR}/bin)
     38
     39# Sets the library path for the FIND_LIBRARY
     40SET(CMAKE_LIBRARY_PATH ${DEP_LIBRARY_DIR})
     41
     42# Certain find scripts don't behave as ecpected so we have
     43# to specify the libraries ourselves.
     44SET(TCL_LIBRARY  ${DEP_BINARY_DIR}/tcl85.dll CACHE FILEPATH "")
     45SET(ZLIB_LIBRARY ${DEP_BINARY_DIR}/zlib1.dll CACHE FILEPATH "")
    7846
    7947# Include paths and other special treatments
     
    9765
    9866# Tcl script library
    99 INSTALL(
    100   DIRECTORY ${DEP_LIBRARY_DIR}/tcl/
    101   DESTINATION lib/tcl
    102 )
     67# TODO: How does this work on OS X?
     68#INSTALL(
     69#  DIRECTORY ${DEP_LIBRARY_DIR}/tcl/
     70#  DESTINATION lib/tcl
     71#)
    10372
    104 # On Windows, DLLs have to be in the executable folder, install them
    105 IF(WIN32 AND DEP_BINARY_DIR)
     73# TODO: Install on OSX
     74IF(FALSE)
    10675  ## DEBUG
    10776  # When installing a debug version, we really can't know which libraries
  • code/branches/ois_update/cmake/tools/CheckPackageVersion.cmake

    r7581 r7582  
    2121 #    Reto Grieder
    2222 #  Description:
    23  #    General package configuration. Merely sets the include paths.
    24  #    Library files are treated separately.
    25  #
     23 #    Check package version info
     24 #    MAJOR: Breaking change
     25 #    MINOR: No breaking changes by the dependency package
     26 #           For example any code running on 3.0 should still run on 3.1
     27 #           But you can specify that the code only runs on 3.1 and higher
     28 #           or 4.0 and higher (so both 3.1 and 4.0 will work).
    2629
    27 # Check package version info
    28 # MAJOR: Breaking change
    29 # MINOR: No breaking changes by the dependency package
    30 #        For example any code running on 3.0 should still run on 3.1
    31 #        But you can specify that the code only runs on 3.1 and higher
    32 #        or 4.0 and higher (so both 3.1 and 4.0 will work).
    33 SET(ALLOWED_MINIMUM_VERSIONS 3.1 4.0 5.0)
     30MACRO(CHECK_PACKAGE_VERSION)
     31  SET(_allowed_minimum_versions ${ARGN})
    3432
    35 IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
    36   SET(DEPENDENCY_VERSION 1.0)
    37 ELSE()
    38   # Get version from file
    39   FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content)
    40   SET(_match)
    41   STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content})
    42   IF(_match)
    43     SET(DEPENDENCY_VERSION ${_match})
     33  IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
     34    SET(DEPENDENCY_VERSION 1.0)
    4435  ELSE()
    45     MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.")
    46   ENDIF()
    47 ENDIF()
    48 
    49 INCLUDE(CompareVersionStrings)
    50 SET(_version_match FALSE)
    51 FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS})
    52   # Get major version
    53   STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
    54   COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
    55   IF(_result EQUAL 0)
    56     COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
    57     IF(NOT _result LESS 0)
    58       SET(_version_match TRUE)
     36    # Get version from file
     37    FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content)
     38    SET(_match)
     39    STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content})
     40    IF(_match)
     41      SET(DEPENDENCY_VERSION ${_match})
     42    ELSE()
     43      MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.")
    5944    ENDIF()
    6045  ENDIF()
    61 ENDFOREACH(_version)
    62 IF(NOT _version_match)
    63   MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
    64           "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n"
    65           "You can get a new version from www.orxonox.net")
    66 ENDIF()
    67 
    68 IF(NOT _INTERNAL_PACKAGE_MESSAGE)
    69   MESSAGE(STATUS "Using library package for the dependencies.")
    70   SET(_INTERNAL_PACKAGE_MESSAGE 1 CACHE INTERNAL "Do not edit!" FORCE)
    71 ENDIF()
    72 
    73 # Ogre versions >= 1.7 require the POCO library on Windows with MSVC for threading
    74 COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} 5 _result TRUE)
    75 IF(NOT _result EQUAL -1 AND NOT MINGW)
    76     SET(POCO_REQUIRED TRUE)
    77 ENDIF()
    78 
    79 # Include paths and other special treatments
    80 SET(ENV{ALUTDIR}               ${DEP_INCLUDE_DIR}/freealut)
    81 SET(ENV{BOOST_ROOT}            ${DEP_INCLUDE_DIR}/boost)
    82 SET(ENV{CEGUIDIR}              ${DEP_INCLUDE_DIR}/cegui)
    83 SET(ENV{DBGHELP_DIR}           ${DEP_INCLUDE_DIR}/dbghelp)
    84 SET(ENV{DXSDK_DIR}             ${DEP_INCLUDE_DIR}/directx)
    85 #SET(ENV{ENETDIR}               ${DEP_INCLUDE_DIR}/enet)
    86 SET(ENV{LUA_DIR}               ${DEP_INCLUDE_DIR}/lua)
    87 SET(ENV{OGGDIR}                ${DEP_INCLUDE_DIR}/libogg)
    88 SET(ENV{VORBISDIR}             ${DEP_INCLUDE_DIR}/libvorbis)
    89 SET(ENV{OGRE_HOME}             ${DEP_INCLUDE_DIR}/ogre)
    90 SET(ENV{OGRE_PLUGIN_DIR}       ${DEP_BINARY_DIR})
    91 SET(ENV{OPENALDIR}             ${DEP_INCLUDE_DIR}/openal)
    92 SET(ENV{POCODIR}               ${DEP_INCLUDE_DIR}/poco)
    93 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl/include)
    94 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/zlib/include)
    95 
    96 ### INSTALL ###
    97 
    98 # Tcl script library
    99 INSTALL(
    100   DIRECTORY ${DEP_LIBRARY_DIR}/tcl/
    101   DESTINATION lib/tcl
    102 )
    103 
    104 # On Windows, DLLs have to be in the executable folder, install them
    105 IF(WIN32 AND DEP_BINARY_DIR)
    106   ## DEBUG
    107   # When installing a debug version, we really can't know which libraries
    108   # are used in released mode because there might be deps of deps.
    109   # --> Copy all of them, except the debug databases
    110   INSTALL(
    111     DIRECTORY ${DEP_BINARY_DIR}/
    112     DESTINATION bin
    113     CONFIGURATIONS Debug
    114     REGEX "^.*\\.pdb$" EXCLUDE
    115   )
    116 
    117   ## RELEASE
    118   # Try to filter out all the debug libraries. If the regex doesn't do the
    119   # job anymore, simply adjust it.
    120   INSTALL(
    121     DIRECTORY ${DEP_BINARY_DIR}/
    122     DESTINATION bin
    123     CONFIGURATIONS Release RelWithDebInfo MinSizeRel
    124     REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE
    125   )
    126 ENDIF()
     46 
     47  INCLUDE(CompareVersionStrings)
     48  SET(_version_match FALSE)
     49  FOREACH(_version ${_allowed_minimum_versions})
     50    # Get major version
     51    STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
     52    COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
     53    IF(_result EQUAL 0)
     54      COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
     55      IF(NOT _result LESS 0)
     56        SET(_version_match TRUE)
     57      ENDIF()
     58    ENDIF()
     59  ENDFOREACH(_version)
     60  IF(NOT _version_match)
     61    MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
     62            "Possible required versions: ${_allowed_minimum_versions}\n"
     63            "You can get a new version from www.orxonox.net")
     64  ENDIF()
     65 
     66ENDMACRO(CHECK_PACKAGE_VERSION)
Note: See TracChangeset for help on using the changeset viewer.