Merge branch 'develop' into feature/streamed-package

feature/streamed-package
kaetemi 5 years ago
commit 8e4edcb954

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

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

@ -1,4 +1,3 @@
950d650ca92e6041611258d7e5131ccf661e4ec2 compatibility-merge
4eddbaff0c5e5d685db96ee3e8427aa0fd96ac83 ryzomcore/v0.8.0
00d9b6e29e95f56785fbf85abe60afd34674f402 ryzomcore/v0.9.0
79776c337176dd5b02e1a74fe5dfb703b91747aa ryzomcore/v0.9.1
@ -8,3 +7,22 @@ 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
9d41f2994d44b9aad92b83f945f114e4b6bed44a ryzom-patch-3.0.2
4300cc14aad098b1f86ea4c55577b7fa4a4cb5d2 ryzom-patch-3.1.0
d4060f217f4f834cc62a33f2f1ccdf3c28298066 ryzom-patch-3.1.0-hotfix
043aaeb3d8a2a54177581b57bda87a9deaad510e ryzom-patch-3.1.0-april_patch
4036ecf59e83960f03acebc2089eb2ff5eeaed0a ryzom-patch-3.2.0
18403bb9485da3d9742c6f007a16d5619ebfb196 ryzom-patch-3.2.1
822ff8f8917ad66e09e2c21c983282f6f693b9f6 ryzom-patch-3.3.0
00dde390a394fce9da06c2f3264140282158d39f ryzom-patch-3.3.0
0000000000000000000000000000000000000000 3.3.0
dcd4c4d161ef775136e18c7e8f5072b75dede27e ryzom-patch-3.3.1
fc4be8ebec5ca754ef4453bc6a9faef90837c674 ryzom-patch-3.4.0
70eba02e8eab6920586dbabf74e9e8180c729980 ryzom-patch-3.4.0 Steam Fix
3941482843f9cd130cfc16634efc08d34a98ed35 ryzom-patch-3.4.0 Atysmas
ecae9feb4cceb78103e5d7236caccaf450796cdb ryzom-patch-3.5.0
95783afa226f241062134eb62f4323295d29ac84 ryzom-patch-3.5.0.9637
8eb94c3549be898fdc4a7c6d791d2477bdc11a18 ryzomcore/v1.0.1
3e92c7104c20d6bc6c2147b4b5fc289e8621d322 ryzomcore/v1.0.0

@ -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,3 +1,5 @@
# 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.

@ -0,0 +1,42 @@
jobs:
- job: ubuntu16
timeoutInMinutes: 120
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 bison autoconf automake -y
sudo apt-get install libpng12-dev -y
sudo apt-get install libjpeg-dev -y
sudo apt-get install libgif-dev libfreetype6-dev -y
sudo apt-get install freeglut3-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 libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev -y
sudo apt-get install libmysqlclient-dev -y
sudo apt-get install libxml2-dev -y
sudo apt-get install libcurl4-openssl-dev libssl-dev -y
sudo apt-get install libsquish-dev -y
sudo apt-get install liblzma-dev -y
sudo apt-get install libgsf-1-dev -y
sudo apt-get install qtbase5-dev qttools5-dev qttools5-dev-tools
displayName: 'Dependencies'
- script: |
mkdir build
cmake --version
cd build
cmake -DWITH_STATIC=ON -DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=ON -DWITH_LUA51=ON -DWITH_RYZOM=ON -DWITH_RYZOM_SERVER=ON -DWITH_RYZOM_CLIENT=ON -DWITH_RYZOM_TOOLS=ON -DWITH_NEL_TOOLS=ON -DWITH_NELNS=ON -DWITH_NELNS_LOGIN_SYSTEM=ON -DWITH_NELNS_SERVER=ON -DWITH_QT5=ON -DWITH_LIBGSF=ON ../code
cat CMakeCache.txt
displayName: 'CMake'
- script: |
cd build
make -j`nproc`
displayName: 'Make'

@ -0,0 +1,24 @@
---
BasedOnStyle: WebKit
AllowShortFunctionsOnASingleLine: All
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
BreakBeforeBraces: Custom
BreakConstructorInitializersBeforeComma: 'false'
NamespaceIndentation: None
PointerAlignment: Right
SortIncludes: 'false'
TabWidth: '4'
UseTab: ForIndentation
...

@ -0,0 +1,23 @@
; 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
[*.config]
indent_style = space
indent_size = 2

@ -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)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/nel.cmake)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/ConfigureChecks.cmake)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/CheckDepends.cmake)
# allow to link to qtmain automatically under Windows
IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF()
ENDIF()
INCLUDE(nel)
INCLUDE(ConfigureChecks)
INCLUDE(CheckDepends)
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
# Force out of source builds.
@ -44,12 +45,23 @@ 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 12)
SET(NL_VERSION_PATCH 0)
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 1)
SET(YEAR "2004-${CURRENT_YEAR}")
SET(AUTHOR "Winch Gate and The Ryzom Core Community")
SET(RYZOM_VERSION_MAJOR 3)
SET(RYZOM_VERSION_MINOR 5)
SET(RYZOM_VERSION_PATCH 0)
#-----------------------------------------------------------------------------
# Redirect output files
@ -59,19 +71,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,146 +90,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(WITH_LIBXML2_ICONV)
ENDIF()
IF(WITH_STATIC)
# libxml2 could need winsock2 library
IF(WINSOCK2_LIB)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
ENDIF()
# on Mac OS X libxml2 requires iconv and liblzma
IF(APPLE)
FIND_PACKAGE(LibLZMA REQUIRED)
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(APPLE)
ENDIF(WITH_STATIC)
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)
ENDIF(WITH_GUI)
FIND_PACKAGE(CURL REQUIRED)
IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
SET(CURL_STATIC ON)
ELSE((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
ELSE()
SET(CURL_STATIC OFF)
ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
ENDIF()
IF(CURL_STATIC)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
FIND_PACKAGE(OpenSSL QUIET)
LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
IF(OPENSSL_FOUND)
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
IF(WIN32)
LIST(APPEND CURL_LIBRARIES Crypt32 Cryptui)
ELSE()
# CURL depends on libidn
FIND_LIBRARY(IDN_LIBRARY idn)
IF(IDN_LIBRARY)
LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY})
ENDIF()
# CURL Macports version depends on libidn, libintl and libiconv too
# CURL Macports version can depend on libidn, libidn2, libintl, libpsl and libiconv too
IF(APPLE)
FIND_LIBRARY(IDN_LIBRARY idn)
FIND_LIBRARY(INTL_LIBRARY intl)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY})
ENDIF(APPLE)
ENDIF(CURL_STATIC)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/3rdparty)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
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()
@ -231,8 +335,8 @@ 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 "Ryzom Core MMORPG Framework")
@ -264,10 +368,10 @@ 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$"
@ -285,8 +389,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
@ -294,8 +398,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)
@ -305,14 +409,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)
@ -322,4 +426,4 @@ INCLUDE(CMakePackaging.txt)
#INCLUDE(UseDebian)
#IF(DEBIAN_FOUND)
# ADD_DEBIAN_TARGETS(nel)
#ENDIF(DEBIAN_FOUND)
#ENDIF()

