2010-02-28 10:04:35 +01:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
|
|
|
|
|
2018-11-28 06:06:03 +01:00
|
|
|
IF(POLICY CMP0003)
|
|
|
|
CMAKE_POLICY(SET CMP0003 NEW)
|
|
|
|
ENDIF(POLICY CMP0003)
|
|
|
|
|
|
|
|
IF(POLICY CMP0056)
|
|
|
|
CMAKE_POLICY(SET CMP0056 NEW)
|
|
|
|
ENDIF(POLICY CMP0056)
|
|
|
|
|
|
|
|
IF(POLICY CMP0066)
|
|
|
|
CMAKE_POLICY(SET CMP0066 NEW)
|
|
|
|
ENDIF(POLICY CMP0066)
|
|
|
|
|
2010-07-10 23:24:18 +02:00
|
|
|
# Speed Dreams project
|
2011-12-03 12:08:11 +01:00
|
|
|
PROJECT(speed-dreams-2)
|
2010-07-10 23:24:18 +02:00
|
|
|
|
2010-02-28 10:04:35 +01:00
|
|
|
INCLUDE(cmake/macros.cmake)
|
|
|
|
INCLUDE(cmake/checks.cmake)
|
|
|
|
|
|
|
|
CHECK_HEADERS_H()
|
|
|
|
CHECK_FUNCTIONS()
|
|
|
|
CHECK_LIBRARIES()
|
|
|
|
|
2012-01-10 19:18:32 +01:00
|
|
|
# Determine version
|
2010-02-28 10:04:35 +01:00
|
|
|
SET(NEXT_LESSER_VERSION 0) # The next lesser version
|
2018-11-22 02:06:58 +01:00
|
|
|
SET(NEXT_MAJOR_MINOR_VERSION "2.3") # Next major.minor version
|
2010-02-28 10:04:35 +01:00
|
|
|
|
2012-08-19 10:18:52 +02:00
|
|
|
# Uncomment if you don't want automatic SVN version detection
|
|
|
|
# (poor performances under Windows, don't work with git-svn, ...)
|
|
|
|
# SET(OPTION_AUTOVERSION Off)
|
|
|
|
|
2012-01-10 19:18:32 +01:00
|
|
|
IF(NOT OPTION_AUTOVERSION)
|
|
|
|
|
2010-07-03 15:54:26 +02:00
|
|
|
SET(VERSION "${NEXT_MAJOR_MINOR_VERSION}-dev")
|
2012-01-10 19:18:32 +01:00
|
|
|
SET(VERSION_LONG "${VERSION}")
|
|
|
|
|
|
|
|
MESSAGE(STATUS "Version '${VERSION_LONG}' (not auto-detected from SVN source tree)")
|
|
|
|
|
|
|
|
ELSE(NOT OPTION_AUTOVERSION)
|
|
|
|
|
|
|
|
# Use SVN HeadURL property on this CMakeLists.txt file in order to automatically get the current version
|
|
|
|
SET(HEAD_URL "$HeadURL$")
|
|
|
|
|
|
|
|
# Define regular expressions
|
2013-04-14 02:30:45 +02:00
|
|
|
SET(REGEX_TAG "^\\$HeadURL:.*speed-dreams/code/tags/([^/\\$ ]*).*\\$$")
|
|
|
|
SET(REGEX_BUG_BRANCH "^\\$HeadURL:.*speed-dreams/code/branches/([0-9]+\\.[0-9]+)(\\.[xX])?/.*\\$$")
|
|
|
|
SET(REGEX_TRUNK "^\\$HeadURL:.*speed-dreams/code/trunk/.*\\$$")
|
|
|
|
SET(REGEX_BRANCH "^\\$HeadURL:.*speed-dreams/code/branches/([^/\\$ ]*).*\\$$")
|
2012-01-10 19:18:32 +01:00
|
|
|
|
|
|
|
# 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}")
|
|
|
|
|
|
|
|
# See if we need to look at the current SVN revision
|
2010-02-28 10:04:35 +01:00
|
|
|
SET(NEED_SVN_REV TRUE)
|
2012-01-10 19:18:32 +01:00
|
|
|
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}")
|
|
|
|
SET(VERSION "${TMP_VERSION}.${NEXT_LESSER_VERSION}-dev")
|
|
|
|
ELSEIF(VERSION_IS_TRUNK)
|
|
|
|
SET(VERSION "${NEXT_MAJOR_MINOR_VERSION}-trunk")
|
|
|
|
ELSEIF(VERSION_IS_BRANCH)
|
|
|
|
STRING(REGEX REPLACE "${REGEX_BRANCH}" "\\1" VERSION "${HEAD_URL}")
|
|
|
|
ELSE(VERSION_IS_TAG)
|
|
|
|
MESSAGE("Warning: Could not determine version name from HeadURL ${HEAD_URL}")
|
|
|
|
SET(VERSION "${NEXT_MAJOR_MINOR_VERSION}-dev")
|
|
|
|
SET(NEED_SVN_REV FALSE)
|
|
|
|
ENDIF(VERSION_IS_TAG)
|
|
|
|
|
|
|
|
# Try to get current SVN revision
|
|
|
|
IF(NEED_SVN_REV)
|
|
|
|
SET(SVN_FIND_REV_FAILED FALSE)
|
|
|
|
FIND_PROGRAM(SVNVERSION_EXEC svnversion PATHS /usr/local/bin /usr/bin)
|
|
|
|
MARK_AS_ADVANCED(SVNVERSION_EXEC)
|
|
|
|
IF(NOT SVNVERSION_EXEC)
|
2010-02-28 10:04:35 +01:00
|
|
|
SET(SVN_FIND_REV_FAILED TRUE)
|
2012-01-10 19:18:32 +01:00
|
|
|
ENDIF(NOT SVNVERSION_EXEC)
|
|
|
|
IF(NOT SVN_FIND_REV_FAILED)
|
|
|
|
MESSAGE(STATUS "Looking for current subversion revision (may be long) ...")
|
|
|
|
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)
|
|
|
|
SET(VERSION_LONG "${VERSION}")
|
|
|
|
IF(NOT SVN_FIND_REV_FAILED)
|
|
|
|
STRING(TOLOWER ${SVN_REV} SVN_REV)
|
|
|
|
SET(VERSION_LONG "${VERSION_LONG}-r${SVN_REV}")
|
|
|
|
ENDIF(NOT SVN_FIND_REV_FAILED)
|
|
|
|
ELSE(NEED_SVN_REV)
|
|
|
|
SET(VERSION_LONG "${VERSION}")
|
|
|
|
ENDIF(NEED_SVN_REV)
|
|
|
|
|
|
|
|
MESSAGE(STATUS "Version '${VERSION_LONG}'")
|
|
|
|
|
|
|
|
ENDIF(NOT OPTION_AUTOVERSION)
|
2010-02-28 10:04:35 +01:00
|
|
|
|
2012-01-10 19:18:32 +01:00
|
|
|
# Generate config.h
|
2012-09-14 20:39:40 +02:00
|
|
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in.cmake
|
2010-02-28 10:04:35 +01:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
|
|
|
2012-01-10 19:18:32 +01:00
|
|
|
# Generate DOxygen configuration file
|
2012-09-14 20:39:40 +02:00
|
|
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/doxygenconfig.in.cmake
|
2013-03-23 18:59:22 +01:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/doxygen_config @ONLY)
|
2010-02-28 10:04:35 +01:00
|
|
|
|
2012-09-23 13:22:50 +02:00
|
|
|
|
|
|
|
# Fictive = no-output target, for having source files available in IDEs.
|
2014-06-18 03:57:09 +02:00
|
|
|
SET(_SOURCES CHANGES.txt COPYING.txt INSTALL.txt README.txt)
|
2013-03-25 20:40:53 +01:00
|
|
|
ADD_CUSTOM_TARGET(rootdoc SOURCES ${_SOURCES} data/data/credits.xml)
|
2012-09-23 13:22:50 +02:00
|
|
|
|
|
|
|
# Install top tree data files
|
|
|
|
SD_INSTALL_FILES(DATA "/" FILES ${_SOURCES})
|
2011-01-09 23:17:22 +01:00
|
|
|
|
2013-03-23 18:59:22 +01:00
|
|
|
# Initialize user settings file management (before any of them is collected).
|
|
|
|
SD_SETUP_SETTINGS_VERSION()
|
|
|
|
|
2012-01-10 19:18:32 +01:00
|
|
|
# Sub-dirs to build ...
|
2010-02-28 10:04:35 +01:00
|
|
|
ADD_SUBDIRECTORY(src)
|
|
|
|
ADD_SUBDIRECTORY(data)
|
|
|
|
ADD_SUBDIRECTORY(cmake)
|
|
|
|
|
2013-03-23 18:59:22 +01:00
|
|
|
# After the user settings files have been collected,
|
|
|
|
# Update (and then install) version.xml from their respective version.
|
|
|
|
SD_UPDATE_SETTINGS_VERSION()
|
|
|
|
|
|
|
|
# Usefull for using an installation of SD as a robot development framework without building it.
|
2010-09-19 15:25:52 +02:00
|
|
|
INSTALL_SD_CMAKE()
|
2010-02-28 10:04:35 +01:00
|
|
|
|
2010-09-07 23:34:19 +02:00
|
|
|
# Generate a 'make clobber'-like clobber.sh/.bat script in case of an in-source build.
|
2012-08-08 19:38:39 +02:00
|
|
|
IF("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
|
|
|
|
SD_GENERATE_CLOBBER_SCRIPT()
|
|
|
|
ENDIF("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
|
2010-09-07 23:34:19 +02:00
|
|
|
|
|
|
|
# Add an unistall target.
|
|
|
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake" IMMEDIATE @ONLY)
|
2012-08-08 19:38:39 +02:00
|
|
|
IF(MSVC)
|
|
|
|
SET(_UNINST_TGT_NAME "UNINSTALL")
|
|
|
|
ELSE(MSVC)
|
|
|
|
SET(_UNINST_TGT_NAME "uninstall")
|
|
|
|
ENDIF(MSVC)
|
|
|
|
ADD_CUSTOM_TARGET(${_UNINST_TGT_NAME} "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake" )
|
2011-01-12 20:32:40 +01:00
|
|
|
|
2019-06-04 02:55:22 +02:00
|
|
|
IF(OPTION_PACKAGING)
|
|
|
|
IF(MSVC)
|
|
|
|
INCLUDE(cmake/packagemaker-nsis.cmake)
|
|
|
|
ENDIF(MSVC)
|
|
|
|
ELSE(OPTION_PACKAGING)
|
2010-09-07 23:34:19 +02:00
|
|
|
# Configure CPack.
|
2019-06-04 02:55:22 +02:00
|
|
|
INCLUDE(cmake/packagemaker.cmake)
|
|
|
|
ENDIF(OPTION_PACKAGING)
|
2010-02-28 10:04:35 +01:00
|
|
|
|