diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 38d11a252..c708b9dda 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -28,10 +28,6 @@ IF(COMMAND cmake_policy) # have absolute paths (e.g. -lpthread) cmake_policy(SET CMP0003 NEW) - # Works around warnings about escaped quotes in ADD_DEFINITIONS - # statements - cmake_policy(SET CMP0005 OLD) - # allow to link to qtmain automatically under Windows IF(POLICY CMP0020) CMAKE_POLICY(SET CMP0020 NEW) @@ -451,6 +447,8 @@ IF(WITH_NEL) SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY}) ENDIF() ENDIF() + ELSEIF(WIN32) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} Crypt32.lib) ENDIF() ENDIF() ENDIF() diff --git a/code/CMakeModules/AndroidToolChain.cmake b/code/CMakeModules/AndroidToolChain.cmake index 7135400e2..4ca702295 100644 --- a/code/CMakeModules/AndroidToolChain.cmake +++ b/code/CMakeModules/AndroidToolChain.cmake @@ -28,14 +28,14 @@ IF(TARGET_CPU STREQUAL "armv7") SET(TOOLCHAIN_ARCH "arm") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi") SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi") - SET(MINIMUM_NDK_TARGET 4) + SET(MINIMUM_NDK_TARGET 9) ELSEIF(TARGET_CPU STREQUAL "armv5") SET(LIBRARY_ARCHITECTURE "armeabi") SET(CMAKE_SYSTEM_PROCESSOR "armv5") SET(TOOLCHAIN_ARCH "arm") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi") SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi") - SET(MINIMUM_NDK_TARGET 4) + SET(MINIMUM_NDK_TARGET 9) ELSEIF(TARGET_CPU STREQUAL "arm64") SET(LIBRARY_ARCHITECTURE "arm64-v8a") SET(CMAKE_SYSTEM_PROCESSOR "arm64") @@ -76,14 +76,9 @@ ELSE() ENDIF() SET(CLANG_TOOLCHAIN_PREFIX "llvm") -SET(ANDROID_COMPILER "GCC") - -IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang") - SET(ANDROID_COMPILER "clang") - SET(CLANG ON) -ELSE() - SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION}) -ENDIF() +SET(ANDROID_COMPILER "clang") +SET(ANDROID_COMPILER "clang") +SET(CLANG ON) IF(NOT NDK_TARGET) SET(NDK_TARGET ${MINIMUM_NDK_TARGET}) @@ -94,88 +89,71 @@ ELSE() ENDIF() IF(CMAKE_HOST_WIN32) - SET(TOOLCHAIN_HOST "windows") + SET(TOOLCHAIN_HOST "windows-x86_64") SET(TOOLCHAIN_BIN_SUFFIX ".exe") ELSEIF(CMAKE_HOST_APPLE) SET(TOOLCHAIN_HOST "apple") SET(TOOLCHAIN_BIN_SUFFIX "") ELSEIF(CMAKE_HOST_UNIX) - SET(TOOLCHAIN_HOST "linux") + SET(TOOLCHAIN_HOST "linux-x86_64") SET(TOOLCHAIN_BIN_SUFFIX "") ENDIF() -MACRO(SEARCH_TOOLCHAIN _COMPILER) - SET(${_COMPILER}_TOOLCHAIN_VERSIONS) - FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-*") - IF(_TOOLCHAIN_VERSIONS) - LIST(SORT _TOOLCHAIN_VERSIONS) - LIST(REVERSE _TOOLCHAIN_VERSIONS) - FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS}) - STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}") - IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$") - LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION}) - ENDIF() - ENDFOREACH() - ENDIF() +# clang +SET(CLANG_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${CLANG_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}") - # try prefixes without version - SET(_TOOLCHAIN_WITHOUT_VERSION "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}") - IF(EXISTS ${_TOOLCHAIN_WITHOUT_VERSION}) - LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS "default") - ENDIF() +IF(EXISTS ${CLANG_TOOLCHAIN_ROOT}) + MESSAGE(STATUS "Found LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}") +ELSE() + MESSAGE(FATAL_ERROR "No LLVM toolchain found in default search path ${CLANG_TOOLCHAIN_ROOT}") +ENDIF() - IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS) - MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains") - ENDIF() - - IF(${_COMPILER}_TOOLCHAIN_VERSIONS) - LIST(FIND ${_COMPILER}_TOOLCHAIN_VERSIONS "${${_COMPILER}_TOOLCHAIN_VERSION}" _INDEX) - IF(_INDEX EQUAL -1) - LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION) +# gcc +SET(GCC_TOOLCHAIN_VERSIONS) +FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-*") +IF(_TOOLCHAIN_VERSIONS) + LIST(SORT _TOOLCHAIN_VERSIONS) + LIST(REVERSE _TOOLCHAIN_VERSIONS) + FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS}) + STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}") + IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$") + LIST(APPEND GCC_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION}) ENDIF() - ELSE() - LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION) - ENDIF() - - MESSAGE(STATUS "TOOLCHAIN_PREFIX = ${${_COMPILER}_TOOLCHAIN_VERSION}") - - IF("${${_COMPILER}_TOOLCHAIN_VERSION}" STREQUAL "default") - MESSAGE(STATUS "default") - SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}") - ELSE() - MESSAGE(STATUS "not default") - SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}") - ENDIF() - - IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}") - FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*") - IF(_TOOLCHAIN_PREFIXES) - LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT) - ENDIF() - ENDIF() -ENDMACRO() - -IF(CLANG) - SEARCH_TOOLCHAIN(CLANG) - - MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use clang ${CLANG_TOOLCHAIN_VERSION}") + ENDFOREACH() ENDIF() -SEARCH_TOOLCHAIN(GCC) - -MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}") - -IF(CLANG_TOOLCHAIN_ROOT) - MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}") +IF(NOT GCC_TOOLCHAIN_VERSIONS) + MESSAGE(FATAL_ERROR "No GCC version found in default search path ${NDK_ROOT}/toolchains") ENDIF() -IF(GCC_TOOLCHAIN_ROOT) - MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}") +IF(GCC_TOOLCHAIN_VERSIONS) + LIST(FIND GCC_TOOLCHAIN_VERSIONS "${GCC_TOOLCHAIN_VERSION}" _INDEX) + IF(_INDEX EQUAL -1) + LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION) + ENDIF() +ELSE() + LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION) ENDIF() +SET(GCC_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-${GCC_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}") + +IF(NOT EXISTS "${GCC_TOOLCHAIN_ROOT}") + FILE(GLOB _TOOLCHAIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}*") + IF(_TOOLCHAIN_PREFIXES) + LIST(GET _TOOLCHAIN_PREFIXES 0 GCC_TOOLCHAIN_ROOT) + ENDIF() +ENDIF() + +IF(EXISTS "${GCC_TOOLCHAIN_ROOT}") + MESSAGE(STATUS "Found GCC toolchain in ${GCC_TOOLCHAIN_ROOT}") +ELSE() + MESSAGE(FATAL_ERROR "No GCC toolchain found in default search path ${GCC_TOOLCHAIN_ROOT}") +ENDIF() + +# NDK SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}") -MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}") +MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} found in ${PLATFORM_ROOT}") # include dirs SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include") @@ -208,41 +186,29 @@ MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY) SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE) ENDMACRO() -# Force the compilers to GCC for Android -include (CMakeForceCompiler) +SET(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -IF(CLANG) - MESSAGE(STATUS "Using clang compiler") +SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang) +SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++) - SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang) - SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++) +SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER}) +SET(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX}) +SET(CMAKE_C_COMPILER_FORCED TRUE) - CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang) - CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang) +SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}) +SET(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX}) +SET(CMAKE_CXX_COMPILER_FORCED TRUE) - SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as) - SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar) - SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++) - - IF(NOT EXISTS "${CMAKE_ASM_COMPILER}") - SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as) - ENDIF() - - IF(NOT EXISTS "${CMAKE_AR}") - SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar) - ENDIF() -ELSE() - MESSAGE(STATUS "Using GCC compiler") - - SET_TOOLCHAIN_BINARY_GCC(CMAKE_C_COMPILER gcc) - SET_TOOLCHAIN_BINARY_GCC(CMAKE_CXX_COMPILER g++) - - CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU) - CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU) +SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as) +SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar) +SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++) +IF(NOT EXISTS "${CMAKE_ASM_COMPILER}") SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as) +ENDIF() + +IF(NOT EXISTS "${CMAKE_AR}") SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar) - SET_TOOLCHAIN_BINARY_GCC(CMAKE_LINKER ld) ENDIF() SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip) diff --git a/code/CMakeModules/FindMSVC.cmake b/code/CMakeModules/FindMSVC.cmake index dceb6f054..706541463 100644 --- a/code/CMakeModules/FindMSVC.cmake +++ b/code/CMakeModules/FindMSVC.cmake @@ -5,6 +5,24 @@ # VC_LIBRARY_DIR - where to find libraries # VC_FOUND - True if MSVC found. +MACRO(ADD_TRAILING_SLASH _FILENAME_VAR) + # put content in a new variable + SET(_FILENAME ${${_FILENAME_VAR}}) + # get length of the string + STRING(LENGTH ${_FILENAME} _LEN) + # convert length to last pos + MATH(EXPR _POS "${_LEN}-1") + # get last character of the string + STRING(SUBSTRING ${_FILENAME} ${_POS} 1 _FILENAME_END) + # compare it with a slash + IF(NOT _FILENAME_END STREQUAL "/") + # not a slash, append it + SET(${_FILENAME_VAR} "${_FILENAME}/") + ELSE() + # already a slash + ENDIF() +ENDMACRO() + MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) # Software/Wow6432Node/... GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE) @@ -12,7 +30,11 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry") SET(VC${_VERSION}_DIR) GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE) + IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") + # be sure it's finishing by a / + ADD_TRAILING_SLASH(VC${_VERSION}_DIR) + SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/") ENDIF() ENDIF() @@ -55,7 +77,34 @@ MACRO(DETECT_EXPRESS_VERSION _VERSION) ENDIF() ENDMACRO() -IF(MSVC14) +IF(MSVC1411 OR MSVC1410) + DETECT_VC_VERSION("15.0") + SET(MSVC_TOOLSET "140") + + SET(VC_DIR "${VC_DIR}Tools/MSVC") + + FILE(GLOB MSVC_TOOLCHAIN_VERSIONS RELATIVE ${VC_DIR} "${VC_DIR}/*") + + IF(MSVC_TOOLCHAIN_VERSIONS) + LIST(SORT MSVC_TOOLCHAIN_VERSIONS) + LIST(REVERSE MSVC_TOOLCHAIN_VERSIONS) + ENDIF() + + IF(NOT MSVC_TOOLCHAIN_VERSIONS) + MESSAGE(FATAL_ERROR "No MSVC version found in default search path ${VC_DIR}") + ENDIF() + + LIST(GET MSVC_TOOLCHAIN_VERSIONS 0 MSVC_TOOLCHAIN_VERSION) + + SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}") + SET(VC_INCLUDE_DIR "${VC_DIR}/include") + + IF(NOT MSVC14_REDIST_DIR) + # If you have VC++ 2017 Express, put x64/Microsoft.VC141.CRT/*.dll in ${EXTERNAL_PATH}/redist + # original files whould be in ${VC_DIR}/Redist/MSVC/14.11.25325/x64/Microsoft.VC141.CRT + SET(MSVC14_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF() +ELSEIF(MSVC14) DETECT_VC_VERSION("14.0") SET(MSVC_TOOLSET "140") @@ -109,6 +158,11 @@ IF(NOT VC_DIR) STRING(REGEX REPLACE "/(bin|BIN|Bin)/.+" "" VC_DIR ${_COMPILER}) ENDIF() -SET(VC_INCLUDE_DIR "${VC_DIR}/include") +IF(NOT VC_INCLUDE_DIR) + SET(VC_INCLUDE_DIR "${VC_DIR}/include") +ENDIF() + +MESSAGE(STATUS "Using headers from ${VC_INCLUDE_DIR}") + SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR}) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index d7918816f..0e2735570 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -35,7 +35,7 @@ MACRO(DETECT_WINKIT_VERSION _VERSION _SUFFIX) SET(WINSDK${_VERSION}_FOUND ON) SET(WINSDK${_VERSION}_VERSION_FULL "${_VERSION}") IF(NOT WindowsSDK_FIND_QUIETLY) - MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}") + MESSAGE(STATUS "Found Windows Kit ${_VERSION} in ${WINSDK${_VERSION}_DIR}") ENDIF() LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION}) ELSE() @@ -240,7 +240,11 @@ MACRO(USE_CURRENT_WINSDK) IF(NOT WINSDK_DIR) # Use Windows SDK versions installed with VC++ when possible - IF(MSVC14) + IF(MSVC1411 OR MSVC1410) + # Special case, use Kits for SDK + SET(WINSDK_VERSION "10.0") + SET(WINSDK_DIR ${WINSDK_UCRT_DIR}) + ELSEIF(MSVC14) SET(WINSDK_VERSION "8.1") ELSEIF(MSVC12) SET(WINSDK_VERSION "8.1") @@ -305,7 +309,7 @@ MACRO(USE_CURRENT_WINSDK) ENDMACRO() IF(MSVC14) - # Under VC++ 2015, stdio.h, stdlib.h, etc... are part of UCRT + # Under VC++ 2015 and 2017, stdio.h, stdlib.h, etc... are part of UCRT SET(WINSDK_UCRT_VERSION "10.0") ENDIF() @@ -314,6 +318,40 @@ IF(WINSDK_UCRT_VERSION AND WINSDK${WINSDK_UCRT_VERSION}_FOUND) SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}") ENDIF() +IF(WINSDK_UCRT_DIR) + # determine exact UCRT version + SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include) + SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib) + + FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*) + SET(UCRT_VERSION) + + FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS}) + IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION) + SET(UCRT_VERSION ${UCRT_SUBDIR}) + ENDIF() + ENDFOREACH() + + IF(UCRT_VERSION) + MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}") + + SET(WINSDK10_INCLUDE_DIR ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION}) + SET(WINSDK10_LIBRARY_DIR ${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION}) + + # directory where UCRT headers are found + FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h + HINTS + ${WINSDK10_INCLUDE_DIR}/ucrt + ) + + # directory where UCRT libraries are found + FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib + HINTS + ${WINSDK10_LIBRARY_DIR}/ucrt/${WINSDK8_SUFFIX} + ) + ENDIF() +ENDIF() + IF(WINSDK_VERSION STREQUAL "CURRENT") USE_CURRENT_WINSDK() ELSE() @@ -334,93 +372,87 @@ ENDIF() # directory where Win32 headers are found FIND_PATH(WINSDK_INCLUDE_DIR Windows.h HINTS + ${WINSDK_DIR}/Include/${UCRT_VERSION}/um ${WINSDK_DIR}/Include/um ${WINSDK_DIR}/Include + NO_DEFAULT_PATH ) +MESSAGE(STATUS "Found Windows.h in ${WINSDK_INCLUDE_DIR}") + # directory where WinRT headers are found FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h HINTS + ${WINSDK_DIR}/Include/${UCRT_VERSION}/winrt ${WINSDK_DIR}/Include/winrt + NO_DEFAULT_PATH ) +MESSAGE(STATUS "Found winstring.h in ${WINSDK_WINRT_INCLUDE_DIR}") + # directory where DirectX headers are found FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h HINTS + ${WINSDK_DIR}/Include/${UCRT_VERSION}/shared ${WINSDK_DIR}/Include/shared + NO_DEFAULT_PATH ) +MESSAGE(STATUS "Found d3d9.h in ${WINSDK_SHARED_INCLUDE_DIR}") + # directory where OpenGL headers are found FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h HINTS + ${WINSDK_INCLUDE_DIR}/gl ${WINSDK_DIR}/Include/um/gl ${WINSDK_DIR}/Include/gl + NO_DEFAULT_PATH ) +MESSAGE(STATUS "Found GL.h in ${WINSDK_OPENGL_INCLUDE_DIR}") + SET(WINSDK_LIBRARY_DIRS + ${WINSDK_DIR}/Lib/${UCRT_VERSION}/um/${WINSDK8_SUFFIX} ${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX} ${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX} ) IF(WINSDK_SUFFIXES) FOREACH(_SUFFIX ${WINSDK_SUFFIXES}) - SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib/${_SUFFIX}) + LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib/${_SUFFIX}) ENDFOREACH() ELSE() - SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib) + LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib) ENDIF() # directory where all libraries are found FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib HINTS ${WINSDK_LIBRARY_DIRS} + NO_DEFAULT_PATH ) -IF(WINSDK_UCRT_DIR) - # determine exact UCRT version - SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include) - SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib) +MESSAGE(STATUS "Found ComCtl32.lib in ${WINSDK_LIBRARY_DIR}") - FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*) - SET(UCRT_VERSION) - - FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS}) - IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION) - SET(UCRT_VERSION ${UCRT_SUBDIR}) - ENDIF() - ENDFOREACH() - - IF(UCRT_VERSION) - MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}") - - # directory where UCRT headers are found - FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h - HINTS - ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION}/ucrt - ) - - # directory where UCRT libraries are found - FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib - HINTS - ${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION}/ucrt/${WINSDK8_SUFFIX} - ) - ENDIF() -ENDIF() +SET(WINSDK_BINARY_DIRS + ${WINSDK_DIR}/Bin/${UCRT_VERSION}/${WINSDK8_SUFFIX} + ${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX} + ${WINSDK_DIR}/Bin/x86 + ${WINSDK_DIR}/Bin +) # signtool is used to sign executables FIND_PROGRAM(WINSDK_SIGNTOOL signtool HINTS - ${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX} - ${WINSDK_DIR}/Bin/x86 - ${WINSDK_DIR}/Bin + ${WINSDK_BINARY_DIRS} + NO_DEFAULT_PATH ) # midl is used to generate IDL interfaces FIND_PROGRAM(WINSDK_MIDL midl HINTS - ${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX} - ${WINSDK_DIR}/Bin/x86 - ${WINSDK_DIR}/Bin + ${WINSDK_BINARY_DIRS} + NO_DEFAULT_PATH ) IF(WINSDK_INCLUDE_DIR) @@ -444,7 +476,7 @@ IF(WINSDK_INCLUDE_DIR) SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_WINRT_INCLUDE_DIR}) ENDIF() - INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) # TODO: Move this after all other includes somehow... + INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) IF(WINSDK_UCRT_LIBRARY_DIR) SET(CMAKE_LIBRARY_PATH ${WINSDK_UCRT_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 36d031f10..c396bd6cf 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -114,12 +114,16 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS) IF(oldProps) - LIST(APPEND _FLAGS ${oldProps}) + SET(_FLAG ${oldProps}) + SEPARATE_ARGUMENTS(_FLAG) + LIST(APPEND _FLAGS ${_FLAG}) ENDIF() GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD}) IF(oldPropsBuild) - LIST(APPEND _FLAGS ${oldPropsBuild}) + SET(_FLAG ${oldPropsBuild}) + SEPARATE_ARGUMENTS(_FLAG) + LIST(APPEND _FLAGS ${_FLAG}) ENDIF() GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES) @@ -205,6 +209,10 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) ENDIF() ENDIF() + IF(USE_CPP0X AND gcc_compiler_version GREATER "6.2.0") + LIST(APPEND _FLAGS "-std=gnu++11") + ENDIF() + # Format definitions IF(MSVC) # Fix path with space @@ -316,7 +324,7 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS) SET(_FLAGS "") IF(APPLE) SET(HEADER_FORMAT "objective-${HEADER_FORMAT}") - SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch) + SET(_FLAGS ${OBJC_FLAGS}) ENDIF() SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT}) ENDIF() @@ -402,7 +410,8 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) ENDIF() IF(APPLE) - SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}") + STRING(REPLACE ";" " " OBJC_FLAGS_STR "${OBJC_FLAGS}") + SET(PCH_ADDITIONAL_COMPILER_FLAGS "${OBJC_FLAGS_STR} -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}") ENDIF() IF(WITH_PCH_DEBUG) diff --git a/code/CMakeModules/iOSToolChain.cmake b/code/CMakeModules/iOSToolChain.cmake index 610045e33..7bcb57227 100644 --- a/code/CMakeModules/iOSToolChain.cmake +++ b/code/CMakeModules/iOSToolChain.cmake @@ -35,23 +35,6 @@ SET(UNIX ON) SET(APPLE ON) SET(IOS ON) -# Force the compilers to Clang for iOS -include (CMakeForceCompiler) -CMAKE_FORCE_C_COMPILER (clang Clang) -CMAKE_FORCE_CXX_COMPILER (clang++ Clang) - -IF(CMAKE_CXX_COMPILER) - EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version - OUTPUT_VARIABLE CLANG_VERSION_RAW - OUTPUT_STRIP_TRAILING_WHITESPACE) - - STRING(REGEX REPLACE "Apple LLVM version ([\\.0-9]+).*" - "\\1" CMAKE_CXX_COMPILER_VERSION "${CLANG_VERSION_RAW}") - - SET(CMAKE_C_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) - SET(CMAKE_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) -ENDIF() - # Setup iOS platform IF(NOT DEFINED IOS_PLATFORM) SET(IOS_PLATFORM "OS") @@ -162,14 +145,14 @@ IF(CMAKE_GENERATOR MATCHES Xcode) ENDIF() ELSE() IF(${IOS_PLATFORM} STREQUAL "OS") - SET(ARCHS "armv7;arm64") + SET(ARCHS armv7 arm64) SET(CMAKE_SYSTEM_PROCESSOR "armv7") ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") # iPhone simulator targets i386 SET(ARCHS "i386") SET(CMAKE_SYSTEM_PROCESSOR "x86") ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") - SET(ARCHS "armv7;arm64;i386;x86_64") + SET(ARCHS armv7 arm64 i386 x86_64) SET(CMAKE_SYSTEM_PROCESSOR "armv7") ENDIF() ENDIF() @@ -198,5 +181,13 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +# Force the compilers to Clang for iOS +SET(CMAKE_C_COMPILER clang) +SET(CMAKE_CXX_COMPILER clang++) + +# Skip the platform compiler checks for cross compiling. +SET(CMAKE_CXX_COMPILER_FORCED TRUE) +SET(CMAKE_C_COMPILER_FORCED TRUE) + # determinate location for bin utils based on CMAKE_FIND_ROOT_PATH -include(CMakeFindBinUtils) +INCLUDE(CMakeFindBinUtils) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index ed0847015..95b28bb8a 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -565,11 +565,18 @@ MACRO(NL_SETUP_BUILD) ADD_PLATFORM_FLAGS("/X") IF(MSVC14) - ADD_PLATFORM_FLAGS("/Gy- /MP") - # /Ox is working with VC++ 2015, but custom optimizations don't exist + ADD_PLATFORM_FLAGS("/Gy-") + # /Ox is working with VC++ 2015 and 2017, but custom optimizations don't exist SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") + + # Special cases for VC++ 2017 + IF(MSVC_VERSION EQUAL "1911") + SET(MSVC1411 ON) + ELSEIF(MSVC_VERSION EQUAL "1910") + SET(MSVC1410 ON) + ENDIF() ELSEIF(MSVC12) ADD_PLATFORM_FLAGS("/Gy-") # /Ox is working with VC++ 2013, but custom optimizations don't exist @@ -657,6 +664,8 @@ MACRO(NL_SETUP_BUILD) ENDIF() IF(APPLE) + SET(OBJC_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch -fobjc-weak) + IF(NOT XCODE) IF(CMAKE_OSX_ARCHITECTURES) SET(TARGETS_COUNT 0) @@ -1160,6 +1169,7 @@ MACRO(SETUP_EXTERNAL) IF(APPLE) IF(WITH_STATIC_EXTERNAL) + # Look only for static libraries because systems libraries are using Frameworks SET(CMAKE_FIND_LIBRARY_SUFFIXES .a) ELSE() SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a) @@ -1173,12 +1183,13 @@ MACRO(SETUP_EXTERNAL) ENDIF() ENDIF() - # Android and iOS have pthread - IF(ANDROID OR IOS) + # Android, iOS and Mac OS X have pthread, but no need to link to libpthread + IF(ANDROID OR APPLE) SET(CMAKE_USE_PTHREADS_INIT 1) SET(Threads_FOUND TRUE) ELSE() - FIND_PACKAGE(Threads REQUIRED) + SET(THREADS_HAVE_PTHREAD_ARG ON) + FIND_PACKAGE(Threads) # TODO: replace all -l by absolute path to in CMAKE_THREAD_LIBS_INIT ENDIF() diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 5bd0e2cbf..be7a74722 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -32,6 +32,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index c497230aa..a4d9dbaeb 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -480,12 +480,21 @@ public: virtual ~CStateRecord() {} // use STL allocator for fast alloc. this works because objects are small ( < 128 bytes) void *operator new(size_t size) { return CStateRecord::Allocator.allocate(size); } + void *operator new(size_t size, int /* blockUse */, char const * /* fileName */, int /* lineNumber */) + { + // TODO: add memory leaks detector + return CStateRecord::Allocator.allocate(size); + } void operator delete(void *block) { CStateRecord::Allocator.deallocate((uint8 *) block, 1); } + void operator delete(void *block, int /* blockUse */, char const* /* fileName */, int /* lineNumber */) + { + // TODO: add memory leaks detector + CStateRecord::Allocator.deallocate((uint8 *)block, 1); + } static std::allocator Allocator; }; - // record of a single .fx pass class CFXPassRecord { diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_index.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_index.cpp index dfdc48670..d7ee84303 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_index.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_index.cpp @@ -25,6 +25,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_inputs.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_inputs.cpp index f754b6357..d26741faf 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_inputs.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_inputs.cpp @@ -17,6 +17,10 @@ #include "stddirect3d.h" #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_light.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_light.cpp index d3bb62e64..f68caab3a 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_light.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_light.cpp @@ -26,6 +26,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp index cc54d6305..e6622f61d 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp @@ -27,6 +27,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_matrix.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_matrix.cpp index c5b479de0..6e7520fb7 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_matrix.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_matrix.cpp @@ -26,6 +26,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp index e0a2cd4a4..7d79eb1a7 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp @@ -29,6 +29,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_profile.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_profile.cpp index 4ff29481c..b574fff54 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_profile.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_profile.cpp @@ -19,6 +19,10 @@ #include "driver_direct3d.h" #include "nel/misc/hierarchical_timer.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_render.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_render.cpp index 939dc1dc9..6b9d2ce0c 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_render.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_render.cpp @@ -27,6 +27,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp index 6f48cc2a4..3f11f8bce 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp @@ -20,6 +20,10 @@ #include "nel/misc/path.h" #include "nel/misc/file.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index d9ba5a526..a10732c64 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -26,6 +26,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_uniform.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_uniform.cpp index e44780e89..a936d5b46 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_uniform.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_uniform.cpp @@ -18,6 +18,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp index 2b7fa8fa9..ba726fcc9 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp @@ -26,6 +26,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp index 69ae49c4f..265468125 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp @@ -18,6 +18,10 @@ #include "driver_direct3d.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/georges/form.cpp b/code/nel/src/georges/form.cpp index 22ed15a2e..f5cbcc3a1 100644 --- a/code/nel/src/georges/form.cpp +++ b/code/nel/src/georges/form.cpp @@ -24,6 +24,10 @@ #include "nel/georges/form.h" #include "nel/georges/form_loader.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; namespace NLGEORGES diff --git a/code/nel/src/georges/form_dfn.cpp b/code/nel/src/georges/form_dfn.cpp index 3f271b976..629c17f86 100644 --- a/code/nel/src/georges/form_dfn.cpp +++ b/code/nel/src/georges/form_dfn.cpp @@ -24,6 +24,10 @@ #include "nel/georges/form_loader.h" #include "nel/georges/form_elm.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace std; diff --git a/code/nel/src/georges/form_elm.cpp b/code/nel/src/georges/form_elm.cpp index a28fe2e9c..48368cc38 100644 --- a/code/nel/src/georges/form_elm.cpp +++ b/code/nel/src/georges/form_elm.cpp @@ -25,6 +25,10 @@ #include "nel/georges/form_loader.h" #include "nel/georges/type.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace std; diff --git a/code/nel/src/georges/form_loader.cpp b/code/nel/src/georges/form_loader.cpp index b56ed23ef..877c587ed 100644 --- a/code/nel/src/georges/form_loader.cpp +++ b/code/nel/src/georges/form_loader.cpp @@ -27,6 +27,10 @@ #include "nel/georges/form.h" #include "nel/georges/form_dfn.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace std; diff --git a/code/nel/src/georges/header.cpp b/code/nel/src/georges/header.cpp index f814d5802..40617e6d5 100644 --- a/code/nel/src/georges/header.cpp +++ b/code/nel/src/georges/header.cpp @@ -22,6 +22,10 @@ #include "nel/georges/header.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; namespace NLGEORGES diff --git a/code/nel/src/georges/stdgeorges.h b/code/nel/src/georges/stdgeorges.h index a11169d27..fa0bf0819 100644 --- a/code/nel/src/georges/stdgeorges.h +++ b/code/nel/src/georges/stdgeorges.h @@ -14,6 +14,16 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#ifndef STDGEORGES_H +#define STDGEORGES_H + +#if defined(_MSC_VER) && defined(_DEBUG) +#define _CRTDBG_MAP_ALLOC +#include +#include +#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif + #include "nel/misc/types_nl.h" #include #include @@ -27,3 +37,5 @@ // Include from libxml2 #include + +#endif diff --git a/code/nel/src/georges/type.cpp b/code/nel/src/georges/type.cpp index cc3c44d6e..0dd2b9457 100644 --- a/code/nel/src/georges/type.cpp +++ b/code/nel/src/georges/type.cpp @@ -27,6 +27,10 @@ #include "nel/georges/form_loader.h" #include "nel/georges/type.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace std; diff --git a/code/nel/src/sound/driver/dsound/buffer_dsound.cpp b/code/nel/src/sound/driver/dsound/buffer_dsound.cpp index 53fa8dcec..72423bba7 100644 --- a/code/nel/src/sound/driver/dsound/buffer_dsound.cpp +++ b/code/nel/src/sound/driver/dsound/buffer_dsound.cpp @@ -23,6 +23,10 @@ #include #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace std; diff --git a/code/nel/src/sound/driver/dsound/listener_dsound.cpp b/code/nel/src/sound/driver/dsound/listener_dsound.cpp index 3bed4f821..d8c81b58b 100644 --- a/code/nel/src/sound/driver/dsound/listener_dsound.cpp +++ b/code/nel/src/sound/driver/dsound/listener_dsound.cpp @@ -18,6 +18,9 @@ #include "listener_dsound.h" #include "sound_driver_dsound.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/nel/src/sound/driver/dsound/sound_driver_dsound.cpp b/code/nel/src/sound/driver/dsound/sound_driver_dsound.cpp index 986993c49..d95b80ca0 100644 --- a/code/nel/src/sound/driver/dsound/sound_driver_dsound.cpp +++ b/code/nel/src/sound/driver/dsound/sound_driver_dsound.cpp @@ -31,6 +31,9 @@ #include "sound_driver_dsound.h" #include "listener_dsound.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/driver/dsound/source_dsound.cpp b/code/nel/src/sound/driver/dsound/source_dsound.cpp index c3bff3289..b80d03590 100644 --- a/code/nel/src/sound/driver/dsound/source_dsound.cpp +++ b/code/nel/src/sound/driver/dsound/source_dsound.cpp @@ -21,6 +21,9 @@ #include "buffer_dsound.h" #include "listener_dsound.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; using namespace std; diff --git a/code/nel/src/sound/driver/dsound/stddsound.h b/code/nel/src/sound/driver/dsound/stddsound.h index f550e8150..cb953e630 100644 --- a/code/nel/src/sound/driver/dsound/stddsound.h +++ b/code/nel/src/sound/driver/dsound/stddsound.h @@ -14,6 +14,16 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#ifndef STDDSOUND_H +#define STDDSOUND_H + +#if defined(_MSC_VER) && defined(_DEBUG) +#define _CRTDBG_MAP_ALLOC +#include +#include +#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif + #include "nel/misc/types_nl.h" #define EAX_AVAILABLE 0 @@ -44,4 +54,5 @@ #include "nel/sound/driver/source.h" #include "nel/sound/driver/listener.h" +#endif /* end of file */ diff --git a/code/nel/src/sound/driver/fmod/buffer_fmod.cpp b/code/nel/src/sound/driver/fmod/buffer_fmod.cpp index 69081b013..edba0bec2 100644 --- a/code/nel/src/sound/driver/fmod/buffer_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/buffer_fmod.cpp @@ -25,6 +25,10 @@ # include #endif +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace std; diff --git a/code/nel/src/sound/driver/fmod/listener_fmod.cpp b/code/nel/src/sound/driver/fmod/listener_fmod.cpp index ad308c937..776a23d70 100644 --- a/code/nel/src/sound/driver/fmod/listener_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/listener_fmod.cpp @@ -18,6 +18,9 @@ #include "listener_fmod.h" #include "sound_driver_fmod.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/nel/src/sound/driver/fmod/music_channel_fmod.cpp b/code/nel/src/sound/driver/fmod/music_channel_fmod.cpp index 3640869b6..9abfd1006 100644 --- a/code/nel/src/sound/driver/fmod/music_channel_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/music_channel_fmod.cpp @@ -18,6 +18,10 @@ #include "music_channel_fmod.h" #include "sound_driver_fmod.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp b/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp index 07455b963..d98aa600f 100644 --- a/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp @@ -26,6 +26,10 @@ #include #endif +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/driver/fmod/source_fmod.cpp b/code/nel/src/sound/driver/fmod/source_fmod.cpp index 6026ce2f5..1224d647d 100644 --- a/code/nel/src/sound/driver/fmod/source_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/source_fmod.cpp @@ -21,6 +21,9 @@ #include "buffer_fmod.h" #include "listener_fmod.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; using namespace std; diff --git a/code/nel/src/sound/driver/fmod/stdfmod.h b/code/nel/src/sound/driver/fmod/stdfmod.h index afb1af3f1..4274adfe3 100644 --- a/code/nel/src/sound/driver/fmod/stdfmod.h +++ b/code/nel/src/sound/driver/fmod/stdfmod.h @@ -14,6 +14,16 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#ifndef STDFMOD_H +#define STDFMOD_H + +#if defined(_MSC_VER) && defined(_DEBUG) +#define _CRTDBG_MAP_ALLOC +#include +#include +#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif + #include #ifdef NL_OS_WINDOWS @@ -42,4 +52,6 @@ #include "nel/sound/driver/source.h" #include "nel/sound/driver/listener.h" +#endif + /* end of file */ diff --git a/code/nel/src/sound/driver/openal/buffer_al.cpp b/code/nel/src/sound/driver/openal/buffer_al.cpp index 352128c3e..ae0054096 100644 --- a/code/nel/src/sound/driver/openal/buffer_al.cpp +++ b/code/nel/src/sound/driver/openal/buffer_al.cpp @@ -18,6 +18,10 @@ #include "sound_driver_al.h" #include "buffer_al.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; namespace NLSOUND diff --git a/code/nel/src/sound/driver/openal/effect_al.cpp b/code/nel/src/sound/driver/openal/effect_al.cpp index 0eec97756..9a09ba7ac 100644 --- a/code/nel/src/sound/driver/openal/effect_al.cpp +++ b/code/nel/src/sound/driver/openal/effect_al.cpp @@ -19,6 +19,10 @@ #include "effect_al.h" #include "sound_driver_al.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; // using namespace NLMISC; diff --git a/code/nel/src/sound/driver/openal/listener_al.cpp b/code/nel/src/sound/driver/openal/listener_al.cpp index a79e551b6..f39f0f18f 100644 --- a/code/nel/src/sound/driver/openal/listener_al.cpp +++ b/code/nel/src/sound/driver/openal/listener_al.cpp @@ -18,6 +18,10 @@ #include "listener_al.h" #include "sound_driver_al.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; namespace NLSOUND { diff --git a/code/nel/src/sound/driver/openal/sound_driver_al.cpp b/code/nel/src/sound/driver/openal/sound_driver_al.cpp index ab9574483..d237f533a 100644 --- a/code/nel/src/sound/driver/openal/sound_driver_al.cpp +++ b/code/nel/src/sound/driver/openal/sound_driver_al.cpp @@ -22,6 +22,10 @@ #include "ext_al.h" #include "effect_al.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/driver/openal/source_al.cpp b/code/nel/src/sound/driver/openal/source_al.cpp index c13db52af..825d9f1e9 100644 --- a/code/nel/src/sound/driver/openal/source_al.cpp +++ b/code/nel/src/sound/driver/openal/source_al.cpp @@ -22,6 +22,10 @@ #include "source_al.h" #include "ext_al.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + // #define NLSOUND_DEBUG_GAIN using namespace std; diff --git a/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.cpp index 2db913268..e70fec076 100644 --- a/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.cpp @@ -20,6 +20,10 @@ #include "buffer_xaudio2.h" #include "adpcm_xaudio2.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; // using namespace NLMISC; diff --git a/code/nel/src/sound/driver/xaudio2/buffer_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/buffer_xaudio2.cpp index 106d565f9..acdb95ab4 100644 --- a/code/nel/src/sound/driver/xaudio2/buffer_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/buffer_xaudio2.cpp @@ -20,6 +20,10 @@ #include "buffer_xaudio2.h" #include "sound_driver_xaudio2.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/driver/xaudio2/effect_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/effect_xaudio2.cpp index 5c1f58722..ac3814226 100644 --- a/code/nel/src/sound/driver/xaudio2/effect_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/effect_xaudio2.cpp @@ -21,6 +21,10 @@ #include "listener_xaudio2.h" #include "effect_xaudio2.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/driver/xaudio2/listener_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/listener_xaudio2.cpp index 10b7e7e48..c6b364046 100644 --- a/code/nel/src/sound/driver/xaudio2/listener_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/listener_xaudio2.cpp @@ -20,6 +20,10 @@ #include "sound_driver_xaudio2.h" #include "listener_xaudio2.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp index 529954006..992f6c66d 100644 --- a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp @@ -22,6 +22,10 @@ #include "effect_xaudio2.h" #include "sound_driver_xaudio2.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp index 021935e50..26566612c 100644 --- a/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp @@ -26,6 +26,10 @@ #include "effect_xaudio2.h" #include "source_xaudio2.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 6ecdb9de4..6fc66e9e7 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -135,7 +135,6 @@ IF(WITH_RYZOM_CLIENT) ENDIF() ENDIF() - IF(WITH_RYZOM_STEAM AND STEAM_RUNTIME) ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -p ${STEAM_RUNTIME} ${RYZOM_CONTENTS_DIR}/MacOS) @@ -178,7 +177,6 @@ IF(WITH_RYZOM_CLIENT) ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${CURL_LIBRARIES} - ${OPENSSL_LIBRARIES} ) IF(NOT APPLE AND NOT WIN32) diff --git a/code/ryzom/client/src/actions.cpp b/code/ryzom/client/src/actions.cpp index 6b9a3649b..7aeaee537 100644 --- a/code/ryzom/client/src/actions.cpp +++ b/code/ryzom/client/src/actions.cpp @@ -22,6 +22,10 @@ #include "events_listener.h" #include "interface_v3/interface_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace std; using namespace NLMISC; diff --git a/code/ryzom/client/src/actions_client.cpp b/code/ryzom/client/src/actions_client.cpp index a538afd50..0f9eabad1 100644 --- a/code/ryzom/client/src/actions_client.cpp +++ b/code/ryzom/client/src/actions_client.cpp @@ -28,6 +28,9 @@ #include "actions_client.h" #include "interface_v3/input_handler_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // USING // diff --git a/code/ryzom/client/src/animation.cpp b/code/ryzom/client/src/animation.cpp index 323405528..5968f6c55 100644 --- a/code/ryzom/client/src/animation.cpp +++ b/code/ryzom/client/src/animation.cpp @@ -35,6 +35,9 @@ #include "client_cfg.h" #include "entity_animation_manager.h" // \todo GUIGUI : added to recompile animations at loading (to do better ?). +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // USING // diff --git a/code/ryzom/client/src/animation_fx.cpp b/code/ryzom/client/src/animation_fx.cpp index 7be1a79a9..8f716d64e 100644 --- a/code/ryzom/client/src/animation_fx.cpp +++ b/code/ryzom/client/src/animation_fx.cpp @@ -27,6 +27,10 @@ #include "nel/3d/u_scene.h" #include "client_sheets/animation_fx_set_sheet.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + extern NL3D::UScene *Scene; diff --git a/code/ryzom/client/src/animation_fx_id_array.cpp b/code/ryzom/client/src/animation_fx_id_array.cpp index 828ba2a7b..b3c07bbd7 100644 --- a/code/ryzom/client/src/animation_fx_id_array.cpp +++ b/code/ryzom/client/src/animation_fx_id_array.cpp @@ -23,6 +23,10 @@ // #include "nel/3d/u_scene.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + extern NL3D::UScene *Scene; // ********************************************************************* diff --git a/code/ryzom/client/src/animation_fx_misc.cpp b/code/ryzom/client/src/animation_fx_misc.cpp index 9bfb3ffcd..45ee764ba 100644 --- a/code/ryzom/client/src/animation_fx_misc.cpp +++ b/code/ryzom/client/src/animation_fx_misc.cpp @@ -20,4 +20,8 @@ #include "animation_fx_misc.h" #include "animation_fx_id_array.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + CAnimationFXIDArray AnimFXMisc; diff --git a/code/ryzom/client/src/animation_misc.cpp b/code/ryzom/client/src/animation_misc.cpp index d9bf60816..60b13c83c 100644 --- a/code/ryzom/client/src/animation_misc.cpp +++ b/code/ryzom/client/src/animation_misc.cpp @@ -27,6 +27,9 @@ // 3d #include "nel/3d/u_track.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // USING // diff --git a/code/ryzom/client/src/animation_set.cpp b/code/ryzom/client/src/animation_set.cpp index 52bead6a1..5e93bc25b 100644 --- a/code/ryzom/client/src/animation_set.cpp +++ b/code/ryzom/client/src/animation_set.cpp @@ -33,6 +33,10 @@ #include "nel/georges/u_form_elm.h" #include "nel/georges/u_form_loader.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + /////////// // USING // /////////// diff --git a/code/ryzom/client/src/animation_state.cpp b/code/ryzom/client/src/animation_state.cpp index 8254d68b4..82aa27a54 100644 --- a/code/ryzom/client/src/animation_state.cpp +++ b/code/ryzom/client/src/animation_state.cpp @@ -30,6 +30,10 @@ // Georges #include "nel/georges/u_form_elm.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + /////////// // USING // /////////// diff --git a/code/ryzom/client/src/app_bundle_utils.cpp b/code/ryzom/client/src/app_bundle_utils.cpp index 42d1b61bc..4c4753c4f 100644 --- a/code/ryzom/client/src/app_bundle_utils.cpp +++ b/code/ryzom/client/src/app_bundle_utils.cpp @@ -21,6 +21,10 @@ #include #endif +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + std::string getAppBundlePath() { static std::string s_cachedPathToBundle; diff --git a/code/ryzom/client/src/attached_fx.cpp b/code/ryzom/client/src/attached_fx.cpp index 0f520f689..7a7b0cd4a 100644 --- a/code/ryzom/client/src/attached_fx.cpp +++ b/code/ryzom/client/src/attached_fx.cpp @@ -27,6 +27,10 @@ #include "time_client.h" #include "fx_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + extern NL3D::UScene *Scene; diff --git a/code/ryzom/client/src/attack_list.cpp b/code/ryzom/client/src/attack_list.cpp index 494ba2e53..c748e5832 100644 --- a/code/ryzom/client/src/attack_list.cpp +++ b/code/ryzom/client/src/attack_list.cpp @@ -29,6 +29,9 @@ // #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif H_AUTO_DECL(RZ_AttackList) diff --git a/code/ryzom/client/src/auto_anim.cpp b/code/ryzom/client/src/auto_anim.cpp index 5cc21305a..9676742bb 100644 --- a/code/ryzom/client/src/auto_anim.cpp +++ b/code/ryzom/client/src/auto_anim.cpp @@ -33,6 +33,9 @@ #include #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif /////////// // USING // diff --git a/code/ryzom/client/src/behaviour_context.cpp b/code/ryzom/client/src/behaviour_context.cpp index a8df81d9f..e8fb2d6ea 100644 --- a/code/ryzom/client/src/behaviour_context.cpp +++ b/code/ryzom/client/src/behaviour_context.cpp @@ -19,6 +19,10 @@ #include "stdpch.h" #include "behaviour_context.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + CBehaviourContext::CBehaviourContext() { } diff --git a/code/ryzom/client/src/bg_downloader_access.cpp b/code/ryzom/client/src/bg_downloader_access.cpp index 1a479849e..426a4176b 100644 --- a/code/ryzom/client/src/bg_downloader_access.cpp +++ b/code/ryzom/client/src/bg_downloader_access.cpp @@ -31,6 +31,10 @@ #include "nel/misc/win_thread.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace BGDownloader; using namespace NLMISC; diff --git a/code/ryzom/client/src/browse_faq.cpp b/code/ryzom/client/src/browse_faq.cpp index ec0d7906d..f56ed0baf 100644 --- a/code/ryzom/client/src/browse_faq.cpp +++ b/code/ryzom/client/src/browse_faq.cpp @@ -17,6 +17,10 @@ #include "stdpch.h" #include "browse_faq.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; void browseFAQ(NLMISC::CConfigFile &cf) diff --git a/code/ryzom/client/src/camera.cpp b/code/ryzom/client/src/camera.cpp index 5f388fb28..904a2db49 100644 --- a/code/ryzom/client/src/camera.cpp +++ b/code/ryzom/client/src/camera.cpp @@ -22,6 +22,10 @@ #include "global.h" #include "misc.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace NL3D; diff --git a/code/ryzom/client/src/character_cl.cpp b/code/ryzom/client/src/character_cl.cpp index e73592acd..a473b4b80 100644 --- a/code/ryzom/client/src/character_cl.cpp +++ b/code/ryzom/client/src/character_cl.cpp @@ -111,6 +111,9 @@ #include "game_share/range_weapon_type.h" // +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif //////////// // DEFINE // @@ -137,10 +140,6 @@ using namespace std; using namespace MBEHAV; using namespace CLFECOMMON; -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif - //////////// // EXTERN // //////////// diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index 8ba5f769f..7c33edb90 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -107,6 +107,9 @@ // to desactive some commands // +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif //////////////// diff --git a/code/ryzom/client/src/continent.cpp b/code/ryzom/client/src/continent.cpp index c1e1177ad..a30604282 100644 --- a/code/ryzom/client/src/continent.cpp +++ b/code/ryzom/client/src/continent.cpp @@ -935,7 +935,6 @@ void CContinent::unselect() // Remove the instances (shapes). EntitiesMngr.removeInstances(); - // release collision primitives if (IGCallbacks) { diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index fcead3e5e..2fd5bad81 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -26,6 +26,10 @@ using namespace NLMISC; using namespace NLNET; using namespace std; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + #define _Curl (CURL *)_CurlStruct @@ -113,6 +117,25 @@ static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm if (itmp && itmp->x509) { + X509_NAME *subject = X509_get_subject_name(itmp->x509); + + std::string name; + unsigned char *tmp = NULL; + + // construct a multiline string with name + for (int i = 0, ilen = X509_NAME_entry_count(subject); i < ilen; ++i) + { + X509_NAME_ENTRY *e = X509_NAME_get_entry(subject, i); + ASN1_STRING *d = X509_NAME_ENTRY_get_data(e); + + if (ASN1_STRING_to_UTF8(&tmp, d) > 0) + { + name += NLMISC::toString("%s\n", tmp); + + OPENSSL_free(tmp); + } + } + // add our certificate to this store if (X509_STORE_add_cert(store, itmp->x509) == 0) { @@ -122,13 +145,13 @@ static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm if (ERR_GET_LIB(errCode) != ERR_LIB_X509 || ERR_GET_REASON(errCode) != X509_R_CERT_ALREADY_IN_HASH_TABLE) { ERR_error_string_n(errCode, errorBuffer, 1024); - nlwarning("Error adding certificate %s: %s", itmp->x509->name, errorBuffer); + nlwarning("Error adding certificate %s: %s", name.c_str(), errorBuffer); res = CURLE_SSL_CACERT; } } else { - nlinfo("Added certificate %s", itmp->x509->name); + nlinfo("Added certificate %s", name.c_str()); } } } diff --git a/code/ryzom/client/src/r2/auto_group.cpp b/code/ryzom/client/src/r2/auto_group.cpp index eeefbd7de..7372d6e48 100644 --- a/code/ryzom/client/src/r2/auto_group.cpp +++ b/code/ryzom/client/src/r2/auto_group.cpp @@ -21,6 +21,10 @@ // #include "nel/misc/i18n.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/config_var.cpp b/code/ryzom/client/src/r2/config_var.cpp index bb9655ba9..4706acfb8 100644 --- a/code/ryzom/client/src/r2/config_var.cpp +++ b/code/ryzom/client/src/r2/config_var.cpp @@ -17,6 +17,9 @@ #include "stdpch.h" #include "config_var.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace R2 diff --git a/code/ryzom/client/src/r2/displayer_base.cpp b/code/ryzom/client/src/r2/displayer_base.cpp index a3ae09621..1864d0e95 100644 --- a/code/ryzom/client/src/r2/displayer_base.cpp +++ b/code/ryzom/client/src/r2/displayer_base.cpp @@ -23,6 +23,10 @@ #include "nel/gui/lua_ihm.h" #include "nel/gui/interface_element.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace R2 { diff --git a/code/ryzom/client/src/r2/displayer_lua.cpp b/code/ryzom/client/src/r2/displayer_lua.cpp index 100dadc8d..2f17efb1a 100644 --- a/code/ryzom/client/src/r2/displayer_lua.cpp +++ b/code/ryzom/client/src/r2/displayer_lua.cpp @@ -20,6 +20,10 @@ #include "../interface_v3/lua_ihm_ryzom.h" #include "editor.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace R2 { diff --git a/code/ryzom/client/src/r2/displayer_visual.cpp b/code/ryzom/client/src/r2/displayer_visual.cpp index aec4ea1fe..76c4270a3 100644 --- a/code/ryzom/client/src/r2/displayer_visual.cpp +++ b/code/ryzom/client/src/r2/displayer_visual.cpp @@ -33,6 +33,10 @@ // #include "r2_config.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; extern uint SkipFrame; diff --git a/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp b/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp index 1d24b266c..6fd17b470 100644 --- a/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp @@ -23,6 +23,9 @@ #include "../interface_v3/interface_manager.h" #include "nel/gui/view_renderer.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/displayer_visual_entity.cpp b/code/ryzom/client/src/r2/displayer_visual_entity.cpp index 238b4bf5c..d906d3d1e 100644 --- a/code/ryzom/client/src/r2/displayer_visual_entity.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_entity.cpp @@ -58,6 +58,10 @@ // #include "../sheet_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace NL3D; diff --git a/code/ryzom/client/src/r2/displayer_visual_group.cpp b/code/ryzom/client/src/r2/displayer_visual_group.cpp index 2f10f9512..3784879cc 100644 --- a/code/ryzom/client/src/r2/displayer_visual_group.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_group.cpp @@ -38,6 +38,10 @@ #include "../time_client.h" // +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + class CGroupMap; using namespace R2; diff --git a/code/ryzom/client/src/r2/displayer_visual_road.cpp b/code/ryzom/client/src/r2/displayer_visual_road.cpp index dc9f8d9f2..629ca4729 100644 --- a/code/ryzom/client/src/r2/displayer_visual_road.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_road.cpp @@ -22,6 +22,9 @@ #include "../global.h" // +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; using namespace NL3D; diff --git a/code/ryzom/client/src/r2/displayer_visual_shape.cpp b/code/ryzom/client/src/r2/displayer_visual_shape.cpp index d676f916a..9d7bba6ba 100644 --- a/code/ryzom/client/src/r2/displayer_visual_shape.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_shape.cpp @@ -33,6 +33,9 @@ #include "nel/3d/u_visual_collision_manager.h" #include "nel/3d/u_visual_collision_entity.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/dmc/action_historic.cpp b/code/ryzom/client/src/r2/dmc/action_historic.cpp index 4ad984778..e7a32cc62 100644 --- a/code/ryzom/client/src/r2/dmc/action_historic.cpp +++ b/code/ryzom/client/src/r2/dmc/action_historic.cpp @@ -21,6 +21,10 @@ #include "../editor.h" #include "nel/gui/lua_ihm.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace R2 { diff --git a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp index 649996256..a3da447dc 100644 --- a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -68,6 +68,9 @@ #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace std; diff --git a/code/ryzom/client/src/r2/dmc/com_lua_module.cpp b/code/ryzom/client/src/r2/dmc/com_lua_module.cpp index d3f5b1a65..930e06051 100644 --- a/code/ryzom/client/src/r2/dmc/com_lua_module.cpp +++ b/code/ryzom/client/src/r2/dmc/com_lua_module.cpp @@ -58,6 +58,9 @@ using namespace NLGUI; using namespace NLMISC; using namespace R2; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif std::map CComLuaModule::_Instance; diff --git a/code/ryzom/client/src/r2/dmc/dmc.cpp b/code/ryzom/client/src/r2/dmc/dmc.cpp index f04feccf4..e03078009 100644 --- a/code/ryzom/client/src/r2/dmc/dmc.cpp +++ b/code/ryzom/client/src/r2/dmc/dmc.cpp @@ -45,6 +45,9 @@ #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLNET; using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/dmc/palette.cpp b/code/ryzom/client/src/r2/dmc/palette.cpp index e0fb35b30..2ef0eb630 100644 --- a/code/ryzom/client/src/r2/dmc/palette.cpp +++ b/code/ryzom/client/src/r2/dmc/palette.cpp @@ -21,6 +21,10 @@ #include +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace R2; namespace R2 diff --git a/code/ryzom/client/src/r2/dmc/property_accessor.cpp b/code/ryzom/client/src/r2/dmc/property_accessor.cpp index a7037201a..3a8da702a 100644 --- a/code/ryzom/client/src/r2/dmc/property_accessor.cpp +++ b/code/ryzom/client/src/r2/dmc/property_accessor.cpp @@ -21,6 +21,11 @@ #include "game_share/object.h" #include + +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace R2; diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index a5b889961..dc81eeb38 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -47,7 +47,6 @@ #include "editor.h" // #include "nel/gui/lua_helper.h" -using namespace NLGUI; #include "nel/gui/group_tree.h" #include "../interface_v3/interface_manager.h" #include "../contextual_cursor.h" @@ -115,11 +114,14 @@ using namespace NLGUI; #include "../far_tp.h" #include "nel/gui/lua_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; using namespace NLNET; using namespace NL3D; - +using namespace NLGUI; extern CEventsListener EventsListener; extern CLog g_log; @@ -1628,8 +1630,17 @@ int CEditor::luaEnumInstances(CLuaState &ls) mt.setValue("__gc", CLuaObject(ls)); // void *newIter = ls.newUserData(sizeof(CInstanceEnumerator)); + +#ifdef new +#undef new +#endif + CInstanceEnumerator *ie = new (newIter) CInstanceEnumerator; +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + ie->InstMap = &getEditor()._InstancesByDispName[classIndex]; ie->Current = ie->InstMap->begin(); mt.push(); diff --git a/code/ryzom/client/src/r2/entity_custom_select_box.cpp b/code/ryzom/client/src/r2/entity_custom_select_box.cpp index bcd757dc7..c426ad30c 100644 --- a/code/ryzom/client/src/r2/entity_custom_select_box.cpp +++ b/code/ryzom/client/src/r2/entity_custom_select_box.cpp @@ -21,6 +21,10 @@ // #include "nel/misc/vector.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; namespace R2 diff --git a/code/ryzom/client/src/r2/entity_sorter.cpp b/code/ryzom/client/src/r2/entity_sorter.cpp index aee488ff6..201e65e03 100644 --- a/code/ryzom/client/src/r2/entity_sorter.cpp +++ b/code/ryzom/client/src/r2/entity_sorter.cpp @@ -20,6 +20,10 @@ #include "../user_entity.h" #include "../time_client.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; namespace R2 diff --git a/code/ryzom/client/src/r2/instance.cpp b/code/ryzom/client/src/r2/instance.cpp index 597e58d5d..f97719b0a 100644 --- a/code/ryzom/client/src/r2/instance.cpp +++ b/code/ryzom/client/src/r2/instance.cpp @@ -30,6 +30,9 @@ // #include "displayer_visual_entity.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/island_collision.cpp b/code/ryzom/client/src/r2/island_collision.cpp index fbc5a14ba..74829a17e 100644 --- a/code/ryzom/client/src/r2/island_collision.cpp +++ b/code/ryzom/client/src/r2/island_collision.cpp @@ -33,6 +33,10 @@ // #include "nel/3d/texture_file.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + extern CContinentManager ContinentMngr; using namespace NL3D; diff --git a/code/ryzom/client/src/r2/lua_event_forwarder.cpp b/code/ryzom/client/src/r2/lua_event_forwarder.cpp index cfacfaf07..27b1927b4 100644 --- a/code/ryzom/client/src/r2/lua_event_forwarder.cpp +++ b/code/ryzom/client/src/r2/lua_event_forwarder.cpp @@ -18,6 +18,9 @@ #include "lua_event_forwarder.h" #include "nel/gui/lua_object.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace R2 { diff --git a/code/ryzom/client/src/r2/mesh_array.cpp b/code/ryzom/client/src/r2/mesh_array.cpp index 844370d41..661f56937 100644 --- a/code/ryzom/client/src/r2/mesh_array.cpp +++ b/code/ryzom/client/src/r2/mesh_array.cpp @@ -21,6 +21,9 @@ #include "../global.h" #include "../misc.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; using namespace NL3D; diff --git a/code/ryzom/client/src/r2/npc_editor.cpp b/code/ryzom/client/src/r2/npc_editor.cpp index 5a154acee..a3c7e190d 100644 --- a/code/ryzom/client/src/r2/npc_editor.cpp +++ b/code/ryzom/client/src/r2/npc_editor.cpp @@ -27,6 +27,10 @@ #include "../sheet_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; using namespace NL3D; using namespace std; diff --git a/code/ryzom/client/src/r2/object_factory_client.cpp b/code/ryzom/client/src/r2/object_factory_client.cpp index 688ec3fcb..f91ed6681 100644 --- a/code/ryzom/client/src/r2/object_factory_client.cpp +++ b/code/ryzom/client/src/r2/object_factory_client.cpp @@ -21,6 +21,10 @@ #include "nel/gui/lua_ihm.h" #include "../interface_v3/lua_ihm_ryzom.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace R2 { @@ -319,7 +323,17 @@ void CObjectTableClient::pushOnLuaStack(CLuaState &state, CLuaObject &metatable) nlassert(metatable.isValid()); // return a new refptr on the sub table void *block = state.newUserData(sizeof(TRefPtrConst)); + +#ifdef new +#undef new +#endif + new (block) CObjectTable::TRefPtrConst(this); // create in place + +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + metatable.push(); state.setMetaTable(-2); _Ref.pop(state); diff --git a/code/ryzom/client/src/r2/palette_node.cpp b/code/ryzom/client/src/r2/palette_node.cpp index b24c5b6bd..d11eeaefa 100644 --- a/code/ryzom/client/src/r2/palette_node.cpp +++ b/code/ryzom/client/src/r2/palette_node.cpp @@ -18,6 +18,9 @@ #include "palette_node.h" #include "editor.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif namespace R2 diff --git a/code/ryzom/client/src/r2/prim_render.cpp b/code/ryzom/client/src/r2/prim_render.cpp index e714b979a..e8b1c23ac 100644 --- a/code/ryzom/client/src/r2/prim_render.cpp +++ b/code/ryzom/client/src/r2/prim_render.cpp @@ -29,6 +29,9 @@ #include "nel/gui/view_renderer.h" #include "../interface_v3/group_map.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NL3D; using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/r2_config.cpp b/code/ryzom/client/src/r2/r2_config.cpp index 76fc73b39..47f9d56dd 100644 --- a/code/ryzom/client/src/r2/r2_config.cpp +++ b/code/ryzom/client/src/r2/r2_config.cpp @@ -17,6 +17,9 @@ #include "stdpch.h" #include "r2_config.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/r2_lua.cpp b/code/ryzom/client/src/r2/r2_lua.cpp index efe510aa7..a29636bff 100644 --- a/code/ryzom/client/src/r2/r2_lua.cpp +++ b/code/ryzom/client/src/r2/r2_lua.cpp @@ -21,6 +21,10 @@ #include "stdpch.h" #include "r2_lua.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + // stupid function to remove VC6 warnings #ifdef NL_COMP_VC6 void foo_r2_lua_cpp() {} diff --git a/code/ryzom/client/src/r2/tool.cpp b/code/ryzom/client/src/r2/tool.cpp index bcbe7f5ac..2e663a5ec 100644 --- a/code/ryzom/client/src/r2/tool.cpp +++ b/code/ryzom/client/src/r2/tool.cpp @@ -42,6 +42,10 @@ // #include "nel/3d/packed_world.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + extern NLPACS::UGlobalRetriever *GR; diff --git a/code/ryzom/client/src/r2/tool_choose_pos.cpp b/code/ryzom/client/src/r2/tool_choose_pos.cpp index 64d0b9d7f..ae76fc3bf 100644 --- a/code/ryzom/client/src/r2/tool_choose_pos.cpp +++ b/code/ryzom/client/src/r2/tool_choose_pos.cpp @@ -35,6 +35,10 @@ #include "dmc/idmc.h" #include "r2_config.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLPACS; using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/tool_choose_pos_lua.cpp b/code/ryzom/client/src/r2/tool_choose_pos_lua.cpp index 85e1ba03e..5efaaae20 100644 --- a/code/ryzom/client/src/r2/tool_choose_pos_lua.cpp +++ b/code/ryzom/client/src/r2/tool_choose_pos_lua.cpp @@ -21,6 +21,10 @@ // #include "nel/misc/vectord.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLPACS; using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/tool_create_entity.cpp b/code/ryzom/client/src/r2/tool_create_entity.cpp index 7c6af14c5..b6be50bd7 100644 --- a/code/ryzom/client/src/r2/tool_create_entity.cpp +++ b/code/ryzom/client/src/r2/tool_create_entity.cpp @@ -41,6 +41,10 @@ #include "game_share/player_visual_properties.h" #include "game_share/visual_slot_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLPACS; using namespace NLMISC; using namespace std; diff --git a/code/ryzom/client/src/r2/tool_draw_prim.cpp b/code/ryzom/client/src/r2/tool_draw_prim.cpp index fa90ebcc7..da8c41f06 100644 --- a/code/ryzom/client/src/r2/tool_draw_prim.cpp +++ b/code/ryzom/client/src/r2/tool_draw_prim.cpp @@ -34,6 +34,9 @@ // tmp tmp #include "nel/gui/ctrl_quad.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/tool_maintained_action.cpp b/code/ryzom/client/src/r2/tool_maintained_action.cpp index ce68a0b86..ea0adaa93 100644 --- a/code/ryzom/client/src/r2/tool_maintained_action.cpp +++ b/code/ryzom/client/src/r2/tool_maintained_action.cpp @@ -20,6 +20,10 @@ #include "editor.h" #include "../interface_v3/interface_manager.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + namespace R2 { diff --git a/code/ryzom/client/src/r2/tool_new_vertex.cpp b/code/ryzom/client/src/r2/tool_new_vertex.cpp index e0d722822..6d2443e52 100644 --- a/code/ryzom/client/src/r2/tool_new_vertex.cpp +++ b/code/ryzom/client/src/r2/tool_new_vertex.cpp @@ -23,6 +23,10 @@ // #include "nel/misc/i18n.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; namespace R2 diff --git a/code/ryzom/client/src/r2/tool_pick.cpp b/code/ryzom/client/src/r2/tool_pick.cpp index 972da9a3c..bb80a6258 100644 --- a/code/ryzom/client/src/r2/tool_pick.cpp +++ b/code/ryzom/client/src/r2/tool_pick.cpp @@ -21,6 +21,9 @@ // #include "nel/gui/lua_ihm.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/tool_select_move.cpp b/code/ryzom/client/src/r2/tool_select_move.cpp index 261e8b49a..f9b9b9a1a 100644 --- a/code/ryzom/client/src/r2/tool_select_move.cpp +++ b/code/ryzom/client/src/r2/tool_select_move.cpp @@ -31,6 +31,9 @@ // #include "nel/misc/matrix.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/tool_select_rotate.cpp b/code/ryzom/client/src/r2/tool_select_rotate.cpp index b6f87e23c..56884a52b 100644 --- a/code/ryzom/client/src/r2/tool_select_rotate.cpp +++ b/code/ryzom/client/src/r2/tool_select_rotate.cpp @@ -28,6 +28,9 @@ #include "displayer_visual.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif using namespace NLMISC; diff --git a/code/ryzom/client/src/r2/verbose_clock.cpp b/code/ryzom/client/src/r2/verbose_clock.cpp index cd64cc2b3..23f14a735 100644 --- a/code/ryzom/client/src/r2/verbose_clock.cpp +++ b/code/ryzom/client/src/r2/verbose_clock.cpp @@ -20,6 +20,10 @@ // #include "verbose_clock.h" +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif + using namespace NLMISC; namespace R2 diff --git a/code/ryzom/client/src/stdpch.h b/code/ryzom/client/src/stdpch.h index c017c584b..5b95b65d9 100644 --- a/code/ryzom/client/src/stdpch.h +++ b/code/ryzom/client/src/stdpch.h @@ -14,6 +14,16 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#ifndef RYZOMCLIENT_STDPCH_H +#define RYZOMCLIENT_STDPCH_H + +#if defined(_MSC_VER) && defined(_DEBUG) +#define _CRTDBG_MAP_ALLOC +#include +#include +#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) +#endif + #include #include @@ -126,3 +136,5 @@ # include # include #endif // NL_OS_WINDOWS + +#endif diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/player_inventory.cpp b/code/ryzom/server/src/entities_game_service/game_item_manager/player_inventory.cpp index c549506da..ea832b494 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/player_inventory.cpp +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/player_inventory.cpp @@ -1071,9 +1071,9 @@ void CCharacterInvView::updateClientSlot(uint32 slot, const CGameItemPtr item) { resaleFlag = BOTCHATTYPE::ResaleKOLockedByOwner; } - + const INVENTORIES::TItemId &itemId = item->getItemId(); - + INVENTORIES::CItemSlot itemSlot( slot ); itemSlot.setItemProp( INVENTORIES::Sheet, item->getSheetId().asInt() ); itemSlot.setItemProp( INVENTORIES::Quality, item->quality() );