@ -15,120 +15,145 @@ 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(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
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(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
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(GCC_TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686")
SET(TOOLCHAIN_BIN_PREFIX "i686-linux-android")
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "x86_64")
SET(LIBRARY_ARCHITECTURE "x86_64")
SET(CMAKE_SYSTEM_PROCESSOR "x86_64")
SET(TOOLCHAIN_ARCH "x86_64")
SET(GCC_TOOLCHAIN_PREFIX "x86_64")
SET(TOOLCHAIN_BIN_PREFIX "x86_64-linux-android")
SET(MINIMUM_NDK_TARGET 21)
ELSEIF(TARGET_CPU STREQUAL "mips")
SET(LIBRARY_ARCHITECTURE "mips")
SET(CMAKE_SYSTEM_PROCESSOR "mips")
SET(TOOLCHAIN_ARCH "mips")
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
SET(TOOLCHAIN_BIN_PREFIX "mipsel-linux-android")
SET(MINIMUM_NDK_TARGET 9)
ENDIF(TARGET_CPU STREQUAL "armv7")
SET(ANDROID_COMPILER "GCC")
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()
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
SET(ANDROID_COMPILER "clang")
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(ANDROID_COMPILER "clang")
SET(ANDROID_COMPILER "clang")
SET(CLANG ON)
ELSE()
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
ENDIF()
IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF(NOT NDK_TARGET)
ELSE()
IF(NDK_TARGET LESS MINIMUM_NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF()
ENDIF()
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows")
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")
SET(TOOLCHAIN_HOST "linux-x86_64")
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32)
ENDIF()
# clang
SET(CLANG_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${CLANG_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}")
MACRO(SEARCH_TOOLCHAIN _COMPILER)
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-*")
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 ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
LIST(APPEND GCC_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF()
ENDFOREACH()
ENDIF()
IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains")
IF(NOT GCC_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No GCC version found in default search path ${NDK_ROOT}/toolchains")
ENDIF()
IF(${_COMPILER}_TOOLCHAIN_VERSIONS)
LIST(FIND ${_COMPILER}_TOOLCHAIN_VERSIONS "${${_COMPILER}_TOOLCHAIN_VERSION}" _INDEX)
IF(GCC_TOOLCHAIN_VERSIONS)
LIST(FIND GCC_TOOLCHAIN_VERSIONS "${GCC_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION)
ENDIF()
ELSE()
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION)
ENDIF()
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
SET(GCC_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-${GCC_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
IF(NOT EXISTS "${GCC_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 GCC_TOOLCHAIN_ROOT)
ENDIF()
ENDMACRO()
IF(CLANG)
SEARCH_TOOLCHAIN(CLANG)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use clang ${CLANG_TOOLCHAIN_VERSION}")
ENDIF()
SEARCH_TOOLCHAIN(GCC)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
IF(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()
# NDK
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
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")
@ -137,14 +162,7 @@ SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
IF(_TOOLCHAIN_BIN_PREFIXES)
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
ENDIF(_TOOLCHAIN_BIN_PREFIXES)
ENDIF()
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
@ -160,39 +178,41 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
IF("${_BINARY}" MATCHES "clang")
MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY)
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ELSE()
ENDMACRO()
MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY)
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDIF()
ENDMACRO(SET_TOOLCHAIN_BINARY)
ENDMACRO()
# Force the compilers to GCC for Android
include (CMakeForceCompiler)
SET(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
IF(CLANG)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
SET(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX})
SET(CMAKE_C_COMPILER_FORCED TRUE)
MESSAGE(STATUS "Using clang compiler")
ELSE()
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)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
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()
MESSAGE(STATUS "Using GCC compiler")
IF(NOT EXISTS "${CMAKE_AR}")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
ENDIF()
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY(CMAKE_AR ar)
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld)
SET_TOOLCHAIN_BINARY(CMAKE_NM nm)
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy)
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJCOPY objcopy)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY_GCC(CMAKE_RANLIB ranlib)

@ -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,67 @@
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()
IF(DESCRIBE)
SET(NL_VERSION "${DESCRIBE}")
ELSE()
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}.${REVISION}")
ENDIF()
SET(NL_VERSION_RC "${NL_VERSION_MAJOR},${NL_VERSION_MINOR},${NL_VERSION_PATCH},${REVISION}")
SET(NL_PRODUCT_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}")
SET(RYZOM_VERSION_SHORT "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}")
IF(DESCRIBE)
SET(RYZOM_VERSION "${DESCRIBE}")
ELSE()
SET(RYZOM_VERSION "${RYZOM_VERSION_SHORT}.${REVISION}")
ENDIF()
SET(RYZOM_VERSION_RC "${RYZOM_VERSION_MAJOR},${RYZOM_VERSION_MINOR},${RYZOM_VERSION_PATCH},${REVISION}")
SET(RYZOM_PRODUCT_VERSION "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}")
NOW(BUILD_DATE)
SET(COPYRIGHT "Copyright (C) ${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,19 +9,58 @@
if(MAXSDK_INCLUDE_DIR)
# Already in cache, be silent
SET(MAXSDK_FIND_QUIETLY TRUE)
endif(MAXSDK_INCLUDE_DIR)
endif()
set(_pf_x86 "PROGRAMFILES(x86)")
FIND_PATH(MAXSDK_DIR
"include/maxversion.h"
HINTS
"$ENV{MAXSDK_DIR}"
PATHS
"$ENV{ADSK_3DSMAX_SDK_2021}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2020}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2019}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2018}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2017}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2016}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2015}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2014}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2013}/maxsdk"
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2021 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2020 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2019 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2018 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2017 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2016 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2015 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2014 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2013 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2012 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2011 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2010 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2009 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 2008 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3ds Max 9 SDK/maxsdk"
"$ENV{${_pf_x86}}/Autodesk/3dsMax8/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2021 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2020 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2019 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2018 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2016 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2015 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2014 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2013 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2012 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2011 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"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3dsMax8/maxsdk"
)
FIND_PATH(MAXSDK_INCLUDE_DIR
@ -36,10 +75,10 @@ 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)
FIND_LIBRARY(${MYLIBRARY}
@ -47,7 +86,7 @@ MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
HINTS
${MAXSDK_LIBRARY_DIRS}
)
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
ENDMACRO()
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
@ -75,8 +114,26 @@ if(MAXSDK_FOUND)
${MAXSDK_PARAMBLK2_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,7 +52,7 @@ IF(DXSDK_DIR)
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
ENDIF(DXSDK_DIR)
ENDIF()
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
# all listed variables are TRUE.

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

@ -1,57 +1,9 @@
# - Locate FMOD library
# This module defines
# FMOD_LIBRARY, the library to link against
# FMOD_FOUND, if false, do not try to link to FMOD
# FMOD_INCLUDE_DIR, where to find headers.
IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
# in cache already
SET(FMOD_FIND_QUIETLY TRUE)
ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
FIND_PATH(FMOD_INCLUDE_DIR
fmod.h
PATHS
$ENV{FMOD_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES fmod fmod3
)
INCLUDE(FindHelpers)
IF(TARGET_X64)
SET(FMOD_LIBRARY_NAMES fmod64 fmod)
ELSE(TARGET_X64)
SET(FMOD_LIBRARY_NAMES fmodvc fmod)
ENDIF(TARGET_X64)
FIND_LIBRARY(FMOD_LIBRARY
NAMES
${FMOD_LIBRARY_NAMES}
PATHS
$ENV{FMOD_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
SET(FMOD_BASE fmod64)
ELSE()
SET(FMOD_BASE fmodvc)
ENDIF()
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)
IF(NOT FMOD_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FMOD!")
ENDIF(NOT FMOD_FIND_QUIETLY)
ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
FIND_PACKAGE_HELPER(FMOD fmod.h RELEASE ${FMOD_BASE} DEBUG ${FMOD_BASE}d SUFFIXES fmod3)

@ -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,217 @@
# - Try to find GLib2
# Once done this will define
#
# GLIB2_FOUND - system has GLib2
# GLIB2_INCLUDE_DIRS - the GLib2 include directory
# GLIB2_LIBRARIES - Link these to use GLib2
#
# HAVE_GLIB_GREGEX_H glib has gregex.h header and
# supports g_regex_match_simple
#
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
# Copyright (c) 2006 Philippe Bernery <philippe.bernery@gmail.com>
# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
# Copyright (c) 2007 Alban Browaeys <prahal@yahoo.com>
# Copyright (c) 2008 Michael Bell <michael.bell@web.de>
# Copyright (c) 2008 Bjoern Ricks <bjoern.ricks@googlemail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
# in cache already
SET(GLIB2_FOUND TRUE)
ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
INCLUDE(FindPkgConfig)
## Glib
IF ( GLIB2_FIND_REQUIRED )
SET( _pkgconfig_REQUIRED "REQUIRED" )
ELSE ( GLIB2_FIND_REQUIRED )
SET( _pkgconfig_REQUIRED "" )
ENDIF ( GLIB2_FIND_REQUIRED )
IF ( GLIB2_MIN_VERSION )
PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} )
ELSE ( GLIB2_MIN_VERSION )
PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 )
ENDIF ( GLIB2_MIN_VERSION )
IF ( PKG_CONFIG_FOUND )
IF ( GLIB2_FOUND )
SET ( GLIB2_CORE_FOUND TRUE )
ELSE ( GLIB2_FOUND )
SET ( GLIB2_CORE_FOUND FALSE )
ENDIF ( GLIB2_FOUND )
ENDIF ( PKG_CONFIG_FOUND )
# Look for glib2 include dir and libraries w/o pkgconfig
IF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND )
FIND_PATH(
_glibconfig_include_DIR
NAMES
glibconfig.h
PATHS
/opt/gnome/lib64
/opt/gnome/lib
/opt/lib/
/opt/local/lib
/sw/lib/
/usr/lib64
/usr/lib
/usr/local/include
${CMAKE_LIBRARY_PATH}
PATH_SUFFIXES
glib-2.0/include
)
FIND_PATH(
_glib2_include_DIR
NAMES
glib.h
PATHS
/opt/gnome/include
/opt/local/include
/sw/include
/usr/include
/usr/local/include
PATH_SUFFIXES
glib-2.0
)
#MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}")
FIND_LIBRARY(
_glib2_link_DIR
NAMES
glib-2.0
glib
PATHS
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/lib
/usr/local/lib
)
IF ( _glib2_include_DIR AND _glib2_link_DIR )
SET ( _glib2_FOUND TRUE )
ENDIF ( _glib2_include_DIR AND _glib2_link_DIR )
IF ( _glib2_FOUND )
SET ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} )
SET ( GLIB2_LIBRARIES ${_glib2_link_DIR} )
SET ( GLIB2_CORE_FOUND TRUE )
ELSE ( _glib2_FOUND )
SET ( GLIB2_CORE_FOUND FALSE )
ENDIF ( _glib2_FOUND )
# Handle dependencies
# libintl
IF ( NOT LIBINTL_FOUND )
FIND_PATH(LIBINTL_INCLUDE_DIR
NAMES
libintl.h
PATHS
/opt/gnome/include
/opt/local/include
/sw/include
/usr/include
/usr/local/include
)
FIND_LIBRARY(LIBINTL_LIBRARY
NAMES
intl
PATHS
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/local/lib
/usr/lib
)
IF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
SET (LIBINTL_FOUND TRUE)
ENDIF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
ENDIF ( NOT LIBINTL_FOUND )
# libiconv
IF ( NOT LIBICONV_FOUND )
FIND_PATH(LIBICONV_INCLUDE_DIR
NAMES
iconv.h
PATHS
/opt/gnome/include
/opt/local/include
/opt/local/include
/sw/include
/sw/include
/usr/local/include
/usr/include
PATH_SUFFIXES
glib-2.0
)
FIND_LIBRARY(LIBICONV_LIBRARY
NAMES
iconv
PATHS
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/lib
/usr/local/lib
)
IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
SET (LIBICONV_FOUND TRUE)
ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
ENDIF ( NOT LIBICONV_FOUND )
IF (LIBINTL_FOUND)
SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY})
SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR})
ENDIF (LIBINTL_FOUND)
IF (LIBICONV_FOUND)
SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY})
SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR})
ENDIF (LIBICONV_FOUND)
ENDIF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND )
##
IF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
SET (GLIB2_FOUND TRUE)
ENDIF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
IF (GLIB2_FOUND)
IF (NOT GLIB2_FIND_QUIETLY)
MESSAGE (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}")
ENDIF (NOT GLIB2_FIND_QUIETLY)
ELSE (GLIB2_FOUND)
IF (GLIB2_FIND_REQUIRED)
MESSAGE (SEND_ERROR "Could not find GLib2")
ENDIF (GLIB2_FIND_REQUIRED)
ENDIF (GLIB2_FOUND)
# show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view
MARK_AS_ADVANCED(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES)
MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY)
MARK_AS_ADVANCED(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY)
ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS)
IF ( GLIB2_FOUND )
# Check if system has a newer version of glib
# which supports g_regex_match_simple
INCLUDE( CheckIncludeFiles )
SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} )
CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H )
# Reset CMAKE_REQUIRED_INCLUDES
SET( CMAKE_REQUIRED_INCLUDES "" )
ENDIF( GLIB2_FOUND )

@ -0,0 +1,51 @@
# - Try to find GObject2
# Find GObject2 headers, libraries and the answer to all questions.
#
# GOBJECT2_FOUND True if GOBJECT2 got found
# GOBJECT2_INCLUDE_DIRS Location of GOBJECT2 headers
# GOBJECT2_LIBRARIES List of libraries to use GOBJECT2
#
# Copyright (c) 2008 Bjoern Ricks <bjoern.ricks@googlemail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
INCLUDE( FindPkgConfig )
IF ( GOBJECT2_FIND_REQUIRED )
SET( _pkgconfig_REQUIRED "REQUIRED" )
ELSE( GOBJECT2_FIND_REQUIRED )
SET( _pkgconfig_REQUIRED "" )
ENDIF ( GOBJECT2_FIND_REQUIRED )
IF ( GOBJECT2_MIN_VERSION )
PKG_SEARCH_MODULE( GOBJECT2 ${_pkgconfig_REQUIRED} gobject-2.0>=${GOBJECT2_MIN_VERSION} )
ELSE ( GOBJECT2_MIN_VERSION )
PKG_SEARCH_MODULE( GOBJECT2 ${_pkgconfig_REQUIRED} gobject-2.0 )
ENDIF ( GOBJECT2_MIN_VERSION )
IF( NOT GOBJECT2_FOUND AND NOT PKG_CONFIG_FOUND )
FIND_PATH( GOBJECT2_INCLUDE_DIRS gobject/gobject.h PATH_SUFFIXES glib-2.0)
FIND_LIBRARY( GOBJECT2_LIBRARIES gobject-2.0 )
# Report results
IF ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS )
SET( GOBJECT2_FOUND 1 )
IF ( NOT GOBJECT2_FIND_QUIETLY )
MESSAGE( STATUS "Found GOBJECT2: ${GOBJECT2_LIBRARIES}" )
ENDIF ( NOT GOBJECT2_FIND_QUIETLY )
ELSE ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS )
IF ( GOBJECT2_FIND_REQUIRED )
MESSAGE( SEND_ERROR "Could NOT find GOBJECT2" )
ELSE ( GOBJECT2_FIND_REQUIRED )
IF ( NOT GOBJECT2_FIND_QUIETLY )
MESSAGE( STATUS "Could NOT find GOBJECT2" )
ENDIF ( NOT GOBJECT2_FIND_QUIETLY )
ENDIF ( GOBJECT2_FIND_REQUIRED )
ENDIF ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS )
ENDIF( NOT GOBJECT2_FOUND AND NOT PKG_CONFIG_FOUND )
MARK_AS_ADVANCED( GOBJECT2_LIBRARIES GOBJECT2_INCLUDE_DIRS )

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

@ -20,7 +20,7 @@ FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c PATHS /opt/local)
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
SET(ICONV_FOUND TRUE)
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
ENDIF()
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
@ -29,7 +29,7 @@ IF(ICONV_FOUND)
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
if(ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif(ICONV_HAVE_WERROR)
ENDIF()
check_c_source_compiles("
#include <iconv.h>
int main(){
@ -43,19 +43,19 @@ IF(ICONV_FOUND)
}
" ICONV_SECOND_ARGUMENT_IS_CONST )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
ENDIF(ICONV_FOUND)
ENDIF()
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)
ENDIF()
ELSE()
IF(Iconv_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Iconv")
ENDIF(Iconv_FIND_REQUIRED)
ENDIF(ICONV_FOUND)
ENDIF()
ENDIF()
MARK_AS_ADVANCED(
ICONV_INCLUDE_DIR

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

@ -0,0 +1,57 @@
# - Try to find libGSF
#
# Once done this will define
#
# LIBGSF_FOUND - System has LibGSF
# LIBGSF_INCLUDE_DIR - The LibGSF include directory
# LIBGSF_LIBRARIES - The libraries needed to use LibGSF
# LIBGSF_DEFINITIONS - Compiler switches required for using LibGSF
# LIBGSF_GSF_EXECUTABLE - The archive utility
# LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE - The office files thumbnailer for the GNOME desktop
# LIBGSF_GSFVBADUMP_EXECUTABLE - The utility to extract Visual Basic for Applications macros
# Copyright (c) 2009, Pau Garcia i Quiles <pgquiles@elpauer.org>
# Based off FindLibXml2.cmake from CMake 2.6.4 by Alexander Neundorf <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES)
# in cache already
SET(LIBGSF_FIND_QUIETLY TRUE)
ENDIF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES)
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)
PKG_CHECK_MODULES(PC_LIBGSF libgsf-1)
SET(LIBGSF_DEFINITIONS ${PC_LIBGSF_CFLAGS_OTHER})
ENDIF (NOT WIN32)
FIND_PATH(LIBGSF_INCLUDE_DIR gsf/gsf.h
HINTS
${PC_LIBGSF_INCLUDEDIR}
${PC_LIBGSF_INCLUDE_DIRS}
PATH_SUFFIXES libgsf-1
)
FIND_LIBRARY(LIBGSF_LIBRARIES NAMES gsf-1 libgsf-1
HINTS
${PC_LIBGSF_LIBDIR}
${PC_LIBGSF_LIBRARY_DIRS}
)
FIND_PROGRAM(LIBGSF_GSF_EXECUTABLE gsf)
FIND_PROGRAM(LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE gsf-office-thumbnailer)
FIND_PROGRAM(LIBGSF_GSFVBADUMP_EXECUTABLE gsf-vba-dump)
INCLUDE(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBGSF_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGSF DEFAULT_MSG LIBGSF_LIBRARIES LIBGSF_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBGSF_INCLUDE_DIR LIBGSF_LIBRARIES LIBGSF_GSF_EXECUTABLE LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE LIBGSF_GSFVBADUMP_EXECUTABLE )

@ -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,18 +25,18 @@ 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 libovr
@ -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)

