Merging default.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
commit 16290f7ff9

@ -106,7 +106,6 @@ IF(WIN32)
ENDIF(WITH_MFC)
ENDIF(WIN32)
FIND_PACKAGE(Threads REQUIRED)
FIND_PACKAGE(LibXml2 REQUIRED)
FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(Jpeg)
@ -114,6 +113,7 @@ FIND_PACKAGE(Jpeg)
IF(WITH_STATIC_LIBXML2)
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
ENDIF(WITH_STATIC_LIBXML2)
IF(WITH_STATIC)
# libxml2 could need winsock2 library
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
@ -144,6 +144,36 @@ IF(WITH_NEL)
IF(WITH_GUI)
FIND_PACKAGE(Libwww REQUIRED)
IF(WITH_LUA51)
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(WITH_LUA51)
FIND_PACKAGE(Lua50 REQUIRED)
ENDIF(WITH_LUA51)
FIND_PACKAGE(Luabind REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
SET(CURL_STATIC ON)
ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
IF(CURL_STATIC)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
FIND_PACKAGE(OpenSSL QUIET)
IF(OPENSSL_FOUND)
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
# CURL Macports version depends on libidn, libintl and libiconv too
IF(APPLE)
FIND_LIBRARY(IDN_LIBRARY idn)
FIND_LIBRARY(INTL_LIBRARY intl)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY})
ENDIF(APPLE)
ENDIF(CURL_STATIC)
ENDIF(WITH_GUI)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR})

@ -0,0 +1,149 @@
IF(DEFINED CMAKE_CROSSCOMPILING)
# subsequent toolchain loading is not really needed
RETURN()
ENDIF()
# Standard settings
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Linux version
SET(UNIX ON)
SET(LINUX ON)
SET(ANDROID ON)
IF(NOT NDK_ROOT)
SET(NDK_ROOT $ENV{NDK_ROOT})
IF(CMAKE_HOST_WIN32)
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
ENDIF(CMAKE_HOST_WIN32)
ENDIF(NOT NDK_ROOT)
IF(NOT TARGET_CPU)
SET(TARGET_CPU "armv7")
ENDIF(NOT TARGET_CPU)
IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(LIBRARY_ARCHITECTURE "x86")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
SET(TOOLCHAIN_ARCH "x86")
SET(TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686")
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "mips")
SET(LIBRARY_ARCHITECTURE "mips")
SET(CMAKE_SYSTEM_PROCESSOR "mips")
SET(TOOLCHAIN_ARCH "mips")
SET(TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
SET(MINIMUM_NDK_TARGET 9)
ENDIF(TARGET_CPU STREQUAL "armv7")
IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF(NOT NDK_TARGET)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${TOOLCHAIN_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND NDK_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
ENDFOREACH(_TOOLCHAIN_VERSION)
ENDIF(_TOOLCHAIN_VERSIONS)
IF(NOT NDK_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF(NOT NDK_TOOLCHAIN_VERSIONS)
IF(NDK_TOOLCHAIN_VERSION)
LIST(FIND NDK_TOOLCHAIN_VERSIONS "${NDK_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(_INDEX EQUAL -1)
ELSE(NDK_TOOLCHAIN_VERSION)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(NDK_TOOLCHAIN_VERSION)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${NDK_TOOLCHAIN_VERSION}")
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows")
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
ELSEIF(CMAKE_HOST_APPLE)
SET(TOOLCHAIN_HOST "apple")
SET(TOOLCHAIN_BIN_SUFFIX "")
ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_HOST "linux")
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-${NDK_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
IF(NOT EXISTS "${TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF(NOT EXISTS "${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android toolchain in ${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
# include dirs
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
# NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
# Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${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 "${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_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
INCLUDE_DIRECTORIES(${STL_INCLUDE_DIR} ${STL_INCLUDE_CPU_DIR})
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
SET(${_NAME} ${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX})
ENDMACRO(SET_TOOLCHAIN_BINARY)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
# Force the compilers to GCC for Android
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)

@ -4,42 +4,35 @@
# MFC_LIBRARY_DIR, where to find libraries
# MFC_INCLUDE_DIR, where to find headers
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF(CustomMFC_FIND_REQUIRED)
# Try to find MFC using official module, MFC_FOUND is set
FIND_PACKAGE(MFC)
SET(CUSTOM_MFC_DIR FALSE)
# If using STLport and MFC have been found, remember its directory
IF(WITH_STLPORT AND MFC_FOUND AND VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(WITH_STLPORT AND MFC_FOUND AND VC_DIR)
IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
IF(MFC_FOUND AND VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(MFC_FOUND AND VC_DIR)
# If using STLport or MFC haven't been found, search for afxwin.h
IF(WITH_STLPORT OR NOT MFC_FOUND)
FIND_PATH(MFC_DIR
include/afxwin.h
PATHS
HINTS
${MFC_STANDARD_DIR}
)
ENDIF(NOT MFC_DIR)
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF(CustomMFC_FIND_REQUIRED)
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
IF(MFC_FOUND)
SET(CUSTOM_MFC_DIR TRUE)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
ENDIF(MFC_FOUND)
ENDIF(WITH_STLPORT OR NOT MFC_FOUND)
IF(MFC_FOUND)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
# Only if using a custom path
IF(CUSTOM_MFC_DIR)
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
@ -49,9 +42,7 @@ IF(CUSTOM_MFC_DIR)
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
ENDIF(CUSTOM_MFC_DIR)
IF(MFC_FOUND)
# Set definitions for using MFC in DLL
SET(MFC_DEFINITIONS -D_AFXDLL)
ENDIF(MFC_FOUND)

@ -1,38 +0,0 @@
# - Find DirectInput
# Find the DirectSound includes and libraries
#
# DINPUT_INCLUDE_DIR - where to find dinput.h
# DINPUT_LIBRARIES - List of libraries when using DirectInput.
# DINPUT_FOUND - True if DirectInput found.
if(DINPUT_INCLUDE_DIR)
# Already in cache, be silent
set(DINPUT_FIND_QUIETLY TRUE)
endif(DINPUT_INCLUDE_DIR)
find_path(DINPUT_INCLUDE_DIR dinput.h
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Include"
)
find_library(DINPUT_LIBRARY
NAMES dinput dinput8
PATHS
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Lib"
"$ENV{DXSDK_DIR}/Lib/x86"
)
# Handle the QUIETLY and REQUIRED arguments and set DINPUT_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DINPUT DEFAULT_MSG
DINPUT_INCLUDE_DIR DINPUT_LIBRARY)
if(DINPUT_FOUND)
set(DINPUT_LIBRARIES ${DINPUT_LIBRARY})
else(DINPUT_FOUND)
set(DINPUT_LIBRARIES)
endif(DINPUT_FOUND)
mark_as_advanced(DINPUT_INCLUDE_DIR DINPUT_LIBRARY)

@ -6,8 +6,8 @@
# DXSDK_FOUND - True if MAX SDK found.
IF(DXSDK_DIR)
# Already in cache, be silent
SET(DXSDK_FIND_QUIETLY TRUE)
# Already in cache, be silent
SET(DXSDK_FIND_QUIETLY TRUE)
ENDIF(DXSDK_DIR)
FIND_PATH(DXSDK_DIR
@ -26,10 +26,10 @@ FIND_PATH(DXSDK_DIR
MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
"${DXSDK_LIBRARY_DIR}"
)
NAMES ${MYLIBRARYNAME}
PATHS
"${DXSDK_LIBRARY_DIR}"
)
ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
IF(DXSDK_DIR)

@ -1,14 +1,13 @@
# - Locate FreeType library
# This module defines
# FREETYPE_LIBRARY, the library to link against
# FREETYPE_LIBRARIES, libraries to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
# in cache already
SET(FREETYPE_FIND_QUIETLY TRUE)
ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
SET(Freetype_FIND_QUIETLY TRUE)
ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
FIND_PATH(FREETYPE_INCLUDE_DIRS
freetype
@ -40,7 +39,7 @@ IF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR})
ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
FIND_LIBRARY(FREETYPE_LIBRARY
FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE
NAMES freetype libfreetype freetype219 freetype246
PATHS
$ENV{FREETYPE_DIR}/lib
@ -55,20 +54,50 @@ FIND_LIBRARY(FREETYPE_LIBRARY
/usr/freeware/lib64
)
IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_FOUND "YES")
FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG
NAMES freetyped libfreetyped freetype219d freetype246d
PATHS
$ENV{FREETYPE_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES optimized ${FREETYPE_LIBRARY_RELEASE} debug ${FREETYPE_LIBRARY_DEBUG})
ELSEIF(FREETYPE_LIBRARY_RELEASE)
# Normal case
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_RELEASE})
ELSEIF(FREETYPE_LIBRARY_DEBUG)
# Case where Freetype is compiled from sources (debug version is compiled by default)
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG})
ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
ENDIF(FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_FOUND)
IF(WITH_STATIC_EXTERNAL AND APPLE)
FIND_PACKAGE(BZip2)
IF(BZIP2_FOUND)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR})
SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARY} ${BZIP2_LIBRARIES})
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES})
ENDIF(BZIP2_FOUND)
ENDIF(WITH_STATIC_EXTERNAL AND APPLE)
IF(NOT FREETYPE_FIND_QUIETLY)
MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARY}")
ENDIF(NOT FREETYPE_FIND_QUIETLY)
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}")
ENDIF(NOT Freetype_FIND_QUIETLY)
ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
IF(NOT FREETYPE_FIND_QUIETLY)
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FreeType!")
ENDIF(NOT FREETYPE_FIND_QUIETLY)
ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
ENDIF(NOT Freetype_FIND_QUIETLY)
ENDIF(FREETYPE_FOUND)

@ -3,17 +3,15 @@
#
# This module defines
# LIBWWW_INCLUDE_DIR, where to find tiff.h, etc.
# LIBWWW_LIBRARY, where to find the LibWWW library.
# LIBWWW_FOUND, If false, do not try to use LibWWW.
# LIBWWW_LIBRARY, where to find the Libwww library.
# LIBWWW_FOUND, If false, do not try to use Libwww.
OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF)
SET(LIBWWW_FIND_QUIETLY ${Libwww_FIND_QUIETLY})
# also defined, but not for general use are
IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR)
# in cache already
SET(LIBWWW_FIND_QUIETLY TRUE)
SET(Libwww_FIND_QUIETLY TRUE)
ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR)
FIND_PATH(LIBWWW_INCLUDE_DIR
@ -47,14 +45,29 @@ IF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
# helper to find all the libwww sub libraries
MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION)
MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION FILE)
IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${ARGN}
FIND_LIBRARY(${MYLIBRARY}_RELEASE
NAMES ${FILE}
PATHS
/usr/local/lib
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(${MYLIBRARY}_DEBUG
NAMES ${FILE}d
PATHS
/usr/local/lib
/usr/lib
@ -72,17 +85,25 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
IF(${MYLIBRARY})
IF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG)
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} optimized ${${MYLIBRARY}_RELEASE} debug ${${MYLIBRARY}_DEBUG})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSEIF(${MYLIBRARY}_RELEASE)
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_RELEASE})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSEIF(${MYLIBRARY}_DEBUG)
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}})
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_DEBUG})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSE(${MYLIBRARY})
IF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32)
ELSE(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG)
IF(NOT Libwww_FIND_QUIETLY AND NOT WIN32)
MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}")
ENDIF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32)
ENDIF(${MYLIBRARY})
ENDIF(NOT Libwww_FIND_QUIETLY AND NOT WIN32)
ENDIF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG)
MARK_AS_ADVANCED(${MYLIBRARY})
MARK_AS_ADVANCED(${MYLIBRARY}_RELEASE ${MYLIBRARY}_DEBUG)
ENDMACRO(FIND_WWW_LIBRARY)
MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL)
@ -163,7 +184,7 @@ LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBREGEX_LIBRARY regexec)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY OPENSSL_LIBRARIES SSL_new)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibWWW DEFAULT_MSG
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libwww DEFAULT_MSG
LIBWWW_LIBRARIES
LIBWWW_INCLUDE_DIR
)

@ -0,0 +1,76 @@
# - Find MS Visual C++
#
# VC_INCLUDE_DIR - where to find headers
# VC_INCLUDE_DIRS - where to find headers
# VC_LIBRARY_DIR - where to find libraries
# VC_FOUND - True if MSVC found.
MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
# Software/Wow6432Node/...
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR)
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND ON)
IF(NOT MSVC_FIND_QUIETLY)
MESSAGE(STATUS "Found Visual C++ ${_VERSION} in ${VC${_VERSION}_DIR}")
ENDIF(NOT MSVC_FIND_QUIETLY)
ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND OFF)
SET(VC${_VERSION}_DIR "")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDMACRO(DETECT_VC_VERSION_HELPER)
MACRO(DETECT_VC_VERSION _VERSION)
SET(VC${_VERSION}_FOUND OFF)
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT VC${_VERSION}_FOUND)
IF(NOT VC${_VERSION}_FOUND)
SET(VC_FOUND ON)
SET(VC_DIR "${VC${_VERSION}_DIR}")
ENDIF(NOT VC${_VERSION}_FOUND)
ENDMACRO(DETECT_VC_VERSION)
IF(MSVC11)
DETECT_VC_VERSION("11.0")
IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0")
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC10_REDIST_DIR)
ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0")
ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0")
ENDIF(MSVC11)
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
IF(NOT VC_DIR)
SET(VC_DIR $ENV{VC_DIR})
ENDIF(NOT VC_DIR)
IF(NOT VC_DIR)
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
ENDIF(NOT VC_DIR)
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR})

@ -48,7 +48,8 @@
# License text for the above reference.)
FIND_PROGRAM(Mercurial_HG_EXECUTABLE hg
DOC "mercurial command line client")
DOC "mercurial command line client"
HINTS /opt/local/bin)
MARK_AS_ADVANCED(Mercurial_HG_EXECUTABLE)
IF(Mercurial_HG_EXECUTABLE)
@ -58,7 +59,7 @@ IF(Mercurial_HG_EXECUTABLE)
STRING(REGEX REPLACE ".*version ([\\.0-9]+).*"
"\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}")
MACRO(Mercurial_WC_INFO dir prefix)
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}"
WORKING_DIRECTORY ${dir}

