2010-02-28 10:04:35 +01:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
|
|
|
|
|
2010-07-10 23:24:18 +02:00
|
|
|
# Speed Dreams project
|
|
|
|
PROJECT(speed-dreams)
|
|
|
|
|
2010-02-28 10:04:35 +01:00
|
|
|
INCLUDE(cmake/macros.cmake)
|
|
|
|
INCLUDE(cmake/checks.cmake)
|
|
|
|
|
|
|
|
# 3rd Party Dependency Stuff
|
|
|
|
IF(WIN32)
|
|
|
|
INCLUDE(Find3rdPartyDependencies)
|
|
|
|
ENDIF(WIN32)
|
|
|
|
|
|
|
|
CHECK_HEADERS_H()
|
|
|
|
CHECK_FUNCTIONS()
|
|
|
|
CHECK_LIBRARIES()
|
|
|
|
CHECK_PLIB_LIBRARIES()
|
|
|
|
CHECK_PACKAGES()
|
|
|
|
|
|
|
|
#Calculate version
|
|
|
|
#Set version which doesn't follow from HeadURL
|
|
|
|
SET(HEAD_URL "$HeadURL$")
|
|
|
|
SET(NEXT_LESSER_VERSION 0) # The next lesser version
|
|
|
|
SET(NEXT_MAJOR_MINOR_VERSION "2.0") # Next major.minor version
|
|
|
|
|
|
|
|
#Define regular expressions
|
|
|
|
SET(REGEX_TAG "^\\$HeadURL:.*speed-dreams/tags/([^/\\$ ]*).*\\$$")
|
|
|
|
SET(REGEX_BUG_BRANCH "^\\$HeadURL:.*speed-dreams/branches/([0-9]+\\.[0-9]+)(\\.[xX])?/.*\\$$")
|
|
|
|
SET(REGEX_TRUNK "^\\$HeadURL:.*speed-dreams/trunk/.*\\$$")
|
|
|
|
SET(REGEX_BRANCH "^\\$HeadURL:.*speed-dreams/branches/([^/\\$ ]*).*\\$$")
|
|
|
|
|
|
|
|
#Check regular expressions
|
|
|
|
STRING(REGEX MATCH "${REGEX_TAG}" VERSION_IS_TAG "${HEAD_URL}")
|
|
|
|
STRING(REGEX MATCH "${REGEX_BUG_BRANCH}" VERSION_IS_BUG_BRANCH "${HEAD_URL}")
|
|
|
|
STRING(REGEX MATCH "${REGEX_TRUNK}" VERSION_IS_TRUNK "${HEAD_URL}")
|
|
|
|
STRING(REGEX MATCH "${REGEX_BRANCH}" VERSION_IS_BRANCH "${HEAD_URL}")
|
|
|
|
|
|
|
|
#Look in which case we are and set the version according to that
|
|
|
|
SET(NEED_SVN_REV FALSE)
|
|
|
|
IF(VERSION_IS_TAG)
|
|
|
|
STRING(REGEX REPLACE "${REGEX_TAG}" "\\1" VERSION "${HEAD_URL}")
|
|
|
|
ELSEIF(VERSION_IS_BUG_BRANCH)
|
|
|
|
STRING(REGEX REPLACE "${REGEX_BUG_BRANCH}" "\\1" TMP_VERSION "${HEAD_URL}")
|
2010-07-06 00:12:25 +02:00
|
|
|
SET(VERSION "${TMP_VERSION}.${NEXT_LESSER_VERSION}-dev")
|
2010-02-28 10:04:35 +01:00
|
|
|
SET(NEED_SVN_REV TRUE)
|
|
|
|
ELSEIF(VERSION_IS_TRUNK)
|
2010-07-03 15:54:26 +02:00
|
|
|
SET(VERSION "${NEXT_MAJOR_MINOR_VERSION}-dev")
|
2010-02-28 10:04:35 +01:00
|
|
|
SET(NEED_SVN_REV TRUE)
|
|
|
|
ELSEIF(VERSION_IS_BRANCH)
|
|
|
|
STRING(REGEX REPLACE "${REGEX_BRANCH}" "\\1" VERSION "${HEAD_URL}")
|
2010-07-06 00:12:25 +02:00
|
|
|
SET(VERSION "${VERSION}-dev")
|
2010-02-28 10:04:35 +01:00
|
|
|
SET(NEED_SVN_REV TRUE)
|
|
|
|
ELSE(VERSION_IS_TAG)
|
2010-07-06 00:12:25 +02:00
|
|
|
MESSAGE("Warning: Could not determine version name from HeadURL ${HEAD_URL}")
|
2010-02-28 10:04:35 +01:00
|
|
|
ENDIF(VERSION_IS_TAG)
|
|
|
|
|
|
|
|
#Try to get current revision
|
|
|
|
IF(NEED_SVN_REV)
|
|
|
|
SET(SVN_FIND_REV_FAILED FALSE)
|
|
|
|
FIND_PROGRAM(SVNVERSION_EXEC svnversion PATHS /usr/local/bin /usr/bin)
|
|
|
|
IF(NOT SVNVERSION_EXEC)
|
|
|
|
SET(SVN_FIND_REV_FAILED TRUE)
|
|
|
|
ENDIF(NOT SVNVERSION_EXEC)
|
|
|
|
IF(NOT SVN_FIND_REV_FAILED)
|
|
|
|
EXECUTE_PROCESS(COMMAND ${SVNVERSION_EXEC}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
--no-newline
|
|
|
|
RESULT_VARIABLE SVNVERSION_RESULT
|
|
|
|
OUTPUT_VARIABLE SVN_REV_LONG)
|
|
|
|
IF(NOT ${SVNVERSION_RESULT} EQUAL 0)
|
|
|
|
SET(SVN_FIND_REV_FAILED TRUE)
|
|
|
|
ENDIF(NOT ${SVNVERSION_RESULT} EQUAL 0)
|
|
|
|
ENDIF(NOT SVN_FIND_REV_FAILED)
|
|
|
|
IF(NOT SVN_FIND_REV_FAILED)
|
|
|
|
IF("${SVN_REV_LONG}" MATCHES ":")
|
|
|
|
STRING(REGEX REPLACE "^[^:]*:(.*)$" "\\1" SVN_REV
|
|
|
|
"${SVN_REV_LONG}")
|
|
|
|
ELSE("${SVN_REV_LONG}" MATCHES ":")
|
|
|
|
SET(SVN_REV "${SVN_REV_LONG}")
|
|
|
|
ENDIF("${SVN_REV_LONG}" MATCHES ":")
|
|
|
|
IF(NOT SVN_REV)
|
|
|
|
SET(SVN_FIND_REV_FAILED TRUE)
|
|
|
|
ENDIF(NOT SVN_REV)
|
|
|
|
ENDIF(NOT SVN_FIND_REV_FAILED)
|
2010-07-03 15:54:26 +02:00
|
|
|
SET(VERSION_LONG "${VERSION}")
|
|
|
|
IF(NOT SVN_FIND_REV_FAILED)
|
2010-07-06 00:12:25 +02:00
|
|
|
STRING(TOLOWER ${SVN_REV} SVN_REV)
|
2010-07-03 15:54:26 +02:00
|
|
|
SET(VERSION_LONG "${VERSION_LONG}-r${SVN_REV}")
|
|
|
|
ENDIF(NOT SVN_FIND_REV_FAILED)
|
2010-02-28 10:04:35 +01:00
|
|
|
MESSAGE(STATUS "Looking for current subversion revision : found '${VERSION_LONG}'")
|
|
|
|
ELSE(NEED_SVN_REV)
|
|
|
|
SET(VERSION_LONG "${VERSION}")
|
|
|
|
ENDIF(NEED_SVN_REV)
|
|
|
|
|
|
|
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
|
|
|
|
|
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
|
|
|
|
|
|
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxygen_config.cmake
|
2010-04-23 19:46:48 +02:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/doxygen_config @ONLY)
|
2010-02-28 10:04:35 +01:00
|
|
|
|
|
|
|
TORCS_INSTALL_FILES(DATA . FILES credits.xml)
|
|
|
|
|
|
|
|
ADD_SUBDIRECTORY(src)
|
|
|
|
ADD_SUBDIRECTORY(data)
|
|
|
|
ADD_SUBDIRECTORY(cmake)
|
|
|
|
|
|
|
|
INSTALL_TORCSNG_CMAKE()
|
|
|
|
|
|
|
|
INCLUDE(cmake/packagemaker.cmake)
|
|
|
|
|