@ -3,80 +3,107 @@
# LUABIND_LIBRARIES, the libraries to link against
# LUABIND_FOUND, if false, do not try to link to LUABIND
# LUABIND_INCLUDE_DIR, where to find headers.
INCLUDE(FindHelpers)
MACRO(FIND_CORRECT_LUA_VERSION)
# Check Lua version linked to Luabind under Linux
IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
INCLUDE(CheckDepends)
SET(LUA52_LIBRARY "liblua5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
# check for Lua 5.3
SET(LUA53_LIBRARIES liblua5.3 liblua-5.3 liblua.so.5.3)
FOREACH(_LIB ${LUA53_LIBRARIES})
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.3")
FIND_PACKAGE(Lua53 REQUIRED)
BREAK()
ENDIF()
ENDFOREACH()
IF(NOT LUALIB_FOUND)
# fedora (v20)
SET(LUA52_LIBRARY "liblua-5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
ENDIF(NOT LUALIB_FOUND)
# check for Lua 5.2
SET(LUA52_LIBRARIES liblua5.2 liblua-5.2 liblua.so.5.2)
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)
ELSE(LUALIB_FOUND)
SET(LUA51_LIBRARY "liblua5.1")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND)
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)
ELSE(LUALIB_FOUND)
SET(LUA50_LIBRARY "liblua5.0")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND)
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)
BREAK()
ENDIF()
ENDFOREACH()
ENDIF()
IF(NOT 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")
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)
FIND_PATH(LUABIND_INCLUDE_DIR
luabind/luabind.hpp
PATHS
$ENV{LUABIND_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
ENDIF()
SET(LIBRARY_NAME_RELEASE)
SET(LIBRARY_NAME_DEBUG)
IF(WITH_LUA53)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua53)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua53d)
ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua53)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua53d)
ENDIF()
IF(WITH_LUA52)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d)
ENDIF(WITH_STLPORT)
ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d)
@ -86,7 +113,7 @@ IF(WITH_LUA51)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua51d)
ENDIF(WITH_STLPORT)
ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua51d)
@ -96,7 +123,7 @@ IF(WITH_LUA50)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua50d)
ENDIF(WITH_STLPORT)
ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua50d)
@ -105,41 +132,13 @@ ENDIF()
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlportd)
ENDIF(WITH_STLPORT)
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}
PATHS
$ENV{LUABIND_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(LUABIND_LIBRARY_DEBUG
NAMES ${LIBRARY_NAME_DEBUG}
PATHS
$ENV{LUABIND_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_PACKAGE_HELPER(Luabind luabind/luabind.hpp RELEASE ${LIBRARY_NAME_RELEASE} DEBUG ${LIBRARY_NAME_DEBUG})
FIND_PACKAGE(Boost REQUIRED)
@ -156,8 +155,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})
@ -165,17 +164,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)

@ -1,101 +1,119 @@
# - Find MS Visual C++
#
# VC_DIR - where to find Visual C++
# VC_INCLUDE_DIR - where to find headers
# VC_INCLUDE_DIRS - where to find headers
# VC_LIBRARY_DIR - where to find libraries
# VC_FOUND - True if MSVC found.
MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
# Software/Wow6432Node/...
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR)
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND ON)
DETECT_EXPRESS_VERSION(${_VERSION})
IF(NOT MSVC_FIND_QUIETLY)
SET(_VERSION_STR ${_VERSION})
IF(MSVC_EXPRESS)
SET(_VERSION_STR "${_VERSION_STR} Express")
ENDIF(MSVC_EXPRESS)
MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}")
ENDIF(NOT MSVC_FIND_QUIETLY)
ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND OFF)
SET(VC${_VERSION}_DIR "")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDMACRO(DETECT_VC_VERSION_HELPER)
MACRO(DETECT_VC_VERSION _VERSION)
SET(VC${_VERSION}_FOUND OFF)
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT VC${_VERSION}_FOUND)
IF(VC${_VERSION}_FOUND)
# VC_FOUND - True if MSVC found
IF(CMAKE_CXX_COMPILER)
SET(_COMPILER ${CMAKE_CXX_COMPILER})
SET(_VERSION ${CMAKE_CXX_COMPILER_VERSION})
ELSEIF(CMAKE_C_COMPILER)
SET(_COMPILER ${CMAKE_C_COMPILER})
SET(_VERSION ${CMAKE_C_COMPILER_VERSION})
ELSE()
MESSAGE(FATAL_ERROR "No way to determine Visual C++ location")
ENDIF()
IF(MSVC_VERSION LESS 1910)
IF(MSVC_VERSION LESS 1500)
MESSAGE(FATAL_ERROR "Unsupported version of Visual C++ (minimum version is 2008)")
ELSEIF(MSVC_VERSION LESS 1600)
SET(MSVC_TOOLSET "90")
SET(_NAME "2008")
ELSEIF(MSVC_VERSION LESS 1700)
SET(MSVC_TOOLSET "100")
SET(_NAME "2010")
ELSEIF(MSVC_VERSION LESS 1800)
SET(MSVC_TOOLSET "110")
SET(_NAME "2012")
ELSEIF(MSVC_VERSION LESS 1900)
SET(MSVC_TOOLSET "120")
SET(_NAME "2013")
ELSE()
SET(MSVC_TOOLSET "140")
SET(_NAME "2015")
ENDIF()
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${_COMPILER})
MESSAGE(STATUS "Found Visual C++ ${_NAME} (${_VERSION}) in ${VC_DIR}")
ELSE()
# Toolset = version of runtime DLLs
SET(MSVC_TOOLSET "140")
IF(MSVC_VERSION LESS 1920)
SET(_NAME "2017")
ELSE()
SET(_NAME "2019")
ENDIF()
STRING(REGEX REPLACE "/MSVC/.+" "/MSVC" VC_DIR ${_COMPILER})
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(MSVC_TOOLCHAIN_VERSIONS)
LIST(GET MSVC_TOOLCHAIN_VERSIONS 0 MSVC_TOOLCHAIN_VERSION)
SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}")
MESSAGE(STATUS "Found Visual C++ ${_NAME} (${_VERSION} with toolchain ${MSVC_TOOLCHAIN_VERSION}) in ${VC_DIR}")
ELSE()
MESSAGE(FATAL_ERROR "Unable to find Visual C++ in ${VC_DIR}")
ENDIF()
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)
SET(VC_DIR "${VC${_VERSION}_DIR}")
ENDIF(VC${_VERSION}_FOUND)
ENDMACRO(DETECT_VC_VERSION)
ENDIF()
ENDIF()
MACRO(DETECT_EXPRESS_VERSION _VERSION)
GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE)
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
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)
IF(NOT EXISTS "${MSVC_REDIST_DIR}")
SET(MSVC_REDIST_DIR "${VC_DIR}/redist")
IF(MSVC12)
DETECT_VC_VERSION("12.0")
SET(MSVC_TOOLSET "120")
IF(NOT EXISTS "${MSVC_REDIST_DIR}")
SET(MSVC_REDIST_DIR)
ENDIF()
ENDIF()
IF(NOT MSVC12_REDIST_DIR)
IF(MSVC_REDIST_DIR)
IF(MSVC_VERSION GREATER 1909)
# 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 "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC12_REDIST_DIR)
SET(MSVC12_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC11)
DETECT_VC_VERSION("11.0")
SET(MSVC_TOOLSET "110")
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(MSVC11_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0")
SET(MSVC_TOOLSET "100")
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(MSVC10_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0")
SET(MSVC_TOOLSET "90")
SET(MSVC90_REDIST_DIR "${MSVC_REDIST_DIR}")
ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0")
SET(MSVC_TOOLSET "80")
ENDIF(MSVC12)
# 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)
SET(MSVC80_REDIST_DIR "${MSVC_REDIST_DIR}")
ENDIF()
ENDIF()
IF(NOT VC_DIR)
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
ENDIF(NOT VC_DIR)
IF(VC_INCLUDE_DIR)
MESSAGE(STATUS "Using VC++ headers from ${VC_INCLUDE_DIR}")
ELSE()
MESSAGE(FATAL_ERROR "Unable to find VC++ headers")
ENDIF()
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.
@ -65,7 +65,7 @@ IF(Mercurial_HG_EXECUTABLE)
"\\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)

@ -16,40 +16,50 @@ IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ELSE()
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
PATH_SUFFIXES mysql
PATH_SUFFIXES mysql mariadb
PATHS
/usr/include/mysql
/usr/include/mariadb
/usr/local/include/mysql
/usr/local/include/mariadb
/opt/local/include/mysql5/mysql
/opt/local/include/mysql55/mysql
/opt/local/include/mysql51/mysql
$ENV{ProgramFiles}/MySQL/*/include
$ENV{SystemDrive}/MySQL/*/include)
IF(WIN32 AND MSVC)
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient libmariadb mariadbclient
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd libmariadb mariadbclient
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
ELSE()
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient mariadbclient
PATHS
/usr/lib
/usr/local/lib
/usr/lib/mariadb
/usr/lib/mysql
/usr/local/lib/mysql
/usr/local/lib/mariadb
/opt/local/lib/mysql5/mysql
/opt/local/lib/mysql55/mysql
/opt/local/lib/mysql51/mysql
)
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd mariadbclientd
PATHS
/usr/lib
/usr/local/lib
/usr/lib/mysql
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
/opt/local/lib/mysql55/mysql
/opt/local/lib/mysql51/mysql
)
ENDIF()
@ -62,6 +72,9 @@ ELSE()
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()
ENDIF()
@ -70,6 +83,10 @@ ELSE()
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
IF (MYSQL_LIBRARIES MATCHES "libmariadb" OR MYSQL_LIBRARIES MATCHES "mariadbclient")
SET(MARIADB_FOUND TRUE)
MESSAGE(STATUS "Found MariaDB.")
ENDIF()
ELSE()
SET(MYSQL_FOUND FALSE)
MESSAGE(STATUS "MySQL not found.")

@ -0,0 +1,418 @@
# 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()
IF(CMAKE_DL_LIBS)
LIST(APPEND NELMISC_LIBRARIES ${CMAKE_DL_LIBS})
ENDIF()
FIND_PACKAGE(Threads)
IF(Threads_FOUND)
LIST(APPEND NELMISC_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
ENDIF()
IF(UNIX AND NOT APPLE)
LIST(APPEND NELMISC_LIBRARIES rt)
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
DIR ${NEL_DIR}
QUIET)
IF(${_UPNAME}_FOUND)
LIST(APPEND NEL_MODULES_FOUND ${COMPONENT})
# all NeL libraries depend on nelmisc in static
IF(NEL_STATIC)
LIST(APPEND ${_UPNAME}_LIBRARIES ${NELMISC_LIBRARIES})
ENDIF()
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)
IF(LUABIND_FOUND)
LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES})
ENDIF()
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 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})