@ -1,50 +0,0 @@
# - Locate S3TC library
# This module defines
# S3TC_LIBRARY, the library to link against
# S3TC_FOUND, if false, do not try to link to S3TC
# S3TC_INCLUDE_DIR, where to find headers.
IF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
# in cache already
SET(S3TC_FIND_QUIETLY TRUE)
ENDIF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
FIND_PATH(S3TC_INCLUDE_DIR
s3_intrf.h
PATHS
$ENV{S3TC_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES S3TC
)
FIND_LIBRARY(S3TC_LIBRARY
NAMES s3tc libs3tc
PATHS
$ENV{S3TC_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
SET(S3TC_FOUND "YES")
IF(NOT S3TC_FIND_QUIETLY)
MESSAGE(STATUS "Found S3TC: ${S3TC_LIBRARY}")
ENDIF(NOT S3TC_FIND_QUIETLY)
ELSE(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
IF(NOT S3TC_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find S3TC!")
ENDIF(NOT S3TC_FIND_QUIETLY)
ENDIF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)

@ -6,80 +6,163 @@
# WINSDK_LIBRARY_DIR - where to find libraries
# WINSDK_FOUND - True if Windows SDK found.
IF(WINSDK_INCLUDE_DIR)
# Already in cache, be silent
SET(WindowsSDK_FIND_QUIETLY TRUE)
ENDIF(WINSDK_INCLUDE_DIR)
IF(WINSDK_FOUND)
# If Windows SDK already found, skip it
RETURN()
ENDIF(WINSDK_FOUND)
# TODO: add the possibility to use a specific Windows SDK
SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer")
IF(MSVC11)
GET_FILENAME_COMPONENT(WINSDK8_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE)
GET_FILENAME_COMPONENT(WINSDK8_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;ProductVersion]" NAME)
MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};InstallationFolder]" ABSOLUTE)
IF(WINSDK8_DIR)
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
SET(WINSDK${_VERSION}_FOUND ON)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_VERSION_FULL "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};ProductVersion]" NAME)
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${WINSDK8_VERSION} in ${WINSDK8_DIR}")
MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
IF(TARGET_ARM)
SET(WINSDK8_SUFFIX "arm")
ELSEIF(TARGET_X64)
SET(WINSDK8_SUFFIX "x64")
ELSEIF(TARGET_X86)
SET(WINSDK8_SUFFIX "x86")
ENDIF(TARGET_ARM)
ENDIF(WINSDK8_DIR)
ENDIF(MSVC11)
GET_FILENAME_COMPONENT(WINSDK71_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;InstallationFolder]" ABSOLUTE CACHE)
GET_FILENAME_COMPONENT(WINSDK71_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;ProductVersion]" NAME)
IF(WINSDK71_DIR)
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${WINSDK71_VERSION} in ${WINSDK71_DIR}")
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
ENDIF(WINSDK71_DIR)
ELSEIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
SET(WINSDK${_VERSION}_DIR "")
ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
ENDMACRO(DETECT_WINSDK_VERSION_HELPER)
MACRO(DETECT_WINSDK_VERSION _VERSION)
SET(WINSDK${_VERSION}_FOUND OFF)
DETECT_WINSDK_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT WINSDK${_VERSION}_FOUND)
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT WINSDK${_VERSION}_FOUND)
ENDMACRO(DETECT_WINSDK_VERSION)
SET(WINSDK_VERSIONS "8.0" "8.0A" "7.1" "7.0A" "6.1" "6.0" "6.0A")
# Search all supported Windows SDKs
FOREACH(_VERSION ${WINSDK_VERSIONS})
DETECT_WINSDK_VERSION(${_VERSION})
ENDFOREACH(_VERSION)
SET(WINSDK_SUFFIX)
IF(TARGET_ARM)
SET(WINSDK8_SUFFIX "arm")
ELSEIF(TARGET_X64)
SET(WINSDK8_SUFFIX "x64")
SET(WINSDK_SUFFIX "x64")
ELSEIF(TARGET_X86)
SET(WINSDK8_SUFFIX "x86")
ENDIF(TARGET_ARM)
GET_FILENAME_COMPONENT(WINSDKCURRENT_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME)
IF(WINSDKCURRENT_DIR)
IF(WINSDKCURRENT_VERSION AND NOT WINSDKCURRENT_VERSION STREQUAL "/registry")
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${WINSDKCURRENT_VERSION} in ${WINSDKCURRENT_DIR}")
# MESSAGE(STATUS "Current version is ${WINSDKCURRENT_VERSION}")
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
ENDIF(WINSDKCURRENT_DIR)
ENDIF(WINSDKCURRENT_VERSION AND NOT WINSDKCURRENT_VERSION STREQUAL "/registry")
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
MACRO(USE_CURRENT_WINSDK)
IF(WINSDKENV_DIR)
SET(WINSDK_VERSION "")
SET(WINSDK_VERSION_FULL "")
SET(WINSDK_DIR ${WINSDKENV_DIR})
FOREACH(_VERSION ${WINSDK_VERSIONS})
IF(WINSDK_DIR STREQUAL WINSDK${_VERSION}_DIR)
SET(WINSDK_VERSION ${_VERSION})
SET(WINSDK_VERSION_FULL "${WINSDK${_VERSION}_VERSION_FULL}")
BREAK()
ENDIF(WINSDK_DIR STREQUAL WINSDK${_VERSION}_DIR)
ENDFOREACH(_VERSION)
ELSE(WINSDKENV_DIR)
# Windows SDK 7.0A doesn't provide 64bits compilers, use SDK 7.1 for 64 bits
IF(WINSDKCURRENT_VERSION STREQUAL WINSDK7.0A_VERSION_FULL)
IF(TARGET_X64)
SET(WINSDK_VERSION "7.1")
SET(WINSDK_VERSION_FULL ${WINSDK7.1_VERSION_FULL})
SET(WINSDK_DIR ${WINSDK7.1_DIR})
ELSE(TARGET_X64)
SET(WINSDK_VERSION "7.0A")
SET(WINSDK_VERSION_FULL ${WINSDK7.0A_VERSION_FULL})
SET(WINSDK_DIR ${WINSDK7.0A_DIR})
ENDIF(TARGET_X64)
ELSE(WINSDKCURRENT_VERSION STREQUAL WINSDK7.0A_VERSION_FULL)
FOREACH(_VERSION ${WINSDK_VERSIONS})
IF(WINSDKCURRENT_VERSION STREQUAL WINSDK${_VERSION}_VERSION)
SET(WINSDK_VERSION ${_VERSION})
SET(WINSDK_VERSION_FULL "${WINSDK${_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${_VERSION}_DIR}")
BREAK()
ENDIF(WINSDKCURRENT_VERSION STREQUAL WINSDK${_VERSION}_VERSION)
ENDFOREACH(_VERSION)
ENDIF(WINSDKCURRENT_VERSION STREQUAL WINSDK7.0A_VERSION_FULL)
ENDIF(WINSDKENV_DIR)
ENDMACRO(USE_CURRENT_WINSDK)
IF(WINSDK_VERSION STREQUAL "CURRENT")
USE_CURRENT_WINSDK()
ELSE(WINSDK_VERSION STREQUAL "CURRENT")
IF(WINSDK${WINSDK_VERSION}_FOUND)
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
ELSE(WINSDK${WINSDK_VERSION}_FOUND)
USE_CURRENT_WINSDK()
ENDIF(WINSDK${WINSDK_VERSION}_FOUND)
ENDIF(WINSDK_VERSION STREQUAL "CURRENT")
IF(WINSDK_DIR)
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
ELSE(WINSDK_DIR)
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
ENDIF(WINSDK_DIR)
# directory where Win32 headers are found
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
HINTS
${WINSDK8_DIR}/Include/um
${WINSDK71_DIR}/Include
${WINSDKCURRENT_DIR}/Include
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
)
# directory where DirectX headers are found
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
HINTS
${WINSDK8_DIR}/Include/shared
${WINSDK71_DIR}/Include
${WINSDKCURRENT_DIR}/Include
${WINSDK_DIR}/Include/shared
${WINSDK_DIR}/Include
)
# directory where all libraries are found
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
HINTS
${WINSDK8_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
${WINSDK71_DIR}/Lib
${WINSDKCURRENT_DIR}/Lib
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/${WINSDK_SUFFIX}
)
# signtool is used to sign executables
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
HINTS
${WINSDK8_DIR}/Bin/x86
${WINSDK71_DIR}/Bin
${WINSDKCURRENT_DIR}/Bin
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
)
# midl is used to generate IDL interfaces
FIND_PROGRAM(WINSDK_MIDL midl
HINTS
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
)
IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND TRUE)
SET(WINSDK_FOUND ON)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR})
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})
# Fix for using Windows SDK 7.1 with Visual C++ 2012
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
ELSE(WINSDK_INCLUDE_DIR)
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")

@ -19,6 +19,7 @@ IF(SOURCE_DIR)
SET(SOURCE_DIR ${ROOT_DIR})
ENDIF(NOT SOURCE_DIR AND ROOT_DIR)
ELSE(SOURCE_DIR)
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
ENDIF(SOURCE_DIR)
@ -57,6 +58,15 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
ENDIF(MERCURIAL_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.hg/")
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)
SET(REVISION_FILE ${SOURCE_DIR}/revision)
IF(EXISTS ${REVISION_FILE})
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
MESSAGE(STATUS "Read revision ${REVISION} from file")
ENDIF(EXISTS ${REVISION_FILE})
ENDIF(SOURCE_DIR AND NOT DEFINED REVISION)
IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
MESSAGE(STATUS "Revision: ${REVISION}")

@ -10,7 +10,6 @@
IF(MSVC)
SET(PCHSupport_FOUND TRUE)
SET(_PCH_include_prefix "/I")
ELSE(MSVC)
IF(CMAKE_COMPILER_IS_GNUCXX)
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
@ -26,44 +25,50 @@ ELSE(MSVC)
# TODO: make tests for other compilers than GCC
SET(PCHSupport_FOUND TRUE)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET(_PCH_include_prefix "-I")
ENDIF(MSVC)
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
MACRO(PCH_SET_COMPILE_FLAGS _target)
SET(PCH_FLAGS)
SET(PCH_ARCHS)
SET(PCH_ARCHS)
SET(_FLAGS)
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}")
IF(NOT MSVC)
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
LIST(APPEND _FLAGS " -fPIC")
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
ENDIF(NOT MSVC)
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
IF(_pic)
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
ENDIF(_pic)
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"")
LIST(APPEND _FLAGS " -I\"${item}\"")
ENDFOREACH(item)
# Required for CMake 2.6
SET(GLOBAL_DEFINITIONS)
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
IF(oldProps)
@ -75,6 +80,27 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
LIST(APPEND _FLAGS " ${oldPropsBuild}")
ENDIF(oldPropsBuild)
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
IF(DIRINC)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " -I\"${item}\"")
ENDFOREACH(item)
ENDIF(DIRINC)
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
@ -90,7 +116,6 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
SEPARATE_ARGUMENTS(_FLAGS)
ENDIF(MSVC)
IF(CLANG)
# Determining all architectures and get common flags
SET(_ARCH_NEXT)
@ -183,6 +208,9 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
IF(MSVC)
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
# Ninja PCH Support
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")
ELSE(MSVC)
SET(HEADER_FORMAT "c++-header")
SET(_FLAGS "")
@ -242,6 +270,18 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
IF(MSVC)
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
# Ninja PCH Support
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES OBJECT_DEPENDS "${PCH_OUTPUT}")
# NMAKE-VS2012 Error LNK2011 (NMAKE-VS2010 do not complain)
# we need to link the pch.obj file, see http://msdn.microsoft.com/en-us/library/3ay26wa2(v=vs.110).aspx
GET_TARGET_PROPERTY(DEPS ${_targetName} LINK_LIBRARIES)
if (NOT DEPS)
set (DEPS)
endif ()
list (INSERT DEPS 0 "${PCH_OUTPUT}.obj")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES LINK_LIBRARIES "${DEPS}")
ELSE(MSVC)
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
# on all remote machines set

@ -0,0 +1,183 @@
# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
# files which are included with CMake 2.8.4
# It has been altered for iOS development
#
# Options:
#
# IOS_VERSION = last(default) or specific one (4.3, 5.0, 4.1)
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
#
# IOS_PLATFORM = OS (default) or SIMULATOR or ALL
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
#
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
# If set manually, it will override the default location and force the user of a particular Developer Platform
#
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
# If set manually, this will force the use of a specific SDK version
IF(DEFINED CMAKE_CROSSCOMPILING)
# subsequent toolchain loading is not really needed
RETURN()
ENDIF()
# Standard settings
SET(CMAKE_SYSTEM_NAME Darwin)
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Darwin version
SET(UNIX ON)
SET(APPLE ON)
SET(IOS ON)
# Force the compilers to Clang for iOS
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (clang Clang)
CMAKE_FORCE_CXX_COMPILER (clang++ Clang)
# Setup iOS platform
if (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
# Check the platform selection and setup for developer root
if (${IOS_PLATFORM} STREQUAL "OS")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
elseif (${IOS_PLATFORM} STREQUAL "ALL")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
else (${IOS_PLATFORM} STREQUAL "OS")
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif (${IOS_PLATFORM} STREQUAL "OS")
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform")
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
# Note Xcode 4.3 changed the installation location, choose the most recent one available
SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms")
SET(XCODE_PRE_43_ROOT "/Developer/Platforms")
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
IF(EXISTS ${XCODE_POST_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT})
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT})
ENDIF(EXISTS ${XCODE_POST_43_ROOT})
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
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")
MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
FILE(GLOB _CMAKE_IOS_SDKS "${ROOT}/SDKs/iPhoneOS*")
IF(_CMAKE_IOS_SDKS)
LIST(SORT _CMAKE_IOS_SDKS)
LIST(REVERSE _CMAKE_IOS_SDKS)
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
ENDFOREACH(_CMAKE_IOS_SDK)
ENDIF(_CMAKE_IOS_SDKS)
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS)
# Find and use the most recent iOS sdk
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
# Search for a specific version of a SDK
GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} 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.")
ENDIF(NOT IOS_VERSIONS)
IF(IOS_VERSION)
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
ELSE(_INDEX EQUAL -1)
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(_INDEX EQUAL -1)
ELSE(IOS_VERSION)
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(IOS_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_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk)
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
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(IOS_VERSION ${IOS_VERSION} CACHE STRING "iOS target version")
# Set the sysroot default to the most recent SDK
SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
IF(CMAKE_GENERATOR MATCHES Xcode)
SET(ARCHS "$(ARCHS_STANDARD_32_BIT)")
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ELSE(CMAKE_GENERATOR MATCHES Xcode)
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(ARCHS "armv7")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
# iPhone simulator targets i386
SET(ARCHS "i386")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(ARCHS "armv7;i386")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
# 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")
# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
# 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_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include)
#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib)
#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin)

@ -125,10 +125,6 @@ MACRO(NL_DEFAULT_PROPS name label)
COMPILE_FLAGS "/GA"
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}")
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32)
IF(WITH_STLPORT AND WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
ENDIF(WITH_STLPORT AND WIN32)
ENDMACRO(NL_DEFAULT_PROPS)
###
@ -396,11 +392,11 @@ MACRO(NL_SETUP_BUILD)
SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR})
IF(HOST_CPU MATCHES "amd64")
IF(HOST_CPU MATCHES "(amd|AMD)64")
SET(HOST_CPU "x86_64")
ELSEIF(HOST_CPU MATCHES "i.86")
SET(HOST_CPU "x86")
ENDIF(HOST_CPU MATCHES "amd64")
ENDIF(HOST_CPU MATCHES "(amd|AMD)64")
# Determine target CPU
@ -409,11 +405,11 @@ MACRO(NL_SETUP_BUILD)
SET(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR})
ENDIF(NOT TARGET_CPU)
IF(TARGET_CPU MATCHES "amd64")
IF(TARGET_CPU MATCHES "(amd|AMD)64")
SET(TARGET_CPU "x86_64")
ELSEIF(TARGET_CPU MATCHES "i.86")
SET(TARGET_CPU "x86")
ENDIF(TARGET_CPU MATCHES "amd64")
ENDIF(TARGET_CPU MATCHES "(amd|AMD)64")
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(CLANG ON)
@ -425,6 +421,11 @@ MACRO(NL_SETUP_BUILD)
MESSAGE(STATUS "Generating Xcode project")
ENDIF(CMAKE_GENERATOR MATCHES "Xcode")
IF(CMAKE_GENERATOR MATCHES "NMake")
SET(NMAKE ON)
MESSAGE(STATUS "Generating NMake project")
ENDIF(CMAKE_GENERATOR MATCHES "NMake")
# If target and host CPU are the same
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
# x86-compatible CPU
@ -544,6 +545,9 @@ MACRO(NL_SETUP_BUILD)
SET(MSVC11 ON)
ENDIF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11)
# Ignore default include paths
ADD_PLATFORM_FLAGS("/X")
IF(MSVC11)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2010, but custom optimizations don't exist
@ -903,20 +907,23 @@ ENDMACRO(NL_SETUP_BUILD)
MACRO(NL_SETUP_BUILD_FLAGS)
SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE)
## Debug
SET(CMAKE_C_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE)
## Release
SET(CMAKE_C_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE)
ENDMACRO(NL_SETUP_BUILD_FLAGS)
# Macro to create x_ABSOLUTE_PREFIX from x_PREFIX
@ -1070,74 +1077,14 @@ MACRO(SETUP_EXTERNAL)
IF(WIN32)
FIND_PACKAGE(External REQUIRED)
IF(NOT VC_DIR)
SET(VC_DIR $ENV{VC_DIR})
ENDIF(NOT VC_DIR)
IF(MSVC11)
IF(NOT MSVC_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC_REDIST_DIR)
IF(NOT VC_DIR)
IF(NOT VC_ROOT_DIR)
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\11.0_Config;InstallDir]" ABSOLUTE)
# VC_ROOT_DIR is set to "registry" when a key is not found
IF(VC_ROOT_DIR MATCHES "registry")
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\WDExpress\\11.0_Config\\Setup\\VC;InstallDir]" ABSOLUTE)
IF(VC_ROOT_DIR MATCHES "registry")
SET(VS110COMNTOOLS $ENV{VS110COMNTOOLS})
IF(VS110COMNTOOLS)
FILE(TO_CMAKE_PATH ${VS110COMNTOOLS} VC_ROOT_DIR)
ENDIF(VS110COMNTOOLS)
IF(NOT VC_ROOT_DIR)
MESSAGE(FATAL_ERROR "Unable to find VC++ 2012 directory!")
ENDIF(NOT VC_ROOT_DIR)
ENDIF(VC_ROOT_DIR MATCHES "registry")
ENDIF(VC_ROOT_DIR MATCHES "registry")
ENDIF(NOT VC_ROOT_DIR)
# convert IDE fullpath to VC++ path
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR})
ENDIF(NOT VC_DIR)
ELSEIF(MSVC10)
IF(NOT MSVC_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC_REDIST_DIR)
IF(NOT VC_DIR)
IF(NOT VC_ROOT_DIR)
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE)
# VC_ROOT_DIR is set to "registry" when a key is not found
IF(VC_ROOT_DIR MATCHES "registry")
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE)
IF(VC_ROOT_DIR MATCHES "registry")
SET(VS100COMNTOOLS $ENV{VS100COMNTOOLS})
IF(VS100COMNTOOLS)
FILE(TO_CMAKE_PATH ${VS100COMNTOOLS} VC_ROOT_DIR)
ENDIF(VS100COMNTOOLS)
IF(NOT VC_ROOT_DIR)
MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!")
ENDIF(NOT VC_ROOT_DIR)
ENDIF(VC_ROOT_DIR MATCHES "registry")
ENDIF(VC_ROOT_DIR MATCHES "registry")
ENDIF(NOT VC_ROOT_DIR)
# convert IDE fullpath to VC++ path
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR})
ENDIF(NOT VC_DIR)
ELSE(MSVC11)
IF(NOT VC_DIR)
IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
# convert IDE fullpath to VC++ path
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${CMAKE_MAKE_PROGRAM})
ELSE(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
# convert compiler fullpath to VC++ path
STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER})
ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
ENDIF(NOT VC_DIR)
ENDIF(MSVC11)
# If using custom boost, we need to define the right variables used by official boost CMake module
IF(DEFINED BOOST_DIR)
SET(BOOST_INCLUDEDIR ${BOOST_DIR}/include)
SET(BOOST_LIBRARYDIR ${BOOST_DIR}/lib)
ENDIF(DEFINED BOOST_DIR)
ELSE(WIN32)
FIND_PACKAGE(External QUIET)
IF(APPLE)
IF(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
@ -1153,15 +1100,22 @@ MACRO(SETUP_EXTERNAL)
ENDIF(APPLE)
ENDIF(WIN32)
# Android and iOS have pthread
IF(ANDROID OR IOS)
SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
ELSE(ANDROID OR IOS)
FIND_PACKAGE(Threads REQUIRED)
# TODO: replace all -l<lib> by absolute path to <lib> in CMAKE_THREAD_LIBS_INIT
ENDIF(ANDROID OR IOS)
IF(WITH_STLPORT)
FIND_PACKAGE(STLport REQUIRED)
INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR})
IF(MSVC)
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
FIND_PACKAGE(WindowsSDK REQUIRED)
# use VC++ and Windows SDK include paths
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIRS})
ENDIF(MSVC)
ENDIF(WITH_STLPORT)
IF(MSVC)
FIND_PACKAGE(MSVC REQUIRED)
FIND_PACKAGE(WindowsSDK REQUIRED)
ENDIF(MSVC)
ENDMACRO(SETUP_EXTERNAL)

@ -6,7 +6,7 @@ GraphicsDriver = "OpenGL";
SoundDriver = "OpenAL";
SoundDevice = "";
LanguageCode = "en";
QtStyle = "Cleanlooks";
QtStyle = "";
FontName = "andbasr.ttf";
FontShadow = 1;
BackgroundColor = {

@ -708,7 +708,7 @@ NL_TARGET_LIB(nel3d ${HEADERS} ${SRC})
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARY})
TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARIES})
SET_TARGET_PROPERTIES(nel3d PROPERTIES LINK_INTERFACE_LIBRARIES "")
NL_DEFAULT_PROPS(nel3d "NeL, Library: NeL 3D")
NL_ADD_RUNTIME_FLAGS(nel3d)

@ -242,8 +242,8 @@ void CComputedString::render2DClip (IDriver& driver, CRenderStringBuffer &rdrBuf
uint lastIndex = 0;
for(uint i=0;i<numVerts;i++)
{
if(count==4){
if(count==4)
{
if(!LetterColors.empty())
{
if(LetterColors.getIndex(lastIndex)==i/4)

@ -1,8 +1,3 @@
FIND_PACKAGE( Libwww REQUIRED )
FIND_PACKAGE( CURL REQUIRED )
FIND_PACKAGE( Lua51 REQUIRED )
FIND_PACKAGE( Luabind REQUIRED )
FILE(GLOB SRC *.cpp *.h)
FILE(GLOB HEADERS ../../include/nel/gui/*.h)
@ -31,6 +26,8 @@ TARGET_LINK_LIBRARIES( nelgui
${CURL_LIBRARIES}
)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${CURL_DEFINITIONS} ${LUABIND_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelgui ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
ENDIF(WITH_PCH)

@ -354,6 +354,9 @@ namespace NLGUI
// start to draw at the reference corner
getTextureSizeFromId (nTxId, txw, txh);
// to avoid a division by zero crash later
if (txw < 0 || txh < 0) return;
if (rot > 3) rot = 3;
sint32 startX = x, startY = y;

@ -19,6 +19,7 @@
#include "nel/misc/bitmap.h"
#include "nel/misc/stream.h"
#include "nel/misc/file.h"
#include "nel/misc/system_info.h"
// Define this to force all bitmap white (debug)
// #define NEL_ALL_BITMAP_WHITE

@ -189,7 +189,8 @@ gint KeyIn(GtkWidget *Widget, GdkEventKey *Event, gpointer *Data)
}
break;
case GDK_Down :
if (CommandHistoryPos + 1 < CommandHistory.size()) {
if (CommandHistoryPos + 1 < CommandHistory.size())
{
CommandHistoryPos++;
gtk_entry_set_text (GTK_ENTRY(Widget), CommandHistory[CommandHistoryPos].c_str());
}
@ -374,7 +375,8 @@ gint updateInterf (gpointer data)
{
uint32 col = (*it).first;
GtkTextTag *tag = NULL;
if ((col>>24) == 0) {
if ((col>>24) == 0)
{
GdkColor color;
color.red = (col >> 8) & 0xFF00;
color.green = col & 0xFF00;

@ -37,14 +37,13 @@ namespace NLMISC
return token;
}
uint i;
uint i, j;
CSString result;
// skip leading junk
for (i=0;i<size();++i)
{
// look for the next character in the 'separator' character list supplied
uint j;
for (j=0;separators[j] && (*this)[i]!=separators[j];++j)
{}
// if not found then we're at end of leading junk
@ -56,7 +55,6 @@ namespace NLMISC
for (;i<size();++i)
{
// look for the next character in the 'separator' character list supplied
uint j;
for (j=0;separators[j] && (*this)[i]!=separators[j];++j)
{}
// if not found then we're at end of text chunk
@ -69,7 +67,6 @@ namespace NLMISC
for (;i<size();++i)
{
// look for the next character in the 'separator' character list supplied
uint j;
for (j=0;separators[j] && (*this)[i]!=separators[j];++j)
{}
// if not found then we're at end of leading junk

@ -17,8 +17,6 @@
#ifndef NL_STDMISC_H
#define NL_STDMISC_H
#include "nel/misc/types_nl.h"
#include <algorithm>
#include <cmath>
#include <csignal>
@ -44,16 +42,7 @@
#include <utility>
#include <vector>
#include "nel/misc/debug.h"
#include "nel/misc/common.h"
#include "nel/misc/fast_mem.h"
#include "nel/misc/system_info.h"
#include "nel/misc/mem_displayer.h"
#include "nel/misc/stream.h"
#include "nel/misc/path.h"
#include "nel/misc/string_common.h"
#ifdef NL_OS_WINDOWS
#ifdef _WIN32
#define NOMINMAX
#include <WinSock2.h>
#include <windows.h>

@ -56,7 +56,8 @@ static void uuencode (const char *s, const char *store, const int length)
unsigned char *us = (unsigned char *)s;
/* Transform the 3x8 bits to 4x6 bits, as required by base64. */
for (i = 0; i < length; i += 3) {
for (i = 0; i < length; i += 3)
{
*p++ = tbl[us[0] >> 2];
*p++ = tbl[((us[0] & 3) << 4) + (us[1] >> 4)];
*p++ = tbl[((us[1] & 0xf) << 2) + (us[2] >> 6)];
@ -64,10 +65,12 @@ static void uuencode (const char *s, const char *store, const int length)
us += 3;
}
/* Pad the result if necessary... */
if (i == length + 1) {
if (i == length + 1)
{
*(p - 1) = tbl[64];
}
else if (i == length + 2) {
else if (i == length + 2)
{
*(p - 1) = *(p - 2) = tbl[64];
}
/* ...and zero-terminate it. */

@ -24,7 +24,7 @@ IF(WITH_NEL_TOOLS)
shapes_exporter
tga_cut
tga_resize
shape2obj
shape2obj
zone_check_bind
zone_dump
zviewer)
@ -62,7 +62,7 @@ IF(WITH_NEL_TOOLS)
ENDIF(WITH_QT)
IF(SQUISH_FOUND)
ADD_SUBDIRECTORY(s3tc_compressor_lib)
ADD_SUBDIRECTORY(s3tc_compressor_lib)
ADD_SUBDIRECTORY(panoply_maker)
ADD_SUBDIRECTORY(tga_2_dds)
ADD_SUBDIRECTORY(hls_bank_maker)

@ -9,7 +9,7 @@ ADD_SUBDIRECTORY(georges_editor)
ADD_SUBDIRECTORY(material_editor)
IF(WITH_GUI)
ADD_SUBDIRECTORY(gui_editor)
ADD_SUBDIRECTORY(gui_editor)
ENDIF(WITH_GUI)
ADD_SUBDIRECTORY(translation_manager)

@ -1,40 +1,7 @@
IF(WITH_LUA51)
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(WITH_LUA51)
FIND_PACKAGE(Lua50 REQUIRED)
ENDIF(WITH_LUA51)
FIND_PACKAGE(Luabind REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
SET(CURL_STATIC ON)
ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
IF(CURL_STATIC)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
FIND_PACKAGE(OpenSSL QUIET)
IF(OPENSSL_FOUND)
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
# CURL Macports version depends on libidn, libintl and libiconv too
IF(APPLE)
FIND_LIBRARY(IDN_LIBRARY idn)
FIND_LIBRARY(INTL_LIBRARY intl)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY})
ENDIF(APPLE)
ENDIF(CURL_STATIC)
FIND_PACKAGE(Libwww REQUIRED)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${LIBXML2_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
${QT_INCLUDES})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${LIBXML2_INCLUDE_DIR}
${QT_INCLUDES})
FILE(GLOB SRC *.cpp *.h)
@ -105,11 +72,6 @@ TARGET_LINK_LIBRARIES(
${QT_LIBRARIES}
${QT_QTOPENGL_LIBRARY}
qt_property_browser
${LUA_LIBRARIES}
${LUABIND_LIBRARIES}
${CURL_LIBRARIES}
${LIBWWW_LIBRARIES}
${LIBXML2_LIBRARIES}
)
NL_DEFAULT_PROPS(ovqt_plugin_gui_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: GUI Editor")

@ -217,7 +217,7 @@ LRESULT APIENTRY colorSwatchSubclassWndProc(
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK: {
HWND hPanel = GetParent(hwnd);
LONG mod = GetWindowLongPtr(hPanel,GWLP_USERDATA);
LONG_PTR mod = GetWindowLongPtr(hPanel,GWLP_USERDATA);
if (mod) {
((VertexPaint*)mod)->PaletteButton(hwnd);
}
@ -424,9 +424,10 @@ void VertexPaint::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
SendMessage(hParams, WM_POSTINIT, 0, 0);
}
else {
else
{
SetWindowLongPtr(hParams,GWLP_USERDATA,(LONG_PTR)this);
}
}
iTint = SetupIntSpinner (hParams, IDC_TINT_SPIN, IDC_TINT, 0, 100, (int) (fTint*100.0f));
@ -440,7 +441,7 @@ void VertexPaint::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
// Force an eval to update caches.
NotifyDependents(FOREVER, PART_VERTCOLOR, REFMSG_CHANGE);
}
}
void VertexPaint::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next)
{

@ -14,44 +14,10 @@ IF(WITH_RYZOM_CLIENT)
MESSAGE( FATAL_ERROR "The client cannot be built without the NeL GUI Library (WITH_GUI)")
ENDIF(NOT WITH_GUI)
IF(WITH_LUA51)
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(WITH_LUA51)
FIND_PACKAGE(Lua50 REQUIRED)
ENDIF(WITH_LUA51)
FIND_PACKAGE(Luabind REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
SET(CURL_STATIC ON)
ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
IF(CURL_STATIC)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
FIND_PACKAGE(OpenSSL QUIET)
IF(OPENSSL_FOUND)
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
# CURL Macports version depends on libidn, libintl and libiconv too
IF(APPLE)
FIND_LIBRARY(IDN_LIBRARY idn)
FIND_LIBRARY(INTL_LIBRARY intl)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY})
ENDIF(APPLE)
ENDIF(CURL_STATIC)
ADD_SUBDIRECTORY(client)
ELSEIF(WITH_RYZOM_TOOLS)
# Need clientsheets lib for sheets packer tool
ADD_SUBDIRECTORY(client)
ENDIF(WITH_RYZOM_CLIENT)
IF(WITH_RYZOM_TOOLS)

@ -8,6 +8,12 @@ function getDbPropU(dbEntry)
return value
end
if string.find(_VERSION, "Lua 5.0") then
function math.fmod(a, b)
return math.mod(a, b)
end
end
------------------------------------------------------------------------------------------------------------
-- create the game namespace without reseting if already created in an other file.
if (game==nil) then

@ -924,33 +924,28 @@ void CChatGroupWindow::removeAllFreeTellers()
void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f)
{
f.serialVersion(2);
uint32 nNbFreeTellerSaved = 0;
// Save the free teller only if it is present in the friend list to avoid the only-growing situation
// because free tellers are never deleted in game if we save/load all the free tellers, we just create more
// and more container.
uint32 i, nNbFreeTellerSaved = 0;
for (i = 0; i < _FreeTellers.size(); ++i)
if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1)
nNbFreeTellerSaved++;
f.serial(nNbFreeTellerSaved);
// Don't save the free tellers
//// Save the free teller only if it is present in the friend list to avoid the only-growing situation
//// because free tellers are never deleted in game if we save/load all the free tellers, we just create more
//// and more container.
//uint32 i, nNbFreeTellerSaved = 0;
//for (i = 0; i < _FreeTellers.size(); ++i)
// if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1)
// nNbFreeTellerSaved++;
//f.serial(nNbFreeTellerSaved);
//for (i = 0; i < _FreeTellers.size(); ++i)
//{
// CGroupContainer *pGC = _FreeTellers[i];
// if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1)
// {
// ucstring sTitle = pGC->getUCTitle();
// f.serial(sTitle);
// }
//}
for (i = 0; i < _FreeTellers.size(); ++i)
{
CGroupContainer *pGC = _FreeTellers[i];
if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1)
{
ucstring sTitle = pGC->getUCTitle();
f.serial(sTitle);
}
}
}
//=================================================================================
@ -979,12 +974,11 @@ void CChatGroupWindow::loadFreeTeller(NLMISC::IStream &f)
ucstring sTitle;
f.serial(sTitle);
// Don't actually create the free teller
//CGroupContainer *pGC = createFreeTeller(sTitle, "");
CGroupContainer *pGC = createFreeTeller(sTitle, "");
//// With version 1 all tells are active because windows information have "title based" ids and no "sID based".
//if ((ver == 1) && (pGC != NULL))
// pGC->setActive(false);
// With version 1 all tells are active because windows information have "title based" ids and no "sID based".
if ((ver == 1) && (pGC != NULL))
pGC->setActive(false);
}
}

@ -3552,12 +3552,13 @@ void CUserEntity::CSpeedFactor::update(ICDBNode *node) // virtual
//nlinfo("SpeedFactor changed to %f / %"NL_I64"u", _Value, leaf->getValue64());
// clamp the value (2.0 is the egg item or the level 6 speed up power up, nothing should be faster)
if(_Value > 2.0f)
{
// commented because ring editor speed is in fact faster
//if(_Value > 2.0f)
//{
//nlwarning("HACK: you try to change the speed factor to %f", _Value);
//nlstop;
//_Value = 2.0f;
}
//}
}// CSpeedFactor::update //

@ -155,6 +155,11 @@ inline double CAIVectorMirror::distTo(const CAIPos &dest) const
return (dest-CAIVector(*this)).norm();
}
inline double CAIVectorMirror::distSqTo(const CAIPos &dest) const
{
return (dest-CAIVector(*this)).sqrnorm();
}
inline double CAIVectorMirror::quickDistTo(const CAIPos &dest) const
{
double dx=fabs((dest.x()-x()).asDouble()), dy=fabs((dest.y()-y()).asDouble());
@ -172,6 +177,11 @@ inline double CAIVectorMirror::distTo(const CAIVector &dest) const
return (dest-CAIVector(*this)).norm();
}
inline double CAIVectorMirror::distSqTo(const CAIVector &dest) const
{
return (dest-CAIVector(*this)).sqrnorm();
}
inline double CAIVectorMirror::quickDistTo(const CAIVector &dest) const
{
double dx=fabs((dest.x()-x()).asDouble()), dy=fabs((dest.y()-y()).asDouble());
@ -189,6 +199,11 @@ inline double CAIVectorMirror::distTo(const CAIVectorMirror &dest) const
return (dest-*this).norm();
}
inline double CAIVectorMirror::distSqTo(const CAIVectorMirror &dest) const
{
return (dest-*this).sqrnorm();
}
inline double CAIVectorMirror::quickDistTo(const CAIVectorMirror &dest) const
{
double dx=fabs((dest.x()-x()).asDouble()), dy=fabs((dest.y()-y()).asDouble()); return (dx>dy)? (dx+dy/2): (dy+dx/2);

@ -310,9 +310,9 @@ void CWanderFaunaProfile::updateProfile(uint ticksSinceLastUpdate)
CFollowPathContext fpcWanderFaunaProfileUpdate("WanderFaunaProfileUpdate");
// calculate distance from bot position to magnet point (used in all the different processes)
_magnetDist=_Bot->pos().distTo(_Bot->spawnGrp().magnetPos());
if (_magnetDist>_Bot->spawnGrp().magnetRadiusFar())
_magnetDistSq=_Bot->pos().distSqTo(_Bot->spawnGrp().magnetPos());
double grpMagnetRadiusFar=_Bot->spawnGrp().magnetRadiusFar();
if (_magnetDistSq>(grpMagnetRadiusFar*grpMagnetRadiusFar))
{
_Bot->setMode( MBEHAV::NORMAL );
@ -405,11 +405,12 @@ void CGrazeFaunaProfile::updateProfile(uint ticksSinceLastUpdate)
CFollowPathContext fpcGrazeFaunaProfileUpdate("GrazeFaunaProfileUpdate");
// calculate distance from bot position to magnet point (used in all the different processes)
_magnetDist=_Bot->pos().distTo(_Bot->spawnGrp().magnetPos());
_magnetDistSq=_Bot->pos().distSqTo(_Bot->spawnGrp().magnetPos());
if (!_ArrivedInZone)
{
if (_magnetDist>_Bot->spawnGrp().magnetRadiusFar())
float grpMagnetRadiusFar=_Bot->spawnGrp().magnetRadiusFar();
if (_magnetDistSq>(grpMagnetRadiusFar*grpMagnetRadiusFar))
{
_Bot->setMode( MBEHAV::NORMAL );
@ -501,7 +502,8 @@ void CGrazeFaunaProfile::updateProfile(uint ticksSinceLastUpdate)
}
// && _state==0 ) // means wait in movementmagnet.
if ( _magnetDist<=_Bot->spawnGrp().magnetRadiusNear()
const float grpMagnetRadiusNear=_Bot->spawnGrp().magnetRadiusNear();
if ( _magnetDistSq<=(grpMagnetRadiusNear*grpMagnetRadiusNear)
&& _MovementMagnet->getMovementType()==CMovementMagnet::Movement_Anim)
{
if (_Bot->getPersistent().grp().getType()==AITYPES::FaunaTypePredator)
@ -564,11 +566,12 @@ void CRestFaunaProfile::updateProfile(uint ticksSinceLastUpdate)
CFollowPathContext fpcRestFaunaProfileUpdate("RestFaunaProfileUpdate");
// calculate distance from bot position to magnet point (used in all the different processes)
_magnetDist=_Bot->pos().distTo(_Bot->spawnGrp().magnetPos());
_magnetDistSq=_Bot->pos().distSqTo(_Bot->spawnGrp().magnetPos());
if (!_ArrivedInZone)
{
if (_magnetDist>_Bot->spawnGrp().magnetRadiusFar())
float grpMagnetRadiusFar=_Bot->spawnGrp().magnetRadiusFar();
if (_magnetDistSq>(grpMagnetRadiusFar*grpMagnetRadiusFar))
{
if (!_OutOfMagnet)
{
@ -656,7 +659,8 @@ void CRestFaunaProfile::updateProfile(uint ticksSinceLastUpdate)
break;
}
if ( _magnetDist<=_Bot->spawnGrp().magnetRadiusNear()
const float grpMagnetRadiusNear=_Bot->spawnGrp().magnetRadiusNear();
if ( _magnetDistSq<=(grpMagnetRadiusNear*grpMagnetRadiusNear)
&& _MovementMagnet->getMovementType()==CMovementMagnet::Movement_Anim)
{
_Bot->setMode(MBEHAV::REST);

@ -137,7 +137,7 @@ public:
protected:
RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags;
CSpawnBotFauna* _Bot;
double _magnetDist; ///< distance from bot to his magnet at last move
double _magnetDistSq; ///< square distance from bot to his magnet at last move
static CFaunaProfileFloodLogger _FloodLogger;
};
@ -166,7 +166,7 @@ private:
CAITimer _CycleTimer;
uint _CycleTimerBaseTime;
bool _ArrivedInZone;
double _magnetDist; ///< distance from bot to his magnet at last move
double _magnetDistSq; ///< square distance from bot to his magnet at last move
RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags;
static CFaunaProfileFloodLogger _FloodLogger;
};
@ -196,7 +196,7 @@ private:
CAITimer _CycleTimer;
uint _CycleTimerBaseTime;
bool _ArrivedInZone;
double _magnetDist; // distance from bot to his magnet at last move
double _magnetDistSq; // square distance from bot to his magnet at last move
RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags;
static CFaunaProfileFloodLogger _FloodLogger;
};

@ -83,14 +83,17 @@ public: // Methods.
// a few handy utility methods
inline CAngle angleTo(const CAIPos &dest) const;
inline double distTo(const CAIPos &dest) const;
inline double distSqTo(const CAIPos &dest) const;
inline double quickDistTo(const CAIPos &dest) const;
inline CAngle angleTo(const CAIVector &dest) const;
inline double distTo(const CAIVector &dest) const;
inline double distSqTo(const CAIVector &dest) const;
inline double quickDistTo(const CAIVector &dest) const;
inline CAngle angleTo(const CAIVectorMirror &dest) const;
inline double distTo(const CAIVectorMirror &dest) const;
inline double distSqTo(const CAIVectorMirror &dest) const;
inline double quickDistTo(const CAIVectorMirror &dest) const;
protected:

@ -1607,6 +1607,7 @@ Then user events are triggered on the group to inform it about what happens:
- user_event_3: triggered after the player has given the mission items to the npc.
Warning: this function can only be called after the event "player_target_npc".
Warning: only works on an R2 shard for R2 plot items.
Arguments: s(missionItems), s(missionText), c(groupToNotify) ->
@param[in] missionItems is the list of mission items, the string format is "item1:qty1;item2:qty2;...".
@ -1709,38 +1710,6 @@ void receiveMissionItems_ssc_(CStateInstance* entity, CScriptStack& stack)
DEBUG_STOP;
return;
}
// if LD use this the function outside a ring shard
if (IsRingShard)
{
// Here we destroy the item: so we do not want that a user create a scenario where we destroy
// other players precious items
static std::set<CSheetId> r2PlotItemSheetId; // :TODO: use R2Share::CRingAccess
// lazy intialisation
if (r2PlotItemSheetId.empty())
{
for (uint32 i = 0 ; i <= 184 ; ++i)
{
r2PlotItemSheetId.insert( CSheetId( NLMISC::toString("r2_plot_item_%d.sitem", i)));
}
}
// A npc give a mission to take an item given by another npc
// but the item instead of being a r2_plot_item is a normal item like system_mp or big armor
if ( r2PlotItemSheetId.find(sheetId) == r2PlotItemSheetId.end())
{
nlwarning("!!!!!!!!!!!!");
nlwarning("!!!!!!!!!!!! Someone is trying to hack us");
nlwarning("!!!!!!!!!!!!");
nlwarning("ERROR/HACK : an npc is trying to give to a player a item that is not a plot item SheetId='%s' sheetIdAsInt=%u",sheetId.toString().c_str(), sheetId.asInt());
nlwarning("His ai instanceId is %u, use log to know the sessionId and the user ", msg.InstanceId );
nlwarning("!!!!!!!!!!!!");
nlwarning("!!!!!!!!!!!!");
return ;
}
}
uint32 quantity;
NLMISC::fromString(itemAndQty[1], quantity);
@ -1774,6 +1743,7 @@ Then user events are triggered on the group to inform it about what happens:
- user_event_1: triggered after the player has received the mission items from the npc.
Warning: this function can only be called after the event "player_target_npc".
Warning: only works on an R2 shard for R2 plot items.
Arguments: s(missionItems), s(missionText), c(groupToNotify) ->
@param[in] missionItems is the list of mission items, the string format is "item1:qty1;item2:qty2;...".
@ -1877,37 +1847,6 @@ void giveMissionItems_ssc_(CStateInstance* entity, CScriptStack& stack)
return;
}
// if LD use this the function outside a ring shard
if (IsRingShard)
{
static std::set<CSheetId> r2PlotItemSheetId; // :TODO: use R2Share::CRingAccess
// lazy intialisation
if (r2PlotItemSheetId.empty())
{
for (uint32 i = 0 ; i <= 184 ; ++i)
{
r2PlotItemSheetId.insert( CSheetId( NLMISC::toString("r2_plot_item_%d.sitem", i)));
}
}
// A npc give a mission to give a item to another npc
// but the item instead of being a r2_plot_item is a normal item like system_mp or big armor
if ( r2PlotItemSheetId.find(sheetId) == r2PlotItemSheetId.end())
{
nlwarning("!!!!!!!!!!!!");
nlwarning("!!!!!!!!!!!! Someone is trying to hack us");
nlwarning("!!!!!!!!!!!!");
nlwarning("ERROR/HACK : an npc is trying to give to a player a item that is not a plot item SheetId='%s' sheetIdAsInt=%u",sheetId.toString().c_str(), sheetId.asInt());
nlwarning("His ai instanceId is %u, use log to know the sessionId and the user ", msg.InstanceId );
nlwarning("!!!!!!!!!!!!");
nlwarning("!!!!!!!!!!!!");
return ;
}
}
uint32 quantity;
NLMISC::fromString(itemAndQty[1], quantity);
if (quantity == 0)

@ -130,6 +130,7 @@ public: // Methods.
template <class V> CAngle angleTo(const V &v) const { return CAngle(atan2((v.y()-y()).asDouble(),
(v.x()-x()).asDouble())); }
template <class V> double distTo(const V &v) const { return (*this-v).norm(); }
template <class V> double distSqTo(const V &v) const { return (*this-v).sqrnorm(); }
template <class V> double quickDistTo(const V &v) const { double dx=fabs((v.x()-x()).asDouble()),
dy=fabs((v.y()-y()).asDouble());
return (dx>dy)? (dx+dy/2): (dy+dx/2); }

@ -26,6 +26,7 @@
#include "player_manager/player_manager.h"
#include "player_manager/character.h"
#include "server_share/log_item_gen.h"
#include "egs_sheets/egs_sheets.h"
using namespace std;
using namespace NLMISC;
@ -155,47 +156,59 @@ void CR2MissionItem::giveMissionItem(const NLMISC::CEntityId &eid, TSessionId se
std::vector< CGameItemPtr > itemDropToEgg;
for( uint32 j = 0; j < items.size(); ++j )
{
CGameItemPtr item = c->createItem(1, items[j].Quantity, items[j].SheetId);
if( item != NULL )
const CStaticItem* sitem = CSheets::getForm(items[j].SheetId);
if (sitem == NULL)
{
nlwarning("Attempted to give deprecated sitem sheet %s to player character %s in session %i", items[j].SheetId.toString().c_str(), c->getName().toUtf8().c_str(), sessionId.asInt());
}
else if (sitem->Family != ITEMFAMILY::SCROLL_R2)
{
nlwarning("Attempted hack to give non-R2 item %s to player character %s in session %i", items[j].SheetId.toString().c_str(), c->getName().toUtf8().c_str(), sessionId.asInt());
}
else
{
if( c->addItemToInventory(INVENTORIES::bag, item) )
CGameItemPtr item = c->createItem(1, items[j].Quantity, items[j].SheetId);
if( item != NULL )
{
/* // check eid is registered as character have instantiated mission item for this scenario
TMissionItemInstanciatedOwner::iterator it = _OwnerOfInstanciatedItemFromScenario.find(scenarioId);
if( it == _OwnerOfInstanciatedItemFromScenario.end() )
if( c->addItemToInventory(INVENTORIES::bag, item) )
{
pair< TMissionItemInstanciatedOwner::iterator, bool > ret = _OwnerOfInstanciatedItemFromScenario.insert( make_pair( scenarioId, vector< CEntityId >() ) );
if( ret.second )
/* // check eid is registered as character have instantiated mission item for this scenario
TMissionItemInstanciatedOwner::iterator it = _OwnerOfInstanciatedItemFromScenario.find(scenarioId);
if( it == _OwnerOfInstanciatedItemFromScenario.end() )
{
(*ret.first).second.push_back( eid );
pair< TMissionItemInstanciatedOwner::iterator, bool > ret = _OwnerOfInstanciatedItemFromScenario.insert( make_pair( scenarioId, vector< CEntityId >() ) );
if( ret.second )
{
(*ret.first).second.push_back( eid );
}
}
}
else
{
bool found = false;
for( uint32 i = 0; i < (*it).second.size(); ++ i )
else
{
if( (*it).second[i] == eid )
bool found = false;
for( uint32 i = 0; i < (*it).second.size(); ++ i )
{
found = true;
break;
if( (*it).second[i] == eid )
{
found = true;
break;
}
}
if ( ! found) { (*it).second.push_back(eid); }
}
if ( ! found) { (*it).second.push_back(eid); }
*/
keepR2ItemAssociation(eid, scenarioId);
}
else
{
itemDropToEgg.push_back(item);
}
*/
keepR2ItemAssociation(eid, scenarioId);
}
else
{
itemDropToEgg.push_back(item);
nlwarning("CR2MissionItem::giveMissionItem: can't create item %s", items[j].SheetId.toString().c_str());
}
}
else
{
nlwarning("CR2MissionItem::giveMissionItem: can't create item %s", items[j].SheetId.toString().c_str());
}
}
if(itemDropToEgg.size() != 0)
{
@ -273,24 +286,36 @@ void CR2MissionItem::destroyMissionItem(const NLMISC::CEntityId &eid, const std:
CSheetId itemSheetId = items[j].SheetId;
uint32 quantity = items[j].Quantity;
CInventoryPtr inv = c->getInventory(INVENTORIES::bag);
nlassert( inv != NULL );
_destroyMissionItem( inv, itemSheetId, quantity );
if( quantity > 0)
const CStaticItem* sitem = CSheets::getForm(items[j].SheetId);
if (sitem == NULL)
{
nlwarning("Attempted to take deprecated sitem sheet %s from player character %s", items[j].SheetId.toString().c_str(), c->getName().toUtf8().c_str());
}
else if (sitem->Family != ITEMFAMILY::SCROLL_R2)
{
for( uint32 j = INVENTORIES::pet_animal; j < INVENTORIES::max_pet_animal; ++j )
nlwarning("Attempted hack to take non-R2 item %s from player character %s", items[j].SheetId.toString().c_str(), c->getName().toUtf8().c_str());
}
else
{
CInventoryPtr inv = c->getInventory(INVENTORIES::bag);
nlassert( inv != NULL );
_destroyMissionItem( inv, itemSheetId, quantity );
if( quantity > 0)
{
inv = c->getInventory((INVENTORIES::TInventory)j);
nlassert(inv != NULL);
_destroyMissionItem( inv, itemSheetId, quantity );
if(quantity == 0)
break;
for( uint32 j = INVENTORIES::pet_animal; j < INVENTORIES::max_pet_animal; ++j )
{
inv = c->getInventory((INVENTORIES::TInventory)j);
nlassert(inv != NULL);
_destroyMissionItem( inv, itemSheetId, quantity );
if(quantity == 0)
break;
}
}
// TODO: if we can't found enough quantity of item to destroy, we need decide if we must manage that as an error
// if(quantity > 0)
// {
// }
}
// TODO: if we can't found enough quantity of item to destroy, we need decide if we must manage that as an error
// if(quantity > 0)
// {
// }
}
}
}

@ -636,6 +636,18 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
{
if (session->WriteRight) // player must have the right to speak in the channel
{
// If universal channel check if player muted
if (session->getChan()->UniversalChannel)
{
if(_MutedUsers.find( eid ) != _MutedUsers.end())
{
nldebug("IOSCM: chat The player %s:%x is muted",
TheDataset.getEntityId(sender).toString().c_str(),
sender.getIndex());
return;
}
}
if (!session->getChan()->getDontBroadcastPlayerInputs())
{
// add msg to the historic

@ -47,14 +47,14 @@ uint CPUFrequency;
bool GetGLInformation ()
{
// *** INIT VARIABLES
GLExtensions.clear ();
GLRenderer = "";
GLVendor = "";
GLVersion = "";
// *** INIT OPENGL
// Register a window class
WNDCLASS wc;
memset(&wc,0,sizeof(wc));
@ -79,14 +79,14 @@ bool GetGLInformation ()
WndRect.right=100;
WndRect.bottom=100;
HWND hWnd = CreateWindow ( "RyzomGetGlInformation",
"",
WndFlags,
CW_USEDEFAULT,CW_USEDEFAULT,
WndRect.right,WndRect.bottom,
NULL,
NULL,
GetModuleHandle(NULL),
NULL);
"",
WndFlags,
CW_USEDEFAULT,CW_USEDEFAULT,
WndRect.right,WndRect.bottom,
NULL,
NULL,
GetModuleHandle(NULL),
NULL);
if (!hWnd)
return false;
@ -384,7 +384,7 @@ void CDisplayDlg::updateState ()
TextWnd1.EnableWindow (Windowed == 1);
TextWnd2.EnableWindow (Windowed == 1);
TextWnd3.EnableWindow (Windowed == 1);
// Fill the combobox values
ModeCtrl.ResetContent ();
uint i;
@ -411,11 +411,11 @@ void CDisplayDlg::updateState ()
BOOL CDisplayDlg::OnInitDialog()
{
CDialog::OnInitDialog();
updateState ();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
// EXCEPTION: OCX Property Pages should return FALSE
}
// ***************************************************************************

@ -490,6 +490,8 @@ void COutputFile::generateOutput() const
outbuff+="/*\n";
outbuff+="\tFILE: ";
outbuff+=_FileName+"\n\n";
outbuff+="#ifndef RY_EGS_STATIC_BRICK_CPP_H\n";
outbuff+="#define RY_EGS_STATIC_BRICK_CPP_H\n\n";
outbuff+="\tWARNING: This file is autogenerated - any modifications will be lost at next regeneration\n\n";
outbuff+="*/\n\n";
@ -505,6 +507,8 @@ void COutputFile::generateOutput() const
_Structures[i].generateOutput(outbuff);
}
outbuff+="#endif\n\n";
// read in the previous version of the output file
char *inbuff=NULL;
FILE *inf=fopen(_FileName.c_str(),"rb");
@ -631,17 +635,11 @@ void COutputFile::CStruct::generateOutput(std::string &outbuff) const
for (i=0;i<_Params.size();++i)
{
outbuff+="\t\t";
outbuff+=_Params[i]._Name+"=";
if (_Params[i]._Type==COutputFile::INT) outbuff+="atoi(";
if (_Params[i]._Type==COutputFile::FLOAT) outbuff+="(float)atof(";
outbuff+="args[";
outbuff+="NLMISC::fromString(args[";
if (i>100) outbuff+=('0'+((i/100)%10));
if (i>10) outbuff+=('0'+((i/10)%10));
outbuff+=('0'+(i%10));
if (_Params[i]._Type==COutputFile::INT || _Params[i]._Type==COutputFile::FLOAT)
outbuff+="].c_str());\n";
else
outbuff+="].c_str();\n";
outbuff+="], "+_Params[i]._Name+");\n";
}
outbuff+="\n";
outbuff+="\t\treturn *this;\n";

@ -32,8 +32,6 @@
#include <nel/misc/mem_stream.h>
#include <nel/misc/sheet_id.h>
//#include <nel/3d/u_driver.h>
#ifdef NL_OS_WINDOWS
#define NOMINMAX
#include <WinSock2.h>

Loading…
Cancel
Save