Merge with develop
This commit is contained in:
parent
56e4734e3d
commit
46b82be25e
62 changed files with 592 additions and 409 deletions
|
@ -15,48 +15,76 @@ IF(NOT NDK_ROOT)
|
||||||
|
|
||||||
IF(CMAKE_HOST_WIN32)
|
IF(CMAKE_HOST_WIN32)
|
||||||
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
|
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
|
||||||
ENDIF(CMAKE_HOST_WIN32)
|
ENDIF()
|
||||||
ENDIF(NOT NDK_ROOT)
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT TARGET_CPU)
|
IF(NOT TARGET_CPU)
|
||||||
SET(TARGET_CPU "armv7")
|
SET(TARGET_CPU "armv7")
|
||||||
ENDIF(NOT TARGET_CPU)
|
ENDIF()
|
||||||
|
|
||||||
|
SET(ARMV7_HARD_FLOAT OFF)
|
||||||
|
|
||||||
IF(TARGET_CPU STREQUAL "armv7")
|
IF(TARGET_CPU STREQUAL "armv7")
|
||||||
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
|
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
|
||||||
|
IF(ARMV7_HARD_FLOAT)
|
||||||
|
SET(LIBRARY_ARCHITECTURE "${LIBRARY_ARCHITECTURE}-hard")
|
||||||
|
ENDIF()
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||||
SET(TOOLCHAIN_ARCH "arm")
|
SET(TOOLCHAIN_ARCH "arm")
|
||||||
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
||||||
SET(TOOLCHAIN_BIN_PREFIX "arm")
|
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
|
||||||
SET(MINIMUM_NDK_TARGET 4)
|
SET(MINIMUM_NDK_TARGET 4)
|
||||||
ELSEIF(TARGET_CPU STREQUAL "armv5")
|
ELSEIF(TARGET_CPU STREQUAL "armv5")
|
||||||
SET(LIBRARY_ARCHITECTURE "armeabi")
|
SET(LIBRARY_ARCHITECTURE "armeabi")
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
|
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
|
||||||
SET(TOOLCHAIN_ARCH "arm")
|
SET(TOOLCHAIN_ARCH "arm")
|
||||||
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
||||||
SET(TOOLCHAIN_BIN_PREFIX "arm")
|
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
|
||||||
SET(MINIMUM_NDK_TARGET 4)
|
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")
|
ELSEIF(TARGET_CPU STREQUAL "x86")
|
||||||
SET(LIBRARY_ARCHITECTURE "x86")
|
SET(LIBRARY_ARCHITECTURE "x86")
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||||
SET(TOOLCHAIN_ARCH "x86")
|
SET(TOOLCHAIN_ARCH "x86")
|
||||||
SET(GCC_TOOLCHAIN_PREFIX "x86")
|
SET(GCC_TOOLCHAIN_PREFIX "x86")
|
||||||
SET(TOOLCHAIN_BIN_PREFIX "i686")
|
SET(TOOLCHAIN_BIN_PREFIX "i686-linux-android")
|
||||||
SET(MINIMUM_NDK_TARGET 9)
|
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")
|
ELSEIF(TARGET_CPU STREQUAL "mips")
|
||||||
SET(LIBRARY_ARCHITECTURE "mips")
|
SET(LIBRARY_ARCHITECTURE "mips")
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "mips")
|
SET(CMAKE_SYSTEM_PROCESSOR "mips")
|
||||||
SET(TOOLCHAIN_ARCH "mips")
|
SET(TOOLCHAIN_ARCH "mips")
|
||||||
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
|
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
|
||||||
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
|
SET(TOOLCHAIN_BIN_PREFIX "mipsel-linux-android")
|
||||||
SET(MINIMUM_NDK_TARGET 9)
|
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")
|
SET(ANDROID_COMPILER "GCC")
|
||||||
|
|
||||||
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
|
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
|
||||||
SET(ANDROID_COMPILER "clang")
|
SET(ANDROID_COMPILER "clang")
|
||||||
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
|
|
||||||
SET(CLANG ON)
|
SET(CLANG ON)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
|
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
|
||||||
|
@ -64,7 +92,11 @@ ENDIF()
|
||||||
|
|
||||||
IF(NOT NDK_TARGET)
|
IF(NOT NDK_TARGET)
|
||||||
SET(NDK_TARGET ${MINIMUM_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)
|
IF(CMAKE_HOST_WIN32)
|
||||||
SET(TOOLCHAIN_HOST "windows")
|
SET(TOOLCHAIN_HOST "windows")
|
||||||
|
@ -75,7 +107,7 @@ ELSEIF(CMAKE_HOST_APPLE)
|
||||||
ELSEIF(CMAKE_HOST_UNIX)
|
ELSEIF(CMAKE_HOST_UNIX)
|
||||||
SET(TOOLCHAIN_HOST "linux")
|
SET(TOOLCHAIN_HOST "linux")
|
||||||
SET(TOOLCHAIN_BIN_SUFFIX "")
|
SET(TOOLCHAIN_BIN_SUFFIX "")
|
||||||
ENDIF(CMAKE_HOST_WIN32)
|
ENDIF()
|
||||||
|
|
||||||
MACRO(SEARCH_TOOLCHAIN _COMPILER)
|
MACRO(SEARCH_TOOLCHAIN _COMPILER)
|
||||||
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
|
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
|
||||||
|
@ -110,7 +142,7 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER)
|
||||||
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
|
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
|
||||||
IF(_TOOLCHAIN_PREFIXES)
|
IF(_TOOLCHAIN_PREFIXES)
|
||||||
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
|
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
|
||||||
ENDIF(_TOOLCHAIN_PREFIXES)
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
||||||
|
@ -123,8 +155,14 @@ ENDIF()
|
||||||
SEARCH_TOOLCHAIN(GCC)
|
SEARCH_TOOLCHAIN(GCC)
|
||||||
|
|
||||||
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
|
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
|
||||||
MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
|
|
||||||
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
|
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}")
|
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}")
|
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
||||||
# NDK version >= 8b
|
# NDK version >= 8b
|
||||||
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
||||||
ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
ENDIF()
|
||||||
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
|
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
|
||||||
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
|
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_LIBRARY ONLY)
|
||||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
|
||||||
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
|
MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY)
|
||||||
IF("${_BINARY}" MATCHES "clang")
|
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
|
||||||
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
|
ENDMACRO()
|
||||||
ELSE()
|
|
||||||
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
|
MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY)
|
||||||
ENDIF()
|
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
|
||||||
ENDMACRO(SET_TOOLCHAIN_BINARY)
|
ENDMACRO()
|
||||||
|
|
||||||
# Force the compilers to GCC for Android
|
# Force the compilers to GCC for Android
|
||||||
include (CMakeForceCompiler)
|
include (CMakeForceCompiler)
|
||||||
|
|
||||||
IF(CLANG)
|
IF(CLANG)
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
|
MESSAGE(STATUS "Using clang compiler")
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
|
|
||||||
|
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_C_COMPILER(${CMAKE_C_COMPILER} clang)
|
||||||
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_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()
|
ELSE()
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
|
MESSAGE(STATUS "Using GCC compiler")
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
|
|
||||||
|
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_C_COMPILER(${CMAKE_C_COMPILER} GNU)
|
||||||
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_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()
|
ENDIF()
|
||||||
|
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip)
|
SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip)
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_AR ar)
|
SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm)
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld)
|
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJCOPY objcopy)
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_NM nm)
|
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJDUMP objdump)
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy)
|
SET_TOOLCHAIN_BINARY_GCC(CMAKE_RANLIB ranlib)
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
|
|
||||||
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
if(MAXSDK_INCLUDE_DIR)
|
if(MAXSDK_INCLUDE_DIR)
|
||||||
# Already in cache, be silent
|
# Already in cache, be silent
|
||||||
SET(MAXSDK_FIND_QUIETLY TRUE)
|
SET(MAXSDK_FIND_QUIETLY TRUE)
|
||||||
endif(MAXSDK_INCLUDE_DIR)
|
endif()
|
||||||
|
|
||||||
FIND_PATH(MAXSDK_DIR
|
FIND_PATH(MAXSDK_DIR
|
||||||
"include/maxversion.h"
|
"include/maxversion.h"
|
||||||
|
@ -37,9 +37,9 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
|
||||||
|
|
||||||
IF(TARGET_X64)
|
IF(TARGET_X64)
|
||||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
|
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
|
||||||
ELSE(TARGET_X64)
|
ELSE()
|
||||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
|
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
|
||||||
ENDIF(TARGET_X64)
|
ENDIF()
|
||||||
|
|
||||||
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||||
FIND_LIBRARY(${MYLIBRARY}
|
FIND_LIBRARY(${MYLIBRARY}
|
||||||
|
@ -47,7 +47,7 @@ MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||||
HINTS
|
HINTS
|
||||||
${MAXSDK_LIBRARY_DIRS}
|
${MAXSDK_LIBRARY_DIRS}
|
||||||
)
|
)
|
||||||
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
ENDMACRO()
|
||||||
|
|
||||||
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
||||||
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
|
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
|
||||||
|
|
|
@ -45,6 +45,6 @@ IF(MFC_FOUND)
|
||||||
|
|
||||||
# Set CMake flag to use MFC DLL
|
# Set CMake flag to use MFC DLL
|
||||||
SET(CMAKE_MFC_FLAG 2)
|
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
|
# 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
|
HINTS
|
||||||
"${DXSDK_LIBRARY_DIR}"
|
"${DXSDK_LIBRARY_DIR}"
|
||||||
)
|
)
|
||||||
ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
ENDMACRO()
|
||||||
|
|
||||||
IF(DXSDK_DIR)
|
IF(DXSDK_DIR)
|
||||||
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
|
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
|
||||||
|
|
||||||
IF(TARGET_X64)
|
IF(TARGET_X64)
|
||||||
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x64 ${DXSDK_DIR}/lib/amd64)
|
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)
|
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x86 ${DXSDK_DIR}/lib)
|
||||||
ENDIF(TARGET_X64)
|
ENDIF()
|
||||||
|
|
||||||
FIND_PATH(DXSDK_LIBRARY_DIR
|
FIND_PATH(DXSDK_LIBRARY_DIR
|
||||||
dxguid.lib
|
dxguid.lib
|
||||||
|
@ -52,7 +52,7 @@ IF(DXSDK_DIR)
|
||||||
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
|
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
|
||||||
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
|
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
|
||||||
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
|
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
|
||||||
ENDIF(DXSDK_DIR)
|
ENDIF()
|
||||||
|
|
||||||
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
|
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
|
||||||
# all listed variables are TRUE.
|
# 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)
|
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")
|
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||||
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
|
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
|
||||||
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
ENDIF()
|
||||||
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
|
ENDIF()
|
||||||
|
|
||||||
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||||
SET(VC${_VERSION}_FOUND ON)
|
SET(VC${_VERSION}_FOUND ON)
|
||||||
|
@ -24,14 +24,14 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
|
||||||
SET(_VERSION_STR ${_VERSION})
|
SET(_VERSION_STR ${_VERSION})
|
||||||
IF(MSVC_EXPRESS)
|
IF(MSVC_EXPRESS)
|
||||||
SET(_VERSION_STR "${_VERSION_STR} Express")
|
SET(_VERSION_STR "${_VERSION_STR} Express")
|
||||||
ENDIF(MSVC_EXPRESS)
|
ENDIF()
|
||||||
MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}")
|
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")
|
ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||||
SET(VC${_VERSION}_FOUND OFF)
|
SET(VC${_VERSION}_FOUND OFF)
|
||||||
SET(VC${_VERSION}_DIR "")
|
SET(VC${_VERSION}_DIR "")
|
||||||
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
ENDIF()
|
||||||
ENDMACRO(DETECT_VC_VERSION_HELPER)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(DETECT_VC_VERSION _VERSION)
|
MACRO(DETECT_VC_VERSION _VERSION)
|
||||||
SET(VC${_VERSION}_FOUND OFF)
|
SET(VC${_VERSION}_FOUND OFF)
|
||||||
|
@ -39,21 +39,21 @@ MACRO(DETECT_VC_VERSION _VERSION)
|
||||||
|
|
||||||
IF(NOT VC${_VERSION}_FOUND)
|
IF(NOT VC${_VERSION}_FOUND)
|
||||||
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
||||||
ENDIF(NOT VC${_VERSION}_FOUND)
|
ENDIF()
|
||||||
|
|
||||||
IF(VC${_VERSION}_FOUND)
|
IF(VC${_VERSION}_FOUND)
|
||||||
SET(VC_FOUND ON)
|
SET(VC_FOUND ON)
|
||||||
SET(VC_DIR "${VC${_VERSION}_DIR}")
|
SET(VC_DIR "${VC${_VERSION}_DIR}")
|
||||||
ENDIF(VC${_VERSION}_FOUND)
|
ENDIF()
|
||||||
ENDMACRO(DETECT_VC_VERSION)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(DETECT_EXPRESS_VERSION _VERSION)
|
MACRO(DETECT_EXPRESS_VERSION _VERSION)
|
||||||
GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE)
|
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")
|
IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
|
||||||
SET(MSVC_EXPRESS ON)
|
SET(MSVC_EXPRESS ON)
|
||||||
ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
|
ENDIF()
|
||||||
ENDMACRO(DETECT_EXPRESS_VERSION)
|
ENDMACRO()
|
||||||
|
|
||||||
IF(MSVC12)
|
IF(MSVC12)
|
||||||
DETECT_VC_VERSION("12.0")
|
DETECT_VC_VERSION("12.0")
|
||||||
|
@ -62,7 +62,7 @@ IF(MSVC12)
|
||||||
IF(NOT MSVC12_REDIST_DIR)
|
IF(NOT MSVC12_REDIST_DIR)
|
||||||
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||||
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||||
ENDIF(NOT MSVC12_REDIST_DIR)
|
ENDIF()
|
||||||
ELSEIF(MSVC11)
|
ELSEIF(MSVC11)
|
||||||
DETECT_VC_VERSION("11.0")
|
DETECT_VC_VERSION("11.0")
|
||||||
SET(MSVC_TOOLSET "110")
|
SET(MSVC_TOOLSET "110")
|
||||||
|
@ -70,7 +70,7 @@ ELSEIF(MSVC11)
|
||||||
IF(NOT MSVC11_REDIST_DIR)
|
IF(NOT MSVC11_REDIST_DIR)
|
||||||
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||||
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||||
ENDIF(NOT MSVC11_REDIST_DIR)
|
ENDIF()
|
||||||
ELSEIF(MSVC10)
|
ELSEIF(MSVC10)
|
||||||
DETECT_VC_VERSION("10.0")
|
DETECT_VC_VERSION("10.0")
|
||||||
SET(MSVC_TOOLSET "100")
|
SET(MSVC_TOOLSET "100")
|
||||||
|
@ -78,19 +78,19 @@ ELSEIF(MSVC10)
|
||||||
IF(NOT MSVC10_REDIST_DIR)
|
IF(NOT MSVC10_REDIST_DIR)
|
||||||
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||||
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||||
ENDIF(NOT MSVC10_REDIST_DIR)
|
ENDIF()
|
||||||
ELSEIF(MSVC90)
|
ELSEIF(MSVC90)
|
||||||
DETECT_VC_VERSION("9.0")
|
DETECT_VC_VERSION("9.0")
|
||||||
SET(MSVC_TOOLSET "90")
|
SET(MSVC_TOOLSET "90")
|
||||||
ELSEIF(MSVC80)
|
ELSEIF(MSVC80)
|
||||||
DETECT_VC_VERSION("8.0")
|
DETECT_VC_VERSION("8.0")
|
||||||
SET(MSVC_TOOLSET "80")
|
SET(MSVC_TOOLSET "80")
|
||||||
ENDIF(MSVC12)
|
ENDIF()
|
||||||
|
|
||||||
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
|
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
|
||||||
IF(NOT VC_DIR)
|
IF(NOT VC_DIR)
|
||||||
SET(VC_DIR $ENV{VC_DIR})
|
SET(VC_DIR $ENV{VC_DIR})
|
||||||
ENDIF(NOT VC_DIR)
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT VC_DIR)
|
IF(NOT VC_DIR)
|
||||||
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
|
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
# MESSAGE("Current revision is ${Project_WC_REVISION}")
|
# MESSAGE("Current revision is ${Project_WC_REVISION}")
|
||||||
# Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project)
|
# Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project)
|
||||||
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
|
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
|
||||||
# ENDIF(MERCURIAL_FOUND)
|
# ENDIF()
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Copyright 2006-2009 Kitware, Inc.
|
# Copyright 2006-2009 Kitware, Inc.
|
||||||
|
@ -74,22 +74,22 @@ IF(Mercurial_HG_EXECUTABLE)
|
||||||
|
|
||||||
IF(NOT ${Mercurial_hg_info_result} EQUAL 0)
|
IF(NOT ${Mercurial_hg_info_result} EQUAL 0)
|
||||||
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}")
|
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)
|
LIST(LENGTH ${prefix}_WC_INFO _COUNT)
|
||||||
IF(_COUNT EQUAL 4)
|
IF(_COUNT EQUAL 4)
|
||||||
LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
|
LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
|
||||||
LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
|
LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
|
||||||
LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
|
LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
|
||||||
LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
|
LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
|
||||||
ELSE(_COUNT EQUAL 4)
|
ELSE()
|
||||||
MESSAGE(STATUS "Bad output from HG")
|
MESSAGE(STATUS "Bad output from HG")
|
||||||
SET(${prefix}_WC_REVISION "unknown")
|
SET(${prefix}_WC_REVISION "unknown")
|
||||||
SET(${prefix}_WC_CHANGESET "unknown")
|
SET(${prefix}_WC_CHANGESET "unknown")
|
||||||
SET(${prefix}_WC_BRANCH "unknown")
|
SET(${prefix}_WC_BRANCH "unknown")
|
||||||
ENDIF(_COUNT EQUAL 4)
|
ENDIF()
|
||||||
ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0)
|
ENDIF()
|
||||||
|
|
||||||
ENDMACRO(Mercurial_WC_INFO)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(Mercurial_WC_LOG dir prefix)
|
MACRO(Mercurial_WC_LOG dir prefix)
|
||||||
# This macro can block if the certificate is not signed:
|
# 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)
|
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}")
|
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)
|
ENDIF()
|
||||||
ENDMACRO(Mercurial_WC_LOG)
|
ENDMACRO()
|
||||||
ENDIF(Mercurial_HG_EXECUTABLE)
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
IF(WINSDK_FOUND)
|
IF(WINSDK_FOUND)
|
||||||
# If Windows SDK already found, skip it
|
# If Windows SDK already found, skip it
|
||||||
RETURN()
|
RETURN()
|
||||||
ENDIF(WINSDK_FOUND)
|
ENDIF()
|
||||||
|
|
||||||
# Values can be CURRENT or any existing versions 7.1, 8.0A, etc...
|
# Values can be CURRENT or any existing versions 7.1, 8.0A, etc...
|
||||||
SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer")
|
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)
|
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||||
ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
||||||
SET(WINSDK${_VERSION}_DIR "")
|
SET(WINSDK${_VERSION}_DIR "")
|
||||||
ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
ENDIF()
|
||||||
ENDMACRO(DETECT_WINSDK_VERSION_HELPER)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(DETECT_WINSDK_VERSION _VERSION)
|
MACRO(DETECT_WINSDK_VERSION _VERSION)
|
||||||
SET(WINSDK${_VERSION}_FOUND OFF)
|
SET(WINSDK${_VERSION}_FOUND OFF)
|
||||||
|
@ -34,8 +34,8 @@ MACRO(DETECT_WINSDK_VERSION _VERSION)
|
||||||
|
|
||||||
IF(NOT WINSDK${_VERSION}_FOUND)
|
IF(NOT WINSDK${_VERSION}_FOUND)
|
||||||
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
||||||
ENDIF(NOT WINSDK${_VERSION}_FOUND)
|
ENDIF()
|
||||||
ENDMACRO(DETECT_WINSDK_VERSION)
|
ENDMACRO()
|
||||||
|
|
||||||
SET(WINSDK_VERSIONS "8.1" "8.0" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
|
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)
|
SET(WINSDK_DETECTED_VERSIONS)
|
||||||
|
@ -46,8 +46,8 @@ FOREACH(_VERSION ${WINSDK_VERSIONS})
|
||||||
|
|
||||||
IF(WINSDK${_VERSION}_FOUND)
|
IF(WINSDK${_VERSION}_FOUND)
|
||||||
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
|
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
|
||||||
ENDIF(WINSDK${_VERSION}_FOUND)
|
ENDIF()
|
||||||
ENDFOREACH(_VERSION)
|
ENDFOREACH()
|
||||||
|
|
||||||
SET(WINSDK_SUFFIX)
|
SET(WINSDK_SUFFIX)
|
||||||
|
|
||||||
|
@ -58,19 +58,19 @@ ELSEIF(TARGET_X64)
|
||||||
SET(WINSDK_SUFFIX "x64")
|
SET(WINSDK_SUFFIX "x64")
|
||||||
ELSEIF(TARGET_X86)
|
ELSEIF(TARGET_X86)
|
||||||
SET(WINSDK8_SUFFIX "x86")
|
SET(WINSDK8_SUFFIX "x86")
|
||||||
ENDIF(TARGET_ARM)
|
ENDIF()
|
||||||
|
|
||||||
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
|
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
|
||||||
|
|
||||||
IF(WINSDKCURRENT_VERSION_INCLUDE)
|
IF(WINSDKCURRENT_VERSION_INCLUDE)
|
||||||
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
|
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
|
||||||
ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
|
ENDIF()
|
||||||
|
|
||||||
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
|
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
|
||||||
|
|
||||||
IF(NOT WINSDKENV_DIR)
|
IF(NOT WINSDKENV_DIR)
|
||||||
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
|
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
|
||||||
ENDIF(NOT WINSDKENV_DIR)
|
ENDIF()
|
||||||
|
|
||||||
MACRO(FIND_WINSDK_VERSION_HEADERS)
|
MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||||
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
|
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
|
||||||
|
@ -88,8 +88,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||||
|
|
||||||
IF(_CONTENT)
|
IF(_CONTENT)
|
||||||
SET(WINSDK_VERSION "8.1")
|
SET(WINSDK_VERSION "8.1")
|
||||||
ENDIF(_CONTENT)
|
ENDIF()
|
||||||
ENDIF(NOT WINSDK_VERSION)
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT WINSDK_VERSION)
|
IF(NOT WINSDK_VERSION)
|
||||||
# Look for Windows SDK 8.0
|
# Look for Windows SDK 8.0
|
||||||
|
@ -97,8 +97,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||||
|
|
||||||
IF(_CONTENT)
|
IF(_CONTENT)
|
||||||
SET(WINSDK_VERSION "8.0")
|
SET(WINSDK_VERSION "8.0")
|
||||||
ENDIF(_CONTENT)
|
ENDIF()
|
||||||
ENDIF(NOT WINSDK_VERSION)
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT WINSDK_VERSION)
|
IF(NOT WINSDK_VERSION)
|
||||||
# Look for Windows SDK 7.0
|
# Look for Windows SDK 7.0
|
||||||
|
@ -123,14 +123,14 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||||
SET(WINSDK_VERSION "7.1")
|
SET(WINSDK_VERSION "7.1")
|
||||||
ELSEIF(_WINSDKVER STREQUAL "0601")
|
ELSEIF(_WINSDKVER STREQUAL "0601")
|
||||||
SET(WINSDK_VERSION "7.0A")
|
SET(WINSDK_VERSION "7.0A")
|
||||||
ELSE(_WINSDKVER STREQUAL "06010000")
|
ELSE()
|
||||||
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
|
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
|
||||||
ENDIF(_WINSDKVER STREQUAL "06010000")
|
ENDIF()
|
||||||
ELSE(_WINSDKVER_FILE)
|
ELSE()
|
||||||
SET(WINSDK_VERSION "7.0")
|
SET(WINSDK_VERSION "7.0")
|
||||||
ENDIF(_WINSDKVER_FILE)
|
ENDIF()
|
||||||
ENDIF(_CONTENT)
|
ENDIF()
|
||||||
ENDIF(NOT WINSDK_VERSION)
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT WINSDK_VERSION)
|
IF(NOT WINSDK_VERSION)
|
||||||
# Look for Windows SDK 6.0
|
# Look for Windows SDK 6.0
|
||||||
|
@ -138,8 +138,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||||
|
|
||||||
IF(_CONTENT)
|
IF(_CONTENT)
|
||||||
SET(WINSDK_VERSION "6.0")
|
SET(WINSDK_VERSION "6.0")
|
||||||
ENDIF(_CONTENT)
|
ENDIF()
|
||||||
ENDIF(NOT WINSDK_VERSION)
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT WINSDK_VERSION)
|
IF(NOT WINSDK_VERSION)
|
||||||
# Look for Windows SDK 5.2
|
# Look for Windows SDK 5.2
|
||||||
|
@ -147,8 +147,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||||
|
|
||||||
IF(_CONTENT)
|
IF(_CONTENT)
|
||||||
SET(WINSDK_VERSION "5.2")
|
SET(WINSDK_VERSION "5.2")
|
||||||
ENDIF(_CONTENT)
|
ENDIF()
|
||||||
ENDIF(NOT WINSDK_VERSION)
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT WINSDK_VERSION)
|
IF(NOT WINSDK_VERSION)
|
||||||
# Look for Windows SDK 5.1
|
# Look for Windows SDK 5.1
|
||||||
|
@ -156,8 +156,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||||
|
|
||||||
IF(_CONTENT)
|
IF(_CONTENT)
|
||||||
SET(WINSDK_VERSION "5.1")
|
SET(WINSDK_VERSION "5.1")
|
||||||
ENDIF(_CONTENT)
|
ENDIF()
|
||||||
ENDIF(NOT WINSDK_VERSION)
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT WINSDK_VERSION)
|
IF(NOT WINSDK_VERSION)
|
||||||
# Look for Windows SDK 5.0
|
# Look for Windows SDK 5.0
|
||||||
|
@ -165,13 +165,13 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||||
|
|
||||||
IF(_CONTENT)
|
IF(_CONTENT)
|
||||||
SET(WINSDK_VERSION "5.0")
|
SET(WINSDK_VERSION "5.0")
|
||||||
ENDIF(_CONTENT)
|
ENDIF()
|
||||||
ENDIF(NOT WINSDK_VERSION)
|
ENDIF()
|
||||||
ELSE(_MSI_FILE)
|
ELSE()
|
||||||
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
|
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
|
||||||
ENDIF(_MSI_FILE)
|
ENDIF()
|
||||||
ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION)
|
ENDIF()
|
||||||
ENDMACRO(FIND_WINSDK_VERSION_HEADERS)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(USE_CURRENT_WINSDK)
|
MACRO(USE_CURRENT_WINSDK)
|
||||||
SET(WINSDK_DIR "")
|
SET(WINSDK_DIR "")
|
||||||
|
@ -185,7 +185,7 @@ MACRO(USE_CURRENT_WINSDK)
|
||||||
${WINSDKENV_DIR}/Include/um
|
${WINSDKENV_DIR}/Include/um
|
||||||
${WINSDKENV_DIR}/Include
|
${WINSDKENV_DIR}/Include
|
||||||
)
|
)
|
||||||
ENDIF(WINSDKENV_DIR)
|
ENDIF()
|
||||||
|
|
||||||
# Use INCLUDE environment variable
|
# Use INCLUDE environment variable
|
||||||
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
|
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})
|
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
|
||||||
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
|
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
|
||||||
BREAK()
|
BREAK()
|
||||||
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
|
ENDIF()
|
||||||
ENDFOREACH(_INCLUDE)
|
ENDFOREACH()
|
||||||
ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
|
ENDIF()
|
||||||
|
|
||||||
IF(WINSDK_DIR)
|
IF(WINSDK_DIR)
|
||||||
# Compare WINSDK_DIR with registered Windows SDKs
|
# Compare WINSDK_DIR with registered Windows SDKs
|
||||||
|
@ -208,11 +208,11 @@ MACRO(USE_CURRENT_WINSDK)
|
||||||
SET(WINSDK_VERSION ${_VERSION})
|
SET(WINSDK_VERSION ${_VERSION})
|
||||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||||
BREAK()
|
BREAK()
|
||||||
ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
|
ENDIF()
|
||||||
ENDFOREACH(_VERSION)
|
ENDFOREACH()
|
||||||
|
|
||||||
FIND_WINSDK_VERSION_HEADERS()
|
FIND_WINSDK_VERSION_HEADERS()
|
||||||
ENDIF(WINSDK_DIR)
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT WINSDK_DIR)
|
IF(NOT WINSDK_DIR)
|
||||||
# Use Windows SDK versions installed with VC++ when possible
|
# Use Windows SDK versions installed with VC++ when possible
|
||||||
|
@ -223,19 +223,19 @@ MACRO(USE_CURRENT_WINSDK)
|
||||||
ELSEIF(MSVC10)
|
ELSEIF(MSVC10)
|
||||||
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||||
SET(WINSDK_VERSION "7.0A")
|
SET(WINSDK_VERSION "7.0A")
|
||||||
ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
ENDIF()
|
||||||
ELSEIF(MSVC90)
|
ELSEIF(MSVC90)
|
||||||
IF(NOT MSVC_EXPRESS)
|
IF(NOT MSVC_EXPRESS)
|
||||||
SET(WINSDK_VERSION "6.0A")
|
SET(WINSDK_VERSION "6.0A")
|
||||||
ENDIF(NOT MSVC_EXPRESS)
|
ENDIF()
|
||||||
ELSEIF(MSVC80)
|
ELSEIF(MSVC80)
|
||||||
IF(NOT MSVC_EXPRESS)
|
IF(NOT MSVC_EXPRESS)
|
||||||
# TODO: fix this version
|
# TODO: fix this version
|
||||||
SET(WINSDK_VERSION "5.2A")
|
SET(WINSDK_VERSION "5.2A")
|
||||||
ENDIF(NOT MSVC_EXPRESS)
|
ENDIF()
|
||||||
ELSE(MSVC12)
|
ELSE()
|
||||||
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
|
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
|
||||||
ENDIF(MSVC12)
|
ENDIF()
|
||||||
|
|
||||||
# Use installed Windows SDK
|
# Use installed Windows SDK
|
||||||
IF(NOT WINSDK_VERSION)
|
IF(NOT WINSDK_VERSION)
|
||||||
|
@ -262,27 +262,27 @@ MACRO(USE_CURRENT_WINSDK)
|
||||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||||
BREAK()
|
BREAK()
|
||||||
ENDIF(WINSDK_VERSION STREQUAL _VERSION)
|
ENDIF()
|
||||||
ENDFOREACH(_VERSION)
|
ENDFOREACH()
|
||||||
ENDIF(NOT WINSDK_DIR)
|
ENDIF()
|
||||||
ENDMACRO(USE_CURRENT_WINSDK)
|
ENDMACRO()
|
||||||
|
|
||||||
IF(WINSDK_VERSION STREQUAL "CURRENT")
|
IF(WINSDK_VERSION STREQUAL "CURRENT")
|
||||||
USE_CURRENT_WINSDK()
|
USE_CURRENT_WINSDK()
|
||||||
ELSE(WINSDK_VERSION STREQUAL "CURRENT")
|
ELSE()
|
||||||
IF(WINSDK${WINSDK_VERSION}_FOUND)
|
IF(WINSDK${WINSDK_VERSION}_FOUND)
|
||||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||||
ELSE(WINSDK${WINSDK_VERSION}_FOUND)
|
ELSE()
|
||||||
USE_CURRENT_WINSDK()
|
USE_CURRENT_WINSDK()
|
||||||
ENDIF(WINSDK${WINSDK_VERSION}_FOUND)
|
ENDIF()
|
||||||
ENDIF(WINSDK_VERSION STREQUAL "CURRENT")
|
ENDIF()
|
||||||
|
|
||||||
IF(WINSDK_DIR)
|
IF(WINSDK_DIR)
|
||||||
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
|
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
|
||||||
ELSE(WINSDK_DIR)
|
ELSE()
|
||||||
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
|
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
|
||||||
ENDIF(WINSDK_DIR)
|
ENDIF()
|
||||||
|
|
||||||
# directory where Win32 headers are found
|
# directory where Win32 headers are found
|
||||||
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
|
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
|
# Fix for using Windows SDK 7.1 with Visual C++ 2012
|
||||||
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
||||||
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
|
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
|
||||||
ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
ENDIF()
|
||||||
ELSE(WINSDK_INCLUDE_DIR)
|
ELSE()
|
||||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||||
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
|
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
|
||||||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
ENDIF()
|
||||||
ENDIF(WINSDK_INCLUDE_DIR)
|
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)
|
# 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)
|
# 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)
|
IF(SOURCE_DIR)
|
||||||
# Replace spaces by semi-columns
|
# Replace spaces by semi-columns
|
||||||
|
|
|
@ -40,12 +40,15 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||||
|
|
||||||
|
SET(_USE_PIE OFF)
|
||||||
|
|
||||||
IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY")
|
IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY")
|
||||||
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
||||||
ELSE()
|
ELSE()
|
||||||
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
|
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
|
||||||
|
MESSAGE(STATUS "Target ${_target} is using PIE")
|
||||||
IF(_pic)
|
IF(_pic)
|
||||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
SET(_USE_PIE ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -70,6 +73,20 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
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)
|
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
|
||||||
IF(oldProps)
|
IF(oldProps)
|
||||||
LIST(APPEND _FLAGS " ${oldProps}")
|
LIST(APPEND _FLAGS " ${oldProps}")
|
||||||
|
@ -101,6 +118,49 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
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}")
|
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
||||||
|
|
||||||
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
|
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
|
||||||
|
|
|
@ -40,48 +40,67 @@ include (CMakeForceCompiler)
|
||||||
CMAKE_FORCE_C_COMPILER (clang Clang)
|
CMAKE_FORCE_C_COMPILER (clang Clang)
|
||||||
CMAKE_FORCE_CXX_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
|
# Setup iOS platform
|
||||||
if (NOT DEFINED IOS_PLATFORM)
|
IF(NOT DEFINED IOS_PLATFORM)
|
||||||
set (IOS_PLATFORM "OS")
|
SET(IOS_PLATFORM "OS")
|
||||||
endif (NOT DEFINED IOS_PLATFORM)
|
ENDIF()
|
||||||
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
|
||||||
|
SET(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
||||||
|
|
||||||
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
||||||
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||||
|
|
||||||
# Check the platform selection and setup for developer root
|
# Check the platform selection and setup for developer root
|
||||||
if (${IOS_PLATFORM} STREQUAL "OS")
|
if(${IOS_PLATFORM} STREQUAL "OS")
|
||||||
# This causes the installers to properly locate the output libraries
|
# This causes the installers to properly locate the output libraries
|
||||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
||||||
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
elseif(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||||
# This causes the installers to properly locate the output libraries
|
# This causes the installers to properly locate the output libraries
|
||||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
||||||
elseif (${IOS_PLATFORM} STREQUAL "ALL")
|
elseif(${IOS_PLATFORM} STREQUAL "ALL")
|
||||||
# This causes the installers to properly locate the output libraries
|
# This causes the installers to properly locate the output libraries
|
||||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
|
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")
|
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")
|
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
|
# 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
|
# 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_DEFAULT_ROOT "/Applications/Xcode.app/Contents")
|
||||||
SET(XCODE_PRE_43_ROOT "/Developer/Platforms")
|
|
||||||
|
|
||||||
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||||
IF(EXISTS ${XCODE_POST_43_ROOT})
|
IF(NOT DEFINED CMAKE_XCODE_ROOT)
|
||||||
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT})
|
IF(EXISTS ${XCODE_DEFAULT_ROOT})
|
||||||
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT})
|
SET(CMAKE_XCODE_ROOT ${XCODE_DEFAULT_ROOT} CACHE STRING "Xcode root")
|
||||||
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT})
|
ELSE()
|
||||||
ENDIF(EXISTS ${XCODE_POST_43_ROOT})
|
MESSAGE(FATAL_ERROR "Xcode directory ${XCODE_DEFAULT_ROOT} doesn't exist")
|
||||||
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
ENDIF()
|
||||||
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
ENDIF()
|
||||||
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer)
|
||||||
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
IF(EXISTS ${TMP})
|
||||||
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
SET(CMAKE_IOS_DEVELOPER_ROOT ${TMP})
|
||||||
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
MESSAGE(STATUS "Use iOS developer root: ${CMAKE_IOS_DEVELOPER_ROOT}")
|
||||||
ENDIF(NOT DEFINED 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_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")
|
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform")
|
||||||
|
|
||||||
|
@ -93,36 +112,36 @@ MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
|
||||||
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
|
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
|
||||||
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
|
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
|
||||||
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
|
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
|
||||||
ENDFOREACH(_CMAKE_IOS_SDK)
|
ENDFOREACH()
|
||||||
ENDIF(_CMAKE_IOS_SDKS)
|
ENDIF()
|
||||||
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS)
|
ENDMACRO()
|
||||||
|
|
||||||
# Find and use the most recent iOS sdk
|
# Find and use the most recent iOS sdk
|
||||||
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||||
# Search for a specific version of a SDK
|
# Search for a specific version of a SDK
|
||||||
GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} IOS_VERSIONS)
|
GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} IOS_VERSIONS)
|
||||||
|
|
||||||
IF(NOT IOS_VERSIONS)
|
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.")
|
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)
|
IF(IOS_VERSION)
|
||||||
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
|
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
|
||||||
IF(_INDEX EQUAL -1)
|
IF(_INDEX EQUAL -1)
|
||||||
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
|
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
|
||||||
ELSE(_INDEX EQUAL -1)
|
ELSE()
|
||||||
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||||
ENDIF(_INDEX EQUAL -1)
|
ENDIF()
|
||||||
ELSE(IOS_VERSION)
|
ELSE()
|
||||||
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
|
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
|
||||||
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||||
ENDIF(IOS_VERSION)
|
ENDIF()
|
||||||
|
|
||||||
MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}")
|
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_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)
|
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_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")
|
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")
|
SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
|
||||||
|
|
||||||
IF(CMAKE_GENERATOR MATCHES Xcode)
|
IF(CMAKE_GENERATOR MATCHES Xcode)
|
||||||
SET(ARCHS "$(ARCHS_STANDARD_32_BIT)")
|
|
||||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||||
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||||
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||||
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
|
ENDIF()
|
||||||
ELSE(CMAKE_GENERATOR MATCHES Xcode)
|
ELSE()
|
||||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||||
SET(ARCHS "armv7")
|
SET(ARCHS "armv7;arm64")
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||||
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||||
# iPhone simulator targets i386
|
# iPhone simulator targets i386
|
||||||
SET(ARCHS "i386")
|
SET(ARCHS "i386")
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||||
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
||||||
SET(ARCHS "armv7;i386")
|
SET(ARCHS "armv7;arm64;i386;x86_64")
|
||||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||||
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
|
ENDIF()
|
||||||
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
|
ENDIF()
|
||||||
|
|
||||||
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
|
# 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
|
# 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 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")
|
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
|
# 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_LIBRARY ONLY)
|
||||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
|
||||||
#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include)
|
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
|
||||||
#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib)
|
include(CMakeFindBinUtils)
|
||||||
#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin)
|
|
||||||
|
|
|
@ -708,7 +708,7 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
}
|
}
|
||||||
|
|
||||||
string arg = " " + 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)
|
if (res)
|
||||||
{
|
{
|
||||||
|
@ -728,7 +728,30 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
CloseHandle( pi.hThread );
|
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;
|
static bool firstLaunchProgram = true;
|
||||||
if (firstLaunchProgram)
|
if (firstLaunchProgram)
|
||||||
|
@ -811,9 +834,6 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (log)
|
|
||||||
nlwarning ("LAUNCH: launchProgram() not implemented");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -75,6 +75,31 @@ IF(APPLE)
|
||||||
IF(RYZOM_DATA_DIR)
|
IF(RYZOM_DATA_DIR)
|
||||||
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -RpX ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR})
|
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -RpX ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR})
|
||||||
ENDIF()
|
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()
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "nel/misc/types_nl.h"
|
#include "nel/misc/types_nl.h"
|
||||||
#include "nel/net/unified_network.h"
|
#include "nel/net/unified_network.h"
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Types for options of CMirroredDataSet::declareProperty()
|
* Types for options of CMirroredDataSet::declareProperty()
|
||||||
|
@ -374,13 +375,13 @@ const TPropertyIndex INVALID_PROPERTY_INDEX = (TPropertyIndex)~0;
|
||||||
#ifdef MIRROR_LIST_ROW_32BITS
|
#ifdef MIRROR_LIST_ROW_32BITS
|
||||||
|
|
||||||
typedef uint32 TSharedListRow;
|
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
|
const uint NB_SHAREDLIST_CELLS = 500000; // property+list container footprint with data size of 32 bit and 500000 rows: 5.8 MB
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
typedef uint16 TSharedListRow;
|
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
|
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
|
#endif
|
||||||
|
|
|
@ -766,7 +766,7 @@ bool CProductDescriptionForClient::load(const std::string& filePath)
|
||||||
clear();
|
clear();
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromBinFile(filePath.c_str());
|
pdr.readFromBinFile(filePath);
|
||||||
apply(pdr);
|
apply(pdr);
|
||||||
|
|
||||||
return true;
|
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
|
* Item in a tracker
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <nel/misc/types_nl.h>
|
#include <nel/misc/types_nl.h>
|
||||||
//#include <sstream>
|
//#include <sstream>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
const uint MAX_NB_DATASETS = 4;
|
const uint MAX_NB_DATASETS = 4;
|
||||||
extern bool VerboseWarnWhenMirrorReturningUnknownEntityId;
|
extern bool VerboseWarnWhenMirrorReturningUnknownEntityId;
|
||||||
|
@ -260,7 +261,7 @@ inline uint16 datasetToBitIndex( CMirroredDataSet *dataSet )
|
||||||
if ( DataSetQuickArray[i] == dataSet )
|
if ( DataSetQuickArray[i] == dataSet )
|
||||||
return (uint16)i;
|
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));
|
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);
|
H_AUTO(CPersistentDataRecordWriteToBinFile);
|
||||||
|
|
||||||
|
@ -750,7 +750,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName)
|
||||||
// write the buffer to a file
|
// write the buffer to a file
|
||||||
COFile f;
|
COFile f;
|
||||||
bool open = f.open(fileName);
|
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
|
// write the binary data to file
|
||||||
try
|
try
|
||||||
|
@ -759,7 +759,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName)
|
||||||
}
|
}
|
||||||
catch(...)
|
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
|
// rewind the read pointer 'cos it's at the end of file
|
||||||
|
@ -768,7 +768,7 @@ bool CPersistentDataRecord::writeToBinFile(const char* fileName)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat stringFormat)
|
bool CPersistentDataRecord::writeToTxtFile(const std::string &fileName,TStringFormat stringFormat)
|
||||||
{
|
{
|
||||||
H_AUTO(CPersistentDataRecordWriteToTxtFile);
|
H_AUTO(CPersistentDataRecordWriteToTxtFile);
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st
|
||||||
// write the text buffer to a file
|
// write the text buffer to a file
|
||||||
COFile f;
|
COFile f;
|
||||||
bool open = f.open(fileName);
|
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
|
// write the binary data to file
|
||||||
try
|
try
|
||||||
|
@ -788,7 +788,7 @@ bool CPersistentDataRecord::writeToTxtFile(const char* fileName,TStringFormat st
|
||||||
}
|
}
|
||||||
catch(...)
|
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
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPersistentDataRecord::writeToFile(const char* fileName,TFileFormat fileFormat)
|
bool CPersistentDataRecord::writeToFile(const std::string &fileName, TFileFormat fileFormat)
|
||||||
{
|
{
|
||||||
H_AUTO(CPersistentDataRecordWriteToFile);
|
H_AUTO(CPersistentDataRecordWriteToFile);
|
||||||
|
|
||||||
|
@ -805,18 +805,18 @@ bool CPersistentDataRecord::writeToFile(const char* fileName,TFileFormat fileFor
|
||||||
{
|
{
|
||||||
case BINARY_FILE:
|
case BINARY_FILE:
|
||||||
binary_file:
|
binary_file:
|
||||||
nlinfo("saving binary file: %s",fileName);
|
nlinfo("saving binary file: %s", fileName.c_str());
|
||||||
return writeToBinFile(fileName);
|
return writeToBinFile(fileName);
|
||||||
|
|
||||||
case XML_FILE:
|
case XML_FILE:
|
||||||
xml_file:
|
xml_file:
|
||||||
nlinfo("saving xml file: %s",fileName);
|
nlinfo("saving xml file: %s", fileName.c_str());
|
||||||
return writeToTxtFile(fileName,XML_STRING);
|
return writeToTxtFile(fileName, XML_STRING);
|
||||||
|
|
||||||
case LINES_FILE:
|
case LINES_FILE:
|
||||||
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);
|
return writeToTxtFile(fileName, LINES_STRING);
|
||||||
|
|
||||||
case ANY_FILE:
|
case ANY_FILE:
|
||||||
{
|
{
|
||||||
|
@ -825,14 +825,14 @@ bool CPersistentDataRecord::writeToFile(const char* fileName,TFileFormat fileFor
|
||||||
goto binary_file;
|
goto binary_file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BOMB("Bad file type supplied to writeToFile() - file not saved: "<<fileName,return false);
|
BOMB("Bad file type supplied to writeToFile() - file not saved: " << fileName, return false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// set of accessors for retrieving a data record from various sources
|
// set of accessors for retrieving a data record from various sources
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
bool CPersistentDataRecord::fromBuffer(const char *src,uint32 bufferSize)
|
bool CPersistentDataRecord::fromBuffer(const char *src, uint32 bufferSize)
|
||||||
{
|
{
|
||||||
H_AUTO(CPersistentDataRecordFromBuffer);
|
H_AUTO(CPersistentDataRecordFromBuffer);
|
||||||
|
|
||||||
|
@ -1113,15 +1113,15 @@ bool CPersistentDataRecord::fromBuffer(NLMISC::IStream& stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CPersistentDataRecord::readFromFile(const char* fileName)
|
bool CPersistentDataRecord::readFromFile(const std::string &fileName)
|
||||||
{
|
{
|
||||||
H_AUTO(pdrReadFromFile)
|
H_AUTO(pdrReadFromFile)
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
||||||
// open the file
|
// 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);
|
DROP_IF( inf==NULL, "Failed to open input file " << fileName, return false);
|
||||||
|
|
||||||
// get the file size
|
// get the file size
|
||||||
uint32 length= filelength(fileno(inf));
|
uint32 length= filelength(fileno(inf));
|
||||||
|
@ -1133,7 +1133,7 @@ bool CPersistentDataRecord::readFromFile(const char* fileName)
|
||||||
// read the data
|
// read the data
|
||||||
uint32 blocksRead= (uint32)fread(&buffer[0],length,1,inf);
|
uint32 blocksRead= (uint32)fread(&buffer[0],length,1,inf);
|
||||||
fclose(inf);
|
fclose(inf);
|
||||||
DROP_IF( blocksRead!=1, "Failed to read data from file "<<fileName, return false);
|
DROP_IF( blocksRead!=1, "Failed to read data from file " << fileName, return false);
|
||||||
|
|
||||||
// test whether our data buffer is binary
|
// test whether our data buffer is binary
|
||||||
bool isBinary=(length>8 && *(uint32*)&buffer[4]==length);
|
bool isBinary=(length>8 && *(uint32*)&buffer[4]==length);
|
||||||
|
@ -1143,7 +1143,7 @@ bool CPersistentDataRecord::readFromFile(const char* fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// it's not a valid binary file so see whether it looks like a valid text file
|
// it's not a valid binary file so see whether it looks like a valid text file
|
||||||
DROP_IF(!buffer.isValidText(),"File is binary but 'file size' header entry doesn't match true file size",return false);
|
DROP_IF(!buffer.isValidText(),"File is binary but 'file size' header entry doesn't match true file size", return false);
|
||||||
|
|
||||||
// parse the data as text...
|
// parse the data as text...
|
||||||
return fromString(buffer);
|
return fromString(buffer);
|
||||||
|
@ -1153,27 +1153,27 @@ bool CPersistentDataRecord::readFromFile(const char* fileName)
|
||||||
// open the file
|
// open the file
|
||||||
CIFile f;
|
CIFile f;
|
||||||
bool open = f.open(fileName);
|
bool open = f.open(fileName);
|
||||||
DROP_IF( !open, "Failed to open input file "<<fileName, return false);
|
DROP_IF( !open, "Failed to open input file " << fileName, return false);
|
||||||
|
|
||||||
// get the file size
|
// get the file size
|
||||||
uint32 len= f.getFileSize();
|
uint32 len= f.getFileSize();
|
||||||
|
|
||||||
bool result= fromStream(f, len);
|
bool result= fromStream(f, len);
|
||||||
DROP_IF( !result, "Failed to parse input file "<<fileName, return false);
|
DROP_IF( !result, "Failed to parse input file " << fileName, return false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPersistentDataRecord::readFromBinFile(const char* fileName)
|
bool CPersistentDataRecord::readFromBinFile(const std::string &fileName)
|
||||||
{
|
{
|
||||||
H_AUTO(CPersistentDataRecordReadFromBinFile);
|
H_AUTO(CPersistentDataRecordReadFromBinFile);
|
||||||
|
|
||||||
// open the file
|
// open the file
|
||||||
CIFile f;
|
CIFile f;
|
||||||
bool open = f.open(fileName);
|
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
|
// get the file size
|
||||||
uint32 len=CFile::getFileSize(fileName);
|
uint32 len=CFile::getFileSize(fileName);
|
||||||
|
@ -1189,24 +1189,24 @@ bool CPersistentDataRecord::readFromBinFile(const char* fileName)
|
||||||
}
|
}
|
||||||
catch(...)
|
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
|
// parse the buffer contents to re-generate the data
|
||||||
bool result= fromBuffer(&s[0],(uint32)s.size());
|
bool result= fromBuffer(&s[0],(uint32)s.size());
|
||||||
DROP_IF( !result, "Failed to parse input file "<<fileName, return false);
|
DROP_IF( !result, "Failed to parse input file " << fileName, return false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPersistentDataRecord::readFromTxtFile(const char* fileName)
|
bool CPersistentDataRecord::readFromTxtFile(const std::string &fileName)
|
||||||
{
|
{
|
||||||
H_AUTO(CPersistentDataRecordReadFromTxtFile);
|
H_AUTO(CPersistentDataRecordReadFromTxtFile);
|
||||||
|
|
||||||
// open the file
|
// open the file
|
||||||
CIFile f;
|
CIFile f;
|
||||||
bool open = f.open(fileName);
|
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
|
// get the file size
|
||||||
uint32 len=CFile::getFileSize(fileName);
|
uint32 len=CFile::getFileSize(fileName);
|
||||||
|
@ -1222,7 +1222,7 @@ bool CPersistentDataRecord::readFromTxtFile(const char* fileName)
|
||||||
}
|
}
|
||||||
catch(...)
|
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
|
// parse the buffer contents to re-generate the data
|
||||||
|
|
|
@ -407,15 +407,15 @@ public:
|
||||||
bool toLines(std::string& result);
|
bool toLines(std::string& result);
|
||||||
|
|
||||||
// perform a toBuffer() and write the result to a binary file
|
// 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
|
// 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
|
// 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
|
// determine the file type. In this case 'txt' and 'xml' have specific meanings
|
||||||
// returns writeToTxtFile(...) or writeToBinFile(...) depending on the file format
|
// 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);
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -427,7 +427,7 @@ public:
|
||||||
|
|
||||||
// read from a binary data buffer
|
// read from a binary data buffer
|
||||||
// if the input data looks like text then calls fromString()
|
// if the input data looks like text then calls fromString()
|
||||||
bool fromBuffer(const char *src,uint32 bufferSize);
|
bool fromBuffer(const char *src, uint32 bufferSize);
|
||||||
|
|
||||||
// read from a text string (either xml or lines)
|
// read from a text string (either xml or lines)
|
||||||
// note 1: This routine is not at all optimised
|
// note 1: This routine is not at all optimised
|
||||||
|
@ -445,14 +445,14 @@ public:
|
||||||
bool fromLines(const std::string& s);
|
bool fromLines(const std::string& s);
|
||||||
|
|
||||||
// read from a binary file
|
// read from a binary file
|
||||||
bool readFromBinFile(const char* fileName);
|
bool readFromBinFile(const std::string &fileName);
|
||||||
|
|
||||||
// read from a text file
|
// 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
|
// read a file and determine whether it's a binary or text file from it's
|
||||||
// content - then behave like readFromBinFile() or readFromTxtFile()
|
// content - then behave like readFromBinFile() or readFromTxtFile()
|
||||||
bool readFromFile(const char* fileName);
|
bool readFromFile(const std::string &fileName);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -370,13 +370,13 @@ void PERSISTENT_CLASS::store(CPersistentDataRecord &pdr _PERSISTENT_STORE_ARGS)
|
||||||
|
|
||||||
#else
|
#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
|
// 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__MapKey = std::numeric_limits<uint16>::max(); pdr.addString("__Key__",__Tok__MapKey);
|
||||||
static uint16 __Tok__MapVal= (uint16)~0u; pdr.addString("__Val__",__Tok__MapVal);
|
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= (uint16)~0u; pdr.addString(name,token);
|
#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= (uint16)~0u; 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= (uint16)~0u; 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= (uint16)~0u; 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= (uint16)~0u; pdr.addString(name,token);
|
#define _FLAG(token,name,logic,code) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||||
PERSISTENT_DATA
|
PERSISTENT_DATA
|
||||||
#undef _PROP
|
#undef _PROP
|
||||||
#undef _STRUCT
|
#undef _STRUCT
|
||||||
|
@ -471,13 +471,13 @@ void PERSISTENT_CLASS::apply(CPersistentDataRecord &pdr _PERSISTENT_APPLY_ARGS)
|
||||||
#endif
|
#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
|
// 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__MapKey = std::numeric_limits<uint16>::max(); pdr.addString("__Key__",__Tok__MapKey);
|
||||||
static uint16 __Tok__MapVal= (uint16)~0u; pdr.addString("__Val__",__Tok__MapVal);
|
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= (uint16)~0u; pdr.addString(name,token);
|
#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= (uint16)~0u; 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= (uint16)~0u; 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= (uint16)~0u; 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= (uint16)~0u; pdr.addString(name,token);
|
#define _FLAG(token,name,logic,code) static uint16 token = std::numeric_limits<uint16>::max(); pdr.addString(name,token);
|
||||||
PERSISTENT_DATA
|
PERSISTENT_DATA
|
||||||
#undef _PROP
|
#undef _PROP
|
||||||
#undef _STRUCT
|
#undef _STRUCT
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "property_allocator.h"
|
#include "property_allocator.h"
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace NLNET
|
namespace NLNET
|
||||||
{
|
{
|
||||||
class CMessage;
|
class CMessage;
|
||||||
|
@ -40,7 +42,7 @@ class CPropertyAllocatorClient : public CPropertyAllocator
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// Constructor
|
/// 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.
|
/** Ask to allocate, if not done yet, a segment for the specified property.
|
||||||
* The pointer will be soon returned by getPropertySegment(), but not always
|
* 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);
|
string tmp = toString("r2.%04u.act%u.pdr.xml", sessionId.asInt(), first);
|
||||||
nldebug( "writing xml pdr file %s", tmp.c_str() );
|
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);
|
CComputeCell *cell = _WorldMap.getComputeCell(scanline);
|
||||||
|
|
||||||
{
|
{
|
||||||
uint i;
|
for (uint i = 0; i < 16; ++i)
|
||||||
for (i=0; i<16*16; ++i)
|
|
||||||
{
|
{
|
||||||
toposGridList[0][i].topos[0] =
|
for (uint j = 0; j < 16; ++j)
|
||||||
toposGridList[0][i].topos[1] =
|
{
|
||||||
toposGridList[0][i].topos[2] = -1;
|
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
|
nlassert(isNoGo=true); // by definition this code can't be executed with isNoGo false
|
||||||
|
|
||||||
_surface=NULL;
|
_surface=NULL;
|
||||||
_distance=(uint16)-1;
|
_distance = std::numeric_limits<uint16>::max();
|
||||||
//bool _sameRegion=false;
|
//bool _sameRegion=false;
|
||||||
memset(_direction,0,sizeof(_direction));
|
memset(_direction,0,sizeof(_direction));
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,12 +52,12 @@ void CAIActionsDataRecordPtr::clear()
|
||||||
|
|
||||||
void CAIActionsDataRecordPtr::readFile(const std::string &fileName)
|
void CAIActionsDataRecordPtr::readFile(const std::string &fileName)
|
||||||
{
|
{
|
||||||
_PdrPtr->readFromFile(fileName.c_str());
|
_PdrPtr->readFromFile(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAIActionsDataRecordPtr::writeFile(const std::string &fileName)
|
void CAIActionsDataRecordPtr::writeFile(const std::string &fileName)
|
||||||
{
|
{
|
||||||
_PdrPtr->writeToFile(fileName.c_str());
|
_PdrPtr->writeToFile(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAIActionsDataRecordPtr::display()
|
void CAIActionsDataRecordPtr::display()
|
||||||
|
|
|
@ -372,7 +372,7 @@ uint16 CSingleLayerCell::_MaskMap[16];
|
||||||
|
|
||||||
void CSingleLayerCell::serial(NLMISC::IStream& f)
|
void CSingleLayerCell::serial(NLMISC::IStream& f)
|
||||||
{
|
{
|
||||||
f.serialCheck((uint16)'SL');
|
f.serialCheck(NELID16("SL"));
|
||||||
|
|
||||||
uint i;
|
uint i;
|
||||||
for (i=0; i<16; ++i)
|
for (i=0; i<16; ++i)
|
||||||
|
@ -403,7 +403,7 @@ void CSingleLayerCell::serial(NLMISC::IStream& f)
|
||||||
|
|
||||||
void CMultiLayerCell::serial(NLMISC::IStream& f)
|
void CMultiLayerCell::serial(NLMISC::IStream& f)
|
||||||
{
|
{
|
||||||
f.serialCheck((uint16)'ML');
|
f.serialCheck(NELID16("ML"));
|
||||||
|
|
||||||
uint slot;
|
uint slot;
|
||||||
|
|
||||||
|
|
|
@ -118,10 +118,10 @@ NLMISC_COMMAND ( dumpCharacterFile, "dump the content of the save file for a cha
|
||||||
}
|
}
|
||||||
|
|
||||||
// the file exist !
|
// the file exist !
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
|
|
||||||
if (!pdr.readFromBinFile(fileName.c_str()))
|
if (!pdr.readFromBinFile(fileName))
|
||||||
{
|
{
|
||||||
log.displayNL("Error while reading file '%s'", fileName.c_str());
|
log.displayNL("Error while reading file '%s'", fileName.c_str());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2199,7 +2199,7 @@ NLMISC_CATEGORISED_COMMAND(pdr,saveToXML,"save a character to an XML file","<eid
|
||||||
static CPersistentDataRecordRyzomStore pdr;
|
static CPersistentDataRecordRyzomStore pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
c->store(pdr);
|
c->store(pdr);
|
||||||
pdr.writeToTxtFile((fileName+".xml").c_str());
|
pdr.writeToTxtFile(fileName+".xml");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2223,9 +2223,9 @@ NLMISC_CATEGORISED_COMMAND(pdr,loadFromXML,"load a character from an XML file","
|
||||||
uint32 guildId= c->getGuildId();
|
uint32 guildId= c->getGuildId();
|
||||||
NLMISC::CEntityId id= c->getId();
|
NLMISC::CEntityId id= c->getId();
|
||||||
|
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromTxtFile((fileName+".xml").c_str());
|
pdr.readFromTxtFile(fileName+".xml");
|
||||||
c->apply(pdr);
|
c->apply(pdr);
|
||||||
c->setName(name);
|
c->setName(name);
|
||||||
c->setGuildId(guildId);
|
c->setGuildId(guildId);
|
||||||
|
@ -2249,14 +2249,14 @@ NLMISC_CATEGORISED_COMMAND(pdr,saveToPDR,"save a character to a binary PDR file"
|
||||||
if (args.size () < 2) return false;
|
if (args.size () < 2) return false;
|
||||||
GET_CHARACTER
|
GET_CHARACTER
|
||||||
|
|
||||||
std::string fileName = args[1];
|
std::string fileName = args[1];
|
||||||
|
|
||||||
if( c )
|
if( c )
|
||||||
{
|
{
|
||||||
static CPersistentDataRecordRyzomStore pdr;
|
static CPersistentDataRecordRyzomStore pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
c->store(pdr);
|
c->store(pdr);
|
||||||
pdr.writeToBinFile((fileName+".pdr").c_str());
|
pdr.writeToBinFile(fileName+".pdr");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2280,9 +2280,9 @@ NLMISC_CATEGORISED_COMMAND(pdr,loadFromPDR,"load a character from a binary PDR f
|
||||||
uint32 guildId= c->getGuildId();
|
uint32 guildId= c->getGuildId();
|
||||||
NLMISC::CEntityId id= c->getId();
|
NLMISC::CEntityId id= c->getId();
|
||||||
|
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromBinFile((fileName+".pdr").c_str());
|
pdr.readFromBinFile(fileName+".pdr");
|
||||||
c->apply(pdr);
|
c->apply(pdr);
|
||||||
|
|
||||||
c->setName(name);
|
c->setName(name);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
class CDeposit;
|
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.
|
* 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);
|
std::map<std::string, size_t>::const_iterator it = _AnimIdMap.find(animId);
|
||||||
if (it!=_AnimIdMap.end())
|
if (it!=_AnimIdMap.end())
|
||||||
return (uint16)it->second;
|
return (uint16)it->second;
|
||||||
return (uint16)~0;
|
return std::numeric_limits<uint16>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removed
|
/// Removed
|
||||||
|
|
|
@ -117,7 +117,7 @@ public:
|
||||||
std::map<std::string, size_t>::const_iterator it = _EmoteIdMap.find(emoteId);
|
std::map<std::string, size_t>::const_iterator it = _EmoteIdMap.find(emoteId);
|
||||||
if (it!=_EmoteIdMap.end())
|
if (it!=_EmoteIdMap.end())
|
||||||
return (uint16)it->second;
|
return (uint16)it->second;
|
||||||
return (uint16)~0;
|
return std::numeric_limits<uint16>::max();
|
||||||
}
|
}
|
||||||
MBEHAV::EBehaviour getEmoteBehav(const std::string& emoteId) const;
|
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();
|
pdr.clear();
|
||||||
{
|
{
|
||||||
H_AUTO(LoadCharacterNamesLoadFile);
|
H_AUTO(LoadCharacterNamesLoadFile);
|
||||||
pdr.readFromFile((*it).second.FileName.c_str());
|
pdr.readFromFile((*it).second.FileName);
|
||||||
}
|
}
|
||||||
CCharacterNameExtraction nameExtractor;
|
CCharacterNameExtraction nameExtractor;
|
||||||
{
|
{
|
||||||
|
@ -1760,25 +1760,25 @@ NLMISC_COMMAND(loadCharacterNames,"load all character save games and extract nam
|
||||||
// // std read tst
|
// // std read tst
|
||||||
// static CPersistentDataRecord pdrRead("");
|
// static CPersistentDataRecord pdrRead("");
|
||||||
// pdrRead.clear();
|
// pdrRead.clear();
|
||||||
// pdrRead.readFromBinFile(files[i].c_str());
|
// pdrRead.readFromBinFile(files[i]);
|
||||||
// pdrRead.writeToTxtFile((saveDir + "test/txt_read/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING);
|
// pdrRead.writeToTxtFile(saveDir + "test/txt_read/" + CFile::getFilenameWithoutExtension(file) + ".txt", CPersistentDataRecord::LINES_STRING);
|
||||||
//
|
//
|
||||||
// // read write tst (even with a bad used RyzomStore class)
|
// // read write tst (even with a bad used RyzomStore class)
|
||||||
// static CPersistentDataRecordRyzomStore pdr;
|
// static CPersistentDataRecordRyzomStore pdr;
|
||||||
// pdr.clear();
|
// pdr.clear();
|
||||||
// pdr.readFromBinFile(files[i].c_str());
|
// pdr.readFromBinFile(files[i]);
|
||||||
// TTime t0= CTime::getLocalTime();
|
// TTime t0= CTime::getLocalTime();
|
||||||
// pdr.writeToBinFile((saveDir + "test/bin_new/" + file).c_str());
|
// pdr.writeToBinFile(saveDir + "test/bin_new/" + file);
|
||||||
// TTime t1= CTime::getLocalTime();
|
// TTime t1= CTime::getLocalTime();
|
||||||
// nlinfo("resaved %s in %d ms", file.c_str(), uint32(t1-t0));
|
// 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
|
// // ReLoad
|
||||||
// {
|
// {
|
||||||
// static CPersistentDataRecordRyzomStore pdr;
|
// static CPersistentDataRecordRyzomStore pdr;
|
||||||
// pdr.clear();
|
// pdr.clear();
|
||||||
// pdr.readFromBinFile((saveDir + "test/bin_new/" + file).c_str());
|
// pdr.readFromBinFile(saveDir + "test/bin_new/" + file);
|
||||||
// pdr.writeToTxtFile((saveDir + "test/txt_after/" + CFile::getFilenameWithoutExtension(file) + ".txt").c_str(), CPersistentDataRecord::LINES_STRING);
|
// 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;
|
// static CPersistentDataRecord pdr;
|
||||||
// pdr.clear();
|
// pdr.clear();
|
||||||
// pdr.readFromFile(files[i].c_str());
|
// pdr.readFromFile(files[i]);
|
||||||
// string txtFile= files[i];
|
// string txtFile= files[i];
|
||||||
// strFindReplace(txtFile, ".bin", ".txt");
|
// strFindReplace(txtFile, ".bin", ".txt");
|
||||||
// pdr.writeToTxtFile(txtFile.c_str(), CPersistentDataRecord::LINES_STRING);
|
// pdr.writeToTxtFile(txtFile, CPersistentDataRecord::LINES_STRING);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -64,9 +64,9 @@ void CGameEventManager::init()
|
||||||
|
|
||||||
if (CFile::fileExists(sFilename))
|
if (CFile::fileExists(sFilename))
|
||||||
{
|
{
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromTxtFile(sFilename.c_str());
|
pdr.readFromTxtFile(sFilename);
|
||||||
apply(pdr);
|
apply(pdr);
|
||||||
createEventChannel();
|
createEventChannel();
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ void CGameEventManager::saveGameEventFile()
|
||||||
static CPersistentDataRecordRyzomStore pdr;
|
static CPersistentDataRecordRyzomStore pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
store(pdr);
|
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;
|
// return false;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0].c_str()) );
|
// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0]) );
|
||||||
// //uint16 quality = (uint16)NLMISC::fromString(args[1].c_str());
|
// //uint16 quality;
|
||||||
|
// //NLMISC::fromString(args[1]; quality);
|
||||||
//
|
//
|
||||||
// sint32 x;
|
// sint32 x;
|
||||||
// NLMISC::fromString(args[2], x);
|
// NLMISC::fromString(args[2], x);
|
||||||
|
@ -957,9 +958,10 @@ NLMISC_COMMAND(createItem,"create a new item","<sheet id><quality>")
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0].c_str()) );
|
// CEntityId itemId( RYZOMID::object, NLMISC::fromString(args[0]) );
|
||||||
// CSheetId sheetId(args[1]);
|
// 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 x = (sint32)NLMISC::fromString(args[3].c_str()) * 1000;
|
||||||
// sint32 y = (sint32)NLMISC::fromString(args[4].c_str()) * 1000;
|
// sint32 y = (sint32)NLMISC::fromString(args[4].c_str()) * 1000;
|
||||||
// sint32 z = (sint32)NLMISC::fromString(args[5].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)
|
if ( id > 0)
|
||||||
{
|
{
|
||||||
// this is a guild file. We can load it
|
// this is a guild file. We can load it
|
||||||
pdr.readFromBinFile(args[0].c_str());
|
pdr.readFromBinFile(args[0]);
|
||||||
|
|
||||||
guildId = id;
|
guildId = id;
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ NLMISC_COMMAND( importGuildFile, "Import a guild file into the server", "<filena
|
||||||
if ( id > 0)
|
if ( id > 0)
|
||||||
{
|
{
|
||||||
// this is a guild file. We can load it
|
// this is a guild file. We can load it
|
||||||
pdr.readFromTxtFile(args[0].c_str());
|
pdr.readFromTxtFile(args[0]);
|
||||||
guildId = id;
|
guildId = id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -328,7 +328,7 @@ void CGuildManager::saveGuild( CGuild* guild )
|
||||||
{
|
{
|
||||||
H_AUTO( CGuildManagerUpdate_PDR_WRITE_TEXT )
|
H_AUTO( CGuildManagerUpdate_PDR_WRITE_TEXT )
|
||||||
string fileName = Bsi.getLocalPath()+NLMISC::toString("guilds/guild_%05u.txt", id & 0x000fffff);
|
string fileName = Bsi.getLocalPath()+NLMISC::toString("guilds/guild_%05u.txt", id & 0x000fffff);
|
||||||
pdr.writeToTxtFile(fileName.c_str());
|
pdr.writeToTxtFile(fileName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -360,7 +360,7 @@ void CGuildManager::saveGuild( CGuild* guild )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
H_AUTO( CGuildManagerUpdatePDR_WRITE_BIN_NO_PDS )
|
H_AUTO( CGuildManagerUpdatePDR_WRITE_BIN_NO_PDS )
|
||||||
pdr.writeToBinFile((Bsi.getLocalPath() + fileName).c_str());
|
pdr.writeToBinFile(Bsi.getLocalPath() + fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,9 @@ void CMissionQueueManager::init()
|
||||||
|
|
||||||
if (CFile::fileExists(sFilename))
|
if (CFile::fileExists(sFilename))
|
||||||
{
|
{
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromTxtFile(sFilename.c_str());
|
pdr.readFromTxtFile(sFilename);
|
||||||
apply(pdr);
|
apply(pdr);
|
||||||
}
|
}
|
||||||
_InitOk = true;
|
_InitOk = true;
|
||||||
|
|
|
@ -1095,14 +1095,19 @@ class CMissionStepKillPlayer : public IMissionStepTemplate
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// missionData.ChatParams.push_back( make_pair( args[0], STRING_MANAGER::clan ) );
|
// missionData.ChatParams.push_back( make_pair( args[0], STRING_MANAGER::clan ) );
|
||||||
subStep.MinLevel = atoi( args[1].c_str() ) * kFameMultipler;
|
NLMISC::fromString(args[1], subStep.MinLevel);
|
||||||
subStep.MaxLevel = atoi( args[2].c_str() ) * kFameMultipler;
|
NLMISC::fromString(args[2], subStep.MaxLevel);
|
||||||
|
|
||||||
|
subStep.MinLevel *= kFameMultipler;
|
||||||
|
subStep.MaxLevel *= kFameMultipler;
|
||||||
|
|
||||||
if ( subStep.MinLevel >= subStep.MaxLevel )
|
if ( subStep.MinLevel >= subStep.MaxLevel )
|
||||||
{
|
{
|
||||||
MISLOGERROR("min_level >= max_level");
|
MISLOGERROR("min_level >= max_level");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
subStep.Quantity = (uint16) atoi( args[3].c_str() );
|
NLMISC::fromString(args[3], subStep.Quantity);
|
||||||
|
|
||||||
if ( subStep.Quantity == 0 )
|
if ( subStep.Quantity == 0 )
|
||||||
{
|
{
|
||||||
MISLOGERROR("invalid quantity 0");
|
MISLOGERROR("invalid quantity 0");
|
||||||
|
|
|
@ -428,9 +428,9 @@ void COutpostManager::loadOutpostSaveFiles()
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// // load dynamic data
|
// // load dynamic data
|
||||||
// static CPersistentDataRecord pdr;
|
// static CPersistentDataRecord pdr;
|
||||||
// pdr.clear();
|
// pdr.clear();
|
||||||
// pdr.readFromBinFile(files[i].c_str());
|
// pdr.readFromBinFile(files[i]);
|
||||||
// outpost->apply( pdr );
|
// outpost->apply( pdr );
|
||||||
// loadedOutposts.push_back( outpost );
|
// loadedOutposts.push_back( outpost );
|
||||||
// }
|
// }
|
||||||
|
@ -808,7 +808,7 @@ void COutpostManager::saveOutpost(NLMISC::CSmartPtr<COutpost> outpost)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
H_AUTO( COutpostManagerSTORE_NO_BS )
|
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;
|
_IsStatic = false;
|
||||||
_AddRecastTime = 0;
|
_AddRecastTime = 0;
|
||||||
_PhraseType = BRICK_TYPE::SPECIAL_POWER;
|
_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;
|
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());
|
uint16 seconds = uint16((endDate - CTickEventHandler::getGameCycle())*CTickEventHandler::getGameTimeStep());
|
||||||
uint8 minutes = uint8(seconds/60);
|
uint8 minutes = uint8(seconds/60);
|
||||||
|
|
|
@ -66,7 +66,7 @@ bool CSpecialPowerTaunt::validate(std::string &errorCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
TGameCycle endDate;
|
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() );
|
uint16 seconds = uint16( (endDate - CTickEventHandler::getGameCycle())*CTickEventHandler::getGameTimeStep() );
|
||||||
uint8 minutes = uint8(seconds/60);
|
uint8 minutes = uint8(seconds/60);
|
||||||
|
|
|
@ -140,8 +140,7 @@ public:
|
||||||
//get the number of nodes
|
//get the number of nodes
|
||||||
uint16 getNbNodes() const
|
uint16 getNbNodes() const
|
||||||
{
|
{
|
||||||
return (uint16)
|
return (uint16)_Nodes.size();
|
||||||
_Nodes.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2611,7 +2611,7 @@ void CCharacter::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
|
||||||
void CCharacter::setPositionToDefaultRespawnPoint()
|
void CCharacter::setPositionToDefaultRespawnPoint()
|
||||||
{
|
{
|
||||||
CContinent * continent = CZoneManager::getInstance().getContinent( getX(), getY() );
|
CContinent * continent = CZoneManager::getInstance().getContinent( getX(), getY() );
|
||||||
uint16 zoneId = (uint16)~0;
|
uint16 zoneId = std::numeric_limits<uint16>::max();
|
||||||
if( continent == 0 )
|
if( continent == 0 )
|
||||||
{
|
{
|
||||||
nlwarning("<CHAR_TP_TOWN: Character %s : continent null for pos %d %d", getId().toString().c_str(), getX(), getY());
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( zoneId != (uint16)~0 )
|
if( zoneId != std::numeric_limits<uint16>::max() )
|
||||||
{
|
{
|
||||||
// get the tp coords
|
// get the tp coords
|
||||||
const CTpSpawnZone* zone = CZoneManager::getInstance().getTpSpawnZone( zoneId );
|
const CTpSpawnZone* zone = CZoneManager::getInstance().getTpSpawnZone( zoneId );
|
||||||
|
|
|
@ -831,7 +831,7 @@ void CPlayer::loadAllCharacters()
|
||||||
bool isOK;
|
bool isOK;
|
||||||
{
|
{
|
||||||
H_AUTO(LoadAllCharactersPdrBinReadFile);
|
H_AUTO(LoadAllCharactersPdrBinReadFile);
|
||||||
isOK= pdr.readFromBinFile(pdrBinFileName.c_str());
|
isOK= pdr.readFromBinFile(pdrBinFileName);
|
||||||
}
|
}
|
||||||
if (!isOK)
|
if (!isOK)
|
||||||
break;
|
break;
|
||||||
|
@ -854,7 +854,7 @@ void CPlayer::loadAllCharacters()
|
||||||
bool isOK;
|
bool isOK;
|
||||||
{
|
{
|
||||||
H_AUTO(LoadAllCharactersPdrXmlReadFile);
|
H_AUTO(LoadAllCharactersPdrXmlReadFile);
|
||||||
isOK= pdr.readFromTxtFile(pdrXmlFileName.c_str());
|
isOK= pdr.readFromTxtFile(pdrXmlFileName);
|
||||||
}
|
}
|
||||||
if (!isOK)
|
if (!isOK)
|
||||||
break;
|
break;
|
||||||
|
@ -975,7 +975,7 @@ void CPlayer::loadAllCharactersPdr()
|
||||||
// try loading the save data from disk
|
// try loading the save data from disk
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool isOK= pdr.readFromFile(fileName.c_str());
|
bool isOK= pdr.readFromFile(fileName);
|
||||||
if (!isOK)
|
if (!isOK)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1478,11 +1478,11 @@ NLMISC_CATEGORISED_COMMAND(egs, convertToPdr, "Load all possible characters from
|
||||||
bool writeSuccess = false;
|
bool writeSuccess = false;
|
||||||
if (xml)
|
if (xml)
|
||||||
{
|
{
|
||||||
writeSuccess = pdr.writeToTxtFile(dstFile.c_str());
|
writeSuccess = pdr.writeToTxtFile(dstFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writeSuccess = pdr.writeToBinFile(dstFile.c_str());
|
writeSuccess = pdr.writeToBinFile(dstFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check file can be read back
|
// check file can be read back
|
||||||
|
@ -1491,7 +1491,7 @@ NLMISC_CATEGORISED_COMMAND(egs, convertToPdr, "Load all possible characters from
|
||||||
static CPersistentDataRecord pdrTest;
|
static CPersistentDataRecord pdrTest;
|
||||||
pdrTest.clear();
|
pdrTest.clear();
|
||||||
|
|
||||||
if (pdrTest.readFromFile(dstFile.c_str()))
|
if (pdrTest.readFromFile(dstFile))
|
||||||
{
|
{
|
||||||
CCharacter* characterTest = new CCharacter();
|
CCharacter* characterTest = new CCharacter();
|
||||||
characterTest->setId( PlayerManager.createCharacterId( UserId, CharId ) );
|
characterTest->setId( PlayerManager.createCharacterId( UserId, CharId ) );
|
||||||
|
|
|
@ -846,7 +846,7 @@ void CPlayerManager::savePlayerCharRecurs( uint32 userId, sint32 idx, std::set<C
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
H_AUTO(SavePlayerPDRSave);
|
H_AUTO(SavePlayerPDRSave);
|
||||||
pdr.writeToFile(pdrPathFileName.c_str());
|
pdr.writeToFile(pdrPathFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const Exception &)
|
catch(const Exception &)
|
||||||
|
|
|
@ -60,7 +60,7 @@ void CPowerActivationDateVector::clearConsumable()
|
||||||
{
|
{
|
||||||
for(sint32 i = (sint32)PowerActivationDates.size()-1; i >= 0; --i )
|
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[i] = PowerActivationDates[PowerActivationDates.size()-1];
|
||||||
PowerActivationDates.pop_back();
|
PowerActivationDates.pop_back();
|
||||||
|
@ -117,7 +117,7 @@ bool CPowerActivationDateVector::isPowerAllowed(POWERS::TPowerType type, uint16
|
||||||
}
|
}
|
||||||
else
|
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;
|
endDate = (*it).ActivationDate;
|
||||||
result = false;
|
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)
|
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);
|
_AuraUsers.push_back(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct CPowerActivationDate
|
||||||
NLMISC::TGameCycle DeactivationDate;
|
NLMISC::TGameCycle DeactivationDate;
|
||||||
NLMISC::TGameCycle ActivationDate;
|
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)
|
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;
|
static CPersistentDataRecordRyzomStore pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.fromBuffer(dataStream);
|
pdr.fromBuffer(dataStream);
|
||||||
// pdr.readFromFile( sFilePath.c_str() );
|
// pdr.readFromFile( sFilePath );
|
||||||
|
|
||||||
apply( pdr );
|
apply( pdr );
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ bool CPVPFactionRewardManager::_LoadFromPDR()
|
||||||
//
|
//
|
||||||
// static CPersistentDataRecordRyzomStore pdr;
|
// static CPersistentDataRecordRyzomStore pdr;
|
||||||
// pdr.clear();
|
// pdr.clear();
|
||||||
// pdr.readFromFile( sFilePath.c_str() );
|
// pdr.readFromFile( sFilePath );
|
||||||
//
|
//
|
||||||
// if ( pdr.isEndOfData() )
|
// if ( pdr.isEndOfData() )
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -332,7 +332,7 @@ void CTotemBase::totemFileCallback(const CFileDescription& fileDescription, NLMI
|
||||||
static CPersistentDataRecordRyzomStore pdr;
|
static CPersistentDataRecordRyzomStore pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.fromBuffer(dataStream);
|
pdr.fromBuffer(dataStream);
|
||||||
// pdr.readFromFile( sFilePath.c_str() );
|
// pdr.readFromFile( sFilePath );
|
||||||
|
|
||||||
apply( pdr );
|
apply( pdr );
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ void CTotemBase::loadFromPDR()
|
||||||
|
|
||||||
// static CPersistentDataRecordRyzomStore pdr;
|
// static CPersistentDataRecordRyzomStore pdr;
|
||||||
// pdr.clear();
|
// pdr.clear();
|
||||||
// pdr.readFromFile( sFilePath.c_str() );
|
// pdr.readFromFile( sFilePath );
|
||||||
//
|
//
|
||||||
// apply( pdr );
|
// apply( pdr );
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ void CDynamicItems::init()
|
||||||
// static CPersistentDataRecord pdr;
|
// static CPersistentDataRecord pdr;
|
||||||
// pdr.clear();
|
// pdr.clear();
|
||||||
//
|
//
|
||||||
// pdr.readFromFile(fileName.c_str());
|
// pdr.readFromFile(fileName);
|
||||||
// apply(pdr, i);
|
// apply(pdr, i);
|
||||||
//
|
//
|
||||||
// for( uint32 j = 0; j < subVec.size(); ++j )
|
// for( uint32 j = 0; j < subVec.size(); ++j )
|
||||||
|
|
|
@ -66,9 +66,9 @@ void CNamedItems::loadNamedItemsFromFile(const std::string & fileName)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromTxtFile(path.c_str());
|
pdr.readFromTxtFile(path);
|
||||||
CInventoryPtr inv = loadFromPdr(pdr);
|
CInventoryPtr inv = loadFromPdr(pdr);
|
||||||
if (inv == NULL)
|
if (inv == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -728,7 +728,7 @@ void CStatDB::valueLeaveFileCallback(const CFileDescription& fileDescription, N
|
||||||
CStatDBValueLeavesPD valueLeavesPD;
|
CStatDBValueLeavesPD valueLeavesPD;
|
||||||
|
|
||||||
pdr.fromBuffer(dataStream);
|
pdr.fromBuffer(dataStream);
|
||||||
// pdr.readFromFile(sFilePath.c_str());
|
// pdr.readFromFile(sFilePath);
|
||||||
valueLeavesPD.apply(pdr);
|
valueLeavesPD.apply(pdr);
|
||||||
nTotalLoaded += fileDescription.FileSize;
|
nTotalLoaded += fileDescription.FileSize;
|
||||||
|
|
||||||
|
@ -791,7 +791,7 @@ void CStatDB::tableLeaveFileCallback(const CFileDescription& fileDescription, N
|
||||||
CStatDBTableLeafPD tableLeafPD;
|
CStatDBTableLeafPD tableLeafPD;
|
||||||
|
|
||||||
pdr.fromBuffer(dataStream);
|
pdr.fromBuffer(dataStream);
|
||||||
// pdr.readFromFile(fileName.c_str());
|
// pdr.readFromFile(fileName);
|
||||||
tableLeafPD.apply(pdr);
|
tableLeafPD.apply(pdr);
|
||||||
nTotalLoaded += CFile::getFileSize(fileName);
|
nTotalLoaded += CFile::getFileSize(fileName);
|
||||||
|
|
||||||
|
@ -854,7 +854,7 @@ void CStatDB::load()
|
||||||
// pdr.clear();
|
// pdr.clear();
|
||||||
// CStatDBValueLeavesPD valueLeavesPD;
|
// CStatDBValueLeavesPD valueLeavesPD;
|
||||||
//
|
//
|
||||||
// pdr.readFromFile(sFilePath.c_str());
|
// pdr.readFromFile(sFilePath);
|
||||||
// valueLeavesPD.apply(pdr);
|
// valueLeavesPD.apply(pdr);
|
||||||
// nTotalLoaded += CFile::getFileSize(sFilePath);
|
// nTotalLoaded += CFile::getFileSize(sFilePath);
|
||||||
//
|
//
|
||||||
|
@ -910,7 +910,7 @@ void CStatDB::load()
|
||||||
// pdr.clear();
|
// pdr.clear();
|
||||||
// CStatDBTableLeafPD tableLeafPD;
|
// CStatDBTableLeafPD tableLeafPD;
|
||||||
//
|
//
|
||||||
// pdr.readFromFile(fileName.c_str());
|
// pdr.readFromFile(fileName);
|
||||||
// tableLeafPD.apply(pdr);
|
// tableLeafPD.apply(pdr);
|
||||||
// nTotalLoaded += CFile::getFileSize(fileName);
|
// nTotalLoaded += CFile::getFileSize(fileName);
|
||||||
//
|
//
|
||||||
|
|
|
@ -60,9 +60,9 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeGuildIdFix,"set the guild ids in the
|
||||||
nlinfo("Setting id for guild: %s to: %d",fdc[i].FileName.c_str(),id);
|
nlinfo("Setting id for guild: %s to: %d",fdc[i].FileName.c_str(),id);
|
||||||
|
|
||||||
// read the file
|
// read the file
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(fdc[i].FileName.c_str());
|
pdr.readFromFile(fdc[i].FileName);
|
||||||
|
|
||||||
// convert to XML
|
// convert to XML
|
||||||
NLMISC::CSString inputString;
|
NLMISC::CSString inputString;
|
||||||
|
@ -80,8 +80,8 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeGuildIdFix,"set the guild ids in the
|
||||||
pdr.fromXML(resultString);
|
pdr.fromXML(resultString);
|
||||||
|
|
||||||
// write the file
|
// write the file
|
||||||
pdr.writeToFile((fdc[i].FileName+".new.xml").c_str());
|
pdr.writeToFile(fdc[i].FileName+".new.xml");
|
||||||
pdr.writeToFile((fdc[i].FileName+".new.bin").c_str());
|
pdr.writeToFile(fdc[i].FileName+".new.bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -107,9 +107,9 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeChangeCharacterNames,"change names of
|
||||||
// read the file
|
// read the file
|
||||||
NLMISC::CSString fileName= args[0]+NLMISC::toString("/characters/account_%d_%d_pdr.bin",account,slot);
|
NLMISC::CSString fileName= args[0]+NLMISC::toString("/characters/account_%d_%d_pdr.bin",account,slot);
|
||||||
DROP_IF(!NLMISC::CFile::fileExists(fileName),"Skipping inexistant file: "+fileName,continue);
|
DROP_IF(!NLMISC::CFile::fileExists(fileName),"Skipping inexistant file: "+fileName,continue);
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(fileName.c_str());
|
pdr.readFromFile(fileName);
|
||||||
|
|
||||||
// convert to XML
|
// convert to XML
|
||||||
NLMISC::CSString inputString;
|
NLMISC::CSString inputString;
|
||||||
|
@ -127,8 +127,8 @@ NLMISC_CATEGORISED_COMMAND(ShardMerge,mergeChangeCharacterNames,"change names of
|
||||||
pdr.fromXML(resultString);
|
pdr.fromXML(resultString);
|
||||||
|
|
||||||
// write the file
|
// write the file
|
||||||
pdr.writeToFile((fileName+".new.xml").c_str());
|
pdr.writeToFile(fileName+".new.xml");
|
||||||
pdr.writeToFile((fileName+".new.bin").c_str());
|
pdr.writeToFile(fileName+".new.bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -139,9 +139,9 @@ NLMISC_CATEGORISED_COMMAND(Stats,listCharNames,"display the names of the charact
|
||||||
std::sort(files.begin(),files.end());
|
std::sort(files.begin(),files.end());
|
||||||
for (uint32 i=0;i<files.size();++i)
|
for (uint32 i=0;i<files.size();++i)
|
||||||
{
|
{
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(files[i].c_str());
|
pdr.readFromFile(files[i]);
|
||||||
|
|
||||||
CStatsScanCharacter c;
|
CStatsScanCharacter c;
|
||||||
c.apply(pdr);
|
c.apply(pdr);
|
||||||
|
|
|
@ -286,7 +286,7 @@ bool CCharacterScanJob::runForFile(const std::string& fileName)
|
||||||
// load the file into a pdr record
|
// load the file into a pdr record
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(fileName.c_str());
|
pdr.readFromFile(fileName);
|
||||||
|
|
||||||
// create a character representation and apply the pdr
|
// create a character representation and apply the pdr
|
||||||
CStatsScanCharacter c;
|
CStatsScanCharacter c;
|
||||||
|
|
|
@ -308,9 +308,9 @@ NLMISC_CATEGORISED_COMMAND(Stats,listCharNames,"display the names of the charact
|
||||||
std::sort(files.begin(),files.end());
|
std::sort(files.begin(),files.end());
|
||||||
for (uint32 i=0;i<files.size();++i)
|
for (uint32 i=0;i<files.size();++i)
|
||||||
{
|
{
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(files[i].c_str());
|
pdr.readFromFile(files[i]);
|
||||||
|
|
||||||
CStatsScanCharacter c;
|
CStatsScanCharacter c;
|
||||||
c.apply(pdr);
|
c.apply(pdr);
|
||||||
|
|
|
@ -284,9 +284,9 @@ bool CCharacterScanJob::deleteFilesInOutputDirectory() const
|
||||||
bool CCharacterScanJob::runForFile(const std::string& fileName)
|
bool CCharacterScanJob::runForFile(const std::string& fileName)
|
||||||
{
|
{
|
||||||
// load the file into a pdr record
|
// load the file into a pdr record
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(fileName.c_str());
|
pdr.readFromFile(fileName);
|
||||||
|
|
||||||
// create a character representation and apply the pdr
|
// create a character representation and apply the pdr
|
||||||
CStatsScanCharacter c;
|
CStatsScanCharacter c;
|
||||||
|
|
|
@ -91,8 +91,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrBin2xml,"convert a binary pdr file to xml","
|
||||||
|
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromBinFile(args[0].c_str());
|
pdr.readFromBinFile(args[0]);
|
||||||
pdr.writeToTxtFile(args[1].c_str());
|
pdr.writeToTxtFile(args[1]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,8 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrXml2bin,"convert a text pdr file to binary",
|
||||||
|
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromTxtFile(args[0].c_str());
|
pdr.readFromTxtFile(args[0]);
|
||||||
pdr.writeToBinFile(args[1].c_str());
|
pdr.writeToBinFile(args[1]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -136,10 +136,10 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2xml,"convert one or more sets of pdr files
|
||||||
fd.FileName.rightCrop(4)+".xml": fd.FileName+".xml";
|
fd.FileName.rightCrop(4)+".xml": fd.FileName+".xml";
|
||||||
|
|
||||||
log.displayNL("Converting to XML : %s => %s",fd.FileName.c_str(),outputFileName.c_str());
|
log.displayNL("Converting to XML : %s => %s",fd.FileName.c_str(),outputFileName.c_str());
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(fd.FileName.c_str());
|
pdr.readFromFile(fd.FileName);
|
||||||
pdr.writeToFile(outputFileName.c_str());
|
pdr.writeToFile(outputFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,10 +168,10 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2bin,"convert one or more sets of pdr files
|
||||||
fd.FileName.rightCrop(4)+".bin": fd.FileName+".bin";
|
fd.FileName.rightCrop(4)+".bin": fd.FileName+".bin";
|
||||||
|
|
||||||
log.displayNL("Converting to Binary : %s => %s",fd.FileName.c_str(),outputFileName.c_str());
|
log.displayNL("Converting to Binary : %s => %s",fd.FileName.c_str(),outputFileName.c_str());
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(fd.FileName.c_str());
|
pdr.readFromFile(fd.FileName);
|
||||||
pdr.writeToFile(outputFileName.c_str());
|
pdr.writeToFile(outputFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,10 +200,10 @@ NLMISC_CATEGORISED_COMMAND(utils,pdr2txt,"convert one or more sets of pdr files
|
||||||
fd.FileName.rightCrop(4)+".txt": fd.FileName+".txt";
|
fd.FileName.rightCrop(4)+".txt": fd.FileName+".txt";
|
||||||
|
|
||||||
log.displayNL("Converting to TXT : %s => %s",fd.FileName.c_str(),outputFileName.c_str());
|
log.displayNL("Converting to TXT : %s => %s",fd.FileName.c_str(),outputFileName.c_str());
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(fd.FileName.c_str());
|
pdr.readFromFile(fd.FileName);
|
||||||
pdr.writeToFile(outputFileName.c_str());
|
pdr.writeToFile(outputFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,10 +218,10 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrFileCompare,"Compare 2 pdr files","<first fi
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CPersistentDataRecord pdr0;
|
CPersistentDataRecord pdr0;
|
||||||
pdr0.readFromFile(args[0].c_str());
|
pdr0.readFromFile(args[0]);
|
||||||
|
|
||||||
CPersistentDataRecord pdr1;
|
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());
|
log.displayNL("%s : %s / %s", (pdr0==pdr1)?"Files MATCH":"Files DON'T match", args[0].c_str(), args[1].c_str());
|
||||||
|
|
||||||
|
@ -264,17 +264,18 @@ NLMISC_CATEGORISED_COMMAND(utils,pdrInfo,"Extract info from pdr file(s)","<input
|
||||||
for (uint32 j=0;j<fdc.size();++j)
|
for (uint32 j=0;j<fdc.size();++j)
|
||||||
{
|
{
|
||||||
H_AUTO(pdrInfo_treatFile)
|
H_AUTO(pdrInfo_treatFile)
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
|
|
||||||
const CFileDescription& fd=fdc[j];
|
const CFileDescription& fd=fdc[j];
|
||||||
log.display("- %s: ",fd.FileName.quoteIfNotQuoted().c_str());
|
log.display("- %s: ", fd.FileName.quoteIfNotQuoted().c_str());
|
||||||
|
|
||||||
{
|
{
|
||||||
H_AUTO(pdrInfo_readFromFile)
|
H_AUTO(pdrInfo_readFromFile)
|
||||||
pdr.readFromFile(fd.FileName.c_str());
|
pdr.readFromFile(fd.FileName);
|
||||||
}
|
}
|
||||||
log.displayNL("%s",pdr.getInfo().c_str());
|
|
||||||
|
log.displayNL("%s", pdr.getInfo().c_str());
|
||||||
|
|
||||||
if (!outputFileName.empty())
|
if (!outputFileName.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ void GenerateLZMA(const std::string sourceFile, const std::string &outputFile)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
// old syntax incompatible with new versions
|
// old syntax incompatible with new versions
|
||||||
std::string cmd = "lzma e ";
|
std::string cmd = "lzma e";
|
||||||
cmd += " " + sourceFile + " " + outputFile;
|
cmd += " " + sourceFile + " " + outputFile;
|
||||||
nlinfo("Executing system command: %s", cmd.c_str());
|
nlinfo("Executing system command: %s", cmd.c_str());
|
||||||
}
|
}
|
||||||
|
@ -187,38 +187,38 @@ void CPackageDescription::setup(const std::string& packageName)
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
// read new contents from input file
|
// read new contents from input file
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromTxtFile(packageName.c_str());
|
pdr.readFromTxtFile(packageName);
|
||||||
apply(pdr);
|
apply(pdr);
|
||||||
|
|
||||||
// root directory
|
// root directory
|
||||||
if (_RootDirectory.empty())
|
if (_RootDirectory.empty())
|
||||||
_RootDirectory= NLMISC::CFile::getPath(packageName);
|
_RootDirectory = NLMISC::CFile::getPath(packageName);
|
||||||
_RootDirectory= NLMISC::CPath::standardizePath(_RootDirectory,true);
|
_RootDirectory = NLMISC::CPath::standardizePath(_RootDirectory, true);
|
||||||
|
|
||||||
// patch directory
|
// patch directory
|
||||||
if (_PatchDirectory.empty())
|
if (_PatchDirectory.empty())
|
||||||
_PatchDirectory= _RootDirectory+"patch";
|
_PatchDirectory = _RootDirectory + "patch";
|
||||||
_PatchDirectory= NLMISC::CPath::standardizePath(_PatchDirectory,true);
|
_PatchDirectory = NLMISC::CPath::standardizePath(_PatchDirectory, true);
|
||||||
|
|
||||||
// BNP directory
|
// BNP directory
|
||||||
if (_BnpDirectory.empty())
|
if (_BnpDirectory.empty())
|
||||||
_BnpDirectory= _RootDirectory+"bnp";
|
_BnpDirectory = _RootDirectory+"bnp";
|
||||||
_BnpDirectory= NLMISC::CPath::standardizePath(_BnpDirectory,true);
|
_BnpDirectory = NLMISC::CPath::standardizePath(_BnpDirectory, true);
|
||||||
|
|
||||||
// ref directory
|
// ref directory
|
||||||
if (_RefDirectory.empty())
|
if (_RefDirectory.empty())
|
||||||
_RefDirectory= _RootDirectory+"ref";
|
_RefDirectory = _RootDirectory+"ref";
|
||||||
_RefDirectory= NLMISC::CPath::standardizePath(_RefDirectory,true);
|
_RefDirectory = NLMISC::CPath::standardizePath(_RefDirectory, true);
|
||||||
|
|
||||||
// client index file
|
// client index file
|
||||||
if (_ClientIndexFileName.empty())
|
if (_ClientIndexFileName.empty())
|
||||||
_ClientIndexFileName= NLMISC::CFile::getFilenameWithoutExtension(packageName)+".idx";
|
_ClientIndexFileName = NLMISC::CFile::getFilenameWithoutExtension(packageName)+".idx";
|
||||||
|
|
||||||
// index file
|
// index file
|
||||||
if (_IndexFileName.empty())
|
if (_IndexFileName.empty())
|
||||||
_IndexFileName= NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName)+".hist";
|
_IndexFileName = NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName)+".hist";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPackageDescription::storeToPdr(CPersistentDataRecord& pdr) const
|
void CPackageDescription::storeToPdr(CPersistentDataRecord& pdr) const
|
||||||
|
@ -229,30 +229,34 @@ void CPackageDescription::storeToPdr(CPersistentDataRecord& pdr) const
|
||||||
|
|
||||||
void CPackageDescription::readIndex(CBNPFileSet& packageIndex) 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
|
// clear out old contents before reading from input file
|
||||||
packageIndex.clear();
|
packageIndex.clear();
|
||||||
|
|
||||||
// read new contents from input file
|
// read new contents from input file
|
||||||
if (NLMISC::CFile::fileExists(_RootDirectory+_IndexFileName))
|
if (NLMISC::CFile::fileExists(indexPath))
|
||||||
{
|
{
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromTxtFile((_RootDirectory+_IndexFileName).c_str());
|
pdr.readFromTxtFile(indexPath);
|
||||||
packageIndex.apply(pdr);
|
packageIndex.apply(pdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPackageDescription::writeIndex(const CBNPFileSet& packageIndex) const
|
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
|
// write contents to output file
|
||||||
static CPersistentDataRecordRyzomStore pdr;
|
static CPersistentDataRecordRyzomStore pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
packageIndex.store(pdr);
|
packageIndex.store(pdr);
|
||||||
pdr.writeToTxtFile((_RootDirectory+_IndexFileName).c_str());
|
pdr.writeToTxtFile(indexPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPackageDescription::getCategories(CPersistentDataRecord &pdr) const
|
void CPackageDescription::getCategories(CPersistentDataRecord &pdr) const
|
||||||
|
@ -285,18 +289,22 @@ void CPackageDescription::updateIndexFileList(CBNPFileSet& packageIndex) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPackageDescription::generateClientIndex(CProductDescriptionForClient& theClientPackage,const 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
|
// 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
|
// clear out the client package before we start
|
||||||
theClientPackage.clear();
|
theClientPackage.clear();
|
||||||
|
|
||||||
// copy the categories using a pdr record
|
// copy the categories using a pdr record
|
||||||
static CPersistentDataRecordRyzomStore pdr;
|
static CPersistentDataRecordRyzomStore pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
_Categories.store(pdr);
|
_Categories.store(pdr);
|
||||||
theClientPackage.setCategories(pdr);
|
theClientPackage.setCategories(pdr);
|
||||||
|
@ -310,11 +318,10 @@ void CPackageDescription::generateClientIndex(CProductDescriptionForClient& theC
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
theClientPackage.store(pdr);
|
theClientPackage.store(pdr);
|
||||||
|
|
||||||
std::string newName = _PatchDirectory + toString("%05u/", packageIndex.getVersionNumber()) + NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName);
|
std::string newName = patchDirectory + "/" + NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName) + "_" + patchNumber;
|
||||||
newName += NLMISC::toString("_%05u", packageIndex.getVersionNumber());
|
|
||||||
|
|
||||||
pdr.writeToBinFile((newName+".idx").c_str());
|
pdr.writeToBinFile(newName + ".idx");
|
||||||
pdr.writeToTxtFile((newName+"_debug.xml").c_str());
|
pdr.writeToTxtFile(newName + "_debug.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPackageDescription::addVersion(CBNPFileSet& packageIndex)
|
void CPackageDescription::addVersion(CBNPFileSet& packageIndex)
|
||||||
|
@ -341,14 +348,14 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
||||||
{
|
{
|
||||||
nlinfo("Generating patches ...");
|
nlinfo("Generating patches ...");
|
||||||
|
|
||||||
for (uint32 i=packageIndex.fileCount();i--;)
|
for (uint32 i = packageIndex.fileCount(); i--;)
|
||||||
{
|
{
|
||||||
bool deleteRefAfterDelta= true;
|
bool deleteRefAfterDelta = true;
|
||||||
bool usingTemporaryFile = false;
|
bool usingTemporaryFile = false;
|
||||||
// generate file name root
|
// generate file name root
|
||||||
std::string bnpFileName= _BnpDirectory+packageIndex.getFile(i).getFileName();
|
std::string bnpFileName = _BnpDirectory + packageIndex.getFile(i).getFileName();
|
||||||
std::string refNameRoot= _RefDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
std::string refNameRoot = _RefDirectory + NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
||||||
std::string patchNameRoot= _PatchDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
std::string patchNameRoot = _PatchDirectory + NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
||||||
|
|
||||||
// if the file has no versions then skip on to the next file
|
// if the file has no versions then skip on to the next file
|
||||||
if (packageIndex.getFile(i).versionCount()==0)
|
if (packageIndex.getFile(i).versionCount()==0)
|
||||||
|
@ -358,7 +365,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
||||||
const CBNPFileVersion& curVersion= packageIndex.getFile(i).getVersion(packageIndex.getFile(i).versionCount()-1);
|
const CBNPFileVersion& curVersion= packageIndex.getFile(i).getVersion(packageIndex.getFile(i).versionCount()-1);
|
||||||
std::string curVersionFileName= refNameRoot+NLMISC::toString("_%05u.%s",curVersion.getVersionNumber(),NLMISC::CFile::getExtension(bnpFileName).c_str());
|
std::string curVersionFileName= refNameRoot+NLMISC::toString("_%05u.%s",curVersion.getVersionNumber(),NLMISC::CFile::getExtension(bnpFileName).c_str());
|
||||||
// std::string patchFileName= patchNameRoot+NLMISC::toString("_%05d.patch",curVersion.getVersionNumber());
|
// std::string patchFileName= patchNameRoot+NLMISC::toString("_%05d.patch",curVersion.getVersionNumber());
|
||||||
std::string patchFileName= _PatchDirectory+toString("%05u/",curVersion.getVersionNumber())+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+toString("_%05u",curVersion.getVersionNumber())+".patch";
|
std::string patchFileName= _PatchDirectory + toString("%05u/",curVersion.getVersionNumber())+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+toString("_%05u",curVersion.getVersionNumber())+".patch";
|
||||||
|
|
||||||
// get the second last version number and the related file name
|
// get the second last version number and the related file name
|
||||||
std::string prevVersionFileName;
|
std::string prevVersionFileName;
|
||||||
|
@ -377,7 +384,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
||||||
std::string refVersionFileName= prevVersionFileName;
|
std::string refVersionFileName= prevVersionFileName;
|
||||||
|
|
||||||
// create the subdirectory for this patch number
|
// create the subdirectory for this patch number
|
||||||
string versionSubDir = _PatchDirectory+"/"+toString("%05u/", curVersion.getVersionNumber());
|
string versionSubDir = _PatchDirectory + toString("%05u/", curVersion.getVersionNumber());
|
||||||
CFile::createDirectory(versionSubDir);
|
CFile::createDirectory(versionSubDir);
|
||||||
|
|
||||||
// generate the lzma packed version of the bnp if needed (lzma file are slow to generate)
|
// generate the lzma packed version of the bnp if needed (lzma file are slow to generate)
|
||||||
|
@ -406,7 +413,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
||||||
refVersionFileName= _BnpDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+"_.ref";
|
refVersionFileName= _BnpDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+"_.ref";
|
||||||
|
|
||||||
// delete the previous patch - because we only need the latest patch for non-incremental files
|
// delete the previous patch - because we only need the latest patch for non-incremental files
|
||||||
std::string lastPatch= _PatchDirectory+NLMISC::CFile::getFilenameWithoutExtension(prevVersionFileName)+".patch";
|
std::string lastPatch= _PatchDirectory + NLMISC::CFile::getFilenameWithoutExtension(prevVersionFileName)+".patch";
|
||||||
if (NLMISC::CFile::fileExists(lastPatch.c_str()))
|
if (NLMISC::CFile::fileExists(lastPatch.c_str()))
|
||||||
NLMISC::CFile::deleteFile(lastPatch.c_str());
|
NLMISC::CFile::deleteFile(lastPatch.c_str());
|
||||||
}
|
}
|
||||||
|
@ -545,17 +552,18 @@ static bool createNewProduct(std::string fileName)
|
||||||
|
|
||||||
// create a new package, store it to a persistent data record and write the latter to a file
|
// create a new package, store it to a persistent data record and write the latter to a file
|
||||||
CPackageDescription package;
|
CPackageDescription package;
|
||||||
static CPersistentDataRecordRyzomStore pdr;
|
static CPersistentDataRecordRyzomStore pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
package.storeToPdr(pdr);
|
package.storeToPdr(pdr);
|
||||||
pdr.writeToTxtFile(fileName.c_str());
|
pdr.writeToTxtFile(fileName);
|
||||||
package.setup(fileName);
|
package.setup(fileName);
|
||||||
package.createDirectories();
|
package.createDirectories();
|
||||||
package.buildDefaultFileList();
|
package.buildDefaultFileList();
|
||||||
package.storeToPdr(pdr);
|
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);
|
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());
|
nlinfo("New package description file created successfully: %s", fileName.c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,7 @@ int main(int argc, char *argv[])
|
||||||
outputFileName += outExt;
|
outputFileName += outExt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
|
|
||||||
switch(mode)
|
switch(mode)
|
||||||
|
@ -258,25 +258,25 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("Converting '%s' (XML) to '%s' (BINARY)\n", fileName.c_str(), outputFileName.c_str() );
|
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;
|
goto failureRead;
|
||||||
if (!pdr.writeToBinFile(outputFileName.c_str()))
|
if (!pdr.writeToBinFile(outputFileName))
|
||||||
goto failureWrite;
|
goto failureWrite;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cm_to_xml:
|
case cm_to_xml:
|
||||||
printf("Converting '%s' (BINARY) to '%s' (XML)\n", fileName.c_str(), outputFileName.c_str() );
|
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;
|
goto failureRead;
|
||||||
if (!pdr.writeToTxtFile(outputFileName.c_str(), CPersistentDataRecord::XML_STRING))
|
if (!pdr.writeToTxtFile(outputFileName, CPersistentDataRecord::XML_STRING))
|
||||||
goto failureWrite;
|
goto failureWrite;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cm_to_txt:
|
case cm_to_txt:
|
||||||
printf("Converting '%s' (BINARY) to '%s' (TXT)\n", fileName.c_str(), outputFileName.c_str() );
|
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;
|
goto failureRead;
|
||||||
if (!pdr.writeToTxtFile(outputFileName.c_str(), CPersistentDataRecord::LINES_STRING))
|
if (!pdr.writeToTxtFile(outputFileName, CPersistentDataRecord::LINES_STRING))
|
||||||
goto failureWrite;
|
goto failureWrite;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -140,14 +140,14 @@ NLMISC_COMMAND(listCharNames,"display the names of the characters int he listed
|
||||||
std::sort(files.begin(),files.end());
|
std::sort(files.begin(),files.end());
|
||||||
for (uint32 i=0;i<files.size();++i)
|
for (uint32 i=0;i<files.size();++i)
|
||||||
{
|
{
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(files[i].c_str());
|
pdr.readFromFile(files[i]);
|
||||||
|
|
||||||
CStatsScanCharacter c;
|
CStatsScanCharacter c;
|
||||||
c.apply(pdr);
|
c.apply(pdr);
|
||||||
|
|
||||||
log.displayNL("%-40s Name: %s ",files[i].c_str(),c.EntityBase._Name.c_str());
|
log.displayNL("%-40s Name: %s ", files[i].c_str(), c.EntityBase._Name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -97,9 +97,9 @@ void CCharacterScanJob::update()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// load the file into a pdr record
|
// load the file into a pdr record
|
||||||
static CPersistentDataRecord pdr;
|
static CPersistentDataRecord pdr;
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
pdr.readFromFile(_Files[_NextFile].c_str());
|
pdr.readFromFile(_Files[_NextFile]);
|
||||||
++_NextFile;
|
++_NextFile;
|
||||||
|
|
||||||
// create a character representation and apply the pdr
|
// create a character representation and apply the pdr
|
||||||
|
|
Loading…
Reference in a new issue