@ -1,49 +1,3 @@
# - Locate Ogg library
# This module defines
# OGG_LIBRARY, the library to link against
# OGG_FOUND, if false, do not try to link to OGG
# OGG_INCLUDE_DIR, where to find headers.
INCLUDE(FindHelpers)
IF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
# in cache already
SET(OGG_FIND_QUIETLY TRUE)
ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
FIND_PATH(OGG_INCLUDE_DIR
ogg/ogg.h
PATHS
$ENV{OGG_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
FIND_LIBRARY(OGG_LIBRARY
NAMES ogg libogg
PATHS
$ENV{OGG_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(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)
IF(NOT OGG_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Ogg!")
ENDIF(NOT OGG_FIND_QUIETLY)
ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
FIND_PACKAGE_HELPER(Ogg ogg/ogg.h)

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

@ -1,91 +1,5 @@
# Look for a directory containing STLport.
#
# The following values are defined
# STLPORT_INCLUDE_DIR - where to find vector, etc.
# STLPORT_LIBRARIES - link against these to use STLport
# STLPORT_FOUND - True if the STLport is available.
INCLUDE(FindHelpers)
# also defined, but not for general use are
IF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR)
# in cache already
SET(STLPORT_FIND_QUIETLY TRUE)
ENDIF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR)
FIND_PATH(STLPORT_INCLUDE_DIR
iostream
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES stlport
)
FIND_LIBRARY(STLPORT_LIBRARY_DEBUG
NAMES
stlport_cygwin_debug
stlport_cygwin_stldebug
stlport_gcc_debug
stlport_gcc_stldebug
stlportstld_x
stlportstld_x.5.2
stlportd
stlportd_statix
stlportd_static
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(STLPORT_LIBRARY_RELEASE
NAMES
stlport_cygwin
stlport_gcc
stlport
stlport_x
stlport_x.5.2
stlport_statix
stlport_static
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(STLPORT_INCLUDE_DIR)
IF(STLPORT_LIBRARY_RELEASE)
SET(STLPORT_FOUND TRUE)
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)
IF(STLPORT_FOUND)
IF(NOT STLPORT_FIND_QUIETLY)
MESSAGE(STATUS "Found STLport: ${STLPORT_LIBRARIES}")
ENDIF(NOT STLPORT_FIND_QUIETLY)
ELSE(STLPORT_FOUND)
IF(NOT STLPORT_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find STLport!")
ENDIF(NOT STLPORT_FIND_QUIETLY)
ENDIF(STLPORT_FOUND)
MARK_AS_ADVANCED(STLPORT_LIBRARY_RELEASE STLPORT_LIBRARY_DEBUG)
FIND_PACKAGE_HELPER(STLport iostream
RELEASE stlport_cygwin stlport_gcc stlport_x stlport_x.5.2 stlport_statix stlport_static
DEBUG stlport_cygwin_debug stlport_cygwin_stldebug stlport_gcc_debug stlport_gcc_stldebug stlportstld_x stlportstld_x.5.2 stlportd_statix stlportd_static)

@ -1,83 +1,14 @@
#
# Find the LibSquish includes and library
#
# This module defines
# SQUISH_INCLUDE_DIR, where to find squish.h
# SQUISH_LIBRARIES, where to find the Squish libraries.
# SQUISH_FOUND, If false, do not try to use Squish.
INCLUDE(FindHelpers)
# also defined, but not for general use are
IF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR)
# in cache already
SET(SQUISH_FIND_QUIETLY TRUE)
ENDIF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR)
FIND_PATH(SQUISH_INCLUDE_DIR
squish.h
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES cppunit
)
FIND_LIBRARY(SQUISH_LIBRARY_RELEASE
squish
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(SQUISH_LIBRARY_DEBUG
squishd
PATHS
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(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}")
ELSE(SQUISH_LIBRARY_DEBUG)
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_RELEASE}")
MESSAGE("Debug Squish NOT found, using the release version!")
ENDIF(SQUISH_LIBRARY_DEBUG)
ENDIF(SQUISH_LIBRARY_RELEASE)
ENDIF(SQUISH_INCLUDE_DIR)
FIND_PACKAGE_HELPER(Squish squish.h)
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)
IF(NOT SQUISH_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Squish!")
ENDIF(NOT SQUISH_FIND_QUIETLY)
ENDIF(SQUISH_FOUND)
MARK_AS_ADVANCED(SQUISH_LIBRARY_RELEASE SQUISH_LIBRARY_DEBUG)
ENDIF()
ENDIF()

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

@ -1,65 +1,8 @@
# - Locate Vorbis library
# This module defines
# VORBIS_LIBRARY, the library to link against
# VORBIS_FOUND, if false, do not try to link to VORBIS
# VORBIS_INCLUDE_DIR, where to find headers.
INCLUDE(FindHelpers)
IF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
# in cache already
SET(VORBIS_FIND_QUIETLY TRUE)
ENDIF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
FIND_PACKAGE_HELPER(Vorbis vorbisenc.h)
FIND_PACKAGE_HELPER(VorbisFile vorbisfile.h SUFFIXES vorbis)
FIND_PATH(VORBIS_INCLUDE_DIR
vorbis/vorbisfile.h
PATHS
$ENV{VORBIS_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
FIND_LIBRARY(VORBIS_LIBRARY
NAMES vorbis libvorbis
PATHS
$ENV{VORBIS_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(VORBISFILE_LIBRARY
NAMES vorbisfile libvorbisfile
PATHS
$ENV{VORBIS_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
SET(VORBIS_FOUND "YES")
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)
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)
IF(VORBISFILE_FOUND)
SET(VORBIS_LIBRARIES ${VORBIS_LIBRARIES} ${VORBISFILE_LIBRARIES})
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,32 @@ 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_HELPER _VERSION _SUFFIX _PREFIX _ARCH)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\${_PREFIX}Microsoft\\Windows Kits\\Installed Roots;KitsRoot${_SUFFIX}]" ABSOLUTE)
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry" AND EXISTS "${WINSDK${_VERSION}_DIR}/Include")
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} (registry ${_ARCH} bits)")
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,43 +50,60 @@ 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()
MACRO(DETECT_WINKIT_VERSION _VERSION _SUFFIX)
DETECT_WINKIT_VERSION_HELPER("${_VERSION}" "${_SUFFIX}" "WOW6432Node\\\\" "32")
IF(NOT WINSDK${_VERSION}_FOUND)
DETECT_WINKIT_VERSION_HELPER("${_VERSION}" "${_SUFFIX}" "" "64")
ENDIF()
ENDMACRO()
SET(WINSDK_VERSIONS "8.0" "8.0A" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
SET(WINSDK_DETECTED_VERSIONS)
# Fixed versions for Windows Kits (VC++ from 2012)
DETECT_WINKIT_VERSION("10.0" "10")
DETECT_WINKIT_VERSION("8.1" "81")
DETECT_WINKIT_VERSION("8.0" "")
# For VC++ up to 2010
SET(WINSDK_VERSIONS "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
# Search all supported Windows SDKs
FOREACH(_VERSION ${WINSDK_VERSIONS})
DETECT_WINSDK_VERSION(${_VERSION})
IF(WINSDK${_VERSION}_FOUND)
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
ENDIF(WINSDK${_VERSION}_FOUND)
ENDFOREACH(_VERSION)
ENDIF()
ENDFOREACH()
SET(WINSDK_SUFFIX)
SET(WINSDK_SUFFIXES)
IF(TARGET_ARM)
IF(TARGET_ARM64)
SET(WINSDK8_SUFFIX "arm64")
ELSEIF(TARGET_ARM)
SET(WINSDK8_SUFFIX "arm")
ELSEIF(TARGET_X64)
SET(WINSDK8_SUFFIX "x64")
SET(WINSDK_SUFFIX "x64")
SET(WINSDK_SUFFIXES "x64" "amd64")
ELSEIF(TARGET_X86)
SET(WINSDK8_SUFFIX "x86")
ENDIF(TARGET_ARM)
ENDIF()
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
IF(WINSDKCURRENT_VERSION_INCLUDE)
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
ENDIF()
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
IF(NOT WINSDKENV_DIR)
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
ENDIF(NOT WINSDKENV_DIR)
ENDIF()
MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
@ -82,12 +115,23 @@ 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")
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(_CONTENT)
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 7.0
@ -112,14 +156,14 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
SET(WINSDK_VERSION "7.1")
ELSEIF(_WINSDKVER STREQUAL "0601")
SET(WINSDK_VERSION "7.0A")
ELSE(_WINSDKVER STREQUAL "06010000")
ELSE()
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
ENDIF(_WINSDKVER STREQUAL "06010000")
ELSE(_WINSDKVER_FILE)
ENDIF()
ELSE()
SET(WINSDK_VERSION "7.0")
ENDIF(_WINSDKVER_FILE)
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 6.0
@ -127,8 +171,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT)
SET(WINSDK_VERSION "6.0")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.2
@ -136,8 +180,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT)
SET(WINSDK_VERSION "5.2")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.1
@ -145,8 +189,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT)
SET(WINSDK_VERSION "5.1")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.0
@ -154,13 +198,13 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(_CONTENT)
SET(WINSDK_VERSION "5.0")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ELSE(_MSI_FILE)
ENDIF()
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
ENDIF(_MSI_FILE)
ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION)
ENDMACRO(FIND_WINSDK_VERSION_HEADERS)
ENDIF()
ENDIF()
ENDMACRO()
MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_DIR "")
@ -174,7 +218,7 @@ MACRO(USE_CURRENT_WINSDK)
${WINSDKENV_DIR}/Include/um
${WINSDKENV_DIR}/Include
)
ENDIF(WINSDKENV_DIR)
ENDIF()
# Use INCLUDE environment variable
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
@ -186,9 +230,9 @@ MACRO(USE_CURRENT_WINSDK)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
BREAK()
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
ENDFOREACH(_INCLUDE)
ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
ENDIF()
ENDFOREACH()
ENDIF()
IF(WINSDK_DIR)
# Compare WINSDK_DIR with registered Windows SDKs
@ -197,38 +241,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")
@ -236,10 +301,10 @@ MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_VERSION "6.1")
ELSEIF(WINSDK6.0_FOUND)
SET(WINSDK_VERSION "6.0")
ELSE(WINSDK7.1_FOUND)
ELSE()
MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.")
ENDIF(WINSDK7.1_FOUND)
ENDIF(NOT WINSDK_VERSION)
ENDIF()
ENDIF()
# Look for correct registered Windows SDK version
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
@ -247,82 +312,197 @@ 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
)
IF(WINSDK_INCLUDE_DIR)
MESSAGE(STATUS "Found Windows.h in ${WINSDK_INCLUDE_DIR}")
ELSE()
MESSAGE(FATAL_ERROR "Unable to find Windows.h")
ENDIF()
# 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
${WINSDK_DIR}/Include
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} ${WINSDK_OPENGL_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,12 +2,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3)
# ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory)
# SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt)
# BINARY_DIR should be set to root of your build directory
IF(SOURCE_DIR)
# Replace spaces by semi-columns
IF(CMAKE_MODULE_PATH)
STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
ENDIF(CMAKE_MODULE_PATH)
ENDIF()
SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})
@ -20,10 +21,16 @@ IF(SOURCE_DIR)
ENDIF()
ELSE()
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR}/..)
# convert ROOT_DIR to absolute path
GET_FILENAME_COMPONENT(ROOT_DIR ${ROOT_DIR} ABSOLUTE)
ENDIF()
MACRO(NOW RESULT)
IF(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")
@ -36,7 +43,8 @@ MACRO(NOW RESULT)
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} "0000-00-00 00:00:00")
ENDIF()
ENDMACRO(NOW)
ENDIF()
ENDMACRO()
IF(EXISTS "${ROOT_DIR}/.svn/")
FIND_PACKAGE(Subversion QUIET)
@ -44,14 +52,14 @@ IF(EXISTS "${ROOT_DIR}/.svn/")
IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION})
ENDIF(SUBVERSION_FOUND)
ENDIF()
FIND_PACKAGE(TortoiseSVN QUIET)
IF(TORTOISESVN_FOUND)
TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION)
ENDIF(TORTOISESVN_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.svn/")
ENDIF()
ENDIF()
IF(EXISTS "${ROOT_DIR}/.hg/")
FIND_PACKAGE(Mercurial)
@ -64,6 +72,49 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
ENDIF()
ENDIF()
IF(EXISTS "${ROOT_DIR}/.git/")
FIND_PACKAGE(Git)
IF(GIT_FOUND)
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-list HEAD --count
WORKING_DIRECTORY ${ROOT_DIR}
RESULT_VARIABLE git_exit_code
OUTPUT_VARIABLE REVISION)
IF(NOT ${git_exit_code} EQUAL 0)
MESSAGE(WARNING "git rev-list failed, unable to include version.")
ELSE()
STRING(STRIP ${REVISION} REVISION)
ENDIF()
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD
WORKING_DIRECTORY ${ROOT_DIR}
RESULT_VARIABLE git_exit_code
OUTPUT_VARIABLE CHANGESET)
IF(NOT ${git_exit_code} EQUAL 0)
MESSAGE(WARNING "git rev-parse failed, unable to include version.")
ELSE()
STRING(STRIP ${CHANGESET} CHANGESET)
ENDIF()
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${ROOT_DIR}
RESULT_VARIABLE git_exit_code
OUTPUT_VARIABLE BRANCH)
IF(NOT ${git_exit_code} EQUAL 0)
MESSAGE(WARNING "git rev-parse failed, unable to include git branch.")
ELSE()
STRING(STRIP ${BRANCH} BRANCH)
ENDIF()
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} describe
WORKING_DIRECTORY ${ROOT_DIR}
RESULT_VARIABLE git_exit_code
OUTPUT_VARIABLE DESCRIBE)
IF(NOT ${git_exit_code} EQUAL 0)
MESSAGE(WARNING "git rev-parse failed, unable to include git branch.")
ELSE()
STRING(STRIP ${DESCRIBE} DESCRIBE)
ENDIF()
ENDIF()
ENDIF()
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)
SET(REVISION_FILE ${SOURCE_DIR}/revision)
@ -73,11 +124,8 @@ IF(SOURCE_DIR AND NOT DEFINED REVISION)
ENDIF()
ENDIF()
IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
MESSAGE(STATUS "Revision: ${REVISION}")
NOW(BUILD_DATE)
CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different
ENDIF()
IF(DEFINED REVISION)
MESSAGE(STATUS "Found revision ${REVISION}")
ELSE()
SET(REVISION 0)
ENDIF()

@ -0,0 +1,143 @@
# Define OSX_SDK to force a specific version such as : -DOSX_SDK=10.11
#
# Example:
# cmake .. -DCMAKE_TOOLCHAIN_FILE=$CMAKE_MODULE_PATH/OSXToolChain.cmake -DOSX_SDK=10.14 <other flags>
# Don't forget to define environment variables:
#
# export MACOSX_DEPLOYMENT_TARGET=10.8
# 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
# cmake .. -DCMAKE_TOOLCHAIN_FILE=$CMAKE_MODULE_PATH/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()
# OSXCROSS_TARGET
# OSXCROSS_SDK
# Force the compilers to Clang for OS X
SET(OSXCROSS_HOST "x86_64-apple-darwin18")
# C
SET(CMAKE_C_COMPILER ${OSXCROSS_HOST}-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 ${OSXCROSS_HOST}-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-18.0.0")
SET(CMAKE_SYSTEM_VERSION "18.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 NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
INCLUDE(CMakeFindBinUtils)
set(CMAKE_AR "${OSXCROSS_HOST}-ar" CACHE FILEPATH "ar")
set(CMAKE_RANLIB "${OSXCROSS_HOST}-ranlib" CACHE FILEPATH "ranlib")
set(CMAKE_INSTALL_NAME_TOOL "${OSXCROSS_HOST}-install_name_tool" CACHE FILEPATH "install_name_tool")
set(ENV{PKG_CONFIG_LIBDIR} "${MACPORTS_ROOT_DIR}/lib/pkgconfig")
set(ENV{PKG_CONFIG_SYSROOT_DIR} "${CMAKE_OSX_TOOLCHAIN_ROOT}/macports/pkgs")

@ -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}")
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)
# 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)
# create a command-line string
STRING(REGEX REPLACE ";" " " PCH_FLAGS "${PCH_FLAGS}")
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)
# 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,30 +498,26 @@ 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)
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
RETURN()
ENDIF(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
@ -389,9 +525,9 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
SET(PCH_METHOD 1)
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
SET(PCH_METHOD 2)
ELSE(CMAKE_GENERATOR MATCHES "Visual Studio")
ELSE()
SET(PCH_METHOD 0)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
ENDIF()
IF(PCH_METHOD EQUAL 1)
# Auto include the precompile (useful for moc processing, since the use of
@ -401,7 +537,7 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
IF(${oldProps} MATCHES NOTFOUND)
SET(oldProps "")
ENDIF(${oldProps} MATCHES NOTFOUND)
ENDIF()
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
@ -418,12 +554,21 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
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)
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(PCH_METHOD EQUAL 1)
ENDIF()
ENDIF()
IF(TARGET ${_targetName}_static)
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
ENDIF(TARGET ${_targetName}_static)
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
ENDIF()
ELSE()
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
ENDIF()
ENDMACRO()

@ -35,16 +35,12 @@ 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")
@ -59,29 +55,35 @@ elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
elseif(${IOS_PLATFORM} STREQUAL "ALL")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
else (${IOS_PLATFORM} STREQUAL "OS")
else()
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif (${IOS_PLATFORM} STREQUAL "OS")
endif()
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform")
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
# Note Xcode 4.3 changed the installation location, choose the most recent one available
SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms")
SET(XCODE_PRE_43_ROOT "/Developer/Platforms")
SET(XCODE_DEFAULT_ROOT "/Applications/Xcode.app/Contents")
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
IF(EXISTS ${XCODE_POST_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT})
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT})
ENDIF(EXISTS ${XCODE_POST_43_ROOT})
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
IF(NOT DEFINED CMAKE_XCODE_ROOT)
IF(EXISTS ${XCODE_DEFAULT_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_DEFAULT_ROOT} CACHE STRING "Xcode root")
ELSE()
MESSAGE(FATAL_ERROR "Xcode directory ${XCODE_DEFAULT_ROOT} doesn't exist")
ENDIF()
ENDIF()
SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${TMP})
SET(CMAKE_IOS_DEVELOPER_ROOT ${TMP})
MESSAGE(STATUS "Use iOS developer root: ${CMAKE_IOS_DEVELOPER_ROOT}")
ENDIF()
SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${TMP})
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${TMP})
MESSAGE(STATUS "Use iOS simulator developer root: ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}")
ENDIF()
ENDIF()
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform")
@ -93,9 +95,9 @@ MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
ENDFOREACH(_CMAKE_IOS_SDK)
ENDIF(_CMAKE_IOS_SDKS)
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS)
ENDFOREACH()
ENDIF()
ENDMACRO()
# Find and use the most recent iOS sdk
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
@ -104,25 +106,25 @@ IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
IF(NOT IOS_VERSIONS)
MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
ENDIF(NOT IOS_VERSIONS)
ENDIF()
IF(IOS_VERSION)
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
ELSE(_INDEX EQUAL -1)
ELSE()
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(_INDEX EQUAL -1)
ELSE(IOS_VERSION)
ENDIF()
ELSE()
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(IOS_VERSION)
ENDIF()
MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}")
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk)
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk)
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
endif()
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK")
@ -134,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")
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
SET(CMAKE_SYSTEM_PROCESSOR "x86_64")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ELSE(CMAKE_GENERATOR MATCHES Xcode)
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
ENDIF()
ELSE()
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(ARCHS "armv7")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(ARCHS armv7 arm64)
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
# iPhone simulator targets i386
SET(ARCHS "i386")
# iPhone simulator targets x86_64
SET(ARCHS "x86_64")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(ARCHS "armv7;i386")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
SET(ARCHS armv7 arm64 x86_64)
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
ENDIF()
ENDIF()
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
IF(ARCHS)
SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE STRING "Build architecture for iOS")
ENDIF()
# Set the find root to the iOS developer roots and to user defined paths
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root")
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,21 @@
#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 NL_PRODUCT_VERSION "${NL_PRODUCT_VERSION}"
#cmakedefine RYZOM_VERSION "${RYZOM_VERSION}"
#cmakedefine RYZOM_VERSION_RC ${RYZOM_VERSION_RC}
#cmakedefine RYZOM_PRODUCT_VERSION "${RYZOM_PRODUCT_VERSION}"
#cmakedefine AUTHOR "${AUTHOR}"
#cmakedefine YEAR "${YEAR}"
#cmakedefine COPYRIGHT "${COPYRIGHT}"
#cmakedefine RYZOM_CLIENT_ICON "${RYZOM_CLIENT_ICON}"
#endif // CONFIG_H

@ -1,6 +1,10 @@
/* 7zAlloc.c */
/* 7zAlloc.c -- Allocation functions
2017-04-03 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include <stdlib.h>
#include "7zAlloc.h"
/* #define _SZ_ALLOC_DEBUG */
@ -11,24 +15,28 @@
#ifdef _WIN32
#include <windows.h>
#endif
#include <stdio.h>
int g_allocCount = 0;
int g_allocCountTemp = 0;
#endif
void *SzAlloc(size_t size)
void *SzAlloc(ISzAllocPtr p, size_t size)
{
UNUSED_VAR(p);
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
fprintf(stderr, "\nAlloc %10u bytes; count = %10d", (unsigned)size, g_allocCount);
g_allocCount++;
#endif
return malloc(size);
}
void SzFree(void *address)
void SzFree(ISzAllocPtr p, void *address)
{
UNUSED_VAR(p);
#ifdef _SZ_ALLOC_DEBUG
if (address != 0)
{
@ -39,12 +47,13 @@ void SzFree(void *address)
free(address);
}
void *SzAllocTemp(size_t size)
void *SzAllocTemp(ISzAllocPtr p, size_t size)
{
UNUSED_VAR(p);
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp);
fprintf(stderr, "\nAlloc_temp %10u bytes; count = %10d", (unsigned)size, g_allocCountTemp);
g_allocCountTemp++;
#ifdef _WIN32
return HeapAlloc(GetProcessHeap(), 0, size);
@ -53,8 +62,9 @@ void *SzAllocTemp(size_t size)
return malloc(size);
}
void SzFreeTemp(void *address)
void SzFreeTemp(ISzAllocPtr p, void *address)
{
UNUSED_VAR(p);
#ifdef _SZ_ALLOC_DEBUG
if (address != 0)
{

@ -1,20 +1,19 @@
/* 7zAlloc.h */
/* 7zAlloc.h -- Allocation functions
2017-04-03 : Igor Pavlov : Public domain */
#ifndef __7Z_ALLOC_H
#define __7Z_ALLOC_H
#include <stddef.h>
#include "7zTypes.h"
typedef struct _ISzAlloc
{
void *(*Alloc)(size_t size);
void (*Free)(void *address); /* address can be 0 */
} ISzAlloc;
EXTERN_C_BEGIN
void *SzAlloc(size_t size);
void SzFree(void *address);
void *SzAlloc(ISzAllocPtr p, size_t size);
void SzFree(ISzAllocPtr p, void *address);
void *SzAllocTemp(size_t size);
void SzFreeTemp(void *address);
void *SzAllocTemp(ISzAllocPtr p, size_t size);
void SzFreeTemp(ISzAllocPtr p, void *address);
EXTERN_C_END
#endif

@ -1,76 +1,128 @@
/* 7zCrc.c */
/* 7zCrc.c -- CRC32 init
2017-06-06 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include "7zCrc.h"
#include "CpuArch.h"
#define kCrcPoly 0xEDB88320
UInt32 g_CrcTable[256];
#ifdef MY_CPU_LE
#define CRC_NUM_TABLES 8
#else
#define CRC_NUM_TABLES 9
void InitCrcTable()
{
UInt32 i;
for (i = 0; i < 256; i++)
{
UInt32 r = i;
int j;
for (j = 0; j < 8; j++)
if (r & 1)
r = (r >> 1) ^ kCrcPoly;
else
r >>= 1;
g_CrcTable[i] = r;
}
}
#define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24))
UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
UInt32 MY_FAST_CALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
#endif
#ifndef MY_CPU_BE
UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
#endif
typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table);
CRC_FUNC g_CrcUpdateT4;
CRC_FUNC g_CrcUpdateT8;
CRC_FUNC g_CrcUpdate;
void CrcInit(UInt32 *crc) { *crc = 0xFFFFFFFF; }
UInt32 CrcGetDigest(UInt32 *crc) { return *crc ^ 0xFFFFFFFF; }
UInt32 g_CrcTable[256 * CRC_NUM_TABLES];
void CrcUpdateByte(UInt32 *crc, Byte b)
UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
{
*crc = g_CrcTable[((Byte)(*crc)) ^ b] ^ (*crc >> 8);
return g_CrcUpdate(v, data, size, g_CrcTable);
}
void CrcUpdateUInt16(UInt32 *crc, UInt16 v)
UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
{
CrcUpdateByte(crc, (Byte)v);
CrcUpdateByte(crc, (Byte)(v >> 8));
return g_CrcUpdate(CRC_INIT_VAL, data, size, g_CrcTable) ^ CRC_INIT_VAL;
}
void CrcUpdateUInt32(UInt32 *crc, UInt32 v)
#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table)
{
int i;
for (i = 0; i < 4; i++)
CrcUpdateByte(crc, (Byte)(v >> (8 * i)));
const Byte *p = (const Byte *)data;
const Byte *pEnd = p + size;
for (; p != pEnd; p++)
v = CRC_UPDATE_BYTE_2(v, *p);
return v;
}
void CrcUpdateUInt64(UInt32 *crc, UInt64 v)
void MY_FAST_CALL CrcGenerateTable()
{
int i;
for (i = 0; i < 8; i++)
UInt32 i;
for (i = 0; i < 256; i++)
{
CrcUpdateByte(crc, (Byte)(v));
v >>= 8;
UInt32 r = i;
unsigned j;
for (j = 0; j < 8; j++)
r = (r >> 1) ^ (kCrcPoly & ((UInt32)0 - (r & 1)));
g_CrcTable[i] = r;
}
for (i = 256; i < 256 * CRC_NUM_TABLES; i++)
{
UInt32 r = g_CrcTable[(size_t)i - 256];
g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
}
void CrcUpdate(UInt32 *crc, const void *data, size_t size)
#if CRC_NUM_TABLES < 4
g_CrcUpdate = CrcUpdateT1;
#else
#ifdef MY_CPU_LE
g_CrcUpdateT4 = CrcUpdateT4;
g_CrcUpdate = CrcUpdateT4;
#if CRC_NUM_TABLES >= 8
g_CrcUpdateT8 = CrcUpdateT8;
#ifdef MY_CPU_X86_OR_AMD64
if (!CPU_Is_InOrder())
#endif
g_CrcUpdate = CrcUpdateT8;
#endif
#else
{
UInt32 v = *crc;
const Byte *p = (const Byte *)data;
for (; size > 0 ; size--, p++)
v = g_CrcTable[((Byte)(v)) ^ *p] ^ (v >> 8);
*crc = v;
#ifndef MY_CPU_BE
UInt32 k = 0x01020304;
const Byte *p = (const Byte *)&k;
if (p[0] == 4 && p[1] == 3)
{
g_CrcUpdateT4 = CrcUpdateT4;
g_CrcUpdate = CrcUpdateT4;
#if CRC_NUM_TABLES >= 8
g_CrcUpdateT8 = CrcUpdateT8;
g_CrcUpdate = CrcUpdateT8;
#endif
}
UInt32 CrcCalculateDigest(const void *data, size_t size)
else if (p[0] != 1 || p[1] != 2)
g_CrcUpdate = CrcUpdateT1;
else
#endif
{
UInt32 crc;
CrcInit(&crc);
CrcUpdate(&crc, data, size);
return CrcGetDigest(&crc);
for (i = 256 * CRC_NUM_TABLES - 1; i >= 256; i--)
{
UInt32 x = g_CrcTable[(size_t)i - 256];
g_CrcTable[i] = CRC_UINT32_SWAP(x);
}
g_CrcUpdateT4 = CrcUpdateT1_BeT4;
g_CrcUpdate = CrcUpdateT1_BeT4;
#if CRC_NUM_TABLES >= 8
g_CrcUpdateT8 = CrcUpdateT1_BeT8;
g_CrcUpdate = CrcUpdateT1_BeT8;
#endif
}
}
#endif
int CrcVerifyDigest(UInt32 digest, const void *data, size_t size)
{
return (CrcCalculateDigest(data, size) == digest);
#endif
}

@ -1,24 +1,25 @@
/* 7zCrc.h */
/* 7zCrc.h -- CRC32 calculation
2013-01-18 : Igor Pavlov : Public domain */
#ifndef __7Z_CRC_H
#define __7Z_CRC_H
#include <stddef.h>
#include "7zTypes.h"
extern UInt32 g_CrcTable[256];
void InitCrcTable();
EXTERN_C_BEGIN
extern UInt32 g_CrcTable[];
/* Call CrcGenerateTable one time before other CRC functions */
void MY_FAST_CALL CrcGenerateTable(void);
#define CRC_INIT_VAL 0xFFFFFFFF
#define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL)
#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
void CrcInit(UInt32 *crc);
UInt32 CrcGetDigest(UInt32 *crc);
void CrcUpdateByte(UInt32 *crc, Byte v);
void CrcUpdateUInt16(UInt32 *crc, UInt16 v);
void CrcUpdateUInt32(UInt32 *crc, UInt32 v);
void CrcUpdateUInt64(UInt32 *crc, UInt64 v);
void CrcUpdate(UInt32 *crc, const void *data, size_t size);
UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size);
UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size);
UInt32 CrcCalculateDigest(const void *data, size_t size);
int CrcVerifyDigest(UInt32 digest, const void *data, size_t size);
EXTERN_C_END
#endif

