[Widelands-cvs] SF.net SVN: widelands:[5022] branches/cmake-migration
Status: Beta
Brought to you by:
sirver
From: <qc...@us...> - 2010-01-27 01:23:33
|
Revision: 5022 http://widelands.svn.sourceforge.net/widelands/?rev=5022&view=rev Author: qcs Date: 2010-01-27 01:23:23 +0000 (Wed, 27 Jan 2010) Log Message: ----------- Versioning stuff (CMake, CPack) and cleanup Modified Paths: -------------- branches/cmake-migration/CMakeLists.txt branches/cmake-migration/src/CMakeLists.txt Modified: branches/cmake-migration/CMakeLists.txt =================================================================== --- branches/cmake-migration/CMakeLists.txt 2010-01-26 23:00:12 UTC (rev 5021) +++ branches/cmake-migration/CMakeLists.txt 2010-01-27 01:23:23 UTC (rev 5022) @@ -4,8 +4,10 @@ # set them via cmake -DVARIABLE=VALUE # CMAKE_BUILD_TYPE: # Default is "Debug", Distributors should use "Release" -# WL_VERSION: +# WL_VERSION_MAJOR, WL_VERSION_MINOR (, WL_VERSION_PATCH): # Default is using SVN revision, Distributors should use correct version +# Attention: We are currently only using MAJOR and MINOR. +# If you try to set WL_VERSION directly, it will ignore your setting. cmake_minimum_required (VERSION 2.6) @@ -15,17 +17,42 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) -if (NOT CMAKE_BUILD_TYPE) +if (NOT DEFINED CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE Debug) -endif (NOT CMAKE_BUILD_TYPE) +endif (NOT DEFINED CMAKE_BUILD_TYPE) -if (NOT WL_VERSION) +# we don't want someone to set this directly... +unset (WL_VERSION CACHE) + +# ...but using MAJOR, MINOR and PATCH +# (BUT: we only use MAJOR and MINOR for the moment; PATCH is set to 0) +if (DEFINED WL_VERSION_MAJOR) + set (WL_VERSION ${WL_VERSION_MAJOR}) + set (CPACK_PACKAGE_VERSION_MAJOR ${WL_VERSION_MAJOR}) + if (DEFINED WL_VERSION_MINOR) + set (WL_VERSION ${WL_VERSION}.${WL_VERSION_MINOR}) + set (CPACK_PACKAGE_VERSION_MINOR ${WL_VERSION_MINOR}) + if (DEFINED WL_VERSION_PATCH) + set (WL_VERSION ${WL_VERSION}.${WL_VERSION_PATCH}) + set (CPACK_PACKAGE_VERSION_PATCH ${WL_VERSION_PATCH}) + else (DEFINED WL_VERSION_PATCH) + set (CPACK_PACKAGE_VERSION_PATCH 0) + endif (DEFINED WL_VERSION_PATCH) + else (DEFINED WL_VERSION_MINOR) + set (CPACK_PACKAGE_VERSION_MINOR 0) + endif (DEFINED WL_VERSION_MINOR) +endif (DEFINED WL_VERSION_MAJOR) + +if (NOT DEFINED WL_VERSION) find_package (PythonInterp REQUIRED) - execute_process (COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/detect_revision.py - OUTPUT_VARIABLE WL_VERSION WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_STRIP_TRAILING_WHITESPACE) -endif (NOT WL_VERSION) -message( "Version of Widelands Build is ${WL_VERSION}(${CMAKE_BUILD_TYPE})") + execute_process ( + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/detect_revision.py + OUTPUT_VARIABLE WL_VERSION + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +endif (NOT DEFINED WL_VERSION) +message ("Version of Widelands Build is ${WL_VERSION}(${CMAKE_BUILD_TYPE})") set (WL_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) set (WL_INSTALL_BINDIR ${WL_INSTALL_PREFIX}/bin/) @@ -88,23 +115,15 @@ find_package(Doxygen REQUIRED) include(Documentation) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/sourcecode) - configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in - ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE) - add_custom_target(doc COMMAND ${DOXYGEN_EXECUTABLE} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE) + add_custom_target(doc COMMAND ${DOXYGEN_EXECUTABLE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif() -include_directories(${CMAKE_CURRENT_BINARY_DIR}/src) -include_directories(src) +include_directories(src ${CMAKE_CURRENT_BINARY_DIR}/src) -configure_file( - src/config.h.cmake src/config.h - ) +#configure_file (src/config.h.cmake src/config.h) +#configure_file (src/build_info.cc.cmake src/build_info.cc) -configure_file( - src/build_info.cc.cmake src/build_info.cc - ) - #add_subdirectory(po) add_subdirectory(pics) add_subdirectory(src) @@ -141,6 +160,7 @@ ) endif() +set (CPACK_PACKAGE_FILE_NAME widelands-${WL_VERSION}) set (CPACK_COMPONENTS_ALL ExecutableFiles CoreDataFiles DocFiles) set (CPACK_GENERATOR TGZ) set (CPACK_SOURCE_GENERATOR TGZ) Modified: branches/cmake-migration/src/CMakeLists.txt =================================================================== --- branches/cmake-migration/src/CMakeLists.txt 2010-01-26 23:00:12 UTC (rev 5021) +++ branches/cmake-migration/src/CMakeLists.txt 2010-01-27 01:23:23 UTC (rev 5022) @@ -1,3 +1,6 @@ +configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) +configure_file (${CMAKE_CURRENT_SOURCE_DIR}/build_info.cc.cmake ${CMAKE_CURRENT_BINARY_DIR}/build_info.cc) + file(GLOB WL_SRCS *.cc economy/*.cc trigger/*.cc scripting/*.cc) set(WL_TEST_SRCS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |