Merge with develop

--HG--
branch : opengl3
hg/feature/opengl3
kaetemi 9 years ago
commit bbecb833b3

@ -0,0 +1,19 @@
; Top-most EditorConfig file
root = true
; 4-column tab indentation
[*.cpp]
indent_style = tab
indent_size = 4
[*.c]
indent_style = tab
indent_size = 4
[*.h]
indent_style = tab
indent_size = 4
[*.py]
indent_style = tab
indent_size = 4

265
.gitignore vendored

@ -0,0 +1,265 @@
syntax: glob
# Various build directories
bin
obj
Debug
Release
ReleaseDebug
DebugFast
ReleaseDebugStatic
DebugFastStatic
# Test and application directories
screenshots
release
test
Temp
# NeL cache
*.packed_sheets
# Ryzom save
save_shard
last_loaded_char.bin
*.binprim
*.string_cache
graphs_output
default_c
# Windows compile
*.exe
*.dll
*.lib
*.obj
# Linux compile
*.a
*.la
*.lo
*.Po
*.Plo
*.o
*.so
*.so.*
*_debug
*.pc
*.gch
# Mac OS X compile
*.dylib
# Log dump files
report_refused
report_failed
exception_catched
*.stat
*.log
log.txt
# Max plugin extensions
*.dlx
*.dlm
*.dlu
# makeall build
.mode_static
# cmake build files & directories
CMakeFiles
CMakeCache.txt
cmake_install.cmake
CTestTestfile.cmake
CPackConfig.cmake
CPackSourceConfig.cmake
.libs
# Linux garbage
Makefile*
aclocal.m4
config.guess
config.sub
configure
depcomp
config.h.in
nelconfig.h.in
install-sh
ltmain.sh
missing
ylwrap
*.mk
# Visual Studio garbage
*.opensdf
UpgradeLog*.XML
_UpgradeReport_Files
BuildLog.htm
mt.dep
ipch
*.suo
*.ncb
*.user
*.ilk
*.pdb
*.aps
*.exp
*.idb
*.sdf
# Mac OS X garbage
.DS_Store
# Ryzom server garbage
aes_alias_name.cfg
aes_nagios_report.txt
aes_state.txt
*.launch_ctrl
*.state
*.start_count
# Vim and kwrite cache
*~
# Kdevelop4 garbage
*.kdev4
.kdev4
# intellij project folder
.idea/
# Python cache
*.pyd
*.pyc
# Qt compiler
moc_*.cpp
*.moc
# Misc garbage
*.rej
*.orig
*.cachefile
*.cache
*.patch
*.7z
3rdParty
.svn
thumbs.db
Thumbs.db
*.tpl.php
.SyncID
.SyncIgnore
.SyncArchive
# build
code/nel/build/*
code/nelns/build/*
code/snowballs/build/*
code/ryzom/build/*
code/build/*
code/build-2010/*
build/*
install/*
build_vc*
code/nel/tools/build_gamedata/configuration/buildsite.py
# Linux nel compile
code/nel/build/nel-config
code/nel/config.status
code/nel/include/nelconfig.h
code/nel/include/stamp-h1
code/nel/libtool
code/nel/nel-config
code/nel/samples/3d/cluster_viewer/cluster_viewer
code/nel/samples/3d/font/font
code/nel/samples/georges/georges
code/nel/samples/misc/command/command
code/nel/samples/misc/configfile/configfile
code/nel/samples/misc/debug/debug
code/nel/samples/misc/i18n/i18n
code/nel/samples/misc/log/log
code/nel/samples/misc/strings/strings
code/nel/samples/net/chat/chatclient
code/nel/samples/net/chat/chatserver
code/nel/samples/net/login_system/nls_frontend_service
code/nel/samples/net/login_system/nls_login_client
code/nel/samples/net/udp/udp_bench_client
code/nel/samples/net/udp/udp_bench_service
code/nel/samples/pacs/pacs_sample
code/nel/tools/3d/build_coarse_mesh/build_coarse_mesh
code/nel/tools/3d/build_far_bank/build_far_bank
code/nel/tools/3d/build_smallbank/build_smallbank
code/nel/tools/3d/ig_lighter/ig_lighter
code/nel/tools/3d/zone_dependencies/zone_dependencies
code/nel/tools/3d/zone_ig_lighter/zone_ig_lighter
code/nel/tools/3d/zone_lighter/zone_lighter
code/nel/tools/3d/zone_welder/zone_welder
code/nel/tools/misc/bnp_make/bnp_make
code/nel/tools/misc/disp_sheet_id/disp_sheet_id
code/nel/tools/misc/make_sheet_id/make_sheet_id
code/nel/tools/misc/xml_packer/xml_packer
code/nel/tools/pacs/build_ig_boxes/build_ig_boxes
code/nel/tools/pacs/build_indoor_rbank/build_indoor_rbank
code/nel/tools/pacs/build_rbank/build_rbank
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/skills.skill_tree
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/xptable.xp_table
code/ryzom/tools/server/sql/ryzom_admin_default_data.sql
# Linux server compile
code/ryzom/server/src/entities_game_service/entities_game_service
code/ryzom/server/src/frontend_service/frontend_service
code/ryzom/server/src/gpm_service/gpm_service
code/ryzom/server/src/input_output_service/input_output_service
code/ryzom/server/src/mirror_service/mirror_service
code/ryzom/server/src/ryzom_admin_service/ryzom_admin_service
code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service
code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service
code/ryzom/server/src/tick_service/tick_service
# WebTT temp dir
code/ryzom/tools/server/www/webtt/app/tmp
# AMS ignore
code/web/public_php/ams/is_installed
code/web/docs/ams/html
code/web/public_php/ams/templates_c
code/ryzom/tools/server/ryzom_ams/drupal
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php
code/ryzom/tools/server/ryzom_ams/old
#tools and external dir's
external
external_stlport
nel_tools*
ryzom_tools*
#Dumps
*.dmp
code/nel/tools/build_gamedata/processes/ai_wmap/ai_build_wmap.cfg
code/nel/tools/build_gamedata/processes/sheets/sheets_packer.cfg
code/nel/tools/build_gamedata/processes/rbank/build_rbank.cfg
code/nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg
code/web/public_php/config.php
code/web/public_php/is_installed
code/web/public_php/ams/files
code/web/public_php/db_version_lib
code/web/public_php/db_version_shard
code/web/public_php/db_version_tool
code/web/public_php/db_version_web
code/web/public_php/role_service
code/web/public_php/role_support
code/web/public_php/role_domain
code/web/public_php/db_version_ring
code/web/public_php/config_user.php
code/nel/tools/build_gamedata/processes/pz/build_world_packed_col.cfg
code/nel/tools/build_gamedata/processes/cartographer/island_screenshots.cfg

@ -124,6 +124,9 @@ aes_state.txt
*.kdev4
.kdev4
# intellij project folder
.idea/
# Python cache
*.pyd
*.pyc
@ -139,8 +142,6 @@ moc_*.cpp
*.cache
*.patch
*.7z
external
external_stlport
3rdParty
.svn
thumbs.db

@ -7,3 +7,4 @@ edaa3624a56420b02ccc64c26059801a389927ee ryzomcore/v0.11.0
e3fe4855f22c3e75722e015dc33c091c340b3ad7 ryzomcore/v0.11.1
9e583b717fd63be0be9fd60b99087abf1691ea49 ryzomcore/v0.11.2
bfe5628e14a024ba7ea32e4b326ae433a07856b9 ryzomcore/v0.11.3
9a6120735daa97c96ac5d85ca35c7f21f607bd87 ryzomcore/v0.12.0

@ -0,0 +1,53 @@
sudo: false
language: cpp
compiler:
- gcc
os:
- linux
matrix:
fast_finish: true
env:
- CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS:BOOL=off -DWITH_LUA51:BOOL=on -DWITH_LUA52:BOOL=off -DWITH_LUA53:BOOL=off"
- CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS:BOOL=off -DWITH_LUA51:BOOL=off -DWITH_LUA52:BOOL=on -DWITH_LUA53:BOOL=off"
- CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS:BOOL=off -DWITH_LUA51:BOOL=off -DWITH_LUA52:BOOL=off -DWITH_LUA53:BOOL=on"
- CMAKE_CONFIGURE_OPTIONS="-DCPPTEST_LIBRARY_DEBUG:STRING=/usr/lib/libcpptest.so"
CMAKE_BUILD_OPTIONS="--target nel_unit_test -- -j 2"
RUN="build/bin/nel_unit_test"
addons:
apt:
packages:
- liblua5.1-0-dev
- liblua5.1-0-dbg
- liblua5.2-0-dev
- liblua5.2-0-dbg
- libluabind-dev
- libcpptest-dev
- libogg-dev
- libvorbis-dev
- libopenal-dev
- libgif-dev
- libfreetype6-dev
- libxml2-dev
before_script:
- mkdir build
- cmake --version
- cmake -Hcode -Bbuild $CMAKE_CONFIGURE_OPTIONS
- cat build/CMakeCache.txt
script:
- cmake --build build $CMAKE_BUILD_OPTIONS
- $RUN
notifications:
irc:
channels:
- $NOTIFICATION_IRC_CHANNEL
template:
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}"
- "Description : %{commit_message}"
- "Change view : %{compare_url}"
- "Build details : %{build_url}"

@ -1,5 +1,7 @@
# Ryzom Core [![Build Status](https://travis-ci.org/ryzom/ryzomcore.svg)](https://travis-ci.org/ryzom/ryzomcore)
Ryzom Core is the open-source project related to Ryzom Game. Written in C++, Ryzom Core contains the whole code (client, server, tools) used to make the commercial MMORPG Ryzom. Ryzom Core is a toolkit for the development of massively multiplayer online universes. It provides the base technologies and a set of development methodologies for the development of both client and server code.
Ryzom Core is open source and released under the terms of the GNU Affero General Public License 3.0 (GNU/AGPLv3) for the source code and the Creative Commons Attributions-ShareAlike 3.0 (CC-BY-SA) for the art assets. Which means you can create your own game using Ryzom Core, for more information on doing so check out Creating Your Own Game Using Ryzom Core.
Ryzom Core is open source and released under the terms of the GNU Affero General Public License 3.0 (GNU/AGPLv3) for the source code and the Creative Commons Attributions-ShareAlike 3.0 (CC-BY-SA) for the art assets. Which means you can create your own game using Ryzom Core, for more information on doing so check out Creating Your Own Game Using Ryzom Core.

@ -2,7 +2,7 @@
#
# Ryzom Core
# Authors: Nevrax and the Ryzom Core Community
# Version: 0.11.3
# Version: 0.12.0
#
# Notes:
# * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path
@ -31,11 +31,16 @@ IF(COMMAND cmake_policy)
# Works around warnings about escaped quotes in ADD_DEFINITIONS
# statements
cmake_policy(SET CMP0005 OLD)
# allow to link to qtmain automatically under Windows
IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF()
ENDIF(COMMAND cmake_policy)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/nel.cmake)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/ConfigureChecks.cmake)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/CheckDepends.cmake)
INCLUDE(nel)
INCLUDE(ConfigureChecks)
INCLUDE(CheckDepends)
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
# Force out of source builds.
@ -44,12 +49,19 @@ CHECK_OUT_OF_SOURCE()
# To be able to specify a different deployment target on Mac OS X :
# export MACOSX_DEPLOYMENT_TARGET=10.6
IF(CMAKE_VERSION VERSION_GREATER "2.8.10")
STRING(TIMESTAMP CURRENT_YEAR "%Y")
ELSE()
SET(CURRENT_YEAR "2016")
ENDIF()
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(RyzomCore CXX C)
SET(NL_VERSION_MAJOR 0)
SET(NL_VERSION_MINOR 11)
SET(NL_VERSION_PATCH 3)
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}")
SET(NL_VERSION_MINOR 12)
SET(NL_VERSION_PATCH 0)
SET(YEAR "2004-${CURRENT_YEAR}")
SET(AUTHOR "Winchgate and The Ryzom Core Community")
#-----------------------------------------------------------------------------
# Redirect output files
@ -67,10 +79,6 @@ IF(WIN32)
IF(WITH_MFC)
FIND_PACKAGE(MFC QUIET)
ENDIF(WITH_MFC)
IF(NOT DEFINED ENV{QTDIR})
SET(ENV{QTDIR} "c:/qt/4.6.3")
ENDIF(NOT DEFINED ENV{QTDIR})
ENDIF(WIN32)
#-----------------------------------------------------------------------------
@ -94,7 +102,6 @@ NL_SETUP_BUILD_FLAGS()
#Platform specifics
SETUP_EXTERNAL()
NL_GEN_REVISION_H()
IF(WIN32)
SET(WINSOCK2_LIB ws2_32.lib)
@ -104,8 +111,11 @@ IF(WIN32)
ENDIF(WITH_MFC)
ENDIF(WIN32)
FIND_PACKAGE(ZLIB REQUIRED)
FIND_PACKAGE(LibXml2 REQUIRED)
FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(OpenSSL REQUIRED)
FIND_PACKAGE(GIF)
FIND_PACKAGE(Jpeg)
IF(WITH_STATIC_LIBXML2)
@ -120,13 +130,17 @@ ENDIF(WITH_LIBXML2_ICONV)
IF(WITH_STATIC)
# libxml2 could need winsock2 library
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
# on Mac OS X libxml2 requires iconv and liblzma
IF(APPLE)
FIND_PACKAGE(LibLZMA REQUIRED)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
ENDIF(APPLE)
IF(WINSOCK2_LIB)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
ENDIF()
IF(UNIX)
# under Linux and OS X, recent libxml2 versions are linked against liblzma
FIND_PACKAGE(LibLZMA)
IF(LIBLZMA_LIBRARIES)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
ENDIF()
ENDIF()
ENDIF(WITH_STATIC)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
@ -142,48 +156,284 @@ IF(WITH_SSE2)
ENDIF(WITH_SSE3)
ENDIF(WITH_SSE2)
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")
SET(CODESIGN_ALLOCATE)
ENDIF()
ENDIF()
MACRO(ADD_QT_LIBRARY _NAME)
IF(WIN32)
SET(_PREFIX "Qt5")
SET(_EXT "lib")
ELSE()
SET(_PREFIX "libQt5")
SET(_EXT "a")
ENDIF()
SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}.${_EXT}")
IF(EXISTS ${_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB})
ENDIF()
SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}")
IF(EXISTS ${_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB})
ENDIF()
ENDMACRO()
MACRO(ADD_QT_PLUGIN _TYPE _NAME)
IF(WIN32)
SET(_PREFIX "")
SET(_EXT "lib")
ELSE()
SET(_PREFIX "lib")
SET(_EXT "a")
ENDIF()
SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}.${_EXT}")
IF(EXISTS ${_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB})
ENDIF()
SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}")
IF(EXISTS ${_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB})
ENDIF()
ENDMACRO()
IF(WITH_QT5)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR)
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR})
FIND_PACKAGE(Qt5Core QUIET)
IF(Qt5Core_FOUND)
# Check if we are using Qt static or shared libraries
GET_TARGET_PROPERTY(_FILE Qt5::Core IMPORTED_LOCATION_RELEASE)
SET(QT_VERSION "${Qt5Core_VERSION_STRING}")
SET(_VERSION "${QT_VERSION}")
IF(_FILE MATCHES "\\.(lib|a)$")
SET(QT_STATIC ON)
SET(_VERSION "${_VERSION} static version")
ELSE()
SET(QT_STATIC OFF)
SET(_VERSION "${_VERSION} shared version")
ENDIF()
MESSAGE(STATUS "Found Qt ${_VERSION}")
# These variables are not defined with Qt5 CMake modules
SET(QT_BINARY_DIR "${_qt5Core_install_prefix}/bin")
SET(QT_LIBRARY_DIR "${_qt5Core_install_prefix}/lib")
SET(QT_PLUGINS_DIR "${_qt5Core_install_prefix}/plugins")
SET(QT_TRANSLATIONS_DIR "${_qt5Core_install_prefix}/translations")
# Fix wrong include directories with Qt 5 under Mac OS X
INCLUDE_DIRECTORIES("${_qt5Core_install_prefix}/include")
FIND_PACKAGE(Qt5Gui)
FIND_PACKAGE(Qt5Widgets)
FIND_PACKAGE(Qt5OpenGL)
FIND_PACKAGE(Qt5Xml)
FIND_PACKAGE(Qt5LinguistTools)
FIND_PACKAGE(Qt5Network)
IF(QT_STATIC)
ADD_DEFINITIONS(-DQT_STATICPLUGIN)
SET(QT_LIBRARIES Qt5::Widgets)
# Gui
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Gui Qt5::OpenGL)
ADD_QT_LIBRARY(PrintSupport)
IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES}
${WINSDK_LIBRARY_DIR}/Imm32.lib
${WINSDK_LIBRARY_DIR}/OpenGL32.lib
${WINSDK_LIBRARY_DIR}/WinMM.Lib)
ADD_QT_PLUGIN(platforms qwindows)
ADD_QT_LIBRARY(PlatformSupport)
ELSEIF(APPLE)
# Cups needs .dylib
SET(OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib)
FIND_LIBRARY(CUPS_LIBRARY cups)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES})
FIND_LIBRARY(IOKIT_FRAMEWORK IOKit)
FIND_LIBRARY(COCOA_FRAMEWORK Cocoa)
FIND_LIBRARY(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration)
FIND_LIBRARY(OPENGL_FRAMEWORK NAMES OpenGL)
SET(QT_LIBRARIES ${QT_LIBRARIES}
${CUPS_LIBRARY}
${COCOA_FRAMEWORK}
${SYSTEMCONFIGURATION_FRAMEWORK}
${IOKIT_FRAMEWORK}
${OPENGL_FRAMEWORK})
ADD_QT_PLUGIN(printsupport cocoaprintersupport)
ADD_QT_PLUGIN(platforms qcocoa)
ADD_QT_LIBRARY(PlatformSupport)
ELSE()
# order is very important there
ADD_QT_PLUGIN(platforms qxcb)
ADD_QT_PLUGIN(xcbglintegrations qxcb-glx-integration)
ADD_QT_LIBRARY(XcbQpa)
ADD_QT_LIBRARY(PlatformSupport)
SET(QT_LIBRARIES ${QT_LIBRARIES} -lX11-xcb -lXi -lSM -lICE -lxcb -lGL)
IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a")
SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_LIBRARY_DIR}/libxcb-static.a")
ENDIF()
SET(QT_LIBRARIES ${QT_LIBRARIES} -lfontconfig)
ADD_QT_LIBRARY(DBus)
ENDIF()
ADD_QT_PLUGIN(imageformats qgif)
ADD_QT_PLUGIN(imageformats qicns)
ADD_QT_PLUGIN(imageformats qico)
ADD_QT_PLUGIN(imageformats qjpeg)
# harfbuzz is needed since Qt 5.3
IF(UNIX)
SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzzng.a")
ELSEIF(WIN32)
SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib")
ENDIF()
IF(EXISTS ${HB_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${HB_LIB})
ENDIF()
# freetype is needed since Qt 5.5
IF(UNIX)
SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a")
ELSEIF(WIN32)
SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib")
ENDIF()
IF(EXISTS ${FREETYPE_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB})
ENDIF()
ADD_QT_PLUGIN(accessible qtaccessiblewidgets)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARY})
# Network
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Network Qt5::Xml)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES})
IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES}
${WINSDK_LIBRARY_DIR}/Crypt32.lib
${WINSDK_LIBRARY_DIR}/WS2_32.Lib)
ENDIF()
# Core
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Core)
# pcre is needed since Qt 5.5
IF(UNIX)
SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a")
ELSEIF(WIN32)
SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib")
ENDIF()
IF(EXISTS ${PCRE_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${PCRE_LIB})
ENDIF()
IF(APPLE)
FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre)
FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
FIND_LIBRARY(SECURITY_FRAMEWORK Security)
SET(QT_LIBRARIES ${QT_LIBRARIES}
${PCRE_LIBRARY}
${FOUNDATION_FRAMEWORK}
${CARBON_FRAMEWORK}
${SECURITY_FRAMEWORK})
ELSEIF(UNIX)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} -ldl -lrt)
ENDIF()
ELSE()
SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core)
ENDIF()
ELSE()
MESSAGE(WARNING "Unable to find Qt 5")
ENDIF()
ENDIF()
IF(WITH_QT)
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR})
# Use Qt 4
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
ENDIF(WITH_QT)
IF(WITH_ASSIMP)
FIND_PACKAGE(assimp REQUIRED)
ENDIF(WITH_ASSIMP)
IF(WITH_NEL)
IF(WITH_NEL_TESTS)
FIND_PACKAGE(CppTest)
ENDIF(WITH_NEL_TESTS)
IF(WITH_GUI)
FIND_PACKAGE(Libwww REQUIRED)
FIND_PACKAGE(Luabind REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
SET(CURL_STATIC ON)
ELSE((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
ELSE()
SET(CURL_STATIC OFF)
ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
ENDIF()
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)
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
# CURL Macports version depends on libidn, libintl and libiconv too
IF(APPLE)
IF(UNIX)
# CURL depends on libidn
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})
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(IDN_LIBRARY)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY})
ENDIF()
# CURL Macports version depends on libidn, libintl and libiconv too
IF(APPLE)
FIND_LIBRARY(INTL_LIBRARY intl)
IF(INTL_LIBRARY)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY})
ENDIF()
ENDIF()
ENDIF()
ENDIF()
ENDIF()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include)
ADD_SUBDIRECTORY(nel)
ENDIF(WITH_NEL)
@ -201,7 +451,7 @@ ENDIF(WITH_SNOWBALLS)
IF(WITH_TOOLS)
ADD_SUBDIRECTORY(tool)
ENDIF(WITH_TOOLS)
ENDIF()
IF(WITH_STUDIO)
ADD_SUBDIRECTORY(studio)

@ -15,48 +15,76 @@ IF(NOT NDK_ROOT)
IF(CMAKE_HOST_WIN32)
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
ENDIF(CMAKE_HOST_WIN32)
ENDIF(NOT NDK_ROOT)
ENDIF()
ENDIF()
IF(NOT TARGET_CPU)
SET(TARGET_CPU "armv7")
ENDIF(NOT TARGET_CPU)
ENDIF()
SET(ARMV7_HARD_FLOAT OFF)
IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
IF(ARMV7_HARD_FLOAT)
SET(LIBRARY_ARCHITECTURE "${LIBRARY_ARCHITECTURE}-hard")
ENDIF()
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "arm64")
SET(LIBRARY_ARCHITECTURE "arm64-v8a")
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
SET(TOOLCHAIN_ARCH "arm64")
SET(GCC_TOOLCHAIN_PREFIX "aarch64-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "aarch64-linux-android")
SET(MINIMUM_NDK_TARGET 21)
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(LIBRARY_ARCHITECTURE "x86")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
SET(TOOLCHAIN_ARCH "x86")
SET(GCC_TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686")
SET(TOOLCHAIN_BIN_PREFIX "i686-linux-android")
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "x86_64")
SET(LIBRARY_ARCHITECTURE "x86_64")
SET(CMAKE_SYSTEM_PROCESSOR "x86_64")
SET(TOOLCHAIN_ARCH "x86_64")
SET(GCC_TOOLCHAIN_PREFIX "x86_64")
SET(TOOLCHAIN_BIN_PREFIX "x86_64-linux-android")
SET(MINIMUM_NDK_TARGET 21)
ELSEIF(TARGET_CPU STREQUAL "mips")
SET(LIBRARY_ARCHITECTURE "mips")
SET(CMAKE_SYSTEM_PROCESSOR "mips")
SET(TOOLCHAIN_ARCH "mips")
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
SET(TOOLCHAIN_BIN_PREFIX "mipsel-linux-android")
SET(MINIMUM_NDK_TARGET 9)
ENDIF(TARGET_CPU STREQUAL "armv7")
ELSEIF(TARGET_CPU STREQUAL "mips64")
SET(LIBRARY_ARCHITECTURE "mips64")
SET(CMAKE_SYSTEM_PROCESSOR "mips64")
SET(TOOLCHAIN_ARCH "mips64")
SET(GCC_TOOLCHAIN_PREFIX "mips64el-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mips64el-linux-android")
SET(MINIMUM_NDK_TARGET 21)
ELSE()
MESSAGE(FATAL_ERROR "Unable to process TARGET_CPU ${TARGET_CPU}")
ENDIF()
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(ANDROID_COMPILER "GCC")
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
SET(ANDROID_COMPILER "clang")
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(CLANG ON)
ELSE()
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
@ -64,7 +92,11 @@ ENDIF()
IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF(NOT NDK_TARGET)
ELSE()
IF(NDK_TARGET LESS MINIMUM_NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF()
ENDIF()
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows")
@ -75,7 +107,7 @@ ELSEIF(CMAKE_HOST_APPLE)
ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_HOST "linux")
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32)
ENDIF()
MACRO(SEARCH_TOOLCHAIN _COMPILER)
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
@ -110,7 +142,7 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER)
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF()
ENDIF()
ENDMACRO()
@ -123,8 +155,14 @@ ENDIF()
SEARCH_TOOLCHAIN(GCC)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
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}")
@ -137,14 +175,7 @@ SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
IF(_TOOLCHAIN_BIN_PREFIXES)
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
ENDIF(_TOOLCHAIN_BIN_PREFIXES)
ENDIF()
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
@ -160,39 +191,45 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
IF("${_BINARY}" MATCHES "clang")
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
ELSE()
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDIF()
ENDMACRO(SET_TOOLCHAIN_BINARY)
MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY)
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
ENDMACRO()
MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY)
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDMACRO()
# Force the compilers to GCC for Android
include (CMakeForceCompiler)
IF(CLANG)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
MESSAGE(STATUS "Using clang compiler")
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
MESSAGE(STATUS "Using clang compiler")
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++)
ELSE()
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
MESSAGE(STATUS "Using GCC compiler")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_CXX_COMPILER g++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
MESSAGE(STATUS "Using GCC compiler")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_LINKER ld)
ENDIF()
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY(CMAKE_AR ar)
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld)
SET_TOOLCHAIN_BINARY(CMAKE_NM nm)
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy)
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJCOPY objcopy)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_RANLIB ranlib)

@ -1,79 +1,56 @@
MACRO(NL_CONFIGURE_CHECKS)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckTypeSize)
CHECK_INCLUDE_FILES ("execinfo.h" HAVE_EXECINFO_H)
CHECK_INCLUDE_FILES ("stdint.h" HAVE_STDINT_H)
CHECK_INCLUDE_FILES ("sys/types.h" HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES ("inttypes.h" HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES ("unistd.h" HAVE_UNISTD_H)
CHECK_INCLUDE_FILES ("utime.h" HAVE_UTIME_H)
CHECK_INCLUDE_FILES ("dl.h" HAVE_DL_H)
CHECK_INCLUDE_FILES ("limits.h" HAVE_LIMITS_H)
CHECK_INCLUDE_FILES ("malloc.h" HAVE_MALLOC_H)
CHECK_INCLUDE_FILES ("sys/param.h" HAVE_SYS_PARAM_H)
CHECK_INCLUDE_FILES ("sys/param.h;sys/mount.h" HAVE_SYS_MOUNT_H)
CHECK_INCLUDE_FILES ("sys/statvfs.h" HAVE_SYS_STATVFS_H)
CHECK_INCLUDE_FILES ("pthread.h" HAVE_PTHREAD)
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
#if (NOT HAVE_SIZEOF_SIZE_T)
# MESSAGE(FATAL_ERROR "size_t is not present on this architecture - aborting")
#endif (NOT HAVE_SIZEOF_SIZE_T)
MESSAGE(STATUS "DEBUG size_t is ${SIZEOF_SIZE_T}")
CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T)
MESSAGE(STATUS "DEBUG off_t is ${SIZEOF_OFF_T}")
CHECK_FUNCTION_EXISTS("backtrace" HAVE_BACKTRACE)
CHECK_FUNCTION_EXISTS("getsockname" HAVE_GETSOCKNAME)
CHECK_FUNCTION_EXISTS("inet_ntoa" HAVE_INET_NTOA)
CHECK_FUNCTION_EXISTS("inet_ntop" HAVE_INET_NTOP)
CHECK_FUNCTION_EXISTS("inet_pton" HAVE_INET_PTON)
CHECK_FUNCTION_EXISTS("regcomp" HAVE_REGCOMP)
CHECK_FUNCTION_EXISTS("strerror" HAVE_STRERROR)
CHECK_FUNCTION_EXISTS("strlcat" HAVE_STRLCAT)
CHECK_FUNCTION_EXISTS("strptime" HAVE_STRPTIME)
CHECK_FUNCTION_EXISTS("strtok_r" HAVE_STRTOK_R)
CHECK_FUNCTION_EXISTS("strtoull" HAVE_STRTOULL)
CHECK_FUNCTION_EXISTS("statvfs" HAVE_STATVFS)
CHECK_FUNCTION_EXISTS("stat64" HAVE_STAT64)
INCLUDE(GetRevision)
# 3D drivers
IF(WITH_DRIVER_OPENGL)
SET(NL_OPENGL_AVAILABLE 1)
ENDIF(WITH_DRIVER_OPENGL)
ENDIF()
IF(WITH_DRIVER_OPENGLES)
SET(NL_OPENGLES_AVAILABLE 1)
ENDIF(WITH_DRIVER_OPENGLES)
ENDIF()
IF(WITH_DRIVER_DIRECT3D)
SET(NL_DIRECT3D_AVAILABLE 1)
ENDIF(WITH_DRIVER_DIRECT3D)
ENDIF()
# sound drivers
IF(WITH_DRIVER_FMOD)
SET(NL_FMOD_AVAILABLE 1)
ENDIF(WITH_DRIVER_FMOD)
ENDIF()
IF(WITH_DRIVER_OPENAL)
SET(NL_OPENAL_AVAILABLE 1)
ENDIF(WITH_DRIVER_OPENAL)
ENDIF()
IF(WITH_DRIVER_DSOUND)
SET(NL_DSOUND_AVAILABLE 1)
ENDIF(WITH_DRIVER_DSOUND)
ENDIF()
IF(WITH_DRIVER_XAUDIO2)
SET(NL_XAUDIO2_AVAILABLE 1)
ENDIF(WITH_DRIVER_XAUDIO2)
ENDIF()
IF(NOT RYZOM_VERSION_MAJOR)
SET(RYZOM_VERSION_MAJOR ${NL_VERSION_MAJOR})
SET(RYZOM_VERSION_MINOR ${NL_VERSION_MINOR})
SET(RYZOM_VERSION_PATCH ${NL_VERSION_PATCH})
ENDIF()
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}.${REVISION}")
SET(NL_VERSION_RC "${NL_VERSION_MAJOR},${NL_VERSION_MINOR},${NL_VERSION_PATCH},${REVISION}")
SET(RYZOM_VERSION "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}.${REVISION}")
SET(RYZOM_VERSION_RC "${RYZOM_VERSION_MAJOR},${RYZOM_VERSION_MINOR},${RYZOM_VERSION_PATCH},${REVISION}")
NOW(BUILD_DATE)
SET(COPYRIGHT "${YEAR} ${AUTHOR}")
IF(NOT RYZOM_CLIENT_ICON)
SET(RYZOM_CLIENT_ICON "ryzom_client")
ENDIF()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
ENDMACRO(NL_CONFIGURE_CHECKS)
ENDMACRO()

@ -9,7 +9,7 @@
if(MAXSDK_INCLUDE_DIR)
# Already in cache, be silent
SET(MAXSDK_FIND_QUIETLY TRUE)
endif(MAXSDK_INCLUDE_DIR)
endif()
FIND_PATH(MAXSDK_DIR
"include/maxversion.h"
@ -37,9 +37,9 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
IF(TARGET_X64)
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
ELSE(TARGET_X64)
ELSE()
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
ENDIF(TARGET_X64)
ENDIF()
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
@ -47,7 +47,7 @@ MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
HINTS
${MAXSDK_LIBRARY_DIRS}
)
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
ENDMACRO()
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)

@ -45,6 +45,6 @@ IF(MFC_FOUND)
# Set CMake flag to use MFC DLL
SET(CMAKE_MFC_FLAG 2)
ENDIF(MFC_FOUND)
ENDIF()
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project

@ -30,16 +30,16 @@ MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
HINTS
"${DXSDK_LIBRARY_DIR}"
)
ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
ENDMACRO()
IF(DXSDK_DIR)
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
IF(TARGET_X64)
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x64 ${DXSDK_DIR}/lib/amd64)
ELSE(TARGET_X64)
ELSE()
SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x86 ${DXSDK_DIR}/lib)
ENDIF(TARGET_X64)
ENDIF()
FIND_PATH(DXSDK_LIBRARY_DIR
dxguid.lib
@ -52,7 +52,7 @@ IF(DXSDK_DIR)
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
ENDIF(DXSDK_DIR)
ENDIF()
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
# all listed variables are TRUE.

@ -8,7 +8,7 @@
# EXTERNAL_FOUND - True if the external libraries are available
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH})
SET(EXTERNAL_TEMP_FILE "include/wwwconf.h")
SET(EXTERNAL_TEMP_FILE "include/zlib.h")
SET(EXTERNAL_NAME "external")
# If using STLport preprend external_stlport
@ -38,35 +38,35 @@ IF(EXTERNAL_PATH)
# Using 32 or 64 bits binaries
IF(TARGET_X64 AND WIN32)
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64")
ELSE(TARGET_X64 AND WIN32)
ELSE()
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin")
ENDIF(TARGET_X64 AND WIN32)
ENDIF()
# Using 32 or 64 bits libraries
IF(TARGET_X64 AND WIN32)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
ELSE(TARGET_X64 AND WIN32)
ELSE()
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
ENDIF(TARGET_X64 AND WIN32)
ENDIF()
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")
# Stupid hack for FindOpenAL.cmake
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")
SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")
ENDIF(EXTERNAL_PATH)
ENDIF()
IF(EXTERNAL_FOUND)
IF(NOT External_FIND_QUIETLY)
MESSAGE(STATUS "Found ${EXTERNAL_NAME}: ${EXTERNAL_PATH}")
ENDIF(NOT External_FIND_QUIETLY)
ELSE(EXTERNAL_FOUND)
ENDIF()
ELSE()
IF(External_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Unable to find ${EXTERNAL_NAME}!")
ELSE(External_FIND_REQUIRED)
ELSE()
IF(NOT External_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find ${EXTERNAL_NAME}!")
ENDIF(NOT External_FIND_QUIETLY)
ENDIF(External_FIND_REQUIRED)
ENDIF(EXTERNAL_FOUND)
ENDIF()
ENDIF()
ENDIF()
MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH)

@ -58,6 +58,7 @@ IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
ENDIF(NOT LIBOVR_FIND_QUIETLY)
SET(LIBOVR_FOUND "YES")
SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR")
SET(NL_STEREO_AVAILABLE ON)
IF(UNIX)
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread)
ELSE(UNIX)

@ -25,6 +25,7 @@ IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
ENDIF(NOT LIBVR_FIND_QUIETLY)
SET(LIBVR_FOUND "YES")
SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR")
SET(NL_STEREO_AVAILABLE ON)
ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibVR!")

@ -1,190 +0,0 @@
#
# Find the W3C libwww includes and library
#
# 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.
OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF)
# also defined, but not for general use are
IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR)
# in cache already
SET(Libwww_FIND_QUIETLY TRUE)
ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR)
FIND_PATH(LIBWWW_INCLUDE_DIR
WWWInit.h
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES libwww w3c-libwww
)
# when installing libwww on mac os x using macports the file wwwconf.h resides
# in /opt/local/include and not in the real libwww include dir :/
FIND_PATH(LIBWWW_ADDITIONAL_INCLUDE_DIR
wwwconf.h
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
# combine both include directories into one variable
IF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_ADDITIONAL_INCLUDE_DIR})
ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
# helper to find all the libwww sub libraries
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}_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
/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
)
IF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
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}_DEBUG})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
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}_RELEASE AND ${MYLIBRARY}_DEBUG)
MARK_AS_ADVANCED(${MYLIBRARY}_RELEASE ${MYLIBRARY}_DEBUG)
ENDMACRO(FIND_WWW_LIBRARY)
MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL)
IF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL)
LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL})
ENDIF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL)
ENDMACRO(LINK_WWW_LIBRARY)
# Find and link required libs for static or dynamic
FIND_WWW_LIBRARY(LIBWWWAPP_LIBRARY REQUIRED wwwapp) # cache core file ftp gopher html http mime news stream telnet trans utils zip xml xmlparse
FIND_WWW_LIBRARY(LIBWWWCORE_LIBRARY REQUIRED wwwcore) # utils
FIND_WWW_LIBRARY(LIBWWWFILE_LIBRARY REQUIRED wwwfile) # core trans utils html
FIND_WWW_LIBRARY(LIBWWWHTML_LIBRARY REQUIRED wwwhtml) # core utils
FIND_WWW_LIBRARY(LIBWWWHTTP_LIBRARY REQUIRED wwwhttp) # md5 core mime stream utils
FIND_WWW_LIBRARY(LIBWWWMIME_LIBRARY REQUIRED wwwmime) # core cache stream utils
# Required for static or if underlinking
FIND_WWW_LIBRARY(LIBWWWCACHE_LIBRARY OPTIONAL wwwcache) # core trans utils
FIND_WWW_LIBRARY(LIBWWWSTREAM_LIBRARY OPTIONAL wwwstream) # core file utils
FIND_WWW_LIBRARY(LIBWWWTRANS_LIBRARY REQUIRED wwwtrans) # core utils
FIND_WWW_LIBRARY(LIBWWWUTILS_LIBRARY REQUIRED wwwutils)
# Required only if underlinking
# Unused protocols
FIND_WWW_LIBRARY(LIBWWWFTP_LIBRARY OPTIONAL wwwftp) # core file utils
FIND_WWW_LIBRARY(LIBWWWGOPHER_LIBRARY OPTIONAL wwwgopher) # core html utils file
FIND_WWW_LIBRARY(LIBWWWNEWS_LIBRARY OPTIONAL wwwnews) # core html mime stream utils
FIND_WWW_LIBRARY(LIBWWWTELNET_LIBRARY OPTIONAL wwwtelnet) # core utils
# Other used by app
FIND_WWW_LIBRARY(LIBWWWDIR_LIBRARY OPTIONAL wwwdir) # file
FIND_WWW_LIBRARY(LIBWWWINIT_LIBRARY OPTIONAL wwwinit) # app cache core file html utils
FIND_WWW_LIBRARY(LIBWWWMUX_LIBRARY OPTIONAL wwwmux) # core stream trans utils
FIND_WWW_LIBRARY(LIBWWWXML_LIBRARY OPTIONAL wwwxml) # core utils xmlparse
FIND_WWW_LIBRARY(LIBWWWZIP_LIBRARY OPTIONAL wwwzip) # core utils
FIND_WWW_LIBRARY(LIBXMLPARSE_LIBRARY OPTIONAL xmlparse) # xmltok
# Other used by other
FIND_WWW_LIBRARY(LIBXMLTOK_LIBRARY OPTIONAL xmltok)
FIND_WWW_LIBRARY(LIBWWWSSL_LIBRARY OPTIONAL wwwssl)
FIND_WWW_LIBRARY(LIBMD5_LIBRARY OPTIONAL md5)
FIND_WWW_LIBRARY(LIBPICS_LIBRARY OPTIONAL pics)
# Other external libraries
FIND_PACKAGE(EXPAT QUIET)
FIND_PACKAGE(OpenSSL QUIET)
FIND_WWW_LIBRARY(LIBREGEX_LIBRARY OPTIONAL gnu_regex)
# Now link all libs together
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTLoadCache)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTCacheAppend)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWFTP_LIBRARY HTLoadFTP)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWGOPHER_LIBRARY HTLoadGopher)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWNEWS_LIBRARY HTLoadNews)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWTELNET_LIBRARY HTLoadTelnet)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTStreamToChunk)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTGuess_new)
LINK_WWW_LIBRARY(LIBWWWFILE_LIBRARY LIBWWWDIR_LIBRARY HTDir_new)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWINIT_LIBRARY HTProtocolInit)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWXML_LIBRARY HTXML_new)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWZIP_LIBRARY HTZLib_inflate)
# libwwwxml can be linked to xmlparse or expat
LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY LIBXMLPARSE_LIBRARY XML_ParserCreate)
IF(LIBXMLPARSE_LIBRARY_LINKED)
LINK_WWW_LIBRARY(LIBXMLPARSE_LIBRARY EXPAT_LIBRARY XmlInitEncoding)
ELSE(LIBXMLPARSE_LIBRARY_LINKED)
LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY EXPAT_LIBRARY XML_ParserCreate)
ENDIF(LIBXMLPARSE_LIBRARY_LINKED)
LINK_WWW_LIBRARY(LIBWWWHTTP_LIBRARY LIBMD5_LIBRARY MD5Init)
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
LIBWWW_LIBRARIES
LIBWWW_INCLUDE_DIR
)

@ -0,0 +1,81 @@
# Locate Lua library
# This module defines
# LUA53_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# Note that the expected include convention is
# #include "lua.h"
# and not
# #include <lua/lua.h>
# This is because, the lua location is not standardized and may exist
# in locations other than lua/
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua53 include/lua5.3 include/lua-5.3 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUA_LIBRARY
NAMES lua53 lua5.3 lua-5.3 lua
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUA_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua53
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)

@ -9,53 +9,81 @@ MACRO(FIND_CORRECT_LUA_VERSION)
IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
INCLUDE(CheckDepends)
SET(LUA52_LIBRARY "liblua5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
# check for Lua 5.3
SET(LUA53_LIBRARIES liblua5.3 liblua-5.3 liblua.so.5.3)
FOREACH(_LIB ${LUA53_LIBRARIES})
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.3")
FIND_PACKAGE(Lua53 REQUIRED)
BREAK()
ENDIF()
ENDFOREACH()
IF(NOT LUALIB_FOUND)
# fedora (v20)
SET(LUA52_LIBRARY "liblua-5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
ENDIF(NOT LUALIB_FOUND)
# check for Lua 5.2
SET(LUA52_LIBRARIES liblua5.2 liblua-5.2 liblua.so.5.2)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.2")
FIND_PACKAGE(Lua52 REQUIRED)
ELSE(LUALIB_FOUND)
SET(LUA51_LIBRARY "liblua5.1")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND)
FOREACH(_LIB ${LUA52_LIBRARIES})
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.2")
FIND_PACKAGE(Lua52 REQUIRED)
BREAK()
ENDIF()
ENDFOREACH()
ENDIF()
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.1")
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(LUALIB_FOUND)
SET(LUA50_LIBRARY "liblua5.0")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND)
IF(NOT LUALIB_FOUND)
# check for Lua 5.1
SET(LUA51_LIBRARIES liblua5.1 liblua-5.1 liblua.so.5.1)
FOREACH(_LIB ${LUA51_LIBRARIES})
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.1")
FIND_PACKAGE(Lua51 REQUIRED)
BREAK()
ENDIF()
ENDFOREACH()
ENDIF()
IF(NOT LUALIB_FOUND)
# check for Lua 5.0
SET(LUA50_LIBRARIES liblua5.0 liblua-5.0 liblua.so.5.0)
FOREACH(_LIB ${LUA50_LIBRARIES})
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.0")
FIND_PACKAGE(Lua50 REQUIRED)
ELSE(LUALIB_FOUND)
MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind")
ENDIF(LUALIB_FOUND)
ENDIF(LUALIB_FOUND)
ENDIF(LUALIB_FOUND)
ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
BREAK()
ENDIF()
ENDFOREACH()
ENDIF()
IF(NOT LUALIB_FOUND)
MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind")
ENDIF()
ELSE()
# TODO: find a way to detect Lua version
IF(WITH_LUA52)
IF(WITH_LUA53)
FIND_PACKAGE(Lua53 REQUIRED)
ELSEIF(WITH_LUA52)
FIND_PACKAGE(Lua52 REQUIRED)
ELSEIF(WITH_LUA51)
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(WITH_LUA52)
ELSE()
FIND_PACKAGE(Lua50 REQUIRED)
ENDIF(WITH_LUA52)
ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
ENDMACRO(FIND_CORRECT_LUA_VERSION)
ENDIF()
ENDIF()
ENDMACRO()
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
# in cache already
SET(Luabind_FIND_QUIETLY TRUE)
ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
ENDIF()
FIND_PATH(LUABIND_INCLUDE_DIR
luabind/luabind.hpp
@ -72,11 +100,21 @@ FIND_PATH(LUABIND_INCLUDE_DIR
SET(LIBRARY_NAME_RELEASE)
SET(LIBRARY_NAME_DEBUG)
IF(WITH_LUA53)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua53)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua53d)
ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua53)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua53d)
ENDIF()
IF(WITH_LUA52)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d)
ENDIF(WITH_STLPORT)
ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d)

@ -14,8 +14,8 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
ENDIF()
ENDIF()
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND ON)
@ -24,14 +24,14 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
SET(_VERSION_STR ${_VERSION})
IF(MSVC_EXPRESS)
SET(_VERSION_STR "${_VERSION_STR} Express")
ENDIF(MSVC_EXPRESS)
ENDIF()
MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}")
ENDIF(NOT MSVC_FIND_QUIETLY)
ENDIF()
ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND OFF)
SET(VC${_VERSION}_DIR "")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDMACRO(DETECT_VC_VERSION_HELPER)
ENDIF()
ENDMACRO()
MACRO(DETECT_VC_VERSION _VERSION)
SET(VC${_VERSION}_FOUND OFF)
@ -39,21 +39,21 @@ MACRO(DETECT_VC_VERSION _VERSION)
IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT VC${_VERSION}_FOUND)
ENDIF()
IF(VC${_VERSION}_FOUND)
SET(VC_FOUND ON)
SET(VC_DIR "${VC${_VERSION}_DIR}")
ENDIF(VC${_VERSION}_FOUND)
ENDMACRO(DETECT_VC_VERSION)
ENDIF()
ENDMACRO()
MACRO(DETECT_EXPRESS_VERSION _VERSION)
GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE)
IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
SET(MSVC_EXPRESS ON)
ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
ENDMACRO(DETECT_EXPRESS_VERSION)
ENDIF()
ENDMACRO()
IF(MSVC12)
DETECT_VC_VERSION("12.0")
@ -62,7 +62,7 @@ IF(MSVC12)
IF(NOT MSVC12_REDIST_DIR)
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC12_REDIST_DIR)
ENDIF()
ELSEIF(MSVC11)
DETECT_VC_VERSION("11.0")
SET(MSVC_TOOLSET "110")
@ -70,7 +70,7 @@ ELSEIF(MSVC11)
IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR)
ENDIF()
ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0")
SET(MSVC_TOOLSET "100")
@ -78,23 +78,28 @@ ELSEIF(MSVC10)
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC10_REDIST_DIR)
ENDIF()
ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0")
SET(MSVC_TOOLSET "90")
ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0")
SET(MSVC_TOOLSET "80")
ENDIF(MSVC12)
ENDIF()
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
IF(NOT VC_DIR)
SET(VC_DIR $ENV{VC_DIR})
ENDIF(NOT VC_DIR)
ENDIF()
IF(NOT VC_DIR)
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
ENDIF(NOT VC_DIR)
IF(CMAKE_CXX_COMPILER)
SET(_COMPILER ${CMAKE_CXX_COMPILER})
ELSE()
SET(_COMPILER ${CMAKE_C_COMPILER})
ENDIF()
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${_COMPILER})
ENDIF()
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR})

@ -31,7 +31,7 @@
# MESSAGE("Current revision is ${Project_WC_REVISION}")
# Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
# ENDIF(MERCURIAL_FOUND)
# ENDIF()
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@ -74,22 +74,22 @@ IF(Mercurial_HG_EXECUTABLE)
IF(NOT ${Mercurial_hg_info_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}")
ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0)
ELSE()
LIST(LENGTH ${prefix}_WC_INFO _COUNT)
IF(_COUNT EQUAL 4)
LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
ELSE(_COUNT EQUAL 4)
ELSE()
MESSAGE(STATUS "Bad output from HG")
SET(${prefix}_WC_REVISION "unknown")
SET(${prefix}_WC_CHANGESET "unknown")
SET(${prefix}_WC_BRANCH "unknown")
ENDIF(_COUNT EQUAL 4)
ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0)
ENDIF()
ENDIF()
ENDMACRO(Mercurial_WC_INFO)
ENDMACRO()
MACRO(Mercurial_WC_LOG dir prefix)
# This macro can block if the certificate is not signed:
@ -105,9 +105,9 @@ IF(Mercurial_HG_EXECUTABLE)
IF(NOT ${Mercurial_hg_log_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Mercurial_hg_log_error}")
ENDIF(NOT ${Mercurial_hg_log_result} EQUAL 0)
ENDMACRO(Mercurial_WC_LOG)
ENDIF(Mercurial_HG_EXECUTABLE)
ENDIF()
ENDMACRO()
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE)

@ -17,9 +17,12 @@ ELSE()
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
PATH_SUFFIXES mysql
PATHS
/usr/include/mysql
/usr/local/include/mysql
/opt/local/include/mysql5/mysql
/opt/local/include/mysql55/mysql
/opt/local/include/mysql51/mysql
$ENV{ProgramFiles}/MySQL/*/include
$ENV{SystemDrive}/MySQL/*/include)
@ -41,6 +44,8 @@ ELSE()
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
/opt/local/lib/mysql55/mysql
/opt/local/lib/mysql51/mysql
)
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd
@ -50,6 +55,8 @@ ELSE()
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
/opt/local/lib/mysql55/mysql
/opt/local/lib/mysql51/mysql
)
ENDIF()

@ -9,7 +9,7 @@
IF(WINSDK_FOUND)
# If Windows SDK already found, skip it
RETURN()
ENDIF(WINSDK_FOUND)
ENDIF()
# Values can be CURRENT or any existing versions 7.1, 8.0A, etc...
SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer")
@ -17,16 +17,31 @@ SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer")
MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};InstallationFolder]" ABSOLUTE)
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry" AND EXISTS "${WINSDK${_VERSION}_DIR}/Include")
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 ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
ENDIF()
ELSE()
SET(WINSDK${_VERSION}_DIR "")
ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
ENDMACRO(DETECT_WINSDK_VERSION_HELPER)
ENDIF()
ENDMACRO()
MACRO(DETECT_WINKIT_VERSION _VERSION _SUFFIX)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot${_SUFFIX}]" ABSOLUTE)
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
SET(WINSDK${_VERSION}_FOUND ON)
SET(WINSDK${_VERSION}_VERSION_FULL "${_VERSION}")
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
ENDIF()
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
ELSE()
SET(WINSDK${_VERSION}_DIR "")
ENDIF()
ENDMACRO()
MACRO(DETECT_WINSDK_VERSION _VERSION)
SET(WINSDK${_VERSION}_FOUND OFF)
@ -34,43 +49,52 @@ MACRO(DETECT_WINSDK_VERSION _VERSION)
IF(NOT WINSDK${_VERSION}_FOUND)
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT WINSDK${_VERSION}_FOUND)
ENDMACRO(DETECT_WINSDK_VERSION)
ENDIF()
ENDMACRO()
SET(WINSDK_VERSIONS "8.0" "8.0A" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
SET(WINSDK_DETECTED_VERSIONS)
# Fixed versions for Windows Kits (VC++ from 2012)
DETECT_WINKIT_VERSION("10.0" "10")
DETECT_WINKIT_VERSION("8.1" "81")
DETECT_WINKIT_VERSION("8.0" "")
# For VC++ up to 2010
SET(WINSDK_VERSIONS "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
# Search all supported Windows SDKs
FOREACH(_VERSION ${WINSDK_VERSIONS})
DETECT_WINSDK_VERSION(${_VERSION})
IF(WINSDK${_VERSION}_FOUND)
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
ENDIF(WINSDK${_VERSION}_FOUND)
ENDFOREACH(_VERSION)
ENDIF()
ENDFOREACH()
SET(WINSDK_SUFFIX)
SET(WINSDK_SUFFIXES)
IF(TARGET_ARM)
IF(TARGET_ARM64)
SET(WINSDK8_SUFFIX "arm64")
ELSEIF(TARGET_ARM)
SET(WINSDK8_SUFFIX "arm")
ELSEIF(TARGET_X64)
SET(WINSDK8_SUFFIX "x64")
SET(WINSDK_SUFFIX "x64")
SET(WINSDK_SUFFIXES "x64" "amd64")
ELSEIF(TARGET_X86)
SET(WINSDK8_SUFFIX "x86")
ENDIF(TARGET_ARM)
ENDIF()
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
IF(WINSDKCURRENT_VERSION_INCLUDE)
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
ENDIF()
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
IF(NOT WINSDKENV_DIR)
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
ENDIF(NOT WINSDKENV_DIR)
ENDIF()
MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
@ -82,17 +106,28 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
)
IF(_MSI_FILE)
# Look for Windows SDK 8.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 8.1
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINBLUE")
IF(_CONTENT)
SET(WINSDK_VERSION "8.1")
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 8.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
IF(_CONTENT)
SET(WINSDK_VERSION "8.0")
ENDIF()
ENDIF()
IF(_CONTENT)
SET(WINSDK_VERSION "8.0")
ENDIF(_CONTENT)
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 7.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN7")
IF(_CONTENT)
FIND_FILE(_WINSDKVER_FILE winsdkver.h WinSDKVer.h
PATHS
@ -112,23 +147,23 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
SET(WINSDK_VERSION "7.1")
ELSEIF(_WINSDKVER STREQUAL "0601")
SET(WINSDK_VERSION "7.0A")
ELSE(_WINSDKVER STREQUAL "06010000")
ELSE()
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
ENDIF(_WINSDKVER STREQUAL "06010000")
ELSE(_WINSDKVER_FILE)
ENDIF()
ELSE()
SET(WINSDK_VERSION "7.0")
ENDIF(_WINSDKVER_FILE)
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 6.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_VISTA")
IF(_CONTENT)
SET(WINSDK_VERSION "6.0")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.2
@ -136,8 +171,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT)
SET(WINSDK_VERSION "5.2")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.1
@ -145,8 +180,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT)
SET(WINSDK_VERSION "5.1")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.0
@ -154,13 +189,13 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT)
SET(WINSDK_VERSION "5.0")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ELSE(_MSI_FILE)
ENDIF()
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
ENDIF(_MSI_FILE)
ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION)
ENDMACRO(FIND_WINSDK_VERSION_HEADERS)
ENDIF()
ENDIF()
ENDMACRO()
MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_DIR "")
@ -174,7 +209,7 @@ MACRO(USE_CURRENT_WINSDK)
${WINSDKENV_DIR}/Include/um
${WINSDKENV_DIR}/Include
)
ENDIF(WINSDKENV_DIR)
ENDIF()
# Use INCLUDE environment variable
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
@ -186,9 +221,9 @@ MACRO(USE_CURRENT_WINSDK)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
BREAK()
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
ENDFOREACH(_INCLUDE)
ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
ENDIF()
ENDFOREACH()
ENDIF()
IF(WINSDK_DIR)
# Compare WINSDK_DIR with registered Windows SDKs
@ -197,38 +232,44 @@ MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_VERSION ${_VERSION})
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
BREAK()
ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
ENDFOREACH(_VERSION)
ENDIF()
ENDFOREACH()
FIND_WINSDK_VERSION_HEADERS()
ENDIF(WINSDK_DIR)
ENDIF()
IF(NOT WINSDK_DIR)
# Use Windows SDK versions installed with VC++ when possible
IF(MSVC12)
SET(WINSDK_VERSION "8.1A")
IF(MSVC14)
SET(WINSDK_VERSION "8.1")
ELSEIF(MSVC12)
SET(WINSDK_VERSION "8.1")
ELSEIF(MSVC11)
SET(WINSDK_VERSION "8.0A")
SET(WINSDK_VERSION "8.0")
ELSEIF(MSVC10)
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
SET(WINSDK_VERSION "7.0A")
ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
ENDIF()
ELSEIF(MSVC90)
IF(NOT MSVC_EXPRESS)
SET(WINSDK_VERSION "6.0A")
ENDIF(NOT MSVC_EXPRESS)
ENDIF()
ELSEIF(MSVC80)
IF(NOT MSVC_EXPRESS)
# TODO: fix this version
SET(WINSDK_VERSION "5.2A")
ENDIF(NOT MSVC_EXPRESS)
ELSE(MSVC12)
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
ENDIF(MSVC12)
ENDIF()
# Use installed Windows SDK
IF(NOT WINSDK_VERSION)
IF(WINSDK7.1_FOUND)
IF(WINSDK8.1_FOUND)
SET(WINSDK_VERSION "8.1")
ELSEIF(WINSDK8.0_FOUND)
SET(WINSDK_VERSION "8.0")
ELSEIF(WINSDK7.1_FOUND)
SET(WINSDK_VERSION "7.1")
ELSEIF(WINSDK7.0_FOUND)
SET(WINSDK_VERSION "7.0")
@ -236,10 +277,10 @@ MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_VERSION "6.1")
ELSEIF(WINSDK6.0_FOUND)
SET(WINSDK_VERSION "6.0")
ELSE(WINSDK7.1_FOUND)
ELSE()
MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.")
ENDIF(WINSDK7.1_FOUND)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
# Look for correct registered Windows SDK version
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
@ -247,27 +288,37 @@ MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
BREAK()
ENDIF(WINSDK_VERSION STREQUAL _VERSION)
ENDFOREACH(_VERSION)
ENDIF(NOT WINSDK_DIR)
ENDMACRO(USE_CURRENT_WINSDK)
ENDIF()
ENDFOREACH()
ENDIF()
ENDMACRO()
IF(MSVC14)
# Under VC++ 2015, stdio.h, stdlib.h, etc... are part of UCRT
SET(WINSDK_UCRT_VERSION "10.0")
ENDIF()
# Look for correct UCRT
IF(WINSDK_UCRT_VERSION AND WINSDK${WINSDK_UCRT_VERSION}_FOUND)
SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}")
ENDIF()
IF(WINSDK_VERSION STREQUAL "CURRENT")
USE_CURRENT_WINSDK()
ELSE(WINSDK_VERSION STREQUAL "CURRENT")
ELSE()
IF(WINSDK${WINSDK_VERSION}_FOUND)
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
ELSE(WINSDK${WINSDK_VERSION}_FOUND)
ELSE()
USE_CURRENT_WINSDK()
ENDIF(WINSDK${WINSDK_VERSION}_FOUND)
ENDIF(WINSDK_VERSION STREQUAL "CURRENT")
ENDIF()
ENDIF()
IF(WINSDK_DIR)
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
ELSE(WINSDK_DIR)
ELSE()
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
ENDIF(WINSDK_DIR)
ENDIF()
# directory where Win32 headers are found
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
@ -276,30 +327,64 @@ FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
${WINSDK_DIR}/Include
)
# directory where WinRT headers are found
FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h
HINTS
${WINSDK_DIR}/Include/winrt
)
# directory where DirectX headers are found
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
HINTS
${WINSDK_DIR}/Include/shared
${WINSDK_DIR}/Include
)
# directory where OpenGL headers are found
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
HINTS
${WINSDK_DIR}/Include/um/gl
${WINSDK_DIR}/Include/gl
${WINSDK_DIR}/Include
)
SET(WINSDK_LIBRARY_DIRS
${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
)
IF(WINSDK_SUFFIXES)
FOREACH(_SUFFIX ${WINSDK_SUFFIXES})
SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib/${_SUFFIX})
ENDFOREACH()
ELSE()
SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib)
ENDIF()
# directory where all libraries are found
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
HINTS
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/${WINSDK_SUFFIX}
${WINSDK_LIBRARY_DIRS}
)
IF(WINSDK_UCRT_DIR)
# directory where UCRT headers are found
FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h
HINTS
${WINSDK_UCRT_DIR}/Include/10.0.10056.0/ucrt
${WINSDK_UCRT_DIR}/Include/10.0.10150.0/ucrt
)
# directory where UCRT libraries are found
FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib
HINTS
${WINSDK_UCRT_DIR}/Lib/10.0.10056.0/ucrt/${WINSDK8_SUFFIX}
${WINSDK_UCRT_DIR}/Lib/10.0.10150.0/ucrt/${WINSDK8_SUFFIX}
)
ENDIF()
# signtool is used to sign executables
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
HINTS
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
)
@ -307,22 +392,46 @@ FIND_PROGRAM(WINSDK_SIGNTOOL signtool
# midl is used to generate IDL interfaces
FIND_PROGRAM(WINSDK_MIDL midl
HINTS
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
)
IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND ON)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR} ${WINSDK_OPENGL_INCLUDE_DIR})
IF(WINSDK_UCRT_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_UCRT_INCLUDE_DIR})
ENDIF()
IF(WINSDK_SHARED_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_SHARED_INCLUDE_DIR})
ENDIF()
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_INCLUDE_DIR})
IF(WINSDK_OPENGL_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_OPENGL_INCLUDE_DIR})
ENDIF()
IF(WINSDK_WINRT_INCLUDE_DIR)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_WINRT_INCLUDE_DIR})
ENDIF()
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) # TODO: Move this after all other includes somehow...
IF(WINSDK_UCRT_LIBRARY_DIR)
SET(CMAKE_LIBRARY_PATH ${WINSDK_UCRT_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
ENDIF()
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)
ENDIF()
ELSE()
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
ENDIF(WINSDK_INCLUDE_DIR)
ENDIF()
ENDIF()

@ -0,0 +1,29 @@
FIND_PATH(
assimp_INCLUDE_DIRS
NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h assimp/cimport.h
PATHS /usr/local/include/
)
FIND_LIBRARY(
assimp_LIBRARIES
NAMES assimp
PATHS /usr/local/lib/
)
IF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
SET(assimp_FOUND TRUE)
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
SET(assimp_LIBRARIES ${assimp_LIBRARIES} ${ZLIB_LIBRARIES})
ENDIF()
ENDIF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
IF (assimp_FOUND)
IF (NOT assimp_FIND_QUIETLY)
MESSAGE(STATUS "Found asset importer library: ${assimp_LIBRARIES}")
ENDIF (NOT assimp_FIND_QUIETLY)
ELSE (assimp_FOUND)
IF (assimp_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find asset importer library")
ENDIF (assimp_FIND_REQUIRED)
ENDIF (assimp_FOUND)

@ -2,12 +2,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3)
# ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory)
# SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt)
# BINARY_DIR should be set to root of your build directory
IF(SOURCE_DIR)
# Replace spaces by semi-columns
IF(CMAKE_MODULE_PATH)
STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
ENDIF(CMAKE_MODULE_PATH)
ENDIF()
SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})
@ -20,23 +21,30 @@ IF(SOURCE_DIR)
ENDIF()
ELSE()
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR}/..)
# convert ROOT_DIR to absolute path
GET_FILENAME_COMPONENT(ROOT_DIR ${ROOT_DIR} ABSOLUTE)
ENDIF()
MACRO(NOW RESULT)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
IF(NOT DATETIME MATCHES "ERROR")
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
ENDIF()
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
IF(CMAKE_VERSION VERSION_GREATER "2.8.10")
STRING(TIMESTAMP ${RESULT} "%Y-%m-%d %H:%M:%S")
ELSE()
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} "0000-00-00 00:00:00")
IF(WIN32)
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
IF(NOT DATETIME MATCHES "ERROR")
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
ENDIF()
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
ELSE()
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} "0000-00-00 00:00:00")
ENDIF()
ENDIF()
ENDMACRO(NOW)
ENDMACRO()
IF(EXISTS "${ROOT_DIR}/.svn/")
FIND_PACKAGE(Subversion QUIET)
@ -44,14 +52,14 @@ IF(EXISTS "${ROOT_DIR}/.svn/")
IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION})
ENDIF(SUBVERSION_FOUND)
ENDIF()
FIND_PACKAGE(TortoiseSVN QUIET)
IF(TORTOISESVN_FOUND)
TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION)
ENDIF(TORTOISESVN_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.svn/")
ENDIF()
ENDIF()
IF(EXISTS "${ROOT_DIR}/.hg/")
FIND_PACKAGE(Mercurial)
@ -73,11 +81,6 @@ IF(SOURCE_DIR AND NOT DEFINED REVISION)
ENDIF()
ENDIF()
IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
MESSAGE(STATUS "Revision: ${REVISION}")
NOW(BUILD_DATE)
CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different
ENDIF()
IF(DEFINED REVISION)
MESSAGE(STATUS "Found revision ${REVISION}")
ENDIF()

@ -10,22 +10,22 @@
IF(MSVC)
SET(PCHSupport_FOUND TRUE)
ELSE(MSVC)
ELSE()
IF(CMAKE_COMPILER_IS_GNUCXX)
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
OUTPUT_VARIABLE gcc_compiler_version)
IF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
IF(gcc_compiler_version VERSION_LESS "4.2")
SET(PCHSupport_FOUND FALSE)
ELSEIF(gcc_compiler_version MATCHES "^4\\.[0-9]+(\\.[0-9]+)?")
ELSE()
SET(PCHSupport_FOUND TRUE)
ENDIF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
ELSE(CMAKE_COMPILER_IS_GNUCXX)
ENDIF()
ELSE()
# TODO: make tests for other compilers than GCC
SET(PCHSupport_FOUND TRUE)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(MSVC)
ENDIF()
ENDIF()
# 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)
@ -40,19 +40,21 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
SET(_USE_PIC OFF)
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)
ELSE()
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)
SET(_USE_PIC ON)
ENDIF()
ENDIF()
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " -I\"${item}\"")
ENDFOREACH(item)
ENDFOREACH()
# Required for CMake 2.6
SET(GLOBAL_DEFINITIONS)
@ -60,61 +62,123 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
ENDFOREACH()
ENDIF()
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
ENDFOREACH()
ENDIF()
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH()
ENDIF()
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
IF(oldProps)
LIST(APPEND _FLAGS " ${oldProps}")
ENDIF(oldProps)
ENDIF()
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
IF(oldPropsBuild)
LIST(APPEND _FLAGS " ${oldPropsBuild}")
ENDIF(oldPropsBuild)
ENDIF()
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
IF(DIRINC)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " -I\"${item}\"")
ENDFOREACH(item)
ENDIF(DIRINC)
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(_LIBS ${_target} INTERFACE_LINK_LIBRARIES)
IF(_LIBS)
FOREACH(_LIB ${_LIBS})
IF(TARGET "${_LIB}")
# use same include directories
GET_TARGET_PROPERTY(_DIRS ${_LIB} INTERFACE_INCLUDE_DIRECTORIES)
IF(_DIRS)
FOREACH(item ${_DIRS})
LIST(APPEND GLOBAL_DEFINITIONS " -I\"${item}\"")
ENDFOREACH()
ENDIF()
# use same compile definitions
GET_TARGET_PROPERTY(_DEFINITIONS ${_LIB} INTERFACE_COMPILE_DEFINITIONS)
IF(_DEFINITIONS)
FOREACH(item ${_DEFINITIONS})
# don't use dynamic expressions
IF(NOT item MATCHES "\\$<")
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDIF()
ENDFOREACH()
ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()
# Special Qt 5 cases
IF(GLOBAL_DEFINITIONS MATCHES "QT_CORE_LIB")
# Hack to define missing QT_NO_DEBUG with Qt 5.2
IF(_UPPER_BUILD STREQUAL "RELEASE")
LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG")
ENDIF()
# Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIC
IF(Qt5_POSITION_INDEPENDENT_CODE)
SET(_USE_PIC ON)
ENDIF()
IF(_USE_PIC)
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}")
ENDIF()
ENDIF()
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
LIST(APPEND _FLAGS " ${_directory_flags}")
LIST(APPEND _FLAGS " ${_directory_definitions}")
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
LIST(APPEND _FLAGS " ${_directory_flags}")
LIST(APPEND _FLAGS " ${_directory_definitions}")
ENDIF()
# Format definitions
IF(MSVC)
# Fix path with space
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
ELSE(MSVC)
ELSE()
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
SEPARATE_ARGUMENTS(_FLAGS)
ENDIF(MSVC)
ENDIF()
IF(CLANG)
# Determining all architectures and get common flags
@ -127,11 +191,11 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
LIST(APPEND PCH_ARCHS ${item})
STRING(TOUPPER "${item}" _UPPER_ARCH)
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
ENDIF(ITEM_FOUND EQUAL -1)
ENDIF()
SET(_ARCH_NEXT OFF)
ELSEIF(_XARCH_NEXT)
SET(_XARCH_NEXT OFF)
ELSE(_ARCH_NEXT)
ELSE()
IF(item MATCHES "^-arch")
SET(_ARCH_NEXT ON)
ELSEIF(item MATCHES "^-Xarch_")
@ -141,13 +205,13 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
LIST(APPEND PCH_ARCHS ${item})
STRING(TOUPPER "${item}" _UPPER_ARCH)
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
ENDIF(ITEM_FOUND EQUAL -1)
ENDIF()
SET(_XARCH_NEXT ON)
ELSE(item MATCHES "^-arch")
ELSE()
LIST(APPEND PCH_FLAGS ${item})
ENDIF(item MATCHES "^-arch")
ENDIF(_ARCH_NEXT)
ENDFOREACH(item)
ENDIF()
ENDIF()
ENDFOREACH()
# Get architcture specific flags
SET(_XARCH_NEXT)
@ -156,25 +220,25 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH)
LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item})
SET(_XARCH_NEXT OFF)
ELSE(_XARCH_NEXT)
ELSE()
IF(item MATCHES "^-Xarch_")
STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT)
ENDIF(item MATCHES "^-Xarch_")
ENDIF(_XARCH_NEXT)
ENDFOREACH(item)
ENDIF()
ENDIF()
ENDFOREACH()
# Remove duplicated architectures
IF(_ARCHS AND PCH_ARCHS)
LIST(REMOVE_DUPLICATES PCH_ARCHS)
ENDIF(_ARCHS AND PCH_ARCHS)
ELSE(CLANG)
ENDIF()
ELSE()
SET(PCH_FLAGS ${_FLAGS})
ENDIF(CLANG)
ENDIF()
IF(PCH_FLAGS)
LIST(REMOVE_DUPLICATES PCH_FLAGS)
ENDIF(PCH_FLAGS)
ENDMACRO(PCH_SET_COMPILE_FLAGS)
ENDIF()
ENDMACRO()
MACRO(GET_PDB_FILENAME _out_filename _target)
# determine output directory based on target type
@ -201,9 +265,9 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
IF(CMAKE_CXX_COMPILER_ARG1)
# remove leading space in compiler argument
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
ELSE(CMAKE_CXX_COMPILER_ARG1)
ELSE()
SET(pchsupport_compiler_cxx_arg1 "")
ENDIF(CMAKE_CXX_COMPILER_ARG1)
ENDIF()
IF(MSVC)
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
@ -211,16 +275,16 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
# 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)
ELSE()
SET(HEADER_FORMAT "c++-header")
SET(_FLAGS "")
IF(APPLE)
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch)
ENDIF(APPLE)
ENDIF()
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT})
ENDIF(MSVC)
ENDMACRO(PCH_SET_COMPILE_COMMAND)
ENDIF()
ENDMACRO()
MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch")
@ -230,14 +294,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
SET(PCH_INPUT ${_input})
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch")
ELSE(MSVC)
ELSE()
IF(NOT "${_arch}" STREQUAL "")
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}")
ENDIF(NOT "${_arch}" STREQUAL "")
ENDIF()
IF(NOT "${_language}" STREQUAL "")
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}")
ENDIF(NOT "${_language}" STREQUAL "")
ENDIF()
GET_FILENAME_COMPONENT(_name ${_input} NAME)
@ -251,14 +315,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
IF(CLANG)
SET(PCH_EXT "pth")
ELSE(CLANG)
ELSE()
SET(PCH_EXT "gch")
ENDIF(CLANG)
ENDIF()
# For GCC and Clang, PCH needs to be in the same directory as .h
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}")
ENDIF(MSVC)
ENDMACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT)
ENDIF()
ENDMACRO()
# Add common flags
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
@ -266,7 +330,7 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
IF(${oldProps} MATCHES NOTFOUND)
SET(oldProps "")
ENDIF(${oldProps} MATCHES NOTFOUND)
ENDIF()
IF(MSVC)
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
@ -279,17 +343,17 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS)
IF(NOT _STATIC_LIBRARY_FLAGS)
SET(_STATIC_LIBRARY_FLAGS)
ENDIF(NOT _STATIC_LIBRARY_FLAGS)
ENDIF()
SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}")
GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS)
IF(NOT _LINK_FLAGS)
SET(_LINK_FLAGS)
ENDIF(NOT _LINK_FLAGS)
ENDIF()
SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS})
ELSE(MSVC)
ELSE()
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
# on all remote machines set
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
@ -299,21 +363,21 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
# If no arch is specified, create common flags
IF(PCH_ARCHS_COUNT LESS 2)
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-include ${PCH_INPUT} ${PCH_ADDITIONAL_COMPILER_FLAGS}")
ENDIF(PCH_ARCHS_COUNT LESS 2)
ENDIF()
IF(APPLE)
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
ENDIF(APPLE)
ENDIF()
IF(WITH_PCH_DEBUG)
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}")
ENDIF(WITH_PCH_DEBUG)
ENDIF()
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch")
ENDIF(MSVC)
ENDIF()
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
ENDMACRO()
# Add specific flags for an arch
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
@ -324,19 +388,19 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
IF(${_FLAGS} MATCHES NOTFOUND)
SET(_FLAGS "")
ENDIF(${_FLAGS} MATCHES NOTFOUND)
ENDIF()
SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS})
ENDIF(PCH_ARCHS_COUNT GREATER 1)
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH)
ENDIF()
ENDMACRO()
MACRO(PCH_CREATE_TARGET _targetName _targetNamePCH)
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_OUTPUT} COMMAND ${PCH_COMMAND} COMMENT "Generating ${_targetNamePCH}" DEPENDS ${PCH_INPUT})
ADD_CUSTOM_TARGET(${_targetNamePCH} DEPENDS ${PCH_INPUT} ${PCH_OUTPUT})
ADD_DEPENDENCIES(${_targetName} ${_targetNamePCH})
ENDMACRO(PCH_CREATE_TARGET _targetName _inputh _inputcpp)
ENDMACRO()
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
SET(_PCH_current_target ${_targetName})
@ -346,7 +410,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
"This is the ADD_PRECOMPILED_HEADER macro. "
"You must set CMAKE_BUILD_TYPE!"
)
ENDIF(NOT CMAKE_BUILD_TYPE)
ENDIF()
PCH_SET_COMPILE_FLAGS(${_targetName})
@ -362,68 +426,67 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH})
ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH})
ENDFOREACH(_ARCH)
ELSE(PCH_ARCHS)
ENDFOREACH()
ELSE()
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "")
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}")
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch)
ENDIF(PCH_ARCHS)
ENDIF()
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName})
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}")
ENDMACRO(ADD_PRECOMPILED_HEADER)
ENDMACRO()
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
IF(NOT PCHSupport_FOUND)
IF(PCHSupport_FOUND)
# 0 => creating a new target for PCH, works for all makefiles
# 1 => setting PCH for VC++ project, works for VC++ projects
# 2 => setting PCH for XCode project, works for XCode projects
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(PCH_METHOD 1)
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
SET(PCH_METHOD 2)
ELSE()
SET(PCH_METHOD 0)
ENDIF()
IF(PCH_METHOD EQUAL 1)
# Auto include the precompile (useful for moc processing, since the use of
# precompiled is specified at the target level
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
IF(${oldProps} MATCHES NOTFOUND)
SET(oldProps "")
ENDIF()
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
#also inlude ${oldProps} to have the same compile options
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"")
ELSEIF(PCH_METHOD EQUAL 2)
# For Xcode, cmake needs my patch to process
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
# When buiding out of the tree, precompiled may not be located
# Use full path instead.
GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE)
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
ELSE()
#Fallback to the "old" precompiled suppport
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
ENDIF()
IF(TARGET ${_targetName}_static)
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
ENDIF()
ELSE()
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
RETURN()
ENDIF(NOT PCHSupport_FOUND)
# 0 => creating a new target for PCH, works for all makefiles
# 1 => setting PCH for VC++ project, works for VC++ projects
# 2 => setting PCH for XCode project, works for XCode projects
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(PCH_METHOD 1)
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
SET(PCH_METHOD 2)
ELSE(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(PCH_METHOD 0)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
IF(PCH_METHOD EQUAL 1)
# Auto include the precompile (useful for moc processing, since the use of
# precompiled is specified at the target level
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
IF(${oldProps} MATCHES NOTFOUND)
SET(oldProps "")
ENDIF(${oldProps} MATCHES NOTFOUND)
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
#also inlude ${oldProps} to have the same compile options
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"")
ELSEIF(PCH_METHOD EQUAL 2)
# For Xcode, cmake needs my patch to process
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
# When buiding out of the tree, precompiled may not be located
# Use full path instead.
GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE)
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
ELSE(PCH_METHOD EQUAL 1)
#Fallback to the "old" precompiled suppport
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
ENDIF(PCH_METHOD EQUAL 1)
IF(TARGET ${_targetName}_static)
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
ENDIF(TARGET ${_targetName}_static)
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
ENDIF()
ENDMACRO()

@ -40,48 +40,67 @@ include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (clang Clang)
CMAKE_FORCE_CXX_COMPILER (clang++ Clang)
IF(CMAKE_CXX_COMPILER)
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE CLANG_VERSION_RAW
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE "Apple LLVM version ([\\.0-9]+).*"
"\\1" CMAKE_CXX_COMPILER_VERSION "${CLANG_VERSION_RAW}")
SET(CMAKE_C_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
SET(CMAKE_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
ENDIF()
# Setup iOS platform
if (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
IF(NOT DEFINED IOS_PLATFORM)
SET(IOS_PLATFORM "OS")
ENDIF()
SET(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
# 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
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
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
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
else (${IOS_PLATFORM} STREQUAL "OS")
else()
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif (${IOS_PLATFORM} STREQUAL "OS")
endif()
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform")
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
# Note Xcode 4.3 changed the installation location, choose the most recent one available
SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms")
SET(XCODE_PRE_43_ROOT "/Developer/Platforms")
SET(XCODE_DEFAULT_ROOT "/Applications/Xcode.app/Contents")
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
IF(EXISTS ${XCODE_POST_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT})
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT})
ENDIF(EXISTS ${XCODE_POST_43_ROOT})
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
IF(NOT DEFINED CMAKE_XCODE_ROOT)
IF(EXISTS ${XCODE_DEFAULT_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_DEFAULT_ROOT} CACHE STRING "Xcode root")
ELSE()
MESSAGE(FATAL_ERROR "Xcode directory ${XCODE_DEFAULT_ROOT} doesn't exist")
ENDIF()
ENDIF()
SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${TMP})
SET(CMAKE_IOS_DEVELOPER_ROOT ${TMP})
MESSAGE(STATUS "Use iOS developer root: ${CMAKE_IOS_DEVELOPER_ROOT}")
ENDIF()
SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${TMP})
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${TMP})
MESSAGE(STATUS "Use iOS simulator developer root: ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}")
ENDIF()
ENDIF()
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform")
@ -93,36 +112,36 @@ MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
ENDFOREACH(_CMAKE_IOS_SDK)
ENDIF(_CMAKE_IOS_SDKS)
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS)
ENDFOREACH()
ENDIF()
ENDMACRO()
# Find and use the most recent iOS sdk
# 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)
ENDIF()
IF(IOS_VERSION)
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
ELSE(_INDEX EQUAL -1)
ELSE()
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(_INDEX EQUAL -1)
ELSE(IOS_VERSION)
ENDIF()
ELSE()
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(IOS_VERSION)
ENDIF()
MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}")
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk)
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk)
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
endif()
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK")
@ -134,31 +153,32 @@ SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS sup
SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
IF(CMAKE_GENERATOR MATCHES Xcode)
SET(ARCHS "$(ARCHS_STANDARD_32_BIT)")
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ELSE(CMAKE_GENERATOR MATCHES Xcode)
ENDIF()
ELSE()
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(ARCHS "armv7")
SET(ARCHS "armv7;arm64")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
# iPhone simulator targets i386
SET(ARCHS "i386")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(ARCHS "armv7;i386")
SET(ARCHS "armv7;arm64;i386;x86_64")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
ENDIF()
ENDIF()
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
IF(ARCHS)
SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
ENDIF()
# Set the find root to the iOS developer roots and to user defined paths
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root")
@ -174,10 +194,9 @@ set (CMAKE_SYSTEM_FRAMEWORK_PATH
)
# only search the iOS sdks, not the remainder of the host filesystem
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include)
#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib)
#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin)
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
include(CMakeFindBinUtils)

@ -20,60 +20,6 @@ MACRO(NL_GEN_PC name)
ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
ENDMACRO(NL_GEN_PC)
###
# Helper macro that generates revision.h from revision.h.in
###
MACRO(NL_GEN_REVISION_H)
IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in)
SET(TOOL_FOUND OFF)
IF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/")
FIND_PACKAGE(Subversion)
IF(SUBVERSION_FOUND)
SET(TOOL_FOUND ON)
ENDIF(SUBVERSION_FOUND)
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/")
IF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/")
FIND_PACKAGE(Mercurial)
IF(MERCURIAL_FOUND)
SET(TOOL_FOUND ON)
ENDIF(MERCURIAL_FOUND)
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/")
# if already generated
IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
# copy it
MESSAGE(STATUS "Copying provided revision.h...")
FILE(COPY ${CMAKE_SOURCE_DIR}/revision.h DESTINATION ${CMAKE_BINARY_DIR})
SET(HAVE_REVISION_H ON)
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
IF(TOOL_FOUND)
# a custom target that is always built
ADD_CUSTOM_TARGET(revision ALL
COMMAND ${CMAKE_COMMAND}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DROOT_DIR=${CMAKE_SOURCE_DIR}/..
-DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/CMakeModules
-P ${CMAKE_SOURCE_DIR}/CMakeModules/GetRevision.cmake)
# revision.h is a generated file
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/revision.h
PROPERTIES GENERATED TRUE
HEADER_FILE_ONLY TRUE)
SET(HAVE_REVISION_H ON)
ENDIF(TOOL_FOUND)
IF(HAVE_REVISION_H)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_DEFINITIONS(-DHAVE_REVISION_H)
ENDIF(HAVE_REVISION_H)
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in)
ENDMACRO(NL_GEN_REVISION_H)
###
#
###
@ -102,10 +48,10 @@ ENDMACRO(NL_TARGET_DRIVER)
# Argument:
###
MACRO(NL_DEFAULT_PROPS name label)
IF(HAVE_REVISION_H)
IF(TARGET revision)
# explicitly say that the target depends on revision.h
ADD_DEPENDENCIES(${name} revision)
ENDIF(HAVE_REVISION_H)
ENDIF()
# Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name.
# CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819
@ -243,13 +189,14 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
IF(WITH_QT)
OPTION(WITH_STUDIO "Build Core Studio" OFF )
ENDIF(WITH_QT)
###
# Features
###
OPTION(WITH_LOGGING "With Logging" ON )
OPTION(WITH_COVERAGE "With Code Coverage Support" OFF)
OPTION(WITH_PCH "With Precompiled Headers" ON )
OPTION(WITH_LOW_MEMORY "With low memory (use the least of RAM)" OFF)
OPTION(FINAL_VERSION "Build in Final Version mode" ON )
# Default to static building on Windows.
@ -280,13 +227,21 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
OPTION(WITH_EXTERNAL "With provided external." OFF)
ENDIF(WIN32)
OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF)
IF(UNIX AND NOT APPLE)
OPTION(WITH_UNIX_STRUCTURE "Use UNIX structure (bin, include, lib)" ON )
ELSE()
OPTION(WITH_UNIX_STRUCTURE "Use UNIX structure (bin, include, lib)" OFF)
ENDIF()
OPTION(WITH_INSTALL_LIBRARIES "Install development files." ON )
OPTION(WITH_ASSIMP "Use assimp exporter" OFF)
###
# GUI toolkits
###
OPTION(WITH_GTK "With GTK Support" OFF)
OPTION(WITH_QT "With QT Support" OFF)
OPTION(WITH_QT "With Qt 4 Support" OFF)
OPTION(WITH_QT5 "With Qt 5 Support" OFF)
IF(WIN32 AND MFC_FOUND)
OPTION(WITH_MFC "With MFC Support" ON )
@ -311,6 +266,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
OPTION(WITH_NELNS "Build NeL Network Services." OFF)
OPTION(WITH_RYZOM "Build Ryzom Core." ON )
OPTION(WITH_SNOWBALLS "Build Snowballs." OFF)
OPTION(WITH_TOOLS "Build Tools" OFF)
ENDMACRO(NL_SETUP_DEFAULT_OPTIONS)
MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
@ -350,10 +306,10 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
OPTION(WITH_LIBOVR "With LibOVR support" OFF)
OPTION(WITH_LIBVR "With LibVR support" OFF)
OPTION(WITH_PERFHUD "With NVIDIA PerfHUD support" OFF)
OPTION(WITH_SSE2 "With SSE2" ON )
OPTION(WITH_SSE3 "With SSE3" ON )
IF(NOT MSVC)
OPTION(WITH_GCC_FPMATH_BOTH "With GCC -mfpmath=both" OFF)
ENDIF(NOT MSVC)
@ -375,14 +331,16 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
OPTION(WITH_RYZOM_TOOLS "Build Ryzom Core Tools" ON )
OPTION(WITH_RYZOM_SERVER "Build Ryzom Core Services" ON )
OPTION(WITH_RYZOM_SOUND "Enable Ryzom Core Sound" ON )
OPTION(WITH_RYZOM_PATCH "Enable Ryzom in-game patch support" OFF)
###
# Optional support
###
OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON )
OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF)
OPTION(WITH_LUA53 "Build Ryzom Core using Lua 5.3" OFF)
OPTION(WITH_RYZOM_CLIENT_UAC "Ask to run as Administrator" OFF)
OPTION(WITH_RYZOM_PATCH "Enable Ryzom in-game patch support" OFF)
OPTION(WITH_RYZOM_CUSTOM_PATCH_SERVER "Only use patch server from CFG file" OFF)
ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
@ -426,7 +384,7 @@ MACRO(NL_SETUP_BUILD)
ELSEIF(HOST_CPU MATCHES "i.86")
SET(HOST_CPU "x86")
ENDIF(HOST_CPU MATCHES "(amd|AMD)64")
# Determine target CPU
# If not specified, use the same CPU as host
@ -577,7 +535,13 @@ MACRO(NL_SETUP_BUILD)
# Ignore default include paths
ADD_PLATFORM_FLAGS("/X")
IF(MSVC12)
IF(MSVC14)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2015, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC12)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2013, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
@ -609,7 +573,7 @@ MACRO(NL_SETUP_BUILD)
SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}")
ELSE(MSVC12)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF(MSVC12)
ENDIF(MSVC14)
ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250")
@ -861,7 +825,11 @@ MACRO(NL_SETUP_BUILD)
ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
ENDIF(APPLE)
ADD_PLATFORM_FLAGS("-D_REENTRANT -pipe -fno-strict-aliasing")
ADD_PLATFORM_FLAGS("-D_REENTRANT -fno-strict-aliasing")
IF(NOT WITH_LOW_MEMORY)
ADD_PLATFORM_FLAGS("-pipe")
ENDIF()
IF(WITH_COVERAGE)
ADD_PLATFORM_FLAGS("-fprofile-arcs -ftest-coverage")
@ -869,11 +837,6 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_WARNINGS)
ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused")
IF(CLANG)
ADD_PLATFORM_FLAGS("-std=gnu99")
ELSE(CLANG)
ADD_PLATFORM_FLAGS("-ansi")
ENDIF(CLANG)
ENDIF(WITH_WARNINGS)
IF(ANDROID)
@ -972,141 +935,140 @@ ENDMACRO(NL_SETUP_BUILD_FLAGS)
MACRO(NL_MAKE_ABSOLUTE_PREFIX NAME_RELATIVE NAME_ABSOLUTE)
IF(IS_ABSOLUTE "${${NAME_RELATIVE}}")
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
ELSE(IS_ABSOLUTE "${${NAME_RELATIVE}}")
IF(WIN32)
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
ELSE(WIN32)
ELSE()
IF(WITH_UNIX_STRUCTURE)
SET(${NAME_ABSOLUTE} ${CMAKE_INSTALL_PREFIX}/${${NAME_RELATIVE}})
ENDIF(WIN32)
ELSE()
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
ENDIF()
ENDIF(IS_ABSOLUTE "${${NAME_RELATIVE}}")
ENDMACRO(NL_MAKE_ABSOLUTE_PREFIX)
MACRO(NL_SETUP_PREFIX_PATHS)
## Allow override of install_prefix/etc path.
IF(NOT NL_ETC_PREFIX)
IF(WIN32)
SET(NL_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
SET(NL_ETC_PREFIX "etc/nel" CACHE PATH "Installation path for configurations")
ENDIF(WIN32)
ENDIF(NOT NL_ETC_PREFIX)
ELSE()
SET(NL_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_ETC_PREFIX NL_ETC_ABSOLUTE_PREFIX)
## Allow override of install_prefix/share path.
IF(NOT NL_SHARE_PREFIX)
IF(WIN32)
SET(NL_SHARE_PREFIX "." CACHE PATH "Installation path for data.")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
SET(NL_SHARE_PREFIX "share/nel" CACHE PATH "Installation path for data.")
ENDIF(WIN32)
ENDIF(NOT NL_SHARE_PREFIX)
ELSE()
SET(NL_SHARE_PREFIX "." CACHE PATH "Installation path for data.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_SHARE_PREFIX NL_SHARE_ABSOLUTE_PREFIX)
## Allow override of install_prefix/sbin path.
IF(NOT NL_SBIN_PREFIX)
IF(WIN32)
SET(NL_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
SET(NL_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.")
ENDIF(WIN32)
ENDIF(NOT NL_SBIN_PREFIX)
ELSE()
SET(NL_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_SBIN_PREFIX NL_SBIN_ABSOLUTE_PREFIX)
## Allow override of install_prefix/bin path.
IF(NOT NL_BIN_PREFIX)
IF(WIN32)
SET(NL_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
SET(NL_BIN_PREFIX "bin" CACHE PATH "Installation path for tools and applications.")
ENDIF(WIN32)
ENDIF(NOT NL_BIN_PREFIX)
ELSE()
SET(NL_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_BIN_PREFIX NL_BIN_ABSOLUTE_PREFIX)
## Allow override of install_prefix/lib path.
IF(NOT NL_LIB_PREFIX)
IF(LIBRARY_ARCHITECTURE)
SET(NL_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE(LIBRARY_ARCHITECTURE)
ELSE()
SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
ENDIF(LIBRARY_ARCHITECTURE)
ENDIF(NOT NL_LIB_PREFIX)
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX)
## Allow override of install_prefix/lib path.
IF(NOT NL_DRIVER_PREFIX)
IF(WIN32)
SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
IF(LIBRARY_ARCHITECTURE)
SET(NL_DRIVER_PREFIX "lib/${LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.")
ELSE(LIBRARY_ARCHITECTURE)
ELSE()
SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.")
ENDIF(LIBRARY_ARCHITECTURE)
ENDIF(WIN32)
ENDIF(NOT NL_DRIVER_PREFIX)
ENDIF()
ELSE()
SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(NL_DRIVER_PREFIX NL_DRIVER_ABSOLUTE_PREFIX)
ENDMACRO(NL_SETUP_PREFIX_PATHS)
MACRO(RYZOM_SETUP_PREFIX_PATHS)
## Allow override of install_prefix/etc path.
IF(NOT RYZOM_ETC_PREFIX)
IF(WIN32)
SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
SET(RYZOM_ETC_PREFIX "etc/ryzom" CACHE PATH "Installation path for configurations")
ENDIF(WIN32)
ELSE()
SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
ENDIF()
ENDIF(NOT RYZOM_ETC_PREFIX)
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_ETC_PREFIX RYZOM_ETC_ABSOLUTE_PREFIX)
## Allow override of install_prefix/share path.
IF(NOT RYZOM_SHARE_PREFIX)
IF(WIN32)
SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
SET(RYZOM_SHARE_PREFIX "share/ryzom" CACHE PATH "Installation path for data.")
ENDIF(WIN32)
ENDIF(NOT RYZOM_SHARE_PREFIX)
ELSE()
SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_SHARE_PREFIX RYZOM_SHARE_ABSOLUTE_PREFIX)
## Allow override of install_prefix/sbin path.
IF(NOT RYZOM_SBIN_PREFIX)
IF(WIN32)
SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
SET(RYZOM_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.")
ENDIF(WIN32)
ENDIF(NOT RYZOM_SBIN_PREFIX)
ELSE()
SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_SBIN_PREFIX RYZOM_SBIN_ABSOLUTE_PREFIX)
## Allow override of install_prefix/bin path.
IF(NOT RYZOM_BIN_PREFIX)
IF(WIN32)
SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
SET(RYZOM_BIN_PREFIX "bin" CACHE PATH "Installation path for tools.")
ENDIF(WIN32)
ENDIF(NOT RYZOM_BIN_PREFIX)
ELSE()
SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_BIN_PREFIX RYZOM_BIN_ABSOLUTE_PREFIX)
## Allow override of install_prefix/lib path.
IF(NOT RYZOM_LIB_PREFIX)
IF(LIBRARY_ARCHITECTURE)
SET(RYZOM_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE(LIBRARY_ARCHITECTURE)
ELSE()
SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
ENDIF(LIBRARY_ARCHITECTURE)
ENDIF()
ENDIF(NOT RYZOM_LIB_PREFIX)
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX)
## Allow override of install_prefix/games path.
IF(NOT RYZOM_GAMES_PREFIX)
IF(WIN32)
SET(RYZOM_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ELSE(WIN32)
IF(WITH_UNIX_STRUCTURE)
SET(RYZOM_GAMES_PREFIX "games" CACHE PATH "Installation path for client.")
ENDIF(WIN32)
ENDIF(NOT RYZOM_GAMES_PREFIX)
ELSE()
SET(RYZOM_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.")
ENDIF()
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_GAMES_PREFIX RYZOM_GAMES_ABSOLUTE_PREFIX)
ENDMACRO(RYZOM_SETUP_PREFIX_PATHS)
@ -1130,19 +1092,19 @@ MACRO(SETUP_EXTERNAL)
IF(APPLE)
IF(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
ELSE(WITH_STATIC_EXTERNAL)
ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a)
ENDIF(WITH_STATIC_EXTERNAL)
ENDIF()
ELSE(APPLE)
IF(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .so)
ELSE(WITH_STATIC_EXTERNAL)
ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .so .a)
ENDIF(WITH_STATIC_EXTERNAL)
ENDIF()
ENDIF(APPLE)
ENDIF(WIN32)
# Android and iOS have pthread
# Android and iOS have pthread
IF(ANDROID OR IOS)
SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
@ -1156,6 +1118,14 @@ MACRO(SETUP_EXTERNAL)
INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR})
ENDIF(WITH_STLPORT)
IF(WIN32)
# Must include DXSDK before WINSDK
FIND_PACKAGE(DirectXSDK REQUIRED)
# IF(DXSDK_INCLUDE_DIR)
# INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
# ENDIF()
ENDIF(WIN32)
IF(MSVC)
FIND_PACKAGE(MSVC REQUIRED)
FIND_PACKAGE(WindowsSDK REQUIRED)

@ -1,39 +1,6 @@
#ifndef CONFIG_H
#define CONFIG_H
#cmakedefine HAVE_DL_H 1
#cmakedefine HAVE_EXECINFO_H 1
#cmakedefine HAVE_ICONV 1
#cmakedefine HAVE_INTTYPES_H 1
#cmakedefine HAVE_LANGINFO_CODESET 1
#cmakedefine HAVE_LIMITS_H 1
#cmakedefine HAVE_MALLOC_H 1
#cmakedefine HAVE_PAM_MISC_H 1
#cmakedefine HAVE_PAM_PAM_APPL_H 1
#cmakedefine HAVE_PTHREAD 1
#cmakedefine HAVE_SECURITY_PAM_APPL_H 1
#cmakedefine HAVE_SECURITY_PAM_MISC_H 1
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_SYS_MOUNT_H 1
#cmakedefine HAVE_SYS_PARAM_H 1
#cmakedefine HAVE_SYS_STATVFS_H 1
#cmakedefine HAVE_SYS_TYPES_H 1
#cmakedefine HAVE_UNISTD_H 1
#cmakedefine HAVE_UTIME_H 1
#cmakedefine HAVE_WCHAR_H 1
#cmakedefine HAVE_BACKTRACE 1
#cmakedefine HAVE_INET_NTOA 1
#cmakedefine HAVE_INET_NTOP 1
#cmakedefine HAVE_INET_PTON 1
#cmakedefine HAVE_STRERROR 1
#cmakedefine HAVE_STRLCAT 1
#cmakedefine HAVE_STRPTIME 1
#cmakedefine HAVE_STRTOK_R 1
#cmakedefine HAVE_STRTOULL 1
#cmakedefine HAVE_STATVFS 1
#cmakedefine HAVE_STAT64 1
#cmakedefine NL_OPENGL_AVAILABLE ${NL_OPENGL_AVAILABLE}
#cmakedefine NL_OPENGLES_AVAILABLE ${NL_OPENGLES_AVAILABLE}
#cmakedefine NL_DIRECT3D_AVAILABLE ${NL_DIRECT3D_AVAILABLE}
@ -43,6 +10,8 @@
#cmakedefine NL_DSOUND_AVAILABLE ${NL_DSOUND_AVAILABLE}
#cmakedefine NL_XAUDIO2_AVAILABLE ${NL_XAUDIO2_AVAILABLE}
#cmakedefine NL_STEREO_AVAILABLE ${NL_STEREO_AVAILABLE}
#cmakedefine NL_BIN_PREFIX "${NL_BIN_ABSOLUTE_PREFIX}"
#cmakedefine NL_ETC_PREFIX "${NL_ETC_ABSOLUTE_PREFIX}"
#cmakedefine NL_SHARE_PREFIX "${NL_SHARE_ABSOLUTE_PREFIX}"
@ -53,4 +22,18 @@
#cmakedefine RYZOM_ETC_PREFIX "${RYZOM_ETC_ABSOLUTE_PREFIX}"
#cmakedefine RYZOM_SHARE_PREFIX "${RYZOM_SHARE_ABSOLUTE_PREFIX}"
#cmakedefine REVISION "${REVISION}"
#cmakedefine BUILD_DATE "${BUILD_DATE}"
#cmakedefine NL_VERSION "${NL_VERSION}"
#cmakedefine NL_VERSION_RC ${NL_VERSION_RC}
#cmakedefine RYZOM_VERSION "${RYZOM_VERSION}"
#cmakedefine RYZOM_VERSION_RC ${RYZOM_VERSION_RC}
#cmakedefine AUTHOR "${AUTHOR}"
#cmakedefine YEAR "${YEAR}"
#cmakedefine COPYRIGHT "${COPYRIGHT}"
#cmakedefine RYZOM_CLIENT_ICON "${RYZOM_CLIENT_ICON}"
#endif // CONFIG_H

@ -4,11 +4,7 @@ IF(WITH_STATIC_DRIVERS)
ADD_DEFINITIONS(-DNL_STATIC)
ENDIF(WITH_STATIC_DRIVERS)
# On Windows we need to find DirectInput for NLMISC.
# This is how we get events.
IF(WIN32)
FIND_PACKAGE(DirectXSDK REQUIRED)
# On Win32 we can also build the MAX plugins.
IF(WITH_NEL_MAXPLUGIN)
FIND_PACKAGE(3dsMaxSDK)
@ -68,18 +64,12 @@ IF(WITH_INSTALL_LIBRARIES)
ENDIF(UNIX)
ADD_SUBDIRECTORY(include)
ENDIF(WITH_INSTALL_LIBRARIES)
ENDIF()
ADD_SUBDIRECTORY(src)
IF(WITH_NEL_SAMPLES)
ADD_SUBDIRECTORY(samples)
ENDIF(WITH_NEL_SAMPLES)
# Allow to compile only max plugins without other tools.
IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)
IF(WITH_NEL_TOOLS)
FIND_PACKAGE(Squish)
ENDIF(WITH_NEL_TOOLS)
ADD_SUBDIRECTORY(tools)
ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)
ENDIF()
ADD_SUBDIRECTORY(tools)

@ -415,6 +415,16 @@ public:
*/
virtual void setAnisotropicFilter(sint filter) = 0;
/**
* Get current anisotropic filter value
*/
virtual uint getAnisotropicFilter() const = 0;
/**
* Get maximum anisotropic filter value
*/
virtual uint getAnisotropicFilterMaximum() const = 0;
/** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..)
* to be divided by Divisor (2, 4, 8...)
* Default is 1.
@ -855,6 +865,12 @@ public:
* get the official name of the driver
*/
virtual const char *getVideocardInformation () = 0;
/**
* Get total video memory.
* get the amount of video memory of current adapter, result is in KiB, -1 if unable to determine
*/
virtual sint getTotalVideoMemory () const = 0;
// @}
@ -1332,6 +1348,7 @@ public:
uint32 DeviceId;
uint32 SubSysId;
uint32 Revision;
sint32 VideoMemory; // video memory in KiB, -1 if unable to determine
};
// Get the number of hardware renderer available on the client platform.

@ -412,6 +412,7 @@ public:
virtual uint32 getImplementationVersion () const;
virtual const char* getDriverInformation ();
virtual const char* getVideocardInformation ();
virtual sint getTotalVideoMemory () const;
virtual uint getNbTextureStages();
virtual void getWindowSize (uint32 &width, uint32 &height);
virtual uint getWindowWidth ();
@ -474,6 +475,8 @@ public:
virtual TPolygonMode getPolygonMode ();
virtual void forceDXTCCompression(bool dxtcComp);
virtual void setAnisotropicFilter(sint filter);
virtual uint getAnisotropicFilter() const;
virtual uint getAnisotropicFilterMaximum() const;
virtual void forceTextureResize(uint divisor);
virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties);
// @}

@ -54,11 +54,13 @@ public:
/** generate and return a bitmap
* \param c the unicode char
* \param size size of the generated font in ??? format
* \param embolden set embolden style (bold)
* \param oblique set oblique style (slanted, italic)
* \param width width of the generated bitmap, this value is set by this function
* \param height height of the generated bitmap, this value is set by this function
* \param pitch pitch of the generated bitmap (+ or - the number of bytes per row), this value is set by this function
*/
uint8 *getBitmap (ucchar c, uint32 size, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex);
uint8 *getBitmap (ucchar c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex);
/** returns the width and height of a character using a specific size and
*

@ -102,6 +102,8 @@ public:
* \param fontGen font generator
* \param color primitive blocks color
* \param fontSize font size
* \param embolden font style bold
* \param oblique font style slanted (italic)
* \param desc display descriptor (screen size, font ratio)
* \param output computed string
* \param keep800x600Ratio true if you want that CFontManager look at Driver window size, and resize fontSize so it keeps same size...
@ -110,6 +112,8 @@ public:
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString& output,
bool keep800x600Ratio= true);
@ -121,6 +125,8 @@ public:
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString &output,
bool keep800x600Ratio= true);
@ -132,6 +138,8 @@ public:
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString &output,
bool keep800x600Ratio= true);

@ -429,7 +429,7 @@ private:
void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);}
// Force non resident memory
void restaureNonResidentMemory();
void restoreNonResidentMemory();
// Convert current index to a serializable vector
void buildSerialVector(std::vector<uint32> &dest) const;

@ -992,8 +992,8 @@ public:
* NB : the system should be restarted for this to work correctly
* The default is true
*/
void enableEmitThreshold(bool enabled = true) { _EmitThreshold = enabled; }
bool isEmitThresholdEnabled() const { return _EmitThreshold; }
void enableEmitThreshold(bool enabled = true) { _EmitThreshold = enabled; }
bool isEmitThresholdEnabled() const { return _EmitThreshold; }
// activate // deactivate all emitters in the system
void activateEmitters(bool active);

@ -74,6 +74,10 @@ public:
void setFontSize (uint32 fontSize) { _FontSize = fontSize; }
void setEmbolden (bool b) { _Embolden = b; }
void setOblique (bool b) { _Oblique = b; }
void setHotSpot (CComputedString::THotSpot hotSpot) { _HotSpot = hotSpot; }
void setScaleX (float scaleX) { _ScaleX = scaleX; }
@ -101,6 +105,10 @@ public:
uint32 getFontSize () const { return _FontSize; }
bool getEmbolden () const { return _Embolden; }
bool getOblique () const { return _Oblique; }
CComputedString::THotSpot getHotSpot() const { return _HotSpot; }
float getScaleX() const { return _ScaleX; }
@ -240,7 +248,7 @@ public:
nlassert(_FontGen);
// compute the string just one time
_FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio);
_FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, _TempString, _Keep800x600Ratio);
// draw shaded
if (_Shaded)
@ -279,7 +287,7 @@ public:
// compute the string just one time
char *str;
NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize);
_FontManager->computeString (str, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio);
_FontManager->computeString (str, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, _TempString, _Keep800x600Ratio);
// draw shaded
if (_Shaded)
@ -334,7 +342,7 @@ public:
*/
void computeString (const std::string& s, CComputedString& output)
{
_FontManager->computeString (s, _FontGen, _Color, _FontSize, _Driver, output, _Keep800x600Ratio);
_FontManager->computeString (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio);
}
/**
@ -345,12 +353,12 @@ public:
*/
void computeString (const ucstring& s, CComputedString& output)
{
_FontManager->computeString (s, _FontGen, _Color, _FontSize, _Driver, output, _Keep800x600Ratio);
_FontManager->computeString (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio);
}
void computeStringInfo (const ucstring& s, CComputedString& output)
{
_FontManager->computeStringInfo (s, _FontGen, _Color, _FontSize, _Driver, output, _Keep800x600Ratio);
_FontManager->computeStringInfo (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio);
}
/// Debug : write to the disk the texture cache
@ -381,6 +389,10 @@ private:
/// Font size;
uint32 _FontSize;
bool _Embolden;
bool _Oblique;
/// Current text color
NLMISC::CRGBA _Color;

@ -66,6 +66,10 @@ public:
void setColor(NLMISC::CRGBA color);
void setFontSize(uint32 fontSize);
uint32 getFontSize() const;
void setEmbolden(bool b);
bool getEmbolden() const;
void setOblique(bool b);
bool getOblique() const;
void setHotSpot(THotSpot hotSpot);
THotSpot getHotSpot() const;
void setScaleX(float scaleX);

@ -43,6 +43,8 @@ public:
ucchar Char;
CFontGenerator *FontGenerator;
sint Size;
bool Embolden;
bool Oblique;
// The less recently used infos
@ -66,6 +68,8 @@ public:
ucchar Char;
CFontGenerator *FontGenerator;
sint Size;
bool Embolden;
bool Oblique;
uint32 getVal();
//bool operator < (const SLetterKey&k) const;

@ -20,6 +20,7 @@
#include "nel/misc/debug.h"
#include "nel/misc/stream.h"
#include "nel/misc/rgba.h"
#include "nel/misc/path.h"
#include <vector>
#include <set>
#include <string>
@ -82,8 +83,8 @@ public:
// not free
_Flags&=~NL3D_CTILE_FREE_FLAG;
// set filename
_BitmapName[bitmapType]=name;
// set filename, replacing \\ by / if needed
_BitmapName[bitmapType] = NLMISC::CPath::standardizePath(name, false);
}
std::string getFileName (TBitmap bitmapType) const

@ -505,6 +505,12 @@ public:
*/
virtual const char* getVideocardInformation () = 0;
/**
* Get total video memory.
* get the amount of video memory of current adapter, result is in KiB, -1 if unable to determine
*/
virtual sint getTotalVideoMemory () const = 0;
/// Get the number of texture stage available, for multitexturing (Normal material shaders). Valid only after setDisplay().
virtual uint getNbTextureStages() = 0;
@ -646,6 +652,16 @@ public:
*/
virtual void setAnisotropicFilter(sint filter)=0;
/**
* Get current anisotropic filter value
*/
virtual uint getAnisotropicFilter() const = 0;
/**
* Get maximum anisotropic filter value
*/
virtual uint getAnisotropicFilterMaximum() const = 0;
/** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..)
* to be divided by Divisor (2, 4, 8...)
* Default is 1.

@ -137,6 +137,24 @@ public:
* \return the font size
*/
virtual uint32 getFontSize () const = 0;
/**
* set embolden (bold) state
* \param embolden the embbolden state
*/
virtual void setEmbolden (bool b) = 0;
/**
* \return the embolden state
*/
virtual bool getEmbolden () const = 0;
/**
* set oblique (italic) state
* \param oblique the oblique state
*/
virtual void setOblique (bool b) = 0;
/**
* \return the oblique state
*/
virtual bool getOblique () const = 0;
/**
* set the hot spot
* \param fonSize the font size

@ -653,7 +653,7 @@ private:
void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);}
// Force non resident memory
void restaureNonResidentMemory();
void restoreNonResidentMemory();
private:

@ -19,8 +19,12 @@
#include "nel/misc/types_nl.h"
// Include from libxml2
#include <libxml/parser.h>
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
typedef struct _xmlDoc xmlDoc;
typedef xmlDoc *xmlDocPtr;
namespace NLGEORGES
{

@ -225,7 +225,7 @@ public:
/// Returns the type of the atom. NULL otherwise.
virtual const class UType *getType () = 0;
virtual const class UType *getType () = 0;
/// Return true if the element is an atom
virtual bool isAtom () const = 0;

@ -17,13 +17,16 @@
#ifndef NL_ACTION_HANDLER_H
#define NL_ACTION_HANDLER_H
#include "nel/misc/types_nl.h"
#include <libxml/parser.h>
#include "nel/misc/types_nl.h"
#include "nel/misc/debug.h"
#include "nel/misc/xml_auto_ptr.h"
#include <map>
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
namespace NLGUI
{

@ -151,8 +151,12 @@ namespace NLGUI
// called when keyboard capture has been lost
virtual void onKeyboardCaptureLost() {}
// 'tooltip' property expects string to be ucstring or latin1 which is not possible from html page
int luaSetTooltipUtf8(CLuaState &ls);
REFLECT_EXPORT_START(CCtrlBase, CViewBase)
REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp);
REFLECT_LUA_METHOD("setTooltipUtf8", luaSetTooltipUtf8);
REFLECT_EXPORT_END
// special for mouse over : return true and fill the name of the cursor to display

@ -147,7 +147,7 @@ namespace NLGUI
sint32 _Aligned; // 0-Top 1-Bottom 2-Left 3-Right
sint32 _TrackDispPos;
sint32 _TrackPos;
float _TrackPos;
sint32 _TrackSize;
sint32 _TrackSizeMin;

@ -63,6 +63,8 @@ namespace NLGUI
uint getTextId(uint i) const;
uint getTextPos(uint nId) const;
const ucstring &getTexture(uint i) const;
void setGrayed(uint i, bool g);
const bool getGrayed(uint i) const;
void removeText(uint nPos);
uint getNumTexts() const {return (uint)_Texts.size();}
void sortText();
@ -132,6 +134,7 @@ namespace NLGUI
sint32 _NotLinkedToDBSelection;
std::vector<std::pair<uint, ucstring> > _Texts;
std::vector<ucstring> _Textures;
std::vector<bool> _Grayed;
// Action Handler called on combo click
std::string _AHOnSelectStart;

@ -82,13 +82,13 @@ namespace NLGUI
// Get the header color draw. NB: depends if grayed, and if active.
virtual NLMISC::CRGBA getDrawnHeaderColor () const{ return NLMISC::CRGBA(); };
uint8 getCurrentContainerAlpha() const{ return _CurrentContainerAlpha; }
uint8 getCurrentContentAlpha() const{ return _CurrentContentAlpha; }
uint8 getCurrentContainerAlpha() const { return _CurrentContainerAlpha; }
uint8 getCurrentContentAlpha() const { return _CurrentContentAlpha; }
virtual bool isGrayed() const{ return false; }
virtual bool getTouchFlag(bool clearFlag) const{ return false; }
virtual void backupPosition(){}
virtual void restorePosition(){}
virtual bool isGrayed() const { return false; }
virtual bool getTouchFlag(bool /* clearFlag */) const { return false; }
virtual void backupPosition() {}
virtual void restorePosition() {}
protected:
void triggerAlphaSettingsChangedAH();

@ -25,23 +25,21 @@
#include "nel/gui/group_tree.h"
#include "nel/gui/ctrl_button.h"
#include "nel/gui/group_table.h"
#include "nel/gui/libwww_types.h"
typedef std::map<std::string, std::string> TStyle;
extern "C"
{
#include "WWWInit.h"
}
namespace NLGUI
{
class CCtrlButton;
class CCtrlScroll;
class CGroupList;
class CGroupMenu;
class CDBGroupComboBox;
class CGroupParagraph;
extern std::string CurrentCookie;
extern std::string HTTPCurrentDomain;
// HTML group
/**
@ -55,15 +53,6 @@ namespace NLGUI
public:
DECLARE_UI_CLASS( CGroupHTML )
friend void TextAdd (struct _HText *me, const char * buf, int len);
friend void TextBeginElement (_HText *me, int element_number, const BOOL *present, const char ** value);
friend void TextEndElement (_HText *me, int element_number);
friend void TextLink (struct _HText *me, int element_number, int attribute_number, struct _HTChildAnchor *anchor, const BOOL *present, const char **value);
friend void TextBuild (HText * me, HTextStatus status);
friend void TextBeginUnparsedElement(HText *me, const char *buffer, int length);
friend void TextEndUnparsedElement(HText *me, const char *buffer, int length);
friend int requestTerminater (HTRequest * request, HTResponse * response, void * param, int status);
/// Web browser options for CGroupHTML
struct SWebOptions
{
@ -76,13 +65,42 @@ namespace NLGUI
std::string languageCode;
/// List of domains the widget can consider secure.
std::vector< std::string > trustedDomains;
/// Maximum concurrent MultiCurl connections per CGroupHTML instance
sint32 curlMaxConnections;
SWebOptions()
SWebOptions(): curlMaxConnections(2)
{
}
};
static SWebOptions options;
class CStyleParams
{
public:
CStyleParams () : TextColor(255,255,255,255)
{
FontSize=10;
FontWeight=400;
FontOblique=false;
Underlined=false;
StrikeThrough=false;
Width=-1;
Height=-1;
MaxWidth=-1;
MaxHeight=-1;
}
uint FontSize;
uint FontWeight;
bool FontOblique;
NLMISC::CRGBA TextColor;
bool Underlined;
bool StrikeThrough;
sint32 Width;
sint32 Height;
sint32 MaxWidth;
sint32 MaxHeight;
};
// Constructor
CGroupHTML(const TCtorParam &param);
@ -102,6 +120,9 @@ namespace NLGUI
// Browse
virtual void browse (const char *url);
// parse html string using libxml2 parser
virtual bool parseHtml(std::string htmlString);
// Refresh
void refresh();
@ -169,12 +190,44 @@ namespace NLGUI
std::string DefaultFormTextGroup;
std::string DefaultFormTextAreaGroup;
std::string DefaultFormSelectGroup;
std::string DefaultFormSelectBoxMenuGroup;
std::string DefaultCheckBoxBitmapNormal;
std::string DefaultCheckBoxBitmapPushed;
std::string DefaultCheckBoxBitmapOver;
std::string DefaultRadioButtonBitmapNormal;
std::string DefaultRadioButtonBitmapPushed;
std::string DefaultRadioButtonBitmapOver;
std::string DefaultBackgroundBitmapView;
std::string CurrentLinkTitle;
struct TFormField {
public:
TFormField(const std::string &k, const std::string &v)
:name(k),value(v)
{}
std::string name;
std::string value;
};
struct SFormFields {
public:
SFormFields()
{
}
void clear()
{
Values.clear();
}
void add(const std::string &key, const std::string &value)
{
Values.push_back(TFormField(key, value));
}
std::vector<TFormField> Values;
};
// Browser home
std::string Home;
@ -199,6 +252,7 @@ namespace NLGUI
int luaBeginElement(CLuaState &ls);
int luaEndElement(CLuaState &ls);
int luaShowDiv(CLuaState &ls);
int luaParseHtml(CLuaState &ls);
REFLECT_EXPORT_START(CGroupHTML, CGroupScrollText)
REFLECT_LUA_METHOD("browse", luaBrowse)
@ -210,6 +264,7 @@ namespace NLGUI
REFLECT_LUA_METHOD("beginElement", luaBeginElement)
REFLECT_LUA_METHOD("endElement", luaEndElement)
REFLECT_LUA_METHOD("showDiv", luaShowDiv)
REFLECT_LUA_METHOD("parseHtml", luaParseHtml)
REFLECT_STRING("url", getURL, setURL)
REFLECT_FLOAT("timeout", getTimeout, setTimeout)
REFLECT_EXPORT_END
@ -228,10 +283,10 @@ namespace NLGUI
virtual void addText (const char * buf, int len);
// A link has been parsed
virtual void addLink (uint element_number, uint attribute_number, HTChildAnchor *anchor, const BOOL *present, const char **value);
virtual void addLink (uint element_number, const std::vector<bool> &present, const std::vector<const char *> &value);
// A new begin HTML element has been parsed (<IMG> for exemple)
virtual void beginElement (uint element_number, const BOOL *present, const char **value);
virtual void beginElement (uint element_number, const std::vector<bool> &present, const std::vector<const char *> &value);
// A new end HTML element has been parsed (</IMG> for exemple)
virtual void endElement (uint element_number);
@ -246,10 +301,14 @@ namespace NLGUI
virtual void addHTTPGetParams (std::string &url, bool trustedDomain);
// Add POST params to the libwww list
virtual void addHTTPPostParams (HTAssocList *formfields, bool trustedDomain);
virtual void addHTTPPostParams (SFormFields &formfields, bool trustedDomain);
// the current request is terminated
virtual void requestTerminated(HTRequest *request);
virtual void requestTerminated();
// libxml2 html parser functions
void htmlElement(xmlNode *node, int element_number);
void htmlWalkDOM(xmlNode *a_node);
// Get Home URL
virtual std::string home();
@ -281,17 +340,19 @@ namespace NLGUI
void addString(const ucstring &str);
// Add an image in the current paragraph
void addImage(const char *image, bool globalColor, bool reloadImg=false);
void addImage(const char *image, bool globalColor, bool reloadImg=false, const CStyleParams &style = CStyleParams());
// Add a text area in the current paragraph
CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength);
// Add a combo box in the current paragraph
CDBGroupComboBox *addComboBox(const std::string &templateName, const char *name);
CGroupMenu *addSelectBox(const std::string &templateName, const char *name);
// Add a button in the current paragraph. actionHandler, actionHandlerParams and tooltip can be NULL.
CCtrlButton *addButton(CCtrlButton::EType type, const std::string &name, const std::string &normalBitmap, const std::string &pushedBitmap,
const std::string &overBitmap, bool useGlobalColor, const char *actionHandler, const char *actionHandlerParams, const char *tooltip);
const std::string &overBitmap, bool useGlobalColor, const char *actionHandler, const char *actionHandlerParams, const char *tooltip,
const CStyleParams &style = CStyleParams());
// Set the background color
void setBackgroundColor (const NLMISC::CRGBA &bgcolor);
@ -311,8 +372,20 @@ namespace NLGUI
// Delete page content and prepare next page
void removeContent ();
// Current URL
// Current URL for relative links in page
std::string _URL;
// Current URL
std::string _DocumentUrl;
// Valid base href was found
bool _IgnoreBaseUrlTag;
// Fragment from loading url
std::string _UrlFragment;
std::map<std::string,NLGUI::CInterfaceElement *> _Anchors;
std::vector<std::string> _AnchorName;
// Parser context
bool _ReadingHeadTag;
bool _IgnoreHeadTag;
// Current DOMAIN
bool _TrustedDomain;
@ -338,6 +411,11 @@ namespace NLGUI
bool _Connecting;
double _TimeoutValue; // the timeout in seconds
double _ConnectingTimeout;
sint _RedirectsRemaining;
// Automatic page refresh
double _LastRefreshTime;
double _NextRefreshTime;
std::string _RefreshUrl;
// minimal embeded lua script support
// Note : any embeded script is executed immediately after the closing
@ -347,15 +425,13 @@ namespace NLGUI
bool _IgnoreText;
// the script to execute
std::string _LuaScript;
bool _LuaHrefHack;
bool _Object;
std::string _ObjectScript;
// Someone is conecting. We got problem with libwww : 2 connection requests can deadlock the client.
static CGroupHTML *_ConnectingLock;
// LibWWW data
class CLibWWWData *_LibWWW;
// Data container for active curl transfer
class CCurlWWWData * _CurlWWW;
// Current paragraph
std::string _DivName;
@ -377,14 +453,33 @@ namespace NLGUI
return _PRE.back();
}
// UL mode
std::vector<bool> _UL;
inline bool getUL() const
{
if (_UL.empty())
return false;
return _UL.back();
}
// DL list
class HTMLDListElement {
public:
HTMLDListElement()
: DT(false), DD(false)
{ }
public:
bool DT;
bool DD;
};
std::vector<HTMLDListElement> _DL;
// OL and UL
class HTMLOListElement {
public:
HTMLOListElement(int start, std::string type)
: Value(start),Type(type), First(true)
{ }
std::string getListMarkerText() const;
public:
sint32 Value;
std::string Type;
bool First;
};
std::vector<HTMLOListElement> _UL;
// A mode
std::vector<bool> _A;
@ -424,6 +519,44 @@ namespace NLGUI
return TextFontSize;
return _FontSize.back();
}
inline uint getFontSizeSmaller() const
{
if (getFontSize() < 5)
return 3;
return getFontSize()-2;
}
std::vector<uint> _FontWeight;
inline uint getFontWeight() const
{
if (_FontWeight.empty())
return 400;
return _FontWeight.back();
}
std::vector<bool> _FontOblique;
inline bool getFontOblique() const
{
if (_FontOblique.empty())
return false;
return _FontOblique.back();
}
std::vector<bool> _FontUnderlined;
inline bool getFontUnderlined() const
{
if (_FontUnderlined.empty())
return false;
return _FontUnderlined.back();
}
std::vector<bool> _FontStrikeThrough;
inline bool getFontStrikeThrough() const
{
if (_FontStrikeThrough.empty())
return false;
return _FontStrikeThrough.back();
}
// Current link
std::vector<std::string> _Link;
@ -448,7 +581,15 @@ namespace NLGUI
return "";
return _LinkClass.back().c_str();
}
std::vector<bool> _BlockLevelElement;
inline bool isBlockLevelElement() const
{
if (_BlockLevelElement.empty())
return false;
return _BlockLevelElement.back();
}
// Divs (i.e. interface group)
std::vector<class CInterfaceGroup*> _Divs;
inline CInterfaceGroup *getDiv() const
@ -492,6 +633,10 @@ namespace NLGUI
TextArea = NULL;
Checkbox = NULL;
ComboBox = NULL;
SelectBox = NULL;
sbRBRef = NULL;
sbMultiple = false;
sbOptionDisabled = -1;
InitialSelection = 0;
}
@ -510,6 +655,19 @@ namespace NLGUI
// Combobox group
CDBGroupComboBox *ComboBox;
// Combobox with multiple selection or display size >= 2
CGroupMenu *SelectBox;
// Single or multiple selections for SelectBox
bool sbMultiple;
// Marks OPTION element as disabled
// Only valid when parsing html
sint sbOptionDisabled;
// First radio button in SelectBox if single selection
CCtrlBaseButton *sbRBRef;
// select values (for the <select> tag)
std::vector<std::string> SelectValues;
sint InitialSelection; // initial selection for the combo box
@ -593,6 +751,8 @@ namespace NLGUI
// search if the action / params match the url. look recurs into procedures
bool actionLaunchUrlRecurs(const std::string &ah, const std::string &params, const std::string &url);
void registerAnchor(CInterfaceElement* elm);
// Browse undo and redo
enum {MaxUrlUndoRedo= 256};
std::string _BrowseUndoButton;
@ -603,7 +763,8 @@ namespace NLGUI
std::deque<std::string> _BrowseUndo;
std::deque<std::string> _BrowseRedo;
void pushUrlUndoRedo(const std::string &url);
void doBrowse(const char *url);
void doBrowse(const char *url, bool force = false);
void doBrowseAnchor(const std::string &anchor);
void updateUndoRedoButtons();
void updateRefreshButton();
@ -613,28 +774,57 @@ namespace NLGUI
typedef std::map<uint32, NLMISC::CRefPtr<CGroupHTML> > TGroupHtmlByUIDMap;
static TGroupHtmlByUIDMap _GroupHtmlByUID;
private:
// read style attribute
void getStyleParams(const std::string &styleString, CStyleParams &style, bool inherit = true);
void applyCssMinMax(sint32 &width, sint32 &height, sint32 minw=0, sint32 minh=0, sint32 maxw=0, sint32 maxh=0);
// load and render local html file (from bnp for example)
void doBrowseLocalFile(const std::string &filename);
// load remote content using either GET or POST
void doBrowseRemoteUrl(const std::string &url, const std::string &referer, bool doPost = false, const SFormFields &formfields = SFormFields());
// render html string as new browser page
bool renderHtmlString(const std::string &html);
// initialize formfields list from form elements on page
void buildHTTPPostParams (SFormFields &formfields);
private:
// decode all HTML entities
static ucstring decodeHTMLEntities(const ucstring &str);
// ImageDownload system
enum TDataType {ImgType= 0, BnpType};
struct CDataImageDownload
{
public:
CDataImageDownload(CViewBase *img, CStyleParams style): Image(img), Style(style)
{
}
public:
CViewBase * Image;
CStyleParams Style;
};
struct CDataDownload
{
CDataDownload(CURL *c, const std::string &u, FILE *f, TDataType t, CViewBase *i, const std::string &s, const std::string &m) : curl(c), url(u), luaScript(s), md5sum(m), type(t), fp(f)
public:
CDataDownload(CURL *c, const std::string &u, const std::string &d, FILE *f, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams()) : curl(c), url(u), dest(d), luaScript(s), md5sum(m), type(t), fp(f)
{
if (t == ImgType) imgs.push_back(i);
if (t == ImgType) imgs.push_back(CDataImageDownload(i, style));
}
public:
CURL *curl;
std::string url;
std::string dest;
std::string luaScript;
std::string md5sum;
TDataType type;
FILE *fp;
std::vector<CViewBase *> imgs;
std::vector<CDataImageDownload> imgs;
};
std::vector<CDataDownload> Curls;
@ -643,11 +833,13 @@ namespace NLGUI
void initImageDownload();
void checkImageDownload();
void addImageDownload(const std::string &url, CViewBase *img);
void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams());
std::string localImageName(const std::string &url);
std::string getAbsoluteUrl(const std::string &url);
bool isTrustedDomain(const std::string &domain);
void setImage(CViewBase *view, const std::string &file);
void setImageSize(CViewBase *view, const CStyleParams &style = CStyleParams());
// BnpDownload system
void initBnpDownload();
@ -658,6 +850,13 @@ namespace NLGUI
void releaseDownloads();
void checkDownloads();
// HtmlType download finished
void htmlDownloadFinished(const std::string &content, const std::string &type, long code);
// cURL transfer callbacks
static size_t curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData);
static size_t curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData);
static size_t curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
};
// adapter group that store y offset for inputs inside an html form
@ -671,7 +870,6 @@ namespace NLGUI
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
};
}
#endif

@ -346,6 +346,7 @@ namespace NLGUI
// set the minW of the RootMenu.
void setMinW(sint32 minW);
void setMinH(sint32 minH);
// Gray a line on the RootMenu
void setGrayedLine(uint line, bool g);

@ -66,6 +66,8 @@ namespace NLGUI
// from CCtrlBase
virtual void elementCaptured(CCtrlBase *capturedElement);
// setup vertical scrolling event
void smoothScrollY (sint32 dy);
REFLECT_EXPORT_START(CGroupScrollText, CInterfaceGroup)
REFLECT_EXPORT_END
@ -78,6 +80,9 @@ namespace NLGUI
bool _Settuped;
bool _InvertScrollBar;
sint32 _ListHeight;
bool _Scrolling;
float _ScrollDistance;
bool _ClockMsgEventRegistered;
protected:
void setup();
void updateScrollBar();

@ -74,9 +74,9 @@ namespace NLGUI
class IDeletionWatcher
{
public:
IDeletionWatcher(){}
virtual ~IDeletionWatcher(){}
virtual void onDeleted( const std::string &name ){}
IDeletionWatcher() {}
virtual ~IDeletionWatcher() {}
virtual void onDeleted( const std::string &/* name */) {}
};
enum EStrech

@ -22,9 +22,12 @@
#include "nel/misc/debug.h"
#include "nel/misc/smart_ptr.h"
#include "nel/misc/rgba.h"
#include "libxml/globals.h"
#include "nel/misc/xml_auto_ptr.h"
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
namespace NL3D
{
class UAnimationSet;

@ -20,12 +20,10 @@
#ifndef CL_LIB_WWW_H
#define CL_LIB_WWW_H
extern "C"
{
#include "WWWInit.h"
}
#include <curl/curl.h>
#include "nel/misc/rgba.h"
#include "nel/gui/libwww_types.h"
namespace NLGUI
{
@ -35,14 +33,12 @@ namespace NLGUI
// ***************************************************************************
// Legacy function from libwww
SGML_dtd * HTML_dtd (void);
// Init the libwww
void initLibWWW();
// Get an url and setup a local domain
const std::string &setCurrentDomain(const std::string &url);
extern std::string CurrentCookie;
// ***************************************************************************
// Some DTD table
@ -218,49 +214,58 @@ namespace NLGUI
HTML_ATTR(DIV,STYLE),
};
enum
{
HTML_ATTR(SPAN,CLASS) = 0,
HTML_ATTR(SPAN,ID),
HTML_ATTR(SPAN,STYLE),
};
#undef HTML_ATTR
enum
{
HTML_ATTR(H1,CLASS) = 0,
HTML_ATTR(H1,ID),
HTML_ATTR(H1,STYLE),
};
// ***************************************************************************
enum
{
HTML_ATTR(H2,CLASS) = 0,
HTML_ATTR(H2,ID),
HTML_ATTR(H2,STYLE),
};
enum
{
HTML_ATTR(H3,CLASS) = 0,
HTML_ATTR(H3,ID),
HTML_ATTR(H3,STYLE),
};
enum
{
HTML_ATTR(H4,CLASS) = 0,
HTML_ATTR(H4,ID),
HTML_ATTR(H4,STYLE),
};
enum
{
HTML_ATTR(H5,CLASS) = 0,
HTML_ATTR(H5,ID),
HTML_ATTR(H5,STYLE),
};
// A smart ptr for LibWWW strings
class C3WSmartPtr
enum
{
public:
C3WSmartPtr ()
{
_Ptr = NULL;
}
C3WSmartPtr (const char *ptr)
{
_Ptr = ptr;
}
~C3WSmartPtr ()
{
clear();
}
void operator=(const char *str)
{
clear ();
_Ptr = str;
}
operator const char *() const
{
return _Ptr;
}
void clear()
{
if (_Ptr)
{
void *ptr = (void*)_Ptr;
HT_FREE(ptr);
}
_Ptr = NULL;
}
private:
const char *_Ptr;
HTML_ATTR(H6,CLASS) = 0,
HTML_ATTR(H6,ID),
HTML_ATTR(H6,STYLE),
};
#undef HTML_ATTR
// ***************************************************************************
// Read a width HTML parameter. "100" or "100%". Returns true if percent (0 ~ 1) else false
@ -273,15 +278,10 @@ namespace NLGUI
// ***************************************************************************
void _VerifyLibWWW(const char *function, bool ok, const char *file, int line);
#define VerifyLibWWW(a,b) _VerifyLibWWW(a,(b)!=FALSE,__FILE__,__LINE__)
const std::string &setCurrentDomain(const std::string &uri);
void receiveCookies (CURL *curl, const std::string &domain, bool trusted);
void sendCookies(CURL *curl, const std::string &domain, bool trusted);
// ***************************************************************************
// Standard request terminator
int requestTerminater (HTRequest * request, HTResponse * response, void * param, int status) ;
// ***************************************************************************
}
#endif

File diff suppressed because it is too large Load Diff

@ -239,6 +239,7 @@ namespace NLGUI
bool isNil(int index = -1);
bool isBoolean(int index = -1);
bool isNumber(int index = -1);
bool isInteger(int index = -1);
bool isString(int index = -1);
bool isTable(int index = -1);
bool isFunction(int index = -1);
@ -248,6 +249,7 @@ namespace NLGUI
// converting then getting a value from the stack
bool toBoolean(int index = -1);
lua_Number toNumber(int index = -1);
lua_Integer toInteger(int index = -1);
const char *toString(int index = -1);
void toString(int index, std::string &str); // convert to a std::string, with a NULL check.
size_t strlen(int index = -1);
@ -259,11 +261,21 @@ namespace NLGUI
* If conversion fails then an exception is thrown (with optional msg)
*/
bool getTableBooleanValue(const char *name, bool defaultValue= false);
double getTableNumberValue(const char *name, double defaultValue= 0);
double getTableNumberValue(const char *name, double defaultValue= 0.0);
sint64 getTableIntegerValue(const char *name, sint64 defaultValue= 0);
const char *getTableStringValue(const char *name, const char *defaultValue= NULL);
// pushing value onto the stack
void push(bool value);
void push(lua_Number value);
void push(float value);
void push(double value);
void push(uint8 value);
void push(uint16 value);
void push(uint32 value);
void push(uint64 value);
void push(sint8 value);
void push(sint16 value);
void push(sint32 value);
void push(sint64 value);
void push(const char *str);
void push(const char *str, int length);
void push(const std::string &str);

@ -172,6 +172,18 @@ inline bool CLuaState::isNumber(int index)
return lua_isnumber(_State, index) != 0;
}
//================================================================================
inline bool CLuaState::isInteger(int index)
{
//H_AUTO(Lua_CLuaState_isInteger)
checkIndex(index);
#if LUA_VERSION_NUM >= 503
return lua_isinteger(_State, index) != 0;
#else
return lua_isnumber(_State, index) != 0;
#endif
}
//================================================================================
inline bool CLuaState::isString(int index)
{
@ -236,6 +248,27 @@ inline lua_Number CLuaState::toNumber(int index)
return lua_tonumber(_State, index);
}
//================================================================================
inline lua_Integer CLuaState::toInteger(int index)
{
//H_AUTO(Lua_CLuaState_toInteger)
checkIndex(index);
#if LUA_VERSION_NUM >= 503
sint isnum = 0;
// lua_tointeger fails with decimal numbers under Lua 5.3
lua_Integer res = lua_tointegerx(_State, index, &isnum);
if (!isnum)
{
lua_Number d = lua_tonumber(_State, index);
nlwarning("Lua: Unable to convert Lua number %lf to integer", d);
res = (lua_Integer)d;
}
return res;
#else
return lua_tointeger(_State, index);
#endif
}
//================================================================================
inline const char *CLuaState::toString(int index)
{
@ -302,11 +335,83 @@ inline void CLuaState::push(bool value)
}
//================================================================================
inline void CLuaState::push(lua_Number value)
inline void CLuaState::push(float value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushnumber(_State, (lua_Number)value);
}
//================================================================================
inline void CLuaState::push(double value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushnumber(_State, (lua_Number)value);
}
//================================================================================
inline void CLuaState::push(uint8 value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushinteger(_State, (lua_Integer)value);
}
//================================================================================
inline void CLuaState::push(uint16 value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushinteger(_State, (lua_Integer)value);
}
//================================================================================
inline void CLuaState::push(uint32 value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushinteger(_State, (lua_Integer)value);
}
//================================================================================
inline void CLuaState::push(uint64 value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushinteger(_State, (lua_Integer)value);
}
//================================================================================
inline void CLuaState::push(sint8 value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushinteger(_State, (lua_Integer)value);
}
//================================================================================
inline void CLuaState::push(sint16 value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushinteger(_State, (lua_Integer)value);
}
//================================================================================
inline void CLuaState::push(sint32 value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushinteger(_State, (lua_Integer)value);
}
//================================================================================
inline void CLuaState::push(sint64 value)
{
//H_AUTO(Lua_CLuaState_push)
nlverify( lua_checkstack(_State, 1) );
lua_pushnumber(_State, value);
lua_pushinteger(_State, (lua_Integer)value);
}
//================================================================================

@ -31,8 +31,8 @@ namespace NLGUI
class CLuaManager
{
public:
~CLuaManager();
/// Get or create singleton
static CLuaManager& getInstance()
{
if( instance == NULL )
@ -42,6 +42,9 @@ namespace NLGUI
return *instance;
}
/// Release singleton
static void releaseInstance();
/// Enables attaching the Lua debugger in the CLuaState instance, only matters on startup.
static void enableLuaDebugging(){ debugLua = true; }
@ -65,6 +68,7 @@ namespace NLGUI
private:
CLuaManager();
~CLuaManager();
static CLuaManager *instance;
static bool debugLua;

@ -80,6 +80,7 @@ namespace NLGUI
const char *getTypename() const;
bool isNil() const;
bool isNumber() const;
bool isInteger() const;
bool isBoolean() const;
bool isString() const;
bool isFunction() const;
@ -94,6 +95,7 @@ namespace NLGUI
NLMISC::CRGBA toRGBA() const; // default to black if not a crgba
bool toBoolean() const;
lua_Number toNumber() const;
lua_Integer toInteger() const;
std::string toString() const;
lua_CFunction toCFunction() const;
void *toUserData() const;
@ -102,6 +104,8 @@ namespace NLGUI
operator bool() const;
operator float() const;
operator double() const;
operator sint32() const;
operator sint64() const;
operator std::string() const;
/** create a sub table for this object, with a string as a key
* This object must be a table or an exception if thrown
@ -121,6 +125,9 @@ namespace NLGUI
void setValue(const char *key, bool value) throw(ELuaNotATable);
void setValue(const char *key, TLuaWrappedFunction value) throw(ELuaNotATable);
void setValue(const char *key, double value) throw(ELuaNotATable);
void setValue(const char *key, uint32 value) throw(ELuaNotATable);
void setValue(const char *key, sint32 value) throw(ELuaNotATable);
void setValue(const char *key, sint64 value) throw(ELuaNotATable);
void setValue(const std::string &key, const std::string &value) throw(ELuaNotATable) { setValue(key.c_str(), value); }
void setNil(const char *key) throw(ELuaNotATable);
void setNil(const std::string &key) throw(ELuaNotATable) { setNil(key.c_str()); }

@ -0,0 +1,63 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CL_URL_PARSER_H
#define CL_URL_PARSER_H
#include <string>
namespace NLGUI
{
/**
* Simple URL parser
* \author Meelis Mägi
* \date 2015
*/
class CUrlParser
{
public:
CUrlParser(){}
// parse uri to components
CUrlParser(const std::string &url);
// parse uri to components
void parse(std::string uri);
// serialize URL back to string
std::string toString() const;
// inherit scheme, domain, path from given url
void inherit(const std::string &url);
// if current parts can compose absolute url or not
bool isAbsolute() const;
// resolve relative path like './a/../b' to absolute path '/a/b'
static void resolveRelativePath(std::string &path);
public:
std::string scheme;
std::string domain;
std::string path;
std::string query;
std::string hash;
};
}// namespace
#endif // CL_URL_PARSER_H

@ -169,7 +169,7 @@ namespace NLGUI
/*
* getScreenSize : get the screen window size changed (at last checkNewScreenSize called)
*/
void getScreenSize (uint32 &w, uint32 &h);
void getScreenSize(uint32 &w, uint32 &h);
/*
* get OOW / OOH

@ -81,6 +81,8 @@ namespace NLGUI
void setText (const ucstring &text);
void setFontSize (sint nFontSize);
void setEmbolden (bool nEmbolden);
void setOblique (bool nOblique);
void setColor (const NLMISC::CRGBA &color);
void setShadow (bool bShadow);
void setShadowOutline (bool bShadowOutline);
@ -101,6 +103,8 @@ namespace NLGUI
ucstring getText() const { return _Text; }
sint getFontSize() const;
bool getEmbolden() { return _Embolden; }
bool getOblique() { return _Oblique; }
NLMISC::CRGBA getColor() { return _Color; }
bool getShadow() { return _Shadow; }
bool getShadowOutline() { return _ShadowOutline; }
@ -125,6 +129,8 @@ namespace NLGUI
uint getLastLineW () const;
void setUnderlined (bool underlined) { _Underlined = underlined; }
bool getUnderlined () const { return _Underlined; }
void setStrikeThrough (bool linethrough) { _StrikeThrough = linethrough; }
bool getStrikeThrough () const { return _StrikeThrough; }
// true if the viewText is a single line clamped.
bool isSingleLineTextClamped() const {return _SingleLineTextClamped;}
@ -220,6 +226,8 @@ namespace NLGUI
NL3D::UTextContext::CStringInfo _Info;
/// the font size
sint _FontSize;
bool _Embolden;
bool _Oblique;
// width of the font in pixel. Just a Hint for tabing format (computed with '_')
uint _FontWidth;
// height of the font in pixel.
@ -374,6 +382,7 @@ namespace NLGUI
bool _TextSelection : 1;
bool _InvalidTextContext : 1;
bool _Underlined : 1;
bool _StrikeThrough : 1;
bool _ContinuousUpdate : 1;
bool _Setuped : 1;

@ -335,7 +335,7 @@ namespace NLGUI
sint32 newW, sint32 newH) const;
// move windows according to new screen size
void moveAllWindowsToNewScreenSize(sint32 newScreenW, sint32 newScreenH, bool fixCurrentUI );
void moveAllWindowsToNewScreenSize(uint32 newScreenW, uint32 newScreenH, bool fixCurrentUI );
void updateAllLocalisedElements();
@ -481,7 +481,7 @@ namespace NLGUI
void setIngame( bool i ){ inGame = i; }
bool isIngame() const{ return inGame; }
void setScreenWH( uint32 w, uint32 h ){ screenW = w; screenH = h; }
void setScreenWH(uint32 w, uint32 h){ _ScreenW = w; _ScreenH = h; }
void registerNewScreenSizeHandler( INewScreenSizeHandler *handler );
void removeNewScreenSizeHandler( INewScreenSizeHandler *handler );
@ -569,7 +569,7 @@ namespace NLGUI
std::vector< CInterfaceGroup* > _GroupsUnderPointer;
// view that should be notified from clock msg
std::vector<CCtrlBase*> _ClockMsgTargets;
std::list<CCtrlBase*> _ClockMsgTargets;
NLMISC::CRGBA _GlobalColor;
NLMISC::CRGBA _GlobalColorForContent;
@ -612,8 +612,8 @@ namespace NLGUI
CEventDescriptorKey lastKeyEvent;
uint32 screenH;
uint32 screenW;
uint32 _ScreenH;
uint32 _ScreenW;
std::vector< CInterfaceAnim* > activeAnims;

@ -20,8 +20,13 @@
#include "nel/misc/vector.h"
#include "nel/misc/rgba.h"
// Include from libxml2
#include <libxml/parser.h>
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
typedef struct _xmlDoc xmlDoc;
typedef xmlDoc *xmlDocPtr;
#include <vector>

@ -22,8 +22,9 @@
#include <map>
#include <set>
// Include from libxml2
#include <libxml/parser.h>
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
namespace NLLIGO
{

@ -21,8 +21,9 @@
#include "nel/misc/rgba.h"
#include <vector>
// Include from libxml2
#include <libxml/parser.h>
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
namespace NLLIGO
{

@ -20,7 +20,7 @@
#include "types_nl.h"
#include "tds.h"
#include "singleton.h"
#include "callback.h"
namespace NLMISC {
@ -86,6 +86,66 @@ public:
// Used for CPath only for the moment !
char *getFileNamePtr(const std::string &sFileName, const std::string &sBigFileName);
typedef CCallback<bool /* continue */, const std::string &/* filename */, uint32 /* currentSize */, uint32 /* totalSize */> TUnpackProgressCallback;
// Unpack all files in sBigFileName to sDestDir and send progress notifications to optional callback
static bool unpack(const std::string &sBigFileName, const std::string &sDestDir, TUnpackProgressCallback *callback = NULL);
// A BNPFile header (filename is a char* pointing on FileNames and is always lowercase)
struct BNPFile
{
BNPFile() : Name(NULL), Size(0), Pos(0) { }
char* Name;
uint32 Size;
uint32 Pos;
};
// A SBNPFile header (filename is a std::string and keeps the original case)
struct SBNPFile
{
SBNPFile() : Size(0), Pos(0) { }
std::string Name;
uint32 Size;
uint32 Pos;
};
// A BNP structure
struct BNP
{
BNP() : FileNames(NULL), ThreadFileId(0), CacheFileOnOpen(false), AlwaysOpened(false), InternalUse(false), OffsetFromBeginning(0) { }
// FileName of the BNP. important to open it in getFile() (for other threads or if not always opened).
std::string BigFileName;
// map of files in the BNP.
char *FileNames;
std::vector<BNPFile> Files;
std::vector<SBNPFile> SFiles;
// Since many seek may be done on a FILE*, each thread should have its own FILE opened.
uint32 ThreadFileId;
bool CacheFileOnOpen;
bool AlwaysOpened;
bool InternalUse;
// Offset written in BNP header
uint32 OffsetFromBeginning;
// Read BNP header from FILE* and init member variables
bool readHeader(FILE* file);
// Read BNP header from BigFileName and init member variables
bool readHeader();
// Append BNP header to the big file BigFileName (to use after appendFile calls)
bool appendHeader();
// Append a file to BigFileName
bool appendFile(const std::string &filename);
// Unpack BigFileName to sDestDir and send progress notifications to optional callback
bool unpack(const std::string &sDestDir, TUnpackProgressCallback *callback = NULL);
};
// ***************
private:
class CThreadFileArray;
@ -118,38 +178,6 @@ private:
uint32 _CurrentId;
};
// A BNPFile header
struct BNPFile
{
BNPFile() : Name(NULL), Size(0), Pos(0) { }
char *Name;
uint32 Size;
uint32 Pos;
};
struct CBNPFileComp
{
bool operator()(const BNPFile &f, const BNPFile &s )
{
return strcmp( f.Name, s.Name ) < 0;
}
};
// A BNP structure
struct BNP
{
BNP() : FileNames(NULL) { }
// FileName of the BNP. important to open it in getFile() (for other threads or if not always opened).
std::string BigFileName;
// map of files in the BNP.
char *FileNames;
std::vector<BNPFile> Files;
// Since many seek may be done on a FILE*, each thread should have its own FILE opened.
uint32 ThreadFileId;
bool CacheFileOnOpen;
bool AlwaysOpened;
};
private:
// CBigFile(); // Singleton mode -> access it with the getInstance function

@ -44,6 +44,7 @@ const uint32 DDS_HEADER = NL_MAKEFOURCC('D', 'D', 'S', ' ');
const uint32 DXT_HEADER = NL_MAKEFOURCC('D', 'X', 'T', '\0');
const uint32 PNG_HEADER = NL_MAKEFOURCC(0x89, 'P', 'N', 'G');
const uint32 JPG_HEADER = NL_MAKEFOURCC(0xff, 0xd8, 0xff, 0xe0);
const uint32 GIF_HEADER = NL_MAKEFOURCC('G', 'I', 'F', '8');
// dwLinearSize is valid
@ -132,6 +133,15 @@ private :
uint8 readJPG( NLMISC::IStream &f );
/**
* Read a GIF from an IStream.
* GIF pictures are all converted to 32bit
* \param f IStream (must be a reading stream)
* \return image depth if succeed, 0 else
*/
uint8 readGIF( NLMISC::IStream &f );
/**
* Change bitmap format
*
@ -226,6 +236,34 @@ private :
sint32 nDestWidth, sint32 nDestHeight);
/**
* The grayscale resample function
* \param pSrc grayscale 8-bits array
* \param pDest grayscale 8-bits array for storing resampled texture
* \param nSrcWidth original width
* \param nSrcHeight original height
* \param nDestWidth width after resample
* \param nDestHeight height after resample
*/
void resamplePicture8 (const uint8 *pSrc, uint8 *pDest,
sint32 nSrcWidth, sint32 nSrcHeight,
sint32 nDestWidth, sint32 nDestHeight);
/**
* The FAST resample function : works only when reducing the size by two
* and when the image is square
* \param pSrc grayscale 8-bits array
* \param pDest grayscale 8-bits array for storing resampled texture
* \param nSrcWidth original width
* \param nSrcHeight original height
* \param nDestWidth width after resample
* \param nDestHeight height after resample
*/
void resamplePicture8Fast (const uint8 *pSrc, uint8 *pDest,
sint32 nSrcWidth, sint32 nSrcHeight,
sint32 nDestWidth, sint32 nDestHeight);
/**
* Quadratic interpolator
* \return the interpolation in (x,y) of the values (xy**)
@ -282,16 +320,8 @@ public:
// don't forget to update operator=() and swap() if adding a data member
CBitmap()
{
_MipMapCount = 1;
_Width = 0;
_Height = 0;
PixelFormat = RGBA;
_LoadGrayscaleAsAlpha = true;
}
virtual ~CBitmap() { }
CBitmap();
virtual ~CBitmap();
// swap 2 bitmaps contents
void swap(CBitmap &other);
@ -338,6 +368,27 @@ public:
*/
void makeNonPowerOf2Dummy();
/**
* Make a bitmap fully opaque (set alpha to 255).
*/
void makeOpaque();
/**
* Return if the bitmap has uniform alpha values for all pixels.
* \param alpha return the uniform value if return is true
* \return uniform or not
*/
bool isAlphaUniform(uint8 *alpha = NULL) const;
/**
* Return if the bitmap is a real grayscale.
* \return grayscale or not
*/
bool isGrayscale() const;
/**
* Return the pixels buffer of the image, or of one of its mipmap.
* Return a reference of an array in pixel format get with getPixelFormat().

@ -25,7 +25,9 @@
#include "string_mapper.h"
#include "sstring.h"
#include <libxml/parser.h>
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
namespace NLMISC
{

@ -61,7 +61,7 @@ public:
class CClassIdHashMapTraits
{
public:
enum { bucket_size = 4, min_buckets = 8, };
enum { bucket_size = 4, min_buckets = 8 };
inline size_t operator() ( const CClassId& classId ) const
{
return ((((uint64)classId >> 32)|0xFFFFFFFF) ^ (((uint64)classId|0xFFFFFFFF) & 0xFFFFFFFF));

@ -31,36 +31,111 @@ namespace NLMISC
class CCmdArgs
{
public:
/// Sets the command line and init _Args variable. You must call this before calling main()
void setArgs (int argc, const char **argv);
CCmdArgs();
/// Sets the command line and init _Args variable. You must call this before calling main()
void setArgs (const char *args);
struct TArg
{
std::string shortName; // short argument. Eg: o for -o
std::string longName; // long argument. Eg: output for --output
std::string helpName; // name of argument in help. Eg: <output directory>
std::string helpDescription; // description of argument in help. Eg: Specifies the directory where to write generated files
bool onlyOnce; // only one argument of this type is used, if several are provided, only the last one is kept
bool required; // at least one argument of this type must be provided
bool found; // all values for this argument
std::vector<std::string> values; // all values for this argument
};
typedef std::vector<TArg> TArgs;
/// Add a TArg structure to arguments list.
void addArg(const TArg &arg);
/// Add an full argument to arguments list.
/// shortName is "p" of the argument is -p
/// longName is "print" of the argument is --print
/// helpName is the name that will be displayed in help if it's a required argument
/// helpDescription is the description of the argument that will be displayed in help
/// onlyOnce can be set to false, if we allows to use this argument more than once
void addArg(const std::string &shortName, const std::string &longName, const std::string &helpName, const std::string &helpDescription, bool onlyOnce = true);
/// Add a additional argument to arguments list.
/// helpName is the name that will be displayed in help if it's a required argument
/// helpDescription is the description of the argument that will be displayed in help
/// onlyOnce can be set to false, if we allows to use this argument more than once
/// required can be set to false, if this argument is required
void addAdditionalArg(const std::string &name, const std::string &helpDescription, bool onlyOnce = true, bool required = true);
/// Parse the command line from main() parameters argc and argv and process default arguments.
bool parse(int argc, char **argv);
/// Parse the command line from a std::string and process default arguments.
bool parse(const std::string &args);
/// Parse the command linefrom a std::vector<std::string> and process default arguments.
bool parse(const std::vector<std::string> &args);
/// Returns arguments of the program pass from the user to the program using parameters (ie: "myprog param1 param2")
const NLMISC::CVectorSString &getArgs () const { return _Args; }
const TArgs& getArgs() const { return _Args; }
/// Returns true if the argument if present in the command line (ie: haveArg('p') will return true if -p is in the command line)
bool haveArg (char argName) const;
/// Returns true if the argument if present in the command line (ie: haveArg("p") will return true if -p is in the command line)
bool haveArg(const std::string &argName) const;
/** Returns the parameter linked to an option
* getArg('p') will return toto if -ptoto is in the command line
* getArg('p') will return C:\Documents and Settings\toto.tmp if -p"C:\Documents and Settings\toto.tmp" is in the command line
* It'll thrown an Exception if the argName is not found
/** Returns the parameters linked to an option
* getArg("p") will return toto if -ptoto is in the command line
* getArg("p") will return C:\Documents and Settings\toto.tmp if -p"C:\Documents and Settings\toto.tmp" is in the command line
*/
std::string getArg (char argName) const;
std::vector<std::string> getArg(const std::string &argName) const;
/// return true if named long arg is present on the commandline
/// eg haveLongArg("toto") returns true if "--toto" or "--toto=xxx" can be found on commandline
bool haveLongArg (const char* argName) const;
bool haveLongArg(const std::string &argName) const;
/// returns the value associated with the given named argument
/// returns values associated with the given named argument
/// both "--toto=xxx" and "--toto xxx" are acceptable
/// quotes round arguments are stripped
std::string getLongArg (const char* argName) const;
std::vector<std::string> getLongArg(const std::string &argName) const;
/// return true if there are arguments that are required
bool needAdditionalArg() const;
/// return true if any additional args are present on the commandline
bool haveAdditionalArg() const;
/// return true if a specific additional arg is present on the commandline
bool haveAdditionalArg(const std::string &name) const;
/// Returns values of a specific additional arg
std::vector<std::string> getAdditionalArg(const std::string &name) const;
/// Display help of the program.
void displayHelp();
/// Display version of the program.
void displayVersion();
/// Returns program name or path passed as first parameter to parse() method
std::string getProgramName() const { return _ProgramName; }
std::string getProgramPath() const { return _ProgramPath; }
std::string getStartupPath() const { return _StartupPath; }
/// Set or get description to display in help
void setDescription(const std::string &description) { _Description = description; }
std::string getDescription() const { return _Description; }
/// Set or get version to display in -v
void setVersion(const std::string &version) { _Version = version; }
std::string getVersion() const { return _Version; }
protected:
std::string _ProgramName; // filename of the program
std::string _ProgramPath; // full path of the program
std::string _StartupPath; // initial startup path
std::string _Description; // description of the program
std::string _Version; // version of the program
/// Array of arguments pass from the command line
NLMISC::CVectorSString _Args;
TArgs _Args;
}; // class CCmdArgs
}; // NAMESPACE NLMISC

@ -28,8 +28,8 @@ namespace NLMISC
# define NL_WIN_CALLBACK
#endif
// Default to 8KB stack for tasks
const unsigned int NL_TASK_STACK_SIZE = 8*1024;
// Default to 1MiB stack for tasks
const uint NL_TASK_STACK_SIZE = 1024*1024;
// forward def for platform specific data
struct TCoTaskData;

@ -38,6 +38,10 @@
# include <sys/types.h>
#endif
#if defined(NL_CPU_INTEL) && defined(NL_COMP_GCC)
#include <x86intrin.h>
#endif
#include "string_common.h"
#ifdef NL_OS_WINDOWS
@ -65,20 +69,20 @@ namespace NLMISC
inline uint64 rdtsc()
{
#if defined(NL_COMP_GCC) && !defined(CLANG_VERSION) && (GCC_VERSION <= 40405)
// for GCC versions that don't implement __rdtsc()
#ifdef NL_CPU_X86_64
uint64 low, high;
__asm__ volatile("rdtsc" : "=a" (low), "=d" (high));
return low | (high << 32);
#else
uint64 ticks;
# ifdef NL_OS_WINDOWS
# ifdef NL_NO_ASM
ticks = uint64(__rdtsc());
# else
// We should use the intrinsic code now. ticks = uint64(__rdtsc());
__asm rdtsc
__asm mov DWORD PTR [ticks], eax
__asm mov DWORD PTR [ticks + 4], edx
# endif // NL_NO_ASM
# else
__asm__ volatile(".byte 0x0f, 0x31" : "=a" (ticks.low), "=d" (ticks.high));
# endif // NL_OS_WINDOWS
__asm__ volatile("rdtsc" : "=A" (ticks));
return ticks;
#endif
#else
return uint64(__rdtsc());
#endif
}
#endif // NL_CPU_INTEL
@ -278,6 +282,13 @@ inline sint nlstricmp(const std::string &lhs, const std::string &rhs) { return s
inline sint nlstricmp(const std::string &lhs, const char *rhs) { return stricmp(lhs.c_str(),rhs); }
inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp(lhs,rhs.c_str()); }
// macros helper to convert UTF-8 std::string and wchar_t*
#define wideToUtf8(str) (ucstring((ucchar*)str).toUtf8())
#define utf8ToWide(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str())
// wrapper for fopen to be able to open files with an UTF-8 filename
FILE* nlfopen(const std::string &filename, const std::string &mode);
/** Signed 64 bit fseek. Same interface as fseek
*/
int nlfseek64( FILE *stream, sint64 offset, int origin );
@ -332,12 +343,18 @@ void itoaInt64 (sint64 number, char *str, sint64 base = 10);
std::string bytesToHumanReadable (const std::string &bytes);
std::string bytesToHumanReadable (uint64 bytes);
/// Convert a number in bytes into a string that is easily readable by an human, for example 105123 -> "102kb"
/// Using units array as string: 0 => B, 1 => KiB, 2 => MiB, 3 => GiB, etc...
std::string bytesToHumanReadableUnits (uint64 bytes, const std::vector<std::string> &units);
/// Convert a human readable into a bytes, for example "102kb" -> 105123
uint32 humanReadableToBytes (const std::string &str);
/// Convert a time into a string that is easily readable by an human, for example 3600 -> "1h"
std::string secondsToHumanReadable (uint32 time);
/// Convert a UNIX timestamp to a formatted date in ISO format
std::string timestampToHumanReadable(uint32 timestamp);
/// Get a bytes or time in string format and convert it in seconds or bytes
uint32 fromHumanReadable (const std::string &str);
@ -349,6 +366,25 @@ std::string formatThousands(const std::string& s);
/// The program will be launched in the current directory
bool launchProgram (const std::string &programName, const std::string &arguments, bool log = true);
/// Same but with an array of strings for arguments
bool launchProgramArray (const std::string &programName, const std::vector<std::string> &arguments, bool log = true);
/// This function executes a program and wait for result (used for example for crash report).
/// The program will be launched in the current directory
sint launchProgramAndWaitForResult (const std::string &programName, const std::string &arguments, bool log = true);
/// This function executes a program and returns output as a string
std::string getCommandOutput(const std::string &command);
/// This function replace all environment variables in a string by their content.
/// Environment variables names can use both Windows (%NAME%) and UNIX syntax ($NAME)
/// Authorized characters in names are A-Z, a-z, 0-9 and _
std::string expandEnvironmentVariables(const std::string &s);
/// Functions to convert a string with arguments to array or array to string (will espace strings with spaces)
bool explodeArguments(const std::string &str, std::vector<std::string> &args);
std::string joinArguments(const std::vector<std::string> &args);
/// This function kills a program using his pid (on unix, it uses the kill() POSIX function)
bool killProgram(uint32 pid);

@ -229,7 +229,7 @@ void setCrashAlreadyReported(bool state);
*\code
void function(char *filename)
{
FILE *fp = fopen (filename, "r");
FILE *fp = nlfopen (filename, "r");
if (fp==NULL)
{
nlerror("file not found");

@ -26,13 +26,13 @@
# define WIN32_LEAN_AND_MEAN
#endif
#ifndef _WIN32_WINDOWS
# define _WIN32_WINDOWS 0x0410
# define _WIN32_WINDOWS 0x0500
#endif
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0400
# define _WIN32_WINNT 0x0500
#endif
#ifndef WINVER
# define WINVER 0x0400
# define WINVER 0x0500
#endif
#ifndef NOMINMAX
# define NOMINMAX

@ -174,7 +174,8 @@ public:
/** Build a NeL standard library name according to platform and compilation mode setting.
* aka : adding decoration one base lib name.
* e.g : 'mylib' become 'mylib_rd.dll' on Windows ReleaseDebug mode or
* e.g : 'mylib' become 'mylib_rd.dll' on Windows ReleaseDebug mode,
* 'libmylib.dylib' under OS X or
* 'libmylib.so' on unix system.
*/
static std::string makeLibName(const std::string &baseName);

@ -354,7 +354,7 @@ public:
}
else
{
nlerror ("CEntityId looped (max was %"NL_I64"d", MaxEntityId);
nlerror ("CEntityId looped (max was %" NL_I64 "d", MaxEntityId);
}
return *this;
}
@ -487,7 +487,7 @@ public:
uint creatorId;
uint dynamicId;
if (sscanf(str, "(%"NL_I64"x:%x:%x:%x)", &id, &type, &creatorId, &dynamicId) != 4)
if (sscanf(str, "(%" NL_I64 "x:%x:%x:%x)", &id, &type, &creatorId, &dynamicId) != 4)
{
*this = Unknown;
return;
@ -575,12 +575,12 @@ public:
// Traits for hash_map using CEntityId
struct CEntityIdHashMapTraits
{
enum { bucket_size = 4, min_buckets = 8, };
enum { bucket_size = 4, min_buckets = 8 };
CEntityIdHashMapTraits() { }
size_t operator() (const NLMISC::CEntityId &id ) const
{
uint64 hash64 = id.getUniqueId();
#if (HAVE_X86_64)
#ifdef HAVE_X86_64
return (size_t)hash64;
#else
return (size_t)hash64 ^ (size_t)(hash64 >> 32);

@ -212,6 +212,11 @@ enum TKey
KeyRCONTROL =0xA3,
KeyLMENU =0xA4,
KeyRMENU =0xA5,
KeyMUTE =0xAD,
KeyPLAYPAUSE =0xB3,
KeyVOLUMEDOWN =0xB4,
KeyVOLUMEUP =0xB5,
KeyCALC =0xB7,
KeySEMICOLON =0xBA,
KeyEQUALS =0xBB,
KeyCOMMA =0xBC,

@ -104,6 +104,11 @@ public:
*/
static const std::vector<std::string> &getLanguageCodes();
/** Check if a language code is supported.
* Code are ISO 639-2 compliant.
*/
static bool isLanguageCodeSupported(const std::string &lang);
/// Load a language file depending of the language code("en", "fr", ...). Code are ISO 639-2 compliant.
static void load (const std::string &languageCode, const std::string &fallbackLanguageCode="");
@ -119,6 +124,9 @@ public:
/// Returns the code of the language ("fr", "en", ...)
static std::string getCurrentLanguageCode ();
/// Returns the code of the language ("fr", "en", ...) defined on system
static std::string getSystemLanguageCode ();
/// Find a string in the selected language and return his association.
static const ucstring &get (const std::string &label);

@ -25,8 +25,12 @@
#include "types_nl.h"
#include "stream.h"
// Include from libxml2
#include <libxml/parser.h>
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
typedef struct _xmlParserCtxt xmlParserCtxt;
typedef xmlParserCtxt *xmlParserCtxtPtr;
namespace NLMISC {
@ -124,11 +128,11 @@ public:
/** Get the first child node pointer of type. NULL if no node of type.
*/
static xmlNodePtr getFirstChildNode (xmlNodePtr parent, xmlElementType type);
static xmlNodePtr getFirstChildNode (xmlNodePtr parent, sint /* xmlElementType */ type);
/** Get the next child node pointer of type. NULL if no node of type.
*/
static xmlNodePtr getNextChildNode (xmlNodePtr last, xmlElementType type);
static xmlNodePtr getNextChildNode (xmlNodePtr last, sint /* xmlElementType */ type);
/** Count number of sub node named with a given name for a given node.
*/
@ -136,7 +140,7 @@ public:
/** Count number of sub node of type for a given node.
*/
static uint countChildren (xmlNodePtr node, xmlElementType type);
static uint countChildren (xmlNodePtr node, sint /* xmlElementType */ type);
/**
* Read a property string

@ -31,13 +31,13 @@
# define WIN32_LEAN_AND_MEAN
#endif
#ifndef _WIN32_WINDOWS
# define _WIN32_WINDOWS 0x0410
# define _WIN32_WINDOWS 0x0500
#endif
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0400
# define _WIN32_WINNT 0x0500
#endif
#ifndef WINVER
# define WINVER 0x0400
# define WINVER 0x0500
#endif
#ifndef NOMINMAX
# define NOMINMAX

@ -728,7 +728,7 @@ inline void CMemStream::serial(uint64 &b)
}
else
{
writenumber( b, "%"NL_I64"u", 20 );
writenumber( b, "%" NL_I64 "u", 20 );
}
}
else
@ -748,7 +748,7 @@ inline void CMemStream::serial(sint64 &b)
}
else
{
writenumber( b, "%"NL_I64"d", 20 );
writenumber( b, "%" NL_I64 "d", 20 );
}
}
else

@ -293,12 +293,7 @@ public:
if (!atomic_swap (&_Lock))
break;
#ifdef NL_OS_WINDOWS
nlSleep (wait_time);
#else
//std::cout << "Sleeping i=" << i << std::endl;
usleep( wait_time*1000 );
#endif
}
}
}
@ -401,12 +396,7 @@ public:
if (!CFastMutex::atomic_swap (&_Lock))
break;
#ifdef NL_OS_WINDOWS
nlSleep (wait_time);
#else
//std::cout << "Sleeping i=" << i << std::endl;
usleep( wait_time*1000 );
#endif
}
}
}

@ -25,9 +25,12 @@
#include "types_nl.h"
#include "stream.h"
// Include from libxml2
#include <libxml/parser.h>
// Forward declarations for libxml2
typedef struct _xmlNode xmlNode;
typedef xmlNode *xmlNodePtr;
typedef struct _xmlDoc xmlDoc;
typedef xmlDoc *xmlDocPtr;
namespace NLMISC {

@ -230,7 +230,7 @@ public:
/** Get application directory.
* \return directory where applications should write files.
*/
std::string getApplicationDirectory(const std::string &appName = "");
std::string getApplicationDirectory(const std::string &appName = "", bool local = false);
/** Get a temporary directory.
* \return temporary directory where applications should write files.
@ -497,7 +497,7 @@ public:
static void getFileListByName(const std::string &extension, const std::string &name, std::vector<std::string> &filenames);
/** Create a list of file having the requested string in the path and the requested extension
*/
*/
static void getFileListByPath(const std::string &extension, const std::string &path, std::vector<std::string> &filenames);
/** Make a path relative to another if possible, else doesn't change it.
@ -508,18 +508,25 @@ public:
static bool makePathRelative (const char *basePath, std::string &relativePath);
/** Make path absolute
* \param relativePath - The relative path
* \param directory - the directory to which the path is relative to
* returns the absolute path, or empty if something went wrong.
*/
static std::string makePathAbsolute (const std::string &relativePath, const std::string &directory );
* \param relativePath - The relative path
* \param directory - the directory to which the path is relative to
* \param simplify - if we should simplify or not the path (convert . and .. in path)
* returns the absolute path, or empty if something went wrong.
*/
static std::string makePathAbsolute (const std::string &relativePath, const std::string &directory, bool simplify = false );
/** Return if a path is absolute or not.
* \param path - The path
* returns true if path is absolute or false if relative.
*/
static bool isAbsolutePath (const std::string &path);
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
*/
static void addIgnoredDoubleFile(const std::string &ignoredFile);
/** For the moment after memoryCompress you cant addsearchpath anymore
*/
*/
static void memoryCompress();
static void memoryUncompress();
@ -527,17 +534,17 @@ public:
static bool isMemoryCompressed() { return getInstance()->_FileContainer.isMemoryCompressed(); }
/** Get the ms windows directory (in standardized way with end slash), or returns an empty string on other os
*/
*/
static std::string getWindowsDirectory();
/** Get application directory.
* \return directory where applications should write files.
*/
static std::string getApplicationDirectory(const std::string &appName = "");
* \return directory where applications should write files.
*/
static std::string getApplicationDirectory(const std::string &appName = "", bool local = false);
/** Get a temporary directory.
* \return temporary directory where applications should write files.
*/
* \return temporary directory where applications should write files.
*/
static std::string getTemporaryDirectory();
// release singleton
@ -612,7 +619,7 @@ struct CFile
* Return the position between [begin,end[ of the last separator between path and filename ('/' or '\').
* If there's no separator, it returns string::npos.
*/
static int getLastSeparator (const std::string &filename);
static std::string::size_type getLastSeparator (const std::string &filename);
static std::string getFilenameWithoutExtension (const std::string &filename);
static std::string getExtension (const std::string &filename);
@ -701,7 +708,7 @@ struct CFile
/** Move a file
* NB this keeps file attributes
*/
static bool moveFile(const char *dest, const char *src);
static bool moveFile(const std::string &dest, const std::string &src);
/** Create a directory
* \return true if success
@ -715,7 +722,6 @@ struct CFile
/** Try to set the file access to read/write if not already set.
* return true if the file doesn't exist or if the file already have RW access.
* Work actually only on Windows and returns always true on other platforms.
* \return true if RW access is granted
*/
static bool setRWAccess(const std::string &filename);

@ -146,6 +146,14 @@ public:
*/
uint8 toGray() const;
/**
* Color is gray
*/
bool isGray() const
{
return R == G && G == B;
}
/**
* Get a 16 bits 565 pixel.
*/
@ -169,6 +177,17 @@ public:
B= (B<<3) + (B>>2);
}
/**
* Set the RGBA fields with a 32 bits 8888 pixel.
*/
void set8888(uint32 col)
{
R = col & 255;
G = (col >> 8) & 255;
B = (col >> 16) & 255;
A = (col >> 24) & 255;
}
/**
* Compute in this the average of 2 RGBA.

@ -248,7 +248,7 @@ private :
class CSheetIdHashMapTraits
{
public:
enum { bucket_size = 4, min_buckets = 8, };
enum { bucket_size = 4, min_buckets = 8 };
inline size_t operator() ( const CSheetId& sheetId ) const
{
return sheetId.asInt() >> 5;

@ -352,7 +352,7 @@ public:
}
};
#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 80
#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 80 && NL_COMP_VC_VERSION < 140
// This operator only purpose is to compare with NULL value
template <class T>

@ -945,14 +945,6 @@ inline CSString operator+(const char* s0,const CSString& s1)
return CSString(s0) + s1.c_str();
}
#if !defined(NL_COMP_VC) || (NL_COMP_VC_VERSION <= 100)
// TODO: check if it can be disabled for other compilers too
inline CSString operator+(const std::string& s0,const CSString& s1)
{
return s0+static_cast<const std::string&>(s1);
}
#endif
} // NLMISC
// *** The following was commented out by Sadge because there were strange compilation/ link issues ***

@ -186,8 +186,8 @@ inline std::string toString(const uint16 &val) { return toString("%hu", val); }
inline std::string toString(const sint16 &val) { return toString("%hd", val); }
inline std::string toString(const uint32 &val) { return toString("%u", val); }
inline std::string toString(const sint32 &val) { return toString("%d", val); }
inline std::string toString(const uint64 &val) { return toString("%"NL_I64"u", val); }
inline std::string toString(const sint64 &val) { return toString("%"NL_I64"d", val); }
inline std::string toString(const uint64 &val) { return toString("%" NL_I64 "u", val); }
inline std::string toString(const sint64 &val) { return toString("%" NL_I64 "d", val); }
#ifdef NL_COMP_GCC
# if GCC_VERSION == 40102
@ -195,24 +195,27 @@ inline std::string toString(const sint64 &val) { return toString("%"NL_I64"d", v
// error fix for size_t? gcc 4.1.2 requested this type instead of size_t ...
inline std::string toString(const long unsigned int &val)
{
if (sizeof(long unsigned int) == 8)
return toString((uint64)val);
#ifdef _LP64
return toString((uint64)val);
#else
return toString((uint32)val);
#endif
}
# endif
#endif
#if (SIZEOF_SIZE_T) == 8
inline std::string toString(const size_t &val) { return toString("%"NL_I64"u", val); }
inline std::string toString(const size_t &val) { return toString("%" NL_I64 "u", val); }
#else
#ifdef NL_OS_MAC
inline std::string toString(const size_t &val) { return toString("%u", val); }
#endif
#endif
inline std::string toString(const float &val) { return toString("%f", val); }
inline std::string toString(const double &val) { return toString("%lf", val); }
inline std::string toString(const bool &val) { return toString("%u", val?1:0); }
inline std::string toString(const bool &val) { return val ? "1":"0"; }
inline std::string toString(const std::string &val) { return val; }
// stl vectors of bool use bit reference and not real bools, so define the operator for bit reference
@ -234,71 +237,60 @@ inline bool fromString(const std::string &str, uint8 &val) { char *end; long v;
inline bool fromString(const std::string &str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint8)v; return true; } }
inline bool fromString(const std::string &str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str.c_str()) { val = 0; return false; } else { val = (uint16)v; return true; } }
inline bool fromString(const std::string &str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint16)v; return true; } }
inline bool fromString(const std::string &str, uint64 &val) { bool ret = sscanf(str.c_str(), "%"NL_I64"u", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(str.c_str(), "%"NL_I64"d", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, uint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "u", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "d", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }
inline bool fromString(const std::string &str, bool &val)
{
if( str.length() == 1 )
if (str.length() == 1)
{
if( str[ 0 ] == '1' )
const char c = str[0];
switch(c)
{
case '1':
case 't':
case 'T':
case 'y':
case 'Y':
val = true;
else
if( str[ 0 ] == '0' )
break;
case '0':
case 'f':
case 'F':
case 'n':
case 'N':
val = false;
break;
default:
val = false;
else
return false;
}
}
else
{
if( str == "true" )
if (str == "true" || str == "yes")
{
val = true;
else
if( str == "false" )
}
else if (str == "false" || str == "no")
{
val = false;
}
else
{
val = false;
return false;
}
}
return true;
}
inline bool fromString(const char *str, uint32 &val) { if (strstr(str, "-") != NULL) { val = 0; return false; } char *end; unsigned long v; errno = 0; v = strtoul(str, &end, 10); if (errno || v > UINT_MAX || end == str) { val = 0; return false; } else { val = (uint32)v; return true; } }
inline bool fromString(const char *str, sint32 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > INT_MAX || v < INT_MIN || end == str) { val = 0; return false; } else { val = (sint32)v; return true; } }
inline bool fromString(const char *str, uint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > UCHAR_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint8)v; return true; } }
inline bool fromString(const char *str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str) { val = 0; return false; } else { val = (sint8)v; return true; } }
inline bool fromString(const char *str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint16)v; return true; } }
inline bool fromString(const char *str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str) { val = 0; return false; } else { val = (sint16)v; return true; } }
inline bool fromString(const char *str, uint64 &val) { bool ret = sscanf(str, "%"NL_I64"u", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const char *str, sint64 &val) { bool ret = sscanf(str, "%"NL_I64"d", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const char *str, float &val) { bool ret = sscanf(str, "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const char *str, double &val) { bool ret = sscanf(str, "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }
inline bool fromString(const char *str, bool &val)
{
switch (str[0])
{
case '1':
case 't':
case 'y':
case 'T':
case 'Y':
val = true;
return true;
case '0':
case 'f':
case 'n':
case 'F':
case 'N':
val = false;
return true;
}
return false;
}
inline bool fromString(const std::string &str, std::string &val) { val = str; return true; }
// stl vectors of bool use bit reference and not real bools, so define the operator for bit reference

@ -39,7 +39,7 @@ typedef const std::string *TStringId;
// Traits for hash_map using CStringId
struct CStringIdHashMapTraits
{
enum { bucket_size = 4, min_buckets = 8, };
enum { bucket_size = 4, min_buckets = 8 };
CStringIdHashMapTraits() { }
size_t operator() (const NLMISC::TStringId &stringId) const
{

@ -72,9 +72,9 @@ public:
*/
static bool isNT();
/** Returns the space left on the hard drive that contains the filename
/** Returns the space left on the hard drive that contains the filename in bytes
*/
static std::string availableHDSpace (const std::string &filename);
static uint64 availableHDSpace (const std::string &filename);
/** Returns all the physical memory available on the computer (in bytes)
*/

@ -81,6 +81,7 @@ public:
/// Detect whether the current process is a windowed application. Return true if definitely yes, false if unknown
static bool detectWindowedApplication();
static sint getTotalVideoMemory();
};
} // NLMISC

@ -43,17 +43,34 @@
// This way we know about _HAS_TR1 and _STLPORT_VERSION
#include <string>
#if defined(HAVE_X86_64)
# define NL_CPU_INTEL
# define NL_CPU_X86_64
// x86_64 CPU always have SSE2 instructions
# ifndef NL_HAS_SSE2
# define NL_HAS_SSE2
# endif
#elif defined(HAVE_X86)
# define NL_CPU_INTEL
# define NL_CPU_X86
#endif
// Operating systems definition
#ifdef _WIN32
# define NL_OS_WINDOWS
# define NL_LITTLE_ENDIAN
# define NL_CPU_INTEL
# ifndef NL_CPU_INTEL
# define NL_CPU_INTEL
# endif
# ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0500 // Minimal OS = Windows 2000 (NeL is not supported on Windows 95/98)
# endif
# ifdef _MSC_VER
# define NL_COMP_VC
# if _MSC_VER >= 1800
# if _MSC_VER >= 1900
# define NL_COMP_VC14
# define NL_COMP_VC_VERSION 140
# elif _MSC_VER >= 1800
# define NL_COMP_VC12
# define NL_COMP_VC_VERSION 120
# elif _MSC_VER >= 1700
@ -177,6 +194,10 @@
# define NL_ISO_STDTR1_HEADER(header) <header>
# define NL_ISO_STDTR1_NAMESPACE std
# endif
# endif
// clang define GCC version for compatibility
# ifdef __clang__
# define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
# endif
#endif
@ -285,7 +306,7 @@
* Used to display a int64 in a platform independent way with printf like functions.
\code
sint64 myint64 = SINT64_CONSTANT(0x123456781234);
printf("This is a 64 bits int: %"NL_I64"u", myint64);
printf("This is a 64 bits int: %" NL_I64 "u", myint64);
\endcode
*/
@ -368,8 +389,9 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
inline void *aligned_malloc(size_t size, size_t alignment) { return _aligned_malloc(size, alignment); }
inline void aligned_free(void *ptr) { _aligned_free(ptr); }
#elif defined(NL_OS_MAC)
#include <stdlib.h>
// under Mac OS X, malloc is already aligned for SSE and Altivec (16 bytes alignment)
inline void *aligned_malloc(size_t size, size_t alignment) { return malloc(size); }
inline void *aligned_malloc(size_t size, size_t /* alignment */) { return malloc(size); }
inline void aligned_free(void *ptr) { free(ptr); }
#else
#include <malloc.h>
@ -383,10 +405,13 @@ inline void aligned_free(void *ptr) { free(ptr); }
#define NL_DEFAULT_MEMORY_ALIGNMENT 16
#define NL_ALIGN_SSE2 NL_ALIGN(NL_DEFAULT_MEMORY_ALIGNMENT)
#ifndef NL_CPU_X86_64
// on x86_64, new and delete are already aligned on 16 bytes
extern void *operator new(size_t size) throw(std::bad_alloc);
extern void *operator new[](size_t size) throw(std::bad_alloc);
extern void operator delete(void *p) throw();
extern void operator delete[](void *p) throw();
#endif
#else /* NL_HAS_SSE2 */
@ -463,7 +488,7 @@ typedef uint16 ucchar;
// To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234)
#ifdef NL_COMP_VC
# if (NL_COMP_VC_VERSION >= 120)
# if (NL_COMP_VC_VERSION >= 100)
# define INT64_CONSTANT(c) (c##LL)
# define SINT64_CONSTANT(c) (c##LL)
# define UINT64_CONSTANT(c) (c##ULL)

@ -355,7 +355,7 @@ namespace NLMISC
// Traits for hash_map using CEntityId
struct CUCStringHashMapTraits
{
enum { bucket_size = 4, min_buckets = 8, };
enum { bucket_size = 4, min_buckets = 8 };
CUCStringHashMapTraits() { }
size_t operator() (const ucstring &id ) const
{

@ -242,8 +242,6 @@ public:
{
T v;
bool ret = NLMISC::fromString(val, v);
// std::stringstream ss (val);
// ss >> v;
set (v);
return ret;
}
@ -251,9 +249,6 @@ public:
virtual std::string toString (bool /* human */) const
{
return NLMISC::toString(_Value);
// std::stringstream ss;
// ss << _Value;
// return ss.str();
}
CVariable<T> &operator= (const T &val)

@ -45,7 +45,7 @@ inline uint64 wangHash64Inv(uint64 key)
key = key^tmp >> 28;
// Invert key *= 21
key *= 14933078535860113213u;
key *= UINT64_CONSTANT(14933078535860113213);
// Invert key = key ^ (key >> 14)
tmp = key^key >> 14;
@ -54,7 +54,7 @@ inline uint64 wangHash64Inv(uint64 key)
key = key^tmp >> 14;
// Invert key *= 265
key *= 15244667743933553977u;
key *= UINT64_CONSTANT(15244667743933553977);
// Invert key = key ^ (key >> 24)
tmp = key^key >> 24;

@ -25,13 +25,13 @@
# define WIN32_LEAN_AND_MEAN
#endif
#ifndef _WIN32_WINDOWS
# define _WIN32_WINDOWS 0x0410
# define _WIN32_WINDOWS 0x0500
#endif
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0400
# define _WIN32_WINNT 0x0500
#endif
#ifndef WINVER
# define WINVER 0x0400
# define WINVER 0x0500
#endif
#ifndef NOMINMAX
# define NOMINMAX

@ -64,6 +64,8 @@ public:
virtual void getWindowPos (uint32 &x, uint32 &y, uint32 &w, uint32 &h) { x=y=w=h=0; }
static std::string stringifyMessage(const NLMISC::CLog::TDisplayInfo &args, const char *message, bool needSlashR = false);
protected:
// display a string (MT)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save