diff options
Diffstat (limited to 'indra/cmake/BuildVersion.cmake')
-rw-r--r--[-rwxr-xr-x] | indra/cmake/BuildVersion.cmake | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/indra/cmake/BuildVersion.cmake b/indra/cmake/BuildVersion.cmake index e618a988b8..6ffa698a1c 100755..100644 --- a/indra/cmake/BuildVersion.cmake +++ b/indra/cmake/BuildVersion.cmake @@ -12,38 +12,44 @@ if (NOT DEFINED VIEWER_SHORT_VERSION) # will be true in indra/, false in indra/n if (DEFINED ENV{revision}) set(VIEWER_VERSION_REVISION $ENV{revision}) - message("Revision (from environment): ${VIEWER_VERSION_REVISION}") + message(STATUS "Revision (from environment): ${VIEWER_VERSION_REVISION}") else (DEFINED ENV{revision}) - find_program(MERCURIAL hg) - find_program(WORDCOUNT wc) - find_program(SED sed) - if (DEFINED MERCURIAL AND DEFINED WORDCOUNT AND DEFINED SED) - execute_process( - COMMAND ${MERCURIAL} log -r tip:0 --template '\\n' - COMMAND ${WORDCOUNT} -l - COMMAND ${SED} "s/ //g" - OUTPUT_VARIABLE VIEWER_VERSION_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") - message("Revision (from hg) ${VIEWER_VERSION_REVISION}") - else ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") - message("Revision not set (repository not found?); using 0") - set(VIEWER_VERSION_REVISION 0 ) - endif ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") - else (DEFINED MERCURIAL AND DEFINED WORDCOUNT AND DEFINED SED) - message("Revision not set: 'hg', 'wc' or 'sed' not found; using 0") + find_program(MERCURIAL + NAMES hg + PATHS [HKEY_LOCAL_MACHINE\\Software\\TortoiseHG] + PATH_SUFFIXES Mercurial) + mark_as_advanced(MERCURIAL) + if (MERCURIAL) + execute_process(COMMAND ${MERCURIAL} identify --num --rev tip + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE hg_id_result + ERROR_VARIABLE hg_id_error + OUTPUT_VARIABLE VIEWER_VERSION_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT ${hg_id_result} EQUAL 0) + message(SEND_ERROR "Revision number generation failed with output:\n${hg_id_error}") + else (NOT ${hg_id_result} EQUAL 0) + string(REGEX REPLACE "[^0-9a-f]" "" VIEWER_VERSION_REVISION ${VIEWER_VERSION_REVISION}) + endif (NOT ${hg_id_result} EQUAL 0) + if ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") + message(STATUS "Revision (from hg) ${VIEWER_VERSION_REVISION}") + else ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") + message(STATUS "Revision not set (repository not found?); using 0") + set(VIEWER_VERSION_REVISION 0 ) + endif ("${VIEWER_VERSION_REVISION}" MATCHES "^[0-9]+$") + else (MERCURIAL) + message(STATUS "Revision not set: mercurial not found; using 0") set(VIEWER_VERSION_REVISION 0) - endif (DEFINED MERCURIAL AND DEFINED WORDCOUNT AND DEFINED SED) + endif (MERCURIAL) endif (DEFINED ENV{revision}) - message("Building '${VIEWER_CHANNEL}' Version ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}") + message(STATUS "Building '${VIEWER_CHANNEL}' Version ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}") else ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) message(SEND_ERROR "Cannot get viewer version from '${VIEWER_VERSION_BASE_FILE}'") endif ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) if ("${VIEWER_VERSION_REVISION}" STREQUAL "") - message("Ultimate fallback, revision was blank or not set: will use 0") + message(STATUS "Ultimate fallback, revision was blank or not set: will use 0") set(VIEWER_VERSION_REVISION 0) endif ("${VIEWER_VERSION_REVISION}" STREQUAL "") @@ -53,5 +59,6 @@ if (NOT DEFINED VIEWER_SHORT_VERSION) # will be true in indra/, false in indra/n "LL_VIEWER_VERSION_MINOR=${VIEWER_VERSION_MINOR}" "LL_VIEWER_VERSION_PATCH=${VIEWER_VERSION_PATCH}" "LL_VIEWER_VERSION_BUILD=${VIEWER_VERSION_REVISION}" + "LLBUILD_CONFIG=\"${CMAKE_BUILD_TYPE}\"" ) endif (NOT DEFINED VIEWER_SHORT_VERSION) |