[Orxonox-commit 2879] r7582 - in code/branches/ois_update/cmake: . tools
rgrieder at orxonox.net
rgrieder at orxonox.net
Mon Oct 25 23:05:34 CEST 2010
Author: rgrieder
Date: 2010-10-25 23:05:34 +0200 (Mon, 25 Oct 2010)
New Revision: 7582
Added:
code/branches/ois_update/cmake/PackageConfigOSX.cmake
code/branches/ois_update/cmake/tools/CheckPackageVersion.cmake
Modified:
code/branches/ois_update/cmake/LibraryConfig.cmake
code/branches/ois_update/cmake/PackageConfig.cmake
Log:
Added CMake code for OS X package configuration.
Not guaranteed to work... Mainly because it requires several adjustments of the paths.
Modified: code/branches/ois_update/cmake/LibraryConfig.cmake
===================================================================
--- code/branches/ois_update/cmake/LibraryConfig.cmake 2010-10-25 20:21:53 UTC (rev 7581)
+++ code/branches/ois_update/cmake/LibraryConfig.cmake 2010-10-25 21:05:34 UTC (rev 7582)
@@ -39,15 +39,14 @@
# On Windows using a package causes way less problems
SET(_option_msg "Set this to true to use precompiled dependecy archives")
-IF(WIN32)
+IF(WIN32 OR APPLE)
OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" ON)
-ELSE(WIN32)
+ELSE()
OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
-ENDIF(WIN32)
+ENDIF()
# Scripts for specific library and CMake config
INCLUDE(LibraryConfigTardis)
-INCLUDE(LibraryConfigApple)
IF(DEPENDENCY_PACKAGE_ENABLE)
GET_FILENAME_COMPONENT(_dep_dir_1 ${CMAKE_SOURCE_DIR}/../dependencies ABSOLUTE)
@@ -72,9 +71,13 @@
MESSAGE(STATUS "Warning: Could not find dependency directory."
"Disable LIBRARY_USE_PACKAGE if you have none intalled.")
ELSE()
- INCLUDE(PackageConfigMinGW)
- INCLUDE(PackageConfigMSVC)
- INCLUDE(PackageConfig) # For both msvc and mingw
+ IF(WIN32)
+ INCLUDE(PackageConfigMinGW)
+ INCLUDE(PackageConfigMSVC)
+ INCLUDE(PackageConfig) # For both msvc and mingw
+ ELSEIF(APPLE)
+ INCLUDE(PackageConfigOSX)
+ ENDIF(WIN32)
ENDIF()
ENDIF(DEPENDENCY_PACKAGE_ENABLE)
Modified: code/branches/ois_update/cmake/PackageConfig.cmake
===================================================================
--- code/branches/ois_update/cmake/PackageConfig.cmake 2010-10-25 20:21:53 UTC (rev 7581)
+++ code/branches/ois_update/cmake/PackageConfig.cmake 2010-10-25 21:05:34 UTC (rev 7582)
@@ -24,47 +24,10 @@
# Library files are treated separately.
#
-# Check package version info
-# MAJOR: Breaking change
-# MINOR: No breaking changes by the dependency package
-# For example any code running on 3.0 should still run on 3.1
-# But you can specify that the code only runs on 3.1 and higher
-# or 4.0 and higher (so both 3.1 and 4.0 will work).
-SET(ALLOWED_MINIMUM_VERSIONS 3.1 4.0 5.0)
+INCLUDE(CheckPackageVersion)
-IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
- SET(DEPENDENCY_VERSION 1.0)
-ELSE()
- # Get version from file
- FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content)
- SET(_match)
- STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content})
- IF(_match)
- SET(DEPENDENCY_VERSION ${_match})
- ELSE()
- MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.")
- ENDIF()
-ENDIF()
+CHECK_PACKAGE_VERSION(3.1 4.0 5.0)
-INCLUDE(CompareVersionStrings)
-SET(_version_match FALSE)
-FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS})
- # Get major version
- STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
- COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
- IF(_result EQUAL 0)
- COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
- IF(NOT _result LESS 0)
- SET(_version_match TRUE)
- ENDIF()
- ENDIF()
-ENDFOREACH(_version)
-IF(NOT _version_match)
- MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
- "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n"
- "You can get a new version from www.orxonox.net")
-ENDIF()
-
IF(NOT _INTERNAL_PACKAGE_MESSAGE)
MESSAGE(STATUS "Using library package for the dependencies.")
SET(_INTERNAL_PACKAGE_MESSAGE 1 CACHE INTERNAL "Do not edit!" FORCE)
Copied: code/branches/ois_update/cmake/PackageConfigOSX.cmake (from rev 7581, code/branches/ois_update/cmake/PackageConfig.cmake)
===================================================================
--- code/branches/ois_update/cmake/PackageConfigOSX.cmake (rev 0)
+++ code/branches/ois_update/cmake/PackageConfigOSX.cmake 2010-10-25 21:05:34 UTC (rev 7582)
@@ -0,0 +1,95 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+ # as published by the Free Software Foundation; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with this program; if not, write to the Free Software Foundation,
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ #
+ # Author:
+ # Reto Grieder
+ # Description:
+ # OS X package configuration
+ #
+
+INCLUDE(CheckPackageVersion)
+
+CHECK_PACKAGE_VERSION(1.0)
+
+IF(NOT _INTERNAL_PACKAGE_MESSAGE)
+ MESSAGE(STATUS "Using library package for the dependencies.")
+ SET(_INTERNAL_PACKAGE_MESSAGE 1 CACHE INTERNAL "Do not edit!" FORCE)
+ENDIF()
+
+SET(DEP_INCLUDE_DIR ${DEPENDENCY_PACKAGE_DIR}/include)
+SET(DEP_LIBRARY_DIR ${DEPENDENCY_PACKAGE_DIR}/lib)
+SET(DEP_BINARY_DIR ${DEPENDENCY_PACKAGE_DIR}/bin)
+
+# Sets the library path for the FIND_LIBRARY
+SET(CMAKE_LIBRARY_PATH ${DEP_LIBRARY_DIR})
+
+# Certain find scripts don't behave as ecpected so we have
+# to specify the libraries ourselves.
+SET(TCL_LIBRARY ${DEP_BINARY_DIR}/tcl85.dll CACHE FILEPATH "")
+SET(ZLIB_LIBRARY ${DEP_BINARY_DIR}/zlib1.dll CACHE FILEPATH "")
+
+# Include paths and other special treatments
+SET(ENV{ALUTDIR} ${DEP_INCLUDE_DIR}/freealut)
+SET(ENV{BOOST_ROOT} ${DEP_INCLUDE_DIR}/boost)
+SET(ENV{CEGUIDIR} ${DEP_INCLUDE_DIR}/cegui)
+SET(ENV{DBGHELP_DIR} ${DEP_INCLUDE_DIR}/dbghelp)
+SET(ENV{DXSDK_DIR} ${DEP_INCLUDE_DIR}/directx)
+#SET(ENV{ENETDIR} ${DEP_INCLUDE_DIR}/enet)
+SET(ENV{LUA_DIR} ${DEP_INCLUDE_DIR}/lua)
+SET(ENV{OGGDIR} ${DEP_INCLUDE_DIR}/libogg)
+SET(ENV{VORBISDIR} ${DEP_INCLUDE_DIR}/libvorbis)
+SET(ENV{OGRE_HOME} ${DEP_INCLUDE_DIR}/ogre)
+SET(ENV{OGRE_PLUGIN_DIR} ${DEP_BINARY_DIR})
+SET(ENV{OPENALDIR} ${DEP_INCLUDE_DIR}/openal)
+SET(ENV{POCODIR} ${DEP_INCLUDE_DIR}/poco)
+LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl/include)
+LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/zlib/include)
+
+### INSTALL ###
+
+# Tcl script library
+# TODO: How does this work on OS X?
+#INSTALL(
+# DIRECTORY ${DEP_LIBRARY_DIR}/tcl/
+# DESTINATION lib/tcl
+#)
+
+# TODO: Install on OSX
+IF(FALSE)
+ ## DEBUG
+ # When installing a debug version, we really can't know which libraries
+ # are used in released mode because there might be deps of deps.
+ # --> Copy all of them, except the debug databases
+ INSTALL(
+ DIRECTORY ${DEP_BINARY_DIR}/
+ DESTINATION bin
+ CONFIGURATIONS Debug
+ REGEX "^.*\\.pdb$" EXCLUDE
+ )
+
+ ## RELEASE
+ # Try to filter out all the debug libraries. If the regex doesn't do the
+ # job anymore, simply adjust it.
+ INSTALL(
+ DIRECTORY ${DEP_BINARY_DIR}/
+ DESTINATION bin
+ CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+ REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE
+ )
+ENDIF()
Copied: code/branches/ois_update/cmake/tools/CheckPackageVersion.cmake (from rev 7581, code/branches/ois_update/cmake/PackageConfig.cmake)
===================================================================
--- code/branches/ois_update/cmake/tools/CheckPackageVersion.cmake (rev 0)
+++ code/branches/ois_update/cmake/tools/CheckPackageVersion.cmake 2010-10-25 21:05:34 UTC (rev 7582)
@@ -0,0 +1,66 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+ # as published by the Free Software Foundation; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with this program; if not, write to the Free Software Foundation,
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ #
+ # Author:
+ # Reto Grieder
+ # Description:
+ # Check package version info
+ # MAJOR: Breaking change
+ # MINOR: No breaking changes by the dependency package
+ # For example any code running on 3.0 should still run on 3.1
+ # But you can specify that the code only runs on 3.1 and higher
+ # or 4.0 and higher (so both 3.1 and 4.0 will work).
+
+MACRO(CHECK_PACKAGE_VERSION)
+ SET(_allowed_minimum_versions ${ARGN})
+
+ IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
+ SET(DEPENDENCY_VERSION 1.0)
+ ELSE()
+ # Get version from file
+ FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content)
+ SET(_match)
+ STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content})
+ IF(_match)
+ SET(DEPENDENCY_VERSION ${_match})
+ ELSE()
+ MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.")
+ ENDIF()
+ ENDIF()
+
+ INCLUDE(CompareVersionStrings)
+ SET(_version_match FALSE)
+ FOREACH(_version ${_allowed_minimum_versions})
+ # Get major version
+ STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
+ COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
+ IF(_result EQUAL 0)
+ COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
+ IF(NOT _result LESS 0)
+ SET(_version_match TRUE)
+ ENDIF()
+ ENDIF()
+ ENDFOREACH(_version)
+ IF(NOT _version_match)
+ MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
+ "Possible required versions: ${_allowed_minimum_versions}\n"
+ "You can get a new version from www.orxonox.net")
+ ENDIF()
+
+ENDMACRO(CHECK_PACKAGE_VERSION)
More information about the Orxonox-commit
mailing list