Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
0e63e81565
62 changed files with 592 additions and 409 deletions
|
@ -15,48 +15,76 @@ IF(NOT NDK_ROOT)
|
|||
|
||||
IF(CMAKE_HOST_WIN32)
|
||||
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
|
||||
ENDIF(CMAKE_HOST_WIN32)
|
||||
ENDIF(NOT NDK_ROOT)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT TARGET_CPU)
|
||||
SET(TARGET_CPU "armv7")
|
||||
ENDIF(NOT TARGET_CPU)
|
||||
ENDIF()
|
||||
|
||||
SET(ARMV7_HARD_FLOAT OFF)
|
||||
|
||||
IF(TARGET_CPU STREQUAL "armv7")
|
||||
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
|
||||
IF(ARMV7_HARD_FLOAT)
|
||||
SET(LIBRARY_ARCHITECTURE "${LIBRARY_ARCHITECTURE}-hard")
|
||||
ENDIF()
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
SET(TOOLCHAIN_ARCH "arm")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "arm")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
|
||||
SET(MINIMUM_NDK_TARGET 4)
|
||||
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")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
|
||||
SET(MINIMUM_NDK_TARGET 4)
|
||||
ELSEIF(TARGET_CPU STREQUAL "arm64")
|
||||
SET(LIBRARY_ARCHITECTURE "arm64-v8a")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
|
||||
SET(TOOLCHAIN_ARCH "arm64")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "aarch64-linux-android")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "aarch64-linux-android")
|
||||
SET(MINIMUM_NDK_TARGET 21)
|
||||
ELSEIF(TARGET_CPU STREQUAL "x86")
|
||||
SET(LIBRARY_ARCHITECTURE "x86")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
SET(TOOLCHAIN_ARCH "x86")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "x86")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "i686")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "i686-linux-android")
|
||||
SET(MINIMUM_NDK_TARGET 9)
|
||||
ELSEIF(TARGET_CPU STREQUAL "x86_64")
|
||||
SET(LIBRARY_ARCHITECTURE "x86_64")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||
SET(TOOLCHAIN_ARCH "x86_64")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "x86_64")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "x86_64-linux-android")
|
||||
SET(MINIMUM_NDK_TARGET 21)
|
||||
ELSEIF(TARGET_CPU STREQUAL "mips")
|
||||
SET(LIBRARY_ARCHITECTURE "mips")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "mips")
|
||||
SET(TOOLCHAIN_ARCH "mips")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "mipsel-linux-android")
|
||||
SET(MINIMUM_NDK_TARGET 9)
|
||||
ENDIF(TARGET_CPU STREQUAL "armv7")
|
||||
ELSEIF(TARGET_CPU STREQUAL "mips64")
|
||||
SET(LIBRARY_ARCHITECTURE "mips64")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "mips64")
|
||||
SET(TOOLCHAIN_ARCH "mips64")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "mips64el-linux-android")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "mips64el-linux-android")
|
||||
SET(MINIMUM_NDK_TARGET 21)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to process TARGET_CPU ${TARGET_CPU}")
|
||||
ENDIF()
|
||||
|
||||
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
|
||||
SET(ANDROID_COMPILER "GCC")
|
||||
|
||||
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
|
||||
SET(ANDROID_COMPILER "clang")
|
||||
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
|
||||
SET(CLANG ON)
|
||||
ELSE()
|
||||
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
|
||||
|
@ -64,7 +92,11 @@ ENDIF()
|
|||
|
||||
IF(NOT NDK_TARGET)
|
||||
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
|
||||
ENDIF(NOT NDK_TARGET)
|
||||
ELSE()
|
||||
IF(NDK_TARGET LESS MINIMUM_NDK_TARGET)
|
||||
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_HOST_WIN32)
|
||||
SET(TOOLCHAIN_HOST "windows")
|
||||
|
@ -75,7 +107,7 @@ ELSEIF(CMAKE_HOST_APPLE)
|
|||
ELSEIF(CMAKE_HOST_UNIX)
|
||||
SET(TOOLCHAIN_HOST "linux")
|
||||
SET(TOOLCHAIN_BIN_SUFFIX "")
|
||||
ENDIF(CMAKE_HOST_WIN32)
|
||||
ENDIF()
|
||||
|
||||
MACRO(SEARCH_TOOLCHAIN _COMPILER)
|
||||
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
|
||||
|
@ -110,7 +142,7 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER)
|
|||
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
|
||||
IF(_TOOLCHAIN_PREFIXES)
|
||||
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
|
||||
ENDIF(_TOOLCHAIN_PREFIXES)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
@ -123,8 +155,14 @@ 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}")
|
||||
ENDIF()
|
||||
|
||||
IF(GCC_TOOLCHAIN_ROOT)
|
||||
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
|
||||
ENDIF()
|
||||
|
||||
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
|
||||
|
||||
|
@ -137,14 +175,7 @@ SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
|
|||
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
||||
# NDK version >= 8b
|
||||
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
||||
ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
||||
|
||||
# Determine bin prefix for toolchain
|
||||
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
|
||||
IF(_TOOLCHAIN_BIN_PREFIXES)
|
||||
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
|
||||
STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
|
||||
ENDIF(_TOOLCHAIN_BIN_PREFIXES)
|
||||
ENDIF()
|
||||
|
||||
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
|
||||
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
|
||||
|
@ -160,39 +191,45 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
|||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
|
||||
IF("${_BINARY}" MATCHES "clang")
|
||||
MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY)
|
||||
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
|
||||
ELSE()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY)
|
||||
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
|
||||
ENDIF()
|
||||
ENDMACRO(SET_TOOLCHAIN_BINARY)
|
||||
ENDMACRO()
|
||||
|
||||
# Force the compilers to GCC for Android
|
||||
include (CMakeForceCompiler)
|
||||
|
||||
IF(CLANG)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
|
||||
MESSAGE(STATUS "Using clang compiler")
|
||||
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang)
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++)
|
||||
|
||||
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
|
||||
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
|
||||
|
||||
MESSAGE(STATUS "Using clang compiler")
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as)
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar)
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++)
|
||||
ELSE()
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
|
||||
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)
|
||||
|
||||
MESSAGE(STATUS "Using GCC compiler")
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_LINKER ld)
|
||||
ENDIF()
|
||||
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_AR ar)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_NM nm)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJCOPY objcopy)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJDUMP objdump)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_RANLIB ranlib)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
if(MAXSDK_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(MAXSDK_FIND_QUIETLY TRUE)
|
||||
endif(MAXSDK_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
FIND_PATH(MAXSDK_DIR
|
||||
"include/maxversion.h"
|
||||
|
@ -37,9 +37,9 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
|
|||
|
||||
IF(TARGET_X64)
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
|
||||
ELSE(TARGET_X64)
|
||||
ELSE()
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
|
||||
ENDIF(TARGET_X64)
|
||||
ENDIF()
|
||||
|
||||
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
FIND_LIBRARY(${MYLIBRARY}
|
||||
|
@ -47,7 +47,7 @@ MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
|||
HINTS
|
||||
${MAXSDK_LIBRARY_DIRS}
|
||||
)
|
||||
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
ENDMACRO()
|
||||
|
||||
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
|
||||
|
|
|
@ -45,6 +45,6 @@ IF(MFC_FOUND)
|
|||
|
||||
# Set CMake flag to use MFC DLL
|
||||
SET(CMAKE_MFC_FLAG 2)
|
||||
ENDIF(MFC_FOUND)
|
||||
ENDIF()
|
||||
|
||||
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project
|
||||
|
|
|
@ -30,16 +30,16 @@ MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
|||
HINTS
|
||||
"${DXSDK_LIBRARY_DIR}"
|
||||
)
|
||||
ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
ENDMACRO()
|
||||
|
||||
IF(DXSDK_DIR)
|
||||
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
|
||||
|
||||
IF(TARGET_X64)
|
||||
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x64 ${DXSDK_DIR}/lib/amd64)
|
||||
ELSE(TARGET_X64)
|
||||
ELSE()
|
||||
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x86 ${DXSDK_DIR}/lib)
|
||||
ENDIF(TARGET_X64)
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(DXSDK_LIBRARY_DIR
|
||||
dxguid.lib
|
||||
|
@ -52,7 +52,7 @@ IF(DXSDK_DIR)
|
|||
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
|
||||
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
|
||||
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
|
||||
ENDIF(DXSDK_DIR)
|
||||
ENDIF()
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
|
|
|
@ -14,8 +14,8 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
|
|||
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")
|
||||
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
|
||||
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
SET(VC${_VERSION}_FOUND ON)
|
||||
|
@ -24,14 +24,14 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
|
|||
SET(_VERSION_STR ${_VERSION})
|
||||
IF(MSVC_EXPRESS)
|
||||
SET(_VERSION_STR "${_VERSION_STR} Express")
|
||||
ENDIF(MSVC_EXPRESS)
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}")
|
||||
ENDIF(NOT MSVC_FIND_QUIETLY)
|
||||
ENDIF()
|
||||
ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
SET(VC${_VERSION}_FOUND OFF)
|
||||
SET(VC${_VERSION}_DIR "")
|
||||
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDMACRO(DETECT_VC_VERSION_HELPER)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(DETECT_VC_VERSION _VERSION)
|
||||
SET(VC${_VERSION}_FOUND OFF)
|
||||
|
@ -39,21 +39,21 @@ MACRO(DETECT_VC_VERSION _VERSION)
|
|||
|
||||
IF(NOT VC${_VERSION}_FOUND)
|
||||
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
||||
ENDIF(NOT VC${_VERSION}_FOUND)
|
||||
ENDIF()
|
||||
|
||||
IF(VC${_VERSION}_FOUND)
|
||||
SET(VC_FOUND ON)
|
||||
SET(VC_DIR "${VC${_VERSION}_DIR}")
|
||||
ENDIF(VC${_VERSION}_FOUND)
|
||||
ENDMACRO(DETECT_VC_VERSION)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(DETECT_EXPRESS_VERSION _VERSION)
|
||||
GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE)
|
||||
|
||||
IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
|
||||
SET(MSVC_EXPRESS ON)
|
||||
ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
|
||||
ENDMACRO(DETECT_EXPRESS_VERSION)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF(MSVC12)
|
||||
DETECT_VC_VERSION("12.0")
|
||||
|
@ -62,7 +62,7 @@ IF(MSVC12)
|
|||
IF(NOT MSVC12_REDIST_DIR)
|
||||
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC12_REDIST_DIR)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC11)
|
||||
DETECT_VC_VERSION("11.0")
|
||||
SET(MSVC_TOOLSET "110")
|
||||
|
@ -70,7 +70,7 @@ ELSEIF(MSVC11)
|
|||
IF(NOT MSVC11_REDIST_DIR)
|
||||
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC11_REDIST_DIR)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC10)
|
||||
DETECT_VC_VERSION("10.0")
|
||||
SET(MSVC_TOOLSET "100")
|
||||
|
@ -78,19 +78,19 @@ ELSEIF(MSVC10)
|
|||
IF(NOT MSVC10_REDIST_DIR)
|
||||
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC10_REDIST_DIR)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC90)
|
||||
DETECT_VC_VERSION("9.0")
|
||||
SET(MSVC_TOOLSET "90")
|
||||
ELSEIF(MSVC80)
|
||||
DETECT_VC_VERSION("8.0")
|
||||
SET(MSVC_TOOLSET "80")
|
||||
ENDIF(MSVC12)
|
||||
ENDIF()
|
||||
|
||||
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
|
||||
IF(NOT VC_DIR)
|
||||
SET(VC_DIR $ENV{VC_DIR})
|
||||
ENDIF(NOT VC_DIR)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT VC_DIR)
|
||||
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
# 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)
|
||||
# ENDIF()
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2006-2009 Kitware, Inc.
|
||||
|
@ -74,22 +74,22 @@ IF(Mercurial_HG_EXECUTABLE)
|
|||
|
||||
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)
|
||||
ELSE()
|
||||
LIST(LENGTH ${prefix}_WC_INFO _COUNT)
|
||||
IF(_COUNT EQUAL 4)
|
||||
LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
|
||||
LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
|
||||
LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
|
||||
LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
|
||||
ELSE(_COUNT EQUAL 4)
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Bad output from HG")
|
||||
SET(${prefix}_WC_REVISION "unknown")
|
||||
SET(${prefix}_WC_CHANGESET "unknown")
|
||||
SET(${prefix}_WC_BRANCH "unknown")
|
||||
ENDIF(_COUNT EQUAL 4)
|
||||
ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ENDMACRO(Mercurial_WC_INFO)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(Mercurial_WC_LOG dir prefix)
|
||||
# This macro can block if the certificate is not signed:
|
||||
|
@ -105,9 +105,9 @@ IF(Mercurial_HG_EXECUTABLE)
|
|||
|
||||
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)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
IF(WINSDK_FOUND)
|
||||
# If Windows SDK already found, skip it
|
||||
RETURN()
|
||||
ENDIF(WINSDK_FOUND)
|
||||
ENDIF()
|
||||
|
||||
# Values can be CURRENT or any existing versions 7.1, 8.0A, etc...
|
||||
SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer")
|
||||
|
@ -25,8 +25,8 @@ MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION)
|
|||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
||||
SET(WINSDK${_VERSION}_DIR "")
|
||||
ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDMACRO(DETECT_WINSDK_VERSION_HELPER)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(DETECT_WINSDK_VERSION _VERSION)
|
||||
SET(WINSDK${_VERSION}_FOUND OFF)
|
||||
|
@ -34,8 +34,8 @@ MACRO(DETECT_WINSDK_VERSION _VERSION)
|
|||
|
||||
IF(NOT WINSDK${_VERSION}_FOUND)
|
||||
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
||||
ENDIF(NOT WINSDK${_VERSION}_FOUND)
|
||||
ENDMACRO(DETECT_WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
SET(WINSDK_VERSIONS "8.1" "8.0" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
|
||||
SET(WINSDK_DETECTED_VERSIONS)
|
||||
|
@ -46,8 +46,8 @@ FOREACH(_VERSION ${WINSDK_VERSIONS})
|
|||
|
||||
IF(WINSDK${_VERSION}_FOUND)
|
||||
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
|
||||
ENDIF(WINSDK${_VERSION}_FOUND)
|
||||
ENDFOREACH(_VERSION)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
SET(WINSDK_SUFFIX)
|
||||
|
||||
|
@ -58,19 +58,19 @@ ELSEIF(TARGET_X64)
|
|||
SET(WINSDK_SUFFIX "x64")
|
||||
ELSEIF(TARGET_X86)
|
||||
SET(WINSDK8_SUFFIX "x86")
|
||||
ENDIF(TARGET_ARM)
|
||||
ENDIF()
|
||||
|
||||
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
|
||||
|
||||
IF(WINSDKCURRENT_VERSION_INCLUDE)
|
||||
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
|
||||
ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
|
||||
ENDIF()
|
||||
|
||||
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
|
||||
|
||||
IF(NOT WINSDKENV_DIR)
|
||||
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
|
||||
ENDIF(NOT WINSDKENV_DIR)
|
||||
ENDIF()
|
||||
|
||||
MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
|
||||
|
@ -88,8 +88,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "8.1")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 8.0
|
||||
|
@ -97,8 +97,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "8.0")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 7.0
|
||||
|
@ -123,14 +123,14 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
SET(WINSDK_VERSION "7.1")
|
||||
ELSEIF(_WINSDKVER STREQUAL "0601")
|
||||
SET(WINSDK_VERSION "7.0A")
|
||||
ELSE(_WINSDKVER STREQUAL "06010000")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
|
||||
ENDIF(_WINSDKVER STREQUAL "06010000")
|
||||
ELSE(_WINSDKVER_FILE)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(WINSDK_VERSION "7.0")
|
||||
ENDIF(_WINSDKVER_FILE)
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 6.0
|
||||
|
@ -138,8 +138,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "6.0")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.2
|
||||
|
@ -147,8 +147,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.2")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.1
|
||||
|
@ -156,8 +156,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.1")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.0
|
||||
|
@ -165,13 +165,13 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
|||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.0")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ELSE(_MSI_FILE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
|
||||
ENDIF(_MSI_FILE)
|
||||
ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION)
|
||||
ENDMACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(USE_CURRENT_WINSDK)
|
||||
SET(WINSDK_DIR "")
|
||||
|
@ -185,7 +185,7 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
${WINSDKENV_DIR}/Include/um
|
||||
${WINSDKENV_DIR}/Include
|
||||
)
|
||||
ENDIF(WINSDKENV_DIR)
|
||||
ENDIF()
|
||||
|
||||
# Use INCLUDE environment variable
|
||||
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
|
||||
|
@ -197,9 +197,9 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
|
||||
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
|
||||
BREAK()
|
||||
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
|
||||
ENDFOREACH(_INCLUDE)
|
||||
ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
IF(WINSDK_DIR)
|
||||
# Compare WINSDK_DIR with registered Windows SDKs
|
||||
|
@ -208,11 +208,11 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
SET(WINSDK_VERSION ${_VERSION})
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
BREAK()
|
||||
ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
|
||||
ENDFOREACH(_VERSION)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
FIND_WINSDK_VERSION_HEADERS()
|
||||
ENDIF(WINSDK_DIR)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_DIR)
|
||||
# Use Windows SDK versions installed with VC++ when possible
|
||||
|
@ -223,19 +223,19 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
ELSEIF(MSVC10)
|
||||
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "7.0A")
|
||||
ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC90)
|
||||
IF(NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "6.0A")
|
||||
ENDIF(NOT MSVC_EXPRESS)
|
||||
ENDIF()
|
||||
ELSEIF(MSVC80)
|
||||
IF(NOT MSVC_EXPRESS)
|
||||
# TODO: fix this version
|
||||
SET(WINSDK_VERSION "5.2A")
|
||||
ENDIF(NOT MSVC_EXPRESS)
|
||||
ELSE(MSVC12)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
|
||||
ENDIF(MSVC12)
|
||||
ENDIF()
|
||||
|
||||
# Use installed Windows SDK
|
||||
IF(NOT WINSDK_VERSION)
|
||||
|
@ -262,27 +262,27 @@ MACRO(USE_CURRENT_WINSDK)
|
|||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||
BREAK()
|
||||
ENDIF(WINSDK_VERSION STREQUAL _VERSION)
|
||||
ENDFOREACH(_VERSION)
|
||||
ENDIF(NOT WINSDK_DIR)
|
||||
ENDMACRO(USE_CURRENT_WINSDK)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
USE_CURRENT_WINSDK()
|
||||
ELSE(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
ELSE()
|
||||
IF(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||
ELSE(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
ELSE()
|
||||
USE_CURRENT_WINSDK()
|
||||
ENDIF(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
ENDIF(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(WINSDK_DIR)
|
||||
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
|
||||
ELSE(WINSDK_DIR)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
|
||||
ENDIF(WINSDK_DIR)
|
||||
ENDIF()
|
||||
|
||||
# directory where Win32 headers are found
|
||||
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
|
||||
|
@ -339,9 +339,9 @@ IF(WINSDK_INCLUDE_DIR)
|
|||
# Fix for using Windows SDK 7.1 with Visual C++ 2012
|
||||
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
||||
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
|
||||
ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
||||
ELSE(WINSDK_INCLUDE_DIR)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
|
||||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
ENDIF(WINSDK_INCLUDE_DIR)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
|
|
@ -2,6 +2,7 @@ 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)
|
||||
# BINARY_DIR should be set to root of your build directory
|
||||
|
||||
IF(SOURCE_DIR)
|
||||
# Replace spaces by semi-columns
|
||||
|
|
|
@ -40,12 +40,15 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
|||
|
||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||
|
||||
SET(_USE_PIE OFF)
|
||||
|
||||
IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY")
|
||||
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
||||
ELSE()
|
||||
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
|
||||
MESSAGE(STATUS "Target ${_target} is using PIE")
|
||||
IF(_pic)
|
||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
||||
SET(_USE_PIE ON)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
@ -70,6 +73,20 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
|||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
|
||||
IF(oldProps)
|
||||
LIST(APPEND _FLAGS " ${oldProps}")
|
||||
|
@ -101,6 +118,49 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
|||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(_LIBS ${_target} INTERFACE_LINK_LIBRARIES)
|
||||
IF(_LIBS)
|
||||
FOREACH(_LIB ${_LIBS})
|
||||
IF(TARGET "${_LIB}")
|
||||
# use same include directories
|
||||
GET_TARGET_PROPERTY(_DIRS ${_LIB} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
IF(_DIRS)
|
||||
FOREACH(item ${_DIRS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -I\"${item}\"")
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
# use same compile definitions
|
||||
GET_TARGET_PROPERTY(_DEFINITIONS ${_LIB} INTERFACE_COMPILE_DEFINITIONS)
|
||||
|
||||
IF(_DEFINITIONS)
|
||||
FOREACH(item ${_DEFINITIONS})
|
||||
# don't use dynamic expressions
|
||||
IF(NOT item MATCHES "\\$<")
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
# Hack to define missing QT_NO_DEBUG with Qt 5.2
|
||||
IF(USE_QT5 AND _UPPER_BUILD STREQUAL "RELEASE")
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG")
|
||||
ENDIF()
|
||||
|
||||
# Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIE
|
||||
IF(Qt5_POSITION_INDEPENDENT_CODE)
|
||||
SET(_USE_PIE ON)
|
||||
ENDIF()
|
||||
|
||||
IF(_USE_PIE)
|
||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}")
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
||||
|
||||
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
|
||||
|
|
|
@ -40,11 +40,24 @@ 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")
|
||||
endif (NOT DEFINED IOS_PLATFORM)
|
||||
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
||||
IF(NOT DEFINED IOS_PLATFORM)
|
||||
SET(IOS_PLATFORM "OS")
|
||||
ENDIF()
|
||||
|
||||
SET(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
||||
|
||||
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
||||
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||
|
@ -59,29 +72,35 @@ elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
|||
elseif(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
|
||||
else (${IOS_PLATFORM} STREQUAL "OS")
|
||||
else()
|
||||
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
|
||||
endif (${IOS_PLATFORM} STREQUAL "OS")
|
||||
endif()
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform")
|
||||
|
||||
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
|
||||
# Note Xcode 4.3 changed the installation location, choose the most recent one available
|
||||
SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms")
|
||||
SET(XCODE_PRE_43_ROOT "/Developer/Platforms")
|
||||
SET(XCODE_DEFAULT_ROOT "/Applications/Xcode.app/Contents")
|
||||
|
||||
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
IF(EXISTS ${XCODE_POST_43_ROOT})
|
||||
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT})
|
||||
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT})
|
||||
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT})
|
||||
ENDIF(EXISTS ${XCODE_POST_43_ROOT})
|
||||
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
IF(NOT DEFINED CMAKE_XCODE_ROOT)
|
||||
IF(EXISTS ${XCODE_DEFAULT_ROOT})
|
||||
SET(CMAKE_XCODE_ROOT ${XCODE_DEFAULT_ROOT} CACHE STRING "Xcode root")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Xcode directory ${XCODE_DEFAULT_ROOT} doesn't exist")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
IF(EXISTS ${TMP})
|
||||
SET(CMAKE_IOS_DEVELOPER_ROOT ${TMP})
|
||||
MESSAGE(STATUS "Use iOS developer root: ${CMAKE_IOS_DEVELOPER_ROOT}")
|
||||
ENDIF()
|
||||
SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
IF(EXISTS ${TMP})
|
||||
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${TMP})
|
||||
MESSAGE(STATUS "Use iOS simulator developer root: ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
|
||||
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform")
|
||||
|
||||
|
@ -93,9 +112,9 @@ MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
|
|||
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
|
||||
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
|
||||
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
|
||||
ENDFOREACH(_CMAKE_IOS_SDK)
|
||||
ENDIF(_CMAKE_IOS_SDKS)
|
||||
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS)
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Find and use the most recent iOS sdk
|
||||
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
|
@ -104,25 +123,25 @@ IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
|||
|
||||
IF(NOT IOS_VERSIONS)
|
||||
MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
|
||||
ENDIF(NOT IOS_VERSIONS)
|
||||
ENDIF()
|
||||
|
||||
IF(IOS_VERSION)
|
||||
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
|
||||
IF(_INDEX EQUAL -1)
|
||||
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
|
||||
ELSE(_INDEX EQUAL -1)
|
||||
ELSE()
|
||||
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||
ENDIF(_INDEX EQUAL -1)
|
||||
ELSE(IOS_VERSION)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
|
||||
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||
ENDIF(IOS_VERSION)
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}")
|
||||
|
||||
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk)
|
||||
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk)
|
||||
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
endif()
|
||||
|
||||
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
|
||||
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK")
|
||||
|
@ -134,31 +153,32 @@ SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS sup
|
|||
SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES Xcode)
|
||||
SET(ARCHS "$(ARCHS_STANDARD_32_BIT)")
|
||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
ELSE(CMAKE_GENERATOR MATCHES Xcode)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
SET(ARCHS "armv7")
|
||||
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;i386")
|
||||
SET(ARCHS "armv7;arm64;i386;x86_64")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
|
||||
# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
|
||||
set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
|
||||
IF(ARCHS)
|
||||
SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
|
||||
ENDIF()
|
||||
|
||||
# Set the find root to the iOS developer roots and to user defined paths
|
||||
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root")
|
||||
|
@ -174,10 +194,9 @@ set (CMAKE_SYSTEM_FRAMEWORK_PATH
|
|||
)
|
||||
|
||||
# only search the iOS sdks, not the remainder of the host filesystem
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include)
|
||||
#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib)
|
||||
#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin)
|
||||
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
|
||||
include(CMakeFindBinUtils)
|
||||
|
|
|
@ -708,7 +708,7 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
|||
}
|
||||
|
||||
string arg = " " + arguments;
|
||||
BOOL res = CreateProcessA(programName.c_str(), (char*)arg.c_str(), 0, 0, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, 0, 0, &si, &pi);
|
||||
BOOL res = CreateProcessA(programName.c_str(), (char*)arg.c_str(), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
|
||||
|
||||
if (res)
|
||||
{
|
||||
|
@ -728,7 +728,30 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
|||
CloseHandle( pi.hThread );
|
||||
}
|
||||
|
||||
#elif defined(NL_OS_UNIX)
|
||||
#elif defined(NL_OS_MAC)
|
||||
std::string command;
|
||||
|
||||
if (CFile::getExtension(programName) == "app")
|
||||
{
|
||||
// we need to open bundles with "open" command
|
||||
command = NLMISC::toString("open \"%s\"", programName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
command = programName;
|
||||
}
|
||||
|
||||
// append arguments if any
|
||||
if (!arguments.empty())
|
||||
{
|
||||
command += NLMISC::toString(" --args %s", arguments.c_str());
|
||||
}
|
||||
|
||||
int res = system(command.c_str());
|
||||
|
||||
if (res && log)
|
||||
nlwarning ("LAUNCH: Failed launched '%s' with arg '%s' return code %d", programName.c_str(), arguments.c_str(), res);
|
||||
#else
|
||||
|
||||
static bool firstLaunchProgram = true;
|
||||
if (firstLaunchProgram)
|
||||
|
@ -811,9 +834,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
|||
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
if (log)
|
||||
nlwarning ("LAUNCH: launchProgram() not implemented");
|
||||
#endif
|
||||
|
||||
return false;
|
||||
|
|
|
@ -75,6 +75,31 @@ IF(APPLE)
|
|||
IF(RYZOM_DATA_DIR)
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -RpX ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR})
|
||||
ENDIF()
|
||||
|
||||
IF(APPLE_CERTIFICATE)
|
||||
# Find codesign_allocate
|
||||
|
||||
# Xcode 7.0 and later versions
|
||||
SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate)
|
||||
|
||||
IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
|
||||
# Xcode 6.4 and previous versions
|
||||
SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
|
||||
# System path
|
||||
SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT EXISTS "${CODESIGN_ALLOCATE}")
|
||||
MESSAGE(WARNING "Unable to find codesign_allocate in standard directories")
|
||||
ELSE()
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign -fs "${APPLE_CERTIFICATE}" "${RYZOM_OUTPUT_DIR}" COMMENT "Signing bundle...")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/installscript_osx.vdf ${RYZOM_OUTPUT_DIR})
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/net/unified_network.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
/*
|
||||
* Types for options of CMirroredDataSet::declareProperty()
|
||||
|
@ -374,13 +375,13 @@ const TPropertyIndex INVALID_PROPERTY_INDEX = (TPropertyIndex)~0;
|
|||
#ifdef MIRROR_LIST_ROW_32BITS
|
||||
|
||||
typedef uint32 TSharedListRow;
|
||||
const TSharedListRow INVALID_SHAREDLIST_ROW = ~0; //((uint16)~0)-1;
|
||||
const TSharedListRow INVALID_SHAREDLIST_ROW = std::numeric_limits<uint16>::max(); // std::numeric_limits<uint16>::max()-1;
|
||||
const uint NB_SHAREDLIST_CELLS = 500000; // property+list container footprint with data size of 32 bit and 500000 rows: 5.8 MB
|
||||
|
||||
#else
|
||||
|
||||
typedef uint16 TSharedListRow;
|
||||
const TSharedListRow INVALID_SHAREDLIST_ROW = ((uint16)~0)-1;
|
||||
const TSharedListRow INVALID_SHAREDLIST_ROW = std::numeric_limits<uint16>::max()-1;
|
||||
const uint NB_SHAREDLIST_CELLS = INVALID_SHAREDLIST_ROW; // property+list container footprint with data size of 32 bit and 500000 rows: 1.3 MB
|
||||
|
||||
#endif
|
||||
|
|
|
@ -766,7 +766,7 @@ bool CProductDescriptionForClient::load(const std::string& filePath)
|
|||
clear();
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromBinFile(filePath.c_str());
|
||||
pdr.readFromBinFile(filePath);
|
||||
apply(pdr);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -68,7 +68,7 @@ struct TChangeTrackerHeader
|
|||
};
|
||||
|
||||
|
||||
const uint16 LOCAL_TRACKER_SERVICE_ID = (uint16)~0;
|
||||
const uint16 LOCAL_TRACKER_SERVICE_ID = std::numeric_limits<uint16>::max();
|
||||
|
||||
/**
|
||||
* Item in a tracker
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <nel/misc/types_nl.h>
|
||||
//#include <sstream>
|
||||
|
||||
#include <limits>
|
||||
|
||||
const uint MAX_NB_DATASETS = 4;
|
||||
extern bool VerboseWarnWhenMirrorReturningUnknownEntityId;
|
||||
|
@ -260,7 +261,7 @@ inline uint16 datasetToBitIndex( CMirroredDataSet *dataSet )
|
|||
if ( DataSetQuickArray[i] == dataSet )
|
||||
return (uint16)i;
|
||||
}
|
||||
return (uint16)~0;
|
||||
return std::numeric_limits<uint16>::max();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -737,7 +737,7 @@ bool CPersistentDataRecord::toLines(std::string& result)
|
|||
return pdt.readFromPdr(*this) && pdt.writeToBuffer(reinterpret_cast<NLMISC::CSString&>(result));
|
||||
}
|
||||
|
||||
bool CPersistentDataRecord::writeToBinFile(const char* fileName)
|
||||
bool CPersistentDataRecord::writeToBinFile(const std::string &fileName)
|
||||
{
|
||||
H_AUTO(CPersistentDataRecordWriteToBinFile);
|
||||
|
||||
|
@ -750,7 +750,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName)
|
|||
// write the buffer to a file
|
||||
COFile f;
|
||||
bool open = f.open(fileName);
|
||||
DROP_IF(!open,NLMISC::toString("Failed to open output file %s",fileName).c_str(),return false);
|
||||
DROP_IF(!open, NLMISC::toString("Failed to open output file %s", fileName.c_str()).c_str(),return false);
|
||||
|
||||
// write the binary data to file
|
||||
try
|
||||
|
@ -759,7 +759,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName)
|
|||
}
|
||||
catch(...)
|
||||
{
|
||||
DROP(NLMISC::toString("Failed to write output file: %s",fileName),return false);
|
||||
DROP(NLMISC::toString("Failed to write output file: %s", fileName.c_str()),return false);
|
||||
}
|
||||
|
||||
// rewind the read pointer 'cos it's at the end of file
|
||||
|
@ -768,7 +768,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat stringFormat)
|
||||
bool CPersistentDataRecord::writeToTxtFile(const std::string &fileName,TStringFormat stringFormat)
|
||||
{
|
||||
H_AUTO(CPersistentDataRecordWriteToTxtFile);
|
||||
|
||||
|
@ -779,7 +779,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st
|
|||
// write the text buffer to a file
|
||||
COFile f;
|
||||
bool open = f.open(fileName);
|
||||
DROP_IF(!open,NLMISC::toString("Failed to open output file %s",fileName).c_str(),return false);
|
||||
DROP_IF(!open,NLMISC::toString("Failed to open output file %s", fileName.c_str()).c_str(), return false);
|
||||
|
||||
// write the binary data to file
|
||||
try
|
||||
|
@ -788,7 +788,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st
|
|||
}
|
||||
catch(...)
|
||||
{
|
||||
DROP(NLMISC::toString("Failed to write output file: %s",fileName),return false);
|
||||
DROP(NLMISC::toString("Failed to write output file: %s", fileName.c_str()), return false);
|
||||
}
|
||||
|
||||
// rewind the read pointer 'cos it's at the end of file
|
||||
|
@ -797,7 +797,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CPersistentDataRecord::writeToFile(const char* fileName,TFileFormat fileFormat)
|
||||
bool CPersistentDataRecord::writeToFile(const std::string &fileName, TFileFormat fileFormat)
|
||||
{
|
||||
H_AUTO(CPersistentDataRecordWriteToFile);
|
||||
|
||||
|
@ -805,17 +805,17 @@ bool CPersistentDataRecord::writeToFile(const char* fileName,TFileFormat fileFor
|
|||
{
|
||||
case BINARY_FILE:
|
||||
binary_file:
|
||||
nlinfo("saving binary file: %s",fileName);
|
||||
nlinfo("saving binary file: %s", fileName.c_str());
|
||||
return writeToBinFile(fileName);
|
||||
|
||||
case XML_FILE:
|
||||
xml_file:
|
||||
nlinfo("saving xml file: %s",fileName);
|
||||
nlinfo("saving xml file: %s", fileName.c_str());
|
||||
return writeToTxtFile(fileName, XML_STRING);
|
||||
|
||||
case LINES_FILE:
|
||||
lines_file:
|
||||
nlinfo("saving line-based txt file: %s",fileName);
|
||||
nlinfo("saving line-based txt file: %s", fileName.c_str());
|
||||
return writeToTxtFile(fileName, LINES_STRING);
|
||||
|
||||
case ANY_FILE:
|
||||
|
@ -1113,14 +1113,14 @@ bool CPersistentDataRecord::fromBuffer(NLMISC::IStream& stream)
|
|||
}
|
||||
|
||||
|
||||
bool CPersistentDataRecord::readFromFile(const char* fileName)
|
||||
bool CPersistentDataRecord::readFromFile(const std::string &fileName)
|
||||
{
|
||||
H_AUTO(pdrReadFromFile)
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
// open the file
|
||||
FILE* inf= fopen(fileName,"rb");
|
||||
FILE* inf= fopen(fileName.c_str(), "rb");
|
||||
DROP_IF( inf==NULL, "Failed to open input file " << fileName, return false);
|
||||
|
||||
// get the file size
|
||||
|
@ -1166,14 +1166,14 @@ bool CPersistentDataRecord::readFromFile(const char* fileName)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool CPersistentDataRecord::readFromBinFile(const char* fileName)
|
||||
bool CPersistentDataRecord::readFromBinFile(const std::string &fileName)
|
||||
{
|
||||
H_AUTO(CPersistentDataRecordReadFromBinFile);
|
||||
|
||||
// open the file
|
||||
CIFile f;
|
||||
bool open = f.open(fileName);
|
||||
DROP_IF(!open,NLMISC::toString("Failed to open input file %s",fileName).c_str(),return false)
|
||||
DROP_IF(!open, NLMISC::toString("Failed to open input file %s", fileName.c_str()), return false)
|
||||
|
||||
// get the file size
|
||||
uint32 len=CFile::getFileSize(fileName);
|
||||
|
@ -1189,7 +1189,7 @@ bool CPersistentDataRecord::readFromBinFile(const char* fileName)
|
|||
}
|
||||
catch(...)
|
||||
{
|
||||
DROP(NLMISC::toString("Failed to read input file: %s",fileName),return false);
|
||||
DROP(NLMISC::toString("Failed to read input file: %s", fileName.c_str()), return false);
|
||||
}
|
||||
|
||||
// parse the buffer contents to re-generate the data
|
||||
|
@ -1199,14 +1199,14 @@ bool CPersistentDataRecord::readFromBinFile(const char* fileName)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CPersistentDataRecord::readFromTxtFile(const char* fileName)
|
||||
bool CPersistentDataRecord::readFromTxtFile(const std::string &fileName)
|
||||
{
|
||||
H_AUTO(CPersistentDataRecordReadFromTxtFile);
|
||||
|
||||
// open the file
|
||||
CIFile f;
|
||||
bool open = f.open(fileName);
|
||||
DROP_IF(!open,NLMISC::toString("Failed to open input file %s",fileName).c_str(),return false)
|
||||
DROP_IF(!open, NLMISC::toString("Failed to open input file %s", fileName.c_str()), return false)
|
||||
|
||||
// get the file size
|
||||
uint32 len=CFile::getFileSize(fileName);
|
||||
|
@ -1222,7 +1222,7 @@ bool CPersistentDataRecord::readFromTxtFile(const char* fileName)
|
|||
}
|
||||
catch(...)
|
||||
{
|
||||
DROP(NLMISC::toString("Failed to read input file: %s",fileName),return false);
|
||||
DROP(NLMISC::toString("Failed to read input file: %s", fileName.c_str()), return false);
|
||||
}
|
||||
|
||||
// parse the buffer contents to re-generate the data
|
||||
|
|
|
@ -407,15 +407,15 @@ public:
|
|||
bool toLines(std::string& result);
|
||||
|
||||
// perform a toBuffer() and write the result to a binary file
|
||||
bool writeToBinFile(const char* fileName);
|
||||
bool writeToBinFile(const std::string &fileName);
|
||||
|
||||
// perform a toString() and write the result to a text file
|
||||
bool writeToTxtFile(const char* fileName,TStringFormat stringFormat=XML_STRING);
|
||||
bool writeToTxtFile(const std::string &fileName, TStringFormat stringFormat=XML_STRING);
|
||||
|
||||
// if the format is set to 'ANY_FILE' then use the extension provided in the 'fileName' argument to
|
||||
// determine the file type. In this case 'txt' and 'xml' have specific meanings
|
||||
// returns writeToTxtFile(...) or writeToBinFile(...) depending on the file format
|
||||
bool writeToFile(const char* fileName,TFileFormat fileFormat=ANY_FILE);
|
||||
bool writeToFile(const std::string &fileName, TFileFormat fileFormat=ANY_FILE);
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -445,14 +445,14 @@ public:
|
|||
bool fromLines(const std::string& s);
|
||||
|
||||
// read from a binary file
|
||||
bool readFromBinFile(const char* fileName);
|
||||
bool readFromBinFile(const std::string &fileName);
|
||||
|
||||
// read from a text file
|
||||
bool readFromTxtFile(const char* fileName);
|
||||
bool readFromTxtFile(const std::string &fileName);
|
||||
|
||||
// read a file and determine whether it's a binary or text file from it's
|
||||
// content - then behave like readFromBinFile() or readFromTxtFile()
|
||||
bool readFromFile(const char* fileName);
|
||||
bool readFromFile(const std::string &fileName);
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
@ -370,13 +370,13 @@ void PERSISTENT_CLASS::store(CPersistentDataRecord &pdr _PERSISTENT_STORE_ARGS)
|
|||
|
||||
#else
|
||||
// define the set of tokens - this makes sure that the tokens exist in the map and that we only look them up the once
|
||||
static uint16 __Tok__MapKey= (uint16)~0u; pdr.addString("__Key__",__Tok__MapKey);
|
||||
static uint16 __Tok__MapVal= (uint16)~0u; pdr.addString("__Val__",__Tok__MapVal);
|
||||
#define _PROP(token,name,type,logic,get,set) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _STRUCT(token,name,logic,write,read) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _FLAG(token,name,logic,code) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
static uint16 __Tok__MapKey = std::numeric_limits<uint16>::max(); pdr.addString("__Key__",__Tok__MapKey);
|
||||
static uint16 __Tok__MapVal = std::numeric_limits<uint16>::max(); pdr.addString("__Val__",__Tok__MapVal);
|
||||
#define _PROP(token,name,type,logic,get,set) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _STRUCT(token,name,logic,write,read) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _FLAG(token,name,logic,code) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
PERSISTENT_DATA
|
||||
#undef _PROP
|
||||
#undef _STRUCT
|
||||
|
@ -471,13 +471,13 @@ void PERSISTENT_CLASS::apply(CPersistentDataRecord &pdr _PERSISTENT_APPLY_ARGS)
|
|||
#endif
|
||||
|
||||
// define the set of tokens - this makes sure that the tokens exist in the map and that we only look them up the once
|
||||
static uint16 __Tok__MapKey= (uint16)~0u; pdr.addString("__Key__",__Tok__MapKey);
|
||||
static uint16 __Tok__MapVal= (uint16)~0u; pdr.addString("__Val__",__Tok__MapVal);
|
||||
#define _PROP(token,name,type,logic,get,set) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _STRUCT(token,name,logic,write,read) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
#define _FLAG(token,name,logic,code) static uint16 token= (uint16)~0u; pdr.addString(name,token);
|
||||
static uint16 __Tok__MapKey = std::numeric_limits<uint16>::max(); pdr.addString("__Key__",__Tok__MapKey);
|
||||
static uint16 __Tok__MapVal = std::numeric_limits<uint16>::max(); pdr.addString("__Val__",__Tok__MapVal);
|
||||
#define _PROP(token,name,type,logic,get,set) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _STRUCT(token,name,logic,write,read) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _PROP_MAP(token,name,keyType,valType,logic,getKey,getVal,set) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _STRUCT_MAP(token,name,keyType,logic,getKey,valWrite,read) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
#define _FLAG(token,name,logic,code) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||
PERSISTENT_DATA
|
||||
#undef _PROP
|
||||
#undef _STRUCT
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "property_allocator.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace NLNET
|
||||
{
|
||||
class CMessage;
|
||||
|
@ -40,7 +42,7 @@ class CPropertyAllocatorClient : public CPropertyAllocator
|
|||
public:
|
||||
|
||||
/// Constructor
|
||||
CPropertyAllocatorClient() : _LocalMSId((uint16)~0) {}
|
||||
CPropertyAllocatorClient() : _LocalMSId(std::numeric_limits<uint16>::max()) {}
|
||||
|
||||
/** Ask to allocate, if not done yet, a segment for the specified property.
|
||||
* The pointer will be soon returned by getPropertySegment(), but not always
|
||||
|
|
|
@ -2039,7 +2039,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi
|
|||
{
|
||||
string tmp = toString("r2.%04u.act%u.pdr.xml", sessionId.asInt(), first);
|
||||
nldebug( "writing xml pdr file %s", tmp.c_str() );
|
||||
animSession->Pdrs[first].writeToTxtFile( tmp.c_str() );
|
||||
animSession->Pdrs[first].writeToTxtFile( tmp );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1346,12 +1346,14 @@ public:
|
|||
CComputeCell *cell = _WorldMap.getComputeCell(scanline);
|
||||
|
||||
{
|
||||
uint i;
|
||||
for (i=0; i<16*16; ++i)
|
||||
for (uint i = 0; i < 16; ++i)
|
||||
{
|
||||
toposGridList[0][i].topos[0] =
|
||||
toposGridList[0][i].topos[1] =
|
||||
toposGridList[0][i].topos[2] = -1;
|
||||
for (uint j = 0; j < 16; ++j)
|
||||
{
|
||||
toposGridList[i][j].topos[0] =
|
||||
toposGridList[i][j].topos[1] =
|
||||
toposGridList[i][j].topos[2] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ inline CAIMapSurfaceNeighbour::CAIMapSurfaceNeighbour(bool isNoGo) // constructo
|
|||
nlassert(isNoGo=true); // by definition this code can't be executed with isNoGo false
|
||||
|
||||
_surface=NULL;
|
||||
_distance=(uint16)-1;
|
||||
_distance = std::numeric_limits<uint16>::max();
|
||||
//bool _sameRegion=false;
|
||||
memset(_direction,0,sizeof(_direction));
|
||||
}
|
||||
|
|
|
@ -52,12 +52,12 @@ void CAIActionsDataRecordPtr::clear()
|
|||
|
||||
void CAIActionsDataRecordPtr::readFile(const std::string &fileName)
|
||||
{
|
||||
_PdrPtr->readFromFile(fileName.c_str());
|
||||
_PdrPtr->readFromFile(fileName);
|
||||
}
|
||||
|
||||
void CAIActionsDataRecordPtr::writeFile(const std::string &fileName)
|
||||
{
|
||||
_PdrPtr->writeToFile(fileName.c_str());
|
||||
_PdrPtr->writeToFile(fileName);
|
||||
}
|
||||
|
||||
void CAIActionsDataRecordPtr::display()
|
||||
|
|
|
@ -372,7 +372,7 @@ uint16 CSingleLayerCell::_MaskMap[16];
|
|||
|
||||
void CSingleLayerCell::serial(NLMISC::IStream& f)
|
||||
{
|
||||
f.serialCheck((uint16)'SL');
|
||||
f.serialCheck(NELID16("SL"));
|
||||
|
||||
uint i;
|
||||
for (i=0; i<16; ++i)
|
||||
|
@ -403,7 +403,7 @@ void CSingleLayerCell::serial(NLMISC::IStream& f)
|
|||
|
||||
void CMultiLayerCell::serial(NLMISC::IStream& f)
|
||||
{
|
||||
f.serialCheck((uint16)'ML');
|
||||
f.serialCheck(NELID16("ML"));
|
||||
|
||||
uint slot;
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ NLMISC_COMMAND ( dumpCharacterFile, "dump the content of the save file for a cha
|
|||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
|
||||
if (!pdr.readFromBinFile(fileName.c_str()))
|
||||
if (!pdr.readFromBinFile(fileName))
|
||||
{
|
||||
log.displayNL("Error while reading file '%s'", fileName.c_str());
|
||||
return true;
|
||||
|
|
|
@ -2199,7 +2199,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,saveToXML,"save a character to an XML file","<eid
|
|||
static CPersistentDataRecordRyzomStore pdr;
|
||||
pdr.clear();
|
||||
c->store(pdr);
|
||||
pdr.writeToTxtFile((fileName+".xml").c_str());
|
||||
pdr.writeToTxtFile(fileName+".xml");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2225,7 +2225,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,loadFromXML,"load a character from an XML file","
|
|||
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromTxtFile((fileName+".xml").c_str());
|
||||
pdr.readFromTxtFile(fileName+".xml");
|
||||
c->apply(pdr);
|
||||
c->setName(name);
|
||||
c->setGuildId(guildId);
|
||||
|
@ -2256,7 +2256,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,saveToPDR,"save a character to a binary PDR file"
|
|||
static CPersistentDataRecordRyzomStore pdr;
|
||||
pdr.clear();
|
||||
c->store(pdr);
|
||||
pdr.writeToBinFile((fileName+".pdr").c_str());
|
||||
pdr.writeToBinFile(fileName+".pdr");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2282,7 +2282,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,loadFromPDR,"load a character from a binary PDR f
|
|||
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromBinFile((fileName+".pdr").c_str());
|
||||
pdr.readFromBinFile(fileName+".pdr");
|
||||
c->apply(pdr);
|
||||
|
||||
c->setName(name);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
class CDeposit;
|
||||
|
||||
const uint16 MaxNbActiveSources = (uint16)~0;
|
||||
const uint16 MaxNbActiveSources = std::numeric_limits<uint16>::max();
|
||||
|
||||
/**
|
||||
* A recent forage site prevents from extracting too much material from the same place in a short time.
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
std::map<std::string, size_t>::const_iterator it = _AnimIdMap.find(animId);
|
||||
if (it!=_AnimIdMap.end())
|
||||
return (uint16)it->second;
|
||||
return (uint16)~0;
|
||||
return std::numeric_limits<uint16>::max();
|
||||
}
|
||||
|
||||
/// Removed
|
||||
|
|
|
@ -117,7 +117,7 @@ public:
|
|||
std::map<std::string, size_t>::const_iterator it = _EmoteIdMap.find(emoteId);
|
||||
if (it!=_EmoteIdMap.end())
|
||||
return (uint16)it->second;
|
||||
return (uint16)~0;
|
||||
return std::numeric_limits<uint16>::max();
|
||||
}
|
||||
MBEHAV::EBehaviour getEmoteBehav(const std::string& emoteId) const;
|
||||
|
||||
|
|
|
@ -1720,7 +1720,7 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam
|
|||
pdr.clear();
|
||||
{
|
||||
H_AUTO(LoadCharacterNamesLoadFile);
|
||||
pdr.readFromFile((*it).second.FileName.c_str());
|
||||
pdr.readFromFile((*it).second.FileName);
|
||||
}
|
||||
CCharacterNameExtraction nameExtractor;
|
||||
{
|
||||
|
@ -1760,25 +1760,25 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam
|
|||
// // std read tst
|
||||
// static CPersistentDataRecord pdrRead("");
|
||||
// pdrRead.clear();
|
||||
// pdrRead.readFromBinFile(files[i].c_str());
|
||||
// pdrRead.writeToTxtFile((saveDir + "test/txt_read/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING);
|
||||
// pdrRead.readFromBinFile(files[i]);
|
||||
// pdrRead.writeToTxtFile(saveDir + "test/txt_read/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING);
|
||||
//
|
||||
// // read write tst (even with a bad used RyzomStore class)
|
||||
// static CPersistentDataRecordRyzomStore pdr;
|
||||
// pdr.clear();
|
||||
// pdr.readFromBinFile(files[i].c_str());
|
||||
// pdr.readFromBinFile(files[i]);
|
||||
// TTime t0= CTime::getLocalTime();
|
||||
// pdr.writeToBinFile((saveDir + "test/bin_new/" + file).c_str());
|
||||
// pdr.writeToBinFile(saveDir + "test/bin_new/" + file);
|
||||
// TTime t1= CTime::getLocalTime();
|
||||
// nlinfo("resaved %s in %d ms", file.c_str(), uint32(t1-t0));
|
||||
// pdr.writeToTxtFile((saveDir + "test/txt_before/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING);
|
||||
// pdr.writeToTxtFile(saveDir + "test/txt_before/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING);
|
||||
// }
|
||||
// // ReLoad
|
||||
// {
|
||||
// static CPersistentDataRecordRyzomStore pdr;
|
||||
// pdr.clear();
|
||||
// pdr.readFromBinFile((saveDir + "test/bin_new/" + file).c_str());
|
||||
// pdr.writeToTxtFile((saveDir + "test/txt_after/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING);
|
||||
// pdr.readFromBinFile(saveDir + "test/bin_new/" + file);
|
||||
// pdr.writeToTxtFile(saveDir + "test/txt_after/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
@ -1813,10 +1813,10 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam
|
|||
// {
|
||||
// static CPersistentDataRecord pdr;
|
||||
// pdr.clear();
|
||||
// pdr.readFromFile(files[i].c_str());
|
||||
// pdr.readFromFile(files[i]);
|
||||
// string txtFile= files[i];
|
||||
// strFindReplace(txtFile, ".bin", ".txt");
|
||||
// pdr.writeToTxtFile(txtFile.c_str(), CPersistentDataRecord::LINES_STRING);
|
||||
// pdr.writeToTxtFile(txtFile, CPersistentDataRecord::LINES_STRING);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -66,7 +66,7 @@ void CGameEventManager::init()
|
|||
{
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromTxtFile(sFilename.c_str());
|
||||
pdr.readFromTxtFile(sFilename);
|
||||
apply(pdr);
|
||||
createEventChannel();
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ void CGameEventManager::saveGameEventFile()
|
|||
static CPersistentDataRecordRyzomStore pdr;
|
||||
pdr.clear();
|
||||
store(pdr);
|
||||
pdr.writeToTxtFile(sFilename.c_str());
|
||||
pdr.writeToTxtFile(sFilename);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -918,8 +918,9 @@ NLMISC_COMMAND(createItem,"create a new item","<sheet id><quality>")
|
|||
// return false;
|
||||
// }
|
||||
//
|
||||
// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0].c_str()) );
|
||||
// //uint16 quality = (uint16)NLMISC::fromString(args[1].c_str());
|
||||
// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0]) );
|
||||
// //uint16 quality;
|
||||
// //NLMISC::fromString(args[1]; quality);
|
||||
//
|
||||
// sint32 x;
|
||||
// NLMISC::fromString(args[2], x);
|
||||
|
@ -957,9 +958,10 @@ NLMISC_COMMAND(createItem,"create a new item","<sheet id><quality>")
|
|||
// }
|
||||
// else
|
||||
// {
|
||||
// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0].c_str()) );
|
||||
// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0]) );
|
||||
// CSheetId sheetId(args[1]);
|
||||
// uint16 quality = (uint16)NLMISC::fromString(args[2].c_str());
|
||||
// uint16 quality;
|
||||
// NLMISC::fromString(args[2], quality);
|
||||
// sint32 x = (sint32)NLMISC::fromString(args[3].c_str()) * 1000;
|
||||
// sint32 y = (sint32)NLMISC::fromString(args[4].c_str()) * 1000;
|
||||
// sint32 z = (sint32)NLMISC::fromString(args[5].c_str()) * 1000;
|
||||
|
|
|
@ -510,7 +510,7 @@ NLMISC_COMMAND( importGuildFile, "Import a guild file into the server", "<filena
|
|||
if ( id > 0)
|
||||
{
|
||||
// this is a guild file. We can load it
|
||||
pdr.readFromBinFile(args[0].c_str());
|
||||
pdr.readFromBinFile(args[0]);
|
||||
|
||||
guildId = id;
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ NLMISC_COMMAND( importGuildFile, "Import a guild file into the server", "<filena
|
|||
if ( id > 0)
|
||||
{
|
||||
// this is a guild file. We can load it
|
||||
pdr.readFromTxtFile(args[0].c_str());
|
||||
pdr.readFromTxtFile(args[0]);
|
||||
guildId = id;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -328,7 +328,7 @@ void CGuildManager::saveGuild( CGuild* guild )
|
|||
{
|
||||
H_AUTO( CGuildManagerUpdate_PDR_WRITE_TEXT )
|
||||
string fileName = Bsi.getLocalPath()+NLMISC::toString("guilds/guild_%05u.txt", id & 0x000fffff);
|
||||
pdr.writeToTxtFile(fileName.c_str());
|
||||
pdr.writeToTxtFile(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -360,7 +360,7 @@ void CGuildManager::saveGuild( CGuild* guild )
|
|||
else
|
||||
{
|
||||
H_AUTO( CGuildManagerUpdatePDR_WRITE_BIN_NO_PDS )
|
||||
pdr.writeToBinFile((Bsi.getLocalPath() + fileName).c_str());
|
||||
pdr.writeToBinFile(Bsi.getLocalPath() + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void CMissionQueueManager::init()
|
|||
{
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromTxtFile(sFilename.c_str());
|
||||
pdr.readFromTxtFile(sFilename);
|
||||
apply(pdr);
|
||||
}
|
||||
_InitOk = true;
|
||||
|
|
|
@ -1095,14 +1095,19 @@ class CMissionStepKillPlayer : public IMissionStepTemplate
|
|||
return false;
|
||||
}
|
||||
// missionData.ChatParams.push_back( make_pair( args[0], STRING_MANAGER::clan ) );
|
||||
subStep.MinLevel = atoi( args[1].c_str() ) * kFameMultipler;
|
||||
subStep.MaxLevel = atoi( args[2].c_str() ) * kFameMultipler;
|
||||
NLMISC::fromString(args[1], subStep.MinLevel);
|
||||
NLMISC::fromString(args[2], subStep.MaxLevel);
|
||||
|
||||
subStep.MinLevel *= kFameMultipler;
|
||||
subStep.MaxLevel *= kFameMultipler;
|
||||
|
||||
if ( subStep.MinLevel >= subStep.MaxLevel )
|
||||
{
|
||||
MISLOGERROR("min_level >= max_level");
|
||||
return false;
|
||||
}
|
||||
subStep.Quantity = (uint16) atoi( args[3].c_str() );
|
||||
NLMISC::fromString(args[3], subStep.Quantity);
|
||||
|
||||
if ( subStep.Quantity == 0 )
|
||||
{
|
||||
MISLOGERROR("invalid quantity 0");
|
||||
|
|
|
@ -430,7 +430,7 @@ void COutpostManager::loadOutpostSaveFiles()
|
|||
// // load dynamic data
|
||||
// static CPersistentDataRecord pdr;
|
||||
// pdr.clear();
|
||||
// pdr.readFromBinFile(files[i].c_str());
|
||||
// pdr.readFromBinFile(files[i]);
|
||||
// outpost->apply( pdr );
|
||||
// loadedOutposts.push_back( outpost );
|
||||
// }
|
||||
|
@ -808,7 +808,7 @@ void COutpostManager::saveOutpost(NLMISC::CSmartPtr<COutpost> outpost)
|
|||
else
|
||||
{
|
||||
H_AUTO( COutpostManagerSTORE_NO_BS )
|
||||
pdr.writeToBinFile((Bsi.getLocalPath() + fileName).c_str());
|
||||
pdr.writeToBinFile(Bsi.getLocalPath() + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ CSpecialPowerPhrase::CSpecialPowerPhrase()
|
|||
_IsStatic = false;
|
||||
_AddRecastTime = 0;
|
||||
_PhraseType = BRICK_TYPE::SPECIAL_POWER;
|
||||
_ConsumableFamilyId = (uint16)~0;
|
||||
_ConsumableFamilyId = std::numeric_limits<uint16>::max();
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
|
|
|
@ -54,7 +54,7 @@ bool CSpecialPowerShielding::validate(std::string &errorCode)
|
|||
}
|
||||
|
||||
TGameCycle endDate;
|
||||
if (!actor->canUsePower(_PowerType, (uint16)~0, endDate))
|
||||
if (!actor->canUsePower(_PowerType, std::numeric_limits<uint16>::max(), endDate))
|
||||
{
|
||||
uint16 seconds = uint16((endDate - CTickEventHandler::getGameCycle())*CTickEventHandler::getGameTimeStep());
|
||||
uint8 minutes = uint8(seconds/60);
|
||||
|
|
|
@ -66,7 +66,7 @@ bool CSpecialPowerTaunt::validate(std::string &errorCode)
|
|||
}
|
||||
|
||||
TGameCycle endDate;
|
||||
if (!actor->canUsePower(_PowerType, (uint16)~0, endDate))
|
||||
if (!actor->canUsePower(_PowerType, std::numeric_limits<uint16>::max(), endDate))
|
||||
{
|
||||
uint16 seconds = uint16( (endDate - CTickEventHandler::getGameCycle())*CTickEventHandler::getGameTimeStep() );
|
||||
uint8 minutes = uint8(seconds/60);
|
||||
|
|
|
@ -140,8 +140,7 @@ public:
|
|||
//get the number of nodes
|
||||
uint16 getNbNodes() const
|
||||
{
|
||||
return (uint16)
|
||||
_Nodes.size();
|
||||
return (uint16)_Nodes.size();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2611,7 +2611,7 @@ void CCharacter::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
|
|||
void CCharacter::setPositionToDefaultRespawnPoint()
|
||||
{
|
||||
CContinent * continent = CZoneManager::getInstance().getContinent( getX(), getY() );
|
||||
uint16 zoneId = (uint16)~0;
|
||||
uint16 zoneId = std::numeric_limits<uint16>::max();
|
||||
if( continent == 0 )
|
||||
{
|
||||
nlwarning("<CHAR_TP_TOWN: Character %s : continent null for pos %d %d", getId().toString().c_str(), getX(), getY());
|
||||
|
@ -2660,7 +2660,7 @@ void CCharacter::setPositionToDefaultRespawnPoint()
|
|||
break;
|
||||
}
|
||||
|
||||
if( zoneId != (uint16)~0 )
|
||||
if( zoneId != std::numeric_limits<uint16>::max() )
|
||||
{
|
||||
// get the tp coords
|
||||
const CTpSpawnZone* zone = CZoneManager::getInstance().getTpSpawnZone( zoneId );
|
||||
|
|
|
@ -831,7 +831,7 @@ void CPlayer::loadAllCharacters()
|
|||
bool isOK;
|
||||
{
|
||||
H_AUTO(LoadAllCharactersPdrBinReadFile);
|
||||
isOK= pdr.readFromBinFile(pdrBinFileName.c_str());
|
||||
isOK= pdr.readFromBinFile(pdrBinFileName);
|
||||
}
|
||||
if (!isOK)
|
||||
break;
|
||||
|
@ -854,7 +854,7 @@ void CPlayer::loadAllCharacters()
|
|||
bool isOK;
|
||||
{
|
||||
H_AUTO(LoadAllCharactersPdrXmlReadFile);
|
||||
isOK= pdr.readFromTxtFile(pdrXmlFileName.c_str());
|
||||
isOK= pdr.readFromTxtFile(pdrXmlFileName);
|
||||
}
|
||||
if (!isOK)
|
||||
break;
|
||||
|
@ -975,7 +975,7 @@ void CPlayer::loadAllCharactersPdr()
|
|||
// try loading the save data from disk
|
||||
try
|
||||
{
|
||||
bool isOK= pdr.readFromFile(fileName.c_str());
|
||||
bool isOK= pdr.readFromFile(fileName);
|
||||
if (!isOK)
|
||||
continue;
|
||||
}
|
||||
|
@ -1478,11 +1478,11 @@ NLMISC_CATEGORISED_COMMAND(egs, convertToPdr, "Load all possible characters from
|
|||
bool writeSuccess = false;
|
||||
if (xml)
|
||||
{
|
||||
writeSuccess = pdr.writeToTxtFile(dstFile.c_str());
|
||||
writeSuccess = pdr.writeToTxtFile(dstFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeSuccess = pdr.writeToBinFile(dstFile.c_str());
|
||||
writeSuccess = pdr.writeToBinFile(dstFile);
|
||||
}
|
||||
|
||||
// check file can be read back
|
||||
|
@ -1491,7 +1491,7 @@ NLMISC_CATEGORISED_COMMAND(egs, convertToPdr, "Load all possible characters from
|
|||
static CPersistentDataRecord pdrTest;
|
||||
pdrTest.clear();
|
||||
|
||||
if (pdrTest.readFromFile(dstFile.c_str()))
|
||||
if (pdrTest.readFromFile(dstFile))
|
||||
{
|
||||
CCharacter* characterTest = new CCharacter();
|
||||
characterTest->setId( PlayerManager.createCharacterId( UserId, CharId ) );
|
||||
|
|
|
@ -846,7 +846,7 @@ void CPlayerManager::savePlayerCharRecurs( uint32 userId, sint32 idx, std::set<C
|
|||
}
|
||||
{
|
||||
H_AUTO(SavePlayerPDRSave);
|
||||
pdr.writeToFile(pdrPathFileName.c_str());
|
||||
pdr.writeToFile(pdrPathFileName);
|
||||
}
|
||||
}
|
||||
catch(const Exception &)
|
||||
|
|
|
@ -60,7 +60,7 @@ void CPowerActivationDateVector::clearConsumable()
|
|||
{
|
||||
for(sint32 i = (sint32)PowerActivationDates.size()-1; i >= 0; --i )
|
||||
{
|
||||
if (PowerActivationDates[i].ConsumableFamilyId != (uint16)~0)
|
||||
if (PowerActivationDates[i].ConsumableFamilyId != std::numeric_limits<uint16>::max())
|
||||
{
|
||||
PowerActivationDates[i] = PowerActivationDates[PowerActivationDates.size()-1];
|
||||
PowerActivationDates.pop_back();
|
||||
|
@ -117,7 +117,7 @@ bool CPowerActivationDateVector::isPowerAllowed(POWERS::TPowerType type, uint16
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( (*it).PowerType == type || ((*it).ConsumableFamilyId != (uint16)~0 && (*it).ConsumableFamilyId == consumableFamilyId))
|
||||
if ( (*it).PowerType == type || ((*it).ConsumableFamilyId != std::numeric_limits<uint16>::max() && (*it).ConsumableFamilyId == consumableFamilyId))
|
||||
{
|
||||
endDate = (*it).ActivationDate;
|
||||
result = false;
|
||||
|
@ -195,7 +195,7 @@ void CAuraActivationDateVector::clear()
|
|||
//-----------------------------------------------------------------------------
|
||||
void CAuraActivationDateVector::disableAura(POWERS::TPowerType type, NLMISC::TGameCycle startDate, NLMISC::TGameCycle endDate, const NLMISC::CEntityId &userId)
|
||||
{
|
||||
_AuraActivationDates.push_back( CPowerActivationDate(type,(uint16)~0, startDate, endDate) );
|
||||
_AuraActivationDates.push_back( CPowerActivationDate(type, std::numeric_limits<uint16>::max(), startDate, endDate) );
|
||||
_AuraUsers.push_back(userId);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ struct CPowerActivationDate
|
|||
NLMISC::TGameCycle DeactivationDate;
|
||||
NLMISC::TGameCycle ActivationDate;
|
||||
|
||||
CPowerActivationDate() : PowerType(POWERS::UnknownType), ConsumableFamilyId((uint16)~0), DeactivationDate(0), ActivationDate(0)
|
||||
CPowerActivationDate() : PowerType(POWERS::UnknownType), ConsumableFamilyId(std::numeric_limits<uint16>::max()), DeactivationDate(0), ActivationDate(0)
|
||||
{}
|
||||
|
||||
CPowerActivationDate(POWERS::TPowerType type, uint16 consumableFamilyId, NLMISC::TGameCycle dateOff, NLMISC::TGameCycle dateOn) : PowerType(type), ConsumableFamilyId(consumableFamilyId), DeactivationDate(dateOff), ActivationDate(dateOn)
|
||||
|
|
|
@ -236,7 +236,7 @@ void CPVPFactionRewardManager::_totemFileCallback(const CFileDescription& fileDe
|
|||
static CPersistentDataRecordRyzomStore pdr;
|
||||
pdr.clear();
|
||||
pdr.fromBuffer(dataStream);
|
||||
// pdr.readFromFile( sFilePath.c_str() );
|
||||
// pdr.readFromFile( sFilePath );
|
||||
|
||||
apply( pdr );
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ bool CPVPFactionRewardManager::_LoadFromPDR()
|
|||
//
|
||||
// static CPersistentDataRecordRyzomStore pdr;
|
||||
// pdr.clear();
|
||||
// pdr.readFromFile( sFilePath.c_str() );
|
||||
// pdr.readFromFile( sFilePath );
|
||||
//
|
||||
// if ( pdr.isEndOfData() )
|
||||
// {
|
||||
|
|
|
@ -332,7 +332,7 @@ void CTotemBase::totemFileCallback(const CFileDescription& fileDescription, NLMI
|
|||
static CPersistentDataRecordRyzomStore pdr;
|
||||
pdr.clear();
|
||||
pdr.fromBuffer(dataStream);
|
||||
// pdr.readFromFile( sFilePath.c_str() );
|
||||
// pdr.readFromFile( sFilePath );
|
||||
|
||||
apply( pdr );
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ void CTotemBase::loadFromPDR()
|
|||
|
||||
// static CPersistentDataRecordRyzomStore pdr;
|
||||
// pdr.clear();
|
||||
// pdr.readFromFile( sFilePath.c_str() );
|
||||
// pdr.readFromFile( sFilePath );
|
||||
//
|
||||
// apply( pdr );
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ void CDynamicItems::init()
|
|||
// static CPersistentDataRecord pdr;
|
||||
// pdr.clear();
|
||||
//
|
||||
// pdr.readFromFile(fileName.c_str());
|
||||
// pdr.readFromFile(fileName);
|
||||
// apply(pdr, i);
|
||||
//
|
||||
// for( uint32 j = 0; j < subVec.size(); ++j )
|
||||
|
|
|
@ -68,7 +68,7 @@ void CNamedItems::loadNamedItemsFromFile(const std::string & fileName)
|
|||
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromTxtFile(path.c_str());
|
||||
pdr.readFromTxtFile(path);
|
||||
CInventoryPtr inv = loadFromPdr(pdr);
|
||||
if (inv == NULL)
|
||||
{
|
||||
|
|
|
@ -728,7 +728,7 @@ void CStatDB::valueLeaveFileCallback(const CFileDescription& fileDescription, N
|
|||
CStatDBValueLeavesPD valueLeavesPD;
|
||||
|
||||
pdr.fromBuffer(dataStream);
|
||||
// pdr.readFromFile(sFilePath.c_str());
|
||||
// pdr.readFromFile(sFilePath);
|
||||
valueLeavesPD.apply(pdr);
|
||||
nTotalLoaded += fileDescription.FileSize;
|
||||
|
||||
|
@ -791,7 +791,7 @@ void CStatDB::tableLeaveFileCallback(const CFileDescription& fileDescription, N
|
|||
CStatDBTableLeafPD tableLeafPD;
|
||||
|
||||
pdr.fromBuffer(dataStream);
|
||||
// pdr.readFromFile(fileName.c_str());
|
||||
// pdr.readFromFile(fileName);
|
||||
tableLeafPD.apply(pdr);
|
||||
nTotalLoaded += CFile::getFileSize(fileName);
|
||||
|
||||
|
@ -854,7 +854,7 @@ void CStatDB::load()
|
|||
// pdr.clear();
|
||||
// CStatDBValueLeavesPD valueLeavesPD;
|
||||
//
|
||||
// pdr.readFromFile(sFilePath.c_str());
|
||||
// pdr.readFromFile(sFilePath);
|
||||
// valueLeavesPD.apply(pdr);
|
||||
// nTotalLoaded += CFile::getFileSize(sFilePath);
|
||||
//
|
||||
|
@ -910,7 +910,7 @@ void CStatDB::load()
|
|||
// pdr.clear();
|
||||
// CStatDBTableLeafPD tableLeafPD;
|
||||
//
|
||||
// pdr.readFromFile(fileName.c_str());
|
||||
// pdr.readFromFile(fileName);
|
||||
// tableLeafPD.apply(pdr);
|
||||
// nTotalLoaded += CFile::getFileSize(fileName);
|
||||
//
|
||||
|
|
|
@ -62,7 +62,7 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeGuildIdFix,"set the guild ids in the
|
|||
// read the file
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(fdc[i].FileName.c_str());
|
||||
pdr.readFromFile(fdc[i].FileName);
|
||||
|
||||
// convert to XML
|
||||
NLMISC::CSString inputString;
|
||||
|
@ -80,8 +80,8 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeGuildIdFix,"set the guild ids in the
|
|||
pdr.fromXML(resultString);
|
||||
|
||||
// write the file
|
||||
pdr.writeToFile((fdc[i].FileName+".new.xml").c_str());
|
||||
pdr.writeToFile((fdc[i].FileName+".new.bin").c_str());
|
||||
pdr.writeToFile(fdc[i].FileName+".new.xml");
|
||||
pdr.writeToFile(fdc[i].FileName+".new.bin");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -109,7 +109,7 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeChangeCharacterNames,"change names of
|
|||
DROP_IF(!NLMISC::CFile::fileExists(fileName),"Skipping inexistant file: "+fileName,continue);
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(fileName.c_str());
|
||||
pdr.readFromFile(fileName);
|
||||
|
||||
// convert to XML
|
||||
NLMISC::CSString inputString;
|
||||
|
@ -127,8 +127,8 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeChangeCharacterNames,"change names of
|
|||
pdr.fromXML(resultString);
|
||||
|
||||
// write the file
|
||||
pdr.writeToFile((fileName+".new.xml").c_str());
|
||||
pdr.writeToFile((fileName+".new.bin").c_str());
|
||||
pdr.writeToFile(fileName+".new.xml");
|
||||
pdr.writeToFile(fileName+".new.bin");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -141,7 +141,7 @@ NLMISC_CATEGORISED_COMMAND(Stats,listCharNames,"display the names of the charact
|
|||
{
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(files[i].c_str());
|
||||
pdr.readFromFile(files[i]);
|
||||
|
||||
CStatsScanCharacter c;
|
||||
c.apply(pdr);
|
||||
|
|
|
@ -286,7 +286,7 @@ bool CCharacterScanJob::runForFile(const std::string& fileName)
|
|||
// load the file into a pdr record
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(fileName.c_str());
|
||||
pdr.readFromFile(fileName);
|
||||
|
||||
// create a character representation and apply the pdr
|
||||
CStatsScanCharacter c;
|
||||
|
|
|
@ -310,7 +310,7 @@ NLMISC_CATEGORISED_COMMAND(Stats,listCharNames,"display the names of the charact
|
|||
{
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(files[i].c_str());
|
||||
pdr.readFromFile(files[i]);
|
||||
|
||||
CStatsScanCharacter c;
|
||||
c.apply(pdr);
|
||||
|
|
|
@ -286,7 +286,7 @@ bool CCharacterScanJob::runForFile(const std::string& fileName)
|
|||
// load the file into a pdr record
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(fileName.c_str());
|
||||
pdr.readFromFile(fileName);
|
||||
|
||||
// create a character representation and apply the pdr
|
||||
CStatsScanCharacter c;
|
||||
|
|
|
@ -91,8 +91,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrBin2xml,"convert a binary pdr file to xml","
|
|||
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromBinFile(args[0].c_str());
|
||||
pdr.writeToTxtFile(args[1].c_str());
|
||||
pdr.readFromBinFile(args[0]);
|
||||
pdr.writeToTxtFile(args[1]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -108,8 +108,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrXml2bin,"convert a text pdr file to binary",
|
|||
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromTxtFile(args[0].c_str());
|
||||
pdr.writeToBinFile(args[1].c_str());
|
||||
pdr.readFromTxtFile(args[0]);
|
||||
pdr.writeToBinFile(args[1]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -138,8 +138,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2xml,"convert one or more sets of pdr files
|
|||
log.displayNL("Converting to XML : %s => %s",fd.FileName.c_str(),outputFileName.c_str());
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(fd.FileName.c_str());
|
||||
pdr.writeToFile(outputFileName.c_str());
|
||||
pdr.readFromFile(fd.FileName);
|
||||
pdr.writeToFile(outputFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,8 +170,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2bin,"convert one or more sets of pdr files
|
|||
log.displayNL("Converting to Binary : %s => %s",fd.FileName.c_str(),outputFileName.c_str());
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(fd.FileName.c_str());
|
||||
pdr.writeToFile(outputFileName.c_str());
|
||||
pdr.readFromFile(fd.FileName);
|
||||
pdr.writeToFile(outputFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,8 +202,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2txt,"convert one or more sets of pdr files
|
|||
log.displayNL("Converting to TXT : %s => %s",fd.FileName.c_str(),outputFileName.c_str());
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(fd.FileName.c_str());
|
||||
pdr.writeToFile(outputFileName.c_str());
|
||||
pdr.readFromFile(fd.FileName);
|
||||
pdr.writeToFile(outputFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,10 +218,10 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrFileCompare,"Compare 2 pdr files","<first fi
|
|||
return false;
|
||||
|
||||
CPersistentDataRecord pdr0;
|
||||
pdr0.readFromFile(args[0].c_str());
|
||||
pdr0.readFromFile(args[0]);
|
||||
|
||||
CPersistentDataRecord pdr1;
|
||||
pdr1.readFromFile(args[1].c_str());
|
||||
pdr1.readFromFile(args[1]);
|
||||
|
||||
log.displayNL("%s : %s / %s", (pdr0==pdr1)?"Files MATCH":"Files DON'T match", args[0].c_str(), args[1].c_str());
|
||||
|
||||
|
@ -272,8 +272,9 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrInfo,"Extract info from pdr file(s)","<input
|
|||
|
||||
{
|
||||
H_AUTO(pdrInfo_readFromFile)
|
||||
pdr.readFromFile(fd.FileName.c_str());
|
||||
pdr.readFromFile(fd.FileName);
|
||||
}
|
||||
|
||||
log.displayNL("%s", pdr.getInfo().c_str());
|
||||
|
||||
if (!outputFileName.empty())
|
||||
|
|
|
@ -189,7 +189,7 @@ void CPackageDescription::setup(const std::string& packageName)
|
|||
// read new contents from input file
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromTxtFile(packageName.c_str());
|
||||
pdr.readFromTxtFile(packageName);
|
||||
apply(pdr);
|
||||
|
||||
// root directory
|
||||
|
@ -229,30 +229,34 @@ void CPackageDescription::storeToPdr(CPersistentDataRecord& pdr) const
|
|||
|
||||
void CPackageDescription::readIndex(CBNPFileSet& packageIndex) const
|
||||
{
|
||||
nlinfo("Reading history file: %s ...",(_RootDirectory+_IndexFileName).c_str());
|
||||
std::string indexPath = _RootDirectory + _IndexFileName;
|
||||
|
||||
nlinfo("Reading history file: %s ...", indexPath.c_str());
|
||||
|
||||
// clear out old contents before reading from input file
|
||||
packageIndex.clear();
|
||||
|
||||
// read new contents from input file
|
||||
if (NLMISC::CFile::fileExists(_RootDirectory+_IndexFileName))
|
||||
if (NLMISC::CFile::fileExists(indexPath))
|
||||
{
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromTxtFile((_RootDirectory+_IndexFileName).c_str());
|
||||
pdr.readFromTxtFile(indexPath);
|
||||
packageIndex.apply(pdr);
|
||||
}
|
||||
}
|
||||
|
||||
void CPackageDescription::writeIndex(const CBNPFileSet& packageIndex) const
|
||||
{
|
||||
nlinfo("Writing history file: %s ...",(_RootDirectory+_IndexFileName).c_str());
|
||||
std::string indexPath = _RootDirectory + _IndexFileName;
|
||||
|
||||
nlinfo("Writing history file: %s ...", indexPath.c_str());
|
||||
|
||||
// write contents to output file
|
||||
static CPersistentDataRecordRyzomStore pdr;
|
||||
pdr.clear();
|
||||
packageIndex.store(pdr);
|
||||
pdr.writeToTxtFile((_RootDirectory+_IndexFileName).c_str());
|
||||
pdr.writeToTxtFile(indexPath);
|
||||
}
|
||||
|
||||
void CPackageDescription::getCategories(CPersistentDataRecord &pdr) const
|
||||
|
@ -287,10 +291,14 @@ void CPackageDescription::updateIndexFileList(CBNPFileSet& packageIndex) const
|
|||
|
||||
void CPackageDescription::generateClientIndex(CProductDescriptionForClient& theClientPackage, const CBNPFileSet& packageIndex) const
|
||||
{
|
||||
nlinfo("Generating client index: %s ...",(_PatchDirectory+toString("%05u/", packageIndex.getVersionNumber())+_ClientIndexFileName).c_str());
|
||||
std::string patchNumber = toString("%05u", packageIndex.getVersionNumber());
|
||||
std::string patchDirectory = _PatchDirectory + patchNumber;
|
||||
std::string patchFile = patchDirectory + "/" + _ClientIndexFileName;
|
||||
|
||||
nlinfo("Generating client index: %s...", patchFile.c_str());
|
||||
|
||||
// make sure the version sub directory exist
|
||||
CFile::createDirectory(_PatchDirectory+toString("%05u/", packageIndex.getVersionNumber()));
|
||||
CFile::createDirectory(patchDirectory);
|
||||
|
||||
// clear out the client package before we start
|
||||
theClientPackage.clear();
|
||||
|
@ -310,11 +318,10 @@ void CPackageDescription::generateClientIndex(CProductDescriptionForClient& theC
|
|||
pdr.clear();
|
||||
theClientPackage.store(pdr);
|
||||
|
||||
std::string newName = _PatchDirectory + toString("%05u/", packageIndex.getVersionNumber()) + NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName);
|
||||
newName += NLMISC::toString("_%05u", packageIndex.getVersionNumber());
|
||||
std::string newName = patchDirectory + "/" + NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName) + "_" + patchNumber;
|
||||
|
||||
pdr.writeToBinFile((newName+".idx").c_str());
|
||||
pdr.writeToTxtFile((newName+"_debug.xml").c_str());
|
||||
pdr.writeToBinFile(newName + ".idx");
|
||||
pdr.writeToTxtFile(newName + "_debug.xml");
|
||||
}
|
||||
|
||||
void CPackageDescription::addVersion(CBNPFileSet& packageIndex)
|
||||
|
@ -377,7 +384,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
|||
std::string refVersionFileName= prevVersionFileName;
|
||||
|
||||
// create the subdirectory for this patch number
|
||||
string versionSubDir = _PatchDirectory+"/"+toString("%05u/", curVersion.getVersionNumber());
|
||||
string versionSubDir = _PatchDirectory + toString("%05u/", curVersion.getVersionNumber());
|
||||
CFile::createDirectory(versionSubDir);
|
||||
|
||||
// generate the lzma packed version of the bnp if needed (lzma file are slow to generate)
|
||||
|
@ -548,12 +555,13 @@ static bool createNewProduct(std::string fileName)
|
|||
static CPersistentDataRecordRyzomStore pdr;
|
||||
pdr.clear();
|
||||
package.storeToPdr(pdr);
|
||||
pdr.writeToTxtFile(fileName.c_str());
|
||||
pdr.writeToTxtFile(fileName);
|
||||
package.setup(fileName);
|
||||
package.createDirectories();
|
||||
package.buildDefaultFileList();
|
||||
package.storeToPdr(pdr);
|
||||
pdr.writeToTxtFile(fileName.c_str());
|
||||
pdr.writeToTxtFile(fileName);
|
||||
|
||||
BOMB_IF(!NLMISC::CFile::fileExists(fileName),("Failed to create new package file: "+fileName).c_str(),return false);
|
||||
nlinfo("New package description file created successfully: %s", fileName.c_str());
|
||||
|
||||
|
|
|
@ -258,25 +258,25 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
else
|
||||
printf("Converting '%s' (XML) to '%s' (BINARY)\n", fileName.c_str(), outputFileName.c_str() );
|
||||
if (!pdr.readFromTxtFile(fileName.c_str()))
|
||||
if (!pdr.readFromTxtFile(fileName))
|
||||
goto failureRead;
|
||||
if (!pdr.writeToBinFile(outputFileName.c_str()))
|
||||
if (!pdr.writeToBinFile(outputFileName))
|
||||
goto failureWrite;
|
||||
break;
|
||||
|
||||
case cm_to_xml:
|
||||
printf("Converting '%s' (BINARY) to '%s' (XML)\n", fileName.c_str(), outputFileName.c_str() );
|
||||
if (!pdr.readFromBinFile(fileName.c_str()))
|
||||
if (!pdr.readFromBinFile(fileName))
|
||||
goto failureRead;
|
||||
if (!pdr.writeToTxtFile(outputFileName.c_str(), CPersistentDataRecord::XML_STRING))
|
||||
if (!pdr.writeToTxtFile(outputFileName, CPersistentDataRecord::XML_STRING))
|
||||
goto failureWrite;
|
||||
break;
|
||||
|
||||
case cm_to_txt:
|
||||
printf("Converting '%s' (BINARY) to '%s' (TXT)\n", fileName.c_str(), outputFileName.c_str() );
|
||||
if (!pdr.readFromBinFile(fileName.c_str()))
|
||||
if (!pdr.readFromBinFile(fileName))
|
||||
goto failureRead;
|
||||
if (!pdr.writeToTxtFile(outputFileName.c_str(), CPersistentDataRecord::LINES_STRING))
|
||||
if (!pdr.writeToTxtFile(outputFileName, CPersistentDataRecord::LINES_STRING))
|
||||
goto failureWrite;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -142,7 +142,7 @@ NLMISC_COMMAND(listCharNames,"display the names of the characters int he listed
|
|||
{
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(files[i].c_str());
|
||||
pdr.readFromFile(files[i]);
|
||||
|
||||
CStatsScanCharacter c;
|
||||
c.apply(pdr);
|
||||
|
|
|
@ -99,7 +99,7 @@ void CCharacterScanJob::update()
|
|||
// load the file into a pdr record
|
||||
static CPersistentDataRecord pdr;
|
||||
pdr.clear();
|
||||
pdr.readFromFile(_Files[_NextFile].c_str());
|
||||
pdr.readFromFile(_Files[_NextFile]);
|
||||
++_NextFile;
|
||||
|
||||
// create a character representation and apply the pdr
|
||||
|
|
Loading…
Reference in a new issue