@ -1,135 +1,471 @@
/*
7zMain.c
Test application for 7z Decoder
LZMA SDK 4.43 Copyright (c) 1999-2006 Igor Pavlov (2006-06-04)
*/
/* 7zMain.c - Test application for 7z Decoder
2019-02-02 : Igor Pavlov : Public domain */
#include "Precomp.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "CpuArch.h"
#include "7z.h"
#include "7zAlloc.h"
#include "7zBuf.h"
#include "7zCrc.h"
#include "7zIn.h"
#include "7zExtract.h"
#include "7zFile.h"
#include "7zVersion.h"
#ifndef USE_WINDOWS_FILE
/* for mkdir */
#ifdef _WIN32
#include <direct.h>
#else
#include <sys/stat.h>
#include <errno.h>
#endif
#endif
typedef struct _CFileInStream
#define kInputBufSize ((size_t)1 << 18)
static const ISzAlloc g_Alloc = { SzAlloc, SzFree };
static void Print(const char *s)
{
ISzInStream InStream;
FILE *File;
} CFileInStream;
fputs(s, stdout);
}
#ifdef _LZMA_IN_CB
#define kBufferSize (1 << 12)
Byte g_Buffer[kBufferSize];
static int Buf_EnsureSize(CBuf *dest, size_t size)
{
if (dest->size >= size)
return 1;
Buf_Free(dest, &g_Alloc);
return Buf_Create(dest, size, &g_Alloc);
}
#ifndef _WIN32
#define _USE_UTF8
#endif
/* #define _USE_UTF8 */
#ifdef _USE_UTF8
#define _UTF8_START(n) (0x100 - (1 << (7 - (n))))
#define _UTF8_RANGE(n) (((UInt32)1) << ((n) * 5 + 6))
SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxRequiredSize, size_t *processedSize)
#define _UTF8_HEAD(n, val) ((Byte)(_UTF8_START(n) + (val >> (6 * (n)))))
#define _UTF8_CHAR(n, val) ((Byte)(0x80 + (((val) >> (6 * (n))) & 0x3F)))
static size_t Utf16_To_Utf8_Calc(const UInt16 *src, const UInt16 *srcLim)
{
CFileInStream *s = (CFileInStream *)object;
size_t processedSizeLoc;
if (maxRequiredSize > kBufferSize)
maxRequiredSize = kBufferSize;
processedSizeLoc = fread(g_Buffer, 1, maxRequiredSize, s->File);
*buffer = g_Buffer;
if (processedSize != 0)
*processedSize = processedSizeLoc;
return SZ_OK;
size_t size = 0;
for (;;)
{
UInt32 val;
if (src == srcLim)
return size;
size++;
val = *src++;
if (val < 0x80)
continue;
if (val < _UTF8_RANGE(1))
{
size++;
continue;
}
#else
if (val >= 0xD800 && val < 0xDC00 && src != srcLim)
{
UInt32 c2 = *src;
if (c2 >= 0xDC00 && c2 < 0xE000)
{
src++;
size += 3;
continue;
}
}
size += 2;
}
}
static Byte *Utf16_To_Utf8(Byte *dest, const UInt16 *src, const UInt16 *srcLim)
{
for (;;)
{
UInt32 val;
if (src == srcLim)
return dest;
val = *src++;
if (val < 0x80)
{
*dest++ = (char)val;
continue;
}
if (val < _UTF8_RANGE(1))
{
dest[0] = _UTF8_HEAD(1, val);
dest[1] = _UTF8_CHAR(0, val);
dest += 2;
continue;
}
if (val >= 0xD800 && val < 0xDC00 && src != srcLim)
{
UInt32 c2 = *src;
if (c2 >= 0xDC00 && c2 < 0xE000)
{
src++;
val = (((val - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000;
dest[0] = _UTF8_HEAD(3, val);
dest[1] = _UTF8_CHAR(2, val);
dest[2] = _UTF8_CHAR(1, val);
dest[3] = _UTF8_CHAR(0, val);
dest += 4;
continue;
}
}
SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size, size_t *processedSize)
dest[0] = _UTF8_HEAD(2, val);
dest[1] = _UTF8_CHAR(1, val);
dest[2] = _UTF8_CHAR(0, val);
dest += 3;
}
}
static SRes Utf16_To_Utf8Buf(CBuf *dest, const UInt16 *src, size_t srcLen)
{
CFileInStream *s = (CFileInStream *)object;
size_t processedSizeLoc = fread(buffer, 1, size, s->File);
if (processedSize != 0)
*processedSize = processedSizeLoc;
size_t destLen = Utf16_To_Utf8_Calc(src, src + srcLen);
destLen += 1;
if (!Buf_EnsureSize(dest, destLen))
return SZ_ERROR_MEM;
*Utf16_To_Utf8(dest->data, src, src + srcLen) = 0;
return SZ_OK;
}
#endif
SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
static SRes Utf16_To_Char(CBuf *buf, const UInt16 *s
#ifndef _USE_UTF8
, UINT codePage
#endif
)
{
unsigned len = 0;
for (len = 0; s[len] != 0; len++);
#ifndef _USE_UTF8
{
unsigned size = len * 3 + 100;
if (!Buf_EnsureSize(buf, size))
return SZ_ERROR_MEM;
{
buf->data[0] = 0;
if (len != 0)
{
CFileInStream *s = (CFileInStream *)object;
int res = fseek(s->File, (long)pos, SEEK_SET);
if (res == 0)
char defaultChar = '_';
BOOL defUsed;
unsigned numChars = 0;
numChars = WideCharToMultiByte(codePage, 0, (LPCWSTR)s, len, (char *)buf->data, size, &defaultChar, &defUsed);
if (numChars == 0 || numChars >= size)
return SZ_ERROR_FAIL;
buf->data[numChars] = 0;
}
return SZ_OK;
return SZE_FAIL;
}
}
#else
return Utf16_To_Utf8Buf(buf, s, len);
#endif
}
void PrintError(const char *sz)
#ifdef _WIN32
#ifndef USE_WINDOWS_FILE
static UINT g_FileCodePage = CP_ACP;
#endif
#define MY_FILE_CODE_PAGE_PARAM ,g_FileCodePage
#else
#define MY_FILE_CODE_PAGE_PARAM
#endif
static WRes MyCreateDir(const UInt16 *name)
{
printf("\nERROR: %s\n", sz);
#ifdef USE_WINDOWS_FILE
return CreateDirectoryW((LPCWSTR)name, NULL) ? 0 : GetLastError();
#else
CBuf buf;
WRes res;
Buf_Init(&buf);
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
res =
#ifdef _WIN32
_mkdir((const char *)buf.data)
#else
mkdir((const char *)buf.data, 0777)
#endif
== 0 ? 0 : errno;
Buf_Free(&buf, &g_Alloc);
return res;
#endif
}
int main(int numargs, char *args[])
static WRes OutFile_OpenUtf16(CSzFile *p, const UInt16 *name)
{
#ifdef USE_WINDOWS_FILE
return OutFile_OpenW(p, (LPCWSTR)name);
#else
CBuf buf;
WRes res;
Buf_Init(&buf);
RINOK(Utf16_To_Char(&buf, name MY_FILE_CODE_PAGE_PARAM));
res = OutFile_Open(p, (const char *)buf.data);
Buf_Free(&buf, &g_Alloc);
return res;
#endif
}
static SRes PrintString(const UInt16 *s)
{
CBuf buf;
SRes res;
Buf_Init(&buf);
res = Utf16_To_Char(&buf, s
#ifndef _USE_UTF8
, CP_OEMCP
#endif
);
if (res == SZ_OK)
Print((const char *)buf.data);
Buf_Free(&buf, &g_Alloc);
return res;
}
static void UInt64ToStr(UInt64 value, char *s, int numDigits)
{
char temp[32];
int pos = 0;
do
{
temp[pos++] = (char)('0' + (unsigned)(value % 10));
value /= 10;
}
while (value != 0);
for (numDigits -= pos; numDigits > 0; numDigits--)
*s++ = ' ';
do
*s++ = temp[--pos];
while (pos);
*s = '\0';
}
static char *UIntToStr(char *s, unsigned value, int numDigits)
{
char temp[16];
int pos = 0;
do
temp[pos++] = (char)('0' + (value % 10));
while (value /= 10);
for (numDigits -= pos; numDigits > 0; numDigits--)
*s++ = '0';
do
*s++ = temp[--pos];
while (pos);
*s = '\0';
return s;
}
static void UIntToStr_2(char *s, unsigned value)
{
s[0] = (char)('0' + (value / 10));
s[1] = (char)('0' + (value % 10));
}
#define PERIOD_4 (4 * 365 + 1)
#define PERIOD_100 (PERIOD_4 * 25 - 1)
#define PERIOD_400 (PERIOD_100 * 4 + 1)
static void ConvertFileTimeToString(const CNtfsFileTime *nt, char *s)
{
unsigned year, mon, hour, min, sec;
Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
unsigned t;
UInt32 v;
UInt64 v64 = nt->Low | ((UInt64)nt->High << 32);
v64 /= 10000000;
sec = (unsigned)(v64 % 60); v64 /= 60;
min = (unsigned)(v64 % 60); v64 /= 60;
hour = (unsigned)(v64 % 24); v64 /= 24;
v = (UInt32)v64;
year = (unsigned)(1601 + v / PERIOD_400 * 400);
v %= PERIOD_400;
t = v / PERIOD_100; if (t == 4) t = 3; year += t * 100; v -= t * PERIOD_100;
t = v / PERIOD_4; if (t == 25) t = 24; year += t * 4; v -= t * PERIOD_4;
t = v / 365; if (t == 4) t = 3; year += t; v -= t * 365;
if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
ms[1] = 29;
for (mon = 0;; mon++)
{
unsigned d = ms[mon];
if (v < d)
break;
v -= d;
}
s = UIntToStr(s, year, 4); *s++ = '-';
UIntToStr_2(s, mon + 1); s[2] = '-'; s += 3;
UIntToStr_2(s, (unsigned)v + 1); s[2] = ' '; s += 3;
UIntToStr_2(s, hour); s[2] = ':'; s += 3;
UIntToStr_2(s, min); s[2] = ':'; s += 3;
UIntToStr_2(s, sec); s[2] = 0;
}
static void PrintLF()
{
Print("\n");
}
static void PrintError(char *s)
{
Print("\nERROR: ");
Print(s);
PrintLF();
}
static void GetAttribString(UInt32 wa, BoolInt isDir, char *s)
{
#ifdef USE_WINDOWS_FILE
s[0] = (char)(((wa & FILE_ATTRIBUTE_DIRECTORY) != 0 || isDir) ? 'D' : '.');
s[1] = (char)(((wa & FILE_ATTRIBUTE_READONLY ) != 0) ? 'R': '.');
s[2] = (char)(((wa & FILE_ATTRIBUTE_HIDDEN ) != 0) ? 'H': '.');
s[3] = (char)(((wa & FILE_ATTRIBUTE_SYSTEM ) != 0) ? 'S': '.');
s[4] = (char)(((wa & FILE_ATTRIBUTE_ARCHIVE ) != 0) ? 'A': '.');
s[5] = 0;
#else
s[0] = (char)(((wa & (1 << 4)) != 0 || isDir) ? 'D' : '.');
s[1] = 0;
#endif
}
// #define NUM_PARENTS_MAX 128
int MY_CDECL main(int numargs, char *args[])
{
CFileInStream archiveStream;
CArchiveDatabaseEx db;
SZ_RESULT res;
ISzAlloc allocImp;
ISzAlloc allocTempImp;
printf("\n7z ANSI-C Decoder 4.43 Copyright (c) 1999-2006 Igor Pavlov 2006-06-04\n");
CFileInStream archiveStream;
CLookToRead2 lookStream;
CSzArEx db;
SRes res;
UInt16 *temp = NULL;
size_t tempSize = 0;
// UInt32 parents[NUM_PARENTS_MAX];
Print("\n7z Decoder " MY_VERSION_CPU " : " MY_COPYRIGHT_DATE "\n\n");
if (numargs == 1)
{
printf(
"\nUsage: 7zDec <command> <archive_name>\n\n"
Print(
"Usage: 7zDec <command> <archive_name>\n\n"
"<Commands>\n"
" e: Extract files from archive\n"
" e: Extract files from archive (without using directory names)\n"
" l: List contents of archive\n"
" t: Test integrity of archive\n");
" t: Test integrity of archive\n"
" x: eXtract files with full paths\n");
return 0;
}
if (numargs < 3)
{
PrintError("incorrect command");
return 1;
}
archiveStream.File = fopen(args[2], "rb");
if (archiveStream.File == 0)
#if defined(_WIN32) && !defined(USE_WINDOWS_FILE) && !defined(UNDER_CE)
g_FileCodePage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;
#endif
allocImp = g_Alloc;
allocTempImp = g_Alloc;
#ifdef UNDER_CE
if (InFile_OpenW(&archiveStream.file, L"\test.7z"))
#else
if (InFile_Open(&archiveStream.file, args[2]))
#endif
{
PrintError("can not open input file");
return 1;
}
archiveStream.InStream.Read = SzFileReadImp;
archiveStream.InStream.Seek = SzFileSeekImp;
FileInStream_CreateVTable(&archiveStream);
LookToRead2_CreateVTable(&lookStream, False);
lookStream.buf = NULL;
allocImp.Alloc = SzAlloc;
allocImp.Free = SzFree;
res = SZ_OK;
allocTempImp.Alloc = SzAllocTemp;
allocTempImp.Free = SzFreeTemp;
{
lookStream.buf = (Byte *)ISzAlloc_Alloc(&allocImp, kInputBufSize);
if (!lookStream.buf)
res = SZ_ERROR_MEM;
else
{
lookStream.bufSize = kInputBufSize;
lookStream.realStream = &archiveStream.vt;
LookToRead2_Init(&lookStream);
}
}
CrcGenerateTable();
SzArEx_Init(&db);
InitCrcTable();
SzArDbExInit(&db);
res = SzArchiveOpen(&archiveStream.InStream, &db, &allocImp, &allocTempImp);
if (res == SZ_OK)
{
char *command = args[1];
int listCommand = 0;
int testCommand = 0;
int extractCommand = 0;
if (strcmp(command, "l") == 0)
listCommand = 1;
if (strcmp(command, "t") == 0)
testCommand = 1;
else if (strcmp(command, "e") == 0)
extractCommand = 1;
res = SzArEx_Open(&db, &lookStream.vt, &allocImp, &allocTempImp);
}
if (listCommand)
if (res == SZ_OK)
{
UInt32 i;
for (i = 0; i < db.Database.NumFiles; i++)
char *command = args[1];
int listCommand = 0, testCommand = 0, fullPaths = 0;
if (strcmp(command, "l") == 0) listCommand = 1;
else if (strcmp(command, "t") == 0) testCommand = 1;
else if (strcmp(command, "e") == 0) { }
else if (strcmp(command, "x") == 0) { fullPaths = 1; }
else
{
CFileItem *f = db.Database.Files + i;
printf("%10d %s\n", (int)f->Size, f->Name);
}
PrintError("incorrect command");
res = SZ_ERROR_FAIL;
}
else if (testCommand || extractCommand)
if (res == SZ_OK)
{
UInt32 i;
@ -141,85 +477,210 @@ int main(int numargs, char *args[])
Byte *outBuffer = 0; /* it must be 0 before first call for each new archive. */
size_t outBufferSize = 0; /* it can have any value before first call (if outBuffer = 0) */
printf("\n");
for (i = 0; i < db.Database.NumFiles; i++)
for (i = 0; i < db.NumFiles; i++)
{
size_t offset = 0;
size_t outSizeProcessed = 0;
// const CSzFileItem *f = db.Files + i;
size_t len;
unsigned isDir = SzArEx_IsDir(&db, i);
if (listCommand == 0 && isDir && !fullPaths)
continue;
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
// len = SzArEx_GetFullNameLen(&db, i);
if (len > tempSize)
{
SzFree(NULL, temp);
tempSize = len;
temp = (UInt16 *)SzAlloc(NULL, tempSize * sizeof(temp[0]));
if (!temp)
{
res = SZ_ERROR_MEM;
break;
}
}
SzArEx_GetFileNameUtf16(&db, i, temp);
/*
if (SzArEx_GetFullNameUtf16_Back(&db, i, temp + len) != temp)
{
size_t offset;
size_t outSizeProcessed;
CFileItem *f = db.Database.Files + i;
if (f->IsDirectory)
printf("Directory ");
res = SZ_ERROR_FAIL;
break;
}
*/
if (listCommand)
{
char attr[8], s[32], t[32];
UInt64 fileSize;
GetAttribString(SzBitWithVals_Check(&db.Attribs, i) ? db.Attribs.Vals[i] : 0, isDir, attr);
fileSize = SzArEx_GetFileSize(&db, i);
UInt64ToStr(fileSize, s, 10);
if (SzBitWithVals_Check(&db.MTime, i))
ConvertFileTimeToString(&db.MTime.Vals[i], t);
else
printf(testCommand ?
"Testing ":
"Extracting");
printf(" %s", f->Name);
if (f->IsDirectory)
{
printf("\n");
size_t j;
for (j = 0; j < 19; j++)
t[j] = ' ';
t[j] = '\0';
}
Print(t);
Print(" ");
Print(attr);
Print(" ");
Print(s);
Print(" ");
res = PrintString(temp);
if (res != SZ_OK)
break;
if (isDir)
Print("/");
PrintLF();
continue;
}
res = SzExtract(&archiveStream.InStream, &db, i,
Print(testCommand ?
"Testing ":
"Extracting ");
res = PrintString(temp);
if (res != SZ_OK)
break;
if (isDir)
Print("/");
else
{
res = SzArEx_Extract(&db, &lookStream.vt, i,
&blockIndex, &outBuffer, &outBufferSize,
&offset, &outSizeProcessed,
&allocImp, &allocTempImp);
if (res != SZ_OK)
break;
}
if (!testCommand)
{
FILE *outputHandle;
CSzFile outFile;
size_t processedSize;
char *fileName = f->Name;
size_t nameLen = strlen(f->Name);
for (; nameLen > 0; nameLen--)
if (f->Name[nameLen - 1] == '/')
size_t j;
UInt16 *name = (UInt16 *)temp;
const UInt16 *destPath = (const UInt16 *)name;
for (j = 0; name[j] != 0; j++)
if (name[j] == '/')
{
fileName = f->Name + nameLen;
break;
if (fullPaths)
{
name[j] = 0;
MyCreateDir(name);
name[j] = CHAR_PATH_SEPARATOR;
}
else
destPath = name + j + 1;
}
outputHandle = fopen(fileName, "wb+");
if (outputHandle == 0)
if (isDir)
{
MyCreateDir(destPath);
PrintLF();
continue;
}
else if (OutFile_OpenUtf16(&outFile, destPath))
{
PrintError("can not open output file");
res = SZE_FAIL;
res = SZ_ERROR_FAIL;
break;
}
processedSize = fwrite(outBuffer + offset, 1, outSizeProcessed, outputHandle);
if (processedSize != outSizeProcessed)
processedSize = outSizeProcessed;
if (File_Write(&outFile, outBuffer + offset, &processedSize) != 0 || processedSize != outSizeProcessed)
{
PrintError("can not write output file");
res = SZE_FAIL;
res = SZ_ERROR_FAIL;
break;
}
if (fclose(outputHandle))
#ifdef USE_WINDOWS_FILE
{
FILETIME mtime, ctime;
FILETIME *mtimePtr = NULL;
FILETIME *ctimePtr = NULL;
if (SzBitWithVals_Check(&db.MTime, i))
{
const CNtfsFileTime *t = &db.MTime.Vals[i];
mtime.dwLowDateTime = (DWORD)(t->Low);
mtime.dwHighDateTime = (DWORD)(t->High);
mtimePtr = &mtime;
}
if (SzBitWithVals_Check(&db.CTime, i))
{
const CNtfsFileTime *t = &db.CTime.Vals[i];
ctime.dwLowDateTime = (DWORD)(t->Low);
ctime.dwHighDateTime = (DWORD)(t->High);
ctimePtr = &ctime;
}
if (mtimePtr || ctimePtr)
SetFileTime(outFile.handle, ctimePtr, NULL, mtimePtr);
}
#endif
if (File_Close(&outFile))
{
PrintError("can not close output file");
res = SZE_FAIL;
res = SZ_ERROR_FAIL;
break;
}
#ifdef USE_WINDOWS_FILE
if (SzBitWithVals_Check(&db.Attribs, i))
{
UInt32 attrib = db.Attribs.Vals[i];
/* p7zip stores posix attributes in high 16 bits and adds 0x8000 as marker.
We remove posix bits, if we detect posix mode field */
if ((attrib & 0xF0000000) != 0)
attrib &= 0x7FFF;
SetFileAttributesW((LPCWSTR)destPath, attrib);
}
printf("\n");
#endif
}
allocImp.Free(outBuffer);
PrintLF();
}
else
{
PrintError("incorrect command");
res = SZE_FAIL;
ISzAlloc_Free(&allocImp, outBuffer);
}
}
SzArDbExFree(&db, allocImp.Free);
fclose(archiveStream.File);
SzFree(NULL, temp);
SzArEx_Free(&db, &allocImp);
ISzAlloc_Free(&allocImp, lookStream.buf);
File_Close(&archiveStream.file);
if (res == SZ_OK)
{
printf("\nEverything is Ok\n");
Print("\nEverything is Ok\n");
return 0;
}
if (res == SZE_OUTOFMEMORY)
if (res == SZ_ERROR_UNSUPPORTED)
PrintError("decoder doesn't support this archive");
else if (res == SZ_ERROR_MEM)
PrintError("can not allocate memory");
else if (res == SZ_ERROR_CRC)
PrintError("CRC error");
else
printf("\nERROR #%d\n", res);
{
char s[32];
UInt64ToStr(res, s, 0);
PrintError(s);
}
return 1;
}

@ -1,70 +1,375 @@
/* 7zTypes.h */
/* 7zTypes.h -- Basic types
2018-08-04 : Igor Pavlov : Public domain */
#ifndef __COMMON_TYPES_H
#define __COMMON_TYPES_H
#ifndef __7Z_TYPES_H
#define __7Z_TYPES_H
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#ifdef _WIN32
/* #include <windows.h> */
#endif
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED
typedef unsigned short UInt16;
#include <stddef.h>
#ifndef EXTERN_C_BEGIN
#ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" {
#define EXTERN_C_END }
#else
#define EXTERN_C_BEGIN
#define EXTERN_C_END
#endif
#endif
EXTERN_C_BEGIN
#define SZ_OK 0
#define SZ_ERROR_DATA 1
#define SZ_ERROR_MEM 2
#define SZ_ERROR_CRC 3
#define SZ_ERROR_UNSUPPORTED 4
#define SZ_ERROR_PARAM 5
#define SZ_ERROR_INPUT_EOF 6
#define SZ_ERROR_OUTPUT_EOF 7
#define SZ_ERROR_READ 8
#define SZ_ERROR_WRITE 9
#define SZ_ERROR_PROGRESS 10
#define SZ_ERROR_FAIL 11
#define SZ_ERROR_THREAD 12
#define SZ_ERROR_ARCHIVE 16
#define SZ_ERROR_NO_ARCHIVE 17
typedef int SRes;
#ifdef _WIN32
/* typedef DWORD WRes; */
typedef unsigned WRes;
#define MY_SRes_HRESULT_FROM_WRes(x) HRESULT_FROM_WIN32(x)
#else
typedef int WRes;
#define MY__FACILITY_WIN32 7
#define MY__FACILITY__WRes MY__FACILITY_WIN32
#define MY_SRes_HRESULT_FROM_WRes(x) ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : ((HRESULT) (((x) & 0x0000FFFF) | (MY__FACILITY__WRes << 16) | 0x80000000)))
#endif
#ifndef RINOK
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
#endif
typedef unsigned char Byte;
typedef short Int16;
typedef unsigned short UInt16;
#ifndef _7ZIP_UINT32_DEFINED
#define _7ZIP_UINT32_DEFINED
#ifdef _LZMA_UINT32_IS_ULONG
typedef long Int32;
typedef unsigned long UInt32;
#else
typedef int Int32;
typedef unsigned int UInt32;
#endif
#endif
/* #define _SZ_NO_INT_64 */
/* define it your compiler doesn't support long long int */
#ifndef _7ZIP_UINT64_DEFINED
#define _7ZIP_UINT64_DEFINED
#ifdef _SZ_NO_INT_64
/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
NOTES: Some code will work incorrectly in that case! */
typedef long Int64;
typedef unsigned long UInt64;
#else
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#define UINT64_CONST(n) n
#else
typedef long long int Int64;
typedef unsigned long long int UInt64;
#define UINT64_CONST(n) n ## ULL
#endif
#endif
#ifdef _LZMA_NO_SYSTEM_SIZE_T
typedef UInt32 SizeT;
#else
typedef size_t SizeT;
#endif
typedef int BoolInt;
/* typedef BoolInt Bool; */
#define True 1
#define False 0
/* #define _SZ_FILE_SIZE_64 */
/* Use _SZ_FILE_SIZE_64 if you need support for files larger than 4 GB*/
#ifndef CFileSize
#ifdef _SZ_FILE_SIZE_64
typedef UInt64 CFileSize;
#ifdef _WIN32
#define MY_STD_CALL __stdcall
#else
typedef UInt32 CFileSize;
#define MY_STD_CALL
#endif
#ifdef _MSC_VER
#if _MSC_VER >= 1300
#define MY_NO_INLINE __declspec(noinline)
#else
#define MY_NO_INLINE
#endif
#define SZ_RESULT int
#define MY_FORCE_INLINE __forceinline
#define MY_CDECL __cdecl
#define MY_FAST_CALL __fastcall
#else
#define MY_NO_INLINE
#define MY_FORCE_INLINE
#define MY_CDECL
#define MY_FAST_CALL
/* inline keyword : for C++ / C99 */
/* GCC, clang: */
/*
#if defined (__GNUC__) && (__GNUC__ >= 4)
#define MY_FORCE_INLINE __attribute__((always_inline))
#define MY_NO_INLINE __attribute__((noinline))
#endif
*/
#endif
/* The following interfaces use first parameter as pointer to structure */
typedef struct IByteIn IByteIn;
struct IByteIn
{
Byte (*Read)(const IByteIn *p); /* reads one byte, returns 0 in case of EOF or error */
};
#define IByteIn_Read(p) (p)->Read(p)
typedef struct IByteOut IByteOut;
struct IByteOut
{
void (*Write)(const IByteOut *p, Byte b);
};
#define IByteOut_Write(p, b) (p)->Write(p, b)
typedef struct ISeqInStream ISeqInStream;
struct ISeqInStream
{
SRes (*Read)(const ISeqInStream *p, void *buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) < input(*size)) is allowed */
};
#define ISeqInStream_Read(p, buf, size) (p)->Read(p, buf, size)
/* it can return SZ_ERROR_INPUT_EOF */
SRes SeqInStream_Read(const ISeqInStream *stream, void *buf, size_t size);
SRes SeqInStream_Read2(const ISeqInStream *stream, void *buf, size_t size, SRes errorType);
SRes SeqInStream_ReadByte(const ISeqInStream *stream, Byte *buf);
typedef struct ISeqOutStream ISeqOutStream;
struct ISeqOutStream
{
size_t (*Write)(const ISeqOutStream *p, const void *buf, size_t size);
/* Returns: result - the number of actually written bytes.
(result < size) means error */
};
#define ISeqOutStream_Write(p, buf, size) (p)->Write(p, buf, size)
typedef enum
{
SZ_SEEK_SET = 0,
SZ_SEEK_CUR = 1,
SZ_SEEK_END = 2
} ESzSeek;
#define SZ_OK (0)
#define SZE_DATA_ERROR (1)
#define SZE_OUTOFMEMORY (2)
#define SZE_CRC_ERROR (3)
#define SZE_NOTIMPL (4)
#define SZE_FAIL (5)
typedef struct ISeekInStream ISeekInStream;
struct ISeekInStream
{
SRes (*Read)(const ISeekInStream *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
SRes (*Seek)(const ISeekInStream *p, Int64 *pos, ESzSeek origin);
};
#define ISeekInStream_Read(p, buf, size) (p)->Read(p, buf, size)
#define ISeekInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
#define SZE_ARCHIVE_ERROR (6)
#define RINOK(x) { int __result_ = (x); if(__result_ != 0) return __result_; }
typedef struct ILookInStream ILookInStream;
struct ILookInStream
{
SRes (*Look)(const ILookInStream *p, const void **buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) > input(*size)) is not allowed
(output(*size) < input(*size)) is allowed */
SRes (*Skip)(const ILookInStream *p, size_t offset);
/* offset must be <= output(*size) of Look */
SRes (*Read)(const ILookInStream *p, void *buf, size_t *size);
/* reads directly (without buffer). It's same as ISeqInStream::Read */
SRes (*Seek)(const ILookInStream *p, Int64 *pos, ESzSeek origin);
};
#define ILookInStream_Look(p, buf, size) (p)->Look(p, buf, size)
#define ILookInStream_Skip(p, offset) (p)->Skip(p, offset)
#define ILookInStream_Read(p, buf, size) (p)->Read(p, buf, size)
#define ILookInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
SRes LookInStream_LookRead(const ILookInStream *stream, void *buf, size_t *size);
SRes LookInStream_SeekTo(const ILookInStream *stream, UInt64 offset);
/* reads via ILookInStream::Read */
SRes LookInStream_Read2(const ILookInStream *stream, void *buf, size_t size, SRes errorType);
SRes LookInStream_Read(const ILookInStream *stream, void *buf, size_t size);
typedef struct
{
ILookInStream vt;
const ISeekInStream *realStream;
size_t pos;
size_t size; /* it's data size */
/* the following variables must be set outside */
Byte *buf;
size_t bufSize;
} CLookToRead2;
void LookToRead2_CreateVTable(CLookToRead2 *p, int lookahead);
#define LookToRead2_Init(p) { (p)->pos = (p)->size = 0; }
typedef struct
{
ISeqInStream vt;
const ILookInStream *realStream;
} CSecToLook;
void SecToLook_CreateVTable(CSecToLook *p);
typedef struct
{
ISeqInStream vt;
const ILookInStream *realStream;
} CSecToRead;
void SecToRead_CreateVTable(CSecToRead *p);
typedef struct ICompressProgress ICompressProgress;
struct ICompressProgress
{
SRes (*Progress)(const ICompressProgress *p, UInt64 inSize, UInt64 outSize);
/* Returns: result. (result != SZ_OK) means break.
Value (UInt64)(Int64)-1 for size means unknown value. */
};
#define ICompressProgress_Progress(p, inSize, outSize) (p)->Progress(p, inSize, outSize)
typedef struct ISzAlloc ISzAlloc;
typedef const ISzAlloc * ISzAllocPtr;
struct ISzAlloc
{
void *(*Alloc)(ISzAllocPtr p, size_t size);
void (*Free)(ISzAllocPtr p, void *address); /* address can be 0 */
};
#define ISzAlloc_Alloc(p, size) (p)->Alloc(p, size)
#define ISzAlloc_Free(p, a) (p)->Free(p, a)
/* deprecated */
#define IAlloc_Alloc(p, size) ISzAlloc_Alloc(p, size)
#define IAlloc_Free(p, a) ISzAlloc_Free(p, a)
#ifndef MY_offsetof
#ifdef offsetof
#define MY_offsetof(type, m) offsetof(type, m)
/*
#define MY_offsetof(type, m) FIELD_OFFSET(type, m)
*/
#else
#define MY_offsetof(type, m) ((size_t)&(((type *)0)->m))
#endif
#endif
#ifndef MY_container_of
/*
#define MY_container_of(ptr, type, m) container_of(ptr, type, m)
#define MY_container_of(ptr, type, m) CONTAINING_RECORD(ptr, type, m)
#define MY_container_of(ptr, type, m) ((type *)((char *)(ptr) - offsetof(type, m)))
#define MY_container_of(ptr, type, m) (&((type *)0)->m == (ptr), ((type *)(((char *)(ptr)) - MY_offsetof(type, m))))
*/
/*
GCC shows warning: "perhaps the 'offsetof' macro was used incorrectly"
GCC 3.4.4 : classes with constructor
GCC 4.8.1 : classes with non-public variable members"
*/
#define MY_container_of(ptr, type, m) ((type *)((char *)(1 ? (ptr) : &((type *)0)->m) - MY_offsetof(type, m)))
#endif
#define CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(ptr))
/*
#define CONTAINER_FROM_VTBL(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
*/
#define CONTAINER_FROM_VTBL(ptr, type, m) MY_container_of(ptr, type, m)
#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
/*
#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL(ptr, type, m)
*/
#ifdef _WIN32
#define CHAR_PATH_SEPARATOR '\\'
#define WCHAR_PATH_SEPARATOR L'\\'
#define STRING_PATH_SEPARATOR "\\"
#define WSTRING_PATH_SEPARATOR L"\\"
#else
#define CHAR_PATH_SEPARATOR '/'
#define WCHAR_PATH_SEPARATOR L'/'
#define STRING_PATH_SEPARATOR "/"
#define WSTRING_PATH_SEPARATOR L"/"
#endif
// activate callback support
//#define _LZMA_IN_CB
EXTERN_C_END
#endif

@ -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,16 @@ 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(3rdparty)
ADD_SUBDIRECTORY(src)
IF(WITH_NEL_SAMPLES)
ADD_SUBDIRECTORY(samples)
ENDIF(WITH_NEL_SAMPLES)
ENDIF()
# 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)

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

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

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

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

@ -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
@ -74,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.
@ -152,6 +155,7 @@ public:
void dumpCache (const char *filename)
{
if (_TexFont)
_TexFont->dumpTextureFont (filename);
}
@ -160,6 +164,15 @@ public:
*/
void invalidate();
// get font atlas rebuild count
uint32 getCacheVersion() const
{
if (_TexFont)
return (_TexFont->getCacheVersion() << 16) + _TexCacheNr;
return 0;
}
};

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

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

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

Loading…
Cancel
Save