diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4d429e693..bf5867327 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -91,6 +91,7 @@ NL_CONFIGURE_CHECKS() #Platform specifics SETUP_EXTERNAL() +NL_GEN_REVISION_H() IF(WIN32) SET(WINSOCK2_LIB ws2_32.lib) diff --git a/code/CMakeModules/FindMercurial.cmake b/code/CMakeModules/FindMercurial.cmake new file mode 100644 index 000000000..9c252ad17 --- /dev/null +++ b/code/CMakeModules/FindMercurial.cmake @@ -0,0 +1,108 @@ +# - Extract information from a subversion working copy +# The module defines the following variables: +# Mercurial_HG_EXECUTABLE - path to hg command line client +# Mercurial_VERSION_HG - version of hg command line client +# Mercurial_FOUND - true if the command line client was found +# MERCURIAL_FOUND - same as Mercurial_FOUND, set for compatiblity reasons +# +# The minimum required version of Mercurial can be specified using the +# standard syntax, e.g. FIND_PACKAGE(Mercurial 1.4) +# +# If the command line client executable is found two macros are defined: +# Mercurial_WC_INFO( ) +# Mercurial_WC_LOG( ) +# Mercurial_WC_INFO extracts information of a subversion working copy at +# a given location. This macro defines the following variables: +# _WC_URL - url of the repository (at ) +# _WC_ROOT - root url of the repository +# _WC_REVISION - current revision +# _WC_LAST_CHANGED_AUTHOR - author of last commit +# _WC_LAST_CHANGED_DATE - date of last commit +# _WC_LAST_CHANGED_REV - revision of last commit +# _WC_INFO - output of command `hg info ' +# Mercurial_WC_LOG retrieves the log message of the base revision of a +# subversion working copy at a given location. This macro defines the +# variable: +# _LAST_CHANGED_LOG - last log of base revision +# Example usage: +# FIND_PACKAGE(Mercurial) +# IF(MERCURIAL_FOUND) +# Mercurial_WC_INFO(${PROJECT_SOURCE_DIR} Project) +# MESSAGE("Current revision is ${Project_WC_REVISION}") +# Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project) +# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}") +# ENDIF(MERCURIAL_FOUND) + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006 Tristan Carel +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +FIND_PROGRAM(Mercurial_HG_EXECUTABLE hg + DOC "mercurial command line client") +MARK_AS_ADVANCED(Mercurial_HG_EXECUTABLE) + +IF(Mercurial_HG_EXECUTABLE) + EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} --version + OUTPUT_VARIABLE Mercurial_VERSION_HG + OUTPUT_STRIP_TRAILING_WHITESPACE) + + STRING(REGEX REPLACE ".*version ([\\.0-9]+).*" + "\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}") + + MACRO(Mercurial_WC_INFO dir prefix) + EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip + WORKING_DIRECTORY ${dir} + OUTPUT_VARIABLE ${prefix}_WC_INFO + ERROR_VARIABLE Mercurial_hg_info_error + RESULT_VARIABLE Mercurial_hg_info_result + OUTPUT_STRIP_TRAILING_WHITESPACE) + + IF(NOT ${Mercurial_hg_info_result} EQUAL 0) + MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}") + ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0) + + STRING(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" + "\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}") + STRING(REGEX REPLACE "^(.*\n)?changeset: *([0-9]+).*" + "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}") + STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" + "\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}") + STRING(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*" + "\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}") + STRING(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" + "\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}") + + ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0) + + ENDMACRO(Mercurial_WC_INFO) + + MACRO(Mercurial_WC_LOG dir prefix) + # This macro can block if the certificate is not signed: + # hg ask you to accept the certificate and wait for your answer + # This macro requires a hg server network access (Internet most of the time) + # and can also be slow since it access the hg server + EXECUTE_PROCESS(COMMAND + ${Mercurial_HG_EXECUTABLE} --non-interactive log -r BASE ${dir} + OUTPUT_VARIABLE ${prefix}_LAST_CHANGED_LOG + ERROR_VARIABLE Mercurial_hg_log_error + RESULT_VARIABLE Mercurial_hg_log_result + OUTPUT_STRIP_TRAILING_WHITESPACE) + + IF(NOT ${Mercurial_hg_log_result} EQUAL 0) + MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Mercurial_hg_log_error}") + ENDIF(NOT ${Mercurial_hg_log_result} EQUAL 0) + ENDMACRO(Mercurial_WC_LOG) +ENDIF(Mercurial_HG_EXECUTABLE) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE) diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake new file mode 100644 index 000000000..fdf32abef --- /dev/null +++ b/code/CMakeModules/GetRevision.cmake @@ -0,0 +1,44 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) + +# ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory) +# SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt) + +SET(CMAKE_MODULE_PATH "${SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") + +MACRO(NOW RESULT) + IF (WIN32) + EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME) + STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} ${DATETIME}) + ELSEIF(UNIX) + EXECUTE_PROCESS(COMMAND "date" "+'%Y-%m-%d %H:%M:%S'" OUTPUT_VARIABLE ${RESULT}) + ELSE (WIN32) + MESSAGE(SEND_ERROR "date not implemented") + SET(${RESULT} 000000) + ENDIF (WIN32) +ENDMACRO(NOW) + +IF(EXISTS "${ROOT_DIR}/.svn/") + FIND_PACKAGE(Subversion) + + IF(SUBVERSION_FOUND) + Subversion_WC_INFO(${ROOT_DIR} ER) + SET(REVISION ${ER_WC_REVISION}) + ENDIF(SUBVERSION_FOUND) +ENDIF(EXISTS "${ROOT_DIR}/.svn/") + +IF(EXISTS "${ROOT_DIR}/.hg/") + FIND_PACKAGE(Mercurial) + + IF(MERCURIAL_FOUND) + Mercurial_WC_INFO(${ROOT_DIR} ER) + SET(REVISION ${ER_WC_REVISION}) + ENDIF(MERCURIAL_FOUND) +ENDIF(EXISTS "${ROOT_DIR}/.hg/") + +IF(REVISION) + IF(EXISTS ${SOURCE_DIR}/revision.h.in) + NOW(BUILD_DATE) + CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt) + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different + ENDIF(EXISTS ${SOURCE_DIR}/revision.h.in) +ENDIF(REVISION) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index bb34aebfe..ae5b30ee2 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -8,44 +8,40 @@ # ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use # ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp -IF(CMAKE_COMPILER_IS_GNUCXX) - - EXEC_PROGRAM( - ${CMAKE_CXX_COMPILER} - ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion - OUTPUT_VARIABLE gcc_compiler_version) +IF(MSVC) + SET(PCHSupport_FOUND TRUE) + SET(_PCH_include_prefix "/I") +ELSE(MSVC) + IF(CMAKE_COMPILER_IS_GNUCXX) + EXEC_PROGRAM(${CMAKE_CXX_COMPILER} + ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE gcc_compiler_version) - IF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") - SET(PCHSupport_FOUND TRUE) - ELSE(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") - IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") + IF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") SET(PCHSupport_FOUND TRUE) - ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") - ENDIF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") + ELSE(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") + IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") + SET(PCHSupport_FOUND TRUE) + ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") + ENDIF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") + ELSE(CMAKE_COMPILER_IS_GNUCXX) + # TODO: make tests for other compilers than GCC + SET(PCHSupport_FOUND TRUE) + ENDIF(CMAKE_COMPILER_IS_GNUCXX) SET(_PCH_include_prefix "-I") - -ELSE(CMAKE_COMPILER_IS_GNUCXX) - - IF(WIN32) - SET(PCHSupport_FOUND TRUE) # for experimental msvc support - SET(_PCH_include_prefix "/I") - ELSE(WIN32) - SET(PCHSupport_FOUND FALSE) - ENDIF(WIN32) - -ENDIF(CMAKE_COMPILER_IS_GNUCXX) +ENDIF(MSVC) MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) SET(${_out_compile_flags} ${${_flags_var_name}} ) - IF(CMAKE_COMPILER_IS_GNUCXX) + IF(NOT MSVC) GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) LIST(APPEND ${_out_compile_flags} "-fPIC") ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) - ENDIF(CMAKE_COMPILER_IS_GNUCXX) + ENDIF(NOT MSVC) GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) FOREACH(item ${DIRINC}) @@ -100,17 +96,13 @@ MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _inputcpp _output) SET(pchsupport_compiler_cxx_arg1 "") ENDIF(CMAKE_CXX_COMPILER_ARG1) - IF(CMAKE_COMPILER_IS_GNUCXX) - SET(${out_command} - ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x c++-header -o ${_output} -c ${_input} - ) - ELSE(CMAKE_COMPILER_IS_GNUCXX) + IF(MSVC) _PCH_GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target}) - SET(${out_command} - ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp\"${_output}\" ${_inputcpp} /c /Fd\"${PDB_FILE}\" - ) - ENDIF(CMAKE_COMPILER_IS_GNUCXX) -ENDMACRO(_PCH_GET_COMPILE_COMMAND ) + SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp\"${_output}\" ${_inputcpp} /c /Fd\"${PDB_FILE}\") + ELSE(MSVC) + SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x c++-header -o ${_output} -c ${_input}) + ENDIF(MSVC) +ENDMACRO(_PCH_GET_COMPILE_COMMAND) MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output) IF(MSVC) @@ -128,7 +120,9 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use ) SET(oldProps "") ENDIF(${oldProps} MATCHES NOTFOUND) - IF(CMAKE_COMPILER_IS_GNUCXX) + IF(MSVC) + SET(_target_cflags "${oldProps} /Yu\"${_input}\" /FI\"${_input}\" /Fp\"${_pch_output_to_use}\"") + ELSE(MSVC) # to do: test whether compiler flags match between target _targetName # and _pch_output_to_use FILE(TO_NATIVE_PATH ${_pch_output_to_use} _native_pch_path) @@ -137,11 +131,7 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use ) # on all remote machines set # PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS}-include ${_input} -Winvalid-pch") - ELSE(CMAKE_COMPILER_IS_GNUCXX) - IF(MSVC) - SET(_target_cflags "${oldProps} /Yu\"${_input}\" /FI\"${_input}\" /Fp\"${_pch_output_to_use}\"") - ENDIF(MSVC) - ENDIF(CMAKE_COMPILER_IS_GNUCXX) + ENDIF(MSVC) SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags}) IF(oldProps) @@ -184,8 +174,31 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_inputh} ${_output}) ENDMACRO(ADD_PRECOMPILED_HEADER) +# Macro to move PCH creation file to the front of files list +MACRO(FIX_PRECOMPILED_HEADER _files _pch) + # Remove .cpp creating PCH from the list + LIST(REMOVE_ITEM ${_files} ${_pch}) + # Prepend .cpp creating PCH to the list + LIST(INSERT ${_files} 0 ${_pch}) +ENDMACRO(FIX_PRECOMPILED_HEADER) + MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) - IF(CMAKE_GENERATOR MATCHES Visual*) + SET(PCH_METHOD 0) + + # 0 => creating a new target for PCH, works for all makefiles + # 1 => setting PCH for VC++ project, works for VC++ projects + # 2 => setting PCH for XCode project, works for XCode projects + IF(CMAKE_GENERATOR MATCHES "Visual Studio") + SET(PCH_METHOD 1) + ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles" AND MFC_FOUND AND CMAKE_MFC_FLAG) + # To fix a bug with MFC + # Don't forget to use FIX_PRECOMPILED_HEADER before creating the target +# SET(PCH_METHOD 1) + ELSEIF(CMAKE_GENERATOR MATCHES "Xcode") + SET(PCH_METHOD 2) + ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio") + + IF(PCH_METHOD EQUAL 1) # Auto include the precompile (useful for moc processing, since the use of # precompiled is specified at the target level # and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt) @@ -200,26 +213,24 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) #also inlude ${oldProps} to have the same compile options SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"") - ELSE(CMAKE_GENERATOR MATCHES Visual*) - IF(CMAKE_GENERATOR MATCHES Xcode) - # For Xcode, cmake needs my patch to process - # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties - - GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) - IF(${oldProps} MATCHES NOTFOUND) - SET(oldProps "") - ENDIF(${oldProps} MATCHES NOTFOUND) - - # When buiding out of the tree, precompiled may not be located - # Use full path instead. - GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE) - - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}") - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") - ELSE(CMAKE_GENERATOR MATCHES Xcode) - #Fallback to the "old" precompiled suppport - ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) - ENDIF(CMAKE_GENERATOR MATCHES Xcode) - ENDIF(CMAKE_GENERATOR MATCHES Visual*) + ELSEIF(PCH_METHOD EQUAL 2) + # For Xcode, cmake needs my patch to process + # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties + + GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) + IF(${oldProps} MATCHES NOTFOUND) + SET(oldProps "") + ENDIF(${oldProps} MATCHES NOTFOUND) + + # When buiding out of the tree, precompiled may not be located + # Use full path instead. + GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE) + + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}") + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") + ELSE(PCH_METHOD EQUAL 1) + #Fallback to the "old" precompiled suppport + ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) + ENDIF(PCH_METHOD EQUAL 1) ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index a360f19ae..24f5de7dc 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -9,6 +9,33 @@ MACRO(NL_GEN_PC name) ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) ENDMACRO(NL_GEN_PC) +### +# Helper macro that generates revision.h from revision.h.in +### +MACRO(NL_GEN_REVISION_H) + IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in) + INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) + ADD_DEFINITIONS(-DHAVE_REVISION_H) + SET(HAVE_REVISION_H ON) + + # a custom target that is always built + ADD_CUSTOM_TARGET(revision ALL + DEPENDS ${CMAKE_BINARY_DIR}/revision.h) + + # creates revision.h using cmake script + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/revision.h + COMMAND ${CMAKE_COMMAND} + -DSOURCE_DIR=${CMAKE_SOURCE_DIR} + -DROOT_DIR=${CMAKE_SOURCE_DIR}/.. + -P ${CMAKE_SOURCE_DIR}/CMakeModules/GetRevision.cmake) + + # revision.h is a generated file + SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/revision.h + PROPERTIES GENERATED TRUE + HEADER_FILE_ONLY TRUE) + ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in) +ENDMACRO(NL_GEN_REVISION_H) + ### # ### @@ -614,13 +641,19 @@ MACRO(SETUP_EXTERNAL) ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") ENDIF(MSVC10) ELSE(WIN32) - IF(CMAKE_FIND_LIBRARY_SUFFIXES AND NOT APPLE) + IF(APPLE) IF(WITH_STATIC_EXTERNAL) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib .so) ELSE(WITH_STATIC_EXTERNAL) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so") + SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a) ENDIF(WITH_STATIC_EXTERNAL) - ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES AND NOT APPLE) + ELSE(APPLE) + IF(WITH_STATIC_EXTERNAL) + SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .so) + ELSE(WITH_STATIC_EXTERNAL) + SET(CMAKE_FIND_LIBRARY_SUFFIXES .so .a) + ENDIF(WITH_STATIC_EXTERNAL) + ENDIF(APPLE) ENDIF(WIN32) IF(WITH_STLPORT) diff --git a/code/revision.h.in b/code/revision.h.in new file mode 100644 index 000000000..6c5e9b8b1 --- /dev/null +++ b/code/revision.h.in @@ -0,0 +1,7 @@ +#ifndef REVISION_H +#define REVISION_H + +#cmakedefine REVISION "${REVISION}" +#cmakedefine BUILD_DATE "${BUILD_DATE}" + +#endif diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index 54a3d9b45..e0ed33abe 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -1347,6 +1347,7 @@ void CClientConfig::setValues() if (stricmp(mode, "over") == 0) p.Mode = SSysInfoParam::Over; else if (stricmp(mode, "overonly") == 0) p.Mode = SSysInfoParam::OverOnly; else if (stricmp(mode, "center") == 0) p.Mode = SSysInfoParam::Center; + else if (stricmp(mode, "centeraround") == 0) p.Mode = SSysInfoParam::CenterAround; else if (stricmp(mode, "around") == 0) p.Mode = SSysInfoParam::Around; ClientCfg.SystemInfoParams[toLower(sic->asString(2 * k))] = p; diff --git a/code/ryzom/client/src/client_cfg.h b/code/ryzom/client/src/client_cfg.h index 86e70c1b8..3925aaf2d 100644 --- a/code/ryzom/client/src/client_cfg.h +++ b/code/ryzom/client/src/client_cfg.h @@ -635,12 +635,15 @@ struct CClientConfig // Mode is the display settings : // Normal : just display in the system info window // Over : must be displayed at bottom of the screen and in system info window + // OverOnly : must be displayed at bottom of the screen // Center ; must be displayed at the center of the screen and in system info window + // Around ; must be displayed in the around chat window + // CenterAround ; must be displayed at the center of the screen and in around chat window struct SSysInfoParam { CRGBA Color; std::string SysInfoFxName; - enum TMode { Normal, Over, OverOnly, Center, Around }; + enum TMode { Normal, Over, OverOnly, Center, Around, CenterAround }; TMode Mode; SSysInfoParam() { diff --git a/code/ryzom/client/src/interface_v3/action_handler_help.cpp b/code/ryzom/client/src/interface_v3/action_handler_help.cpp index ddcb324d7..3774764b4 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -244,6 +244,7 @@ CInterfaceGroup *CInterfaceHelp::activateNextWindow(CDBCtrlSheet *elt, sint forc i++; } + bool showSlotAndCreator = false; // If an active window get the same object, abort, but make it top. for(i=0;i<_ActiveWindows.size();i++) { @@ -261,6 +262,8 @@ CInterfaceGroup *CInterfaceHelp::activateNextWindow(CDBCtrlSheet *elt, sint forc // for items, must also test if they have the same itemSlotId, cause relies also on "ItemInfo system" if(elt->getType() == CCtrlSheetInfo::SheetType_Item) { + showSlotAndCreator = true; + CDBCtrlSheet *realCtrlDst= _InfoWindows[_ActiveWindows[i]].CtrlSheet; if(!realCtrlDst) ok= false; @@ -344,6 +347,13 @@ CInterfaceGroup *CInterfaceHelp::activateNextWindow(CDBCtrlSheet *elt, sint forc CInterfaceGroup *group= _InfoWindows[newIndexWindow].Window; nlassert(group); + CInterfaceElement *ctrl = group->getElement(group->getId()+":content:ctrl_slot"); + if (ctrl) ctrl->setActive(showSlotAndCreator); + ctrl = group->getElement(group->getId()+":content:creator"); + if (ctrl) ctrl->setActive(showSlotAndCreator); + ctrl = group->getElement(group->getId()+":content:creator_header"); + if (ctrl) ctrl->setActive(showSlotAndCreator); + // activate it, set top, copy item watched group->setActive(true); pIM->setTopWindow(group); @@ -1217,6 +1227,7 @@ static void setupSkillToTradeHelp(CSheetHelpSetup &setup) if(setup.DestSheet) { setup.SrcSheet->copyAspect(setup.DestSheet); + setup.DestSheet->setActive(true); } ucstring skillText; @@ -2278,6 +2289,7 @@ static void setupItemHelp(CSheetHelpSetup &setup) if(setup.DestSheet) { setup.SrcSheet->copyAspect(setup.DestSheet); + setup.DestSheet->setActive(true); } // NB: for raw materials only, must do each once only, must not do it at refresh, cause combo reseted @@ -2566,6 +2578,7 @@ static void setupPactHelp(CSheetHelpSetup &setup) if(setup.DestSheet) { setup.SrcSheet->copyAspect(setup.DestSheet); + setup.DestSheet->setActive(true); } @@ -2603,6 +2616,7 @@ static void setupMissionHelp(CSheetHelpSetup &setup) if(setup.DestSheet) { setup.SrcSheet->copyAspect(setup.DestSheet); + setup.DestSheet->setActive(true); } // get detail text id from db @@ -2840,6 +2854,7 @@ void setupOutpostBuildingHelp(CSheetHelpSetup &setup) if(setup.DestSheet) { setup.SrcSheet->copyAspect(setup.DestSheet); + setup.DestSheet->setActive(true); } const COutpostBuildingSheet *pOBS = setup.SrcSheet->asOutpostBuildingSheet(); @@ -3164,6 +3179,7 @@ void setupSabrinaPhraseHelp(CSheetHelpSetup &setup, const CSPhraseCom &phrase, u if(setup.DestSheet) { setup.SrcSheet->copyAspect(setup.DestSheet); + setup.DestSheet->setActive(true); } // **** setup the phrase Text info @@ -3233,6 +3249,7 @@ static void setupSabrinaBrickHelp(CSheetHelpSetup &setup, bool auraDisabled) if(setup.DestSheet) { setup.SrcSheet->copyAspect(setup.DestSheet); + setup.DestSheet->setActive(true); } diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index 8d0066816..209e85ab2 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -370,8 +370,14 @@ void CGuildManager::update() { for (uint j = 0; j < CachedGuildMembers.size(); ++j) { - if ((CachedGuildMembers[j].Name == _GuildMembers[i].Name) && - (CachedGuildMembers[j].Online != _GuildMembers[i].Online)) + // Status change is from offline to online/abroad online or vice versa. + TCharConnectionState prevState = CachedGuildMembers[j].Online; + TCharConnectionState curState = _GuildMembers[i].Online; + bool showMsg = (prevState != curState) && + (CachedGuildMembers[j].Name == _GuildMembers[i].Name) && + (prevState == ccs_offline || curState == ccs_offline); + + if (showMsg) { ucstring msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; strFindReplace(msg, "%s", _GuildMembers[i].Name); diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 8e0851cf6..cfae646d2 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -4404,12 +4404,14 @@ void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat } } + if (mode == CClientConfig::SSysInfoParam::Center || mode == CClientConfig::SSysInfoParam::CenterAround) + InSceneBubbleManager.addMessagePopupCenter(str, color); + // If over popup a string at the bottom of the screen if ((mode == CClientConfig::SSysInfoParam::Over) || (mode == CClientConfig::SSysInfoParam::OverOnly)) InSceneBubbleManager.addMessagePopup(str, color); - else if (mode == CClientConfig::SSysInfoParam::Center) - InSceneBubbleManager.addMessagePopupCenter(str, color); - else if (mode == CClientConfig::SSysInfoParam::Around && PeopleInterraction.AroundMe.Window) + else if ( (mode == CClientConfig::SSysInfoParam::Around || mode == CClientConfig::SSysInfoParam::CenterAround) + && PeopleInterraction.AroundMe.Window) PeopleInterraction.ChatInput.AroundMe.displayMessage(str, color, 2); } diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index a6f5f8e31..ba67661bf 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -1420,11 +1420,9 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS sint index = FriendList.getIndexFromContactId(contactId); if (index != -1) { + // Only do work if online status has changed if (FriendList.getOnline(index) != online) { - // Only do work if online status has changed - FriendList.setOnline(index, online); - CCDBNodeLeaf* node = CInterfaceManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_ONLINE_OFFLINE_NOTIFICATIONS_CB", false); if (node && node->getValueBool()) { @@ -1441,8 +1439,11 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS } } - // Player is not in my guild - if (bOnlyFriend) + TCharConnectionState prevState = FriendList.getOnline(index); + bool showMsg = bOnlyFriend && (prevState == ccs_offline || online == ccs_offline); + + // Player is not in my guild, and the status change is from offline to online/abroad online or vice versa. + if (showMsg) { ucstring msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline"); strFindReplace(msg, "%s", FriendList.getName(index)); @@ -1458,6 +1459,8 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS PeopleInterraction.ChatInput.AroundMe.displayMessage(msg, col, 2, &dummy); } } + + FriendList.setOnline(index, online); } } } diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index dd79da45e..5dfead832 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -1605,29 +1605,38 @@ const ucchar *CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CShee // *************************************************************************** const ucchar *CStringManagerClient::getTitleLocalizedName(const std::string &titleId, bool women) { - const ucchar * infos = getSpecialWord(titleId, women); - ucstring infosUC(infos); + vector listInfos = getTitleInfos(titleId, women); - vector listInfos; - splitUCString(infosUC, ucstring("#"), listInfos); - if (listInfos.empty()) - return infos; - - _TitleWords.push_back(listInfos[0]); - return _TitleWords.back().c_str(); + if (listInfos.size() > 0) + { + _TitleWords.push_back(listInfos[0]); + return _TitleWords.back().c_str(); + } + + ucstring ucId; + ucId.fromUtf8(titleId); + return ucId.c_str(); } +// *************************************************************************** vector CStringManagerClient::getTitleInfos(const std::string &titleId, bool women) { - const ucchar * infos = getSpecialWord(titleId, women); - ucstring infosUC(infos); - + ucstring infosUC; + infosUC.fromUtf8(titleId); vector listInfos; splitUCString(infosUC, ucstring("#"), listInfos); + + if (listInfos.size() > 0) + { + if (titleId[0] != '#') + { + listInfos[0] = getSpecialWord(listInfos[0].toUtf8(), women); + } + } + return listInfos; } - // *************************************************************************** const ucchar *CStringManagerClient::getClassificationTypeLocalizedName(EGSPD::CClassificationType::TClassificationType type) { diff --git a/code/ryzom/client/src/string_manager_client.h b/code/ryzom/client/src/string_manager_client.h index 13f8188bb..0f34e24ac 100644 --- a/code/ryzom/client/src/string_manager_client.h +++ b/code/ryzom/client/src/string_manager_client.h @@ -108,6 +108,7 @@ public: // Get the Localized Title name static const ucchar *getTitleLocalizedName(const std::string &titleId, bool women); static std::vector getTitleInfos(const std::string &titleId, bool women); + // Get the Localized name of a classification type static const ucchar *getClassificationTypeLocalizedName(EGSPD::CClassificationType::TClassificationType type); diff --git a/code/ryzom/common/src/game_share/CMakeLists.txt b/code/ryzom/common/src/game_share/CMakeLists.txt index 6342f468d..af19bcebe 100644 --- a/code/ryzom/common/src/game_share/CMakeLists.txt +++ b/code/ryzom/common/src/game_share/CMakeLists.txt @@ -1,7 +1,26 @@ FILE(GLOB SRC *.cpp time_weather_season/*.cpp) FILE(GLOB PRIV_H *.h time_weather_season/*.h) -SOURCE_GROUP(headers FILES ${PRIV_H}) +FILE(GLOB R2 + dms.h dms.cpp + scenario.h scenario.cpp + user_connection_mgr.h user_connection_mgr.cpp + object.h object.cpp + server_animation_module.h server_animation_module.cpp + server_admin_module.h server_admin_module.cpp + server_edition_module.h server_edition_module.cpp + string_mgr_module.h string_mgr_module.cpp + scenario_entry_points.h scenario_entry_points.cpp + small_string_manager.h small_string_manager.cpp + ai_wrapper.h ai_wrapper.cpp + r2_*.h r2_*.cpp + ring_*.h ring_*.cpp) + +LIST(REMOVE_ITEM SRC R2) +LIST(REMOVE_ITEM PRIV_H R2) + +SOURCE_GROUP("" FILES ${SRC} ${PRIV_H}) +SOURCE_GROUP("R2" FILES ${R2}) # Filter out the source files not actually compiled. LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/enum_template.cpp) diff --git a/code/ryzom/server/data_shard/client_commands_privileges.txt b/code/ryzom/server/data_shard/client_commands_privileges.txt index c61537dfa..9b0e115d4 100644 --- a/code/ryzom/server/data_shard/client_commands_privileges.txt +++ b/code/ryzom/server/data_shard/client_commands_privileges.txt @@ -40,6 +40,9 @@ forceTargetToDie :DEV:SGM:GM:EM: // Force entity target to die getEventFaction :DEV:SGM:GM:EM: // Get the event faction of player: giveRespawnPoint :DEV:SGM:GM: // Give a respawn point to a player: guildInvite // Send a guild invite to a player character without distance constrainte +setLeague // Create a League +leagueInvite // Send a League invite to a Team Leader character without distance constrainte +leagueKick // Kick a player or team from league roomInvite // Send a room invite roomKick // Remove a room invite guildMOTD // Set the guild message of the day, command effective only for officer and more graded guild members @@ -72,8 +75,6 @@ renameGuild :DEV:SGM:GM:EM: // Rename a guild: renamePlayerForEvent :DEV:SGM:GM:EM:EG: // Rename a player temporarily for an event: resetPowerFlags :DEV:SGM:GM:EM: // Reset the ineffective aura and the power flags for given character -respawnAfterDeath // Respawn after death at re-spawn point name, it must be valid (validated by PC and usable): -resurrected // Another PC resurrect PC by giving some energy: root :DEV:SGM:GM:EM:VG:SG: // Root a player: