Merge commit '6f545aedd5638e093f35f1e156d3ed4f9a91cb18' into feature/cdb-packed

feature/cdb-packed
kaetemi 4 years ago
commit c624984da1

@ -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

266
.gitignore vendored

@ -0,0 +1,266 @@
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 directories
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

@ -14,6 +14,8 @@
**.font = native
**.scheme = native
**.tpl = native
**.xsd = native
**.dox = native

@ -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
@ -241,6 +242,9 @@ external_stlport
nel_tools*
ryzom_tools*
#personal projects
personal/
#Dumps
*.dmp
@ -260,3 +264,5 @@ 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

@ -2,3 +2,15 @@
4eddbaff0c5e5d685db96ee3e8427aa0fd96ac83 ryzomcore/v0.8.0
00d9b6e29e95f56785fbf85abe60afd34674f402 ryzomcore/v0.9.0
79776c337176dd5b02e1a74fe5dfb703b91747aa ryzomcore/v0.9.1
fedf2aa443d09707beed814b0f499c6a5519cc84 ryzomcore/v0.10.0
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
3e17907af67e8d66d80e6b714707bbf912607f2a ryzom-patch-3.0.0
153e0b605c9e0c83ba05b6428c62838b49cc84b2 ryzom-patch-3.0.1
4300cc14aad098b1f86ea4c55577b7fa4a4cb5d2 ryzom-patch-3.1.0
043aaeb3d8a2a54177581b57bda87a9deaad510e ryzom-patch-3.1.0-april_patch
00dde390a394fce9da06c2f3264140282158d39f 3.3.0
dcd4c4d161ef775136e18c7e8f5072b75dede27e ryzom-patch-3.3.1

@ -0,0 +1,48 @@
sudo: false
language: cpp
compiler:
- gcc
os:
- linux
matrix:
fast_finish: true
env:
- CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=ON -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TOOLS=OFF"
- 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-dev
- 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.

@ -0,0 +1,34 @@
jobs:
- job: ubuntu16
pool:
vmImage: 'Ubuntu-16.04'
steps:
- script: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install cmake build-essential -y
sudo apt-get install gcc-8 g++-8 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 60
sudo apt-get install libmysqlclient-dev -y
sudo apt-get install bison autoconf automake -y
sudo apt-get install libpng12-dev libjpeg62-dev -y
sudo apt-get install liblua5.1-dev libluabind-dev libcpptest-dev -y
sudo apt-get install libogg-dev libvorbis-dev libopenal-dev -y
sudo apt-get install libgif-dev libfreetype6-dev -y
sudo apt-get install libxml2-dev -y
sudo apt-get install libcurl4-openssl-dev -y
displayName: 'Dependencies'
- script: |
mkdir build
cmake --version
cd build
cmake -DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=ON -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=ON -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TOOLS=OFF ../code
cat CMakeCache.txt
displayName: 'CMake'
- script: |
cd build
make -j`nproc`
displayName: 'Make'

@ -1,8 +1,8 @@
#-----------------------------------------------------------------------------
#
# NeL
# Authors: Nevrax and the NeL Community
# Version: 0.9.1
# Ryzom Core
# Authors: Nevrax and the Ryzom Core Community
# Version: 0.12.0
#
# Notes:
# * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path
@ -28,14 +28,15 @@ IF(COMMAND cmake_policy)
# have absolute paths (e.g. -lpthread)
cmake_policy(SET CMP0003 NEW)
# Works around warnings about escaped quotes in ADD_DEFINITIONS
# statements
cmake_policy(SET CMP0005 OLD)
ENDIF(COMMAND cmake_policy)
# allow to link to qtmain automatically under Windows
IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF()
ENDIF()
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 +45,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 9)
SET(NL_VERSION_PATCH 1)
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}")
SET(NL_VERSION_MAJOR 1)
SET(NL_VERSION_MINOR 0)
SET(NL_VERSION_PATCH 0)
SET(YEAR "2004-${CURRENT_YEAR}")
SET(AUTHOR "Winch Gate and The Ryzom Core Community")
#-----------------------------------------------------------------------------
# Redirect output files
@ -59,19 +67,15 @@ SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# DLL should be in the same directory as EXE under Windows
IF(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
ELSE(WIN32)
ELSE()
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
ENDIF(WIN32)
ENDIF()
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)
ENDIF()
ENDIF()
#-----------------------------------------------------------------------------
# Set default config options
@ -82,139 +86,242 @@ NL_SETUP_NELNS_DEFAULT_OPTIONS()
NL_SETUP_RYZOM_DEFAULT_OPTIONS()
NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS()
NL_SETUP_PREFIX_PATHS()
RYZOM_SETUP_PREFIX_PATHS()
NL_CONFIGURE_CHECKS()
NL_SETUP_BUILD()
NL_SETUP_BUILD_FLAGS()
NL_SETUP_PREFIX_PATHS()
RYZOM_SETUP_PREFIX_PATHS()
#-----------------------------------------------------------------------------
#Platform specifics
SETUP_EXTERNAL()
NL_GEN_REVISION_H()
IF(WIN32)
SET(WINSOCK2_LIB ws2_32.lib)
IF(WITH_MFC)
FIND_PACKAGE(CustomMFC REQUIRED)
ENDIF(WITH_MFC)
ENDIF(WIN32)
ENDIF()
ENDIF()
FIND_PACKAGE(ZLIB REQUIRED)
FIND_PACKAGE(LibXml2 REQUIRED)
FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(OpenSSL REQUIRED)
FIND_PACKAGE(GIF)
FIND_PACKAGE(Jpeg)
IF(WIN32)
SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
ENDIF()
IF(WITH_LIBOVR)
FIND_PACKAGE(LibOVR)
ENDIF()
IF(WITH_LIBVR)
FIND_PACKAGE(LibVR)
ENDIF()
NL_CONFIGURE_CHECKS()
IF(WITH_STATIC_LIBXML2)
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
ENDIF(WITH_STATIC_LIBXML2)
ENDIF()
IF(WITH_LIBXML2_ICONV)
FIND_PACKAGE(Iconv REQUIRED)
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
ENDIF()
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(Iconv REQUIRED)
FIND_PACKAGE(LibLZMA REQUIRED)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES} ${LIBLZMA_LIBRARIES})
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
ENDIF(APPLE)
ENDIF(WITH_STATIC)
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()
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
IF(FINAL_VERSION)
ADD_DEFINITIONS(-DFINAL_VERSION=1)
ENDIF(FINAL_VERSION)
ENDIF()
IF(WITH_SSE2)
ADD_DEFINITIONS(-DNL_HAS_SSE2)
IF(WITH_SSE3)
ADD_DEFINITIONS(-DNL_HAS_SSE3)
ENDIF(WITH_SSE3)
ENDIF(WITH_SSE2)
ENDIF()
ENDIF()
IF(APPLE)
FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
FIND_LIBRARY(SECURITY_FRAMEWORK Security)
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()
ENDIF()
INCLUDE(FindHelpers)
IF(WITH_QT5)
FIND_QT5()
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)
ENDIF()
IF(WITH_ASSIMP)
FIND_PACKAGE(assimp REQUIRED)
ENDIF()
IF(WITH_NEL)
IF(WITH_NEL_TESTS)
FIND_PACKAGE(CppTest)
ENDIF(WITH_NEL_TESTS)
ENDIF()
IF(WITH_GUI)
FIND_PACKAGE(Libwww REQUIRED)
FIND_PACKAGE(Luabind REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
SET(CURL_STATIC ON)
ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
ELSE()
SET(CURL_STATIC OFF)
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)
LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
# CURL Macports version depends on libidn, libintl and libiconv too
IF(APPLE)
IF(WIN32)
LIST(APPEND CURL_LIBRARIES Crypt32 Cryptui)
ELSE()
# 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)
LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY})
ENDIF()
# CURL Macports version can depend on libidn, libidn2, libintl, libpsl and libiconv too
IF(APPLE)
FIND_LIBRARY(INTL_LIBRARY intl)
IF(INTL_LIBRARY)
LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY})
ENDIF()
FIND_LIBRARY(IDN2_LIBRARY idn2)
IF(IDN2_LIBRARY)
LIST(APPEND CURL_LIBRARIES ${IDN2_LIBRARY})
ENDIF()
FIND_LIBRARY(PSL_LIBRARY psl)
IF(PSL_LIBRARY)
LIST(APPEND CURL_LIBRARIES ${PSL_LIBRARY})
ENDIF()
FIND_LIBRARY(UNISTRING_LIBRARY unistring)
IF(UNISTRING_LIBRARY)
LIST(APPEND CURL_LIBRARIES ${UNISTRING_LIBRARY})
ENDIF()
LIST(APPEND CURL_LIBRARIES ${SECURITY_FRAMEWORK})
ENDIF()
ENDIF()
ENDIF()
ENDIF()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include)
ADD_SUBDIRECTORY(nel)
ENDIF(WITH_NEL)
# Aliases for targets
SET(NELMISC_LIBRARIES nelmisc)
SET(NELNET_LIBRARIES nelnet)
SET(NELLIGO_LIBRARIES nelligo)
SET(NELGEORGES_LIBRARIES nelgeorges)
SET(NEL3D_LIBRARIES nel3d)
SET(NELGUI_LIBRARIES nelgui)
SET(NELSOUND_LIBRARIES nelsound)
ELSE()
# FIND_PACKAGE(NeL COMPONENTS 3d misc pacs sound nimp REQUIRED)
FIND_PACKAGE(NeL REQUIRED)
INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIRS})
ENDIF()
IF(WITH_RYZOM)
ADD_SUBDIRECTORY(ryzom)
ENDIF(WITH_RYZOM)
ENDIF()
IF(WITH_NELNS)
ADD_SUBDIRECTORY(nelns)
ENDIF(WITH_NELNS)
ENDIF()
IF(WITH_SNOWBALLS)
ADD_SUBDIRECTORY(snowballs2)
ENDIF(WITH_SNOWBALLS)
ENDIF()
IF(WITH_TOOLS)
ADD_SUBDIRECTORY(tool)
ENDIF(WITH_TOOLS)
ENDIF()
IF(WITH_STUDIO)
ADD_SUBDIRECTORY(studio)
ENDIF(WITH_STUDIO)
ENDIF()
IF(WITH_PERSONAL)
ADD_SUBDIRECTORY(personal)
ENDIF()
# To build the documention, you will have to enable it
# and then do the equivalent of "make DoxygenDoc".
IF(BUILD_DOCUMENTATION)
IF(DOT)
SET(HAVE_DOT YES)
ELSE(DOT)
ELSE()
SET(HAVE_DOT NO)
ENDIF(DOT)
ENDIF()
# This processes our Doxyfile.in and substitutes paths to generate
# a final Doxyfile
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/Doxyfile.cmake.in ${CMAKE_BINARY_DIR}/doc/Doxyfile)
ADD_CUSTOM_TARGET(DoxygenDoc ${DOXYGEN} ${CMAKE_BINARY_DIR}/doc/Doxyfile)
ENDIF(BUILD_DOCUMENTATION)
ENDIF()
IF(WITH_NEL_TESTS)
ENABLE_TESTING()
@ -224,42 +331,43 @@ IF(WITH_NEL_TESTS)
SET(SVNCOMMAND svn)
SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel)
SET(GENERATELOGS svn2cl)
ENDIF(BUILD_DASHBOARD)
ENDIF(WITH_NEL_TESTS)
ENDIF()
ENDIF()
# packaging information
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NeL MMORPG Framework")
SET(CPACK_PACKAGE_VENDOR "NeL")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework")
SET(CPACK_PACKAGE_VENDOR "Ryzom Core")
SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
SET(CPACK_PACKAGE_EXECUTABLES "nel${NL_VERSION}" "nel")
SET(CPACK_PACKAGE_EXECUTABLES "ryzomcore${NL_VERSION}" "ryzomcore")
SET(CPACK_SET_DESTDIR TRUE)
# NSIS Specific Packing Setup
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "NeL")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "RyzomCore")
SET(CPACK_NSIS_MODIFY_PATH "ON")
SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} NeL")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} RyzomCore")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
## Source Packages
SET(CPACK_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
SET(CPACK_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
IF(WIN32)
#SET(CPACK_GENERATOR "NSIS")
SET(CPACK_GENERATOR "NSIS;ZIP")
SET(CPACK_SOURCE_GENERATOR "ZIP")
ELSE(WIN32)
ELSE()
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_SOURCE_GENERATOR "TGZ")
ENDIF(WIN32)
ENDIF()
set(CPACK_SOURCE_IGNORE_FILES
"~$"
"\\\\.cvsignore$"
@ -277,8 +385,8 @@ IF(WIN32)
"${QT_LIBRARY_DIR}/../bin/QtXmld4.dll"
"${QT_LIBRARY_DIR}/../bin/QtCored4.dll"
DESTINATION ${NL_BIN_PREFIX})
ENDIF(WITH_QT)
ELSE(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
ENDIF()
ELSE()
IF(WITH_QT)
INCLUDE(${QT_USE_FILE})
INSTALL(FILES
@ -286,8 +394,8 @@ IF(WIN32)
"${QT_LIBRARY_DIR}/../bin/QtXml4.dll"
"${QT_LIBRARY_DIR}/../bin/QtCore4.dll"
DESTINATION ${NL_BIN_PREFIX})
ENDIF(WITH_QT)
ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
ENDIF()
ENDIF()
# Install CEGUI and its dependencies.
IF(WITH_NEL_CEGUI)
@ -297,14 +405,14 @@ IF(WIN32)
INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIFalagardWRBase.dll" DESTINATION ${NL_BIN_PREFIX})
INSTALL(FILES "${CEGUI_LIB_DIR}/Devil.dll" DESTINATION ${NL_BIN_PREFIX})
INSTALL(FILES "${CEGUI_LIB_DIR}/ILU.dll" DESTINATION ${NL_BIN_PREFIX})
ENDIF(WITH_NEL_CEGUI)
ENDIF()
# Only the tools require MFC.
IF(WITH_TOOLS)
SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
ENDIF(WITH_TOOLS)
ENDIF()
#INCLUDE(InstallRequiredSystemLibraries)
ENDIF(WIN32)
ENDIF()
INCLUDE(CPack)
@ -314,4 +422,4 @@ INCLUDE(CMakePackaging.txt)
#INCLUDE(UseDebian)
#IF(DEBIAN_FOUND)
# ADD_DEBIAN_TARGETS(nel)
#ENDIF(DEBIAN_FOUND)
#ENDIF()

@ -15,135 +15,204 @@ 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()
IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi")
SET(MINIMUM_NDK_TARGET 9)
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(TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686")
SET(GCC_TOOLCHAIN_PREFIX "x86")
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(TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
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 "clang")
SET(ANDROID_COMPILER "clang")
SET(CLANG ON)
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()
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-*")
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows-x86_64")
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
ELSEIF(CMAKE_HOST_APPLE)
SET(TOOLCHAIN_HOST "apple")
SET(TOOLCHAIN_BIN_SUFFIX "")
ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_HOST "linux-x86_64")
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF()
# clang
SET(CLANG_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${CLANG_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}")
IF(EXISTS ${CLANG_TOOLCHAIN_ROOT})
MESSAGE(STATUS "Found LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
ELSE()
MESSAGE(FATAL_ERROR "No LLVM toolchain found in default search path ${CLANG_TOOLCHAIN_ROOT}")
ENDIF()
# gcc
SET(GCC_TOOLCHAIN_VERSIONS)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${TOOLCHAIN_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND NDK_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
ENDFOREACH(_TOOLCHAIN_VERSION)
ENDIF(_TOOLCHAIN_VERSIONS)
LIST(APPEND GCC_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF()
ENDFOREACH()
ENDIF()
IF(NOT NDK_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF(NOT NDK_TOOLCHAIN_VERSIONS)
IF(NOT GCC_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No GCC version found in default search path ${NDK_ROOT}/toolchains")
ENDIF()
IF(NDK_TOOLCHAIN_VERSION)
LIST(FIND NDK_TOOLCHAIN_VERSIONS "${NDK_TOOLCHAIN_VERSION}" _INDEX)
IF(GCC_TOOLCHAIN_VERSIONS)
LIST(FIND GCC_TOOLCHAIN_VERSIONS "${GCC_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(_INDEX EQUAL -1)
ELSE(NDK_TOOLCHAIN_VERSION)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(NDK_TOOLCHAIN_VERSION)
LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION)
ENDIF()
ELSE()
LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION)
ENDIF()
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${NDK_TOOLCHAIN_VERSION}")
SET(GCC_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-${GCC_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows")
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
ELSEIF(CMAKE_HOST_APPLE)
SET(TOOLCHAIN_HOST "apple")
SET(TOOLCHAIN_BIN_SUFFIX "")
ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_HOST "linux")
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32)
IF(NOT EXISTS "${GCC_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 GCC_TOOLCHAIN_ROOT)
ENDIF()
ENDIF()
SET(TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-${NDK_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
IF(EXISTS "${GCC_TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
ELSE()
MESSAGE(FATAL_ERROR "No GCC toolchain found in default search path ${GCC_TOOLCHAIN_ROOT}")
ENDIF()
IF(NOT EXISTS "${TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF(NOT EXISTS "${TOOLCHAIN_ROOT}")
# NDK
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
MESSAGE(STATUS "Found Android toolchain in ${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} found in ${PLATFORM_ROOT}")
# include dirs
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
# Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
IF(_TOOLCHAIN_BIN_PREFIXES)
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
STRING(REGEX REPLACE "${TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
ENDIF(_TOOLCHAIN_BIN_PREFIXES)
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
ENDIF()
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
MESSAGE(STATUS "STL include dir: ${STL_INCLUDE_DIR}")
MESSAGE(STATUS "STL library dir: ${STL_LIBRARY_DIR}")
SET(CMAKE_FIND_ROOT_PATH ${CLANG_TOOLCHAIN_ROOT} ${GCC_TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
INCLUDE_DIRECTORIES(${STL_INCLUDE_DIR} ${STL_INCLUDE_CPU_DIR})
MACRO(SET_TOOLCHAIN_BINARY_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()
SET(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++)
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
SET(${_NAME} ${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX})
ENDMACRO(SET_TOOLCHAIN_BINARY)
SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
SET(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX})
SET(CMAKE_C_COMPILER_FORCED TRUE)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER})
SET(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX})
SET(CMAKE_CXX_COMPILER_FORCED TRUE)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++)
IF(NOT EXISTS "${CMAKE_ASM_COMPILER}")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as)
ENDIF()
IF(NOT EXISTS "${CMAKE_AR}")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
ENDIF()
# Force the compilers to GCC for Android
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
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)

@ -24,8 +24,8 @@ MACRO(CHECK_UNDEFINED_SYMBOL MYLIBRARY SYMBOL SYMBOL_FOUND)
IF(NOT NM_SYMBOL MATCHES ${SYMBOL})
SET(${SYMBOL_FOUND} FALSE)
# MESSAGE(STATUS "Defined symbol ${SYMBOL} detected in ${${MYLIBRARY}}")
ENDIF(NOT NM_SYMBOL MATCHES ${SYMBOL})
ENDIF(CMAKE_NM)
ENDIF()
ENDIF()
ELSEIF(UNIX)
SET(CMAKE_OBJDUMP objdump)
IF(CMAKE_OBJDUMP)
@ -35,11 +35,11 @@ MACRO(CHECK_UNDEFINED_SYMBOL MYLIBRARY SYMBOL SYMBOL_FOUND)
IF(NOT OBJDUMP_SYMBOL MATCHES "UND")
#MESSAGE(STATUS "${${MYLIBRARY}} does not use symbol ${SYMBOL}")
SET(${SYMBOL_FOUND} FALSE)
ELSE(NOT OBJDUMP_SYMBOL MATCHES "UND")
ELSE()
#MESSAGE(STATUS "${${MYLIBRARY}} uses symbol ${SYMBOL}")
ENDIF(NOT OBJDUMP_SYMBOL MATCHES "UND")
ENDIF(CMAKE_OBJDUMP)
ENDIF(WIN32)
ENDIF()
ENDIF()
ENDIF()
ENDMACRO(CHECK_UNDEFINED_SYMBOL)
# CHECK_LINKED_LIBRARY
@ -66,8 +66,8 @@ MACRO(CHECK_LINKED_LIBRARY MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
IF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
SET(${LIBRARY_FOUND} TRUE)
# MESSAGE(STATUS "Library ${LIBNAME} already linked to ${${MYLIBRARY}}")
ENDIF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
ENDIF(CMAKE_OTOOL)
ENDIF()
ENDIF()
ELSEIF(UNIX)
SET(CMAKE_OBJDUMP objdump)
IF(CMAKE_OBJDUMP)
@ -79,11 +79,11 @@ MACRO(CHECK_LINKED_LIBRARY MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
IF(OBJDUMP_LIBRARY MATCHES "NEEDED")
#MESSAGE(STATUS "${${MYLIBRARY}} references to ${LIBNAME}.")
SET(${LIBRARY_FOUND} TRUE)
ELSE(OBJDUMP_LIBRARY MATCHES "NEEDED")
ELSE()
#MESSAGE(STATUS "${${MYLIBRARY}} does not reference to ${LIBNAME}!")
ENDIF(OBJDUMP_LIBRARY MATCHES "NEEDED")
ENDIF(CMAKE_OBJDUMP)
ENDIF(WIN32)
ENDIF()
ENDIF()
ENDIF()
ENDMACRO(CHECK_LINKED_LIBRARY)
MACRO(CHECK_DEPENDS MYLIBRARY OTHERLIBRARY SYMBOL MUSTLINK)
@ -91,13 +91,13 @@ MACRO(CHECK_DEPENDS MYLIBRARY OTHERLIBRARY SYMBOL MUSTLINK)
IF(SYMBOL_FOUND)
CHECK_LINKED_LIBRARY(MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
ENDIF(SYMBOL_FOUND)
ENDIF()
IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
SET(${MUSTLINK} YES)
ELSE(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ELSE()
SET(${MUSTLINK} NO)
ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ENDIF()
ENDMACRO(CHECK_DEPENDS)
# LINK_DEPENDS
@ -116,23 +116,23 @@ MACRO(LINK_DEPENDS LIBRARIES MYLIBRARY OTHERLIBRARY SYMBOL)
IF(WIN32 OR WITH_STATIC)
# In static, we link all libraries because it will keep only used symbols
SET(MUST_LINK TRUE)
ELSE(WIN32 OR WITH_STATIC)
ELSE()
CHECK_UNDEFINED_SYMBOL(${MYLIBRARY} ${SYMBOL} SYMBOL_FOUND)
IF(SYMBOL_FOUND)
CHECK_LINKED_LIBRARY(${MYLIBRARY} ${OTHERLIBRARY} LIBRARY_FOUND)
ENDIF(SYMBOL_FOUND)
ENDIF()
IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
MESSAGE(STATUS "Underlinking found: ${${MYLIBRARY}} needs ${${OTHERLIBRARY}} but is not linked to, manually linking...")
SET(MUST_LINK TRUE)
ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ENDIF(WIN32 OR WITH_STATIC)
ENDIF(${MYLIBRARY} AND ${OTHERLIBRARY} AND NOT ${OTHERLIBRARY}_LINKED)
ENDIF()
ENDIF()
ENDIF()
IF(MUST_LINK)
MESSAGE(STATUS "Linking with ${${OTHERLIBRARY}}")
SET(${LIBRARIES} ${${LIBRARIES}} ${${OTHERLIBRARY}})
SET(${OTHERLIBRARY}_LINKED TRUE)
ENDIF(MUST_LINK)
ENDIF()
ENDMACRO(LINK_DEPENDS)

@ -1,79 +1,57 @@
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_SHORT "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}")
SET(RYZOM_VERSION "${RYZOM_VERSION_SHORT}.${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"
@ -18,6 +18,7 @@ FIND_PATH(MAXSDK_DIR
PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk"
@ -36,18 +37,18 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
)
IF(TARGET_X64)
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
ELSE(TARGET_X64)
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib ${MAXSDK_DIR}/lib/x64/Release)
ELSE()
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
ENDIF(TARGET_X64)
ENDIF()
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${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)
@ -73,10 +74,28 @@ if(MAXSDK_FOUND)
${MAXSDK_MAXUTIL_LIBRARY}
${MAXSDK_MAXSCRIPT_LIBRARY}
${MAXSDK_PARAMBLK2_LIBRARY}
${MAXSDK_BMM_LIBRARY} )
${MAXSDK_BMM_LIBRARY})
else(MAXSDK_FOUND)
# parse maxversion.h to determine SDK version
IF(EXISTS "${MAXSDK_DIR}/include/maxversion.h")
FILE(STRINGS "${MAXSDK_DIR}/include/maxversion.h" LINES REGEX "#define MAX_PRODUCT_YEAR_NUMBER ([0-9]+)")
STRING(REGEX REPLACE ".+MAX_PRODUCT_YEAR_NUMBER ([0-9]+)" "\\1" MAXSDK_VERSION "${LINES}")
UNSET(LINES)
ELSE()
SET(MAXSDK_VERSION "Unknown")
ENDIF()
MESSAGE(STATUS "Found 3dsmax version ${MAXSDK_VERSION} in ${MAXSDK_DIR}")
# 3ds Max 2013 and later are always Unicode
IF(MAXSDK_VERSION VERSION_GREATER 2012)
SET(MAXSDK_DEFINITIONS -DUNICODE -D_UNICODE)
ELSE()
SET(MAXSDK_DEFINITIONS)
ENDIF()
ELSE()
set(MAXSDK_LIBRARIES)
endif(MAXSDK_FOUND)
ENDIF()
mark_as_advanced(MAXSDK_INCLUDE_DIR MAXSDK_LIBRARY)

@ -7,7 +7,7 @@
IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
# in cache already
SET(CEGUI_FIND_QUIETLY TRUE)
ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
ENDIF()
FIND_PATH(CEGUI_INCLUDE_DIRS
@ -45,9 +45,9 @@ IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
SET(CEGUI_INCLUDE_DIRS "${CEGUI_INCLUDE_DIRS}/CEGUI")
IF(NOT CEGUI_FIND_QUIETLY)
MESSAGE(STATUS "Found CEGUI: ${CEGUI_LIBRARY}")
ENDIF(NOT CEGUI_FIND_QUIETLY)
ELSE(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
ENDIF()
ELSE()
IF(NOT CEGUI_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find CEGUI!")
ENDIF(NOT CEGUI_FIND_QUIETLY)
ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
ENDIF()
ENDIF()

@ -10,7 +10,7 @@
IF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR)
# in cache already
SET(CPPTEST_FIND_QUIETLY TRUE)
ENDIF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR)
ENDIF()
FIND_PATH(CPPTEST_INCLUDE_DIR
cpptest.h
@ -30,7 +30,7 @@ SET(LIBRARY_NAME_DEBUG cpptestd)
IF(WITH_STLPORT)
SET(LIBRARY_NAME_RELEASE cpptest_stlport ${LIBRARY_NAME_RELEASE})
SET(LIBRARY_NAME_DEBUG cpptest_stlportd ${LIBRARY_NAME_DEBUG})
ENDIF(WITH_STLPORT)
ENDIF()
FIND_LIBRARY(CPPTEST_LIBRARY_RELEASE
${LIBRARY_NAME_RELEASE}
@ -67,18 +67,18 @@ IF(CPPTEST_INCLUDE_DIR)
SET(CPPTEST_LIBRARIES "optimized;${CPPTEST_LIBRARY_RELEASE}")
IF(CPPTEST_LIBRARY_DEBUG)
SET(CPPTEST_LIBRARIES "${CPPTEST_LIBRARIES};debug;${CPPTEST_LIBRARY_DEBUG}")
ENDIF(CPPTEST_LIBRARY_DEBUG)
ENDIF(CPPTEST_LIBRARY_RELEASE)
ENDIF(CPPTEST_INCLUDE_DIR)
ENDIF()
ENDIF()
ENDIF()
IF(CPPTEST_FOUND)
IF(NOT CPPTEST_FIND_QUIETLY)
MESSAGE(STATUS "Found CppTest: ${CPPTEST_LIBRARIES}")
ENDIF(NOT CPPTEST_FIND_QUIETLY)
ELSE(CPPTEST_FOUND)
ENDIF()
ELSE()
IF(NOT CPPTEST_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find CppTest!")
ENDIF(NOT CPPTEST_FIND_QUIETLY)
ENDIF(CPPTEST_FOUND)
ENDIF()
ENDIF()
MARK_AS_ADVANCED(CPPTEST_LIBRARY_RELEASE CPPTEST_LIBRARY_DEBUG)

@ -6,20 +6,20 @@
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF(CustomMFC_FIND_REQUIRED)
ENDIF()
IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
IF(VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(VC_DIR)
ENDIF()
FIND_PATH(MFC_DIR
include/afxwin.h
HINTS
${MFC_STANDARD_DIR}
)
ENDIF(NOT MFC_DIR)
ENDIF()
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
@ -33,18 +33,18 @@ IF(MFC_FOUND)
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
ELSE(TARGET_X64)
ELSE()
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
ENDIF(TARGET_X64)
ENDIF()
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
# Set definitions for using MFC in DLL
SET(MFC_DEFINITIONS -D_AFXDLL)
SET(MFC_DEFINITIONS -D_AFXDLL -DUNICODE -D_UNICODE)
# 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

@ -8,7 +8,7 @@
if(DSOUND_INCLUDE_DIR)
# Already in cache, be silent
set(DSOUND_FIND_QUIETLY TRUE)
endif(DSOUND_INCLUDE_DIR)
ENDIF()
find_path(DSOUND_INCLUDE_DIR dsound.h
"$ENV{DXSDK_DIR}"
@ -29,8 +29,8 @@ find_package_handle_standard_args(DSOUND DEFAULT_MSG
if(DSOUND_FOUND)
set(DSOUND_LIBRARIES ${DSOUND_LIBRARY})
else(DSOUND_FOUND)
ELSE()
set(DSOUND_LIBRARIES)
endif(DSOUND_FOUND)
ENDIF()
mark_as_advanced(DSOUND_INCLUDE_DIR DSOUND_LIBRARY)

@ -8,7 +8,7 @@
IF(DXSDK_DIR)
# Already in cache, be silent
SET(DXSDK_FIND_QUIETLY TRUE)
ENDIF(DXSDK_DIR)
ENDIF()
FIND_PATH(DXSDK_DIR
"Include/dxsdkver.h"
@ -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,13 +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)
#FIND_DXSDK_LIBRARY(DXSDK_MESH_LIBRARY mesh)
#FIND_DXSDK_LIBRARY(DXSDK_MAXUTIL_LIBRARY maxutil)
#FIND_DXSDK_LIBRARY(DXSDK_MAXSCRIPT_LIBRARY maxscrpt)
#FIND_DXSDK_LIBRARY(DXSDK_PARAMBLK2_LIBRARY paramblk2)
#FIND_DXSDK_LIBRARY(DXSDK_BMM_LIBRARY bmm)
ENDIF(DXSDK_DIR)
ENDIF()
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
# all listed variables are TRUE.

@ -7,7 +7,7 @@
IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
# in cache already
SET(EFXUTIL_FIND_QUIETLY TRUE)
ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
ENDIF()
FIND_PATH(EFXUTIL_INCLUDE_DIR
@ -42,9 +42,9 @@ IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
SET(EFXUTIL_FOUND "YES")
IF(NOT EFXUTIL_FIND_QUIETLY)
MESSAGE(STATUS "Found EFX-Util: ${EFXUTIL_LIBRARY}")
ENDIF(NOT EFXUTIL_FIND_QUIETLY)
ELSE(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT EFXUTIL_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find EFX-Util!")
ENDIF(NOT EFXUTIL_FIND_QUIETLY)
ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
ENDIF()
ENDIF()

@ -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
@ -16,7 +16,7 @@ IF(WITH_STLPORT)
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external_stlport ${CMAKE_CURRENT_SOURCE_DIR}/../external_stlport ${EXTERNAL_TEMP_PATH})
SET(EXTERNAL_TEMP_FILE "include/stlport/string")
SET(EXTERNAL_NAME "external with STLport")
ENDIF(WITH_STLPORT)
ENDIF()
FIND_PATH(EXTERNAL_PATH
${EXTERNAL_TEMP_FILE}
@ -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)

@ -0,0 +1,173 @@
# vim: ts=2 sw=2
# - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
#
# Once done this will define
# FFMPEG_FOUND - System has the all required components.
# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers.
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components.
#
# For each of the components it will additionaly set.
# - AVCODEC
# - AVDEVICE
# - AVFORMAT
# - AVUTIL
# - POSTPROC
# - SWSCALE
# - SWRESAMPLE
# the following variables will be defined
# <component>_FOUND - System has <component>
# <component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
# <component>_LIBRARIES - Link these to use <component>
# <component>_DEFINITIONS - Compiler switches required for using <component>
# <component>_VERSION - The components version
#
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
#
# Redistribution and use is allowed according to the terms of the BSD license.
include(FindPackageHandleStandardArgs)
if(NOT FFmpeg_FIND_COMPONENTS)
set(FFmpeg_FIND_COMPONENTS AVFORMAT AVCODEC AVUTIL)
endif()
#
### Macro: set_component_found
#
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
#
macro(set_component_found _component)
if(${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
# message(STATUS " - ${_component} found.")
set(${_component}_FOUND TRUE)
else()
# message(STATUS " - ${_component} not found.")
endif()
endmacro()
#
### Macro: find_component
#
# Checks for the given component by invoking pkgconfig and then looking up the libraries and
# include directories.
#
macro(find_component _component _pkgconfig _library _header)
if(NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_${_component} ${_pkgconfig})
endif()
endif()
find_path(${_component}_INCLUDE_DIRS ${_header}
HINTS
${FFMPEGSDK_INC}
${PC_LIB${_component}_INCLUDEDIR}
${PC_LIB${_component}_INCLUDE_DIRS}
PATH_SUFFIXES
ffmpeg
)
find_library(${_component}_LIBRARIES NAMES ${_library}
HINTS
${FFMPEGSDK_LIB}
${PC_LIB${_component}_LIBDIR}
${PC_LIB${_component}_LIBRARY_DIRS}
)
STRING(REGEX REPLACE "/.*" "/version.h" _ver_header ${_header})
if(EXISTS "${${_component}_INCLUDE_DIRS}/${_ver_header}")
file(STRINGS "${${_component}_INCLUDE_DIRS}/${_ver_header}" version_str REGEX "^#define[\t ]+LIB${_component}_VERSION_M.*")
foreach(_str "${version_str}")
if(NOT version_maj)
string(REGEX REPLACE "^.*LIB${_component}_VERSION_MAJOR[\t ]+([0-9]*).*$" "\\1" version_maj "${_str}")
endif()
if(NOT version_min)
string(REGEX REPLACE "^.*LIB${_component}_VERSION_MINOR[\t ]+([0-9]*).*$" "\\1" version_min "${_str}")
endif()
if(NOT version_mic)
string(REGEX REPLACE "^.*LIB${_component}_VERSION_MICRO[\t ]+([0-9]*).*$" "\\1" version_mic "${_str}")
endif()
endforeach()
unset(version_str)
set(${_component}_VERSION "${version_maj}.${version_min}.${version_mic}" CACHE STRING "The ${_component} version number.")
unset(version_maj)
unset(version_min)
unset(version_mic)
endif(EXISTS "${${_component}_INCLUDE_DIRS}/${_ver_header}")
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
set_component_found(${_component})
mark_as_advanced(
${_component}_INCLUDE_DIRS
${_component}_LIBRARIES
${_component}_DEFINITIONS
${_component}_VERSION)
endmacro()
set(FFMPEGSDK $ENV{FFMPEG_HOME})
if(FFMPEGSDK)
set(FFMPEGSDK_INC "${FFMPEGSDK}/include")
set(FFMPEGSDK_LIB "${FFMPEGSDK}/lib")
endif()
# Check for all possible components.
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h)
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
foreach(_component ${FFmpeg_FIND_COMPONENTS})
if(${_component}_FOUND)
# message(STATUS "Required component ${_component} present.")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
else()
# message(STATUS "Required component ${_component} missing.")
endif()
endforeach()
# Build the include path and library list with duplicates removed.
if(FFMPEG_INCLUDE_DIRS)
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
endif()
if(FFMPEG_LIBRARIES)
list(REMOVE_DUPLICATES FFMPEG_LIBRARIES)
endif()
# cache the vars.
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE)
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE)
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE)
mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS)
# Now set the noncached _FOUND vars for the components.
foreach(_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWRESAMPLE SWSCALE)
set_component_found(${_component})
endforeach ()
# Compile the list of required vars
set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
foreach(_component ${FFmpeg_FIND_COMPONENTS})
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
endforeach()
# Give a nice error message if some of the required vars are missing.
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})

@ -7,7 +7,7 @@
IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
# in cache already
SET(FMOD_FIND_QUIETLY TRUE)
ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
ENDIF()
FIND_PATH(FMOD_INCLUDE_DIR
@ -25,9 +25,9 @@ FIND_PATH(FMOD_INCLUDE_DIR
IF(TARGET_X64)
SET(FMOD_LIBRARY_NAMES fmod64 fmod)
ELSE(TARGET_X64)
ELSE()
SET(FMOD_LIBRARY_NAMES fmodvc fmod)
ENDIF(TARGET_X64)
ENDIF()
FIND_LIBRARY(FMOD_LIBRARY
NAMES
@ -49,9 +49,9 @@ IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
SET(FMOD_FOUND "YES")
IF(NOT FMOD_FIND_QUIETLY)
MESSAGE(STATUS "Found FMOD: ${FMOD_LIBRARY}")
ENDIF(NOT FMOD_FIND_QUIETLY)
ELSE(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT FMOD_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FMOD!")
ENDIF(NOT FMOD_FIND_QUIETLY)
ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
ENDIF()
ENDIF()

@ -7,7 +7,7 @@
IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
# in cache already
SET(Freetype_FIND_QUIETLY TRUE)
ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
ENDIF()
FIND_PATH(FREETYPE_INCLUDE_DIRS
freetype
@ -24,7 +24,7 @@ FIND_PATH(FREETYPE_INCLUDE_DIRS
IF(NOT FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_INCLUDE_DIRS "")
ENDIF(NOT FREETYPE_INCLUDE_DIRS)
ENDIF()
# ft2build.h does not reside in the freetype include dir
FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
@ -42,7 +42,7 @@ FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
# combine both include directories into one variable
IF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR})
ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
ENDIF()
FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE
NAMES freetype libfreetype freetype219 freetype246
@ -89,8 +89,8 @@ IF(FREETYPE_INCLUDE_DIRS)
# Case where Freetype is compiled from sources (debug version is compiled by default)
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG})
ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
ENDIF(FREETYPE_INCLUDE_DIRS)
ENDIF()
ENDIF()
IF(FREETYPE_FOUND)
IF(WITH_STATIC_EXTERNAL AND APPLE)
@ -98,13 +98,13 @@ IF(FREETYPE_FOUND)
IF(BZIP2_FOUND)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR})
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES})
ENDIF(BZIP2_FOUND)
ENDIF(WITH_STATIC_EXTERNAL AND APPLE)
ENDIF()
ENDIF()
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}")
ENDIF(NOT Freetype_FIND_QUIETLY)
ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
ENDIF()
ELSE()
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FreeType!")
ENDIF(NOT Freetype_FIND_QUIETLY)
ENDIF(FREETYPE_FOUND)
ENDIF()
ENDIF()

@ -0,0 +1,959 @@
MACRO(CONVERT_NUMBER_VERSION _VERSION_NUMBER _BASE _OUT)
SET(${_OUT})
SET(_NUMBER ${_VERSION_NUMBER})
WHILE(_NUMBER GREATER 0)
MATH(EXPR _TEMP "${_NUMBER} % ${_BASE}")
LIST(APPEND ${_OUT} ${_TEMP})
MATH(EXPR _NUMBER "${_NUMBER} / ${_BASE}")
ENDWHILE()
ENDMACRO(CONVERT_NUMBER_VERSION)
FUNCTION(JOIN VALUES GLUE OUTPUT)
STRING(REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}")
STRING(REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping
SET(${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
ENDFUNCTION()
MACRO(PARSE_VERSION_OTHER FILENAME)
IF(EXISTS ${FILENAME})
SET(_FILTER_ARRAY ${ARGN})
JOIN("${_FILTER_ARRAY}" "|" _FILTER_REGEX)
FILE(STRINGS ${FILENAME} _FILE REGEX "(${_FILTER_REGEX})[: \t=\(\)\"]+([0-9.]+)")
IF(_FILE)
FOREACH(_LINE ${_FILE})
FOREACH(_VAR ${_FILTER_ARRAY})
IF("${${_VAR}}" STREQUAL "")
STRING(REGEX REPLACE "^.*${_VAR}[: \t=\(\)\"]+([0-9.]+).*$" "\\1" ${_VAR} "${_LINE}")
IF(${_VAR} STREQUAL "${_LINE}")
SET(${_VAR})
ENDIF()
IF(NOT ${_VAR} AND NOT STREQUAL "0")
SET(${_VAR} 0)
ENDIF()
ENDIF()
ENDFOREACH()
ENDFOREACH()
ENDIF()
ENDIF()
ENDMACRO()
# macro to define FIND_PACKAGE options with a different package name
MACRO(FIX_PACKAGE_OPTIONS OLDNAME NEWNAME)
# append other options if needed
SET(_OPTIONS COMPONENTS REQUIRED QUIETLY)
# process each options
FOREACH(_OPTION ${_OPTIONS})
SET(OLD_OPTION ${OLDNAME}_FIND_${_OPTION})
IF(DEFINED )
SET(NEW_OPTION ${NEWNAME}_FIND_${_OPTION})
SET(${NEW_OPTION} ${OLD_OPTION})
ENDIF()
ENDFOREACH()
ENDMACRO()
MACRO(FIND_PACKAGE_HELPER NAME INCLUDE)
# Looks for a directory containing NAME.
#
# NAME is the name of the library, lowercase and uppercase can be mixed
# It should be EXACTLY (same case) the same part as XXXX in FindXXXX.cmake
#
# INCLUDE is the file to check for includes
#
# Following parameters are optional variables and must be prefixed by:
#
# RELEASE is the list of libraries to check in release mode
# DEBUG is the list of libraries to check in debug mode
# SUFFIXES is the PATH_SUFFIXES to check for include file
# QUIET don't display anything
# VERBOSE display more details if not found
# REQUIRED throw an error if not found
# DIR is the base directory where to look for
#
# The first match will be used in the specified order and next matches will be ignored
#
# The following values are defined
# NAME_INCLUDE_DIR - where to find NAME
# NAME_LIBRARIES - link against these to use NAME
# NAME_FOUND - True if NAME is available.
SET(_PARAMS ${ARGN})
SET(_RELEASE_LIBRARIES)
SET(_DEBUG_LIBRARIES)
SET(_SUFFIXES)
SET(_BASE_DIRECTORIES)
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_SUFFIXES OFF)
SET(_IS_VERBOSE OFF)
SET(_IS_DIR OFF)
IF(_PARAMS)
FOREACH(_PARAM ${_PARAMS})
IF(_PARAM STREQUAL "RELEASE")
SET(_IS_RELEASE ON)
SET(_IS_DEBUG OFF)
SET(_IS_SUFFIXES OFF)
SET(_IS_DIR OFF)
ELSEIF(_PARAM STREQUAL "DEBUG")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG ON)
SET(_IS_SUFFIXES OFF)
SET(_IS_DIR OFF)
ELSEIF(_PARAM STREQUAL "SUFFIXES")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_DIR OFF)
SET(_IS_SUFFIXES ON)
ELSEIF(_PARAM STREQUAL "QUIET")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_SUFFIXES OFF)
SET(_IS_DIR OFF)
SET(${NAME}_FIND_QUIETLY ON)
ELSEIF(_PARAM STREQUAL "VERBOSE")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_SUFFIXES OFF)
SET(_IS_DIR OFF)
SET(_IS_VERBOSE ON)
ELSEIF(_PARAM STREQUAL "REQUIRED")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_SUFFIXES OFF)
SET(_IS_DIR OFF)
SET(${NAME}_FIND_REQUIRED ON)
ELSEIF(_PARAM STREQUAL "DIR")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_SUFFIXES OFF)
SET(_IS_DIR ON)
ELSE()
IF(_IS_RELEASE)
LIST(APPEND _RELEASE_LIBRARIES ${_PARAM})
ELSEIF(_IS_DEBUG)
LIST(APPEND _DEBUG_LIBRARIES ${_PARAM})
ELSEIF(_IS_SUFFIXES)
LIST(APPEND _SUFFIXES ${_PARAM})
ELSEIF(_IS_DIR)
LIST(APPEND _BASE_DIRECTORIES ${_PARAM})
ELSE()
MESSAGE(STATUS "parameter ${_PARAM} with no prefix")
ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()
# Fixes names if invalid characters are found
IF("${NAME}" MATCHES "^[a-zA-Z0-9]+$")
SET(_NAME_FIXED ${NAME})
ELSE()
# if invalid characters are detected, replace them by valid ones
STRING(REPLACE "+" "p" _NAME_FIXED ${NAME})
ENDIF()
# Create uppercase and lowercase versions of NAME
STRING(TOUPPER ${NAME} _UPNAME)
STRING(TOLOWER ${NAME} _LOWNAME)
STRING(TOUPPER ${_NAME_FIXED} _UPNAME_FIXED)
STRING(TOLOWER ${_NAME_FIXED} _LOWNAME_FIXED)
SET(_SUFFIXES ${_SUFFIXES} ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME})
# Don't use pkg-config
# IF(NOT WIN32 AND NOT IOS)
# FIND_PACKAGE(PkgConfig QUIET)
# SET(_MODULES ${_LOWNAME} ${_RELEASE_LIBRARIES})
# LIST(REMOVE_DUPLICATES _MODULES)
# IF(PKG_CONFIG_EXECUTABLE)
# PKG_SEARCH_MODULE(PKG_${_NAME_FIXED} QUIET ${_MODULES})
# ENDIF()
# ENDIF()
SET(_INCLUDE_PATHS)
SET(_LIBRARY_PATHS)
# Check for root directories passed to CMake with -DXXX_DIR=...
IF(DEFINED ${_UPNAME_FIXED}_DIR)
SET(_TMP ${${_UPNAME_FIXED}_DIR})
GET_FILENAME_COMPONENT(_TMP ${_TMP} ABSOLUTE)
LIST(APPEND _INCLUDE_PATHS ${_TMP}/include ${_TMP})
LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX})
IF(_IS_VERBOSE)
MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}")
ENDIF()
ENDIF()
IF(DEFINED ${_UPNAME}_DIR)
SET(_TMP ${${_UPNAME}_DIR})
LIST(APPEND _INCLUDE_PATHS ${_TMP}/include ${_TMP})
LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX})
IF(_IS_VERBOSE)
MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}")
ENDIF()
ENDIF()
IF(_BASE_DIRECTORIES)
FOREACH(_DIR ${_BASE_DIRECTORIES})
IF(_DIR)
LIST(APPEND _INCLUDE_PATHS ${_DIR}/include ${_DIR})
LIST(APPEND _LIBRARY_PATHS ${_DIR}/lib${LIB_SUFFIX})
IF(_IS_VERBOSE)
MESSAGE(STATUS "Using ${_DIR} as root directory")
ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()
IF(UNIX)
# Append UNIX standard include paths
SET(_UNIX_INCLUDE_PATHS)
# Append multiarch include paths
IF(CMAKE_LIBRARY_ARCHITECTURE)
LIST(APPEND _UNIX_INCLUDE_PATHS
/usr/local/include/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/include/${CMAKE_LIBRARY_ARCHITECTURE})
ENDIF()
LIST(APPEND _UNIX_INCLUDE_PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include)
ENDIF()
IF(_IS_VERBOSE)
MESSAGE(STATUS "Searching header ${INCLUDE} in: ${_INCLUDE_PATHS} with suffixes ${_SUFFIXES}")
ENDIF()
# Search for include directory
FIND_PATH(${_UPNAME_FIXED}_INCLUDE_DIR
NAMES ${INCLUDE}
HINTS
${PKG_${_NAME_FIXED}_INCLUDE_DIRS}
${_INCLUDE_PATHS}
$ENV{${_UPNAME}_DIR}/include
$ENV{${_UPNAME_FIXED}_DIR}/include
$ENV{${_UPNAME}_DIR}
$ENV{${_UPNAME_FIXED}_DIR}
PATHS
${_UNIX_INCLUDE_PATHS}
PATH_SUFFIXES
${_SUFFIXES}
DOC "Include path for ${NAME}"
)
IF(_IS_VERBOSE)
IF(${_UPNAME_FIXED}_INCLUDE_DIR)
MESSAGE(STATUS "${INCLUDE} found in ${${_UPNAME_FIXED}_INCLUDE_DIR}")
ELSE()
MESSAGE(STATUS "${INCLUDE} not found")
ENDIF()
ENDIF()
# Append environment variables XXX_DIR
LIST(APPEND _LIBRARY_PATHS
$ENV{${_UPNAME}_DIR}/lib${LIB_SUFFIX}
$ENV{${_UPNAME_FIXED}_DIR}/lib${LIB_SUFFIX})
IF(UNIX)
SET(_UNIX_LIBRARY_PATHS)
# Append multiarch libraries paths
IF(CMAKE_LIBRARY_ARCHITECTURE)
LIST(APPEND _UNIX_LIBRARY_PATHS
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE})
ENDIF()
# Append UNIX standard libraries paths
LIST(APPEND _UNIX_LIBRARY_PATHS
/usr/local/lib
/usr/lib
/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib${LIB_SUFFIX})
ENDIF()
LIST(APPEND _RELEASE_LIBRARIES ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME} ${_NAME_FIXED})
LIST(APPEND _DEBUG_LIBRARIES ${_LOWNAME}d ${_LOWNAME_FIXED}d ${NAME}d ${_NAME_FIXED}d)
# Under Windows, some libs may need the lib prefix
IF(WIN32)
SET(_LIBS ${_RELEASE_LIBRARIES})
FOREACH(_LIB ${_LIBS})
LIST(APPEND _RELEASE_LIBRARIES lib${_LIB})
ENDFOREACH()
SET(_LIBS ${_DEBUG_LIBRARIES})
FOREACH(_LIB ${_LIBS})
LIST(APPEND _DEBUG_LIBRARIES lib${_LIB})
ENDFOREACH()
ENDIF()
LIST(REMOVE_DUPLICATES _RELEASE_LIBRARIES)
LIST(REMOVE_DUPLICATES _DEBUG_LIBRARIES)
# Search for release library
FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_RELEASE
NAMES
${_RELEASE_LIBRARIES}
HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS}
PATHS
${_LIBRARY_PATHS}
${_UNIX_LIBRARY_PATHS}
NO_CMAKE_SYSTEM_PATH
)
IF(_IS_VERBOSE)
IF(${_UPNAME_FIXED}_LIBRARY_RELEASE)
MESSAGE(STATUS "${NAME} release library found: ${${_UPNAME_FIXED}_LIBRARY_RELEASE}")
ELSE()
MESSAGE(STATUS "${NAME} release library not found in ${_LIBRARY_PATHS};${_UNIX_LIBRARY_PATHS}")
ENDIF()
ENDIF()
# Search for debug library
FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_DEBUG
NAMES
${_DEBUG_LIBRARIES}
HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS}
PATHS
${_LIBRARY_PATHS}
${_UNIX_LIBRARY_PATHS}
NO_CMAKE_SYSTEM_PATH
)
IF(_IS_VERBOSE)
IF(${_UPNAME_FIXED}_LIBRARY_DEBUG)
MESSAGE(STATUS "${NAME} debug library found: ${${_UPNAME_FIXED}_LIBRARY_DEBUG}")
ELSE()
MESSAGE(STATUS "${NAME} debug library not found")
ENDIF()
ENDIF()
SET(${_UPNAME_FIXED}_FOUND OFF)
IF(${_UPNAME_FIXED}_INCLUDE_DIR)
# Set also _INCLUDE_DIRS
SET(${_UPNAME_FIXED}_INCLUDE_DIRS ${${_UPNAME_FIXED}_INCLUDE_DIR})
ENDIF()
# Library has been found if at least only one library and include are found
IF(${_UPNAME_FIXED}_LIBRARY_RELEASE AND ${_UPNAME_FIXED}_LIBRARY_DEBUG)
# Release and debug libraries found
SET(${_UPNAME_FIXED}_FOUND ON)
SET(${_UPNAME_FIXED}_LIBRARIES optimized ${${_UPNAME_FIXED}_LIBRARY_RELEASE} debug ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
ELSEIF(${_UPNAME_FIXED}_LIBRARY_RELEASE)
# Release library found
SET(${_UPNAME_FIXED}_FOUND ON)
SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
ELSEIF(${_UPNAME_FIXED}_LIBRARY_DEBUG)
# Debug library found
SET(${_UPNAME_FIXED}_FOUND ON)
SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
ENDIF()
IF(${_UPNAME_FIXED}_FOUND)
IF(NOT ${NAME}_FIND_QUIETLY)
MESSAGE(STATUS "Found ${NAME}: ${${_UPNAME_FIXED}_LIBRARIES}")
ENDIF()
ELSE()
IF(${NAME}_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Error: Unable to find ${NAME}!")
ENDIF()
IF(NOT ${NAME}_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find ${NAME}!")
ENDIF()
ENDIF()
MARK_AS_ADVANCED(${_UPNAME_FIXED}_LIBRARY_RELEASE ${_UPNAME_FIXED}_LIBRARY_DEBUG)
ENDMACRO()
MACRO(MESSAGE_VERSION_PACKAGE_HELPER NAME VERSION)
MESSAGE(STATUS "Found ${NAME} ${VERSION}: ${ARGN}")
ENDMACRO()
MACRO(FIND_LIBRARY_HELPER NAME)
# Looks for libraries.
#
# NAME is the name of the library, lowercase and uppercase can be mixed
#
# Following parameters are optional variables and must be prefixed by:
#
# RELEASE is the list of libraries to check in release mode
# DEBUG is the list of libraries to check in debug mode
# VERBOSE display more details if not found
# REQUIRED throw an error if not found
# DIR is the base directory where to look for
#
# The first match will be used in the specified order and next matches will be ignored
#
# The following values are defined
# NAME_LIBRARIES - link against these to use NAME
SET(_PARAMS ${ARGN})
SET(_RELEASE_LIBRARIES)
SET(_DEBUG_LIBRARIES)
SET(_BASE_DIRECTORIES)
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_VERBOSE OFF)
SET(_IS_DIR OFF)
IF(_PARAMS)
FOREACH(_PARAM ${_PARAMS})
IF(_PARAM STREQUAL "RELEASE")
SET(_IS_RELEASE ON)
SET(_IS_DEBUG OFF)
SET(_IS_DIR OFF)
ELSEIF(_PARAM STREQUAL "DEBUG")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG ON)
SET(_IS_DIR OFF)
ELSEIF(_PARAM STREQUAL "VERBOSE")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_DIR OFF)
SET(_IS_VERBOSE ON)
ELSEIF(_PARAM STREQUAL "REQUIRED")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_DIR OFF)
SET(${NAME}_FIND_REQUIRED ON)
ELSEIF(_PARAM STREQUAL "DIR")
SET(_IS_RELEASE OFF)
SET(_IS_DEBUG OFF)
SET(_IS_DIR ON)
ELSE()
IF(_IS_RELEASE)
LIST(APPEND _RELEASE_LIBRARIES ${_PARAM})
ELSEIF(_IS_DEBUG)
LIST(APPEND _DEBUG_LIBRARIES ${_PARAM})
ELSEIF(_IS_DIR)
LIST(APPEND _BASE_DIRECTORIES ${_PARAM})
ELSE()
MESSAGE(STATUS "parameter ${_PARAM} with no prefix")
ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()
# Fixes names if invalid characters are found
IF("${NAME}" MATCHES "^[a-zA-Z0-9]+$")
SET(_NAME_FIXED ${NAME})
ELSE()
# if invalid characters are detected, replace them by valid ones
STRING(REPLACE "+" "p" _NAME_FIXED ${NAME})
ENDIF()
# Create uppercase and lowercase versions of NAME
STRING(TOUPPER ${NAME} _UPNAME)
STRING(TOLOWER ${NAME} _LOWNAME)
STRING(TOUPPER ${_NAME_FIXED} _UPNAME_FIXED)
STRING(TOLOWER ${_NAME_FIXED} _LOWNAME_FIXED)
SET(_LIBRARY_PATHS)
# Check for root directories passed to CMake with -DXXX_DIR=...
IF(DEFINED ${_UPNAME_FIXED}_DIR)
SET(_TMP ${${_UPNAME_FIXED}_DIR})
GET_FILENAME_COMPONENT(_TMP ${_TMP} ABSOLUTE)
LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX})
IF(_IS_VERBOSE)
MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}")
ENDIF()
ENDIF()
IF(DEFINED ${_UPNAME}_DIR)
SET(_TMP ${${_UPNAME}_DIR})
LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX})
IF(_IS_VERBOSE)
MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}")
ENDIF()
ENDIF()
IF(_BASE_DIRECTORIES)
FOREACH(_DIR ${_BASE_DIRECTORIES})
IF(_DIR)
LIST(APPEND _LIBRARY_PATHS ${_DIR}/lib${LIB_SUFFIX})
IF(_IS_VERBOSE)
MESSAGE(STATUS "Using ${_DIR} as root directory")
ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()
# Append environment variables XXX_DIR
LIST(APPEND _LIBRARY_PATHS
$ENV{${_UPNAME}_DIR}/lib${LIB_SUFFIX}
$ENV{${_UPNAME_FIXED}_DIR}/lib${LIB_SUFFIX})
IF(UNIX)
SET(_UNIX_LIBRARY_PATHS)
# Append multiarch libraries paths
IF(CMAKE_LIBRARY_ARCHITECTURE)
LIST(APPEND _UNIX_LIBRARY_PATHS
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE})
ENDIF()
# Append UNIX standard libraries paths
LIST(APPEND _UNIX_LIBRARY_PATHS
/usr/local/lib
/usr/lib
/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib${LIB_SUFFIX})
ENDIF()
LIST(APPEND _RELEASE_LIBRARIES ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME} ${_NAME_FIXED})
LIST(APPEND _DEBUG_LIBRARIES ${_LOWNAME}d ${_LOWNAME_FIXED}d ${NAME}d ${_NAME_FIXED}d)
# Under Windows, some libs may need the lib prefix
IF(WIN32)
SET(_LIBS ${_RELEASE_LIBRARIES})
FOREACH(_LIB ${_LIBS})
LIST(APPEND _RELEASE_LIBRARIES lib${_LIB})
ENDFOREACH()
SET(_LIBS ${_DEBUG_LIBRARIES})
FOREACH(_LIB ${_LIBS})
LIST(APPEND _DEBUG_LIBRARIES lib${_LIB})
ENDFOREACH()
ENDIF()
LIST(REMOVE_DUPLICATES _RELEASE_LIBRARIES)
LIST(REMOVE_DUPLICATES _DEBUG_LIBRARIES)
# Search for release library
FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_RELEASE
NAMES
${_RELEASE_LIBRARIES}
HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS}
PATHS
${_LIBRARY_PATHS}
${_UNIX_LIBRARY_PATHS}
NO_CMAKE_SYSTEM_PATH
)
IF(_IS_VERBOSE)
IF(${_UPNAME_FIXED}_LIBRARY_RELEASE)
MESSAGE(STATUS "${NAME} release library found: ${${_UPNAME_FIXED}_LIBRARY_RELEASE}")
ELSE()
MESSAGE(STATUS "${NAME} release library not found in ${_LIBRARY_PATHS};${_UNIX_LIBRARY_PATHS}")
ENDIF()
ENDIF()
# Search for debug library
FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_DEBUG
NAMES
${_DEBUG_LIBRARIES}
HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS}
PATHS
${_LIBRARY_PATHS}
${_UNIX_LIBRARY_PATHS}
NO_CMAKE_SYSTEM_PATH
)
IF(_IS_VERBOSE)
IF(${_UPNAME_FIXED}_LIBRARY_DEBUG)
MESSAGE(STATUS "${NAME} debug library found: ${${_UPNAME_FIXED}_LIBRARY_DEBUG}")
ELSE()
MESSAGE(STATUS "${NAME} debug library not found")
ENDIF()
ENDIF()
# Library has been found if at least only one library and include are found
IF(${_UPNAME_FIXED}_LIBRARY_RELEASE AND ${_UPNAME_FIXED}_LIBRARY_DEBUG)
# Release and debug libraries found
SET(${_UPNAME_FIXED}_LIBRARIES optimized ${${_UPNAME_FIXED}_LIBRARY_RELEASE} debug ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
ELSEIF(${_UPNAME_FIXED}_LIBRARY_RELEASE)
# Release library found
SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
ELSEIF(${_UPNAME_FIXED}_LIBRARY_DEBUG)
# Debug library found
SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
ENDIF()
MARK_AS_ADVANCED(${_UPNAME_FIXED}_LIBRARY_RELEASE ${_UPNAME_FIXED}_LIBRARY_DEBUG)
ENDMACRO()
MACRO(FIND_LIBCURL)
IF(NOT CURL_FOUND)
FIND_PACKAGE(CURL REQUIRED)
IF(WIN32 OR CURL_LIBRARY MATCHES "\\.a" OR WITH_STATIC_CURL)
SET(CURL_STATIC ON)
ELSE()
SET(CURL_STATIC OFF)
ENDIF()
IF(CURL_STATIC)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
IF(UNIX)
# CURL can depend on libidn
FIND_LIBRARY(IDN_LIBRARY idn)
IF(IDN_LIBRARY)
LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY})
ENDIF()
# CURL Macports version can depend on libidn, libintl and libiconv too
IF(APPLE)
FIND_LIBRARY(INTL_LIBRARY intl)
IF(INTL_LIBRARY)
LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY})
ENDIF()
ELSE()
# Only used by libcurl under Linux
FIND_PACKAGE(OpenSSL REQUIRED)
#IF(WIN32)
# SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
#ENDIF()
# Only Linux version of libcurl depends on OpenSSL
LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
ENDIF()
ENDIF()
ENDIF()
ENDIF()
ENDMACRO()
MACRO(FIND_LIBXML2)
IF(NOT LIBXML2_FOUND)
FIND_PACKAGE(LibXml2 REQUIRED)
IF(WIN32 OR WITH_STATIC_LIBXML2)
LIST(APPEND LIBXML2_DEFINITIONS -DLIBXML_STATIC)
ENDIF()
IF(WITH_LIBXML2_ICONV)
FIND_PACKAGE(Iconv REQUIRED)
# LIST(APPEND CURL_INCLUDE_DIRS ${ICONV_INCLUDE_DIR})
LIST(APPEND LIBXML2_LIBRARIES ${ICONV_LIBRARIES})
ENDIF()
IF(WITH_STATIC)
# libxml2 could need winsock2 library
IF(WIN32)
FIND_LIBRARY(WINSOCK2_LIB ws2_32)
IF(WINSOCK2_LIB)
LIST(APPEND LIBXML2_LIBRARIES ${WINSOCK2_LIB})
ENDIF()
FIND_LIBRARY(CRYPT32_LIB Crypt32)
IF(CRYPT32_LIB)
LIST(APPEND LIBXML2_LIBRARIES ${CRYPT32_LIB})
ENDIF()
ELSE()
# under Linux and OS X, recent libxml2 versions are linked against liblzma
FIND_PACKAGE(LibLZMA)
IF(LIBLZMA_LIBRARIES)
LIST(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES})
ENDIF()
ENDIF()
ENDIF()
ENDIF()
ENDMACRO()
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})
LIST(APPEND QT_LIBRARIES optimized ${_LIB})
ENDIF()
SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}")
IF(EXISTS ${_LIB})
LIST(APPEND 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})
LIST(APPEND QT_LIBRARIES optimized ${_LIB})
ENDIF()
SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}")
IF(EXISTS ${_LIB})
LIST(APPEND QT_LIBRARIES debug ${_LIB})
ENDIF()
ENDMACRO()
MACRO(ADD_QT_SYSTEM_LIBRARY _NAME)
# Save default suffixes
SET(_OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
# Define specific suffixes
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
# Find the library with specified suffixes
FIND_LIBRARY(${_NAME}_LIBRARY NAMES ${_NAME})
# Restore default suffixes
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_OLD_SUFFIXES})
IF(${_NAME}_LIBRARY)
MESSAGE(STATUS "Found ${${_NAME}_LIBRARY} ${_NAME}")
LIST(APPEND QT_LIBRARIES ${${_NAME}_LIBRARY})
ELSE()
MESSAGE(STATUS "Didn't find ${_NAME}")
ENDIF()
ENDMACRO()
MACRO(FIND_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)
FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(Jpeg REQUIRED)
ADD_DEFINITIONS(-DQT_STATICPLUGIN)
SET(QT_LIBRARIES Qt5::Widgets)
# Gui
LIST(APPEND QT_LIBRARIES Qt5::Gui Qt5::OpenGL)
ADD_QT_LIBRARY(PrintSupport)
IF(WIN32)
LIST(APPEND 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)
LIST(APPEND 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(GlxSupport)
ADD_QT_LIBRARY(ServiceSupport)
ADD_QT_LIBRARY(EdidSupport)
ADD_QT_LIBRARY(FontDatabaseSupport)
ADD_QT_LIBRARY(ThemeSupport)
ADD_QT_LIBRARY(EventDispatcherSupport)
ADD_QT_LIBRARY(PlatformSupport)
ADD_QT_LIBRARY(DBus)
IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a")
LIST(APPEND QT_LIBRARIES "${QT_LIBRARY_DIR}/libxcb-static.a")
ENDIF()
# always link these in dynamic, API never changes
ADD_QT_SYSTEM_LIBRARY(X11)
ADD_QT_SYSTEM_LIBRARY(Xmu)
ADD_QT_SYSTEM_LIBRARY(X11-xcb)
ADD_QT_SYSTEM_LIBRARY(Xi)
ADD_QT_SYSTEM_LIBRARY(SM)
ADD_QT_SYSTEM_LIBRARY(ICE)
ADD_QT_SYSTEM_LIBRARY(xcb)
ADD_QT_SYSTEM_LIBRARY(GL)
ADD_QT_SYSTEM_LIBRARY(xcb-glx)
ADD_QT_SYSTEM_LIBRARY(fontconfig)
ADD_QT_SYSTEM_LIBRARY(Xrender)
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")
IF(NOT EXISTS ${HB_LIB})
SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzz.a")
ENDIF()
ELSEIF(WIN32)
SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib")
ENDIF()
IF(EXISTS ${HB_LIB})
LIST(APPEND QT_LIBRARIES ${HB_LIB})
ENDIF()
# freetype is needed since Qt 5.5
FIND_PACKAGE(Freetype)
IF(FREETYPE_FOUND)
LIST(APPEND QT_LIBRARIES ${FREETYPE_LIBRARIES})
ELSE()
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})
LIST(APPEND QT_LIBRARIES ${FREETYPE_LIB})
ENDIF()
ENDIF()
ADD_QT_PLUGIN(accessible qtaccessiblewidgets)
LIST(APPEND QT_LIBRARIES ${PNG_LIBRARIES} ${JPEG_LIBRARY})
# Network
LIST(APPEND QT_LIBRARIES Qt5::Network Qt5::Xml)
LIST(APPEND QT_LIBRARIES ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES})
IF(WIN32)
LIST(APPEND QT_LIBRARIES
${WINSDK_LIBRARY_DIR}/Crypt32.lib
${WINSDK_LIBRARY_DIR}/WS2_32.Lib
${WINSDK_LIBRARY_DIR}/IPHlpApi.Lib)
ENDIF()
# Core
LIST(APPEND QT_LIBRARIES Qt5::Core)
# pcre is needed since Qt 5.5
IF(UNIX)
SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a")
IF(NOT EXISTS ${PCRE_LIB})
SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre2.a")
ENDIF()
ELSEIF(WIN32)
SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib")
ENDIF()
IF(EXISTS ${PCRE_LIB})
LIST(APPEND QT_LIBRARIES ${PCRE_LIB})
ENDIF()
IF(APPLE)
FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre)
FIND_LIBRARY(SECURITY_FRAMEWORK Security)
LIST(APPEND QT_LIBRARIES
${PCRE_LIBRARY}
${FOUNDATION_FRAMEWORK}
${CARBON_FRAMEWORK}
${SECURITY_FRAMEWORK})
ELSEIF(UNIX)
FIND_PACKAGE(Threads)
LIST(APPEND QT_LIBRARIES ${ZLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} -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()
ENDMACRO()

@ -1,4 +1,4 @@
# - Try to find Iconv on Mac OS X
# - Try to find Iconv
# Once done this will define
#
# ICONV_FOUND - system has Iconv
@ -6,78 +6,59 @@
# ICONV_LIBRARIES - Link these to use Iconv
# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
#
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
IF(APPLE)
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
# Already in cache, be silent
SET(ICONV_FIND_QUIETLY TRUE)
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
IF(APPLE)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h
PATHS
/opt/local/include/
NO_CMAKE_SYSTEM_PATH
)
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c
PATHS
/opt/local/lib/
NO_CMAKE_SYSTEM_PATH
)
ENDIF(APPLE)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h PATHS /opt/local/include /sw/include)
string(REGEX REPLACE "(.*)/include/?" "\\1" ICONV_INCLUDE_BASE_DIR "${ICONV_INCLUDE_DIR}")
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c HINTS "${ICONV_INCLUDE_BASE_DIR}/lib" PATHS /opt/local/lib)
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
SET(ICONV_FOUND TRUE)
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
IF(ICONV_FOUND)
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
if(ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif(ICONV_HAVE_WERROR)
check_c_source_compiles("
#include <iconv.h>
int main(){
iconv_t conv = 0;
const char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;
iconv(conv, &in, &ilen, &out, &olen);
return 0;
}
" ICONV_SECOND_ARGUMENT_IS_CONST )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
ENDIF(ICONV_FOUND)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
IF(ICONV_FOUND)
IF(NOT ICONV_FIND_QUIETLY)
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
ENDIF(NOT ICONV_FIND_QUIETLY)
ELSE(ICONV_FOUND)
IF(Iconv_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Iconv")
ENDIF(Iconv_FIND_REQUIRED)
ENDIF(ICONV_FOUND)
MARK_AS_ADVANCED(
ICONV_INCLUDE_DIR
ICONV_LIBRARIES
ICONV_SECOND_ARGUMENT_IS_CONST
)
ENDIF(APPLE)
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
# Already in cache, be silent
SET(ICONV_FIND_QUIETLY TRUE)
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h HINTS /sw/include/ PATHS /opt/local)
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c PATHS /opt/local)
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
SET(ICONV_FOUND TRUE)
ENDIF()
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
IF(ICONV_FOUND)
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
if(ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
ENDIF()
check_c_source_compiles("
#include <iconv.h>
int main(){
iconv_t conv = 0;
const char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;
iconv(conv, &in, &ilen, &out, &olen);
return 0;
}
" ICONV_SECOND_ARGUMENT_IS_CONST )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
ENDIF()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
IF(ICONV_FOUND)
IF(NOT ICONV_FIND_QUIETLY)
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
ENDIF()
ELSE()
IF(Iconv_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Iconv")
ENDIF()
ENDIF()
MARK_AS_ADVANCED(
ICONV_INCLUDE_DIR
ICONV_LIBRARIES
ICONV_SECOND_ARGUMENT_IS_CONST
)

@ -7,7 +7,7 @@
IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
# in cache already
SET(JPEG_FIND_QUIETLY TRUE)
ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
ENDIF()
FIND_PATH(JPEG_INCLUDE_DIR
@ -42,9 +42,9 @@ IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
SET(JPEG_FOUND "YES")
IF(NOT JPEG_FIND_QUIETLY)
MESSAGE(STATUS "Found Jpeg: ${JPEG_LIBRARY}")
ENDIF(NOT JPEG_FIND_QUIETLY)
ELSE(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT JPEG_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Jpeg!")
ENDIF(NOT JPEG_FIND_QUIETLY)
ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
ENDIF()
ENDIF()

@ -7,10 +7,11 @@
IF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
# in cache already
SET(LIBOVR_FIND_QUIETLY TRUE)
ENDIF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
ENDIF()
FIND_PATH(LIBOVR_INCLUDE_DIR
OVR.h
NAMES
OVR.h OVR_CAPI.h
PATHS
$ENV{LIBOVR_DIR}/Include
/usr/local/include
@ -24,21 +25,21 @@ FIND_PATH(LIBOVR_INCLUDE_DIR
IF(UNIX)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/x86_64")
ELSE(TARGET_X64)
ELSE()
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/i386")
ENDIF(TARGET_X64)
ENDIF()
ELSEIF(APPLE)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/MacOS/Release")
ELSEIF(WIN32)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/x64")
ELSE(TARGET_X64)
ELSE()
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Win32")
ENDIF(TARGET_X64)
ENDIF(UNIX)
ENDIF()
ENDIF()
FIND_LIBRARY(LIBOVR_LIBRARY
NAMES ovr
NAMES ovr libovr
PATHS
$ENV{LIBOVR_DIR}/${LIBOVR_LIBRARY_BUILD_PATH}
/usr/local/lib
@ -55,16 +56,17 @@ FIND_LIBRARY(LIBOVR_LIBRARY
IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibOVR: ${LIBOVR_LIBRARY}")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
ENDIF()
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)
ELSE()
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY})
ENDIF(UNIX)
ELSE(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibOVR!")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
ENDIF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
ENDIF()
ENDIF()

@ -7,7 +7,7 @@
IF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
# in cache already
SET(LIBVR_FIND_QUIETLY TRUE)
ENDIF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
ENDIF()
FIND_PATH(LIBVR_INCLUDE_DIR hmd.h
PATH_SUFFIXES include/LibVR
@ -22,11 +22,12 @@ FIND_LIBRARY(LIBVR_LIBRARY
IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibVR: ${LIBVR_LIBRARY}")
ENDIF(NOT LIBVR_FIND_QUIETLY)
ENDIF()
SET(LIBVR_FOUND "YES")
SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR")
ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
SET(NL_STEREO_AVAILABLE ON)
ELSE()
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibVR!")
ENDIF(NOT LIBVR_FIND_QUIETLY)
ENDIF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
ENDIF()
ENDIF()

@ -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,47 +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)
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)
# 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.1")
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(LUALIB_FOUND)
SET(LUA50_LIBRARY "liblua5.0")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.3")
FIND_PACKAGE(Lua53 REQUIRED)
BREAK()
ENDIF()
ENDFOREACH()
IF(NOT LUALIB_FOUND)
# check for Lua 5.2
SET(LUA52_LIBRARIES liblua5.2 liblua-5.2 liblua.so.5.2)
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(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
@ -63,13 +97,57 @@ FIND_PATH(LUABIND_INCLUDE_DIR
/opt/include
)
SET(LIBRARY_NAME_RELEASE luabind libluabind)
SET(LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
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()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d)
ENDIF()
IF(WITH_LUA51)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua51d)
ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua51d)
ENDIF()
IF(WITH_LUA50)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua50d)
ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua50d)
ENDIF()
IF(WITH_STLPORT)
SET(LIBRARY_NAME_RELEASE luabind_stlport ${LIBRARY_NAME_RELEASE})
SET(LIBRARY_NAME_DEBUG luabind_stlportd ${LIBRARY_NAME_DEBUG})
ENDIF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlportd)
ENDIF()
# generic libraries names
LIST(APPEND LIBRARY_NAME_RELEASE luabind libluabind)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
FIND_LIBRARY(LUABIND_LIBRARY_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
@ -116,8 +194,8 @@ IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
# Case where Luabind is compiled from sources (debug version is compiled by default)
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG})
ENDIF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
ENDIF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
ENDIF()
ENDIF()
IF(LUABIND_FOUND)
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
@ -125,17 +203,17 @@ IF(LUABIND_FOUND)
FIND_FILE(LUABIND_VERSION_FILE luabind/version.hpp PATHS ${LUABIND_INCLUDE_DIR})
IF(LUABIND_VERSION_FILE)
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
ENDIF(LUABIND_VERSION_FILE)
ENDIF()
FIND_CORRECT_LUA_VERSION()
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
ENDIF(NOT Luabind_FIND_QUIETLY)
ELSE(LUABIND_FOUND)
ENDIF()
ELSE()
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Luabind!")
ENDIF(NOT Luabind_FIND_QUIETLY)
ENDIF(LUABIND_FOUND)
ENDIF()
ENDIF()
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)

@ -5,6 +5,24 @@
# VC_LIBRARY_DIR - where to find libraries
# VC_FOUND - True if MSVC found.
MACRO(ADD_TRAILING_SLASH _FILENAME_VAR)
# put content in a new variable
SET(_FILENAME ${${_FILENAME_VAR}})
# get length of the string
STRING(LENGTH ${_FILENAME} _LEN)
# convert length to last pos
MATH(EXPR _POS "${_LEN}-1")
# get last character of the string
STRING(SUBSTRING ${_FILENAME} ${_POS} 1 _FILENAME_END)
# compare it with a slash
IF(NOT _FILENAME_END STREQUAL "/")
# not a slash, append it
SET(${_FILENAME_VAR} "${_FILENAME}/")
ELSE()
# already a slash
ENDIF()
ENDMACRO()
MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
# Software/Wow6432Node/...
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE)
@ -12,10 +30,14 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR)
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
# be sure it's finishing by a /
ADD_TRAILING_SLASH(VC${_VERSION}_DIR)
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
ENDIF(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,73 +46,137 @@ 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)
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT VC_FOUND)
SET(VC${_VERSION}_FOUND OFF)
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT VC${_VERSION}_FOUND)
IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF()
IF(VC${_VERSION}_FOUND)
SET(VC_FOUND ON)
SET(VC_DIR "${VC${_VERSION}_DIR}")
ENDIF(VC${_VERSION}_FOUND)
ENDMACRO(DETECT_VC_VERSION)
IF(VC${_VERSION}_FOUND)
SET(VC_FOUND ON)
SET(VC_DIR "${VC${_VERSION}_DIR}")
ENDIF()
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")
IF(MSVC_VERSION GREATER 1909)
DETECT_VC_VERSION("15.0")
SET(MSVC_TOOLSET "140")
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 MSVC11_REDIST_DIR)
SET(VC_DIR "${VC_DIR}Tools/MSVC")
FILE(GLOB MSVC_TOOLCHAIN_VERSIONS RELATIVE ${VC_DIR} "${VC_DIR}/*")
IF(MSVC_TOOLCHAIN_VERSIONS)
LIST(SORT MSVC_TOOLCHAIN_VERSIONS)
LIST(REVERSE MSVC_TOOLCHAIN_VERSIONS)
ENDIF()
IF(NOT MSVC_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No MSVC version found in default search path ${VC_DIR}")
ENDIF()
LIST(GET MSVC_TOOLCHAIN_VERSIONS 0 MSVC_TOOLCHAIN_VERSION)
SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}")
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
ELSEIF(MSVC14)
DETECT_VC_VERSION("14.0")
SET(MSVC_TOOLSET "140")
ELSEIF(MSVC12)
DETECT_VC_VERSION("12.0")
SET(MSVC_TOOLSET "120")
ELSEIF(MSVC11)
DETECT_VC_VERSION("11.0")
IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR)
SET(MSVC_TOOLSET "110")
ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0")
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC10_REDIST_DIR)
SET(MSVC_TOOLSET "100")
ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0")
SET(MSVC_TOOLSET "90")
ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0")
ENDIF(MSVC12)
SET(MSVC_TOOLSET "80")
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)
# Fix path
FILE(TO_CMAKE_PATH ${VC_DIR} 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|BIN|Bin)/.+" "" VC_DIR ${_COMPILER})
ENDIF()
IF(NOT VC_INCLUDE_DIR AND VC_DIR AND EXISTS "${VC_DIR}")
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
IF(EXISTS "${VC_INCLUDE_DIR}")
SET(VC_FOUND ON)
ENDIF()
ENDIF()
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
IF(NOT EXISTS "${MSVC_REDIST_DIR}")
SET(MSVC_REDIST_DIR "${VC_DIR}/redist")
IF(NOT EXISTS "${MSVC_REDIST_DIR}")
SET(MSVC_REDIST_DIR)
ENDIF()
ENDIF()
IF(MSVC_REDIST_DIR)
IF(MSVC1411 OR MSVC1410)
# If you have VC++ 2017 Express, put x64/Microsoft.VC141.CRT/*.dll in ${EXTERNAL_PATH}/redist
# original files whould be in ${VC_DIR}/Redist/MSVC/14.11.25325/x64/Microsoft.VC141.CRT
SET(MSVC14_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC14)
SET(MSVC14_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC12)
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC12_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC11)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC11_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC10)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC90)
SET(MSVC90_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC80)
SET(MSVC80_REDIST_DIR "${MSVC_REDIST_DIR}")
ENDIF()
ENDIF()
MESSAGE(STATUS "Using headers from ${VC_INCLUDE_DIR}")
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${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.
@ -60,12 +60,12 @@ IF(Mercurial_HG_EXECUTABLE)
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} --version
OUTPUT_VARIABLE Mercurial_VERSION_HG
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE ".*version ([\\.0-9]+).*"
"\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}")
MACRO(Mercurial_WC_INFO dir prefix)
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}"
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} log -r . --template "{rev};{node};{tags};{author}"
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_INFO
ERROR_VARIABLE Mercurial_hg_info_error
@ -73,23 +73,23 @@ IF(Mercurial_HG_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE)
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)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log\" failed with output:\n${Mercurial_hg_info_error}")
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)

@ -13,13 +13,16 @@
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
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)
@ -33,7 +36,7 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
ELSE(WIN32 AND MSVC)
ELSE()
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient
PATHS
/usr/lib
@ -41,6 +44,8 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
/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,32 +55,36 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
/opt/local/lib/mysql55/mysql
/opt/local/lib/mysql51/mysql
)
ENDIF(WIN32 AND MSVC)
ENDIF()
IF(MYSQL_INCLUDE_DIR)
IF(MYSQL_LIBRARY_RELEASE)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE})
IF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_DEBUG})
ELSE(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_RELEASE})
ENDIF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE} debug ${MYSQL_LIBRARY_DEBUG})
ELSE()
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY_RELEASE})
ENDIF()
FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND)
IF(WIN32)
SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
ENDIF()
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
ENDIF(MYSQL_LIBRARY_RELEASE)
ENDIF(MYSQL_INCLUDE_DIR)
ENDIF()
ENDIF()
ENDIF()
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ELSE()
SET(MYSQL_FOUND FALSE)
MESSAGE(STATUS "MySQL not found.")
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ENDIF()
MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ENDIF()

@ -0,0 +1,398 @@
# NEL_DIR can be specified as root directory
# Returned variables
# NELDRIVER_XXX_BINARY_DEBUG
# NELDRIVER_XXX_BINARY_RELEASE
# NELDRIVER_XXX_LIBRARY_DEBUG
# NELDRIVER_XXX_LIBRARY_RELEASE
# NELDRIVER_XXX_FOUND
# NEL_DEFINITIONS
# NEL_INCLUDE_DIR
# NEL_INCLUDE_DIRS
# NEL_LIBRARIES
# NELXXX_FOUND
# NELXXX_LIBRARIES
INCLUDE(FindHelpers)
# Init all variables we'll set
SET(NEL_LIBRARIES)
SET(NEL_INCLUDE_DIR)
SET(NEL_INCLUDE_DIRS)
SET(NEL_VERSION)
SET(NEL_STATIC)
SET(NEL_STATIC_DRIVERS)
SET(NEL_VERSION_MAJOR)
SET(NEL_VERSION_MINOR)
SET(NEL_VERSION_PATCH)
SET(NEL_REVISION)
SET(NEL_VERSION)
SET(NEL_MODULES_FOUND)
SET(NEL_MODULES_AVAILABLE 3d georges gui ligo logic net pacs sound) # cegui pipeline
SET(NEL_DRIVERS_FOUND)
SET(NEL_DRIVERS_AVAILABLE opengl opengles direct3d dsound fmod openal xaudio2)
SET(NELMISC_FIND_REQUIRED ${NeL_FIND_REQUIRED})
# Force search of NELMISC
FIND_PACKAGE_HELPER(nelmisc nel/misc/types_nl.h RELEASE nelmisc_r nelmisc DEBUG nelmisc_d DIR ${NEL_DIR} VERBOSE QUIET)
IF(NELMISC_FOUND)
# define NEL_DIR if not specified
IF(NOT NEL_DIR)
GET_FILENAME_COMPONENT(NEL_DIR ${NELMISC_INCLUDE_DIR}/.. ABSOLUTE)
ENDIF()
# Aliases for include directory
SET(NEL_INCLUDE_DIR ${NELMISC_INCLUDE_DIR})
SET(NEL_INCLUDE_DIRS ${NEL_INCLUDE_DIR})
MESSAGE(STATUS "Found NeL headers in ${NEL_INCLUDE_DIR}")
GET_FILENAME_COMPONENT(NEL_LIBRARY_DIR ${NELMISC_LIBRARY} DIRECTORY)
MESSAGE(STATUS "Found NeL library in ${NEL_LIBRARY_DIR}")
# TODO: implement static version checks for Windows
# static libraries
IF(UNIX)
GET_FILENAME_COMPONENT(_LIBEXT ${NELMISC_LIBRARY} EXT)
IF(_LIBEXT STREQUAL ".a")
SET(NEL_STATIC ON)
MESSAGE(STATUS "NeL is using static libraries")
ENDIF()
ENDIF()
IF(WIN32)
SET(NELDRIVER_DIRS_TO_CHECK
${NEL_DIR}/bin${LIB_SUFFIX}
${NEL_DIR}
)
ELSE()
SET(NELDRIVER_DIRS_TO_CHECK
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/lib/nel
/usr/lib
)
ENDIF()
# check for static drivers
FOREACH(_DRIVER ${NEL_DRIVERS_AVAILABLE})
IF(WIN32)
SET(_DRIVER_RELASE_FILE "nel_drv_${_DRIVER}_win_r")
SET(_DRIVER_DEBUG_FILE "nel_drv_${_DRIVER}_win_d")
SET(_DRIVER_SHARED_EXT dll)
SET(_DRIVER_STATIC_EXT lib)
ELSE()
SET(_DRIVER_RELEASE_FILE "nel_drv_${_DRIVER}")
SET(_DRIVER_DEBUG_FILE)
SET(_DRIVER_SHARED_EXT so)
SET(_DRIVER_STATIC_EXT a)
ENDIF()
STRING(TOUPPER ${_DRIVER} _UPDRIVER)
FOREACH(_DIR ${NELDRIVER_DIRS_TO_CHECK})
SET(_FOUND OFF)
IF(_DRIVER_RELASE_FILE)
SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_SHARED_EXT}")
IF(EXISTS ${_FILE})
SET(NELDRIVER_${_UPDRIVER}_BINARY_RELEASE ${_FILE})
MESSAGE(STATUS "Found NeL release shared driver ${_DRIVER}: ${_FILE}")
SET(NEL_STATIC_DRIVERS OFF)
IF(NOT NEL_DRIVER_DIR)
SET(NEL_DRIVER_DIR ${_DIR})
ENDIF()
ENDIF()
SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_STATIC_EXT}")
IF(EXISTS ${_FILE})
SET(NELDRIVER_${_UPDRIVER}_LIBRARY_RELEASE ${_FILE})
MESSAGE(STATUS "Found NeL release static driver ${_DRIVER}: ${_FILE}")
SET(NEL_STATIC_DRIVERS ON)
IF(NOT NEL_DRIVER_DIR)
SET(NEL_DRIVER_DIR ${_DIR})
ENDIF()
ENDIF()
ENDIF()
IF(_DRIVER_DEBUG_FILE)
SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_SHARED_EXT}")
IF(EXISTS ${_FILE})
SET(NELDRIVER_${_UPDRIVER}_BINARY_DEBUG ${_FILE})
MESSAGE(STATUS "Found NeL debug shared driver ${_DRIVER}: ${_FILE}")
SET(NEL_STATIC_DRIVERS OFF)
IF(NOT NEL_DRIVER_DIR)
SET(NEL_DRIVER_DIR ${_DIR})
ENDIF()
ENDIF()
SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_STATIC_EXT}")
IF(EXISTS ${_FILE})
SET(NELDRIVER_${_UPDRIVER}_LIBRARY_DEBUG ${_FILE})
MESSAGE(STATUS "Found NeL debug static driver ${_DRIVER}: ${_FILE}")
SET(NEL_STATIC_DRIVERS ON)
IF(NOT NEL_DRIVER_DIR)
SET(NEL_DRIVER_DIR ${_DIR})
ENDIF()
ENDIF()
IF(_FOUND)
SET(NELDRIVER_${_UPDRIVER}_FOUND ON)
LIST(APPEND NEL_DRIVERS_FOUND ${_DRIVER})
ENDIF()
ENDIF()
ENDFOREACH()
ENDFOREACH()
MESSAGE(STATUS "Found NeL driver in ${NEL_DRIVER_DIR}")
PARSE_VERSION_OTHER(${NEL_INCLUDE_DIR}/nel/misc/version_nl.h NL_VERSION_MAJOR NL_VERSION_MINOR NL_VERSION_PATCH NL_REVISION)
SET(NEL_VERSION_MAJOR ${NL_VERSION_MAJOR})
SET(NEL_VERSION_MINOR ${NL_VERSION_MINOR})
SET(NEL_VERSION_PATCH ${NL_VERSION_PATCH})
SET(NEL_REVISION ${NL_REVISION})
IF(NOT NEL_VERSION)
IF(NEL_VERSION_MAJOR OR NEL_VERSION_MINOR} OR NEL_VERSION_PATCH)
SET(NEL_VERSION "${NEL_VERSION_MAJOR}.${NEL_VERSION_MINOR}.${NEL_VERSION_PATCH}")
ELSE()
SET(NEL_VERSION "0.5.0")
ENDIF()
IF(NEL_REVISION)
SET(NEL_VERSION "${NEL_VERSION}.${NEL_REVISION}")
ENDIF()
ENDIF()
FIND_PACKAGE(PNG REQUIRED)
IF(PNG_FOUND)
LIST(APPEND NELMISC_LIBRARIES ${PNG_LIBRARIES})
ENDIF()
FIND_PACKAGE(Jpeg REQUIRED)
IF(JPEG_FOUND)
LIST(APPEND NELMISC_LIBRARIES ${JPEG_LIBRARY})
ENDIF()
FIND_PACKAGE(GIF)
IF(GIF_FOUND)
LIST(APPEND NELMISC_LIBRARIES ${GIF_LIBRARY})
ENDIF()
FIND_LIBXML2()
IF(LIBXML2_FOUND)
LIST(APPEND NELMISC_LIBRARIES ${LIBXML2_LIBRARIES})
ENDIF()
LIST(REMOVE_ITEM NeL_FIND_COMPONENTS misc)
LIST(APPEND NEL_MODULES_FOUND misc)
LIST(APPEND NEL_LIBRARIES ${NELMISC_LIBRARIES})
ENDIF()
IF(NOT NeL_FIND_COMPONENTS)
SET(NeL_FIND_COMPONENTS ${NEL_MODULES_AVAILABLE})
# We can skip not installed modules
SET(NeL_FIND_REQUIRED OFF)
ENDIF()
FOREACH(COMPONENT ${NeL_FIND_COMPONENTS})
SET(_NAME NeL${COMPONENT})
STRING(TOUPPER ${_NAME} _UPNAME)
# module is required
SET(${_NAME}_FIND_REQUIRED ${NeL_FIND_REQUIRED})
IF(COMPONENT STREQUAL "3d")
SET(HEADER_FILE shape.h)
# ELSEIF(COMPONENT STREQUAL "cegui")
# SET(HEADER_FILE shape.h)
ELSEIF(COMPONENT STREQUAL "georges")
SET(HEADER_FILE form.h)
ELSEIF(COMPONENT STREQUAL "gui")
SET(HEADER_FILE reflect.h)
ELSEIF(COMPONENT STREQUAL "ligo")
SET(HEADER_FILE primitive.h)
ELSEIF(COMPONENT STREQUAL "logic")
SET(HEADER_FILE logic_state.h)
ELSEIF(COMPONENT STREQUAL "net")
SET(HEADER_FILE sock.h)
ELSEIF(COMPONENT STREQUAL "pacs")
SET(HEADER_FILE primitive_block.h)
# ELSEIF(COMPONENT STREQUAL "pipeline")
# SET(HEADER_FILE shape.h)
ELSEIF(COMPONENT STREQUAL "sound")
SET(HEADER_FILE shape.h)
ELSE()
SET(HEADER_FILE)
ENDIF()
# display if a component has a wrong name
IF(NOT HEADER_FILE)
MESSAGE(STATUS "NeL module ${COMPONENT} not supported, ignoring it...")
CONTINUE()
ENDIF()
FIND_PACKAGE_HELPER(${_NAME} nel/${COMPONENT}/${HEADER_FILE}
RELEASE nel${COMPONENT}_r nel${COMPONENT}
DEBUG nel${COMPONENT}_d
QUIET)
IF(${_UPNAME}_FOUND)
LIST(APPEND NEL_MODULES_FOUND ${COMPONENT})
IF(COMPONENT STREQUAL "3d")
IF(NEL_STATIC)
# 3rd party dependencies
FIND_PACKAGE(Freetype REQUIRED)
IF(FREETYPE_FOUND)
LIST(APPEND ${_UPNAME}_LIBRARIES ${FREETYPE_LIBRARIES})
ENDIF()
# Append static 3D drivers
IF(NEL_STATIC_DRIVERS)
# Direct3D driver (only under Windows)
IF(WIN32)
IF(NELDRIVER_DIRECT3D_LIBRARY_DEBUG)
LIST(APPEND ${_UPNAME}_LIBRARIES debug ${NELDRIVER_DIRECT3D_LIBRARY_DEBUG})
ENDIF()
IF(NELDRIVER_DIRECT3D_LIBRARY_RELEASE)
LIST(APPEND ${_UPNAME}_LIBRARIES optimized ${NELDRIVER_DIRECT3D_LIBRARY_RELEASE})
ENDIF()
ENDIF()
# OpenGL driver
IF(NELDRIVER_OPENGL_LIBRARY_DEBUG)
LIST(APPEND ${_UPNAME}_LIBRARIES debug ${NELDRIVER_OPENGL_LIBRARY_DEBUG})
ENDIF()
IF(NELDRIVER_OPENGL_LIBRARY_RELEASE)
LIST(APPEND ${_UPNAME}_LIBRARIES optimized ${NELDRIVER_OPENGL_LIBRARY_RELEASE})
ENDIF()
ENDIF()
ENDIF()
ELSEIF(COMPONENT STREQUAL "gui")
FIND_PACKAGE(Luabind REQUIRED)
LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES})
FIND_LIBCURL()
IF(CURL_FOUND)
LIST(APPEND ${_UPNAME}_LIBRARIES ${CURL_LIBRARIES})
LIST(APPEND ${_UPNAME}_DEFINITIONS ${CURL_DEFINITIONS})
ENDIF()
# TODO: remove complately OpenSSL requirement on Windows
# Only used by libcurl under Linux
FIND_PACKAGE(OpenSSL REQUIRED)
IF(WIN32)
LIST(APPEND OPENSSL_LIBRARIES Crypt32.lib)
ENDIF()
# Only Linux version of libcurl depends on OpenSSL
LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES} ${CURL_LIBRARIES})
LIST(APPEND NEL_DEFINITIONS ${${_UPNAME}_DEFINITIONS})
ELSEIF(COMPONENT STREQUAL "sound")
FIND_PACKAGE(Ogg REQUIRED)
IF(OGG_FOUND)
LIST(APPEND ${_UPNAME}_LIBRARIES ${OGG_LIBRARY})
ENDIF()
FIND_PACKAGE(Vorbis REQUIRED)
IF(VORBIS_FOUND)
LIST(APPEND ${_UPNAME}_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
ENDIF()
IF(NEL_STATIC)
# Link to snd_lowlevel
FIND_LIBRARY_HELPER(nelsnd_lowlevel RELEASE nelsnd_lowlevel_r DEBUG nelsnd_lowlevel_d DIR ${NEL_DIR} REQUIRED)
IF(NELSND_LOWLEVEL_LIBRARIES)
MESSAGE(STATUS "Found NeL sound lowlevel ${NELSND_LOWLEVEL_LIBRARIES}")
LIST(APPEND NELSOUND_LIBRARIES ${NELSND_LOWLEVEL_LIBRARIES})
IF(NEL_STATIC_DRIVERS)
# DirectSound, XAudio2 and FMod drivers (only under Windows)
IF(WIN32)
# DirectSound
IF(NELDRIVER_DIRECTSOUND_LIBRARY_DEBUG)
LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_DIRECTSOUND_LIBRARY_DEBUG})
ENDIF()
IF(NELDRIVER_DIRECTSOUND_LIBRARY_RELEASE)
LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_DIRECTSOUND_LIBRARY_RELEASE})
ENDIF()
# FMod
IF(NELDRIVER_FMOD_LIBRARY_DEBUG)
LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_FMOD_LIBRARY_DEBUG})
ENDIF()
IF(NELDRIVER_FMOD_LIBRARY_RELEASE)
LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_FMOD_LIBRARY_RELEASE})
ENDIF()
# XAudio2
IF(NELDRIVER_XAUDIO2_LIBRARY_DEBUG)
LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_XAUDIO2_LIBRARY_DEBUG})
ENDIF()
IF(NELDRIVER_XAUDIO2_LIBRARY_RELEASE)
LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_XAUDIO2_LIBRARY_RELEASE})
ENDIF()
ENDIF()
# OpenAL driver
IF(NELDRIVER_OPENAL_LIBRARY_DEBUG)
LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_OPENAL_LIBRARY_DEBUG})
ENDIF()
IF(NELDRIVER_OPENAL_LIBRARY_RELEASE)
LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_OPENAL_LIBRARY_RELEASE})
ENDIF()
ENDIF()
ENDIF()
ENDIF()
ENDIF()
LIST(APPEND NEL_LIBRARIES ${${_UPNAME}_LIBRARIES})
ENDIF()
ENDFOREACH()
MESSAGE_VERSION_PACKAGE_HELPER(NeL ${NEL_VERSION} ${NEL_MODULES_FOUND})

@ -7,7 +7,7 @@
IF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
# in cache already
SET(OGG_FIND_QUIETLY TRUE)
ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
ENDIF()
FIND_PATH(OGG_INCLUDE_DIR
@ -41,9 +41,9 @@ IF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
SET(OGG_FOUND "YES")
IF(NOT OGG_FIND_QUIETLY)
MESSAGE(STATUS "Found Ogg: ${OGG_LIBRARY}")
ENDIF(NOT OGG_FIND_QUIETLY)
ELSE(OGG_LIBRARY AND OGG_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT OGG_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Ogg!")
ENDIF(NOT OGG_FIND_QUIETLY)
ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
ENDIF()
ENDIF()

@ -43,7 +43,7 @@ IF(OPENGLES_GLES_LIBRARY)
IF(OPENGLES_EGL_LIBRARY)
SET(OPENGLES_EGL_FOUND "YES")
SET(OPENGLES_LIBRARIES ${OPENGLES_EGL_LIBRARY} ${OPENGLES_LIBRARIES})
ELSE(OPENGLES_EGL_LIBRARY)
ELSE()
SET(OPENGLES_EGL_FOUND "NO")
ENDIF(OPENGLES_EGL_LIBRARY)
ENDIF(OPENGLES_GLES_LIBRARY)
ENDIF()
ENDIF()

@ -0,0 +1,14 @@
INCLUDE(FindHelpers)
FIND_PACKAGE_HELPER(RyzomGameShare game_share/continent.h RELEASE ryzom_gameshare_r ryzom_gameshare DEBUG ryzom_gameshare_d DIR ${NEL_DIR} ${RYZOM_DIR} SUFFIXES ryzom)
IF(RYZOMGAMESHARE_FOUND)
FIND_PACKAGE(NeL REQUIRED)
LIST(APPEND RYZOMGAMESHARE_INCLUDE_DIRS ${NEL_INCLUDE_DIRS})
LIST(APPEND RYZOMGAMESHARE_LIBRARIES ${NELMISC_LIBRARIES} ${NELLIGO_LIBRARIES} ${NELNET_LIBRARIES} ${NELGEORGES_LIBRARIES})
SET(RYZOM_GAMESHARE_LIBRARIES ${RYZOMGAMESHARE_LIBRARIES})
SET(RYZOM_GAMESHARE_FOUND ${RYZOMGAMESHARE_FOUND})
SET(RYZOM_GAMESHARE_INCLUDE_DIR ${RYZOMGAMESHARE_INCLUDE_DIR})
SET(RYZOM_GAMESHARE_INCLUDE_DIRS ${RYZOMGAMESHARE_INCLUDE_DIRS})
ENDIF()

@ -9,7 +9,7 @@
IF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR)
# in cache already
SET(STLPORT_FIND_QUIETLY TRUE)
ENDIF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR)
ENDIF()
FIND_PATH(STLPORT_INCLUDE_DIR
iostream
@ -74,18 +74,18 @@ IF(STLPORT_INCLUDE_DIR)
SET(STLPORT_LIBRARIES ${STLPORT_LIBRARY_RELEASE})
IF(STLPORT_LIBRARY_DEBUG)
SET(STLPORT_LIBRARIES optimized ${STLPORT_LIBRARIES} debug ${STLPORT_LIBRARY_DEBUG})
ENDIF(STLPORT_LIBRARY_DEBUG)
ENDIF(STLPORT_LIBRARY_RELEASE)
ENDIF(STLPORT_INCLUDE_DIR)
ENDIF()
ENDIF()
ENDIF()
IF(STLPORT_FOUND)
IF(NOT STLPORT_FIND_QUIETLY)
MESSAGE(STATUS "Found STLport: ${STLPORT_LIBRARIES}")
ENDIF(NOT STLPORT_FIND_QUIETLY)
ELSE(STLPORT_FOUND)
ENDIF()
ELSE()
IF(NOT STLPORT_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find STLport!")
ENDIF(NOT STLPORT_FIND_QUIETLY)
ENDIF(STLPORT_FOUND)
ENDIF()
ENDIF()
MARK_AS_ADVANCED(STLPORT_LIBRARY_RELEASE STLPORT_LIBRARY_DEBUG)

@ -10,7 +10,7 @@
IF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR)
# in cache already
SET(SQUISH_FIND_QUIETLY TRUE)
ENDIF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR)
ENDIF()
FIND_PATH(SQUISH_INCLUDE_DIR
squish.h
@ -55,27 +55,29 @@ FIND_LIBRARY(SQUISH_LIBRARY_DEBUG
IF(SQUISH_INCLUDE_DIR)
IF(SQUISH_LIBRARY_RELEASE)
SET(SQUISH_FOUND "YES")
SET(SQUISH_LIBRARIES "optimized;${SQUISH_LIBRARY_RELEASE}")
IF(SQUISH_LIBRARY_DEBUG)
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_DEBUG}")
ENDIF(SQUISH_LIBRARY_DEBUG)
ENDIF(SQUISH_LIBRARY_RELEASE)
ENDIF(SQUISH_INCLUDE_DIR)
ELSE()
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_RELEASE}")
MESSAGE("Debug Squish NOT found, using the release version!")
ENDIF()
ENDIF()
ENDIF()
IF(SQUISH_FOUND)
IF(NOT SQUISH_FIND_QUIETLY)
MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARIES}")
ENDIF(NOT SQUISH_FIND_QUIETLY)
ENDIF()
FILE(STRINGS ${SQUISH_INCLUDE_DIR}/squish.h METRIC REGEX "metric = 0")
IF(METRIC)
SET(SQUISH_COMPRESS_HAS_METRIC ON)
SET(SQUISH_DEFINITIONS -DSQUISH_COMPRESS_HAS_METRIC)
ENDIF(METRIC)
ELSE(SQUISH_FOUND)
ENDIF()
ELSE()
IF(NOT SQUISH_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Squish!")
ENDIF(NOT SQUISH_FIND_QUIETLY)
ENDIF(SQUISH_FOUND)
ENDIF()
ENDIF()
MARK_AS_ADVANCED(SQUISH_LIBRARY_RELEASE SQUISH_LIBRARY_DEBUG)

@ -0,0 +1,74 @@
# - Locate Steam API
# This module defines
# STEAM_LIBRARY, the library to link against
# STEAM_FOUND, if false, do not try to link to STEAM
# STEAM_INCLUDE_DIR, where to find headers.
IF(STEAM_LIBRARY AND STEAM_INCLUDE_DIR)
# in cache already
SET(Steam_FIND_QUIETLY TRUE)
ENDIF()
FIND_PATH(STEAM_INCLUDE_DIR
steam_api.h
PATH_SUFFIXES steam
PATHS
$ENV{STEAM_DIR}/public
)
IF(WIN32)
IF(TARGET_X64)
SET(STEAM_LIBNAME steam_api64)
SET(STEAM_RUNTIMENAME steam_api64.dll)
SET(STEAM_PATHNAME redistributable_bin/win64)
ELSE()
SET(STEAM_LIBNAME steam_api)
SET(STEAM_RUNTIMENAME steam_api.dll)
SET(STEAM_PATHNAME redistributable_bin)
ENDIF()
ELSEIF(APPLE)
# universal binary
SET(STEAM_LIBNAME steam_api)
SET(STEAM_RUNTIMENAME libsteam_api.dylib)
SET(STEAM_PATHNAME redistributable_bin/osx32)
ELSE()
SET(STEAM_LIBNAME steam_api)
SET(STEAM_RUNTIMENAME libsteam_api.so)
IF(TARGET_X64)
SET(STEAM_PATHNAME redistributable_bin/linux64)
ELSE()
SET(STEAM_PATHNAME redistributable_bin/linux32)
ENDIF()
ENDIF()
FIND_LIBRARY(STEAM_LIBRARY
NAMES ${STEAM_LIBNAME}
HINTS
$ENV{STEAM_DIR}/${STEAM_PATHNAME}
)
FIND_FILE(STEAM_RUNTIME
NAMES ${STEAM_RUNTIMENAME}
HINTS
$ENV{STEAM_DIR}/${STEAM_PATHNAME}
PATHS
${EXTERNAL_BINARY_PATH}
${CMAKE_LIBRARY_PATH}
/usr/local/lib
/usr/lib
)
# Don't need to check STEAM_LIBRARY because we're dynamically loading Steam DLL
IF(STEAM_INCLUDE_DIR)
SET(STEAM_FOUND ON)
SET(STEAM_LIBRARIES ${STEAM_LIBRARY})
SET(STEAM_INCLUDE_DIRS ${STEAM_INCLUDE_DIR})
IF(NOT Steam_FIND_QUIETLY)
MESSAGE(STATUS "Found Steam: ${STEAM_INCLUDE_DIR} and ${STEAM_RUNTIME}")
ENDIF()
ELSE()
IF(NOT Steam_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Steam!")
ENDIF()
ENDIF()

@ -7,7 +7,7 @@
IF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
# in cache already
SET(VORBIS_FIND_QUIETLY TRUE)
ENDIF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
ENDIF()
FIND_PATH(VORBIS_INCLUDE_DIR
@ -57,9 +57,9 @@ IF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
SET(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
IF(NOT VORBIS_FIND_QUIETLY)
MESSAGE(STATUS "Found Vorbis: ${VORBIS_LIBRARY}")
ENDIF(NOT VORBIS_FIND_QUIETLY)
ELSE(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT VORBIS_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Vorbis!")
ENDIF(NOT VORBIS_FIND_QUIETLY)
ENDIF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
ENDIF()
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()
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 Kit ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
ENDIF()
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
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_WINSDK_VERSION _VERSION)
SET(WINSDK${_VERSION}_FOUND OFF)
@ -34,40 +49,53 @@ 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()
MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
# Search version in headers
@ -78,18 +106,28 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
)
IF(_MSI_FILE)
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 8.1
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINBLUE")
# Look for Windows SDK 8.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
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
@ -109,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
@ -133,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
@ -142,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
@ -151,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 "")
@ -171,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)
@ -181,11 +219,11 @@ MACRO(USE_CURRENT_WINSDK)
# Look for Windows.h because there are several paths
IF(EXISTS ${_INCLUDE}/Windows.h)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK from include environment variable in ${WINSDK_DIR}")
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
@ -194,38 +232,59 @@ 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(MSVC_VERSION GREATER 1909)
# Special case, use Kits for SDK
SET(WINSDK_VERSION "10.0")
SET(WINSDK_DIR ${WINSDK_UCRT_DIR})
ELSEIF(MSVC14)
SET(WINSDK_VERSION "8.1")
ELSEIF(MSVC12)
SET(WINSDK_VERSION "8.1")
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_MSVC80_COMPATIBLES "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A" "5.2A")
# look for each Windows SDK supported by VC++ 2005 (7.1 is the latest)
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
# look if this version of Windows SDK is installed
LIST(FIND WINSDK_MSVC80_COMPATIBLES ${_VERSION} _FOUND)
IF(NOT _FOUND EQUAL -1)
SET(WINSDK_VERSION "${_VERSION}")
BREAK()
ENDIF()
ENDFOREACH()
IF(NOT MSVC_EXPRESS AND NOT WINSDK_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")
@ -233,10 +292,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})
@ -244,75 +303,193 @@ 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 and 2017, 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_UCRT_DIR)
# determine exact UCRT version
SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include)
SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib)
FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*)
SET(UCRT_VERSION)
FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS})
IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION)
SET(UCRT_VERSION ${UCRT_SUBDIR})
ENDIF()
ENDFOREACH()
IF(UCRT_VERSION)
MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}")
SET(WINSDK10_INCLUDE_DIR ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION})
SET(WINSDK10_LIBRARY_DIR ${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION})
# directory where UCRT headers are found
FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h
HINTS
${WINSDK10_INCLUDE_DIR}/ucrt
)
# directory where UCRT libraries are found
FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib
HINTS
${WINSDK10_LIBRARY_DIR}/ucrt/${WINSDK8_SUFFIX}
)
ENDIF()
ENDIF()
IF(WINSDK_VERSION STREQUAL "CURRENT")
USE_CURRENT_WINSDK()
ELSE(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
HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/um
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found Windows.h in ${WINSDK_INCLUDE_DIR}")
# directory where WinRT headers are found
FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h
HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/winrt
${WINSDK_DIR}/Include/winrt
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found winstring.h in ${WINSDK_WINRT_INCLUDE_DIR}")
# directory where DirectX headers are found
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
HINTS
${WINSDK_DIR}/Include/${UCRT_VERSION}/shared
${WINSDK_DIR}/Include/shared
${WINSDK_DIR}/Include
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found d3d9.h in ${WINSDK_SHARED_INCLUDE_DIR}")
# directory where OpenGL headers are found
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
HINTS
${WINSDK_INCLUDE_DIR}/gl
${WINSDK_DIR}/Include/um/gl
${WINSDK_DIR}/Include/gl
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found GL.h in ${WINSDK_OPENGL_INCLUDE_DIR}")
SET(WINSDK_LIBRARY_DIRS
${WINSDK_DIR}/Lib/${UCRT_VERSION}/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
)
IF(WINSDK_SUFFIXES)
FOREACH(_SUFFIX ${WINSDK_SUFFIXES})
LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib/${_SUFFIX})
ENDFOREACH()
ELSE()
LIST(APPEND 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}
NO_DEFAULT_PATH
)
MESSAGE(STATUS "Found ComCtl32.lib in ${WINSDK_LIBRARY_DIR}")
SET(WINSDK_BINARY_DIRS
${WINSDK_DIR}/Bin/${UCRT_VERSION}/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
)
# signtool is used to sign executables
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
HINTS
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
${WINSDK_BINARY_DIRS}
NO_DEFAULT_PATH
)
# midl is used to generate IDL interfaces
FIND_PROGRAM(WINSDK_MIDL midl
HINTS
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
${WINSDK_BINARY_DIRS}
NO_DEFAULT_PATH
)
IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND ON)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR})
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
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})
# Fix for using Windows SDK 7.1 with Visual C++ 2012
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
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})
# Fix for using Windows SDK 7.1 with Visual C++ 2012, 2013, 2015 and 2017
IF(WINSDK_VERSION STREQUAL "7.1" AND (MSVC11 OR MSVC12 OR MSVC14))
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()

@ -7,7 +7,7 @@
IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
# in cache already
SET(XF86VidMode_FIND_QUIETLY TRUE)
ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
ENDIF()
FIND_PATH(XF86VidMode_INCLUDE_DIR
@ -37,10 +37,10 @@ IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
SET(XF86VidMode_DEFINITIONS -DXF86VIDMODE)
IF(NOT XF86VidMode_FIND_QUIETLY)
MESSAGE(STATUS "Found XF86VidMode: ${XF86VidMode_LIBRARY}")
ENDIF(NOT XF86VidMode_FIND_QUIETLY)
ELSE(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT XF86VidMode_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find XF86VidMode!")
ENDIF(NOT XF86VidMode_FIND_QUIETLY)
ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
ENDIF()
ENDIF()

@ -0,0 +1,63 @@
IF(assimp_FIND_REQUIRED)
SET(ASSIMP_FIND_REQUIRED ON)
ENDIF()
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_LIBRARY_RELEASE
NAMES assimp
PATHS /usr/local/lib/
)
FIND_LIBRARY(
IRRXML_LIBRARY_RELEASE
NAMES IrrXML
PATHS /usr/local/lib/
)
FIND_LIBRARY(
ASSIMP_LIBRARY_DEBUG
NAMES assimpd
PATHS /usr/local/lib/
)
FIND_LIBRARY(
IRRXML_LIBRARY_DEBUG
NAMES IrrXMLd
PATHS /usr/local/lib/
)
IF (ASSIMP_INCLUDE_DIRS)
SET(ASSIMP_FOUND TRUE)
IF(ASSIMP_LIBRARY_RELEASE)
SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} optimized ${ASSIMP_LIBRARY_RELEASE})
ENDIF()
IF(ASSIMP_LIBRARY_DEBUG)
SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} debug ${ASSIMP_LIBRARY_DEBUG})
ENDIF()
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} ${ZLIB_LIBRARIES})
ENDIF()
IF(IRRXML_LIBRARY_RELEASE)
SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} optimized ${IRRXML_LIBRARY_RELEASE})
ENDIF()
IF(IRRXML_LIBRARY_DEBUG)
SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} debug ${IRRXML_LIBRARY_DEBUG})
ENDIF()
ENDIF()
IF (ASSIMP_FOUND)
IF (NOT ASSIMP_FIND_QUIETLY)
MESSAGE(STATUS "Found asset importer library: ${ASSIMP_LIBRARIES}")
ENDIF ()
ELSE (ASSIMP_FOUND)
IF (ASSIMP_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find asset importer library")
ENDIF ()
ENDIF ()

@ -2,50 +2,64 @@ 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})
IF(NOT ROOT_DIR AND SOURCE_DIR)
SET(ROOT_DIR ${SOURCE_DIR})
ENDIF(NOT ROOT_DIR AND SOURCE_DIR)
ENDIF()
IF(NOT SOURCE_DIR AND ROOT_DIR)
SET(SOURCE_DIR ${ROOT_DIR})
ENDIF(NOT SOURCE_DIR AND ROOT_DIR)
ELSE(SOURCE_DIR)
ENDIF()
ELSE()
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
ENDIF(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(NOT DATETIME MATCHES "ERROR")
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
ELSE (WIN32)
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} "0000-00-00 00:00:00")
ENDIF (WIN32)
ENDMACRO(NOW)
IF(CMAKE_VERSION VERSION_GREATER "2.8.10")
STRING(TIMESTAMP ${RESULT} "%Y-%m-%d %H:%M:%S")
ELSE()
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()
IF(EXISTS "${ROOT_DIR}/.svn/")
FIND_PACKAGE(Subversion)
FIND_PACKAGE(Subversion QUIET)
IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION})
ENDIF(SUBVERSION_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.svn/")
ENDIF()
FIND_PACKAGE(TortoiseSVN QUIET)
IF(TORTOISESVN_FOUND)
TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION)
ENDIF()
ENDIF()
IF(EXISTS "${ROOT_DIR}/.hg/")
FIND_PACKAGE(Mercurial)
@ -55,8 +69,8 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
SET(REVISION ${ER_WC_REVISION})
SET(CHANGESET ${ER_WC_CHANGESET})
SET(BRANCH ${ER_WC_BRANCH})
ENDIF(MERCURIAL_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.hg/")
ENDIF()
ENDIF()
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)
@ -64,14 +78,11 @@ IF(SOURCE_DIR AND NOT DEFINED REVISION)
IF(EXISTS ${REVISION_FILE})
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
MESSAGE(STATUS "Read revision ${REVISION} from file")
ENDIF(EXISTS ${REVISION_FILE})
ENDIF(SOURCE_DIR AND NOT DEFINED REVISION)
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(EXISTS ${SOURCE_DIR}/revision.h.in)
ENDIF(SOURCE_DIR AND DEFINED REVISION)
IF(DEFINED REVISION)
MESSAGE(STATUS "Found revision ${REVISION}")
ELSE()
SET(REVISION 0)
ENDIF()

@ -0,0 +1,131 @@
# Define OSX_SDK to force a specific version such as : -DOSX_SDK=10.11
#
# Example:
# cmake ../code -DCMAKE_TOOLCHAIN_FILE=../code/CMakeModules/OSXToolChain.cmake -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_TOOLS=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_LUA51=OFF -DWITH_LUA53=ON -DCMAKE_BUILD_TYPE=Release -DWITH_RYZOM_INSTALLER=OFF -DWITH_RYZOM_PATCH=ON -DWITH_NEL_TESTS=OFF -DWITH_NEL_TOOLS=OFF -DWITH_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_WARNINGS=OFF -DWITH_QT5=OFF -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_UNIX_STRUCTURE=OFF -DWITH_INSTALL_LIBRARIES=OFF -DWITH_RYZOM_SANDBOX=OFF -DOSX_SDK=10.11
# Don't forget to define environment variables:
#
# export MACOSX_DEPLOYMENT_TARGET=10.7
# export OSXCROSS_GCC_NO_STATIC_RUNTIME=1
# export PATH=$PATH:/home/src/osxcross/target/bin
#
# ln -s /usr/bin/hg /home/src/osxcross/target/bin/hg
#
# To install all dependencies:
# ./osxcross-macports install libxml2 jpeg curl libogg libvorbis freetype boost openssl zlib lua-5.3 giflib
# to compile Luabind
# export CMAKE_MODULE_PATH=$HOME/shard/tools/external/cmake/modules
# cmake .. -DCMAKE_TOOLCHAIN_FILE=$HOME/ryzomcore/code/CMakeModules/OSXToolChain.cmake -DWITH_SHARED=OFF -DWITH_STATIC=ON -DWITH_LUA51=OFF -DWITH_LUA53=ON -DCMAKE_INSTALL_PREFIX=$HOME/osxcross/target/external
IF(DEFINED CMAKE_CROSSCOMPILING)
# subsequent toolchain loading is not really needed
RETURN()
ENDIF()
# Force the compilers to Clang for OS X
# C
SET(CMAKE_C_COMPILER x86_64-apple-darwin15-clang)
SET(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
SET(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert")
SET(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
SET(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
SET(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
# C++
SET(CMAKE_CXX_COMPILER x86_64-apple-darwin15-clang++)
SET(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17")
SET(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
SET(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
SET(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
SET(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
# make
SET(CMAKE_MAKE_PROGRAM make)
# Skip the platform compiler checks for cross compiling.
SET(CMAKE_CXX_COMPILER_FORCED TRUE)
SET(CMAKE_C_COMPILER_FORCED TRUE)
# Check if osxcross is installed
EXECUTE_PROCESS(COMMAND which ${CMAKE_CXX_COMPILER} OUTPUT_VARIABLE COMPILER_FULLPATH OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT COMPILER_FULLPATH)
MESSAGE(FATAL_ERROR "Unable to find ${CMAKE_CXX_COMPILER}, are you sure osxcross is installed and is in PATH?")
ENDIF()
# Default paths
GET_FILENAME_COMPONENT(CMAKE_OSX_TOOLCHAIN_ROOT ${COMPILER_FULLPATH} DIRECTORY)
# Parent directory
GET_FILENAME_COMPONENT(CMAKE_OSX_TOOLCHAIN_ROOT ${CMAKE_OSX_TOOLCHAIN_ROOT} DIRECTORY)
SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_TOOLCHAIN_ROOT}/SDK)
SET(MACPORTS_ROOT_DIR ${CMAKE_OSX_TOOLCHAIN_ROOT}/macports/pkgs/opt/local)
SET(EXTERNAL_OSX_PATH ${CMAKE_OSX_TOOLCHAIN_ROOT}/external)
# List of all SDKs that have been found
SET(OSX_SDKS)
FILE(GLOB _CMAKE_OSX_SDKS "${CMAKE_OSX_SYSROOT}/MacOSX*")
IF(_CMAKE_OSX_SDKS)
LIST(SORT _CMAKE_OSX_SDKS)
LIST(REVERSE _CMAKE_OSX_SDKS)
FOREACH(_CMAKE_OSX_SDK ${_CMAKE_OSX_SDKS})
STRING(REGEX REPLACE ".+MacOSX([0-9.]+)\\.sdk" "\\1" _OSX_SDK "${_CMAKE_OSX_SDK}")
LIST(APPEND OSX_SDKS ${_OSX_SDK})
ENDFOREACH()
ENDIF()
# Find and use the most recent OS X sdk
IF(NOT OSX_SDKS)
MESSAGE(FATAL_ERROR "No OS X SDK's found in default search path ${CMAKE_OSX_SYSROOT}.")
ENDIF()
# if a specific SDK is defined, try to use it
IF(OSX_SDK)
LIST(FIND OSX_SDKS "${OSX_SDK}" _INDEX)
IF(_INDEX EQUAL -1)
# if specified SDK doesn't exist, use the last one
LIST(GET OSX_SDKS 0 OSX_SDK)
ENDIF()
ELSE()
# use the last SDK
LIST(GET OSX_SDKS 0 OSX_SDK)
ENDIF()
MESSAGE(STATUS "Using OS X SDK ${OSX_SDK}")
# Define final OS X sysroot
SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT}/MacOSX${OSX_SDK}.sdk)
# Standard settings
SET(CMAKE_SYSTEM_NAME Darwin)
SET(CMAKE_SYSTEM "Darwin-15.0.0")
SET(CMAKE_SYSTEM_VERSION "15.0.0")
SET(CMAKE_SYSTEM_PROCESSOR "x86_64")
SET(UNIX ON)
SET(APPLE ON)
# Set the find root to the OS X developer roots and to user defined paths
SET(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_TOOLCHAIN_ROOT} ${CMAKE_OSX_SYSROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} ${MACPORTS_ROOT_DIR} ${EXTERNAL_OSX_PATH} $ENV{EXTERNAL_OSX_PATH} CACHE STRING "OS X find search path root")
# default to searching for frameworks first
SET(CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
SET(CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_OSX_SYSROOT}/System/Library/Frameworks
${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks
${CMAKE_OSX_SYSROOT}/Developer/Library/Frameworks
)
# only search the OS X sdks, not the remainder of the host filesystem
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
INCLUDE(CMakeFindBinUtils)

@ -10,171 +10,294 @@
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()
MACRO(APPEND_DEFINITION _NAME _VAL)
IF(CMAKE_VERSION VERSION_LESS "2.8.12")
# don't support logical expressions, append definition
LIST(APPEND ${_NAME} "-D${_VAL}")
ELSE()
# support logical expressions, use them
LIST(APPEND ${_NAME} "$<$<BOOL:${_VAL}>:-D$<JOIN:${_VAL},-D>>")
ENDIF()
ENDMACRO()
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
MACRO(PCH_SET_COMPILE_FLAGS _target)
SET(PCH_FLAGS)
SET(PCH_ARCHS)
SET(PCH_INCLUDES)
SET(_FLAGS)
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
# Append target for clang if defined
IF(CMAKE_CXX_COMPILER_TARGET)
LIST(APPEND PCH_FLAGS "--target=${CMAKE_CXX_COMPILER_TARGET}")
ENDIF()
IF(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
LIST(APPEND PCH_FLAGS "--gcc-toolchain=${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}")
ENDIF()
IF(CMAKE_SYSROOT)
LIST(APPEND PCH_FLAGS "--sysroot=${CMAKE_SYSROOT}")
ENDIF()
IF(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
FOREACH(item ${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES})
LIST(APPEND PCH_FLAGS "-isystem ${item}")
ENDFOREACH()
ENDIF()
# C++ flags
SET(_FLAGS ${CMAKE_CXX_FLAGS})
SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND PCH_FLAGS ${_FLAGS})
# C++ config flags
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}")
SET(_FLAGS ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}})
SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND PCH_FLAGS ${_FLAGS})
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
SET(_USE_PIC OFF)
IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY")
SET(_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND PCH_FLAGS ${_FLAGS})
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)
LIST(APPEND PCH_INCLUDES "${item}")
ENDFOREACH()
# NOTE: As cmake files (eg FindQT4) may now use generator expressions around their defines that evaluate
# to an empty string, wrap all "items" in an expression that outputs a -D IFF the generated
# expression is not empty.
# Required for CMake 2.6
SET(GLOBAL_DEFINITIONS)
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
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)
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
ENDFOREACH()
ENDIF()
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
ENDFOREACH()
ENDIF()
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
IF(oldProps)
LIST(APPEND _FLAGS " ${oldProps}")
ENDIF(oldProps)
SET(_FLAGS ${oldProps})
SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND PCH_FLAGS ${_FLAGS})
ENDIF()
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
IF(oldPropsBuild)
LIST(APPEND _FLAGS " ${oldPropsBuild}")
ENDIF(oldPropsBuild)
SET(_FLAGS ${oldPropsBuild})
SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND PCH_FLAGS ${_FLAGS})
ENDIF()
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
IF(DIRINC)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " -I\"${item}\"")
ENDFOREACH(item)
ENDIF(DIRINC)
LIST(APPEND PCH_INCLUDES "${item}")
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
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)
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}")
# Format definitions
IF(MSVC)
# Fix path with space
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
ELSE(MSVC)
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
SEPARATE_ARGUMENTS(_FLAGS)
ENDIF(MSVC)
IF(CLANG)
# Determining all architectures and get common flags
SET(_ARCH_NEXT)
SET(_XARCH_NEXT)
FOREACH(item ${_FLAGS})
IF(_ARCH_NEXT)
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
IF(ITEM_FOUND EQUAL -1)
LIST(APPEND PCH_ARCHS ${item})
STRING(TOUPPER "${item}" _UPPER_ARCH)
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
ENDIF(ITEM_FOUND EQUAL -1)
SET(_ARCH_NEXT OFF)
ELSEIF(_XARCH_NEXT)
SET(_XARCH_NEXT OFF)
ELSE(_ARCH_NEXT)
IF(item MATCHES "^-arch")
SET(_ARCH_NEXT ON)
ELSEIF(item MATCHES "^-Xarch_")
STRING(REGEX REPLACE "-Xarch_([a-z0-9_]+)" "\\1" item ${item})
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
IF(ITEM_FOUND EQUAL -1)
LIST(APPEND PCH_ARCHS ${item})
STRING(TOUPPER "${item}" _UPPER_ARCH)
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
ENDIF(ITEM_FOUND EQUAL -1)
SET(_XARCH_NEXT ON)
ELSE(item MATCHES "^-arch")
LIST(APPEND PCH_FLAGS ${item})
ENDIF(item MATCHES "^-arch")
ENDIF(_ARCH_NEXT)
ENDFOREACH(item)
# Get architcture specific flags
SET(_XARCH_NEXT)
FOREACH(item ${_FLAGS})
IF(_XARCH_NEXT)
STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH)
LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item})
SET(_XARCH_NEXT OFF)
ELSE(_XARCH_NEXT)
IF(item MATCHES "^-Xarch_")
STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT)
ENDIF(item MATCHES "^-Xarch_")
ENDIF(_XARCH_NEXT)
ENDFOREACH(item)
# Remove duplicated architectures
IF(_ARCHS AND PCH_ARCHS)
LIST(REMOVE_DUPLICATES PCH_ARCHS)
ENDIF(_ARCHS AND PCH_ARCHS)
ELSE(CLANG)
SET(PCH_FLAGS ${_FLAGS})
ENDIF(CLANG)
IF(PCH_FLAGS)
LIST(REMOVE_DUPLICATES PCH_FLAGS)
ENDIF(PCH_FLAGS)
ENDMACRO(PCH_SET_COMPILE_FLAGS)
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(OPTIONS ${_target} COMPILE_OPTIONS)
IF(OPTIONS)
SEPARATE_ARGUMENTS(OPTIONS)
LIST(APPEND PCH_FLAGS ${OPTIONS})
ENDIF()
GET_TARGET_PROPERTY(OPTIONS ${_target} COMPILE_OPTIONS_${_UPPER_BUILD})
IF(OPTIONS)
SEPARATE_ARGUMENTS(OPTIONS)
LIST(APPEND PCH_FLAGS ${OPTIONS})
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 PCH_INCLUDES "${item}")
ENDFOREACH()
ENDIF()
# use same compile definitions
GET_TARGET_PROPERTY(_DEFINITIONS ${_LIB} INTERFACE_COMPILE_DEFINITIONS)
IF(_DEFINITIONS)
FOREACH(item ${_DEFINITIONS})
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
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 PCH_FLAGS ${CMAKE_CXX_COMPILE_OPTIONS_PIC})
ENDIF()
ENDIF()
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
GET_DIRECTORY_PROPERTY(_DIRECTORY_FLAGS DEFINITIONS)
IF(_DIRECTORY_FLAGS)
SEPARATE_ARGUMENTS(_DIRECTORY_FLAGS)
FOREACH(item ${_DIRECTORY_FLAGS})
LIST(APPEND PCH_FLAGS "${item}")
ENDFOREACH()
ENDIF()
GET_DIRECTORY_PROPERTY(_DIRECTORY_DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEFINITIONS)
IF(_DIRECTORY_DEFINITIONS)
SEPARATE_ARGUMENTS(_DIRECTORY_DEFINITIONS)
FOREACH(item ${_DIRECTORY_DEFINITIONS})
LIST(APPEND PCH_FLAGS "${item}")
ENDFOREACH()
ENDIF()
ENDIF()
IF(CMAKE_CXX11_EXTENSION_COMPILE_OPTION)
LIST(APPEND PCH_FLAGS "${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}")
ENDIF()
# Already in list form and items may contain non-leading spaces that should not be split on
LIST(APPEND PCH_FLAGS "${GLOBAL_DEFINITIONS}")
IF(WIN32)
SET(SYSTEM_FLAG "[-/$]")
ELSE()
SET(SYSTEM_FLAG "[-$]")
ENDIF()
SET(_FINAL_FLAGS)
SET(_PREVIOUS_FLAG)
FOREACH(_FLAG ${PCH_FLAGS})
# If parameter is really a flag (starts with -)
IF(_FLAG MATCHES "^${SYSTEM_FLAG}")
IF(_PREVIOUS_FLAG)
# Append previous flag
LIST(APPEND _FINAL_FLAGS ${_PREVIOUS_FLAG})
ENDIF()
SET(_PREVIOUS_FLAG ${_FLAG})
ELSE()
IF(_PREVIOUS_FLAG)
# Append previous flag and its parameter
# TODO: escape them only if there is an space
LIST(APPEND _FINAL_FLAGS "${_PREVIOUS_FLAG} \"${_FLAG}\"")
SET(_PREVIOUS_FLAG)
ELSE()
# Shouldn't happen
MESSAGE(FATAL_ERROR "No previous flag before ${_FLAG}")
ENDIF()
ENDIF()
ENDFOREACH()
IF(_PREVIOUS_FLAG)
LIST(APPEND _FINAL_FLAGS ${_PREVIOUS_FLAG})
ENDIF()
SET(PCH_FLAGS ${_FINAL_FLAGS})
# Remove flags that don't work with PCH
LIST(REMOVE_ITEM PCH_FLAGS "-Wa,--noexecstack")
# Remove all empty parameters
LIST(REMOVE_ITEM PCH_FLAGS "")
# Remove duplicate parameters
LIST(REMOVE_DUPLICATES PCH_FLAGS)
# create a command-line string
STRING(REGEX REPLACE ";" " " PCH_FLAGS "${PCH_FLAGS}")
# and separate arguments
SEPARATE_ARGUMENTS(PCH_FLAGS)
ENDMACRO()
MACRO(GET_PDB_FILENAME _out_filename _target)
# determine output directory based on target type
@ -183,44 +306,60 @@ MACRO(GET_PDB_FILENAME _out_filename _target)
SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY)
SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
ELSE(${_targetType} STREQUAL EXECUTABLE)
ELSE()
SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
ENDIF(${_targetType} STREQUAL EXECUTABLE)
ENDIF()
# determine target postfix
STRING(TOUPPER "${CMAKE_BUILD_TYPE}_POSTFIX" _postfix_var_name)
GET_TARGET_PROPERTY(_targetPostfix ${_target} ${_postfix_var_name})
IF(${_targetPostfix} MATCHES NOTFOUND)
SET(_targetPostfix "")
ENDIF(${_targetPostfix} MATCHES NOTFOUND)
ENDIF()
SET(${_out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb")
ENDMACRO(GET_PDB_FILENAME)
MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS _includes)
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})
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
GET_PDB_FILENAME(_PDB_FILE ${_PCH_current_target})
SET(PCH_TEMP_CONTENT)
FOREACH(_include ${_includes})
SET(PCH_TEMP_CONTENT "${PCH_TEMP_CONTENT} -I \"${_include}\"")
ENDFOREACH()
SET(PCH_TEMP_FILE ${CMAKE_CURRENT_BINARY_DIR}/pch_command.txt)
FILE(WRITE ${PCH_TEMP_FILE} "${PCH_TEMP_CONTENT}")
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} /nologo @${PCH_TEMP_FILE} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${_PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
# Ninja PCH Support
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")
ELSE(MSVC)
ELSE()
SET(HEADER_FORMAT "c++-header")
SET(_FLAGS "")
SET(_FLAGS)
IF(APPLE)
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch)
ENDIF(APPLE)
LIST(APPEND _FLAGS ${OBJC_FLAGS})
ENDIF()
FOREACH(_include ${_includes})
LIST(APPEND _FLAGS -I "${_include}")
ENDFOREACH()
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 +369,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 +390,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 +405,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 +418,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 +438,22 @@ 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)
STRING(REPLACE ";" " " OBJC_FLAGS_STR "${OBJC_FLAGS}")
SET(PCH_ADDITIONAL_COMPILER_FLAGS "${OBJC_FLAGS_STR} -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
ENDIF()
IF(WITH_PCH_DEBUG)
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 +464,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 +486,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})
@ -358,72 +498,77 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} ${_ARCH} "")
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_ARCH_${_UPPER_ARCH}_FLAGS};${PCH_FLAGS}")
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_ARCH_${_UPPER_ARCH}_FLAGS};${PCH_FLAGS}" "${PCH_INCLUDES}")
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_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}" "${PCH_INCLUDES}")
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
IF(CMAKE_OSX_ARCHITECTURES AND TARGETS_COUNT GREATER 1)
FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES})
ADD_PRECOMPILED_HEADER(${_targetName}_${_ARCH} ${_inputh} ${_inputcpp})
ENDFOREACH()
ELSE()
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
ENDIF()
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()

@ -35,53 +35,55 @@ SET(UNIX ON)
SET(APPLE ON)
SET(IOS ON)
# Force the compilers to Clang for iOS
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (clang Clang)
CMAKE_FORCE_CXX_COMPILER (clang++ Clang)
# Setup iOS platform
if (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
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 +95,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,50 +136,58 @@ 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")
SET(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} ${CMAKE_SOURCE_DIR}/external $ENV{EXTERNAL_IOS_PATH} CACHE STRING "iOS find search path root")
# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)
SET(CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
SET(CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
# only search the iOS sdks, not the remainder of the host filesystem
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Force the compilers to Clang for iOS
SET(CMAKE_C_COMPILER clang)
SET(CMAKE_CXX_COMPILER clang++)
# Skip the platform compiler checks for cross compiling.
SET(CMAKE_CXX_COMPILER_FORCED TRUE)
SET(CMAKE_C_COMPILER_FORCED TRUE)
#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)

File diff suppressed because it is too large Load Diff

@ -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

@ -1,53 +1,39 @@
PROJECT(NeL CXX C)
IF(WITH_STATIC_DRIVERS)
ADD_DEFINITIONS(-DNL_STATIC)
ENDIF(WITH_STATIC_DRIVERS)
ENDIF()
# 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)
ENDIF(WITH_NEL_MAXPLUGIN)
ENDIF(WIN32)
ENDIF()
ENDIF()
IF(WITH_3D)
FIND_PACKAGE(FreeType)
IF(WITH_NEL_CEGUI)
FIND_PACKAGE(CEGUI)
ENDIF(WITH_NEL_CEGUI)
ENDIF(WITH_3D)
ENDIF()
ENDIF()
IF(WITH_SOUND)
FIND_PACKAGE(Ogg)
FIND_PACKAGE(Vorbis)
FIND_PACKAGE(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWRESAMPLE)
IF(WITH_DRIVER_OPENAL)
FIND_PACKAGE(OpenAL)
ENDIF(WITH_DRIVER_OPENAL)
ENDIF()
IF(WITH_DRIVER_FMOD)
FIND_PACKAGE(FMOD)
ENDIF(WITH_DRIVER_FMOD)
ENDIF(WITH_SOUND)
ENDIF()
ENDIF()
IF(WITH_GTK)
FIND_PACKAGE(GTK2)
ENDIF(WITH_GTK)
IF(WITH_LIBOVR)
FIND_PACKAGE(LibOVR)
ENDIF(WITH_LIBOVR)
IF(WITH_LIBVR)
FIND_PACKAGE(LibVR)
ENDIF(WITH_LIBVR)
ENDIF()
IF(WITH_INSTALL_LIBRARIES)
IF(UNIX)
@ -65,22 +51,15 @@ IF(WITH_INSTALL_LIBRARIES)
CONFIGURE_FILE(nel-config.in ${CMAKE_CURRENT_BINARY_DIR}/nel-config)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nel-config DESTINATION ${NL_BIN_PREFIX})
ENDIF(UNIX)
ENDIF()
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)

@ -71,7 +71,7 @@ public:
// For clipTrav. cleared at beginning of CClipTrav::traverse
void clearVisibleList();
// For ClipTrav only. NB: list is cleared at begininng of traverse(). NB: only CTransform are supported
// For ClipTrav only. NB: list is cleared at beginning of traverse(). NB: only CTransform are supported
void addVisibleModel(CTransform *model)
{
_VisibleList[_CurrentNumVisibleModels]= model;

@ -19,6 +19,8 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/bit_set.h"
#include "nel/misc/smart_ptr.h"
#include <string>
#include <vector>
#include <map>

@ -21,13 +21,17 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/smart_ptr.h"
#include "nel/3d/animatable.h"
#include "nel/3d/track.h"
#include <map>
namespace NL3D
{
class CScene;
// ***************************************************************************
/**
* An animated lightmap

@ -93,7 +93,7 @@ public:
uint addAnimation (const char* fileName, const char* animName, bool displayMissingFileWarning = true)
{
// Allocate an animation
std::auto_ptr<CAnimation> anim (new CAnimation);
CUniquePtr<CAnimation> anim (new CAnimation);
// Read it
NLMISC::CIFile file;
@ -130,7 +130,7 @@ public:
virtual uint addSkeletonWeight (const char* fileName, const char* skelName)
{
// Allocate an animation
std::auto_ptr<CSkeletonWeight> skeletonWeight (new CSkeletonWeight);
CUniquePtr<CSkeletonWeight> skeletonWeight (new CSkeletonWeight);
// Read it
NLMISC::CIFile file;

@ -88,7 +88,7 @@ private:
public:
std::string MeshName;
public:
CMeshLoad (const std::string &meshName, IShape **ppShp, IDriver *pDriver, const CVector &position, uint selectedTexture);
CMeshLoad (const std::string &meshName, IShape **ppShp, IDriver *pDriver, const NLMISC::CVector &position, uint selectedTexture);
void run (void);
void getName (std::string &result) const;
};
@ -122,7 +122,7 @@ private:
CTextureFile *TextureFile;
bool *Signal;
public:
CTextureLoad(CTextureFile *textureFile, bool *psgn, const CVector &position)
CTextureLoad(CTextureFile *textureFile, bool *psgn, const NLMISC::CVector &position)
: TextureFile(textureFile), Signal(psgn)
{
Position = position;

@ -152,7 +152,7 @@ private:
struct CTextureLodToSort
{
CTextureLod *Lod;
CVector Position;
NLMISC::CVector Position;
bool operator<(const CTextureLodToSort &other) const
{
return Lod->Weight<other.Lod->Weight;

@ -31,6 +31,7 @@ namespace NL3D
class UDriver;
class UScene;
class CTextureUser;
//-----------------------------------------------------------------------------------------------------------
//---------------------------------------- CBloomEffect -----------------------------------------------------
@ -52,19 +53,14 @@ public:
// Destructor
~CBloomEffect();
// Called after the Driver initialization to indicate if OpenGL or Direct3D is used.
// They are some differences in bloom algorithm depending on this API choice.
// If bloom effect is activated and supported, private method init() is called to initialize
// textures and materials.
// initBloomEffect = false => directx
// initBloomEffect = true => opengl
void init(bool initBloomEffect);
// Called after the Driver initialization.
void init();
// must be called before init
void setDriver(UDriver *driver) { _Driver = driver; }
UDriver* getDriver() const { return _Driver; }
// must be called before initBloom
// must be called before applyBloom
void setScene(UScene *scene) { _Scene = scene; }
UScene* getScene() const { return _Scene; }
@ -76,6 +72,9 @@ public:
void setDensityBloom(uint8 densityBloom) { _DensityBloom = densityBloom; }
uint8 getDensityBloom() const { return _DensityBloom; }
// Applies bloom to the current render target
void applyBloom();
// Called at the beginning of renderAll method in the main loop, if window has been resized,
// reinitialize bloom textures according to new window size.
// The bloom texture (_InitText attribute) which is used as render target during scene render
@ -83,11 +82,11 @@ public:
// If window size exceeds 256*256 the textures used to apply blur are reinitialized with
// 256*256 size. If a dimension is less than 256, the texture is initialized with the nearer
// power of 2, lower than this window dimension.
void initBloom();
// void initBloom();
// Called at the end of renderAll method in the main loop, recover stretched texture, apply
// both blur passes, and the blending operation between initial render target and the blured one.
void endBloom();
// void endBloom();
// In OpenGL, the use of FBO implies that Z buffer values of scene render have been stored in
// a depth render target. Then, to display 3D interfaces, we must display them in the same FBO,
@ -95,15 +94,12 @@ public:
// This method is called at the end of interfaces display in the main loop, to display final render target
// (with added interfaces) in the color frame buffer.
// NB : In Direct3D, the final render target is displayed at the end of endBloom call.
void endInterfacesDisplayBloom();
// void endInterfacesDisplayBloom();
private:
// Initialize textures and materials.
void init();
// Initialize a bloom texture with new dimensions.
void initTexture(NLMISC::CSmartPtr<NL3D::ITexture> & tex, bool isMode2D, uint32 width, uint32 height);
// void initTexture(NLMISC::CSmartPtr<NL3D::ITexture> & tex, bool isMode2D, uint32 width, uint32 height);
// Called in endBloom method to build a blurred texture. Two passes (then two calls)
// are necessary : horizontal and vertical.
@ -130,6 +126,7 @@ private:
// density of bloom
uint8 _DensityBloom;
/*
// render target textures
// used to display scene
NLMISC::CSmartPtr<NL3D::ITexture> _InitText;
@ -140,13 +137,12 @@ private:
NLMISC::CSmartPtr<NL3D::ITexture> _BlurHorizontalTex;
// original render target
NLMISC::CSmartPtr<NL3D::ITexture> _OriginalRenderTarget;
*/
// materials
// used to display first texture in doBlur passes.
NL3D::UMaterial _BlurMat;
// used to display final render target texture in endInterfacesDisplayBloom call (OpenGL).
NL3D::UMaterial _DisplayInitMat;
// used to blend initial scene render target texture and blur texture according to a
// dest+src - dest*src blend operation.
NL3D::UMaterial _DisplayBlurMat;
@ -156,21 +152,24 @@ private:
// quads
NLMISC::CQuadUV _BlurQuad;
NLMISC::CQuadUV _DisplayQuad;
// openGL or Direct3D?
bool _InitBloomEffect;
// textures and materials already initialized?
bool _Init;
// current window dimensions
uint32 _WndWidth;
uint32 _WndHeight;
/*uint32 _WndWidth;
uint32 _WndHeight;*/
// Temporary variables used during applyBloom(...) ->
// current blur texture dimensions
uint32 _BlurWidth;
uint32 _BlurHeight;
// used as stretched texture from _InitText, as displayed texture in first blur pass,
// and as render target in second blur pass.
CTextureUser *_BlurFinalTex;
// used as render target in first blur pass, and as displayed texture on second blur pass.
CTextureUser *_BlurHorizontalTex;
// <-
};
} // NL3D

@ -20,6 +20,7 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/vector.h"
#include "nel/misc/plane.h"
#include "nel/misc/aabbox.h"
namespace NL3D {
@ -39,16 +40,16 @@ public:
/** build the camera collision as a cone or a cylinder
*/
void build(const CVector &start, const CVector &end, float radius, bool cone);
void build(const NLMISC::CVector &start, const NLMISC::CVector &end, float radius, bool cone);
/** build the camera collision as a simple ray
*/
void buildRay(const CVector &start, const CVector &end);
void buildRay(const NLMISC::CVector &start, const NLMISC::CVector &end);
/** compute the intersection of the Camera Volume against the triangle, and minimize
* minDist (actual square of distance) with min sqr distance of the poly.
*/
void minimizeDistanceAgainstTri(const CVector &p0, const CVector &p1, const CVector &p2, float &sqrMinDist);
void minimizeDistanceAgainstTri(const NLMISC::CVector &p0, const NLMISC::CVector &p1, const NLMISC::CVector &p2, float &sqrMinDist);
/** Compute into this the camera collision 'other' mul by 'matrix'
* NB: for cone Radius, suppose uniform scale, else will have strange result (a uniform scale is deduced)
@ -69,9 +70,9 @@ private:
enum {MaxNPlanes=6};
// The start of the camera raycast
CVector _Start;
NLMISC::CVector _Start;
// The end of the camera raycast
CVector _End;
NLMISC::CVector _End;
// The radius (at end only if cone)
float _Radius;
// cone or cylinder?
@ -83,8 +84,8 @@ private:
NLMISC::CAABBox _BBox;
// Temp Data for minimizeDistanceAgainstTri
CVector _ArrayIn[3+MaxNPlanes];
CVector _ArrayOut[3+MaxNPlanes];
NLMISC::CVector _ArrayIn[3+MaxNPlanes];
NLMISC::CVector _ArrayOut[3+MaxNPlanes];
// The pyramid representing the camera collision volume. Nb: local to start for precision problems
NLMISC::CPlane _Pyramid[MaxNPlanes];
@ -97,10 +98,10 @@ private:
float _MaxRadiusProj;
float _OODeltaRadiusProj;
float _RayLen;
CVector _RayNorm;
NLMISC::CVector _RayNorm;
// simpler method for simple ray
void intersectRay(const CVector &p0, const CVector &p1, const CVector &p2, float &sqrMinDist);
void intersectRay(const NLMISC::CVector &p0, const NLMISC::CVector &p1, const NLMISC::CVector &p2, float &sqrMinDist);
};

@ -22,6 +22,7 @@ namespace NL3D
class UDriver;
class UCamera;
class CCloudScape;
class CScene;
/// implementation of UWaterInstance methods
class CCloudScapeUser : public UCloudScape

@ -120,7 +120,7 @@ public:
void setWorldMatrix (const NLMISC::CMatrix &WM);
bool isRoot() { return _LocalVolume.size() == 0; }
bool isRoot() { return _LocalVolume.empty(); }
//\name Sound related.
//@{

@ -84,7 +84,7 @@ public:
void setTextureFile (const char* file);
/**
* Add a coarse mesh in the manager. If an error occured, it returns CantAddCoarseMesh.
* Add a coarse mesh in the manager. If an error occurred, it returns CantAddCoarseMesh.
* \param vBuffer the VertexBuffer pre-transformed / Colored. Size MUST be numVertices*NL3D_COARSEMESH_VERTEX_FORMAT_MGR
* \param indexBuffer containing triangles that will be inserted.
* \return false if the mesh can't be added to this pass BECAUSE OF TOO MANY VERTICES or TOO MANY PRIMITIVES reason

@ -178,6 +178,10 @@ public:
CVertexBuffer Vertices;
CMaterial *Material;
CRGBA Color;
ucstring Text;
uint32 CacheVersion;
/// The width of the string, in pixels (eg: 30)
float StringWidth;
/// The height of the string, in pixels (eg: 10)
@ -223,6 +227,7 @@ public:
*/
CComputedString (bool bSetupVB=true)
{
CacheVersion = 0;
StringWidth = 0;
StringHeight = 0;
if (bSetupVB)

@ -42,9 +42,6 @@
namespace NLMISC
{
class IEventEmitter;
struct IMouseDevice;
struct IKeyboardDevice;
struct IInputDeviceManager;
class CRect;
class CLog;
}
@ -75,6 +72,7 @@ struct IOcclusionQuery;
/// A Graphic Mode descriptor.
struct GfxMode
{
std::string DisplayDevice;
bool OffScreen;
bool Windowed;
uint16 Width;
@ -93,7 +91,7 @@ struct GfxMode
Frequency = 0;
AntiAlias = -1;
}
GfxMode(uint16 w, uint16 h, uint8 d, bool windowed = true, bool offscreen = false, uint frequency = 0, sint8 aa = -1);
GfxMode(uint16 w, uint16 h, uint8 d, bool windowed = true, bool offscreen = false, uint frequency = 0, sint8 aa = -1, const std::string &displayDevice = std::string());
};
// ****************************************************************************
@ -226,7 +224,7 @@ public:
// @{
// first param is the associated window.
// Must be a HWND for Windows (WIN32).
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show = true, bool resizeable = true) throw(EBadDisplay) = 0;
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show = true, bool resizeable = true) = 0;
// Must be called after a setDisplay that initialize the mode
virtual bool setMode(const GfxMode &mode) = 0;
virtual bool getModes(std::vector<GfxMode> &modes) = 0;
@ -259,7 +257,7 @@ public:
virtual emptyProc getWindowProc() = 0;
virtual NLMISC::IEventEmitter *getEventEmitter() = 0;
/// Copy a string to system clipboard.
virtual bool copyTextToClipboard(const ucstring &text) = 0;
@ -362,7 +360,7 @@ public:
virtual void getDepthRange(float &znear, float &zfar) const = 0;
// @}
/// \name Textures
// @{
@ -417,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.
@ -434,7 +442,7 @@ public:
* Under OpenGL this simply returns the maximum number of texture stages (getNbTextureStages) in both return values.
*/
virtual void getNumPerStageConstant(uint &lightedMaterial, uint &unlightedMaterial) const = 0;
// [DEPRECATED] Return if this texture is a rectangle texture that requires RECT sampler (OpenGL specific pre-NPOT functionality)
virtual bool isTextureRectangle(ITexture *tex) const = 0;
@ -442,7 +450,7 @@ public:
virtual bool supportNonPowerOfTwoTextures() const = 0;
// @}
/// \name Texture operations
// @{
@ -495,7 +503,7 @@ public:
*
* NB: you must setupViewMatrix() BEFORE setupModelMatrix(), or else undefined results.
*/
virtual void setupViewMatrix(const CMatrix &mtx)=0;
virtual void setupViewMatrix(const CMatrix &mtx) = 0;
/** setup the view matrix (inverse of camera matrix).
* Extended: give a cameraPos (mtx.Pos() is not taken into account but for getViewMatrix()),
@ -536,7 +544,7 @@ public:
virtual bool isForceNormalize() const = 0;
// @}
/// \name Vertex Buffer Hard: Features
// @{
@ -737,7 +745,7 @@ public:
virtual uint getSwapVBLInterval() = 0;
// @}
@ -857,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;
// @}
@ -869,29 +883,6 @@ public:
/// x and y must be between 0.0 and 1.0
virtual void setMousePos(float x, float y) = 0;
/** Enable / disable low level mouse. This allow to take advantage of some options (speed of the mouse, automatic wrapping)
* It returns a interface to these parameters when it is supported, or NULL otherwise
* The interface pointer is valid as long as the low level mouse is enabled.
* A call to disable the mouse returns NULL, and restore the default mouse behavior
* NB : - In this mode the mouse cursor isn't drawn.
* - Calls to showCursor have no effects
* - Calls to setCapture have no effects
*/
virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive) = 0;
/** Enable / disable a low level keyboard.
* Such a keyboard can only send KeyDown and KeyUp event. It just consider the keyboard as a
* gamepad with lots of buttons...
* This returns a interface to some parameters when it is supported, or NULL otherwise.
* The interface pointer is valid as long as the low level keyboard is enabled.
* A call to disable the keyboard returns NULL, and restore the default keyboard behavior
*/
virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable) = 0;
/** Get the delay in ms for mouse double clicks.
*/
virtual uint getDoubleClickDelay(bool hardwareMouse) = 0;
/** If true, capture the mouse to force it to stay under the window.
* NB : this has no effects if a low level mouse is used
*/
@ -908,11 +899,6 @@ public:
// Change default scale for all cursors
virtual void setCursorScale(float scale) = 0;
/** Check whether there is a low level device manager available, and get its interface. Return NULL if not available
* From this interface you can deal with mouse and keyboard as above, but you can also manage game device (joysticks, joypads ...)
*/
virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager() = 0;
// @}
@ -1005,6 +991,9 @@ public:
) = 0;
// @}
/// Hack for bloom
virtual bool textureCoordinateAlternativeMode() const = 0;
/// \name Render state: Polygon mode
@ -1106,7 +1095,7 @@ public:
virtual bool supportVertexProgram(CVertexProgram::TProfile profile) const = 0;
/** Compile the given vertex program, return if successful.
* If a vertex program was set active before compilation,
* If a vertex program was set active before compilation,
* the state of the active vertex program is undefined behaviour afterwards.
*/
virtual bool compileVertexProgram(CVertexProgram *program) = 0;
@ -1133,7 +1122,7 @@ public:
virtual bool supportPixelProgram(CPixelProgram::TProfile profile) const = 0;
/** Compile the given pixel program, return if successful.
* If a pixel program was set active before compilation,
* If a pixel program was set active before compilation,
* the state of the active pixel program is undefined behaviour afterwards.
*/
virtual bool compilePixelProgram(CPixelProgram *program) = 0;
@ -1160,7 +1149,7 @@ public:
virtual bool supportGeometryProgram(CGeometryProgram::TProfile profile) const = 0;
/** Compile the given pixel program, return if successful.
* If a pixel program was set active before compilation,
* If a pixel program was set active before compilation,
* the state of the active pixel program is undefined behaviour afterwards.
*/
virtual bool compileGeometryProgram(CGeometryProgram *program) = 0;
@ -1359,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.
@ -1449,7 +1439,6 @@ protected:
private:
bool _StaticMemoryToVRAM;
};
// --------------------------------------------------

@ -34,7 +34,7 @@
#include "nel/3d/vertex_stream_manager.h"
#include "nel/3d/async_texture_manager.h"
#include "nel/3d/lod_character_manager.h"
#include "nel/3d/render_target_manager.h"
namespace NL3D
{
@ -71,6 +71,7 @@ protected:
bool _WindowInit;
CMatrixContext _CurrentMatrixContext;
CFontManager _FontManager;
CRenderTargetManager _RenderTargetManager;
// Components List.
typedef CPtrSet<CTextureUser> TTextureSet;
typedef CPtrSet<CTextContextUser> TTextContextSet;
@ -108,6 +109,11 @@ protected:
CMaterial _MatTextInternal;
CMaterial _MatTextStretchInternal;
// Default render target for effect pipeline
CTextureUser *_EffectRenderTarget;
UMaterial _MatRenderTarget;
CMaterial _MatRenderTargetInt;
NLMISC::CQuadUV _RenderTargetQuad;
// StaticInit
static bool _StaticInit;
@ -241,6 +247,16 @@ public:
// @}
/// Get the render target manager
virtual CRenderTargetManager &getRenderTargetManager() { return _RenderTargetManager; }
/// Set a texture the size of the window as render target
virtual void beginDefaultRenderTarget(uint32 width = 0, uint32 height = 0);
/// Draw the render target to the back buffer
virtual void endDefaultRenderTarget(UScene *scene);
/// \name Components gestion for Interface 2D/3D.
// @{
@ -396,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 ();
@ -410,21 +427,6 @@ public:
virtual bool fillBuffer (CBitmap &bitmap);
// @}
/// \name Mouse / Keyboards / Game devices
// @{
virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive);
//
virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable);
virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager();
/**
* wrapper for IEventEmitter::emulateMouseRawMode()
*/
virtual void emulateMouseRawMode(bool enable);
virtual uint getDoubleClickDelay(bool hardwareMouse);
/// show cursor if b is true, or hide it if b is false
virtual void showCursor (bool b);
/// x and y must be between 0.0 and 1.0
@ -473,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);
// @}

@ -134,14 +134,14 @@ class CDRU
public:
/// Portable Function which create a GL Driver (using gl dll...).
static IDriver *createGlDriver() throw(EDru);
static IDriver *createGlDriver();
/// Portable Function which create a GL ES Driver (using gl dll...).
static IDriver *createGlEsDriver() throw(EDru);
static IDriver *createGlEsDriver();
#ifdef NL_OS_WINDOWS
/// Windows Function which create a Direct3d Driver.
static IDriver *createD3DDriver() throw(EDru);
static IDriver *createD3DDriver();
#endif // NL_OS_WINDOWS
/// \name 2D render.

@ -48,7 +48,7 @@ public:
static void releaseInstance();
/// convert a HLS (0..255) to a RGBA.
CRGBA convert(uint H, uint L, uint S);
NLMISC::CRGBA convert(uint H, uint L, uint S);
/// convert a RGBA bitmap into another RGBA, with HLS decal (0..255, -255..+255, -255..+255).
void convertRGBABitmap(NLMISC::CBitmap &dst, const NLMISC::CBitmap &src, uint8 dh, sint dl, sint ds);
@ -75,7 +75,7 @@ private:
uint8 H,L,S,A;
};
CRGBA _HueTable[HueTableSize];
NLMISC::CRGBA _HueTable[HueTableSize];
CHLSA _Color16ToHLS[65536];
/// Constructor

@ -55,7 +55,7 @@ public:
CFlareShape();
/// serial this shape
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
//@}

@ -21,8 +21,12 @@
#undef NL_DONT_USE_EXTERNAL_CODE
#ifndef NL_DONT_USE_EXTERNAL_CODE
#include <ft2build.h>
#include FT_FREETYPE_H
// forward declarations to avoid including freetype.h in headers
typedef int FT_Error;
typedef struct FT_LibraryRec_ *FT_Library;
typedef struct FT_FaceRec_* FT_Face;
#else // NL_DONT_USE_EXTERNAL_CODE
#endif // NL_DONT_USE_EXTERNAL_CODE
@ -54,11 +58,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
*
@ -72,6 +78,8 @@ public:
uint32 getUID() { return _UID; }
std::string getFontFileName() const;
private:
static uint32 _FontGeneratorCounterUID;

@ -59,6 +59,9 @@ class CFontManager
CSmartPtr<CMaterial> _MatFont;
CSmartPtr<CTextureFont> _TexFont;
// Keep track number of textures created to properly report cache version
uint32 _TexCacheNr;
public:
/**
@ -71,6 +74,7 @@ public:
_NbChar = 0;
_MatFont = NULL;
_TexFont = NULL;
_TexCacheNr = 0;
}
@ -94,7 +98,6 @@ public:
*/
CMaterial* getFontMaterial();
/**
* Compute primitive blocks and materials of each character of
* the string.
@ -102,6 +105,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 +115,8 @@ public:
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString& output,
bool keep800x600Ratio= true);
@ -121,6 +128,8 @@ public:
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString &output,
bool keep800x600Ratio= true);
@ -132,6 +141,8 @@ public:
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString &output,
bool keep800x600Ratio= true);
@ -144,7 +155,8 @@ public:
void dumpCache (const char *filename)
{
_TexFont->dumpTextureFont (filename);
if (_TexFont)
_TexFont->dumpTextureFont (filename);
}
/**
@ -152,6 +164,15 @@ public:
*/
void invalidate();
// get font atlas rebuild count
uint32 getCacheVersion() const
{
if (_TexFont)
return (_TexFont->getCacheVersion() << 16) + _TexCacheNr;
return 0;
}
};

@ -0,0 +1,84 @@
/**
* \file fxaa.h
* \brief CFXAA
* \date 2014-08-03 21:41GMT
* \author Jan Boon (Kaetemi)
* CFXAA
*/
/*
* Copyright (C) 2014 by authors
*
* This file is part of NL3D.
* NL3D 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.
*
* NL3D 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 NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_FXAA_H
#define NL3D_FXAA_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/smart_ptr.h>
#include <nel/misc/geom_ext.h>
// Project includes
#include <nel/3d/u_material.h>
#include <nel/3d/vertex_buffer.h>
#define NL_STEREO_MAX_USER_CAMERAS 8
namespace NL3D {
class ITexture;
class CTextureUser;
class CPixelProgram;
class CVertexProgram;
/**
* \brief CFXAA
* \date 2014-08-03 21:41GMT
* \author Jan Boon (Kaetemi)
* CFXAA
*/
class CFXAA
{
public:
CFXAA(NL3D::UDriver *driver);
virtual ~CFXAA();
/// Apply effect to current render target. Render target must be managed by render target manager
virtual void applyEffect();
private:
UDriver *m_Driver;
NL3D::UMaterial m_Mat;
// NL3D::CVertexBuffer m_VB;
NLMISC::CQuadUV m_QuadUV;
CVertexProgram *m_VP;
CPixelProgram *m_PP;
uint m_Width;
uint m_Height;
}; /* class CFXAA */
} /* namespace NL3D */
#endif /* #ifndef NL3D_FXAA_H */
/* end of file */

@ -27,7 +27,8 @@
#ifndef NL3D_GPU_PROGRAM_PARAMS_H
#define NL3D_GPU_PROGRAM_PARAMS_H
#include <nel/misc/types_nl.h>
#include "nel/misc/types_nl.h"
// STL includes
#include <map>
@ -167,7 +168,7 @@ private:
std::map<std::string, size_t> m_MapName; // map from name to offset
size_t m_First;
size_t m_Last;
static const size_t s_End = -1;
static const size_t s_End;
}; /* class CGPUProgramParams */

@ -26,6 +26,7 @@
namespace NL3D
{
class CInstanceGroup;
// ***************************************************************************
/**
@ -106,14 +107,14 @@ public:
public:
/// Debug: build a colored Grid mesh of SunContribution.
void buildSunDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const CVector &deltaPos=CVector::Null);
void buildSunDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const NLMISC::CVector &deltaPos= NLMISC::CVector::Null);
/// Debug: build a colored Grid mesh of PointLight. R= pointLight1 id. G= PointLight2 id. B= The multiplier used to show Ids.
void buildPLDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const CVector &deltaPos, const CInstanceGroup &igOut);
void buildPLDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const NLMISC::CVector &deltaPos, const CInstanceGroup &igOut);
private:
void addDebugMeshFaces(CMesh::CMeshBuild &meshBuild, CSurface &surface, uint vId0,
const std::vector<CRGBA> &colors);
const std::vector<NLMISC::CRGBA> &colors);
};

@ -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;

@ -47,7 +47,7 @@ public:
public:
/// Serial
void serial (NLMISC::IStream& f) throw (NLMISC::EStream)
void serial (NLMISC::IStream& f)
{
// Version number
(void)f.serialVersion (0);
@ -83,7 +83,7 @@ class CKeyTCB : public CKey<T>
public:
/// Serial
void serial (NLMISC::IStream& f) throw (NLMISC::EStream)
void serial (NLMISC::IStream& f)
{
// Version number
(void)f.serialVersion (0);
@ -130,7 +130,7 @@ class CKeyBezier : public CKey<T>
public:
/// Serial
void serial (NLMISC::IStream& f) throw (NLMISC::EStream)
void serial (NLMISC::IStream& f)
{
// Version number
(void)f.serialVersion (0);
@ -180,7 +180,7 @@ template<> class CKeyTCB<NLMISC::CAngleAxis> : public CKey<NLMISC::CAngleAxis>
public:
/// Serial
void serial (NLMISC::IStream& f) throw (NLMISC::EStream)
void serial (NLMISC::IStream& f)
{
// Version number
(void)f.serialVersion (0);
@ -228,7 +228,7 @@ template<> class CKeyBezier<NLMISC::CQuat> : public CKey<NLMISC::CQuat>
public:
/// Serial
void serial (NLMISC::IStream& f) throw (NLMISC::EStream)
void serial (NLMISC::IStream& f)
{
// Version number
(void)f.serialVersion (0);

@ -168,9 +168,9 @@ public:
void clear();
/// Verify the binding of patchs of all zones. throw EBadBind if error.
void checkBinds() throw(EBadBind);
void checkBinds();
/// Verify the binding of patchs of one zone. throw EBadBind if error. nop if zone not loaded.
void checkBinds(uint16 zoneId) throw(EBadBind);
void checkBinds(uint16 zoneId);
/**
* Build tileBank. Call this after loading the near and far tile banks.
@ -716,7 +716,7 @@ private:
bool _RefineMode;
float _FarTransition;
uint _TileMaxSubdivision;
// For VertexProgram. true if change has occured in threshold since the last render().
// For VertexProgram. true if change has occurred in threshold since the last render().
float _VPThresholdChange;
/// \name VertexBuffer mgt.

@ -692,7 +692,7 @@ private:
{
NLMISC::CMatrix TexMat[IDRV_MAT_MAXTEXTURES];
};
std::auto_ptr<CUserTexMat> _TexUserMat; // user texture matrix
CUniquePtr<CUserTexMat> _TexUserMat; // user texture matrix
public:
// Private. For Driver only.

@ -47,7 +47,7 @@ public:
float a31, a32, a33, a34;
// Copy from a matrix.
void set(const CMatrix &mat)
void set(const NLMISC::CMatrix &mat)
{
const float *m =mat.get();
a11= m[0]; a12= m[4]; a13= m[8] ; a14= m[12];
@ -57,14 +57,14 @@ public:
// mulSetvector. NB: in should be different as v!! (else don't work).
void mulSetVector(const CVector &in, CVector &out)
void mulSetVector(const NLMISC::CVector &in, NLMISC::CVector &out)
{
out.x= (a11*in.x + a12*in.y + a13*in.z);
out.y= (a21*in.x + a22*in.y + a23*in.z);
out.z= (a31*in.x + a32*in.y + a33*in.z);
}
// mulSetpoint. NB: in should be different as v!! (else don't work).
void mulSetPoint(const CVector &in, CVector &out)
void mulSetPoint(const NLMISC::CVector &in, NLMISC::CVector &out)
{
out.x= (a11*in.x + a12*in.y + a13*in.z + a14);
out.y= (a21*in.x + a22*in.y + a23*in.z + a24);
@ -73,14 +73,14 @@ public:
// mulSetvector. NB: in should be different as v!! (else don't work).
void mulSetVector(const CVector &in, float scale, CVector &out)
void mulSetVector(const NLMISC::CVector &in, float scale, NLMISC::CVector &out)
{
out.x= (a11*in.x + a12*in.y + a13*in.z) * scale;
out.y= (a21*in.x + a22*in.y + a23*in.z) * scale;
out.z= (a31*in.x + a32*in.y + a33*in.z) * scale;
}
// mulSetpoint. NB: in should be different as v!! (else don't work).
void mulSetPoint(const CVector &in, float scale, CVector &out)
void mulSetPoint(const NLMISC::CVector &in, float scale, NLMISC::CVector &out)
{
out.x= (a11*in.x + a12*in.y + a13*in.z + a14) * scale;
out.y= (a21*in.x + a22*in.y + a23*in.z + a24) * scale;
@ -89,14 +89,14 @@ public:
// mulAddvector. NB: in should be different as v!! (else don't work).
void mulAddVector(const CVector &in, float scale, CVector &out)
void mulAddVector(const NLMISC::CVector &in, float scale, NLMISC::CVector &out)
{
out.x+= (a11*in.x + a12*in.y + a13*in.z) * scale;
out.y+= (a21*in.x + a22*in.y + a23*in.z) * scale;
out.z+= (a31*in.x + a32*in.y + a33*in.z) * scale;
}
// mulAddpoint. NB: in should be different as v!! (else don't work).
void mulAddPoint(const CVector &in, float scale, CVector &out)
void mulAddPoint(const NLMISC::CVector &in, float scale, NLMISC::CVector &out)
{
out.x+= (a11*in.x + a12*in.y + a13*in.z + a14) * scale;
out.y+= (a21*in.x + a22*in.y + a23*in.z + a24) * scale;

@ -85,7 +85,7 @@ public:
// This is slow but doesn't matter since used at mesh building....
CCorner();
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
};
/// A Triangle face.
@ -94,7 +94,7 @@ public:
CCorner Corner[3];
sint32 MaterialId;
sint32 SmoothGroup;
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
};
@ -118,7 +118,7 @@ public:
}
}
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
};
struct CVertLink
@ -203,7 +203,7 @@ public:
CMeshBuild();
// Serialization
//void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
//void serial(NLMISC::IStream &f);
};
//@}
@ -257,7 +257,7 @@ public:
virtual void render(IDriver *drv, CTransformShape *trans, bool opaquePass);
/// serial this mesh.
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
NLMISC_DECLARE_CLASS(CMesh);
/// get trinagle count.
@ -370,7 +370,7 @@ public:
virtual float getNumTriangles (float distance);
/// serial this mesh.
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
NLMISC_DECLARE_CLASS(CMeshGeom);
// profile

@ -146,7 +146,7 @@ public:
CMeshBaseBuild();
// Serialization is not used
//void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
//void serial(NLMISC::IStream &f);
};
//@}
@ -201,7 +201,7 @@ public:
// @}
/// serial the base Part of this mesh.
void serialMeshBase(NLMISC::IStream &f) throw(NLMISC::EStream);
void serialMeshBase(NLMISC::IStream &f);
/// Flush textures
void flushTextures (IDriver &driver, uint selectedTexture);

@ -43,7 +43,7 @@ public:
std::vector<uint32> VertRefs; // Array of vertices reference
void serial (NLMISC::IStream &f) throw(NLMISC::EStream);
void serial (NLMISC::IStream &f);
};
// ***************************************************************************
@ -90,7 +90,7 @@ public:
NLMISC::CObjectVector<CRawSkinVertex*, false> &vertexRemap,
std::vector<CAnimatedMorph> *pBSFactor);
void serial (NLMISC::IStream &f) throw(NLMISC::EStream);
void serial (NLMISC::IStream &f);
private:

@ -115,7 +115,7 @@ public:
virtual float getNumTriangles (float distance);
/// serial this meshGeom.
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
NLMISC_DECLARE_CLASS(CMeshMRMGeom);
/// Scene profile
@ -579,11 +579,11 @@ private:
/// load the header of this mesh. return the version of the header.
sint loadHeader(NLMISC::IStream &f) throw(NLMISC::EStream);
sint loadHeader(NLMISC::IStream &f);
/// load this mesh.
void load(NLMISC::IStream &f) throw(NLMISC::EStream);
void load(NLMISC::IStream &f);
/// save the entire mesh.
void save(NLMISC::IStream &f) throw(NLMISC::EStream);
void save(NLMISC::IStream &f);
// Build bone Usage information for serialized mesh <= version 2.
void buildBoneUsageVer2 ();
@ -702,7 +702,7 @@ public:
virtual float getNumTriangles (float distance);
/// serial this mesh.
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
NLMISC_DECLARE_CLASS(CMeshMRM);
/// Get bbox.

@ -125,7 +125,7 @@ public:
virtual void getAABBox(NLMISC::CAABBox &bbox) const;
/// serial this mesh.
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
/// Declare name of the shape
NLMISC_DECLARE_CLASS(CMeshMultiLod);
@ -238,7 +238,7 @@ private:
std::vector<TCoarseMeshIndexType> CoarseTriangles;
/// Serial
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
/// Is Opaque ?
bool isOpaque() { return (Flags&IsOpaque)!=0; }

@ -65,7 +65,7 @@ public:
const NLMISC::CMatrix &invertedModelMat,
const NLMISC::CVector &viewerPos);
virtual void end(IDriver *drv);
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
virtual void setupForMaterial(const CMaterial &mat,
IDriver *drv,
CScene *scene,

@ -90,7 +90,7 @@ public:
virtual float getMaxVertexMove();
// Serial.
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
NLMISC_DECLARE_CLASS(CMeshVPWindTree);
// @}
@ -124,7 +124,7 @@ private:
double _LastSceneTime;
// maximum amplitude vector for each level. Stored in mesh because same for all instances.
CVector _MaxDeltaPos[HrcDepth];
NLMISC::CVector _MaxDeltaPos[HrcDepth];
float _MaxVertexMove;
// MBR Cache

@ -64,7 +64,7 @@ public:
*
* You can access the driver with CNELU::Driver.
*/
static bool initDriver(uint w, uint h, uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen=false, bool direct3d=false) throw(EDru);
static bool initDriver(uint w, uint h, uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen=false, bool direct3d=false);
/** Init all that we need for a Scene.
* - register scene basics models,
@ -108,7 +108,7 @@ public:
* - initScene();
* - initEventServer();
*/
static bool init(uint w, uint h, CViewport viewport=CViewport(), uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen = false, bool direct3d = false) throw(EDru);
static bool init(uint w, uint h, CViewport viewport=CViewport(), uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen = false, bool direct3d = false);
/** Delete all:
* - releaseEventServer();

@ -54,9 +54,9 @@ public:
void build(std::vector<TPackedZoneBaseSPtr> &packesZones);
bool raytrace(const NLMISC::CVector &start, const NLMISC::CVector &end, NLMISC::CVector &inter, std::vector<NLMISC::CTriangle> *testedTriangles = NULL, NLMISC::CVector *normal = NULL);
void getZones(std::vector<TPackedZoneBaseSPtr> &zones);
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
// just serialize the header, containing name of the zones this CPackedWorld was built from
void serialZoneNames(NLMISC::IStream &f) throw(NLMISC::EStream);
void serialZoneNames(NLMISC::IStream &f);
/** Roughly select triangles that are within a convex 2D polygon (world coordinates)
* Selection is not exact, because limited to the resolution of the grid into which is packed each zone.
* Triangle that are within are guaranteed to be selected, however.
@ -68,7 +68,7 @@ private:
public:
TPackedZoneBaseSPtr Zone;
uint32 RaytraceCounter;
void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void serial(NLMISC::IStream &f)
{
f.serialVersion(1);
CPackedZoneBase *pz = Zone;
@ -81,7 +81,7 @@ private:
{
public:
std::vector<uint32> IDs; // make a class from this vector just for serialization
void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void serial(NLMISC::IStream &f)
{
f.serialCont(IDs);
}

@ -52,7 +52,7 @@ class CPackedVertex
public:
uint16 X, Y, Z;
public:
void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void serial(NLMISC::IStream &f)
{
f.serial(X, Y, Z);
}
@ -68,7 +68,7 @@ class CPackedTri
public:
uint32 V0, V1, V2;
public:
void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void serial(NLMISC::IStream &f)
{
f.serial(V0, V1, V2);
}
@ -79,7 +79,7 @@ class CPackedTri16
public:
uint16 V0, V1, V2;
public:
void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void serial(NLMISC::IStream &f)
{
f.serial(V0, V1, V2);
}
@ -101,7 +101,7 @@ public:
sint32 ZoneY;
public:
virtual ~CPackedZoneBase() {}
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) = 0;
virtual void serial(NLMISC::IStream &f) = 0;
// TMP For debug : render position covered by a frustum
virtual void render(CVertexBuffer &vb, IDriver &drv, CMaterial &mat, CMaterial &wiredMaterial, const NLMISC::CMatrix &camMat, uint batchSize, const NLMISC::CVector localFrustCorners[8]) = 0;
// raytracing test
@ -138,7 +138,7 @@ public:
sint32 zoneX,
sint32 zoneY
);
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
// TMP For debug : render porition covered by a frustum
void render(CVertexBuffer &vb, IDriver &drv, CMaterial &mat, CMaterial &wiredMaterial, const NLMISC::CMatrix &camMat, uint batchSize, const NLMISC::CVector localFrustCorners[8]);
// try to build a 16 bit version of this packed zone to save some more place
@ -183,7 +183,7 @@ public:
NLMISC_DECLARE_CLASS(CPackedZone16)
CPackedZone16();
//
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
// TMP For debug : render position covered by a frustum
void render(CVertexBuffer &vb, IDriver &drv, CMaterial &mat, CMaterial &wiredMaterial, const NLMISC::CMatrix &camMat, uint batchSize, const NLMISC::CVector localFrustCorners[8]);
// raytracing test

@ -84,7 +84,7 @@ public:
/// dtor
virtual ~CParticleSystem();
/// serialize this particle system
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
/** Merge this system with a system instanciated from the given shape
* NB : This is for edition purpose, this is slow
* \return true if the operation could be performed. It can fail when this cause the system the system to last forever,
@ -841,7 +841,7 @@ public:
/// return true when there are still emitters in the system
bool hasEmitters(void) const;
bool hasEmitters() const;
/// return true when there are still particles
bool hasParticles() 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);

@ -87,7 +87,7 @@ private:
{
public:
CParticleSystemModel *Model;
CMatrix OldAncestorMatOrRelPos; // last matrix of ancestor skeleton or relative matrix of ps to its ancestor (see flag below)
NLMISC::CMatrix OldAncestorMatOrRelPos; // last matrix of ancestor skeleton or relative matrix of ps to its ancestor (see flag below)
bool IsRelMatrix; // gives usage of the field OldAncestorMatOrRelPos
bool HasAncestorSkeleton; // has the system an ancestor skeleton ?
public:

@ -102,7 +102,7 @@ class CParticleSystemProcess : public NLMISC::IStreamable
* Everything is saved, except for the fontManager and the fontGenerator.
* They must be set again if the PSToolRender pass is used.
*/
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) ;
virtual void serial(NLMISC::IStream &f);
/// @}
@ -163,10 +163,10 @@ class CParticleSystemProcess : public NLMISC::IStreamable
virtual void setMatrixMode(TPSMatrixMode matrixMode);
/// tells whether there are alive entities / particles in the system
virtual bool hasParticles(void) const { return false ; }
virtual bool hasParticles() const { return false ; }
/// tells whether there are alive emitters / particles in the system
virtual bool hasEmitters(void) const { return false ; }
virtual bool hasEmitters() const { return false ; }
/// max number of faces wanted by this process (for load balancing)

@ -90,7 +90,7 @@ public:
// @}
/// serial the shape
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
NLMISC_DECLARE_CLASS(CParticleSystemShape);

@ -92,9 +92,9 @@ public:
void setWorldMatrix (const NLMISC::CMatrix &WM);
void setName (std::string &name) { _Name = name; }
void setName (const std::string &name) { _Name = name; }
std::string getName () { return _Name; }
std::string getName () const { return _Name; }
void open (bool opened) { _Opened = opened; }
bool isOpened () { return _Opened; }

@ -202,7 +202,7 @@ public:
uint size() const { return _Size; }
/// serialization
void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void serial(NLMISC::IStream &f)
{
if (f.isReading())
{
@ -262,7 +262,7 @@ public:
CPSAttrib();
/// Serialization method
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
void serial(NLMISC::IStream &f);
// swap with another vector
void swap(CPSAttrib<T> &other);
@ -429,7 +429,7 @@ void CPSAttrib<T>::remove(uint32 index)
}
template <typename T>
void CPSAttrib<T>::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void CPSAttrib<T>::serial(NLMISC::IStream &f)
{
// version 4 to 5 => bug with size being > capacity
sint ver = f.serialVersion(5);

@ -60,7 +60,7 @@ struct CPSInputType
uint32 UserParamNum;
};
void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void serial(NLMISC::IStream &f)
{
f.serialEnum(InputType);
switch(InputType)
@ -124,7 +124,7 @@ public:
}
/// serialisation of the object. Derivers MUST call this, (if they use the attribute of this class at least)
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
virtual void serial(NLMISC::IStream &f)
{
f.serialVersion(1);
f.serial(_NbCycles);

@ -103,7 +103,7 @@ public:
uint32 srcStep = (1 << 16)
) const;
virtual void serial (NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial (NLMISC::IStream &f);
virtual void deleteElement (uint32 index);
virtual void newElement (const CPSEmitterInfo &info);
virtual void resize (uint32 capacity, uint32 nbPresentElements);

@ -282,7 +282,7 @@ inline float CPSAttribMakerBinOp<float>::getMaxValue(void) const
template <class T>
inline CPSAttribMakerBinOp<T>::CPSAttribMakerBinOp(const CPSAttribMakerBinOp &other) : CPSAttribMaker<T>(other) // parent copy ctor
{
std::auto_ptr<CPSAttribMaker<T> > a0(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[0]->clone()))
CUniquePtr<CPSAttribMaker<T> > a0(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[0]->clone()))
, a1(NLMISC::safe_cast<CPSAttribMaker<T> *>(other._Arg[1]->clone()));
this->_Op = other._Op;
this->_Size = other._Size;
@ -729,7 +729,7 @@ inline void CPSAttribMakerBinOp<T>::makeN(CPSLocated *loc,
//=================================================================================================================
template <class T>
inline void CPSAttribMakerBinOp<T>::serial (NLMISC::IStream &f) throw(NLMISC::EStream)
inline void CPSAttribMakerBinOp<T>::serial (NLMISC::IStream &f)
{
if (f.isReading())
{

@ -96,7 +96,7 @@ template <typename T, class F> class CPSAttribMakerT : public CPSAttribMaker<T>
/// serialization of the object
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
virtual void serial(NLMISC::IStream &f)
{
sint ver = f.serialVersion(2);
CPSAttribMaker<T>::serial(f);
@ -1463,7 +1463,7 @@ public:
CPSAttribMakerMemoryBase(const CPSAttribMakerMemoryBase &src) : CPSAttribMaker<T>(src) // parent copy ctor
{
nlassert(src._Scheme);
std::auto_ptr<CPSAttribMaker<T> > s(NLMISC::safe_cast<CPSAttribMaker<T> *>(src._Scheme->clone()));
CUniquePtr<CPSAttribMaker<T> > s(NLMISC::safe_cast<CPSAttribMaker<T> *>(src._Scheme->clone()));
this->_T = src._T;
this->_DefaultValue = src._DefaultValue;
this->_Scheme = s.release();
@ -1624,7 +1624,7 @@ public:
}
/// serialisation of the object. Derivers MUST call this, (if they use the attribute of this class at least)
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
virtual void serial(NLMISC::IStream &f)
{
f.serialVersion(1);
@ -1744,7 +1744,7 @@ public:
_MaxValue = other._MaxValue;
}
// serial. Should update min / max when reading
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
virtual uint32 getMinValue(void) const { return _MinValue; }
virtual uint32 getMaxValue(void) const { return _MaxValue; }
virtual void newElement(const CPSEmitterInfo &info);
@ -1767,7 +1767,7 @@ public:
_MaxValue = other._MaxValue;
}
// serial. Should update min / max when reading
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
virtual sint32 getMinValue(void) const { return _MinValue; }
virtual sint32 getMaxValue(void) const { return _MaxValue; }
virtual void newElement(const CPSEmitterInfo &info);
@ -1790,7 +1790,7 @@ public:
_MaxValue = other._MaxValue;
}
// serial. Should update min / max when reading
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
virtual float getMinValue(void) const { return _MinValue; }
virtual float getMaxValue(void) const { return _MaxValue; }
virtual void newElement(const CPSEmitterInfo &info);

@ -24,6 +24,8 @@
#include "nel/misc/rgba.h"
#include "nel/misc/traits_nl.h"
#include <iterator>
namespace NL3D {
/*
@ -91,7 +93,7 @@ public:
CPSValueBlendFunc() {}
/// serialization
void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void serial(NLMISC::IStream &f)
{
f.serialVersion(1);
f.serial(_StartValue, _EndValue);
@ -226,7 +228,7 @@ public:
CPSValueBlendSampleFunc() {}
/// serialization
void serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void serial(NLMISC::IStream &f)
{
f.serialVersion(1);
if (f.isReading())
@ -351,7 +353,7 @@ public:
}
/// serialization
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
virtual void serial(NLMISC::IStream &f);
T getMaxValue(void) const
@ -480,14 +482,18 @@ void CPSValueGradientFunc<T>::setValuesUnpacked(const T *valueTab, uint32 numVal
_MaxValue = _MinValue = valueTab[0];
_NbValues = (numValues - 1) * nbStages;
_Tab.resize(_NbValues + 1);
#ifdef NL_COMP_VC14
std::copy(valueTab, valueTab + _NbValues + 1, stdext::make_checked_array_iterator(&_Tab[0], _Tab.size()));
#else
std::copy(valueTab, valueTab + _NbValues + 1, &_Tab[0]);
#endif
}
template <typename T>
void CPSValueGradientFunc<T>::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
void CPSValueGradientFunc<T>::serial(NLMISC::IStream &f)
{
f.serialVersion(1);
f.serial(_NbStages);

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

Loading…
Cancel
Save