Compare commits
No commits in common. 'main/gingo-test' and 'hg/feature/streamed-package' have entirely different histories.
main/gingo
...
hg/feature
@ -1,24 +0,0 @@
|
||||
---
|
||||
BasedOnStyle: WebKit
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
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
|
||||
|
||||
...
|
@ -1,23 +0,0 @@
|
||||
; 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
|
||||
|
||||
[*.cfg]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
@ -1,274 +0,0 @@
|
||||
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
|
||||
.vscode/
|
||||
*.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/
|
||||
|
||||
# VSCode project folder
|
||||
.vscode/
|
||||
|
||||
# Python cache
|
||||
*.pyd
|
||||
*.pyc
|
||||
|
||||
# Qt compiler
|
||||
moc_*.cpp
|
||||
*.moc
|
||||
|
||||
# Misc garbage
|
||||
*.rej
|
||||
*.orig
|
||||
*.cachefile
|
||||
*.cache
|
||||
*.patch
|
||||
*.7z
|
||||
.svn
|
||||
thumbs.db
|
||||
Thumbs.db
|
||||
*.tpl.php
|
||||
.SyncID
|
||||
.SyncIgnore
|
||||
.SyncArchive
|
||||
|
||||
# build
|
||||
nel/build/*
|
||||
nelns/build/*
|
||||
snowballs/build/*
|
||||
ryzom/build/*
|
||||
build/*
|
||||
build-2010/*
|
||||
build/*
|
||||
install/*
|
||||
win-build/
|
||||
build_*
|
||||
install_*
|
||||
nel/tools/build_gamedata/configuration/buildsite.py
|
||||
|
||||
# Linux nel compile
|
||||
nel/build/nel-config
|
||||
nel/config.status
|
||||
nel/include/nelconfig.h
|
||||
nel/include/stamp-h1
|
||||
nel/libtool
|
||||
nel/nel-config
|
||||
nel/samples/3d/cluster_viewer/cluster_viewer
|
||||
nel/samples/3d/font/font
|
||||
nel/samples/georges/georges
|
||||
nel/samples/misc/command/command
|
||||
nel/samples/misc/configfile/configfile
|
||||
nel/samples/misc/debug/debug
|
||||
nel/samples/misc/i18n/i18n
|
||||
nel/samples/misc/log/log
|
||||
nel/samples/misc/strings/strings
|
||||
nel/samples/net/chat/chatclient
|
||||
nel/samples/net/chat/chatserver
|
||||
nel/samples/net/login_system/nls_frontend_service
|
||||
nel/samples/net/login_system/nls_login_client
|
||||
nel/samples/net/udp/udp_bench_client
|
||||
nel/samples/net/udp/udp_bench_service
|
||||
nel/samples/pacs/pacs_sample
|
||||
nel/tools/3d/build_coarse_mesh/build_coarse_mesh
|
||||
nel/tools/3d/build_far_bank/build_far_bank
|
||||
nel/tools/3d/build_smallbank/build_smallbank
|
||||
nel/tools/3d/ig_lighter/ig_lighter
|
||||
nel/tools/3d/zone_dependencies/zone_dependencies
|
||||
nel/tools/3d/zone_ig_lighter/zone_ig_lighter
|
||||
nel/tools/3d/zone_lighter/zone_lighter
|
||||
nel/tools/3d/zone_welder/zone_welder
|
||||
nel/tools/misc/bnp_make/bnp_make
|
||||
nel/tools/misc/disp_sheet_id/disp_sheet_id
|
||||
nel/tools/misc/make_sheet_id/make_sheet_id
|
||||
nel/tools/misc/xml_packer/xml_packer
|
||||
nel/tools/pacs/build_ig_boxes/build_ig_boxes
|
||||
nel/tools/pacs/build_indoor_rbank/build_indoor_rbank
|
||||
nel/tools/pacs/build_rbank/build_rbank
|
||||
ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/skills.skill_tree
|
||||
ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/xptable.xp_table
|
||||
ryzom/tools/server/sql/ryzom_admin_default_data.sql
|
||||
|
||||
|
||||
# Linux server compile
|
||||
ryzom/server/src/entities_game_service/entities_game_service
|
||||
ryzom/server/src/frontend_service/frontend_service
|
||||
ryzom/server/src/gpm_service/gpm_service
|
||||
ryzom/server/src/input_output_service/input_output_service
|
||||
ryzom/server/src/mirror_service/mirror_service
|
||||
ryzom/server/src/ryzom_admin_service/ryzom_admin_service
|
||||
ryzom/server/src/ryzom_naming_service/ryzom_naming_service
|
||||
ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service
|
||||
ryzom/server/src/tick_service/tick_service
|
||||
|
||||
# WebTT temp dir
|
||||
ryzom/tools/server/www/webtt/app/tmp
|
||||
|
||||
# AMS ignore
|
||||
web/public_php/ams/is_installed
|
||||
web/docs/ams/html
|
||||
web/public_php/ams/templates_c
|
||||
ryzom/tools/server/ryzom_ams/drupal
|
||||
ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload
|
||||
ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs
|
||||
ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron
|
||||
ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img
|
||||
ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins
|
||||
ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty
|
||||
ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations
|
||||
ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php
|
||||
ryzom/tools/server/ryzom_ams/old
|
||||
|
||||
|
||||
|
||||
# Tools and external directories
|
||||
external
|
||||
external_stlport
|
||||
nel_tools*
|
||||
ryzom_tools*
|
||||
|
||||
#personal projects
|
||||
personal/
|
||||
|
||||
# Dumps
|
||||
*.dmp
|
||||
|
||||
nel/tools/build_gamedata/processes/ai_wmap/ai_build_wmap.cfg
|
||||
nel/tools/build_gamedata/processes/sheets/sheets_packer.cfg
|
||||
nel/tools/build_gamedata/processes/rbank/build_rbank.cfg
|
||||
nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg
|
||||
web/public_php/config.php
|
||||
web/public_php/is_installed
|
||||
web/public_php/ams/files
|
||||
web/public_php/db_version_lib
|
||||
web/public_php/db_version_shard
|
||||
web/public_php/db_version_tool
|
||||
web/public_php/db_version_web
|
||||
web/public_php/role_service
|
||||
web/public_php/role_support
|
||||
web/public_php/role_domain
|
||||
web/public_php/db_version_ring
|
||||
web/public_php/config_user.php
|
||||
nel/tools/build_gamedata/processes/pz/build_world_packed_col.cfg
|
||||
nel/tools/build_gamedata/processes/cartographer/island_screenshots.cfg
|
@ -1,48 +0,0 @@
|
||||
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 -H. -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,532 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Ryzom Core
|
||||
# Authors: Nevrax and the Ryzom Core Community
|
||||
# Version: 0.12.0
|
||||
#
|
||||
# Notes:
|
||||
# * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path
|
||||
# * Changing specific install location variables:
|
||||
# * NL_ETC_PREFIX (default: $CMAKE_INSTALL_PREFIX/etc)
|
||||
# * NL_SHARE_PREFIX (default: $CMAKE_INSTALL_PREFIX/share)
|
||||
# * NL_BIN_PREFIX (default: $CMAKE_INSTALL_PREFIX/bin)
|
||||
# * NL_SBIN_PREFIX (default: $CMAKE_INSTALL_PREFIX/sbin)
|
||||
# * NL_LIB_PREFIX (default: $CMAKE_INSTALL_PREFIX/lib)
|
||||
# * NL_DRIVER_PREFIX (default: $CMAKE_INSTALL_PREFIX/lib (windows) or $CMAKE_INSTALL_PREFIX/lib/nel)
|
||||
# * Enable building of documentation: add -DBUILD_DOCUMENTATION:BOOL=ON - new make target: DoxygenDoc
|
||||
# * Updating version: update header (above) but also update NL_VERSION below.
|
||||
# * To build binary archive, use the 'package' target.
|
||||
# To build source archive, use the 'package_source' target.
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Load some macros.
|
||||
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set CMake 2.6 Policies.
|
||||
IF(COMMAND cmake_policy)
|
||||
# Works around warnings libraries linked against that don't
|
||||
# have absolute paths (e.g. -lpthread)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
|
||||
# allow to link to qtmain automatically under Windows
|
||||
IF(POLICY CMP0020)
|
||||
CMAKE_POLICY(SET CMP0020 NEW)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Downloads and install Hunger into HUNTER_ROOT directory.
|
||||
OPTION(HUNTER_ENABLED "Enable Hunter package manager" OFF)
|
||||
IF(HUNTER_ENABLED)
|
||||
INCLUDE("CMakeModules/HunterGate.cmake")
|
||||
HunterGate(
|
||||
URL "https://github.com/cpp-pm/hunter/archive/v0.23.321.tar.gz"
|
||||
SHA1 "5e53cbb0429037ea8e2592bfd92704b8ff3ab492"
|
||||
FILEPATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules/HunterConfig.cmake"
|
||||
)
|
||||
|
||||
# default options for hunterized build
|
||||
SET(WITH_STATIC ON CACHE BOOL "static" FORCE)
|
||||
SET(WITH_STATIC_DRIVERS ON CACHE BOOL "static drivers" FORCE)
|
||||
SET(WITH_STATIC_CURL ON CACHE BOOL "static curl" FORCE)
|
||||
SET(WITH_STATIC_LIBXML2 ON CACHE BOOL "static libxml2" FORCE)
|
||||
SET(WITH_STATIC_EXTERNAL ON CACHE BOOL "static external" FORCE)
|
||||
SET(WITH_EXTERNAL OFF CACHE BOOL "external libs" FORCE)
|
||||
ENDIF()
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
INCLUDE(nel)
|
||||
INCLUDE(ConfigureChecks)
|
||||
INCLUDE(CheckDepends)
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
|
||||
|
||||
MESSAGE("EXTERNAL ${WITH_EXTERNAL}")
|
||||
|
||||
# Force out of source builds.
|
||||
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 "2019")
|
||||
ENDIF()
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
PROJECT(RyzomCore CXX C)
|
||||
SET(NL_VERSION_MAJOR 1)
|
||||
SET(NL_VERSION_MINOR 1)
|
||||
SET(NL_VERSION_PATCH 0 CACHE STRING "Patch version")
|
||||
SET(YEAR "2001-${CURRENT_YEAR}")
|
||||
SET(AUTHOR "Winch Gate and The Ryzom Core Community")
|
||||
|
||||
SET(RYZOM_VERSION_MAJOR 3)
|
||||
SET(RYZOM_VERSION_MINOR 6)
|
||||
SET(RYZOM_VERSION_PATCH 0)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Redirect output files
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
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()
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
IF(WITH_MFC)
|
||||
FIND_PACKAGE(MFC QUIET)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set default config options
|
||||
#
|
||||
NL_SETUP_DEFAULT_OPTIONS()
|
||||
NL_SETUP_NEL_DEFAULT_OPTIONS()
|
||||
NL_SETUP_NELNS_DEFAULT_OPTIONS()
|
||||
NL_SETUP_RYZOM_DEFAULT_OPTIONS()
|
||||
NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS()
|
||||
|
||||
NL_SETUP_BUILD()
|
||||
NL_SETUP_BUILD_FLAGS()
|
||||
|
||||
NL_SETUP_PREFIX_PATHS()
|
||||
RYZOM_SETUP_PREFIX_PATHS()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Default values for URL's
|
||||
SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Create Account URL")
|
||||
SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Edit Account URL")
|
||||
SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Forget Password URL")
|
||||
SET(RYZOM_CLIENT_PATCH_URL "https://cdn.ryzom.dev/open/patch/" CACHE STRING "Ryzom Client Patch URL")
|
||||
SET(RYZOM_CLIENT_APP_NAME "default")
|
||||
|
||||
SET(RYZOM_WEBIG_MAIN_URL "https://open.ryzom.dev/" CACHE STRING "Ryzom Client WebIG Main URL")
|
||||
SET(RYZOM_WEBIG_TRUSTED_DOMAIN "open.ryzom.dev" CACHE STRING "Ryzom Client WebIG Trusted Domain")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# urls when compiling ryzom live client
|
||||
IF(WITH_RYZOM_LIVE)
|
||||
MESSAGE("Using RYZOM_LIVE urls")
|
||||
SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://me.ryzom.com")
|
||||
SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://me.ryzom.com")
|
||||
SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://me.ryzom.com/?forget_password=1")
|
||||
SET(RYZOM_CLIENT_PATCH_URL "http://dl.ryzom.com/patch_live")
|
||||
SET(RYZOM_CLIENT_APP_NAME "ryzom_live")
|
||||
|
||||
SET(RYZOM_WEBIG_MAIN_URL "https://app.ryzom.com/")
|
||||
SET(RYZOM_WEBIG_TRUSTED_DOMAIN "app.ryzom.com")
|
||||
ENDIF()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#Platform specifics
|
||||
|
||||
SETUP_EXTERNAL()
|
||||
|
||||
IF(WIN32)
|
||||
SET(WINSOCK2_LIB ws2_32.lib)
|
||||
|
||||
IF(WITH_MFC)
|
||||
FIND_PACKAGE(CustomMFC REQUIRED)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(HUNTER_ENABLED)
|
||||
## TODO: hack for freetype hunter package
|
||||
SET(ON 1)
|
||||
##
|
||||
HUNTER_ADD_PACKAGE(ZLIB)
|
||||
|
||||
FIND_PACKAGE(ZLIB CONFIG REQUIRED)
|
||||
SET(ZLIB_LIBRARY ZLIB::zlib)
|
||||
|
||||
HUNTER_ADD_PACKAGE(libxml2)
|
||||
FIND_PACKAGE(libxml2 CONFIG REQUIRED)
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} libxml2::libxml2)
|
||||
|
||||
HUNTER_ADD_PACKAGE(OpenSSL)
|
||||
FIND_PACKAGE(OpenSSL REQUIRED)
|
||||
# TODO: is OpenSSL::Crypto only needed for WIN32?
|
||||
SET(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||||
|
||||
# for precompiled headers, not needed if using TARGET_PRECOMPILE_HEADERS() from cmake 3.16+
|
||||
SET(ZLIB_INCLUDE_DIR ZLIB_ROOT/include)
|
||||
SET(LIBXML2_INCLUDE_DIR ${LIBXML2_ROOT}/include/libxml2)
|
||||
ELSE()
|
||||
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()
|
||||
ENDIF() #hunter
|
||||
|
||||
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()
|
||||
|
||||
IF(WITH_LIBXML2_ICONV)
|
||||
FIND_PACKAGE(Iconv REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_STATIC)
|
||||
# libxml2 could need winsock2 library
|
||||
IF(WINSOCK2_LIB)
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
# under Linux and OS X, recent libxml2 versions are linked against liblzma
|
||||
FIND_PACKAGE(LibLZMA)
|
||||
IF(LIBLZMA_LIBRARIES)
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
|
||||
ENDIF()
|
||||
|
||||
# under Linux and OS X, recent libxml2 versions are linked against libicu
|
||||
# FIND_PACKAGE(Icu)
|
||||
FIND_LIBRARY(ICU_LIBRARY icuuc)
|
||||
IF(ICU_LIBRARY)
|
||||
FIND_LIBRARY(ICU_DATA_LIBRARY icudata)
|
||||
IF(ICU_LIBRARY)
|
||||
MESSAGE(STATUS "ICU UC was found: ${ICU_LIBRARY}")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "ICU UC was NOT found")
|
||||
ENDIF()
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_DATA_LIBRARY} ${ICU_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
|
||||
|
||||
IF(FINAL_VERSION)
|
||||
ADD_DEFINITIONS(-DFINAL_VERSION=1)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_SSE2)
|
||||
ADD_DEFINITIONS(-DNL_HAS_SSE2)
|
||||
IF(WITH_SSE3)
|
||||
ADD_DEFINITIONS(-DNL_HAS_SSE3)
|
||||
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)
|
||||
|
||||
#TODO: hunter qt package
|
||||
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()
|
||||
|
||||
#TODO: hunter assimp package
|
||||
IF(WITH_ASSIMP)
|
||||
FIND_PACKAGE(assimp REQUIRED)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_NEL)
|
||||
IF(WITH_NEL_TESTS)
|
||||
FIND_PACKAGE(CppTest)
|
||||
ENDIF()
|
||||
|
||||
IF(HUNTER_ENABLED)
|
||||
IF(WITH_GUI)
|
||||
HUNTER_ADD_PACKAGE(luabind)
|
||||
FIND_PACKAGE(Luabind REQUIRED)
|
||||
ENDIF()
|
||||
|
||||
HUNTER_ADD_PACKAGE(CURL)
|
||||
FIND_PACKAGE(CURL CONFIG REQUIRED)
|
||||
# TODO: for nelgui
|
||||
SET(CURL_LIBRARIES CURL::libcurl libxml2::libxml2)
|
||||
ELSE()
|
||||
IF(WITH_GUI)
|
||||
FIND_PACKAGE(Luabind REQUIRED)
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(CURL REQUIRED)
|
||||
|
||||
IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
|
||||
SET(CURL_STATIC ON)
|
||||
ELSE()
|
||||
SET(CURL_STATIC OFF)
|
||||
ENDIF()
|
||||
|
||||
IF(CURL_STATIC)
|
||||
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
|
||||
|
||||
LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
|
||||
LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
|
||||
|
||||
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 can depend on libidn, libidn2, libintl, libpsl and libiconv too
|
||||
IF(APPLE)
|
||||
FIND_LIBRARY(INTL_LIBRARY intl)
|
||||
IF(INTL_LIBRARY)
|
||||
LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
FIND_LIBRARY(IDN2_LIBRARY idn2)
|
||||
IF(IDN2_LIBRARY)
|
||||
LIST(APPEND CURL_LIBRARIES ${IDN2_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
FIND_LIBRARY(PSL_LIBRARY psl)
|
||||
IF(PSL_LIBRARY)
|
||||
LIST(APPEND CURL_LIBRARIES ${PSL_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
FIND_LIBRARY(UNISTRING_LIBRARY unistring)
|
||||
IF(UNISTRING_LIBRARY)
|
||||
LIST(APPEND CURL_LIBRARIES ${UNISTRING_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND CURL_LIBRARIES ${SECURITY_FRAMEWORK})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF() #hunter
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include)
|
||||
ADD_SUBDIRECTORY(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()
|
||||
|
||||
IF(WITH_NELNS)
|
||||
ADD_SUBDIRECTORY(nelns)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_SNOWBALLS)
|
||||
ADD_SUBDIRECTORY(snowballs2)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_TOOLS)
|
||||
ADD_SUBDIRECTORY(tool)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_STUDIO)
|
||||
ADD_SUBDIRECTORY(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()
|
||||
SET(HAVE_DOT NO)
|
||||
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()
|
||||
|
||||
IF(WITH_NEL_TESTS)
|
||||
ENABLE_TESTING()
|
||||
ADD_TEST(nel_unit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nel_unit_test --html)
|
||||
IF(BUILD_DASHBOARD)
|
||||
INCLUDE(Dart)
|
||||
SET(SVNCOMMAND svn)
|
||||
SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel)
|
||||
SET(GENERATELOGS svn2cl)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# packaging information
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework")
|
||||
SET(CPACK_PACKAGE_VENDOR "Ryzom Core")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
|
||||
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
|
||||
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
|
||||
SET(CPACK_PACKAGE_EXECUTABLES "ryzomcore${NL_VERSION}" "ryzomcore")
|
||||
SET(CPACK_SET_DESTDIR TRUE)
|
||||
|
||||
# NSIS Specific Packing Setup
|
||||
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "RyzomCore")
|
||||
SET(CPACK_NSIS_MODIFY_PATH "ON")
|
||||
SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
|
||||
SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
|
||||
SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
|
||||
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} RyzomCore")
|
||||
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
|
||||
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
|
||||
SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
|
||||
|
||||
## Source Packages
|
||||
SET(CPACK_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
|
||||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
|
||||
IF(WIN32)
|
||||
#SET(CPACK_GENERATOR "NSIS")
|
||||
SET(CPACK_GENERATOR "NSIS;ZIP")
|
||||
SET(CPACK_SOURCE_GENERATOR "ZIP")
|
||||
ELSE()
|
||||
SET(CPACK_GENERATOR "TGZ")
|
||||
SET(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
ENDIF()
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
"~$"
|
||||
"\\\\.cvsignore$"
|
||||
"^${CMAKE_SOURCE_DIR}.*/CVS/"
|
||||
"^${CMAKE_SOURCE_DIR}.*/\\\\.svn/"
|
||||
"^${CMAKE_SOURCE_DIR}/debian/"
|
||||
"^${CMAKE_SOURCE_DIR}/old/")
|
||||
IF(WIN32)
|
||||
IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
|
||||
IF(WITH_QT)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
INSTALL(FILES
|
||||
"${QT_LIBRARY_DIR}/../bin/QtGuid4.dll"
|
||||
"${QT_LIBRARY_DIR}/../bin/QtXmld4.dll"
|
||||
"${QT_LIBRARY_DIR}/../bin/QtCored4.dll"
|
||||
DESTINATION ${NL_BIN_PREFIX})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(WITH_QT)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
INSTALL(FILES
|
||||
"${QT_LIBRARY_DIR}/../bin/QtGui4.dll"
|
||||
"${QT_LIBRARY_DIR}/../bin/QtXml4.dll"
|
||||
"${QT_LIBRARY_DIR}/../bin/QtCore4.dll"
|
||||
DESTINATION ${NL_BIN_PREFIX})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Install CEGUI and its dependencies.
|
||||
IF(WITH_NEL_CEGUI)
|
||||
INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIBase.dll" DESTINATION ${NL_BIN_PREFIX})
|
||||
INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIDevilImageCodec.dll" DESTINATION ${NL_BIN_PREFIX})
|
||||
INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIExpatParser.dll" DESTINATION ${NL_BIN_PREFIX})
|
||||
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()
|
||||
|
||||
# Only the tools require MFC.
|
||||
IF(WITH_TOOLS)
|
||||
SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
|
||||
ENDIF()
|
||||
#INCLUDE(InstallRequiredSystemLibraries)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(CPack)
|
||||
|
||||
INCLUDE(CMakePackaging.txt)
|
||||
|
||||
## Debian Packages
|
||||
#INCLUDE(UseDebian)
|
||||
#IF(DEBIAN_FOUND)
|
||||
# ADD_DEBIAN_TARGETS(nel)
|
||||
#ENDIF()
|
@ -1,218 +0,0 @@
|
||||
IF(DEFINED CMAKE_CROSSCOMPILING)
|
||||
# subsequent toolchain loading is not really needed
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
# Standard settings
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Linux version
|
||||
SET(UNIX ON)
|
||||
SET(LINUX ON)
|
||||
SET(ANDROID ON)
|
||||
|
||||
IF(NOT NDK_ROOT)
|
||||
SET(NDK_ROOT $ENV{NDK_ROOT})
|
||||
|
||||
IF(CMAKE_HOST_WIN32)
|
||||
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT TARGET_CPU)
|
||||
SET(TARGET_CPU "armv7")
|
||||
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-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-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-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-linux-android")
|
||||
SET(MINIMUM_NDK_TARGET 9)
|
||||
ELSEIF(TARGET_CPU STREQUAL "mips64")
|
||||
SET(LIBRARY_ARCHITECTURE "mips64")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "mips64")
|
||||
SET(TOOLCHAIN_ARCH "mips64")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "mips64el-linux-android")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "mips64el-linux-android")
|
||||
SET(MINIMUM_NDK_TARGET 21)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to process TARGET_CPU ${TARGET_CPU}")
|
||||
ENDIF()
|
||||
|
||||
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
|
||||
SET(ANDROID_COMPILER "clang")
|
||||
SET(ANDROID_COMPILER "clang")
|
||||
SET(CLANG ON)
|
||||
|
||||
IF(NOT NDK_TARGET)
|
||||
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
|
||||
ELSE()
|
||||
IF(NDK_TARGET LESS MINIMUM_NDK_TARGET)
|
||||
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_HOST_WIN32)
|
||||
SET(TOOLCHAIN_HOST "windows-x86_64")
|
||||
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
|
||||
ELSEIF(CMAKE_HOST_APPLE)
|
||||
SET(TOOLCHAIN_HOST "apple")
|
||||
SET(TOOLCHAIN_BIN_SUFFIX "")
|
||||
ELSEIF(CMAKE_HOST_UNIX)
|
||||
SET(TOOLCHAIN_HOST "linux-x86_64")
|
||||
SET(TOOLCHAIN_BIN_SUFFIX "")
|
||||
ENDIF()
|
||||
|
||||
# clang
|
||||
SET(CLANG_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${CLANG_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}")
|
||||
|
||||
IF(EXISTS ${CLANG_TOOLCHAIN_ROOT})
|
||||
MESSAGE(STATUS "Found LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "No LLVM toolchain found in default search path ${CLANG_TOOLCHAIN_ROOT}")
|
||||
ENDIF()
|
||||
|
||||
# gcc
|
||||
SET(GCC_TOOLCHAIN_VERSIONS)
|
||||
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-*")
|
||||
IF(_TOOLCHAIN_VERSIONS)
|
||||
LIST(SORT _TOOLCHAIN_VERSIONS)
|
||||
LIST(REVERSE _TOOLCHAIN_VERSIONS)
|
||||
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
|
||||
STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
|
||||
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
|
||||
LIST(APPEND GCC_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT GCC_TOOLCHAIN_VERSIONS)
|
||||
MESSAGE(FATAL_ERROR "No GCC version found in default search path ${NDK_ROOT}/toolchains")
|
||||
ENDIF()
|
||||
|
||||
IF(GCC_TOOLCHAIN_VERSIONS)
|
||||
LIST(FIND GCC_TOOLCHAIN_VERSIONS "${GCC_TOOLCHAIN_VERSION}" _INDEX)
|
||||
IF(_INDEX EQUAL -1)
|
||||
LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION)
|
||||
ENDIF()
|
||||
|
||||
SET(GCC_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-${GCC_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
|
||||
|
||||
IF(NOT EXISTS "${GCC_TOOLCHAIN_ROOT}")
|
||||
FILE(GLOB _TOOLCHAIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}*")
|
||||
IF(_TOOLCHAIN_PREFIXES)
|
||||
LIST(GET _TOOLCHAIN_PREFIXES 0 GCC_TOOLCHAIN_ROOT)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
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 "Target Android NDK ${NDK_TARGET} found in ${PLATFORM_ROOT}")
|
||||
|
||||
# include dirs
|
||||
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
|
||||
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
|
||||
|
||||
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
||||
# NDK version >= 8b
|
||||
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
|
||||
ENDIF()
|
||||
|
||||
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
|
||||
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
|
||||
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
|
||||
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
|
||||
|
||||
MESSAGE(STATUS "STL include dir: ${STL_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS "STL library dir: ${STL_LIBRARY_DIR}")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${CLANG_TOOLCHAIN_ROOT} ${GCC_TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY)
|
||||
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY)
|
||||
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
|
||||
ENDMACRO()
|
||||
|
||||
SET(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang)
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++)
|
||||
|
||||
SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
|
||||
SET(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX})
|
||||
SET(CMAKE_C_COMPILER_FORCED TRUE)
|
||||
|
||||
SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
SET(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX})
|
||||
SET(CMAKE_CXX_COMPILER_FORCED TRUE)
|
||||
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as)
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar)
|
||||
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++)
|
||||
|
||||
IF(NOT EXISTS "${CMAKE_ASM_COMPILER}")
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT EXISTS "${CMAKE_AR}")
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
|
||||
ENDIF()
|
||||
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJCOPY objcopy)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJDUMP objdump)
|
||||
SET_TOOLCHAIN_BINARY_GCC(CMAKE_RANLIB ranlib)
|
@ -1,67 +0,0 @@
|
||||
MACRO(NL_CONFIGURE_CHECKS)
|
||||
INCLUDE(GetRevision)
|
||||
|
||||
# 3D drivers
|
||||
IF(WITH_DRIVER_OPENGL)
|
||||
SET(NL_OPENGL_AVAILABLE 1)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_DRIVER_OPENGLES)
|
||||
SET(NL_OPENGLES_AVAILABLE 1)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_DRIVER_DIRECT3D)
|
||||
SET(NL_DIRECT3D_AVAILABLE 1)
|
||||
ENDIF()
|
||||
|
||||
# sound drivers
|
||||
IF(WITH_DRIVER_FMOD)
|
||||
SET(NL_FMOD_AVAILABLE 1)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_DRIVER_OPENAL)
|
||||
SET(NL_OPENAL_AVAILABLE 1)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_DRIVER_DSOUND)
|
||||
SET(NL_DSOUND_AVAILABLE 1)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_DRIVER_XAUDIO2)
|
||||
SET(NL_XAUDIO2_AVAILABLE 1)
|
||||
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_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
||||
ENDMACRO()
|
@ -1,139 +0,0 @@
|
||||
# - Find DirectInput
|
||||
# Find the DirectSound includes and libraries
|
||||
#
|
||||
# MAXSDK_DIR - 3DSMAX SDK root directory
|
||||
# MAXSDK_INCLUDE_DIR - where to find baseinterface.h
|
||||
# MAXSDK_LIBRARIES - List of libraries when using 3DSMAX.
|
||||
# MAXSDK_FOUND - True if MAX SDK found.
|
||||
|
||||
if(MAXSDK_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(MAXSDK_FIND_QUIETLY TRUE)
|
||||
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
|
||||
max.h
|
||||
HINTS
|
||||
${MAXSDK_DIR}/include
|
||||
)
|
||||
|
||||
FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
|
||||
HINTS
|
||||
${MAXSDK_DIR}/include/CS
|
||||
)
|
||||
|
||||
IF(TARGET_X64)
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib ${MAXSDK_DIR}/lib/x64/Release)
|
||||
ELSE()
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
|
||||
ENDIF()
|
||||
|
||||
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
FIND_LIBRARY(${MYLIBRARY}
|
||||
NAMES ${MYLIBRARYNAME}
|
||||
HINTS
|
||||
${MAXSDK_LIBRARY_DIRS}
|
||||
)
|
||||
ENDMACRO()
|
||||
|
||||
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GFX_LIBRARY gfx)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MESH_LIBRARY mesh)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MAXUTIL_LIBRARY maxutil)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MAXSCRIPT_LIBRARY maxscrpt)
|
||||
FIND_3DS_LIBRARY(MAXSDK_PARAMBLK2_LIBRARY paramblk2)
|
||||
FIND_3DS_LIBRARY(MAXSDK_BMM_LIBRARY bmm)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set MAXSDK_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MAXSDK DEFAULT_MSG
|
||||
MAXSDK_INCLUDE_DIR MAXSDK_CORE_LIBRARY)
|
||||
|
||||
if(MAXSDK_FOUND)
|
||||
SET(MAXSDK_LIBRARIES
|
||||
${MAXSDK_CORE_LIBRARY}
|
||||
${MAXSDK_GEOM_LIBRARY}
|
||||
${MAXSDK_GFX_LIBRARY}
|
||||
${MAXSDK_MESH_LIBRARY}
|
||||
${MAXSDK_MAXUTIL_LIBRARY}
|
||||
${MAXSDK_MAXSCRIPT_LIBRARY}
|
||||
${MAXSDK_PARAMBLK2_LIBRARY}
|
||||
${MAXSDK_BMM_LIBRARY})
|
||||
|
||||
# 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()
|
||||
|
||||
mark_as_advanced(MAXSDK_INCLUDE_DIR MAXSDK_LIBRARY)
|
@ -1,173 +0,0 @@
|
||||
# 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,9 +0,0 @@
|
||||
INCLUDE(FindHelpers)
|
||||
|
||||
IF(TARGET_X64)
|
||||
SET(FMOD_BASE fmod64)
|
||||
ELSE()
|
||||
SET(FMOD_BASE fmodvc)
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE_HELPER(FMOD fmod.h RELEASE ${FMOD_BASE} DEBUG ${FMOD_BASE}d SUFFIXES fmod3)
|
@ -1,217 +0,0 @@
|
||||
# - 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 )
|
@ -1,51 +0,0 @@
|
||||
# - 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 )
|
@ -1,959 +0,0 @@
|
||||
MACRO(CONVERT_NUMBER_VERSION _VERSION_NUMBER _BASE _OUT)
|
||||
SET(${_OUT})
|
||||
SET(_NUMBER ${_VERSION_NUMBER})
|
||||
WHILE(_NUMBER GREATER 0)
|
||||
MATH(EXPR _TEMP "${_NUMBER} % ${_BASE}")
|
||||
LIST(APPEND ${_OUT} ${_TEMP})
|
||||
MATH(EXPR _NUMBER "${_NUMBER} / ${_BASE}")
|
||||
ENDWHILE()
|
||||
ENDMACRO(CONVERT_NUMBER_VERSION)
|
||||
|
||||
FUNCTION(JOIN VALUES GLUE OUTPUT)
|
||||
STRING(REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}")
|
||||
STRING(REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping
|
||||
SET(${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
|
||||
ENDFUNCTION()
|
||||
|
||||
MACRO(PARSE_VERSION_OTHER FILENAME)
|
||||
IF(EXISTS ${FILENAME})
|
||||
SET(_FILTER_ARRAY ${ARGN})
|
||||
JOIN("${_FILTER_ARRAY}" "|" _FILTER_REGEX)
|
||||
FILE(STRINGS ${FILENAME} _FILE REGEX "(${_FILTER_REGEX})[: \t=\(\)\"]+([0-9.]+)")
|
||||
|
||||
IF(_FILE)
|
||||
FOREACH(_LINE ${_FILE})
|
||||
FOREACH(_VAR ${_FILTER_ARRAY})
|
||||
IF("${${_VAR}}" STREQUAL "")
|
||||
STRING(REGEX REPLACE "^.*${_VAR}[: \t=\(\)\"]+([0-9.]+).*$" "\\1" ${_VAR} "${_LINE}")
|
||||
IF(${_VAR} STREQUAL "${_LINE}")
|
||||
SET(${_VAR})
|
||||
ENDIF()
|
||||
IF(NOT ${_VAR} AND NOT STREQUAL "0")
|
||||
SET(${_VAR} 0)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# macro to define FIND_PACKAGE options with a different package name
|
||||
MACRO(FIX_PACKAGE_OPTIONS OLDNAME NEWNAME)
|
||||
# append other options if needed
|
||||
SET(_OPTIONS COMPONENTS REQUIRED QUIETLY)
|
||||
|
||||
# process each options
|
||||
FOREACH(_OPTION ${_OPTIONS})
|
||||
SET(OLD_OPTION ${OLDNAME}_FIND_${_OPTION})
|
||||
IF(DEFINED )
|
||||
SET(NEW_OPTION ${NEWNAME}_FIND_${_OPTION})
|
||||
SET(${NEW_OPTION} ${OLD_OPTION})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(FIND_PACKAGE_HELPER NAME INCLUDE)
|
||||
# Looks for a directory containing NAME.
|
||||
#
|
||||
# NAME is the name of the library, lowercase and uppercase can be mixed
|
||||
# It should be EXACTLY (same case) the same part as XXXX in FindXXXX.cmake
|
||||
#
|
||||
# INCLUDE is the file to check for includes
|
||||
#
|
||||
# Following parameters are optional variables and must be prefixed by:
|
||||
#
|
||||
# RELEASE is the list of libraries to check in release mode
|
||||
# DEBUG is the list of libraries to check in debug mode
|
||||
# SUFFIXES is the PATH_SUFFIXES to check for include file
|
||||
# QUIET don't display anything
|
||||
# VERBOSE display more details if not found
|
||||
# REQUIRED throw an error if not found
|
||||
# DIR is the base directory where to look for
|
||||
#
|
||||
# The first match will be used in the specified order and next matches will be ignored
|
||||
#
|
||||
# The following values are defined
|
||||
# NAME_INCLUDE_DIR - where to find NAME
|
||||
# NAME_LIBRARIES - link against these to use NAME
|
||||
# NAME_FOUND - True if NAME is available.
|
||||
|
||||
SET(_PARAMS ${ARGN})
|
||||
|
||||
SET(_RELEASE_LIBRARIES)
|
||||
SET(_DEBUG_LIBRARIES)
|
||||
SET(_SUFFIXES)
|
||||
SET(_BASE_DIRECTORIES)
|
||||
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_SUFFIXES OFF)
|
||||
SET(_IS_VERBOSE OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
|
||||
IF(_PARAMS)
|
||||
FOREACH(_PARAM ${_PARAMS})
|
||||
IF(_PARAM STREQUAL "RELEASE")
|
||||
SET(_IS_RELEASE ON)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_SUFFIXES OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
ELSEIF(_PARAM STREQUAL "DEBUG")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG ON)
|
||||
SET(_IS_SUFFIXES OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
ELSEIF(_PARAM STREQUAL "SUFFIXES")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
SET(_IS_SUFFIXES ON)
|
||||
ELSEIF(_PARAM STREQUAL "QUIET")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_SUFFIXES OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
SET(${NAME}_FIND_QUIETLY ON)
|
||||
ELSEIF(_PARAM STREQUAL "VERBOSE")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_SUFFIXES OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
SET(_IS_VERBOSE ON)
|
||||
ELSEIF(_PARAM STREQUAL "REQUIRED")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_SUFFIXES OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
SET(${NAME}_FIND_REQUIRED ON)
|
||||
ELSEIF(_PARAM STREQUAL "DIR")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_SUFFIXES OFF)
|
||||
SET(_IS_DIR ON)
|
||||
ELSE()
|
||||
IF(_IS_RELEASE)
|
||||
LIST(APPEND _RELEASE_LIBRARIES ${_PARAM})
|
||||
ELSEIF(_IS_DEBUG)
|
||||
LIST(APPEND _DEBUG_LIBRARIES ${_PARAM})
|
||||
ELSEIF(_IS_SUFFIXES)
|
||||
LIST(APPEND _SUFFIXES ${_PARAM})
|
||||
ELSEIF(_IS_DIR)
|
||||
LIST(APPEND _BASE_DIRECTORIES ${_PARAM})
|
||||
ELSE()
|
||||
MESSAGE(STATUS "parameter ${_PARAM} with no prefix")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
# Fixes names if invalid characters are found
|
||||
IF("${NAME}" MATCHES "^[a-zA-Z0-9]+$")
|
||||
SET(_NAME_FIXED ${NAME})
|
||||
ELSE()
|
||||
# if invalid characters are detected, replace them by valid ones
|
||||
STRING(REPLACE "+" "p" _NAME_FIXED ${NAME})
|
||||
ENDIF()
|
||||
|
||||
# Create uppercase and lowercase versions of NAME
|
||||
STRING(TOUPPER ${NAME} _UPNAME)
|
||||
STRING(TOLOWER ${NAME} _LOWNAME)
|
||||
|
||||
STRING(TOUPPER ${_NAME_FIXED} _UPNAME_FIXED)
|
||||
STRING(TOLOWER ${_NAME_FIXED} _LOWNAME_FIXED)
|
||||
|
||||
SET(_SUFFIXES ${_SUFFIXES} ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME})
|
||||
|
||||
# Don't use pkg-config
|
||||
# IF(NOT WIN32 AND NOT IOS)
|
||||
# FIND_PACKAGE(PkgConfig QUIET)
|
||||
# SET(_MODULES ${_LOWNAME} ${_RELEASE_LIBRARIES})
|
||||
# LIST(REMOVE_DUPLICATES _MODULES)
|
||||
# IF(PKG_CONFIG_EXECUTABLE)
|
||||
# PKG_SEARCH_MODULE(PKG_${_NAME_FIXED} QUIET ${_MODULES})
|
||||
# ENDIF()
|
||||
# ENDIF()
|
||||
|
||||
SET(_INCLUDE_PATHS)
|
||||
SET(_LIBRARY_PATHS)
|
||||
|
||||
# Check for root directories passed to CMake with -DXXX_DIR=...
|
||||
IF(DEFINED ${_UPNAME_FIXED}_DIR)
|
||||
SET(_TMP ${${_UPNAME_FIXED}_DIR})
|
||||
GET_FILENAME_COMPONENT(_TMP ${_TMP} ABSOLUTE)
|
||||
LIST(APPEND _INCLUDE_PATHS ${_TMP}/include ${_TMP})
|
||||
LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX})
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(DEFINED ${_UPNAME}_DIR)
|
||||
SET(_TMP ${${_UPNAME}_DIR})
|
||||
LIST(APPEND _INCLUDE_PATHS ${_TMP}/include ${_TMP})
|
||||
LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX})
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(_BASE_DIRECTORIES)
|
||||
FOREACH(_DIR ${_BASE_DIRECTORIES})
|
||||
IF(_DIR)
|
||||
LIST(APPEND _INCLUDE_PATHS ${_DIR}/include ${_DIR})
|
||||
LIST(APPEND _LIBRARY_PATHS ${_DIR}/lib${LIB_SUFFIX})
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
MESSAGE(STATUS "Using ${_DIR} as root directory")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
# Append UNIX standard include paths
|
||||
SET(_UNIX_INCLUDE_PATHS)
|
||||
|
||||
# Append multiarch include paths
|
||||
IF(CMAKE_LIBRARY_ARCHITECTURE)
|
||||
LIST(APPEND _UNIX_INCLUDE_PATHS
|
||||
/usr/local/include/${CMAKE_LIBRARY_ARCHITECTURE}
|
||||
/usr/include/${CMAKE_LIBRARY_ARCHITECTURE})
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND _UNIX_INCLUDE_PATHS
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/sw/include
|
||||
/opt/local/include
|
||||
/opt/csw/include
|
||||
/opt/include)
|
||||
ENDIF()
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
MESSAGE(STATUS "Searching header ${INCLUDE} in: ${_INCLUDE_PATHS} with suffixes ${_SUFFIXES}")
|
||||
ENDIF()
|
||||
|
||||
# Search for include directory
|
||||
FIND_PATH(${_UPNAME_FIXED}_INCLUDE_DIR
|
||||
NAMES ${INCLUDE}
|
||||
HINTS
|
||||
${PKG_${_NAME_FIXED}_INCLUDE_DIRS}
|
||||
${_INCLUDE_PATHS}
|
||||
$ENV{${_UPNAME}_DIR}/include
|
||||
$ENV{${_UPNAME_FIXED}_DIR}/include
|
||||
$ENV{${_UPNAME}_DIR}
|
||||
$ENV{${_UPNAME_FIXED}_DIR}
|
||||
PATHS
|
||||
${_UNIX_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES
|
||||
${_SUFFIXES}
|
||||
DOC "Include path for ${NAME}"
|
||||
)
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
IF(${_UPNAME_FIXED}_INCLUDE_DIR)
|
||||
MESSAGE(STATUS "${INCLUDE} found in ${${_UPNAME_FIXED}_INCLUDE_DIR}")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "${INCLUDE} not found")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Append environment variables XXX_DIR
|
||||
LIST(APPEND _LIBRARY_PATHS
|
||||
$ENV{${_UPNAME}_DIR}/lib${LIB_SUFFIX}
|
||||
$ENV{${_UPNAME_FIXED}_DIR}/lib${LIB_SUFFIX})
|
||||
|
||||
IF(UNIX)
|
||||
SET(_UNIX_LIBRARY_PATHS)
|
||||
|
||||
# Append multiarch libraries paths
|
||||
IF(CMAKE_LIBRARY_ARCHITECTURE)
|
||||
LIST(APPEND _UNIX_LIBRARY_PATHS
|
||||
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
|
||||
/lib/${CMAKE_LIBRARY_ARCHITECTURE}
|
||||
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE})
|
||||
ENDIF()
|
||||
|
||||
# Append UNIX standard libraries paths
|
||||
LIST(APPEND _UNIX_LIBRARY_PATHS
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/lib
|
||||
/usr/local/X11R6/lib
|
||||
/usr/X11R6/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
/usr/freeware/lib${LIB_SUFFIX})
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND _RELEASE_LIBRARIES ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME} ${_NAME_FIXED})
|
||||
LIST(APPEND _DEBUG_LIBRARIES ${_LOWNAME}d ${_LOWNAME_FIXED}d ${NAME}d ${_NAME_FIXED}d)
|
||||
|
||||
# Under Windows, some libs may need the lib prefix
|
||||
IF(WIN32)
|
||||
SET(_LIBS ${_RELEASE_LIBRARIES})
|
||||
FOREACH(_LIB ${_LIBS})
|
||||
LIST(APPEND _RELEASE_LIBRARIES lib${_LIB})
|
||||
ENDFOREACH()
|
||||
|
||||
SET(_LIBS ${_DEBUG_LIBRARIES})
|
||||
FOREACH(_LIB ${_LIBS})
|
||||
LIST(APPEND _DEBUG_LIBRARIES lib${_LIB})
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
LIST(REMOVE_DUPLICATES _RELEASE_LIBRARIES)
|
||||
LIST(REMOVE_DUPLICATES _DEBUG_LIBRARIES)
|
||||
|
||||
# Search for release library
|
||||
FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_RELEASE
|
||||
NAMES
|
||||
${_RELEASE_LIBRARIES}
|
||||
HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${_LIBRARY_PATHS}
|
||||
${_UNIX_LIBRARY_PATHS}
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
)
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
IF(${_UPNAME_FIXED}_LIBRARY_RELEASE)
|
||||
MESSAGE(STATUS "${NAME} release library found: ${${_UPNAME_FIXED}_LIBRARY_RELEASE}")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "${NAME} release library not found in ${_LIBRARY_PATHS};${_UNIX_LIBRARY_PATHS}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Search for debug library
|
||||
FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_DEBUG
|
||||
NAMES
|
||||
${_DEBUG_LIBRARIES}
|
||||
HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${_LIBRARY_PATHS}
|
||||
${_UNIX_LIBRARY_PATHS}
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
)
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
IF(${_UPNAME_FIXED}_LIBRARY_DEBUG)
|
||||
MESSAGE(STATUS "${NAME} debug library found: ${${_UPNAME_FIXED}_LIBRARY_DEBUG}")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "${NAME} debug library not found")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(${_UPNAME_FIXED}_FOUND OFF)
|
||||
|
||||
IF(${_UPNAME_FIXED}_INCLUDE_DIR)
|
||||
# Set also _INCLUDE_DIRS
|
||||
SET(${_UPNAME_FIXED}_INCLUDE_DIRS ${${_UPNAME_FIXED}_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
|
||||
# Library has been found if at least only one library and include are found
|
||||
IF(${_UPNAME_FIXED}_LIBRARY_RELEASE AND ${_UPNAME_FIXED}_LIBRARY_DEBUG)
|
||||
# Release and debug libraries found
|
||||
SET(${_UPNAME_FIXED}_FOUND ON)
|
||||
SET(${_UPNAME_FIXED}_LIBRARIES optimized ${${_UPNAME_FIXED}_LIBRARY_RELEASE} debug ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
|
||||
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
|
||||
ELSEIF(${_UPNAME_FIXED}_LIBRARY_RELEASE)
|
||||
# Release library found
|
||||
SET(${_UPNAME_FIXED}_FOUND ON)
|
||||
SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
|
||||
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
|
||||
ELSEIF(${_UPNAME_FIXED}_LIBRARY_DEBUG)
|
||||
# Debug library found
|
||||
SET(${_UPNAME_FIXED}_FOUND ON)
|
||||
SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
|
||||
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
|
||||
ENDIF()
|
||||
|
||||
IF(${_UPNAME_FIXED}_FOUND)
|
||||
IF(NOT ${NAME}_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found ${NAME}: ${${_UPNAME_FIXED}_LIBRARIES}")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(${NAME}_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Error: Unable to find ${NAME}!")
|
||||
ENDIF()
|
||||
IF(NOT ${NAME}_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find ${NAME}!")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(${_UPNAME_FIXED}_LIBRARY_RELEASE ${_UPNAME_FIXED}_LIBRARY_DEBUG)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(MESSAGE_VERSION_PACKAGE_HELPER NAME VERSION)
|
||||
MESSAGE(STATUS "Found ${NAME} ${VERSION}: ${ARGN}")
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(FIND_LIBRARY_HELPER NAME)
|
||||
# Looks for libraries.
|
||||
#
|
||||
# NAME is the name of the library, lowercase and uppercase can be mixed
|
||||
#
|
||||
# Following parameters are optional variables and must be prefixed by:
|
||||
#
|
||||
# RELEASE is the list of libraries to check in release mode
|
||||
# DEBUG is the list of libraries to check in debug mode
|
||||
# VERBOSE display more details if not found
|
||||
# REQUIRED throw an error if not found
|
||||
# DIR is the base directory where to look for
|
||||
#
|
||||
# The first match will be used in the specified order and next matches will be ignored
|
||||
#
|
||||
# The following values are defined
|
||||
# NAME_LIBRARIES - link against these to use NAME
|
||||
|
||||
SET(_PARAMS ${ARGN})
|
||||
|
||||
SET(_RELEASE_LIBRARIES)
|
||||
SET(_DEBUG_LIBRARIES)
|
||||
SET(_BASE_DIRECTORIES)
|
||||
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_VERBOSE OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
|
||||
IF(_PARAMS)
|
||||
FOREACH(_PARAM ${_PARAMS})
|
||||
IF(_PARAM STREQUAL "RELEASE")
|
||||
SET(_IS_RELEASE ON)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
ELSEIF(_PARAM STREQUAL "DEBUG")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG ON)
|
||||
SET(_IS_DIR OFF)
|
||||
ELSEIF(_PARAM STREQUAL "VERBOSE")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
SET(_IS_VERBOSE ON)
|
||||
ELSEIF(_PARAM STREQUAL "REQUIRED")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_DIR OFF)
|
||||
SET(${NAME}_FIND_REQUIRED ON)
|
||||
ELSEIF(_PARAM STREQUAL "DIR")
|
||||
SET(_IS_RELEASE OFF)
|
||||
SET(_IS_DEBUG OFF)
|
||||
SET(_IS_DIR ON)
|
||||
ELSE()
|
||||
IF(_IS_RELEASE)
|
||||
LIST(APPEND _RELEASE_LIBRARIES ${_PARAM})
|
||||
ELSEIF(_IS_DEBUG)
|
||||
LIST(APPEND _DEBUG_LIBRARIES ${_PARAM})
|
||||
ELSEIF(_IS_DIR)
|
||||
LIST(APPEND _BASE_DIRECTORIES ${_PARAM})
|
||||
ELSE()
|
||||
MESSAGE(STATUS "parameter ${_PARAM} with no prefix")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
# Fixes names if invalid characters are found
|
||||
IF("${NAME}" MATCHES "^[a-zA-Z0-9]+$")
|
||||
SET(_NAME_FIXED ${NAME})
|
||||
ELSE()
|
||||
# if invalid characters are detected, replace them by valid ones
|
||||
STRING(REPLACE "+" "p" _NAME_FIXED ${NAME})
|
||||
ENDIF()
|
||||
|
||||
# Create uppercase and lowercase versions of NAME
|
||||
STRING(TOUPPER ${NAME} _UPNAME)
|
||||
STRING(TOLOWER ${NAME} _LOWNAME)
|
||||
|
||||
STRING(TOUPPER ${_NAME_FIXED} _UPNAME_FIXED)
|
||||
STRING(TOLOWER ${_NAME_FIXED} _LOWNAME_FIXED)
|
||||
|
||||
SET(_LIBRARY_PATHS)
|
||||
|
||||
# Check for root directories passed to CMake with -DXXX_DIR=...
|
||||
IF(DEFINED ${_UPNAME_FIXED}_DIR)
|
||||
SET(_TMP ${${_UPNAME_FIXED}_DIR})
|
||||
GET_FILENAME_COMPONENT(_TMP ${_TMP} ABSOLUTE)
|
||||
LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX})
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(DEFINED ${_UPNAME}_DIR)
|
||||
SET(_TMP ${${_UPNAME}_DIR})
|
||||
LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX})
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(_BASE_DIRECTORIES)
|
||||
FOREACH(_DIR ${_BASE_DIRECTORIES})
|
||||
IF(_DIR)
|
||||
LIST(APPEND _LIBRARY_PATHS ${_DIR}/lib${LIB_SUFFIX})
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
MESSAGE(STATUS "Using ${_DIR} as root directory")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
# Append environment variables XXX_DIR
|
||||
LIST(APPEND _LIBRARY_PATHS
|
||||
$ENV{${_UPNAME}_DIR}/lib${LIB_SUFFIX}
|
||||
$ENV{${_UPNAME_FIXED}_DIR}/lib${LIB_SUFFIX})
|
||||
|
||||
IF(UNIX)
|
||||
SET(_UNIX_LIBRARY_PATHS)
|
||||
|
||||
# Append multiarch libraries paths
|
||||
IF(CMAKE_LIBRARY_ARCHITECTURE)
|
||||
LIST(APPEND _UNIX_LIBRARY_PATHS
|
||||
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
|
||||
/lib/${CMAKE_LIBRARY_ARCHITECTURE}
|
||||
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE})
|
||||
ENDIF()
|
||||
|
||||
# Append UNIX standard libraries paths
|
||||
LIST(APPEND _UNIX_LIBRARY_PATHS
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/lib
|
||||
/usr/local/X11R6/lib
|
||||
/usr/X11R6/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
/usr/freeware/lib${LIB_SUFFIX})
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND _RELEASE_LIBRARIES ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME} ${_NAME_FIXED})
|
||||
LIST(APPEND _DEBUG_LIBRARIES ${_LOWNAME}d ${_LOWNAME_FIXED}d ${NAME}d ${_NAME_FIXED}d)
|
||||
|
||||
# Under Windows, some libs may need the lib prefix
|
||||
IF(WIN32)
|
||||
SET(_LIBS ${_RELEASE_LIBRARIES})
|
||||
FOREACH(_LIB ${_LIBS})
|
||||
LIST(APPEND _RELEASE_LIBRARIES lib${_LIB})
|
||||
ENDFOREACH()
|
||||
|
||||
SET(_LIBS ${_DEBUG_LIBRARIES})
|
||||
FOREACH(_LIB ${_LIBS})
|
||||
LIST(APPEND _DEBUG_LIBRARIES lib${_LIB})
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
LIST(REMOVE_DUPLICATES _RELEASE_LIBRARIES)
|
||||
LIST(REMOVE_DUPLICATES _DEBUG_LIBRARIES)
|
||||
|
||||
# Search for release library
|
||||
FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_RELEASE
|
||||
NAMES
|
||||
${_RELEASE_LIBRARIES}
|
||||
HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${_LIBRARY_PATHS}
|
||||
${_UNIX_LIBRARY_PATHS}
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
)
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
IF(${_UPNAME_FIXED}_LIBRARY_RELEASE)
|
||||
MESSAGE(STATUS "${NAME} release library found: ${${_UPNAME_FIXED}_LIBRARY_RELEASE}")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "${NAME} release library not found in ${_LIBRARY_PATHS};${_UNIX_LIBRARY_PATHS}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Search for debug library
|
||||
FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_DEBUG
|
||||
NAMES
|
||||
${_DEBUG_LIBRARIES}
|
||||
HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS}
|
||||
PATHS
|
||||
${_LIBRARY_PATHS}
|
||||
${_UNIX_LIBRARY_PATHS}
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
)
|
||||
|
||||
IF(_IS_VERBOSE)
|
||||
IF(${_UPNAME_FIXED}_LIBRARY_DEBUG)
|
||||
MESSAGE(STATUS "${NAME} debug library found: ${${_UPNAME_FIXED}_LIBRARY_DEBUG}")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "${NAME} debug library not found")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Library has been found if at least only one library and include are found
|
||||
IF(${_UPNAME_FIXED}_LIBRARY_RELEASE AND ${_UPNAME_FIXED}_LIBRARY_DEBUG)
|
||||
# Release and debug libraries found
|
||||
SET(${_UPNAME_FIXED}_LIBRARIES optimized ${${_UPNAME_FIXED}_LIBRARY_RELEASE} debug ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
|
||||
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
|
||||
ELSEIF(${_UPNAME_FIXED}_LIBRARY_RELEASE)
|
||||
# Release library found
|
||||
SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
|
||||
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE})
|
||||
ELSEIF(${_UPNAME_FIXED}_LIBRARY_DEBUG)
|
||||
# Debug library found
|
||||
SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
|
||||
SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_DEBUG})
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(${_UPNAME_FIXED}_LIBRARY_RELEASE ${_UPNAME_FIXED}_LIBRARY_DEBUG)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(FIND_LIBCURL)
|
||||
IF(NOT CURL_FOUND)
|
||||
FIND_PACKAGE(CURL REQUIRED)
|
||||
|
||||
IF(WIN32 OR CURL_LIBRARY MATCHES "\\.a" OR WITH_STATIC_CURL)
|
||||
SET(CURL_STATIC ON)
|
||||
ELSE()
|
||||
SET(CURL_STATIC OFF)
|
||||
ENDIF()
|
||||
|
||||
IF(CURL_STATIC)
|
||||
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
|
||||
|
||||
IF(UNIX)
|
||||
# CURL can depend on libidn
|
||||
FIND_LIBRARY(IDN_LIBRARY idn)
|
||||
IF(IDN_LIBRARY)
|
||||
LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
# CURL Macports version can depend on libidn, libintl and libiconv too
|
||||
IF(APPLE)
|
||||
FIND_LIBRARY(INTL_LIBRARY intl)
|
||||
IF(INTL_LIBRARY)
|
||||
LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
# Only used by libcurl under Linux
|
||||
FIND_PACKAGE(OpenSSL REQUIRED)
|
||||
|
||||
#IF(WIN32)
|
||||
# SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
|
||||
#ENDIF()
|
||||
|
||||
# Only Linux version of libcurl depends on OpenSSL
|
||||
LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
|
||||
LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(FIND_LIBXML2)
|
||||
IF(NOT LIBXML2_FOUND)
|
||||
FIND_PACKAGE(LibXml2 REQUIRED)
|
||||
|
||||
IF(WIN32 OR WITH_STATIC_LIBXML2)
|
||||
LIST(APPEND LIBXML2_DEFINITIONS -DLIBXML_STATIC)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_LIBXML2_ICONV)
|
||||
FIND_PACKAGE(Iconv REQUIRED)
|
||||
# LIST(APPEND CURL_INCLUDE_DIRS ${ICONV_INCLUDE_DIR})
|
||||
LIST(APPEND LIBXML2_LIBRARIES ${ICONV_LIBRARIES})
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_STATIC)
|
||||
# libxml2 could need winsock2 library
|
||||
IF(WIN32)
|
||||
FIND_LIBRARY(WINSOCK2_LIB ws2_32)
|
||||
|
||||
IF(WINSOCK2_LIB)
|
||||
LIST(APPEND LIBXML2_LIBRARIES ${WINSOCK2_LIB})
|
||||
ENDIF()
|
||||
|
||||
FIND_LIBRARY(CRYPT32_LIB Crypt32)
|
||||
|
||||
IF(CRYPT32_LIB)
|
||||
LIST(APPEND LIBXML2_LIBRARIES ${CRYPT32_LIB})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
# under Linux and OS X, recent libxml2 versions are linked against liblzma
|
||||
FIND_PACKAGE(LibLZMA)
|
||||
|
||||
IF(LIBLZMA_LIBRARIES)
|
||||
LIST(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_QT_LIBRARY _NAME)
|
||||
IF(WIN32)
|
||||
SET(_PREFIX "Qt5")
|
||||
SET(_EXT "lib")
|
||||
ELSE()
|
||||
SET(_PREFIX "libQt5")
|
||||
SET(_EXT "a")
|
||||
ENDIF()
|
||||
SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}.${_EXT}")
|
||||
IF(EXISTS ${_LIB})
|
||||
LIST(APPEND QT_LIBRARIES optimized ${_LIB})
|
||||
ENDIF()
|
||||
SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}")
|
||||
IF(EXISTS ${_LIB})
|
||||
LIST(APPEND QT_LIBRARIES debug ${_LIB})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_QT_PLUGIN _TYPE _NAME)
|
||||
IF(WIN32)
|
||||
SET(_PREFIX "")
|
||||
SET(_EXT "lib")
|
||||
ELSE()
|
||||
SET(_PREFIX "lib")
|
||||
SET(_EXT "a")
|
||||
ENDIF()
|
||||
SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}.${_EXT}")
|
||||
IF(EXISTS ${_LIB})
|
||||
LIST(APPEND QT_LIBRARIES optimized ${_LIB})
|
||||
ENDIF()
|
||||
SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}")
|
||||
IF(EXISTS ${_LIB})
|
||||
LIST(APPEND QT_LIBRARIES debug ${_LIB})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_QT_SYSTEM_LIBRARY _NAME)
|
||||
# Save default suffixes
|
||||
SET(_OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
||||
# Define specific suffixes
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
|
||||
# Find the library with specified suffixes
|
||||
FIND_LIBRARY(${_NAME}_LIBRARY NAMES ${_NAME})
|
||||
|
||||
# Restore default suffixes
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_OLD_SUFFIXES})
|
||||
|
||||
IF(${_NAME}_LIBRARY)
|
||||
MESSAGE(STATUS "Found ${${_NAME}_LIBRARY} ${_NAME}")
|
||||
|
||||
LIST(APPEND QT_LIBRARIES ${${_NAME}_LIBRARY})
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Didn't find ${_NAME}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(FIND_QT5)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR)
|
||||
|
||||
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR})
|
||||
|
||||
FIND_PACKAGE(Qt5Core QUIET)
|
||||
|
||||
IF(Qt5Core_FOUND)
|
||||
# Check if we are using Qt static or shared libraries
|
||||
GET_TARGET_PROPERTY(_FILE Qt5::Core IMPORTED_LOCATION_RELEASE)
|
||||
|
||||
SET(QT_VERSION "${Qt5Core_VERSION_STRING}")
|
||||
SET(_VERSION "${QT_VERSION}")
|
||||
|
||||
IF(_FILE MATCHES "\\.(lib|a)$")
|
||||
SET(QT_STATIC ON)
|
||||
SET(_VERSION "${_VERSION} static version")
|
||||
ELSE()
|
||||
SET(QT_STATIC OFF)
|
||||
SET(_VERSION "${_VERSION} shared version")
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Found Qt ${_VERSION}")
|
||||
|
||||
# These variables are not defined with Qt5 CMake modules
|
||||
SET(QT_BINARY_DIR "${_qt5Core_install_prefix}/bin")
|
||||
SET(QT_LIBRARY_DIR "${_qt5Core_install_prefix}/lib")
|
||||
SET(QT_PLUGINS_DIR "${_qt5Core_install_prefix}/plugins")
|
||||
SET(QT_TRANSLATIONS_DIR "${_qt5Core_install_prefix}/translations")
|
||||
|
||||
# Fix wrong include directories with Qt 5 under Mac OS X
|
||||
INCLUDE_DIRECTORIES("${_qt5Core_install_prefix}/include")
|
||||
|
||||
FIND_PACKAGE(Qt5Gui)
|
||||
FIND_PACKAGE(Qt5Widgets)
|
||||
FIND_PACKAGE(Qt5OpenGL)
|
||||
FIND_PACKAGE(Qt5Xml)
|
||||
FIND_PACKAGE(Qt5LinguistTools)
|
||||
FIND_PACKAGE(Qt5Network)
|
||||
|
||||
IF(QT_STATIC)
|
||||
FIND_PACKAGE(PNG REQUIRED)
|
||||
FIND_PACKAGE(Jpeg REQUIRED)
|
||||
|
||||
ADD_DEFINITIONS(-DQT_STATICPLUGIN)
|
||||
|
||||
SET(QT_LIBRARIES Qt5::Widgets)
|
||||
|
||||
# Gui
|
||||
LIST(APPEND QT_LIBRARIES Qt5::Gui Qt5::OpenGL)
|
||||
|
||||
ADD_QT_LIBRARY(PrintSupport)
|
||||
|
||||
IF(WIN32)
|
||||
LIST(APPEND QT_LIBRARIES
|
||||
${WINSDK_LIBRARY_DIR}/Imm32.lib
|
||||
${WINSDK_LIBRARY_DIR}/OpenGL32.lib
|
||||
${WINSDK_LIBRARY_DIR}/WinMM.Lib)
|
||||
ADD_QT_PLUGIN(platforms qwindows)
|
||||
ADD_QT_LIBRARY(PlatformSupport)
|
||||
ELSEIF(APPLE)
|
||||
# Cups needs .dylib
|
||||
SET(OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib)
|
||||
FIND_LIBRARY(CUPS_LIBRARY cups)
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
||||
FIND_LIBRARY(IOKIT_FRAMEWORK IOKit)
|
||||
FIND_LIBRARY(COCOA_FRAMEWORK Cocoa)
|
||||
FIND_LIBRARY(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration)
|
||||
FIND_LIBRARY(OPENGL_FRAMEWORK NAMES OpenGL)
|
||||
|
||||
LIST(APPEND QT_LIBRARIES
|
||||
${CUPS_LIBRARY}
|
||||
${COCOA_FRAMEWORK}
|
||||
${SYSTEMCONFIGURATION_FRAMEWORK}
|
||||
${IOKIT_FRAMEWORK}
|
||||
${OPENGL_FRAMEWORK})
|
||||
|
||||
ADD_QT_PLUGIN(printsupport cocoaprintersupport)
|
||||
ADD_QT_PLUGIN(platforms qcocoa)
|
||||
ADD_QT_LIBRARY(PlatformSupport)
|
||||
ELSE()
|
||||
# order is very important there
|
||||
ADD_QT_PLUGIN(platforms qxcb)
|
||||
ADD_QT_PLUGIN(xcbglintegrations qxcb-glx-integration)
|
||||
|
||||
ADD_QT_LIBRARY(XcbQpa)
|
||||
ADD_QT_LIBRARY(GlxSupport)
|
||||
ADD_QT_LIBRARY(ServiceSupport)
|
||||
ADD_QT_LIBRARY(EdidSupport)
|
||||
ADD_QT_LIBRARY(FontDatabaseSupport)
|
||||
ADD_QT_LIBRARY(ThemeSupport)
|
||||
ADD_QT_LIBRARY(EventDispatcherSupport)
|
||||
ADD_QT_LIBRARY(PlatformSupport)
|
||||
|
||||
ADD_QT_LIBRARY(DBus)
|
||||
|
||||
IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a")
|
||||
LIST(APPEND QT_LIBRARIES "${QT_LIBRARY_DIR}/libxcb-static.a")
|
||||
ENDIF()
|
||||
|
||||
# always link these in dynamic, API never changes
|
||||
ADD_QT_SYSTEM_LIBRARY(X11)
|
||||
ADD_QT_SYSTEM_LIBRARY(Xmu)
|
||||
ADD_QT_SYSTEM_LIBRARY(X11-xcb)
|
||||
ADD_QT_SYSTEM_LIBRARY(Xi)
|
||||
ADD_QT_SYSTEM_LIBRARY(SM)
|
||||
ADD_QT_SYSTEM_LIBRARY(ICE)
|
||||
ADD_QT_SYSTEM_LIBRARY(xcb)
|
||||
ADD_QT_SYSTEM_LIBRARY(GL)
|
||||
ADD_QT_SYSTEM_LIBRARY(xcb-glx)
|
||||
ADD_QT_SYSTEM_LIBRARY(fontconfig)
|
||||
ADD_QT_SYSTEM_LIBRARY(Xrender)
|
||||
ENDIF()
|
||||
|
||||
ADD_QT_PLUGIN(imageformats qgif)
|
||||
ADD_QT_PLUGIN(imageformats qicns)
|
||||
ADD_QT_PLUGIN(imageformats qico)
|
||||
ADD_QT_PLUGIN(imageformats qjpeg)
|
||||
|
||||
# harfbuzz is needed since Qt 5.3
|
||||
IF(UNIX)
|
||||
SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzzng.a")
|
||||
IF(NOT EXISTS ${HB_LIB})
|
||||
SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzz.a")
|
||||
ENDIF()
|
||||
ELSEIF(WIN32)
|
||||
SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib")
|
||||
ENDIF()
|
||||
IF(EXISTS ${HB_LIB})
|
||||
LIST(APPEND QT_LIBRARIES ${HB_LIB})
|
||||
ENDIF()
|
||||
|
||||
# freetype is needed since Qt 5.5
|
||||
FIND_PACKAGE(Freetype)
|
||||
|
||||
IF(FREETYPE_FOUND)
|
||||
LIST(APPEND QT_LIBRARIES ${FREETYPE_LIBRARIES})
|
||||
ELSE()
|
||||
IF(UNIX)
|
||||
SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a")
|
||||
ELSEIF(WIN32)
|
||||
SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib")
|
||||
ENDIF()
|
||||
IF(EXISTS ${FREETYPE_LIB})
|
||||
LIST(APPEND QT_LIBRARIES ${FREETYPE_LIB})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ADD_QT_PLUGIN(accessible qtaccessiblewidgets)
|
||||
|
||||
LIST(APPEND QT_LIBRARIES ${PNG_LIBRARIES} ${JPEG_LIBRARY})
|
||||
|
||||
# Network
|
||||
LIST(APPEND QT_LIBRARIES Qt5::Network Qt5::Xml)
|
||||
LIST(APPEND QT_LIBRARIES ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
|
||||
IF(WIN32)
|
||||
LIST(APPEND QT_LIBRARIES
|
||||
${WINSDK_LIBRARY_DIR}/Crypt32.lib
|
||||
${WINSDK_LIBRARY_DIR}/WS2_32.Lib
|
||||
${WINSDK_LIBRARY_DIR}/IPHlpApi.Lib)
|
||||
ENDIF()
|
||||
|
||||
# Core
|
||||
LIST(APPEND QT_LIBRARIES Qt5::Core)
|
||||
|
||||
# pcre is needed since Qt 5.5
|
||||
IF(UNIX)
|
||||
SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a")
|
||||
IF(NOT EXISTS ${PCRE_LIB})
|
||||
SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre2.a")
|
||||
ENDIF()
|
||||
ELSEIF(WIN32)
|
||||
SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib")
|
||||
ENDIF()
|
||||
IF(EXISTS ${PCRE_LIB})
|
||||
LIST(APPEND QT_LIBRARIES ${PCRE_LIB})
|
||||
ENDIF()
|
||||
|
||||
IF(APPLE)
|
||||
FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre)
|
||||
|
||||
FIND_LIBRARY(SECURITY_FRAMEWORK Security)
|
||||
|
||||
LIST(APPEND QT_LIBRARIES
|
||||
${PCRE_LIBRARY}
|
||||
${FOUNDATION_FRAMEWORK}
|
||||
${CARBON_FRAMEWORK}
|
||||
${SECURITY_FRAMEWORK})
|
||||
ELSEIF(UNIX)
|
||||
FIND_PACKAGE(Threads)
|
||||
LIST(APPEND QT_LIBRARIES ${ZLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} -lrt)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(WARNING "Unable to find Qt 5")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
@ -1,57 +0,0 @@
|
||||
# - 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 )
|
||||
|
@ -1,81 +0,0 @@
|
||||
# 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)
|
||||
|
@ -1,201 +0,0 @@
|
||||
# - Locate Luabind library
|
||||
# This module defines
|
||||
# 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)
|
||||
|
||||
# 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)
|
||||
# check for Lua 5.2
|
||||
SET(LUA52_LIBRARIES liblua5.2 liblua-5.2 liblua.so.5.2)
|
||||
|
||||
FOREACH(_LIB ${LUA52_LIBRARIES})
|
||||
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
|
||||
IF(LUALIB_FOUND)
|
||||
MESSAGE(STATUS "Luabind is using Lua 5.2")
|
||||
FIND_PACKAGE(Lua52 REQUIRED)
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT LUALIB_FOUND)
|
||||
# check for Lua 5.1
|
||||
SET(LUA51_LIBRARIES liblua5.1 liblua-5.1 liblua.so.5.1)
|
||||
|
||||
FOREACH(_LIB ${LUA51_LIBRARIES})
|
||||
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
|
||||
IF(LUALIB_FOUND)
|
||||
MESSAGE(STATUS "Luabind is using Lua 5.1")
|
||||
FIND_PACKAGE(Lua51 REQUIRED)
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT LUALIB_FOUND)
|
||||
# check for Lua 5.0
|
||||
SET(LUA50_LIBRARIES liblua5.0 liblua-5.0 liblua.so.5.0)
|
||||
|
||||
FOREACH(_LIB ${LUA50_LIBRARIES})
|
||||
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND)
|
||||
IF(LUALIB_FOUND)
|
||||
MESSAGE(STATUS "Luabind is using Lua 5.0")
|
||||
FIND_PACKAGE(Lua50 REQUIRED)
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT LUALIB_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
# TODO: find a way to detect Lua version
|
||||
IF(HUNTER_ENABLED)
|
||||
HUNTER_ADD_PACKAGE(Lua)
|
||||
FIND_PACKAGE(Lua CONFIG REQUIRED)
|
||||
SET(LUA_LIBRARIES Lua::lua_lib)
|
||||
ELSEIF(WITH_LUA54)
|
||||
FIND_PACKAGE(Lua54 REQUIRED)
|
||||
ELSEIF(WITH_LUA53)
|
||||
FIND_PACKAGE(Lua53 REQUIRED)
|
||||
ELSEIF(WITH_LUA52)
|
||||
FIND_PACKAGE(Lua52 REQUIRED)
|
||||
ELSEIF(WITH_LUA51)
|
||||
FIND_PACKAGE(Lua51 REQUIRED)
|
||||
ELSE()
|
||||
FIND_PACKAGE(Lua50 REQUIRED)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
|
||||
# in cache already
|
||||
SET(Luabind_FIND_QUIETLY TRUE)
|
||||
ENDIF()
|
||||
|
||||
SET(LIBRARY_NAME_RELEASE)
|
||||
SET(LIBRARY_NAME_DEBUG)
|
||||
|
||||
IF(WITH_LUA54)
|
||||
IF(WITH_STLPORT)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua54)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua54d)
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua54)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua54d)
|
||||
ENDIF()
|
||||
|
||||
IF(HUNTER_ENABLED)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind luabind09)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabindd luabind09-d)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_LUA53)
|
||||
IF(WITH_STLPORT)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua53)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua53d)
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua53)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua53d)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_LUA52)
|
||||
IF(WITH_STLPORT)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d)
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_LUA51)
|
||||
IF(WITH_STLPORT)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua51)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua51d)
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua51)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua51d)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_LUA50)
|
||||
IF(WITH_STLPORT)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua50)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua50d)
|
||||
ENDIF()
|
||||
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua50)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua50d)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlportd)
|
||||
ENDIF()
|
||||
|
||||
# generic libraries names
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind libluabind)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
|
||||
|
||||
FIND_PACKAGE_HELPER(Luabind luabind/luabind.hpp RELEASE ${LIBRARY_NAME_RELEASE} DEBUG ${LIBRARY_NAME_DEBUG})
|
||||
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
|
||||
IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
|
||||
IF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
|
||||
# Case where both Release and Debug versions are provided
|
||||
SET(LUABIND_FOUND TRUE)
|
||||
SET(LUABIND_LIBRARIES optimized ${LUABIND_LIBRARY_RELEASE} debug ${LUABIND_LIBRARY_DEBUG})
|
||||
ELSEIF(LUABIND_LIBRARY_RELEASE)
|
||||
# Normal case
|
||||
SET(LUABIND_FOUND TRUE)
|
||||
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_RELEASE})
|
||||
ELSEIF(LUABIND_LIBRARY_DEBUG)
|
||||
# Case where Luabind is compiled from sources (debug version is compiled by default)
|
||||
SET(LUABIND_FOUND TRUE)
|
||||
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(LUABIND_FOUND)
|
||||
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
|
||||
# Check if luabind/version.hpp exists
|
||||
FIND_FILE(LUABIND_VERSION_FILE luabind/version.hpp PATHS ${LUABIND_INCLUDE_DIR})
|
||||
IF(LUABIND_VERSION_FILE)
|
||||
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
|
||||
ENDIF()
|
||||
|
||||
FIND_CORRECT_LUA_VERSION()
|
||||
|
||||
IF(NOT Luabind_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(NOT Luabind_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find Luabind!")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)
|
@ -1,119 +0,0 @@
|
||||
# - 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
|
||||
|
||||
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)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
|
||||
IF(NOT EXISTS "${MSVC_REDIST_DIR}")
|
||||
SET(MSVC_REDIST_DIR "${VC_DIR}/redist")
|
||||
|
||||
IF(NOT EXISTS "${MSVC_REDIST_DIR}")
|
||||
SET(MSVC_REDIST_DIR)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC_REDIST_DIR)
|
||||
IF(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 "${MSVC_REDIST_DIR}")
|
||||
ELSEIF(MSVC11)
|
||||
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC11_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||
ELSEIF(MSVC10)
|
||||
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC10_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||
ELSEIF(MSVC90)
|
||||
SET(MSVC90_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||
ELSEIF(MSVC80)
|
||||
SET(MSVC80_REDIST_DIR "${MSVC_REDIST_DIR}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
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_DIRS ${VC_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR})
|
@ -1,97 +0,0 @@
|
||||
# - Find MySQL
|
||||
# Find the MySQL includes and client library
|
||||
# This module defines
|
||||
# MYSQL_INCLUDE_DIR, where to find mysql.h
|
||||
# MYSQL_LIBRARIES, the libraries needed to use MySQL.
|
||||
# MYSQL_FOUND, If false, do not try to use MySQL.
|
||||
#
|
||||
# Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
||||
SET(MYSQL_FOUND TRUE)
|
||||
|
||||
ELSE()
|
||||
|
||||
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
|
||||
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 libmariadb mariadbclient
|
||||
PATHS
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/opt
|
||||
$ENV{SystemDrive}/MySQL/*/lib/opt)
|
||||
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 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 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()
|
||||
|
||||
IF(MYSQL_INCLUDE_DIR)
|
||||
IF(MYSQL_LIBRARY_RELEASE)
|
||||
IF(MYSQL_LIBRARY_DEBUG)
|
||||
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE} debug ${MYSQL_LIBRARY_DEBUG})
|
||||
ELSE()
|
||||
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY_RELEASE})
|
||||
ENDIF()
|
||||
FIND_PACKAGE(OpenSSL)
|
||||
IF(OPENSSL_FOUND)
|
||||
IF(WIN32)
|
||||
SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
|
||||
ENDIF()
|
||||
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
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.")
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)
|
||||
|
||||
ENDIF()
|
@ -1,418 +0,0 @@
|
||||
# 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,3 +0,0 @@
|
||||
INCLUDE(FindHelpers)
|
||||
|
||||
FIND_PACKAGE_HELPER(Ogg ogg/ogg.h)
|
@ -1,14 +0,0 @@
|
||||
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,5 +0,0 @@
|
||||
INCLUDE(FindHelpers)
|
||||
|
||||
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,14 +0,0 @@
|
||||
INCLUDE(FindHelpers)
|
||||
|
||||
FIND_PACKAGE_HELPER(Squish squish.h)
|
||||
|
||||
IF(SQUISH_FOUND)
|
||||
IF(NOT SQUISH_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARIES}")
|
||||
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()
|
||||
ENDIF()
|
@ -1,74 +0,0 @@
|
||||
# - 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,8 +0,0 @@
|
||||
INCLUDE(FindHelpers)
|
||||
|
||||
FIND_PACKAGE_HELPER(Vorbis vorbisenc.h)
|
||||
FIND_PACKAGE_HELPER(VorbisFile vorbisfile.h SUFFIXES vorbis)
|
||||
|
||||
IF(VORBISFILE_FOUND)
|
||||
SET(VORBIS_LIBRARIES ${VORBIS_LIBRARIES} ${VORBISFILE_LIBRARIES})
|
||||
ENDIF()
|
@ -1,519 +0,0 @@
|
||||
# - Find Windows Platform SDK
|
||||
# Find the Windows includes
|
||||
#
|
||||
# WINSDK_INCLUDE_DIR - where to find Windows.h
|
||||
# WINSDK_INCLUDE_DIRS - where to find all Windows headers
|
||||
# WINSDK_LIBRARY_DIR - where to find libraries
|
||||
# WINSDK_FOUND - True if Windows SDK found.
|
||||
|
||||
IF(WINSDK_FOUND)
|
||||
# If Windows SDK already found, skip it
|
||||
RETURN()
|
||||
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")
|
||||
|
||||
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" 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()
|
||||
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()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(DETECT_WINSDK_VERSION _VERSION)
|
||||
SET(WINSDK${_VERSION}_FOUND OFF)
|
||||
DETECT_WINSDK_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
|
||||
|
||||
IF(NOT WINSDK${_VERSION}_FOUND)
|
||||
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
||||
ENDIF()
|
||||
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_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()
|
||||
ENDFOREACH()
|
||||
|
||||
SET(WINSDK_SUFFIXES)
|
||||
|
||||
IF(TARGET_ARM64)
|
||||
SET(WINSDK8_SUFFIX "arm64")
|
||||
ELSEIF(TARGET_ARM)
|
||||
SET(WINSDK8_SUFFIX "arm")
|
||||
ELSEIF(TARGET_X64)
|
||||
SET(WINSDK8_SUFFIX "x64")
|
||||
SET(WINSDK_SUFFIXES "x64" "amd64")
|
||||
ELSEIF(TARGET_X86)
|
||||
SET(WINSDK8_SUFFIX "x86")
|
||||
ENDIF()
|
||||
|
||||
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
|
||||
|
||||
IF(WINSDKCURRENT_VERSION_INCLUDE)
|
||||
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
|
||||
ENDIF()
|
||||
|
||||
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
|
||||
|
||||
IF(NOT WINSDKENV_DIR)
|
||||
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
|
||||
ENDIF()
|
||||
|
||||
MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
|
||||
# Search version in headers
|
||||
FIND_FILE(_MSI_FILE Msi.h
|
||||
PATHS
|
||||
${WINSDK_DIR}/Include/um
|
||||
${WINSDK_DIR}/Include
|
||||
)
|
||||
|
||||
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()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 7.0
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN7")
|
||||
|
||||
IF(_CONTENT)
|
||||
FIND_FILE(_WINSDKVER_FILE winsdkver.h WinSDKVer.h
|
||||
PATHS
|
||||
${WINSDK_DIR}/Include/um
|
||||
${WINSDK_DIR}/Include
|
||||
)
|
||||
|
||||
IF(_WINSDKVER_FILE)
|
||||
# Load WinSDKVer.h content
|
||||
FILE(STRINGS ${_WINSDKVER_FILE} _CONTENT REGEX "^#define NTDDI_MAXVER")
|
||||
|
||||
# Get NTDDI_MAXVER value
|
||||
STRING(REGEX REPLACE "^.*0x([0-9A-Fa-f]+).*$" "\\1" _WINSDKVER "${_CONTENT}")
|
||||
|
||||
# In Windows SDK 7.1, NTDDI_MAXVER is wrong
|
||||
IF(_WINSDKVER STREQUAL "06010000")
|
||||
SET(WINSDK_VERSION "7.1")
|
||||
ELSEIF(_WINSDKVER STREQUAL "0601")
|
||||
SET(WINSDK_VERSION "7.0A")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(WINSDK_VERSION "7.0")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 6.0
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_VISTA")
|
||||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "6.0")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.2
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WS03SP1")
|
||||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.2")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.1
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINXP")
|
||||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.1")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.0
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN2K")
|
||||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.0")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(USE_CURRENT_WINSDK)
|
||||
SET(WINSDK_DIR "")
|
||||
SET(WINSDK_VERSION "")
|
||||
SET(WINSDK_VERSION_FULL "")
|
||||
|
||||
# Use WINSDK environment variable
|
||||
IF(WINSDKENV_DIR)
|
||||
FIND_PATH(WINSDK_DIR Windows.h
|
||||
HINTS
|
||||
${WINSDKENV_DIR}/Include/um
|
||||
${WINSDKENV_DIR}/Include
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# Use INCLUDE environment variable
|
||||
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
|
||||
FOREACH(_INCLUDE ${WINSDKCURRENT_VERSION_INCLUDE})
|
||||
FILE(TO_CMAKE_PATH ${_INCLUDE} _INCLUDE)
|
||||
|
||||
# Look for Windows.h because there are several paths
|
||||
IF(EXISTS ${_INCLUDE}/Windows.h)
|
||||
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
|
||||
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
IF(WINSDK_DIR)
|
||||
# Compare WINSDK_DIR with registered Windows SDKs
|
||||
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
|
||||
IF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
|
||||
SET(WINSDK_VERSION ${_VERSION})
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
FIND_WINSDK_VERSION_HEADERS()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WINSDK_DIR)
|
||||
# Use Windows SDK versions installed with VC++ when possible
|
||||
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.0")
|
||||
ELSEIF(MSVC10)
|
||||
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "7.0A")
|
||||
ENDIF()
|
||||
ELSEIF(MSVC90)
|
||||
IF(NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "6.0A")
|
||||
ENDIF()
|
||||
ELSEIF(MSVC80)
|
||||
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()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
|
||||
ENDIF()
|
||||
|
||||
# Use installed Windows SDK
|
||||
IF(NOT WINSDK_VERSION)
|
||||
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")
|
||||
ELSEIF(WINSDK6.1_FOUND)
|
||||
SET(WINSDK_VERSION "6.1")
|
||||
ELSEIF(WINSDK6.0_FOUND)
|
||||
SET(WINSDK_VERSION "6.0")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Look for correct registered Windows SDK version
|
||||
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
|
||||
IF(WINSDK_VERSION STREQUAL _VERSION)
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||
BREAK()
|
||||
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()
|
||||
IF(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||
ELSE()
|
||||
USE_CURRENT_WINSDK()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(WINSDK_DIR)
|
||||
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
|
||||
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
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
MESSAGE(STATUS "Found d3d9.h in ${WINSDK_SHARED_INCLUDE_DIR}")
|
||||
|
||||
# directory where OpenGL headers are found
|
||||
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
|
||||
HINTS
|
||||
${WINSDK_INCLUDE_DIR}/gl
|
||||
${WINSDK_DIR}/Include/um/gl
|
||||
${WINSDK_DIR}/Include/gl
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
MESSAGE(STATUS "Found GL.h in ${WINSDK_OPENGL_INCLUDE_DIR}")
|
||||
|
||||
SET(WINSDK_LIBRARY_DIRS
|
||||
${WINSDK_DIR}/Lib/${UCRT_VERSION}/um/${WINSDK8_SUFFIX}
|
||||
${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX}
|
||||
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
|
||||
)
|
||||
|
||||
IF(WINSDK_SUFFIXES)
|
||||
FOREACH(_SUFFIX ${WINSDK_SUFFIXES})
|
||||
LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib/${_SUFFIX})
|
||||
ENDFOREACH()
|
||||
ELSE()
|
||||
LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib)
|
||||
ENDIF()
|
||||
|
||||
# directory where all libraries are found
|
||||
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
|
||||
HINTS
|
||||
${WINSDK_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_BINARY_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# midl is used to generate IDL interfaces
|
||||
FIND_PROGRAM(WINSDK_MIDL midl
|
||||
HINTS
|
||||
${WINSDK_BINARY_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
IF(WINSDK_INCLUDE_DIR)
|
||||
SET(WINSDK_FOUND ON)
|
||||
|
||||
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})
|
||||
|
||||
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()
|
||||
|
||||
IF(NOT DXSDK_DIR)
|
||||
MESSAGE("Using DirectX from Windows SDK (${WINSDK_LIBRARY_DIRS})")
|
||||
SET(DXSDK_DIR ${WINSDK_DIR})
|
||||
FIND_LIBRARY(DXSDK_GUID_LIBRARY dxguid ${WINSDK_LIBRARY_DIRS})
|
||||
FIND_LIBRARY(DXSDK_DINPUT_LIBRARY dinput8 ${WINSDK_LIBRARY_DIRS})
|
||||
FIND_LIBRARY(DXSDK_DSOUND_LIBRARY dsound ${WINSDK_LIBRARY_DIRS})
|
||||
FIND_LIBRARY(DXSDK_XAUDIO_LIBRARY xaudio2 ${WINSDK_LIBRARY_DIRS})
|
||||
# TODO: FIND_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
|
||||
FIND_LIBRARY(DXSDK_D3D9_LIBRARY d3d9 ${WINSDK_LIBRARY_DIRS})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
|
||||
ENDIF()
|
||||
ENDIF()
|
@ -1,63 +0,0 @@
|
||||
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 ()
|
@ -1,131 +0,0 @@
|
||||
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()
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})
|
||||
|
||||
IF(NOT ROOT_DIR AND SOURCE_DIR)
|
||||
SET(ROOT_DIR ${SOURCE_DIR})
|
||||
ENDIF()
|
||||
|
||||
IF(NOT SOURCE_DIR AND ROOT_DIR)
|
||||
SET(SOURCE_DIR ${ROOT_DIR})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(SOURCE_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")
|
||||
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
|
||||
ENDIF()
|
||||
ELSEIF(UNIX)
|
||||
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
|
||||
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
|
||||
ELSE()
|
||||
MESSAGE(SEND_ERROR "date not implemented")
|
||||
SET(${RESULT} "0000-00-00 00:00:00")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF(EXISTS "${ROOT_DIR}/.svn/")
|
||||
FIND_PACKAGE(Subversion QUIET)
|
||||
|
||||
IF(SUBVERSION_FOUND)
|
||||
Subversion_WC_INFO(${ROOT_DIR} ER)
|
||||
SET(REVISION ${ER_WC_REVISION})
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(TortoiseSVN QUIET)
|
||||
|
||||
IF(TORTOISESVN_FOUND)
|
||||
TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(EXISTS "${ROOT_DIR}/.hg/")
|
||||
FIND_PACKAGE(Mercurial)
|
||||
|
||||
IF(MERCURIAL_FOUND)
|
||||
Mercurial_WC_INFO(${ROOT_DIR} ER)
|
||||
SET(REVISION ${ER_WC_REVISION})
|
||||
SET(CHANGESET ${ER_WC_CHANGESET})
|
||||
SET(BRANCH ${ER_WC_BRANCH})
|
||||
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)
|
||||
IF(EXISTS ${REVISION_FILE})
|
||||
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
|
||||
MESSAGE(STATUS "Read revision ${REVISION} from file")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(DEFINED REVISION)
|
||||
MESSAGE(STATUS "Found revision ${REVISION}")
|
||||
ELSE()
|
||||
SET(REVISION 0)
|
||||
ENDIF()
|
@ -1,8 +0,0 @@
|
||||
# This file is parsed by HunterGate command
|
||||
|
||||
hunter_config(luabind
|
||||
VERSION 0.9.1
|
||||
URL "https://github.com/nimetu/luabind/tarball/2fa4606"
|
||||
SHA1 "3b4646bab9f0b2362d7b8d71d78e40deaf3cc747"
|
||||
)
|
||||
|
@ -1,537 +0,0 @@
|
||||
# Copyright (c) 2013-2019, Ruslan Baratov
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# This is a gate file to Hunter package manager.
|
||||
# Include this file using `include` command and add package you need, example:
|
||||
#
|
||||
# cmake_minimum_required(VERSION 3.2)
|
||||
#
|
||||
# include("cmake/HunterGate.cmake")
|
||||
# HunterGate(
|
||||
# URL "https://github.com/path/to/hunter/archive.tar.gz"
|
||||
# SHA1 "798501e983f14b28b10cda16afa4de69eee1da1d"
|
||||
# )
|
||||
#
|
||||
# project(MyProject)
|
||||
#
|
||||
# hunter_add_package(Foo)
|
||||
# hunter_add_package(Boo COMPONENTS Bar Baz)
|
||||
#
|
||||
# Projects:
|
||||
# * https://github.com/hunter-packages/gate/
|
||||
# * https://github.com/ruslo/hunter
|
||||
|
||||
option(HUNTER_ENABLED "Enable Hunter package manager support" ON)
|
||||
|
||||
if(HUNTER_ENABLED)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.2")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"At least CMake version 3.2 required for Hunter dependency management."
|
||||
" Update CMake or set HUNTER_ENABLED to OFF."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CMakeParseArguments) # cmake_parse_arguments
|
||||
|
||||
option(HUNTER_STATUS_PRINT "Print working status" ON)
|
||||
option(HUNTER_STATUS_DEBUG "Print a lot info" OFF)
|
||||
option(HUNTER_TLS_VERIFY "Enable/disable TLS certificate checking on downloads" ON)
|
||||
set(HUNTER_ROOT "" CACHE FILEPATH "Override the HUNTER_ROOT.")
|
||||
|
||||
set(HUNTER_ERROR_PAGE "https://hunter.readthedocs.io/en/latest/reference/errors")
|
||||
|
||||
function(hunter_gate_status_print)
|
||||
if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG)
|
||||
foreach(print_message ${ARGV})
|
||||
message(STATUS "[hunter] ${print_message}")
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_status_debug)
|
||||
if(HUNTER_STATUS_DEBUG)
|
||||
foreach(print_message ${ARGV})
|
||||
string(TIMESTAMP timestamp)
|
||||
message(STATUS "[hunter *** DEBUG *** ${timestamp}] ${print_message}")
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_error_page error_page)
|
||||
message("------------------------------ ERROR ------------------------------")
|
||||
message(" ${HUNTER_ERROR_PAGE}/${error_page}.html")
|
||||
message("-------------------------------------------------------------------")
|
||||
message("")
|
||||
message(FATAL_ERROR "")
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_internal_error)
|
||||
message("")
|
||||
foreach(print_message ${ARGV})
|
||||
message("[hunter ** INTERNAL **] ${print_message}")
|
||||
endforeach()
|
||||
message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
|
||||
message("")
|
||||
hunter_gate_error_page("error.internal")
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_fatal_error)
|
||||
cmake_parse_arguments(hunter "" "ERROR_PAGE" "" "${ARGV}")
|
||||
if("${hunter_ERROR_PAGE}" STREQUAL "")
|
||||
hunter_gate_internal_error("Expected ERROR_PAGE")
|
||||
endif()
|
||||
message("")
|
||||
foreach(x ${hunter_UNPARSED_ARGUMENTS})
|
||||
message("[hunter ** FATAL ERROR **] ${x}")
|
||||
endforeach()
|
||||
message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
|
||||
message("")
|
||||
hunter_gate_error_page("${hunter_ERROR_PAGE}")
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_user_error)
|
||||
hunter_gate_fatal_error(${ARGV} ERROR_PAGE "error.incorrect.input.data")
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_self root version sha1 result)
|
||||
string(COMPARE EQUAL "${root}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("root is empty")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${version}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("version is empty")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${sha1}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("sha1 is empty")
|
||||
endif()
|
||||
|
||||
string(SUBSTRING "${sha1}" 0 7 archive_id)
|
||||
|
||||
if(EXISTS "${root}/cmake/Hunter")
|
||||
set(hunter_self "${root}")
|
||||
else()
|
||||
set(
|
||||
hunter_self
|
||||
"${root}/_Base/Download/Hunter/${version}/${archive_id}/Unpacked"
|
||||
)
|
||||
endif()
|
||||
|
||||
set("${result}" "${hunter_self}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Set HUNTER_GATE_ROOT cmake variable to suitable value.
|
||||
function(hunter_gate_detect_root)
|
||||
# Check CMake variable
|
||||
if(HUNTER_ROOT)
|
||||
set(HUNTER_GATE_ROOT "${HUNTER_ROOT}" PARENT_SCOPE)
|
||||
hunter_gate_status_debug("HUNTER_ROOT detected by cmake variable")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check environment variable
|
||||
if(DEFINED ENV{HUNTER_ROOT})
|
||||
set(HUNTER_GATE_ROOT "$ENV{HUNTER_ROOT}" PARENT_SCOPE)
|
||||
hunter_gate_status_debug("HUNTER_ROOT detected by environment variable")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check HOME environment variable
|
||||
if(DEFINED ENV{HOME})
|
||||
set(HUNTER_GATE_ROOT "$ENV{HOME}/.hunter" PARENT_SCOPE)
|
||||
hunter_gate_status_debug("HUNTER_ROOT set using HOME environment variable")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check SYSTEMDRIVE and USERPROFILE environment variable (windows only)
|
||||
if(WIN32)
|
||||
if(DEFINED ENV{SYSTEMDRIVE})
|
||||
set(HUNTER_GATE_ROOT "$ENV{SYSTEMDRIVE}/.hunter" PARENT_SCOPE)
|
||||
hunter_gate_status_debug(
|
||||
"HUNTER_ROOT set using SYSTEMDRIVE environment variable"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{USERPROFILE})
|
||||
set(HUNTER_GATE_ROOT "$ENV{USERPROFILE}/.hunter" PARENT_SCOPE)
|
||||
hunter_gate_status_debug(
|
||||
"HUNTER_ROOT set using USERPROFILE environment variable"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
hunter_gate_fatal_error(
|
||||
"Can't detect HUNTER_ROOT"
|
||||
ERROR_PAGE "error.detect.hunter.root"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_download dir)
|
||||
string(
|
||||
COMPARE
|
||||
NOTEQUAL
|
||||
"$ENV{HUNTER_DISABLE_AUTOINSTALL}"
|
||||
""
|
||||
disable_autoinstall
|
||||
)
|
||||
if(disable_autoinstall AND NOT HUNTER_RUN_INSTALL)
|
||||
hunter_gate_fatal_error(
|
||||
"Hunter not found in '${dir}'"
|
||||
"Set HUNTER_RUN_INSTALL=ON to auto-install it from '${HUNTER_GATE_URL}'"
|
||||
"Settings:"
|
||||
" HUNTER_ROOT: ${HUNTER_GATE_ROOT}"
|
||||
" HUNTER_SHA1: ${HUNTER_GATE_SHA1}"
|
||||
ERROR_PAGE "error.run.install"
|
||||
)
|
||||
endif()
|
||||
string(COMPARE EQUAL "${dir}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("Empty 'dir' argument")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("HUNTER_GATE_SHA1 empty")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("HUNTER_GATE_URL empty")
|
||||
endif()
|
||||
|
||||
set(done_location "${dir}/DONE")
|
||||
set(sha1_location "${dir}/SHA1")
|
||||
|
||||
set(build_dir "${dir}/Build")
|
||||
set(cmakelists "${dir}/CMakeLists.txt")
|
||||
|
||||
hunter_gate_status_debug("Locking directory: ${dir}")
|
||||
file(LOCK "${dir}" DIRECTORY GUARD FUNCTION)
|
||||
hunter_gate_status_debug("Lock done")
|
||||
|
||||
if(EXISTS "${done_location}")
|
||||
# while waiting for lock other instance can do all the job
|
||||
hunter_gate_status_debug("File '${done_location}' found, skip install")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${build_dir}")
|
||||
file(REMOVE_RECURSE "${cmakelists}")
|
||||
|
||||
file(MAKE_DIRECTORY "${build_dir}") # check directory permissions
|
||||
|
||||
# Disabling languages speeds up a little bit, reduces noise in the output
|
||||
# and avoids path too long windows error
|
||||
file(
|
||||
WRITE
|
||||
"${cmakelists}"
|
||||
"cmake_minimum_required(VERSION 3.2)\n"
|
||||
"project(HunterDownload LANGUAGES NONE)\n"
|
||||
"include(ExternalProject)\n"
|
||||
"ExternalProject_Add(\n"
|
||||
" Hunter\n"
|
||||
" URL\n"
|
||||
" \"${HUNTER_GATE_URL}\"\n"
|
||||
" URL_HASH\n"
|
||||
" SHA1=${HUNTER_GATE_SHA1}\n"
|
||||
" DOWNLOAD_DIR\n"
|
||||
" \"${dir}\"\n"
|
||||
" TLS_VERIFY\n"
|
||||
" ${HUNTER_TLS_VERIFY}\n"
|
||||
" SOURCE_DIR\n"
|
||||
" \"${dir}/Unpacked\"\n"
|
||||
" CONFIGURE_COMMAND\n"
|
||||
" \"\"\n"
|
||||
" BUILD_COMMAND\n"
|
||||
" \"\"\n"
|
||||
" INSTALL_COMMAND\n"
|
||||
" \"\"\n"
|
||||
")\n"
|
||||
)
|
||||
|
||||
if(HUNTER_STATUS_DEBUG)
|
||||
set(logging_params "")
|
||||
else()
|
||||
set(logging_params OUTPUT_QUIET)
|
||||
endif()
|
||||
|
||||
hunter_gate_status_debug("Run generate")
|
||||
|
||||
# Need to add toolchain file too.
|
||||
# Otherwise on Visual Studio + MDD this will fail with error:
|
||||
# "Could not find an appropriate version of the Windows 10 SDK installed on this machine"
|
||||
if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
|
||||
get_filename_component(absolute_CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE)
|
||||
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=${absolute_CMAKE_TOOLCHAIN_FILE}")
|
||||
else()
|
||||
# 'toolchain_arg' can't be empty
|
||||
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${CMAKE_MAKE_PROGRAM}" "" no_make)
|
||||
if(no_make)
|
||||
set(make_arg "")
|
||||
else()
|
||||
# Test case: remove Ninja from PATH but set it via CMAKE_MAKE_PROGRAM
|
||||
set(make_arg "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
"-H${dir}"
|
||||
"-B${build_dir}"
|
||||
"-G${CMAKE_GENERATOR}"
|
||||
"${toolchain_arg}"
|
||||
${make_arg}
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
RESULT_VARIABLE download_result
|
||||
${logging_params}
|
||||
)
|
||||
|
||||
if(NOT download_result EQUAL 0)
|
||||
hunter_gate_internal_error(
|
||||
"Configure project failed."
|
||||
"To reproduce the error run: ${CMAKE_COMMAND} -H${dir} -B${build_dir} -G${CMAKE_GENERATOR} ${toolchain_arg} ${make_arg}"
|
||||
"In directory ${dir}"
|
||||
)
|
||||
endif()
|
||||
|
||||
hunter_gate_status_print(
|
||||
"Initializing Hunter workspace (${HUNTER_GATE_SHA1})"
|
||||
" ${HUNTER_GATE_URL}"
|
||||
" -> ${dir}"
|
||||
)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}" --build "${build_dir}"
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
RESULT_VARIABLE download_result
|
||||
${logging_params}
|
||||
)
|
||||
|
||||
if(NOT download_result EQUAL 0)
|
||||
hunter_gate_internal_error("Build project failed")
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${build_dir}")
|
||||
file(REMOVE_RECURSE "${cmakelists}")
|
||||
|
||||
file(WRITE "${sha1_location}" "${HUNTER_GATE_SHA1}")
|
||||
file(WRITE "${done_location}" "DONE")
|
||||
|
||||
hunter_gate_status_debug("Finished")
|
||||
endfunction()
|
||||
|
||||
# Must be a macro so master file 'cmake/Hunter' can
|
||||
# apply all variables easily just by 'include' command
|
||||
# (otherwise PARENT_SCOPE magic needed)
|
||||
macro(HunterGate)
|
||||
if(HUNTER_GATE_DONE)
|
||||
# variable HUNTER_GATE_DONE set explicitly for external project
|
||||
# (see `hunter_download`)
|
||||
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
|
||||
endif()
|
||||
|
||||
# First HunterGate command will init Hunter, others will be ignored
|
||||
get_property(_hunter_gate_done GLOBAL PROPERTY HUNTER_GATE_DONE SET)
|
||||
|
||||
if(NOT HUNTER_ENABLED)
|
||||
# Empty function to avoid error "unknown function"
|
||||
function(hunter_add_package)
|
||||
endfunction()
|
||||
|
||||
set(
|
||||
_hunter_gate_disabled_mode_dir
|
||||
"${CMAKE_CURRENT_LIST_DIR}/cmake/Hunter/disabled-mode"
|
||||
)
|
||||
if(EXISTS "${_hunter_gate_disabled_mode_dir}")
|
||||
hunter_gate_status_debug(
|
||||
"Adding \"disabled-mode\" modules: ${_hunter_gate_disabled_mode_dir}"
|
||||
)
|
||||
list(APPEND CMAKE_PREFIX_PATH "${_hunter_gate_disabled_mode_dir}")
|
||||
endif()
|
||||
elseif(_hunter_gate_done)
|
||||
hunter_gate_status_debug("Secondary HunterGate (use old settings)")
|
||||
hunter_gate_self(
|
||||
"${HUNTER_CACHED_ROOT}"
|
||||
"${HUNTER_VERSION}"
|
||||
"${HUNTER_SHA1}"
|
||||
_hunter_self
|
||||
)
|
||||
include("${_hunter_self}/cmake/Hunter")
|
||||
else()
|
||||
set(HUNTER_GATE_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
string(COMPARE NOTEQUAL "${PROJECT_NAME}" "" _have_project_name)
|
||||
if(_have_project_name)
|
||||
hunter_gate_fatal_error(
|
||||
"Please set HunterGate *before* 'project' command. "
|
||||
"Detected project: ${PROJECT_NAME}"
|
||||
ERROR_PAGE "error.huntergate.before.project"
|
||||
)
|
||||
endif()
|
||||
|
||||
cmake_parse_arguments(
|
||||
HUNTER_GATE "LOCAL" "URL;SHA1;GLOBAL;FILEPATH" "" ${ARGV}
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" _empty_sha1)
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" _empty_url)
|
||||
string(
|
||||
COMPARE
|
||||
NOTEQUAL
|
||||
"${HUNTER_GATE_UNPARSED_ARGUMENTS}"
|
||||
""
|
||||
_have_unparsed
|
||||
)
|
||||
string(COMPARE NOTEQUAL "${HUNTER_GATE_GLOBAL}" "" _have_global)
|
||||
string(COMPARE NOTEQUAL "${HUNTER_GATE_FILEPATH}" "" _have_filepath)
|
||||
|
||||
if(_have_unparsed)
|
||||
hunter_gate_user_error(
|
||||
"HunterGate unparsed arguments: ${HUNTER_GATE_UNPARSED_ARGUMENTS}"
|
||||
)
|
||||
endif()
|
||||
if(_empty_sha1)
|
||||
hunter_gate_user_error("SHA1 suboption of HunterGate is mandatory")
|
||||
endif()
|
||||
if(_empty_url)
|
||||
hunter_gate_user_error("URL suboption of HunterGate is mandatory")
|
||||
endif()
|
||||
if(_have_global)
|
||||
if(HUNTER_GATE_LOCAL)
|
||||
hunter_gate_user_error("Unexpected LOCAL (already has GLOBAL)")
|
||||
endif()
|
||||
if(_have_filepath)
|
||||
hunter_gate_user_error("Unexpected FILEPATH (already has GLOBAL)")
|
||||
endif()
|
||||
endif()
|
||||
if(HUNTER_GATE_LOCAL)
|
||||
if(_have_global)
|
||||
hunter_gate_user_error("Unexpected GLOBAL (already has LOCAL)")
|
||||
endif()
|
||||
if(_have_filepath)
|
||||
hunter_gate_user_error("Unexpected FILEPATH (already has LOCAL)")
|
||||
endif()
|
||||
endif()
|
||||
if(_have_filepath)
|
||||
if(_have_global)
|
||||
hunter_gate_user_error("Unexpected GLOBAL (already has FILEPATH)")
|
||||
endif()
|
||||
if(HUNTER_GATE_LOCAL)
|
||||
hunter_gate_user_error("Unexpected LOCAL (already has FILEPATH)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
hunter_gate_detect_root() # set HUNTER_GATE_ROOT
|
||||
|
||||
# Beautify path, fix probable problems with windows path slashes
|
||||
get_filename_component(
|
||||
HUNTER_GATE_ROOT "${HUNTER_GATE_ROOT}" ABSOLUTE
|
||||
)
|
||||
hunter_gate_status_debug("HUNTER_ROOT: ${HUNTER_GATE_ROOT}")
|
||||
if(NOT HUNTER_ALLOW_SPACES_IN_PATH)
|
||||
string(FIND "${HUNTER_GATE_ROOT}" " " _contain_spaces)
|
||||
if(NOT _contain_spaces EQUAL -1)
|
||||
hunter_gate_fatal_error(
|
||||
"HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces."
|
||||
"Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error"
|
||||
"(Use at your own risk!)"
|
||||
ERROR_PAGE "error.spaces.in.hunter.root"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(
|
||||
REGEX
|
||||
MATCH
|
||||
"[0-9]+\\.[0-9]+\\.[0-9]+[-_a-z0-9]*"
|
||||
HUNTER_GATE_VERSION
|
||||
"${HUNTER_GATE_URL}"
|
||||
)
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_VERSION}" "" _is_empty)
|
||||
if(_is_empty)
|
||||
set(HUNTER_GATE_VERSION "unknown")
|
||||
endif()
|
||||
|
||||
hunter_gate_self(
|
||||
"${HUNTER_GATE_ROOT}"
|
||||
"${HUNTER_GATE_VERSION}"
|
||||
"${HUNTER_GATE_SHA1}"
|
||||
_hunter_self
|
||||
)
|
||||
|
||||
set(_master_location "${_hunter_self}/cmake/Hunter")
|
||||
if(EXISTS "${HUNTER_GATE_ROOT}/cmake/Hunter")
|
||||
# Hunter downloaded manually (e.g. by 'git clone')
|
||||
set(_unused "xxxxxxxxxx")
|
||||
set(HUNTER_GATE_SHA1 "${_unused}")
|
||||
set(HUNTER_GATE_VERSION "${_unused}")
|
||||
else()
|
||||
get_filename_component(_archive_id_location "${_hunter_self}/.." ABSOLUTE)
|
||||
set(_done_location "${_archive_id_location}/DONE")
|
||||
set(_sha1_location "${_archive_id_location}/SHA1")
|
||||
|
||||
# Check Hunter already downloaded by HunterGate
|
||||
if(NOT EXISTS "${_done_location}")
|
||||
hunter_gate_download("${_archive_id_location}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_done_location}")
|
||||
hunter_gate_internal_error("hunter_gate_download failed")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_sha1_location}")
|
||||
hunter_gate_internal_error("${_sha1_location} not found")
|
||||
endif()
|
||||
file(READ "${_sha1_location}" _sha1_value)
|
||||
string(TOLOWER "${_sha1_value}" _sha1_value_lower)
|
||||
string(TOLOWER "${HUNTER_GATE_SHA1}" _HUNTER_GATE_SHA1_lower)
|
||||
string(COMPARE EQUAL "${_sha1_value_lower}" "${_HUNTER_GATE_SHA1_lower}" _is_equal)
|
||||
if(NOT _is_equal)
|
||||
hunter_gate_internal_error(
|
||||
"Short SHA1 collision:"
|
||||
" ${_sha1_value} (from ${_sha1_location})"
|
||||
" ${HUNTER_GATE_SHA1} (HunterGate)"
|
||||
)
|
||||
endif()
|
||||
if(NOT EXISTS "${_master_location}")
|
||||
hunter_gate_user_error(
|
||||
"Master file not found:"
|
||||
" ${_master_location}"
|
||||
"try to update Hunter/HunterGate"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
include("${_master_location}")
|
||||
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
|
||||
endif()
|
||||
endmacro()
|
@ -1,143 +0,0 @@
|
||||
# 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")
|
@ -1,574 +0,0 @@
|
||||
# - Try to find precompiled headers support for GCC 3.4 and 4.x (and MSVC)
|
||||
# Once done this will define:
|
||||
#
|
||||
# Variable:
|
||||
# PCHSupport_FOUND
|
||||
#
|
||||
# ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp
|
||||
# ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use
|
||||
# ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp
|
||||
|
||||
IF(MSVC)
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
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 VERSION_LESS "4.2")
|
||||
SET(PCHSupport_FOUND FALSE)
|
||||
ELSE()
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
# TODO: make tests for other compilers than GCC
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
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)
|
||||
|
||||
# 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)
|
||||
|
||||
SET(_FLAGS ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}})
|
||||
SEPARATE_ARGUMENTS(_FLAGS)
|
||||
|
||||
LIST(APPEND PCH_FLAGS ${_FLAGS})
|
||||
|
||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||
|
||||
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)
|
||||
SET(_USE_PIC ON)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${DIRINC})
|
||||
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})
|
||||
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${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)
|
||||
SET(_FLAGS ${oldProps})
|
||||
SEPARATE_ARGUMENTS(_FLAGS)
|
||||
LIST(APPEND PCH_FLAGS ${_FLAGS})
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
|
||||
IF(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 PCH_INCLUDES "${item}")
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${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)
|
||||
|
||||
# create a command-line string
|
||||
STRING(REGEX REPLACE ";" " " PCH_FLAGS "${PCH_FLAGS}")
|
||||
|
||||
# and separate arguments
|
||||
SEPARATE_ARGUMENTS(PCH_FLAGS)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(GET_PDB_FILENAME _out_filename _target)
|
||||
# determine output directory based on target type
|
||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||
IF(${_targetType} STREQUAL EXECUTABLE)
|
||||
SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY)
|
||||
SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
|
||||
ELSE()
|
||||
SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
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()
|
||||
|
||||
SET(${_out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb")
|
||||
ENDMACRO(GET_PDB_FILENAME)
|
||||
|
||||
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()
|
||||
SET(pchsupport_compiler_cxx_arg1 "")
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC)
|
||||
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()
|
||||
SET(HEADER_FORMAT "c++-header")
|
||||
SET(_FLAGS)
|
||||
IF(APPLE)
|
||||
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
|
||||
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()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
||||
SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch")
|
||||
|
||||
IF(MSVC)
|
||||
FILE(MAKE_DIRECTORY ${_OUTPUT_DIR})
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
|
||||
SET(PCH_INPUT ${_input})
|
||||
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch")
|
||||
ELSE()
|
||||
IF(NOT "${_arch}" STREQUAL "")
|
||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT "${_language}" STREQUAL "")
|
||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}")
|
||||
ENDIF()
|
||||
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
||||
|
||||
# Copy .h to output dir
|
||||
SET(PCH_INPUT "${_OUTPUT_DIR}/${_name}")
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_INPUT}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_input} ${PCH_INPUT}
|
||||
DEPENDS ${_input}
|
||||
COMMENT "[${_targetName}] Update precompiled header - done"
|
||||
)
|
||||
|
||||
IF(CLANG)
|
||||
SET(PCH_EXT "pth")
|
||||
ELSE()
|
||||
SET(PCH_EXT "gch")
|
||||
ENDIF()
|
||||
|
||||
# For GCC and Clang, PCH needs to be in the same directory as .h
|
||||
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Add common flags
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC)
|
||||
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
|
||||
# Ninja PCH Support
|
||||
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES OBJECT_DEPENDS "${PCH_OUTPUT}")
|
||||
|
||||
# NMAKE-VS2012 Error LNK2011 (NMAKE-VS2010 do not complain)
|
||||
# we need to link the pch.obj file, see http://msdn.microsoft.com/en-us/library/3ay26wa2(v=vs.110).aspx
|
||||
GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS)
|
||||
IF(NOT _STATIC_LIBRARY_FLAGS)
|
||||
SET(_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()
|
||||
SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}")
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS})
|
||||
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
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS)
|
||||
LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT)
|
||||
|
||||
# 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()
|
||||
|
||||
IF(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()
|
||||
|
||||
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch")
|
||||
ENDIF()
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
|
||||
ENDMACRO()
|
||||
|
||||
# Add specific flags for an arch
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
|
||||
LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT)
|
||||
|
||||
IF(PCH_ARCHS_COUNT GREATER 1)
|
||||
GET_TARGET_PROPERTY(_FLAGS ${_targetName} COMPILE_FLAGS)
|
||||
|
||||
IF(${_FLAGS} MATCHES NOTFOUND)
|
||||
SET(_FLAGS "")
|
||||
ENDIF()
|
||||
|
||||
SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}")
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS})
|
||||
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()
|
||||
|
||||
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||
SET(_PCH_current_target ${_targetName})
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"This is the ADD_PRECOMPILED_HEADER macro. "
|
||||
"You must set CMAKE_BUILD_TYPE!"
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
PCH_SET_COMPILE_FLAGS(${_targetName})
|
||||
|
||||
IF(PCH_ARCHS)
|
||||
SET(PCH_OUTPUTS)
|
||||
FOREACH(_ARCH ${PCH_ARCHS})
|
||||
STRING(TOUPPER "${_ARCH}" _UPPER_ARCH)
|
||||
|
||||
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_INCLUDES}")
|
||||
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH})
|
||||
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH})
|
||||
ENDFOREACH()
|
||||
ELSE()
|
||||
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "")
|
||||
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
|
||||
|
||||
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}" "${PCH_INCLUDES}")
|
||||
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch)
|
||||
ENDIF()
|
||||
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName})
|
||||
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}")
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||
IF(PCHSupport_FOUND)
|
||||
# 0 => creating a new target for PCH, works for all makefiles
|
||||
# 1 => setting PCH for VC++ project, works for VC++ projects
|
||||
# 2 => setting PCH for XCode project, works for XCode projects
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
SET(PCH_METHOD 1)
|
||||
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
SET(PCH_METHOD 2)
|
||||
ELSE()
|
||||
SET(PCH_METHOD 0)
|
||||
ENDIF()
|
||||
|
||||
IF(PCH_METHOD EQUAL 1)
|
||||
# Auto include the precompile (useful for moc processing, since the use of
|
||||
# precompiled is specified at the target level
|
||||
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
|
||||
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF()
|
||||
|
||||
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
||||
|
||||
#also inlude ${oldProps} to have the same compile options
|
||||
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"")
|
||||
ELSEIF(PCH_METHOD EQUAL 2)
|
||||
# For Xcode, cmake needs my patch to process
|
||||
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
|
||||
|
||||
# When buiding out of the tree, precompiled may not be located
|
||||
# Use full path instead.
|
||||
GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE)
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
||||
ELSE()
|
||||
#Fallback to the "old" precompiled suppport
|
||||
IF(CMAKE_OSX_ARCHITECTURES AND TARGETS_COUNT GREATER 1)
|
||||
FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES})
|
||||
ADD_PRECOMPILED_HEADER(${_targetName}_${_ARCH} ${_inputh} ${_inputcpp})
|
||||
ENDFOREACH()
|
||||
ELSE()
|
||||
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(TARGET ${_targetName}_static)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
@ -1,193 +0,0 @@
|
||||
# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
|
||||
# files which are included with CMake 2.8.4
|
||||
# It has been altered for iOS development
|
||||
#
|
||||
# Options:
|
||||
#
|
||||
# IOS_VERSION = last(default) or specific one (4.3, 5.0, 4.1)
|
||||
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
|
||||
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
|
||||
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
|
||||
#
|
||||
# IOS_PLATFORM = OS (default) or SIMULATOR or ALL
|
||||
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
|
||||
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
|
||||
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
|
||||
#
|
||||
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
|
||||
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
|
||||
# If set manually, it will override the default location and force the user of a particular Developer Platform
|
||||
#
|
||||
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
|
||||
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
|
||||
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
|
||||
# If set manually, this will force the use of a specific SDK version
|
||||
|
||||
IF(DEFINED CMAKE_CROSSCOMPILING)
|
||||
# subsequent toolchain loading is not really needed
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
# Standard settings
|
||||
SET(CMAKE_SYSTEM_NAME Darwin)
|
||||
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Darwin version
|
||||
SET(UNIX ON)
|
||||
SET(APPLE ON)
|
||||
SET(IOS ON)
|
||||
|
||||
# Setup iOS platform
|
||||
IF(NOT DEFINED IOS_PLATFORM)
|
||||
SET(IOS_PLATFORM "OS")
|
||||
ENDIF()
|
||||
|
||||
SET(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
||||
|
||||
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
||||
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||
|
||||
# Check the platform selection and setup for developer root
|
||||
if(${IOS_PLATFORM} STREQUAL "OS")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
||||
elseif(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
||||
elseif(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
|
||||
else()
|
||||
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
|
||||
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_DEFAULT_ROOT "/Applications/Xcode.app/Contents")
|
||||
|
||||
IF(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")
|
||||
|
||||
MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
|
||||
FILE(GLOB _CMAKE_IOS_SDKS "${ROOT}/SDKs/iPhoneOS*")
|
||||
IF(_CMAKE_IOS_SDKS)
|
||||
LIST(SORT _CMAKE_IOS_SDKS)
|
||||
LIST(REVERSE _CMAKE_IOS_SDKS)
|
||||
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
|
||||
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
|
||||
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Find and use the most recent iOS sdk
|
||||
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
# Search for a specific version of a SDK
|
||||
GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} IOS_VERSIONS)
|
||||
|
||||
IF(NOT IOS_VERSIONS)
|
||||
MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
|
||||
ENDIF()
|
||||
|
||||
IF(IOS_VERSION)
|
||||
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
|
||||
IF(_INDEX EQUAL -1)
|
||||
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
|
||||
ELSE()
|
||||
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
|
||||
SET(IOS_SDK_VERSION ${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()
|
||||
|
||||
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
|
||||
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK")
|
||||
|
||||
SET(IOS_VERSION ${IOS_VERSION} CACHE STRING "iOS target version")
|
||||
|
||||
# Set the sysroot default to the most recent SDK
|
||||
SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
|
||||
SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES Xcode)
|
||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
SET(ARCHS armv7 arm64)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "arm64")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
# iPhone simulator targets x86_64
|
||||
SET(ARCHS "x86_64")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
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
|
||||
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} ${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 up the default search directories for frameworks
|
||||
SET(CMAKE_SYSTEM_FRAMEWORK_PATH
|
||||
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
|
||||
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
|
||||
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
|
||||
)
|
||||
|
||||
# only search the iOS sdks, not the remainder of the host filesystem
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM 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)
|
||||
|
||||
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
|
||||
INCLUDE(CMakeFindBinUtils)
|
File diff suppressed because it is too large
Load Diff
@ -1,661 +0,0 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
@ -1,7 +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.
|
||||
|
||||
|
||||
|
||||
|
||||
Ryzom Core is open source and released under the terms of the GNU Affero General Public License 3.0 (GNU/AGPLv3) for the source code and the Creative Commons Attributions-ShareAlike 3.0 (CC-BY-SA) for the art assets. Which means you can create your own game using Ryzom Core, for more information on doing so check out Creating Your Own Game Using Ryzom Core.
|
||||
Ryzom Core is open source and released under the terms of the GNU Affero General Public License 3.0 (GNU/AGPLv3) for the source code and the Creative Commons Attributions-ShareAlike 3.0 (CC-BY-SA) for the art assets. Which means you can create your own game using Ryzom Core, for more information on doing so check out Creating Your Own Game Using Ryzom Core.
|
@ -1,164 +0,0 @@
|
||||
jobs:
|
||||
- job: ubuntu18
|
||||
timeoutInMinutes: 120
|
||||
pool:
|
||||
vmImage: 'ubuntu-18.04'
|
||||
steps:
|
||||
- script: |
|
||||
sudo apt update
|
||||
sudo apt install -y software-properties-common
|
||||
# sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||
sudo apt update
|
||||
sudo apt install cmake build-essential -y
|
||||
sudo apt 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 install bison autoconf automake -y
|
||||
sudo apt install libpng-dev -y
|
||||
sudo apt install libjpeg-dev -y
|
||||
sudo apt install libgif-dev libfreetype6-dev -y
|
||||
sudo apt install freeglut3-dev -y
|
||||
sudo apt install liblua5.2-dev libluabind-dev libcpptest-dev -y
|
||||
sudo apt install libogg-dev libvorbis-dev libopenal-dev -y
|
||||
sudo apt install libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev -y
|
||||
sudo apt install libmysqlclient-dev -y
|
||||
sudo apt install libxml2-dev -y
|
||||
sudo apt install libcurl4-openssl-dev libssl-dev -y
|
||||
sudo apt install libsquish-dev -y
|
||||
sudo apt install liblzma-dev -y
|
||||
sudo apt install libgsf-1-dev -y
|
||||
sudo apt 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=OFF -DWITH_LUA52=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 ..
|
||||
cat CMakeCache.txt
|
||||
displayName: 'CMake'
|
||||
- script: |
|
||||
cd build
|
||||
make -j`nproc`
|
||||
displayName: 'Make'
|
||||
- job: ubuntu20
|
||||
timeoutInMinutes: 120
|
||||
pool:
|
||||
vmImage: 'ubuntu-20.04'
|
||||
steps:
|
||||
- script: |
|
||||
sudo apt update
|
||||
sudo apt install -y software-properties-common
|
||||
sudo apt update
|
||||
sudo apt install cmake build-essential -y
|
||||
sudo apt install bison autoconf automake -y
|
||||
sudo apt install libpng-dev -y
|
||||
sudo apt install libjpeg-dev -y
|
||||
sudo apt install libgif-dev libfreetype6-dev -y
|
||||
sudo apt install freeglut3-dev -y
|
||||
sudo apt install liblua5.2-dev libluabind-dev libcpptest-dev -y
|
||||
sudo apt install libogg-dev libvorbis-dev libopenal-dev -y
|
||||
sudo apt install libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev -y
|
||||
sudo apt install libmysqlclient-dev -y
|
||||
sudo apt install libxml2-dev -y
|
||||
sudo apt install libcurl4-openssl-dev libssl-dev -y
|
||||
sudo apt install libsquish-dev -y
|
||||
sudo apt install liblzma-dev -y
|
||||
sudo apt install libgsf-1-dev -y
|
||||
sudo apt 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=OFF -DWITH_LUA52=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 ..
|
||||
cat CMakeCache.txt
|
||||
displayName: 'CMake'
|
||||
- script: |
|
||||
cd build
|
||||
make -j`nproc`
|
||||
displayName: 'Make'
|
||||
- job: windows2019
|
||||
timeoutInMinutes: 120
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- checkout: self
|
||||
fetchDepth: 1
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: 'hunter-win2019-x64-rel'
|
||||
path: "c:/.hunter/_Base/Cache"
|
||||
- task: CmdLine@2
|
||||
inputs:
|
||||
script: |
|
||||
aria2c https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
|
||||
7z x DXSDK_Jun10.exe -oC:\ -r -y
|
||||
del DXSDK_Jun10.exe
|
||||
- task: CMake@1
|
||||
inputs:
|
||||
workingDirectory: build.release
|
||||
cmakeArgs: '-DCMAKE_CONFIGURATION_TYPES=Release -DHUNTER_ENABLED=ON -DHUNTER_CONFIGURATION_TYPES=Release -DFINAL_VERSION=OFF -DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_NEL_TOOLS=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_DRIVER_OPENGL=ON -DWITH_DRIVER_OPENAL=ON -DWITH_DRIVER_DIRECT3D=ON -DWITH_DRIVER_XAUDIO2=ON -DDXSDK_DIR=C:/DXSDK ..'
|
||||
- task: MSBuild@1
|
||||
inputs:
|
||||
solution: build.release/ALL_BUILD.vcxproj
|
||||
maximumCpuCount: true
|
||||
configuration: release
|
||||
platform: 'x64'
|
||||
- job: ubuntu18hunter
|
||||
timeoutInMinutes: 120
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- checkout: self
|
||||
fetchDepth: 0
|
||||
- script: |
|
||||
sudo apt-get update
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libasound2-dev libgl1-mesa-dev libjack-dev libpulse-dev libxrandr-dev libxrender-dev libxxf86vm-dev
|
||||
displayName: 'Dependencies'
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: 'hunter317-ubuntu18-rel"'
|
||||
path: "$(Pipeline.Workspace)/.hunter/_Base/Cache"
|
||||
- script: |
|
||||
mkdir build.release
|
||||
cmake --version
|
||||
cd build.release
|
||||
unset SYSTEM
|
||||
export MAKEFLAGS=-j`nproc`
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DHUNTER_ENABLED=ON -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_ROOT="$(Pipeline.Workspace)/.hunter" -DFINAL_VERSION=OFF -DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_NEL_TOOLS=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_DRIVER_OPENGL=ON -DWITH_DRIVER_OPENAL=ON ..
|
||||
displayName: 'CMake, release'
|
||||
- script: |
|
||||
cd build.release
|
||||
make -j`nproc`
|
||||
displayName: 'Make, release'
|
||||
#- task: PublishPipelineArtifact@1
|
||||
# inputs:
|
||||
# targetPath: build.release/bin
|
||||
# artifactName: RyzomUbuntu18Release
|
||||
- job: macOS11
|
||||
timeoutInMinutes: 120
|
||||
pool:
|
||||
vmImage: 'macOS-11'
|
||||
steps:
|
||||
- checkout: self
|
||||
fetchDepth: 0
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: 'hunter317-macOS11-rel"'
|
||||
path: "$(Pipeline.Workspace)/.hunter/_Base/Cache"
|
||||
- task: CMake@1
|
||||
inputs:
|
||||
workingDirectory: build.release
|
||||
cmakeArgs: '-GXcode -DCMAKE_CONFIGURATION_TYPES=Release -DHUNTER_ENABLED=ON -DHUNTER_STATUS_DEBUG=ON -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_ROOT="$(Pipeline.Workspace)/.hunter" -DWITH_LIBXML2_ICONV=OFF -DFINAL_VERSION=OFF -DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_NEL_TOOLS=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_DRIVER_OPENGL=ON -DWITH_DRIVER_OPENAL=ON -DWITH_DRIVER_DIRECT3D=OFF -DWITH_DRIVER_XAUDIO2=OFF ..'
|
||||
- task: Xcode@5
|
||||
inputs:
|
||||
actions: 'build'
|
||||
configuration: Release
|
||||
sdk: macosx12.0
|
||||
xcWorkspacePath: 'build.release/RyzomCore.xcodeproj'
|
||||
scheme: 'ALL_BUILD'
|
||||
packageApp: false
|
||||
#- task: PublishPipelineArtifact@1
|
||||
# inputs:
|
||||
# targetPath: build.release/bin/
|
||||
# artifactName: RyzomClientMacOS11Release
|
@ -0,0 +1,325 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Ryzom Core
|
||||
# Authors: Nevrax and the Ryzom Core Community
|
||||
# Version: 0.12.0
|
||||
#
|
||||
# Notes:
|
||||
# * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path
|
||||
# * Changing specific install location variables:
|
||||
# * NL_ETC_PREFIX (default: $CMAKE_INSTALL_PREFIX/etc)
|
||||
# * NL_SHARE_PREFIX (default: $CMAKE_INSTALL_PREFIX/share)
|
||||
# * NL_BIN_PREFIX (default: $CMAKE_INSTALL_PREFIX/bin)
|
||||
# * NL_SBIN_PREFIX (default: $CMAKE_INSTALL_PREFIX/sbin)
|
||||
# * NL_LIB_PREFIX (default: $CMAKE_INSTALL_PREFIX/lib)
|
||||
# * NL_DRIVER_PREFIX (default: $CMAKE_INSTALL_PREFIX/lib (windows) or $CMAKE_INSTALL_PREFIX/lib/nel)
|
||||
# * Enable building of documentation: add -DBUILD_DOCUMENTATION:BOOL=ON - new make target: DoxygenDoc
|
||||
# * Updating version: update header (above) but also update NL_VERSION below.
|
||||
# * To build binary archive, use the 'package' target.
|
||||
# To build source archive, use the 'package_source' target.
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Load some macros.
|
||||
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set CMake 2.6 Policies.
|
||||
IF(COMMAND cmake_policy)
|
||||
# Works around warnings libraries linked against that don't
|
||||
# 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)
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
|
||||
|
||||
# Force out of source builds.
|
||||
CHECK_OUT_OF_SOURCE()
|
||||
|
||||
# To be able to specify a different deployment target on Mac OS X :
|
||||
# export MACOSX_DEPLOYMENT_TARGET=10.6
|
||||
|
||||
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}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Redirect output files
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
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)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
ENDIF(WIN32)
|
||||
|
||||
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)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set default config options
|
||||
#
|
||||
NL_SETUP_DEFAULT_OPTIONS()
|
||||
NL_SETUP_NEL_DEFAULT_OPTIONS()
|
||||
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()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#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)
|
||||
|
||||
FIND_PACKAGE(LibXml2 REQUIRED)
|
||||
FIND_PACKAGE(PNG REQUIRED)
|
||||
FIND_PACKAGE(Jpeg)
|
||||
|
||||
IF(WITH_STATIC_LIBXML2)
|
||||
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
|
||||
ENDIF(WITH_STATIC_LIBXML2)
|
||||
|
||||
IF(WITH_LIBXML2_ICONV)
|
||||
FIND_PACKAGE(Iconv REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
|
||||
ENDIF(WITH_LIBXML2_ICONV)
|
||||
|
||||
IF(WITH_STATIC)
|
||||
# libxml2 could need winsock2 library
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
|
||||
|
||||
# on Mac OS X libxml2 requires iconv and liblzma
|
||||
IF(APPLE)
|
||||
FIND_PACKAGE(LibLZMA REQUIRED)
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
|
||||
ENDIF(APPLE)
|
||||
ENDIF(WITH_STATIC)
|
||||
|
||||
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
|
||||
|
||||
IF(FINAL_VERSION)
|
||||
ADD_DEFINITIONS(-DFINAL_VERSION=1)
|
||||
ENDIF(FINAL_VERSION)
|
||||
|
||||
IF(WITH_SSE2)
|
||||
ADD_DEFINITIONS(-DNL_HAS_SSE2)
|
||||
IF(WITH_SSE3)
|
||||
ADD_DEFINITIONS(-DNL_HAS_SSE3)
|
||||
ENDIF(WITH_SSE3)
|
||||
ENDIF(WITH_SSE2)
|
||||
|
||||
IF(WITH_QT)
|
||||
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
|
||||
ENDIF(WITH_QT)
|
||||
|
||||
IF(WITH_NEL)
|
||||
IF(WITH_NEL_TESTS)
|
||||
FIND_PACKAGE(CppTest)
|
||||
ENDIF(WITH_NEL_TESTS)
|
||||
|
||||
IF(WITH_GUI)
|
||||
FIND_PACKAGE(Libwww REQUIRED)
|
||||
FIND_PACKAGE(Luabind REQUIRED)
|
||||
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)
|
||||
SET(CURL_STATIC OFF)
|
||||
ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
|
||||
|
||||
IF(CURL_STATIC)
|
||||
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
|
||||
|
||||
FIND_PACKAGE(OpenSSL QUIET)
|
||||
|
||||
IF(OPENSSL_FOUND)
|
||||
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
|
||||
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
|
||||
ENDIF(OPENSSL_FOUND)
|
||||
|
||||
# CURL Macports version depends on libidn, libintl and libiconv too
|
||||
IF(APPLE)
|
||||
FIND_LIBRARY(IDN_LIBRARY idn)
|
||||
FIND_LIBRARY(INTL_LIBRARY intl)
|
||||
|
||||
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY})
|
||||
ENDIF(APPLE)
|
||||
ENDIF(CURL_STATIC)
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/3rdparty)
|
||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
||||
ADD_SUBDIRECTORY(nel)
|
||||
ENDIF(WITH_NEL)
|
||||
|
||||
IF(WITH_RYZOM)
|
||||
ADD_SUBDIRECTORY(ryzom)
|
||||
ENDIF(WITH_RYZOM)
|
||||
|
||||
IF(WITH_NELNS)
|
||||
ADD_SUBDIRECTORY(nelns)
|
||||
ENDIF(WITH_NELNS)
|
||||
|
||||
IF(WITH_SNOWBALLS)
|
||||
ADD_SUBDIRECTORY(snowballs2)
|
||||
ENDIF(WITH_SNOWBALLS)
|
||||
|
||||
IF(WITH_TOOLS)
|
||||
ADD_SUBDIRECTORY(tool)
|
||||
ENDIF(WITH_TOOLS)
|
||||
|
||||
IF(WITH_STUDIO)
|
||||
ADD_SUBDIRECTORY(studio)
|
||||
ENDIF(WITH_STUDIO)
|
||||
|
||||
# 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)
|
||||
SET(HAVE_DOT NO)
|
||||
ENDIF(DOT)
|
||||
# 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)
|
||||
|
||||
IF(WITH_NEL_TESTS)
|
||||
ENABLE_TESTING()
|
||||
ADD_TEST(nel_unit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nel_unit_test --html)
|
||||
IF(BUILD_DASHBOARD)
|
||||
INCLUDE(Dart)
|
||||
SET(SVNCOMMAND svn)
|
||||
SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel)
|
||||
SET(GENERATELOGS svn2cl)
|
||||
ENDIF(BUILD_DASHBOARD)
|
||||
ENDIF(WITH_NEL_TESTS)
|
||||
|
||||
# packaging information
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework")
|
||||
SET(CPACK_PACKAGE_VENDOR "Ryzom Core")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
|
||||
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
|
||||
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
|
||||
SET(CPACK_PACKAGE_EXECUTABLES "ryzomcore${NL_VERSION}" "ryzomcore")
|
||||
SET(CPACK_SET_DESTDIR TRUE)
|
||||
|
||||
# NSIS Specific Packing Setup
|
||||
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "RyzomCore")
|
||||
SET(CPACK_NSIS_MODIFY_PATH "ON")
|
||||
SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
|
||||
SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
|
||||
SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
|
||||
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} RyzomCore")
|
||||
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
|
||||
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
|
||||
SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
|
||||
|
||||
## Source Packages
|
||||
SET(CPACK_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
|
||||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
|
||||
IF(WIN32)
|
||||
#SET(CPACK_GENERATOR "NSIS")
|
||||
SET(CPACK_GENERATOR "NSIS;ZIP")
|
||||
SET(CPACK_SOURCE_GENERATOR "ZIP")
|
||||
ELSE(WIN32)
|
||||
SET(CPACK_GENERATOR "TGZ")
|
||||
SET(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
ENDIF(WIN32)
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
"~$"
|
||||
"\\\\.cvsignore$"
|
||||
"^${CMAKE_SOURCE_DIR}.*/CVS/"
|
||||
"^${CMAKE_SOURCE_DIR}.*/\\\\.svn/"
|
||||
"^${CMAKE_SOURCE_DIR}/debian/"
|
||||
"^${CMAKE_SOURCE_DIR}/old/")
|
||||
IF(WIN32)
|
||||
IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
|
||||
IF(WITH_QT)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
INSTALL(FILES
|
||||
"${QT_LIBRARY_DIR}/../bin/QtGuid4.dll"
|
||||
"${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")
|
||||
IF(WITH_QT)
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
INSTALL(FILES
|
||||
"${QT_LIBRARY_DIR}/../bin/QtGui4.dll"
|
||||
"${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")
|
||||
|
||||
# Install CEGUI and its dependencies.
|
||||
IF(WITH_NEL_CEGUI)
|
||||
INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIBase.dll" DESTINATION ${NL_BIN_PREFIX})
|
||||
INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIDevilImageCodec.dll" DESTINATION ${NL_BIN_PREFIX})
|
||||
INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIExpatParser.dll" DESTINATION ${NL_BIN_PREFIX})
|
||||
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)
|
||||
|
||||
# Only the tools require MFC.
|
||||
IF(WITH_TOOLS)
|
||||
SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
|
||||
ENDIF(WITH_TOOLS)
|
||||
#INCLUDE(InstallRequiredSystemLibraries)
|
||||
ENDIF(WIN32)
|
||||
|
||||
INCLUDE(CPack)
|
||||
|
||||
INCLUDE(CMakePackaging.txt)
|
||||
|
||||
## Debian Packages
|
||||
#INCLUDE(UseDebian)
|
||||
#IF(DEBIAN_FOUND)
|
||||
# ADD_DEBIAN_TARGETS(nel)
|
||||
#ENDIF(DEBIAN_FOUND)
|
@ -0,0 +1,198 @@
|
||||
IF(DEFINED CMAKE_CROSSCOMPILING)
|
||||
# subsequent toolchain loading is not really needed
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
# Standard settings
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Linux version
|
||||
SET(UNIX ON)
|
||||
SET(LINUX ON)
|
||||
SET(ANDROID ON)
|
||||
|
||||
IF(NOT NDK_ROOT)
|
||||
SET(NDK_ROOT $ENV{NDK_ROOT})
|
||||
|
||||
IF(CMAKE_HOST_WIN32)
|
||||
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
|
||||
ENDIF(CMAKE_HOST_WIN32)
|
||||
ENDIF(NOT NDK_ROOT)
|
||||
|
||||
IF(NOT TARGET_CPU)
|
||||
SET(TARGET_CPU "armv7")
|
||||
ENDIF(NOT TARGET_CPU)
|
||||
|
||||
IF(TARGET_CPU STREQUAL "armv7")
|
||||
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
SET(TOOLCHAIN_ARCH "arm")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "arm")
|
||||
SET(MINIMUM_NDK_TARGET 4)
|
||||
ELSEIF(TARGET_CPU STREQUAL "armv5")
|
||||
SET(LIBRARY_ARCHITECTURE "armeabi")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
|
||||
SET(TOOLCHAIN_ARCH "arm")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "arm")
|
||||
SET(MINIMUM_NDK_TARGET 4)
|
||||
ELSEIF(TARGET_CPU STREQUAL "x86")
|
||||
SET(LIBRARY_ARCHITECTURE "x86")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
SET(TOOLCHAIN_ARCH "x86")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "x86")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "i686")
|
||||
SET(MINIMUM_NDK_TARGET 9)
|
||||
ELSEIF(TARGET_CPU STREQUAL "mips")
|
||||
SET(LIBRARY_ARCHITECTURE "mips")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "mips")
|
||||
SET(TOOLCHAIN_ARCH "mips")
|
||||
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
|
||||
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
|
||||
SET(MINIMUM_NDK_TARGET 9)
|
||||
ENDIF(TARGET_CPU STREQUAL "armv7")
|
||||
|
||||
SET(ANDROID_COMPILER "GCC")
|
||||
|
||||
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
|
||||
SET(ANDROID_COMPILER "clang")
|
||||
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
|
||||
SET(CLANG ON)
|
||||
ELSE()
|
||||
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
|
||||
ENDIF()
|
||||
|
||||
IF(NOT NDK_TARGET)
|
||||
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
|
||||
ENDIF(NOT NDK_TARGET)
|
||||
|
||||
IF(CMAKE_HOST_WIN32)
|
||||
SET(TOOLCHAIN_HOST "windows")
|
||||
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
|
||||
ELSEIF(CMAKE_HOST_APPLE)
|
||||
SET(TOOLCHAIN_HOST "apple")
|
||||
SET(TOOLCHAIN_BIN_SUFFIX "")
|
||||
ELSEIF(CMAKE_HOST_UNIX)
|
||||
SET(TOOLCHAIN_HOST "linux")
|
||||
SET(TOOLCHAIN_BIN_SUFFIX "")
|
||||
ENDIF(CMAKE_HOST_WIN32)
|
||||
|
||||
MACRO(SEARCH_TOOLCHAIN _COMPILER)
|
||||
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
|
||||
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${${_COMPILER}_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})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS)
|
||||
MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains")
|
||||
ENDIF()
|
||||
|
||||
IF(${_COMPILER}_TOOLCHAIN_VERSIONS)
|
||||
LIST(FIND ${_COMPILER}_TOOLCHAIN_VERSIONS "${${_COMPILER}_TOOLCHAIN_VERSION}" _INDEX)
|
||||
IF(_INDEX EQUAL -1)
|
||||
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
|
||||
ENDIF()
|
||||
|
||||
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
|
||||
|
||||
IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}")
|
||||
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
|
||||
IF(_TOOLCHAIN_PREFIXES)
|
||||
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
|
||||
ENDIF(_TOOLCHAIN_PREFIXES)
|
||||
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}")
|
||||
|
||||
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
|
||||
|
||||
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
|
||||
|
||||
# include dirs
|
||||
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
|
||||
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
|
||||
|
||||
IF(EXISTS "${STL_DIR}/${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)
|
||||
|
||||
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
|
||||
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
|
||||
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
|
||||
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
|
||||
|
||||
MESSAGE(STATUS "STL include dir: ${STL_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS "STL library dir: ${STL_LIBRARY_DIR}")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${CLANG_TOOLCHAIN_ROOT} ${GCC_TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
|
||||
IF("${_BINARY}" MATCHES "clang")
|
||||
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
|
||||
ELSE()
|
||||
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
|
||||
ENDIF()
|
||||
ENDMACRO(SET_TOOLCHAIN_BINARY)
|
||||
|
||||
# Force the compilers to GCC for Android
|
||||
include (CMakeForceCompiler)
|
||||
|
||||
IF(CLANG)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
|
||||
|
||||
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
|
||||
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
|
||||
|
||||
MESSAGE(STATUS "Using clang compiler")
|
||||
ELSE()
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
|
||||
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
|
||||
|
||||
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
|
||||
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
|
||||
|
||||
MESSAGE(STATUS "Using GCC compiler")
|
||||
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)
|
@ -0,0 +1,79 @@
|
||||
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)
|
||||
|
||||
# 3D drivers
|
||||
IF(WITH_DRIVER_OPENGL)
|
||||
SET(NL_OPENGL_AVAILABLE 1)
|
||||
ENDIF(WITH_DRIVER_OPENGL)
|
||||
|
||||
IF(WITH_DRIVER_OPENGLES)
|
||||
SET(NL_OPENGLES_AVAILABLE 1)
|
||||
ENDIF(WITH_DRIVER_OPENGLES)
|
||||
|
||||
IF(WITH_DRIVER_DIRECT3D)
|
||||
SET(NL_DIRECT3D_AVAILABLE 1)
|
||||
ENDIF(WITH_DRIVER_DIRECT3D)
|
||||
|
||||
# sound drivers
|
||||
IF(WITH_DRIVER_FMOD)
|
||||
SET(NL_FMOD_AVAILABLE 1)
|
||||
ENDIF(WITH_DRIVER_FMOD)
|
||||
|
||||
IF(WITH_DRIVER_OPENAL)
|
||||
SET(NL_OPENAL_AVAILABLE 1)
|
||||
ENDIF(WITH_DRIVER_OPENAL)
|
||||
|
||||
IF(WITH_DRIVER_DSOUND)
|
||||
SET(NL_DSOUND_AVAILABLE 1)
|
||||
ENDIF(WITH_DRIVER_DSOUND)
|
||||
|
||||
IF(WITH_DRIVER_XAUDIO2)
|
||||
SET(NL_XAUDIO2_AVAILABLE 1)
|
||||
ENDIF(WITH_DRIVER_XAUDIO2)
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
||||
ENDMACRO(NL_CONFIGURE_CHECKS)
|
@ -0,0 +1,82 @@
|
||||
# - Find DirectInput
|
||||
# Find the DirectSound includes and libraries
|
||||
#
|
||||
# MAXSDK_DIR - 3DSMAX SDK root directory
|
||||
# MAXSDK_INCLUDE_DIR - where to find baseinterface.h
|
||||
# MAXSDK_LIBRARIES - List of libraries when using 3DSMAX.
|
||||
# MAXSDK_FOUND - True if MAX SDK found.
|
||||
|
||||
if(MAXSDK_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(MAXSDK_FIND_QUIETLY TRUE)
|
||||
endif(MAXSDK_INCLUDE_DIR)
|
||||
|
||||
FIND_PATH(MAXSDK_DIR
|
||||
"include/maxversion.h"
|
||||
HINTS
|
||||
"$ENV{MAXSDK_DIR}"
|
||||
PATHS
|
||||
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
|
||||
"$ENV{3DSMAX_2011_SDK_PATH}/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"
|
||||
)
|
||||
|
||||
FIND_PATH(MAXSDK_INCLUDE_DIR
|
||||
max.h
|
||||
HINTS
|
||||
${MAXSDK_DIR}/include
|
||||
)
|
||||
|
||||
FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
|
||||
HINTS
|
||||
${MAXSDK_DIR}/include/CS
|
||||
)
|
||||
|
||||
IF(TARGET_X64)
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
|
||||
ELSE(TARGET_X64)
|
||||
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
FIND_LIBRARY(${MYLIBRARY}
|
||||
NAMES ${MYLIBRARYNAME}
|
||||
HINTS
|
||||
${MAXSDK_LIBRARY_DIRS}
|
||||
)
|
||||
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
|
||||
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom)
|
||||
FIND_3DS_LIBRARY(MAXSDK_GFX_LIBRARY gfx)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MESH_LIBRARY mesh)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MAXUTIL_LIBRARY maxutil)
|
||||
FIND_3DS_LIBRARY(MAXSDK_MAXSCRIPT_LIBRARY maxscrpt)
|
||||
FIND_3DS_LIBRARY(MAXSDK_PARAMBLK2_LIBRARY paramblk2)
|
||||
FIND_3DS_LIBRARY(MAXSDK_BMM_LIBRARY bmm)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set MAXSDK_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MAXSDK DEFAULT_MSG
|
||||
MAXSDK_INCLUDE_DIR MAXSDK_CORE_LIBRARY)
|
||||
|
||||
if(MAXSDK_FOUND)
|
||||
SET(MAXSDK_LIBRARIES
|
||||
${MAXSDK_CORE_LIBRARY}
|
||||
${MAXSDK_GEOM_LIBRARY}
|
||||
${MAXSDK_GFX_LIBRARY}
|
||||
${MAXSDK_MESH_LIBRARY}
|
||||
${MAXSDK_MAXUTIL_LIBRARY}
|
||||
${MAXSDK_MAXSCRIPT_LIBRARY}
|
||||
${MAXSDK_PARAMBLK2_LIBRARY}
|
||||
${MAXSDK_BMM_LIBRARY} )
|
||||
|
||||
else(MAXSDK_FOUND)
|
||||
set(MAXSDK_LIBRARIES)
|
||||
endif(MAXSDK_FOUND)
|
||||
|
||||
mark_as_advanced(MAXSDK_INCLUDE_DIR MAXSDK_LIBRARY)
|
@ -0,0 +1,57 @@
|
||||
# - 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
|
||||
)
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
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)
|
@ -0,0 +1,190 @@
|
||||
#
|
||||
# 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,181 @@
|
||||
# - Locate Luabind library
|
||||
# This module defines
|
||||
# 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.
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
IF(LUALIB_FOUND)
|
||||
MESSAGE(STATUS "Luabind is using Lua 5.1")
|
||||
FIND_PACKAGE(Lua51 REQUIRED)
|
||||
ELSE(LUALIB_FOUND)
|
||||
SET(LUA50_LIBRARY "liblua5.0")
|
||||
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND)
|
||||
|
||||
IF(LUALIB_FOUND)
|
||||
MESSAGE(STATUS "Luabind is using Lua 5.0")
|
||||
FIND_PACKAGE(Lua50 REQUIRED)
|
||||
ELSE(LUALIB_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind")
|
||||
ENDIF(LUALIB_FOUND)
|
||||
ENDIF(LUALIB_FOUND)
|
||||
ENDIF(LUALIB_FOUND)
|
||||
ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
||||
# TODO: find a way to detect Lua version
|
||||
IF(WITH_LUA52)
|
||||
FIND_PACKAGE(Lua52 REQUIRED)
|
||||
ELSEIF(WITH_LUA51)
|
||||
FIND_PACKAGE(Lua51 REQUIRED)
|
||||
ELSE(WITH_LUA52)
|
||||
FIND_PACKAGE(Lua50 REQUIRED)
|
||||
ENDIF(WITH_LUA52)
|
||||
ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
||||
ENDMACRO(FIND_CORRECT_LUA_VERSION)
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
SET(LIBRARY_NAME_RELEASE)
|
||||
SET(LIBRARY_NAME_DEBUG)
|
||||
|
||||
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)
|
||||
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_LUA51)
|
||||
IF(WITH_STLPORT)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua51)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua51d)
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua51)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua51d)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_LUA50)
|
||||
IF(WITH_STLPORT)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua50)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua50d)
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua50)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua50d)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport)
|
||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlportd)
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
# 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(Boost REQUIRED)
|
||||
|
||||
IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
|
||||
IF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
|
||||
# Case where both Release and Debug versions are provided
|
||||
SET(LUABIND_FOUND TRUE)
|
||||
SET(LUABIND_LIBRARIES optimized ${LUABIND_LIBRARY_RELEASE} debug ${LUABIND_LIBRARY_DEBUG})
|
||||
ELSEIF(LUABIND_LIBRARY_RELEASE)
|
||||
# Normal case
|
||||
SET(LUABIND_FOUND TRUE)
|
||||
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_RELEASE})
|
||||
ELSEIF(LUABIND_LIBRARY_DEBUG)
|
||||
# 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)
|
||||
|
||||
IF(LUABIND_FOUND)
|
||||
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
|
||||
# Check if luabind/version.hpp exists
|
||||
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)
|
||||
|
||||
FIND_CORRECT_LUA_VERSION()
|
||||
|
||||
IF(NOT Luabind_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
|
||||
ENDIF(NOT Luabind_FIND_QUIETLY)
|
||||
ELSE(LUABIND_FOUND)
|
||||
IF(NOT Luabind_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find Luabind!")
|
||||
ENDIF(NOT Luabind_FIND_QUIETLY)
|
||||
ENDIF(LUABIND_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)
|
@ -0,0 +1,101 @@
|
||||
# - Find MS Visual C++
|
||||
#
|
||||
# VC_INCLUDE_DIR - where to find headers
|
||||
# VC_INCLUDE_DIRS - where to find headers
|
||||
# VC_LIBRARY_DIR - where to find libraries
|
||||
# VC_FOUND - True if MSVC found.
|
||||
|
||||
MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
|
||||
# Software/Wow6432Node/...
|
||||
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE)
|
||||
|
||||
IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
SET(VC${_VERSION}_DIR)
|
||||
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE)
|
||||
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
|
||||
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
|
||||
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
|
||||
SET(VC${_VERSION}_FOUND ON)
|
||||
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)
|
||||
SET(VC_FOUND ON)
|
||||
SET(VC_DIR "${VC${_VERSION}_DIR}")
|
||||
ENDIF(VC${_VERSION}_FOUND)
|
||||
ENDMACRO(DETECT_VC_VERSION)
|
||||
|
||||
MACRO(DETECT_EXPRESS_VERSION _VERSION)
|
||||
GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE)
|
||||
|
||||
IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
|
||||
SET(MSVC_EXPRESS ON)
|
||||
ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
|
||||
ENDMACRO(DETECT_EXPRESS_VERSION)
|
||||
|
||||
IF(MSVC12)
|
||||
DETECT_VC_VERSION("12.0")
|
||||
SET(MSVC_TOOLSET "120")
|
||||
|
||||
IF(NOT MSVC12_REDIST_DIR)
|
||||
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC12_REDIST_DIR)
|
||||
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)
|
||||
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)
|
||||
ELSEIF(MSVC90)
|
||||
DETECT_VC_VERSION("9.0")
|
||||
SET(MSVC_TOOLSET "90")
|
||||
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)
|
||||
|
||||
IF(NOT VC_DIR)
|
||||
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
|
||||
ENDIF(NOT VC_DIR)
|
||||
|
||||
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
|
||||
SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR})
|
@ -0,0 +1,80 @@
|
||||
# - Find MySQL
|
||||
# Find the MySQL includes and client library
|
||||
# This module defines
|
||||
# MYSQL_INCLUDE_DIR, where to find mysql.h
|
||||
# MYSQL_LIBRARIES, the libraries needed to use MySQL.
|
||||
# MYSQL_FOUND, If false, do not try to use MySQL.
|
||||
#
|
||||
# Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
||||
SET(MYSQL_FOUND TRUE)
|
||||
|
||||
ELSE()
|
||||
|
||||
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
|
||||
PATH_SUFFIXES mysql
|
||||
/usr/include/mysql
|
||||
/usr/local/include/mysql
|
||||
/opt/local/include/mysql5/mysql
|
||||
$ENV{ProgramFiles}/MySQL/*/include
|
||||
$ENV{SystemDrive}/MySQL/*/include)
|
||||
|
||||
IF(WIN32 AND MSVC)
|
||||
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient
|
||||
PATHS
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/opt
|
||||
$ENV{SystemDrive}/MySQL/*/lib/opt)
|
||||
|
||||
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd
|
||||
PATHS
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/opt
|
||||
$ENV{SystemDrive}/MySQL/*/lib/opt)
|
||||
ELSE()
|
||||
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/lib/mysql
|
||||
/usr/local/lib/mysql
|
||||
/opt/local/lib/mysql5/mysql
|
||||
)
|
||||
|
||||
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/lib/mysql
|
||||
/usr/local/lib/mysql
|
||||
/opt/local/lib/mysql5/mysql
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF(MYSQL_INCLUDE_DIR)
|
||||
IF(MYSQL_LIBRARY_RELEASE)
|
||||
IF(MYSQL_LIBRARY_DEBUG)
|
||||
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE} debug ${MYSQL_LIBRARY_DEBUG})
|
||||
ELSE()
|
||||
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY_RELEASE})
|
||||
ENDIF()
|
||||
FIND_PACKAGE(OpenSSL)
|
||||
IF(OPENSSL_FOUND)
|
||||
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
||||
SET(MYSQL_FOUND TRUE)
|
||||
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
|
||||
ELSE()
|
||||
SET(MYSQL_FOUND FALSE)
|
||||
MESSAGE(STATUS "MySQL not found.")
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)
|
||||
|
||||
ENDIF()
|
@ -0,0 +1,49 @@
|
||||
# - 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.
|
||||
|
||||
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)
|
@ -0,0 +1,91 @@
|
||||
# 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.
|
||||
|
||||
# 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)
|
@ -0,0 +1,83 @@
|
||||
#
|
||||
# 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.
|
||||
|
||||
# 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)
|
||||
|
||||
IF(SQUISH_FOUND)
|
||||
IF(NOT SQUISH_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARIES}")
|
||||
ENDIF(NOT SQUISH_FIND_QUIETLY)
|
||||
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)
|
@ -0,0 +1,65 @@
|
||||
# - 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.
|
||||
|
||||
IF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
|
||||
# in cache already
|
||||
SET(VORBIS_FIND_QUIETLY TRUE)
|
||||
ENDIF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
|
||||
|
||||
|
||||
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)
|
@ -0,0 +1,328 @@
|
||||
# - Find Windows Platform SDK
|
||||
# Find the Windows includes
|
||||
#
|
||||
# WINSDK_INCLUDE_DIR - where to find Windows.h
|
||||
# WINSDK_INCLUDE_DIRS - where to find all Windows headers
|
||||
# WINSDK_LIBRARY_DIR - where to find libraries
|
||||
# WINSDK_FOUND - True if Windows SDK found.
|
||||
|
||||
IF(WINSDK_FOUND)
|
||||
# If Windows SDK already found, skip it
|
||||
RETURN()
|
||||
ENDIF(WINSDK_FOUND)
|
||||
|
||||
# Values can be CURRENT or any existing versions 7.1, 8.0A, etc...
|
||||
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")
|
||||
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")
|
||||
SET(WINSDK${_VERSION}_DIR "")
|
||||
ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
|
||||
ENDMACRO(DETECT_WINSDK_VERSION_HELPER)
|
||||
|
||||
MACRO(DETECT_WINSDK_VERSION _VERSION)
|
||||
SET(WINSDK${_VERSION}_FOUND OFF)
|
||||
DETECT_WINSDK_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
|
||||
|
||||
IF(NOT WINSDK${_VERSION}_FOUND)
|
||||
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
|
||||
ENDIF(NOT WINSDK${_VERSION}_FOUND)
|
||||
ENDMACRO(DETECT_WINSDK_VERSION)
|
||||
|
||||
SET(WINSDK_VERSIONS "8.0" "8.0A" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
|
||||
SET(WINSDK_DETECTED_VERSIONS)
|
||||
|
||||
# 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)
|
||||
|
||||
SET(WINSDK_SUFFIX)
|
||||
|
||||
IF(TARGET_ARM)
|
||||
SET(WINSDK8_SUFFIX "arm")
|
||||
ELSEIF(TARGET_X64)
|
||||
SET(WINSDK8_SUFFIX "x64")
|
||||
SET(WINSDK_SUFFIX "x64")
|
||||
ELSEIF(TARGET_X86)
|
||||
SET(WINSDK8_SUFFIX "x86")
|
||||
ENDIF(TARGET_ARM)
|
||||
|
||||
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
|
||||
|
||||
IF(WINSDKCURRENT_VERSION_INCLUDE)
|
||||
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
|
||||
ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
|
||||
|
||||
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
|
||||
|
||||
IF(NOT WINSDKENV_DIR)
|
||||
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
|
||||
ENDIF(NOT WINSDKENV_DIR)
|
||||
|
||||
MACRO(FIND_WINSDK_VERSION_HEADERS)
|
||||
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
|
||||
# Search version in headers
|
||||
FIND_FILE(_MSI_FILE Msi.h
|
||||
PATHS
|
||||
${WINSDK_DIR}/Include/um
|
||||
${WINSDK_DIR}/Include
|
||||
)
|
||||
|
||||
IF(_MSI_FILE)
|
||||
# Look for Windows SDK 8.0
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
|
||||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "8.0")
|
||||
ENDIF(_CONTENT)
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 7.0
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN7")
|
||||
|
||||
IF(_CONTENT)
|
||||
FIND_FILE(_WINSDKVER_FILE winsdkver.h WinSDKVer.h
|
||||
PATHS
|
||||
${WINSDK_DIR}/Include/um
|
||||
${WINSDK_DIR}/Include
|
||||
)
|
||||
|
||||
IF(_WINSDKVER_FILE)
|
||||
# Load WinSDKVer.h content
|
||||
FILE(STRINGS ${_WINSDKVER_FILE} _CONTENT REGEX "^#define NTDDI_MAXVER")
|
||||
|
||||
# Get NTDDI_MAXVER value
|
||||
STRING(REGEX REPLACE "^.*0x([0-9A-Fa-f]+).*$" "\\1" _WINSDKVER "${_CONTENT}")
|
||||
|
||||
# In Windows SDK 7.1, NTDDI_MAXVER is wrong
|
||||
IF(_WINSDKVER STREQUAL "06010000")
|
||||
SET(WINSDK_VERSION "7.1")
|
||||
ELSEIF(_WINSDKVER STREQUAL "0601")
|
||||
SET(WINSDK_VERSION "7.0A")
|
||||
ELSE(_WINSDKVER STREQUAL "06010000")
|
||||
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
|
||||
ENDIF(_WINSDKVER STREQUAL "06010000")
|
||||
ELSE(_WINSDKVER_FILE)
|
||||
SET(WINSDK_VERSION "7.0")
|
||||
ENDIF(_WINSDKVER_FILE)
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 6.0
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_VISTA")
|
||||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "6.0")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.2
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WS03SP1")
|
||||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.2")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.1
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINXP")
|
||||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.1")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
|
||||
IF(NOT WINSDK_VERSION)
|
||||
# Look for Windows SDK 5.0
|
||||
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN2K")
|
||||
|
||||
IF(_CONTENT)
|
||||
SET(WINSDK_VERSION "5.0")
|
||||
ENDIF(_CONTENT)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
ELSE(_MSI_FILE)
|
||||
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)
|
||||
|
||||
MACRO(USE_CURRENT_WINSDK)
|
||||
SET(WINSDK_DIR "")
|
||||
SET(WINSDK_VERSION "")
|
||||
SET(WINSDK_VERSION_FULL "")
|
||||
|
||||
# Use WINSDK environment variable
|
||||
IF(WINSDKENV_DIR)
|
||||
FIND_PATH(WINSDK_DIR Windows.h
|
||||
HINTS
|
||||
${WINSDKENV_DIR}/Include/um
|
||||
${WINSDKENV_DIR}/Include
|
||||
)
|
||||
ENDIF(WINSDKENV_DIR)
|
||||
|
||||
# Use INCLUDE environment variable
|
||||
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
|
||||
FOREACH(_INCLUDE ${WINSDKCURRENT_VERSION_INCLUDE})
|
||||
FILE(TO_CMAKE_PATH ${_INCLUDE} _INCLUDE)
|
||||
|
||||
# Look for Windows.h because there are several paths
|
||||
IF(EXISTS ${_INCLUDE}/Windows.h)
|
||||
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
|
||||
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
|
||||
BREAK()
|
||||
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
|
||||
ENDFOREACH(_INCLUDE)
|
||||
ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
|
||||
|
||||
IF(WINSDK_DIR)
|
||||
# Compare WINSDK_DIR with registered Windows SDKs
|
||||
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
|
||||
IF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
|
||||
SET(WINSDK_VERSION ${_VERSION})
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
BREAK()
|
||||
ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
|
||||
ENDFOREACH(_VERSION)
|
||||
|
||||
FIND_WINSDK_VERSION_HEADERS()
|
||||
ENDIF(WINSDK_DIR)
|
||||
|
||||
IF(NOT WINSDK_DIR)
|
||||
# Use Windows SDK versions installed with VC++ when possible
|
||||
IF(MSVC12)
|
||||
SET(WINSDK_VERSION "8.1A")
|
||||
ELSEIF(MSVC11)
|
||||
SET(WINSDK_VERSION "8.0A")
|
||||
ELSEIF(MSVC10)
|
||||
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "7.0A")
|
||||
ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
|
||||
ELSEIF(MSVC90)
|
||||
IF(NOT MSVC_EXPRESS)
|
||||
SET(WINSDK_VERSION "6.0A")
|
||||
ENDIF(NOT MSVC_EXPRESS)
|
||||
ELSEIF(MSVC80)
|
||||
IF(NOT MSVC_EXPRESS)
|
||||
# TODO: fix this version
|
||||
SET(WINSDK_VERSION "5.2A")
|
||||
ENDIF(NOT MSVC_EXPRESS)
|
||||
ELSE(MSVC12)
|
||||
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
|
||||
ENDIF(MSVC12)
|
||||
|
||||
# Use installed Windows SDK
|
||||
IF(NOT WINSDK_VERSION)
|
||||
IF(WINSDK7.1_FOUND)
|
||||
SET(WINSDK_VERSION "7.1")
|
||||
ELSEIF(WINSDK7.0_FOUND)
|
||||
SET(WINSDK_VERSION "7.0")
|
||||
ELSEIF(WINSDK6.1_FOUND)
|
||||
SET(WINSDK_VERSION "6.1")
|
||||
ELSEIF(WINSDK6.0_FOUND)
|
||||
SET(WINSDK_VERSION "6.0")
|
||||
ELSE(WINSDK7.1_FOUND)
|
||||
MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.")
|
||||
ENDIF(WINSDK7.1_FOUND)
|
||||
ENDIF(NOT WINSDK_VERSION)
|
||||
|
||||
# Look for correct registered Windows SDK version
|
||||
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
|
||||
IF(WINSDK_VERSION STREQUAL _VERSION)
|
||||
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)
|
||||
|
||||
IF(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
USE_CURRENT_WINSDK()
|
||||
ELSE(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
IF(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
|
||||
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
|
||||
ELSE(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
USE_CURRENT_WINSDK()
|
||||
ENDIF(WINSDK${WINSDK_VERSION}_FOUND)
|
||||
ENDIF(WINSDK_VERSION STREQUAL "CURRENT")
|
||||
|
||||
IF(WINSDK_DIR)
|
||||
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
|
||||
ELSE(WINSDK_DIR)
|
||||
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
|
||||
ENDIF(WINSDK_DIR)
|
||||
|
||||
# directory where Win32 headers are found
|
||||
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
|
||||
HINTS
|
||||
${WINSDK_DIR}/Include/um
|
||||
${WINSDK_DIR}/Include
|
||||
)
|
||||
|
||||
# directory where DirectX headers are found
|
||||
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
|
||||
HINTS
|
||||
${WINSDK_DIR}/Include/shared
|
||||
${WINSDK_DIR}/Include
|
||||
)
|
||||
|
||||
# directory where OpenGL headers are found
|
||||
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
|
||||
HINTS
|
||||
${WINSDK_DIR}/Include/gl
|
||||
${WINSDK_DIR}/Include
|
||||
)
|
||||
|
||||
# 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}
|
||||
)
|
||||
|
||||
# signtool is used to sign executables
|
||||
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
|
||||
HINTS
|
||||
${WINSDK_DIR}/Bin/x86
|
||||
${WINSDK_DIR}/Bin
|
||||
)
|
||||
|
||||
# midl is used to generate IDL interfaces
|
||||
FIND_PROGRAM(WINSDK_MIDL midl
|
||||
HINTS
|
||||
${WINSDK_DIR}/Bin/x86
|
||||
${WINSDK_DIR}/Bin
|
||||
)
|
||||
|
||||
IF(WINSDK_INCLUDE_DIR)
|
||||
SET(WINSDK_FOUND 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})
|
||||
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})
|
||||
|
||||
# Fix for using Windows SDK 7.1 with Visual C++ 2012
|
||||
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
||||
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
|
||||
ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
|
||||
ELSE(WINSDK_INCLUDE_DIR)
|
||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
|
||||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
ENDIF(WINSDK_INCLUDE_DIR)
|
@ -0,0 +1,83 @@
|
||||
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)
|
||||
|
||||
IF(SOURCE_DIR)
|
||||
# Replace spaces by semi-columns
|
||||
IF(CMAKE_MODULE_PATH)
|
||||
STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
|
||||
ENDIF(CMAKE_MODULE_PATH)
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})
|
||||
|
||||
IF(NOT ROOT_DIR AND SOURCE_DIR)
|
||||
SET(ROOT_DIR ${SOURCE_DIR})
|
||||
ENDIF()
|
||||
|
||||
IF(NOT SOURCE_DIR AND ROOT_DIR)
|
||||
SET(SOURCE_DIR ${ROOT_DIR})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
|
||||
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
|
||||
ENDIF()
|
||||
|
||||
MACRO(NOW RESULT)
|
||||
IF (WIN32)
|
||||
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
|
||||
IF(NOT DATETIME MATCHES "ERROR")
|
||||
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
|
||||
ENDIF()
|
||||
ELSEIF(UNIX)
|
||||
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
|
||||
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
|
||||
ELSE()
|
||||
MESSAGE(SEND_ERROR "date not implemented")
|
||||
SET(${RESULT} "0000-00-00 00:00:00")
|
||||
ENDIF()
|
||||
ENDMACRO(NOW)
|
||||
|
||||
IF(EXISTS "${ROOT_DIR}/.svn/")
|
||||
FIND_PACKAGE(Subversion QUIET)
|
||||
|
||||
IF(SUBVERSION_FOUND)
|
||||
Subversion_WC_INFO(${ROOT_DIR} ER)
|
||||
SET(REVISION ${ER_WC_REVISION})
|
||||
ENDIF(SUBVERSION_FOUND)
|
||||
|
||||
FIND_PACKAGE(TortoiseSVN QUIET)
|
||||
|
||||
IF(TORTOISESVN_FOUND)
|
||||
TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION)
|
||||
ENDIF(TORTOISESVN_FOUND)
|
||||
ENDIF(EXISTS "${ROOT_DIR}/.svn/")
|
||||
|
||||
IF(EXISTS "${ROOT_DIR}/.hg/")
|
||||
FIND_PACKAGE(Mercurial)
|
||||
|
||||
IF(MERCURIAL_FOUND)
|
||||
Mercurial_WC_INFO(${ROOT_DIR} ER)
|
||||
SET(REVISION ${ER_WC_REVISION})
|
||||
SET(CHANGESET ${ER_WC_CHANGESET})
|
||||
SET(BRANCH ${ER_WC_BRANCH})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# if processing exported sources, use "revision" file if exists
|
||||
IF(SOURCE_DIR AND NOT DEFINED REVISION)
|
||||
SET(REVISION_FILE ${SOURCE_DIR}/revision)
|
||||
IF(EXISTS ${REVISION_FILE})
|
||||
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
|
||||
MESSAGE(STATUS "Read revision ${REVISION} from file")
|
||||
ENDIF()
|
||||
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()
|
||||
ENDIF()
|
@ -0,0 +1,429 @@
|
||||
# - Try to find precompiled headers support for GCC 3.4 and 4.x (and MSVC)
|
||||
# Once done this will define:
|
||||
#
|
||||
# Variable:
|
||||
# PCHSupport_FOUND
|
||||
#
|
||||
# ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp
|
||||
# ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use
|
||||
# ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp
|
||||
|
||||
IF(MSVC)
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ELSE(MSVC)
|
||||
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]+)?")
|
||||
SET(PCHSupport_FOUND FALSE)
|
||||
ELSEIF(gcc_compiler_version MATCHES "^4\\.[0-9]+(\\.[0-9]+)?")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# TODO: make tests for other compilers than GCC
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ENDIF(MSVC)
|
||||
|
||||
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
|
||||
MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||
SET(PCH_FLAGS)
|
||||
SET(PCH_ARCHS)
|
||||
|
||||
SET(_FLAGS)
|
||||
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
|
||||
|
||||
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
|
||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}")
|
||||
|
||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||
|
||||
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
||||
ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
|
||||
IF(_pic)
|
||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
||||
ENDIF(_pic)
|
||||
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${DIRINC})
|
||||
LIST(APPEND _FLAGS " -I\"${item}\"")
|
||||
ENDFOREACH(item)
|
||||
|
||||
# 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)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(DEFINITIONS)
|
||||
|
||||
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
|
||||
IF(oldProps)
|
||||
LIST(APPEND _FLAGS " ${oldProps}")
|
||||
ENDIF(oldProps)
|
||||
|
||||
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
|
||||
IF(oldPropsBuild)
|
||||
LIST(APPEND _FLAGS " ${oldPropsBuild}")
|
||||
ENDIF(oldPropsBuild)
|
||||
|
||||
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
|
||||
IF(DIRINC)
|
||||
FOREACH(item ${DIRINC})
|
||||
LIST(APPEND _FLAGS " -I\"${item}\"")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(DIRINC)
|
||||
|
||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(DEFINITIONS)
|
||||
|
||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(DEFINITIONS)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
||||
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
||||
LIST(APPEND _FLAGS " ${_directory_flags}")
|
||||
LIST(APPEND _FLAGS " ${_directory_definitions}")
|
||||
|
||||
# Format definitions
|
||||
IF(MSVC)
|
||||
# Fix path with space
|
||||
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
|
||||
ELSE(MSVC)
|
||||
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
|
||||
SEPARATE_ARGUMENTS(_FLAGS)
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(CLANG)
|
||||
# Determining all architectures and get common flags
|
||||
SET(_ARCH_NEXT)
|
||||
SET(_XARCH_NEXT)
|
||||
FOREACH(item ${_FLAGS})
|
||||
IF(_ARCH_NEXT)
|
||||
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
|
||||
IF(ITEM_FOUND EQUAL -1)
|
||||
LIST(APPEND PCH_ARCHS ${item})
|
||||
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
||||
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
||||
ENDIF(ITEM_FOUND EQUAL -1)
|
||||
SET(_ARCH_NEXT OFF)
|
||||
ELSEIF(_XARCH_NEXT)
|
||||
SET(_XARCH_NEXT OFF)
|
||||
ELSE(_ARCH_NEXT)
|
||||
IF(item MATCHES "^-arch")
|
||||
SET(_ARCH_NEXT ON)
|
||||
ELSEIF(item MATCHES "^-Xarch_")
|
||||
STRING(REGEX REPLACE "-Xarch_([a-z0-9_]+)" "\\1" item ${item})
|
||||
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
|
||||
IF(ITEM_FOUND EQUAL -1)
|
||||
LIST(APPEND PCH_ARCHS ${item})
|
||||
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
||||
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
||||
ENDIF(ITEM_FOUND EQUAL -1)
|
||||
SET(_XARCH_NEXT ON)
|
||||
ELSE(item MATCHES "^-arch")
|
||||
LIST(APPEND PCH_FLAGS ${item})
|
||||
ENDIF(item MATCHES "^-arch")
|
||||
ENDIF(_ARCH_NEXT)
|
||||
ENDFOREACH(item)
|
||||
|
||||
# Get architcture specific flags
|
||||
SET(_XARCH_NEXT)
|
||||
FOREACH(item ${_FLAGS})
|
||||
IF(_XARCH_NEXT)
|
||||
STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH)
|
||||
LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item})
|
||||
SET(_XARCH_NEXT OFF)
|
||||
ELSE(_XARCH_NEXT)
|
||||
IF(item MATCHES "^-Xarch_")
|
||||
STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT)
|
||||
ENDIF(item MATCHES "^-Xarch_")
|
||||
ENDIF(_XARCH_NEXT)
|
||||
ENDFOREACH(item)
|
||||
|
||||
# Remove duplicated architectures
|
||||
IF(_ARCHS AND PCH_ARCHS)
|
||||
LIST(REMOVE_DUPLICATES PCH_ARCHS)
|
||||
ENDIF(_ARCHS AND PCH_ARCHS)
|
||||
ELSE(CLANG)
|
||||
SET(PCH_FLAGS ${_FLAGS})
|
||||
ENDIF(CLANG)
|
||||
|
||||
IF(PCH_FLAGS)
|
||||
LIST(REMOVE_DUPLICATES PCH_FLAGS)
|
||||
ENDIF(PCH_FLAGS)
|
||||
ENDMACRO(PCH_SET_COMPILE_FLAGS)
|
||||
|
||||
MACRO(GET_PDB_FILENAME _out_filename _target)
|
||||
# determine output directory based on target type
|
||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||
IF(${_targetType} STREQUAL EXECUTABLE)
|
||||
SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY)
|
||||
SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
|
||||
ELSE(${_targetType} STREQUAL EXECUTABLE)
|
||||
SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
ENDIF(${_targetType} STREQUAL EXECUTABLE)
|
||||
|
||||
# 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)
|
||||
|
||||
SET(${_out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb")
|
||||
ENDMACRO(GET_PDB_FILENAME)
|
||||
|
||||
MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
|
||||
IF(CMAKE_CXX_COMPILER_ARG1)
|
||||
# remove leading space in compiler argument
|
||||
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
|
||||
ELSE(CMAKE_CXX_COMPILER_ARG1)
|
||||
SET(pchsupport_compiler_cxx_arg1 "")
|
||||
ENDIF(CMAKE_CXX_COMPILER_ARG1)
|
||||
|
||||
IF(MSVC)
|
||||
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
|
||||
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
|
||||
# Ninja PCH Support
|
||||
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
|
||||
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")
|
||||
ELSE(MSVC)
|
||||
SET(HEADER_FORMAT "c++-header")
|
||||
SET(_FLAGS "")
|
||||
IF(APPLE)
|
||||
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
|
||||
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch)
|
||||
ENDIF(APPLE)
|
||||
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)
|
||||
|
||||
MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
||||
SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch")
|
||||
|
||||
IF(MSVC)
|
||||
FILE(MAKE_DIRECTORY ${_OUTPUT_DIR})
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
|
||||
SET(PCH_INPUT ${_input})
|
||||
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch")
|
||||
ELSE(MSVC)
|
||||
IF(NOT "${_arch}" STREQUAL "")
|
||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}")
|
||||
ENDIF(NOT "${_arch}" STREQUAL "")
|
||||
|
||||
IF(NOT "${_language}" STREQUAL "")
|
||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}")
|
||||
ENDIF(NOT "${_language}" STREQUAL "")
|
||||
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
||||
|
||||
# Copy .h to output dir
|
||||
SET(PCH_INPUT "${_OUTPUT_DIR}/${_name}")
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_INPUT}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_input} ${PCH_INPUT}
|
||||
DEPENDS ${_input}
|
||||
COMMENT "[${_targetName}] Update precompiled header - done"
|
||||
)
|
||||
|
||||
IF(CLANG)
|
||||
SET(PCH_EXT "pth")
|
||||
ELSE(CLANG)
|
||||
SET(PCH_EXT "gch")
|
||||
ENDIF(CLANG)
|
||||
|
||||
# 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)
|
||||
|
||||
# Add common flags
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
|
||||
IF(MSVC)
|
||||
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
|
||||
# Ninja PCH Support
|
||||
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES OBJECT_DEPENDS "${PCH_OUTPUT}")
|
||||
|
||||
# NMAKE-VS2012 Error LNK2011 (NMAKE-VS2010 do not complain)
|
||||
# we need to link the pch.obj file, see http://msdn.microsoft.com/en-us/library/3ay26wa2(v=vs.110).aspx
|
||||
GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS)
|
||||
IF(NOT _STATIC_LIBRARY_FLAGS)
|
||||
SET(_STATIC_LIBRARY_FLAGS)
|
||||
ENDIF(NOT _STATIC_LIBRARY_FLAGS)
|
||||
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)
|
||||
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)
|
||||
# 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
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS)
|
||||
LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT)
|
||||
|
||||
# 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)
|
||||
|
||||
IF(APPLE)
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||
ENDIF(APPLE)
|
||||
|
||||
IF(WITH_PCH_DEBUG)
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||
ENDIF(WITH_PCH_DEBUG)
|
||||
|
||||
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch")
|
||||
ENDIF(MSVC)
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
|
||||
|
||||
# Add specific flags for an arch
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
|
||||
LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT)
|
||||
|
||||
IF(PCH_ARCHS_COUNT GREATER 1)
|
||||
GET_TARGET_PROPERTY(_FLAGS ${_targetName} COMPILE_FLAGS)
|
||||
|
||||
IF(${_FLAGS} MATCHES NOTFOUND)
|
||||
SET(_FLAGS "")
|
||||
ENDIF(${_FLAGS} MATCHES NOTFOUND)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||
SET(_PCH_current_target ${_targetName})
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"This is the ADD_PRECOMPILED_HEADER macro. "
|
||||
"You must set CMAKE_BUILD_TYPE!"
|
||||
)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
PCH_SET_COMPILE_FLAGS(${_targetName})
|
||||
|
||||
IF(PCH_ARCHS)
|
||||
SET(PCH_OUTPUTS)
|
||||
FOREACH(_ARCH ${PCH_ARCHS})
|
||||
STRING(TOUPPER "${_ARCH}" _UPPER_ARCH)
|
||||
|
||||
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_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH})
|
||||
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH})
|
||||
ENDFOREACH(_ARCH)
|
||||
ELSE(PCH_ARCHS)
|
||||
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "")
|
||||
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
|
||||
|
||||
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}")
|
||||
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch)
|
||||
ENDIF(PCH_ARCHS)
|
||||
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName})
|
||||
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}")
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER)
|
||||
|
||||
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)
|
||||
|
||||
# 0 => creating a new target for PCH, works for all makefiles
|
||||
# 1 => setting PCH for VC++ project, works for VC++ projects
|
||||
# 2 => setting PCH for XCode project, works for XCode projects
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
SET(PCH_METHOD 1)
|
||||
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
SET(PCH_METHOD 2)
|
||||
ELSE(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
SET(PCH_METHOD 0)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
|
||||
IF(PCH_METHOD EQUAL 1)
|
||||
# Auto include the precompile (useful for moc processing, since the use of
|
||||
# precompiled is specified at the target level
|
||||
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
|
||||
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
|
||||
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
||||
|
||||
#also inlude ${oldProps} to have the same compile options
|
||||
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"")
|
||||
ELSEIF(PCH_METHOD EQUAL 2)
|
||||
# For Xcode, cmake needs my patch to process
|
||||
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
|
||||
|
||||
# When buiding out of the tree, precompiled may not be located
|
||||
# Use full path instead.
|
||||
GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE)
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
||||
ELSE(PCH_METHOD EQUAL 1)
|
||||
#Fallback to the "old" precompiled suppport
|
||||
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
|
||||
ENDIF(PCH_METHOD EQUAL 1)
|
||||
|
||||
IF(TARGET ${_targetName}_static)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
|
||||
ENDIF(TARGET ${_targetName}_static)
|
||||
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
|
@ -0,0 +1,183 @@
|
||||
# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
|
||||
# files which are included with CMake 2.8.4
|
||||
# It has been altered for iOS development
|
||||
#
|
||||
# Options:
|
||||
#
|
||||
# IOS_VERSION = last(default) or specific one (4.3, 5.0, 4.1)
|
||||
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
|
||||
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
|
||||
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
|
||||
#
|
||||
# IOS_PLATFORM = OS (default) or SIMULATOR or ALL
|
||||
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
|
||||
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
|
||||
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
|
||||
#
|
||||
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
|
||||
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
|
||||
# If set manually, it will override the default location and force the user of a particular Developer Platform
|
||||
#
|
||||
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
|
||||
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
|
||||
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
|
||||
# If set manually, this will force the use of a specific SDK version
|
||||
|
||||
IF(DEFINED CMAKE_CROSSCOMPILING)
|
||||
# subsequent toolchain loading is not really needed
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
# Standard settings
|
||||
SET(CMAKE_SYSTEM_NAME Darwin)
|
||||
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Darwin version
|
||||
SET(UNIX ON)
|
||||
SET(APPLE ON)
|
||||
SET(IOS ON)
|
||||
|
||||
# Force the compilers to Clang for iOS
|
||||
include (CMakeForceCompiler)
|
||||
CMAKE_FORCE_C_COMPILER (clang Clang)
|
||||
CMAKE_FORCE_CXX_COMPILER (clang++ Clang)
|
||||
|
||||
# Setup iOS platform
|
||||
if (NOT DEFINED IOS_PLATFORM)
|
||||
set (IOS_PLATFORM "OS")
|
||||
endif (NOT DEFINED IOS_PLATFORM)
|
||||
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
||||
|
||||
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
||||
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||
|
||||
# Check the platform selection and setup for developer root
|
||||
if (${IOS_PLATFORM} STREQUAL "OS")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
||||
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
||||
elseif (${IOS_PLATFORM} STREQUAL "ALL")
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
|
||||
else (${IOS_PLATFORM} STREQUAL "OS")
|
||||
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
|
||||
endif (${IOS_PLATFORM} STREQUAL "OS")
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform")
|
||||
|
||||
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
|
||||
# Note Xcode 4.3 changed the installation location, choose the most recent one available
|
||||
SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms")
|
||||
SET(XCODE_PRE_43_ROOT "/Developer/Platforms")
|
||||
|
||||
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
IF(EXISTS ${XCODE_POST_43_ROOT})
|
||||
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT})
|
||||
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT})
|
||||
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT})
|
||||
ENDIF(EXISTS ${XCODE_POST_43_ROOT})
|
||||
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
|
||||
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
|
||||
ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
|
||||
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform")
|
||||
|
||||
MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
|
||||
FILE(GLOB _CMAKE_IOS_SDKS "${ROOT}/SDKs/iPhoneOS*")
|
||||
IF(_CMAKE_IOS_SDKS)
|
||||
LIST(SORT _CMAKE_IOS_SDKS)
|
||||
LIST(REVERSE _CMAKE_IOS_SDKS)
|
||||
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
|
||||
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
|
||||
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
|
||||
ENDFOREACH(_CMAKE_IOS_SDK)
|
||||
ENDIF(_CMAKE_IOS_SDKS)
|
||||
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS)
|
||||
|
||||
# Find and use the most recent iOS sdk
|
||||
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
# Search for a specific version of a SDK
|
||||
GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} IOS_VERSIONS)
|
||||
|
||||
IF(NOT IOS_VERSIONS)
|
||||
MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
|
||||
ENDIF(NOT IOS_VERSIONS)
|
||||
|
||||
IF(IOS_VERSION)
|
||||
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
|
||||
IF(_INDEX EQUAL -1)
|
||||
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
|
||||
ELSE(_INDEX EQUAL -1)
|
||||
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||
ENDIF(_INDEX EQUAL -1)
|
||||
ELSE(IOS_VERSION)
|
||||
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
|
||||
SET(IOS_SDK_VERSION ${IOS_VERSION})
|
||||
ENDIF(IOS_VERSION)
|
||||
|
||||
MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}")
|
||||
|
||||
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk)
|
||||
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk)
|
||||
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
|
||||
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
|
||||
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK")
|
||||
|
||||
SET(IOS_VERSION ${IOS_VERSION} CACHE STRING "iOS target version")
|
||||
|
||||
# Set the sysroot default to the most recent SDK
|
||||
SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
|
||||
SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES Xcode)
|
||||
SET(ARCHS "$(ARCHS_STANDARD_32_BIT)")
|
||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
ELSE(CMAKE_GENERATOR MATCHES Xcode)
|
||||
IF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
SET(ARCHS "armv7")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
# iPhone simulator targets i386
|
||||
SET(ARCHS "i386")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "x86")
|
||||
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
|
||||
SET(ARCHS "armv7;i386")
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
|
||||
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
|
||||
|
||||
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
|
||||
# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
|
||||
set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
|
||||
|
||||
# Set the find root to the iOS developer roots and to user defined paths
|
||||
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root")
|
||||
|
||||
# default to searching for frameworks first
|
||||
set (CMAKE_FIND_FRAMEWORK FIRST)
|
||||
|
||||
# set up the default search directories for frameworks
|
||||
set (CMAKE_SYSTEM_FRAMEWORK_PATH
|
||||
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
|
||||
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
|
||||
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
|
||||
)
|
||||
|
||||
# only search the iOS sdks, not the remainder of the host filesystem
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include)
|
||||
#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib)
|
||||
#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin)
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,56 @@
|
||||
#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}
|
||||
|
||||
#cmakedefine NL_FMOD_AVAILABLE ${NL_FMOD_AVAILABLE}
|
||||
#cmakedefine NL_OPENAL_AVAILABLE ${NL_OPENAL_AVAILABLE}
|
||||
#cmakedefine NL_DSOUND_AVAILABLE ${NL_DSOUND_AVAILABLE}
|
||||
#cmakedefine NL_XAUDIO2_AVAILABLE ${NL_XAUDIO2_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}"
|
||||
#cmakedefine NL_LIB_PREFIX "${NL_LIB_ABSOLUTE_PREFIX}"
|
||||
#cmakedefine NL_DRIVER_PREFIX "${NL_DRIVER_ABSOLUTE_PREFIX}"
|
||||
|
||||
#cmakedefine RYZOM_BIN_PREFIX "${RYZOM_BIN_ABSOLUTE_PREFIX}"
|
||||
#cmakedefine RYZOM_ETC_PREFIX "${RYZOM_ETC_ABSOLUTE_PREFIX}"
|
||||
#cmakedefine RYZOM_SHARE_PREFIX "${RYZOM_SHARE_ABSOLUTE_PREFIX}"
|
||||
|
||||
#endif // CONFIG_H
|
@ -0,0 +1,70 @@
|
||||
/* 7zAlloc.c */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "7zAlloc.h"
|
||||
|
||||
/* #define _SZ_ALLOC_DEBUG */
|
||||
/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
|
||||
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
int g_allocCount = 0;
|
||||
int g_allocCountTemp = 0;
|
||||
#endif
|
||||
|
||||
void *SzAlloc(size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return 0;
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
|
||||
g_allocCount++;
|
||||
#endif
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void SzFree(void *address)
|
||||
{
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
if (address != 0)
|
||||
{
|
||||
g_allocCount--;
|
||||
fprintf(stderr, "\nFree; count = %10d", g_allocCount);
|
||||
}
|
||||
#endif
|
||||
free(address);
|
||||
}
|
||||
|
||||
void *SzAllocTemp(size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return 0;
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp);
|
||||
g_allocCountTemp++;
|
||||
#ifdef _WIN32
|
||||
return HeapAlloc(GetProcessHeap(), 0, size);
|
||||
#endif
|
||||
#endif
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void SzFreeTemp(void *address)
|
||||
{
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
if (address != 0)
|
||||
{
|
||||
g_allocCountTemp--;
|
||||
fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
|
||||
}
|
||||
#ifdef _WIN32
|
||||
HeapFree(GetProcessHeap(), 0, address);
|
||||
return;
|
||||
#endif
|
||||
#endif
|
||||
free(address);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/* 7zAlloc.h */
|
||||
|
||||
#ifndef __7Z_ALLOC_H
|
||||
#define __7Z_ALLOC_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct _ISzAlloc
|
||||
{
|
||||
void *(*Alloc)(size_t size);
|
||||
void (*Free)(void *address); /* address can be 0 */
|
||||
} ISzAlloc;
|
||||
|
||||
void *SzAlloc(size_t size);
|
||||
void SzFree(void *address);
|
||||
|
||||
void *SzAllocTemp(size_t size);
|
||||
void SzFreeTemp(void *address);
|
||||
|
||||
#endif
|
@ -0,0 +1,29 @@
|
||||
/* 7zBuffer.c */
|
||||
|
||||
#include "7zBuffer.h"
|
||||
#include "7zAlloc.h"
|
||||
|
||||
void SzByteBufferInit(CSzByteBuffer *buffer)
|
||||
{
|
||||
buffer->Capacity = 0;
|
||||
buffer->Items = 0;
|
||||
}
|
||||
|
||||
int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size))
|
||||
{
|
||||
buffer->Capacity = newCapacity;
|
||||
if (newCapacity == 0)
|
||||
{
|
||||
buffer->Items = 0;
|
||||
return 1;
|
||||
}
|
||||
buffer->Items = (Byte *)allocFunc(newCapacity);
|
||||
return (buffer->Items != 0);
|
||||
}
|
||||
|
||||
void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *))
|
||||
{
|
||||
freeFunc(buffer->Items);
|
||||
buffer->Items = 0;
|
||||
buffer->Capacity = 0;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
/* 7zBuffer.h */
|
||||
|
||||
#ifndef __7Z_BUFFER_H
|
||||
#define __7Z_BUFFER_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "7zTypes.h"
|
||||
|
||||
typedef struct _CSzByteBuffer
|
||||
{
|
||||
size_t Capacity;
|
||||
Byte *Items;
|
||||
}CSzByteBuffer;
|
||||
|
||||
void SzByteBufferInit(CSzByteBuffer *buffer);
|
||||
int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size));
|
||||
void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *));
|
||||
|
||||
#endif
|
@ -0,0 +1,76 @@
|
||||
/* 7zCrc.c */
|
||||
|
||||
#include "7zCrc.h"
|
||||
|
||||
#define kCrcPoly 0xEDB88320
|
||||
|
||||
UInt32 g_CrcTable[256];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void CrcInit(UInt32 *crc) { *crc = 0xFFFFFFFF; }
|
||||
UInt32 CrcGetDigest(UInt32 *crc) { return *crc ^ 0xFFFFFFFF; }
|
||||
|
||||
void CrcUpdateByte(UInt32 *crc, Byte b)
|
||||
{
|
||||
*crc = g_CrcTable[((Byte)(*crc)) ^ b] ^ (*crc >> 8);
|
||||
}
|
||||
|
||||
void CrcUpdateUInt16(UInt32 *crc, UInt16 v)
|
||||
{
|
||||
CrcUpdateByte(crc, (Byte)v);
|
||||
CrcUpdateByte(crc, (Byte)(v >> 8));
|
||||
}
|
||||
|
||||
void CrcUpdateUInt32(UInt32 *crc, UInt32 v)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
CrcUpdateByte(crc, (Byte)(v >> (8 * i)));
|
||||
}
|
||||
|
||||
void CrcUpdateUInt64(UInt32 *crc, UInt64 v)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
CrcUpdateByte(crc, (Byte)(v));
|
||||
v >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
void CrcUpdate(UInt32 *crc, const void *data, size_t size)
|
||||
{
|
||||
UInt32 v = *crc;
|
||||
const Byte *p = (const Byte *)data;
|
||||
for (; size > 0 ; size--, p++)
|
||||
v = g_CrcTable[((Byte)(v)) ^ *p] ^ (v >> 8);
|
||||
*crc = v;
|
||||
}
|
||||
|
||||
UInt32 CrcCalculateDigest(const void *data, size_t size)
|
||||
{
|
||||
UInt32 crc;
|
||||
CrcInit(&crc);
|
||||
CrcUpdate(&crc, data, size);
|
||||
return CrcGetDigest(&crc);
|
||||
}
|
||||
|
||||
int CrcVerifyDigest(UInt32 digest, const void *data, size_t size)
|
||||
{
|
||||
return (CrcCalculateDigest(data, size) == digest);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/* 7zCrc.h */
|
||||
|
||||
#ifndef __7Z_CRC_H
|
||||
#define __7Z_CRC_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "7zTypes.h"
|
||||
|
||||
extern UInt32 g_CrcTable[256];
|
||||
void InitCrcTable();
|
||||
|
||||
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 CrcCalculateDigest(const void *data, size_t size);
|
||||
int CrcVerifyDigest(UInt32 digest, const void *data, size_t size);
|
||||
|
||||
#endif
|
@ -0,0 +1,150 @@
|
||||
/* 7zDecode.c */
|
||||
|
||||
#include "7zDecode.h"
|
||||
#ifdef _SZ_ONE_DIRECTORY
|
||||
#include "LzmaDecode.h"
|
||||
#else
|
||||
#include "../../Compress/LZMA_C/LzmaDecode.h"
|
||||
#endif
|
||||
|
||||
CMethodID k_Copy = { { 0x0 }, 1 };
|
||||
CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 };
|
||||
|
||||
#ifdef _LZMA_IN_CB
|
||||
|
||||
typedef struct _CLzmaInCallbackImp
|
||||
{
|
||||
ILzmaInCallback InCallback;
|
||||
ISzInStream *InStream;
|
||||
size_t Size;
|
||||
} CLzmaInCallbackImp;
|
||||
|
||||
int LzmaReadImp(void *object, const unsigned char **buffer, SizeT *size)
|
||||
{
|
||||
CLzmaInCallbackImp *cb = (CLzmaInCallbackImp *)object;
|
||||
size_t processedSize;
|
||||
SZ_RESULT res;
|
||||
*size = 0;
|
||||
res = cb->InStream->Read((void *)cb->InStream, (void **)buffer, cb->Size, &processedSize);
|
||||
*size = (SizeT)processedSize;
|
||||
if (processedSize > cb->Size)
|
||||
return (int)SZE_FAIL;
|
||||
cb->Size -= processedSize;
|
||||
if (res == SZ_OK)
|
||||
return 0;
|
||||
return (int)res;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder,
|
||||
#ifdef _LZMA_IN_CB
|
||||
ISzInStream *inStream,
|
||||
#else
|
||||
const Byte *inBuffer,
|
||||
#endif
|
||||
Byte *outBuffer, size_t outSize,
|
||||
size_t *outSizeProcessed, ISzAlloc *allocMain)
|
||||
{
|
||||
UInt32 si;
|
||||
size_t inSize = 0;
|
||||
CCoderInfo *coder;
|
||||
if (folder->NumPackStreams != 1)
|
||||
return SZE_NOTIMPL;
|
||||
if (folder->NumCoders != 1)
|
||||
return SZE_NOTIMPL;
|
||||
coder = folder->Coders;
|
||||
*outSizeProcessed = 0;
|
||||
|
||||
for (si = 0; si < folder->NumPackStreams; si++)
|
||||
inSize += (size_t)packSizes[si];
|
||||
|
||||
if (AreMethodsEqual(&coder->MethodID, &k_Copy))
|
||||
{
|
||||
size_t i;
|
||||
if (inSize != outSize)
|
||||
return SZE_DATA_ERROR;
|
||||
#ifdef _LZMA_IN_CB
|
||||
for (i = 0; i < inSize;)
|
||||
{
|
||||
size_t j;
|
||||
Byte *inBuffer;
|
||||
size_t bufferSize;
|
||||
RINOK(inStream->Read((void *)inStream, (void **)&inBuffer, inSize - i, &bufferSize));
|
||||
if (bufferSize == 0)
|
||||
return SZE_DATA_ERROR;
|
||||
if (bufferSize > inSize - i)
|
||||
return SZE_FAIL;
|
||||
*outSizeProcessed += bufferSize;
|
||||
for (j = 0; j < bufferSize && i < inSize; j++, i++)
|
||||
outBuffer[i] = inBuffer[j];
|
||||
}
|
||||
#else
|
||||
for (i = 0; i < inSize; i++)
|
||||
outBuffer[i] = inBuffer[i];
|
||||
*outSizeProcessed = inSize;
|
||||
#endif
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
if (AreMethodsEqual(&coder->MethodID, &k_LZMA))
|
||||
{
|
||||
#ifdef _LZMA_IN_CB
|
||||
CLzmaInCallbackImp lzmaCallback;
|
||||
#else
|
||||
SizeT inProcessed;
|
||||
#endif
|
||||
|
||||
CLzmaDecoderState state; /* it's about 24-80 bytes structure, if int is 32-bit */
|
||||
int result;
|
||||
SizeT outSizeProcessedLoc;
|
||||
|
||||
#ifdef _LZMA_IN_CB
|
||||
lzmaCallback.Size = inSize;
|
||||
lzmaCallback.InStream = inStream;
|
||||
lzmaCallback.InCallback.Read = LzmaReadImp;
|
||||
#endif
|
||||
|
||||
if (LzmaDecodeProperties(&state.Properties, coder->Properties.Items,
|
||||
(SizeT)coder->Properties.Capacity) != LZMA_RESULT_OK)
|
||||
return SZE_FAIL;
|
||||
|
||||
state.Probs = (CProb *)allocMain->Alloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
|
||||
if (state.Probs == 0)
|
||||
return SZE_OUTOFMEMORY;
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
if (state.Properties.DictionarySize == 0)
|
||||
state.Dictionary = 0;
|
||||
else
|
||||
{
|
||||
state.Dictionary = (unsigned char *)allocMain->Alloc(state.Properties.DictionarySize);
|
||||
if (state.Dictionary == 0)
|
||||
{
|
||||
allocMain->Free(state.Probs);
|
||||
return SZE_OUTOFMEMORY;
|
||||
}
|
||||
}
|
||||
LzmaDecoderInit(&state);
|
||||
#endif
|
||||
|
||||
result = LzmaDecode(&state,
|
||||
#ifdef _LZMA_IN_CB
|
||||
&lzmaCallback.InCallback,
|
||||
#else
|
||||
inBuffer, (SizeT)inSize, &inProcessed,
|
||||
#endif
|
||||
outBuffer, (SizeT)outSize, &outSizeProcessedLoc);
|
||||
*outSizeProcessed = (size_t)outSizeProcessedLoc;
|
||||
allocMain->Free(state.Probs);
|
||||
#ifdef _LZMA_OUT_READ
|
||||
allocMain->Free(state.Dictionary);
|
||||
#endif
|
||||
if (result == LZMA_RESULT_DATA_ERROR)
|
||||
return SZE_DATA_ERROR;
|
||||
if (result != LZMA_RESULT_OK)
|
||||
return SZE_FAIL;
|
||||
return SZ_OK;
|
||||
}
|
||||
return SZE_NOTIMPL;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/* 7zDecode.h */
|
||||
|
||||
#ifndef __7Z_DECODE_H
|
||||
#define __7Z_DECODE_H
|
||||
|
||||
#include "7zItem.h"
|
||||
#include "7zAlloc.h"
|
||||
#ifdef _LZMA_IN_CB
|
||||
#include "7zIn.h"
|
||||
#endif
|
||||
|
||||
SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder,
|
||||
#ifdef _LZMA_IN_CB
|
||||
ISzInStream *stream,
|
||||
#else
|
||||
const Byte *inBuffer,
|
||||
#endif
|
||||
Byte *outBuffer, size_t outSize,
|
||||
size_t *outSizeProcessed, ISzAlloc *allocMain);
|
||||
|
||||
#endif
|
@ -0,0 +1,116 @@
|
||||
/* 7zExtract.c */
|
||||
|
||||
#include "7zExtract.h"
|
||||
#include "7zDecode.h"
|
||||
#include "7zCrc.h"
|
||||
|
||||
SZ_RESULT SzExtract(
|
||||
ISzInStream *inStream,
|
||||
CArchiveDatabaseEx *db,
|
||||
UInt32 fileIndex,
|
||||
UInt32 *blockIndex,
|
||||
Byte **outBuffer,
|
||||
size_t *outBufferSize,
|
||||
size_t *offset,
|
||||
size_t *outSizeProcessed,
|
||||
ISzAlloc *allocMain,
|
||||
ISzAlloc *allocTemp)
|
||||
{
|
||||
UInt32 folderIndex = db->FileIndexToFolderIndexMap[fileIndex];
|
||||
SZ_RESULT res = SZ_OK;
|
||||
*offset = 0;
|
||||
*outSizeProcessed = 0;
|
||||
if (folderIndex == (UInt32)-1)
|
||||
{
|
||||
allocMain->Free(*outBuffer);
|
||||
*blockIndex = folderIndex;
|
||||
*outBuffer = 0;
|
||||
*outBufferSize = 0;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
if (*outBuffer == 0 || *blockIndex != folderIndex)
|
||||
{
|
||||
CFolder *folder = db->Database.Folders + folderIndex;
|
||||
CFileSize unPackSize = SzFolderGetUnPackSize(folder);
|
||||
#ifndef _LZMA_IN_CB
|
||||
CFileSize packSize = SzArDbGetFolderFullPackSize(db, folderIndex);
|
||||
Byte *inBuffer = 0;
|
||||
size_t processedSize;
|
||||
#endif
|
||||
*blockIndex = folderIndex;
|
||||
allocMain->Free(*outBuffer);
|
||||
*outBuffer = 0;
|
||||
|
||||
RINOK(inStream->Seek(inStream, SzArDbGetFolderStreamPos(db, folderIndex, 0)));
|
||||
|
||||
#ifndef _LZMA_IN_CB
|
||||
if (packSize != 0)
|
||||
{
|
||||
inBuffer = (Byte *)allocTemp->Alloc((size_t)packSize);
|
||||
if (inBuffer == 0)
|
||||
return SZE_OUTOFMEMORY;
|
||||
}
|
||||
res = inStream->Read(inStream, inBuffer, (size_t)packSize, &processedSize);
|
||||
if (res == SZ_OK && processedSize != (size_t)packSize)
|
||||
res = SZE_FAIL;
|
||||
#endif
|
||||
if (res == SZ_OK)
|
||||
{
|
||||
*outBufferSize = (size_t)unPackSize;
|
||||
if (unPackSize != 0)
|
||||
{
|
||||
*outBuffer = (Byte *)allocMain->Alloc((size_t)unPackSize);
|
||||
if (*outBuffer == 0)
|
||||
res = SZE_OUTOFMEMORY;
|
||||
}
|
||||
if (res == SZ_OK)
|
||||
{
|
||||
size_t outRealSize;
|
||||
res = SzDecode(db->Database.PackSizes +
|
||||
db->FolderStartPackStreamIndex[folderIndex], folder,
|
||||
#ifdef _LZMA_IN_CB
|
||||
inStream,
|
||||
#else
|
||||
inBuffer,
|
||||
#endif
|
||||
*outBuffer, (size_t)unPackSize, &outRealSize, allocTemp);
|
||||
if (res == SZ_OK)
|
||||
{
|
||||
if (outRealSize == (size_t)unPackSize)
|
||||
{
|
||||
if (folder->UnPackCRCDefined)
|
||||
{
|
||||
if (!CrcVerifyDigest(folder->UnPackCRC, *outBuffer, (size_t)unPackSize))
|
||||
res = SZE_FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
res = SZE_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef _LZMA_IN_CB
|
||||
allocTemp->Free(inBuffer);
|
||||
#endif
|
||||
}
|
||||
if (res == SZ_OK)
|
||||
{
|
||||
UInt32 i;
|
||||
CFileItem *fileItem = db->Database.Files + fileIndex;
|
||||
*offset = 0;
|
||||
for(i = db->FolderStartFileIndex[folderIndex]; i < fileIndex; i++)
|
||||
*offset += (UInt32)db->Database.Files[i].Size;
|
||||
*outSizeProcessed = (size_t)fileItem->Size;
|
||||
if (*offset + *outSizeProcessed > *outBufferSize)
|
||||
return SZE_FAIL;
|
||||
{
|
||||
if (fileItem->IsFileCRCDefined)
|
||||
{
|
||||
if (!CrcVerifyDigest(fileItem->FileCRC, *outBuffer + *offset, *outSizeProcessed))
|
||||
res = SZE_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/* 7zExtract.h */
|
||||
|
||||
#ifndef __7Z_EXTRACT_H
|
||||
#define __7Z_EXTRACT_H
|
||||
|
||||
#include "7zIn.h"
|
||||
|
||||
/*
|
||||
SzExtract extracts file from archive
|
||||
|
||||
*outBuffer must be 0 before first call for each new archive.
|
||||
|
||||
Extracting cache:
|
||||
If you need to decompress more than one file, you can send
|
||||
these values from previous call:
|
||||
*blockIndex,
|
||||
*outBuffer,
|
||||
*outBufferSize
|
||||
You can consider "*outBuffer" as cache of solid block. If your archive is solid,
|
||||
it will increase decompression speed.
|
||||
|
||||
If you use external function, you can declare these 3 cache variables
|
||||
(blockIndex, outBuffer, outBufferSize) as static in that external function.
|
||||
|
||||
Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
|
||||
*/
|
||||
|
||||
SZ_RESULT SzExtract(
|
||||
ISzInStream *inStream,
|
||||
CArchiveDatabaseEx *db,
|
||||
UInt32 fileIndex, /* index of file */
|
||||
UInt32 *blockIndex, /* index of solid block */
|
||||
Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
|
||||
size_t *outBufferSize, /* buffer size for output buffer */
|
||||
size_t *offset, /* offset of stream for required file in *outBuffer */
|
||||
size_t *outSizeProcessed, /* size of file in *outBuffer */
|
||||
ISzAlloc *allocMain,
|
||||
ISzAlloc *allocTemp);
|
||||
|
||||
#endif
|
@ -0,0 +1,5 @@
|
||||
/* 7zHeader.c */
|
||||
|
||||
#include "7zHeader.h"
|
||||
|
||||
Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
|
@ -0,0 +1,55 @@
|
||||
/* 7zHeader.h */
|
||||
|
||||
#ifndef __7Z_HEADER_H
|
||||
#define __7Z_HEADER_H
|
||||
|
||||
#include "7zTypes.h"
|
||||
|
||||
#define k7zSignatureSize 6
|
||||
extern Byte k7zSignature[k7zSignatureSize];
|
||||
|
||||
#define k7zMajorVersion 0
|
||||
|
||||
#define k7zStartHeaderSize 0x20
|
||||
|
||||
enum EIdEnum
|
||||
{
|
||||
k7zIdEnd,
|
||||
|
||||
k7zIdHeader,
|
||||
|
||||
k7zIdArchiveProperties,
|
||||
|
||||
k7zIdAdditionalStreamsInfo,
|
||||
k7zIdMainStreamsInfo,
|
||||
k7zIdFilesInfo,
|
||||
|
||||
k7zIdPackInfo,
|
||||
k7zIdUnPackInfo,
|
||||
k7zIdSubStreamsInfo,
|
||||
|
||||
k7zIdSize,
|
||||
k7zIdCRC,
|
||||
|
||||
k7zIdFolder,
|
||||
|
||||
k7zIdCodersUnPackSize,
|
||||
k7zIdNumUnPackStream,
|
||||
|
||||
k7zIdEmptyStream,
|
||||
k7zIdEmptyFile,
|
||||
k7zIdAnti,
|
||||
|
||||
k7zIdName,
|
||||
k7zIdCreationTime,
|
||||
k7zIdLastAccessTime,
|
||||
k7zIdLastWriteTime,
|
||||
k7zIdWinAttributes,
|
||||
k7zIdComment,
|
||||
|
||||
k7zIdEncodedHeader,
|
||||
|
||||
k7zIdStartPos
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@
|
||||
/* 7zIn.h */
|
||||
|
||||
#ifndef __7Z_IN_H
|
||||
#define __7Z_IN_H
|
||||
|
||||
#include "7zHeader.h"
|
||||
#include "7zItem.h"
|
||||
#include "7zAlloc.h"
|
||||
|
||||
typedef struct _CInArchiveInfo
|
||||
{
|
||||
CFileSize StartPositionAfterHeader;
|
||||
CFileSize DataStartPosition;
|
||||
}CInArchiveInfo;
|
||||
|
||||
typedef struct _CArchiveDatabaseEx
|
||||
{
|
||||
CArchiveDatabase Database;
|
||||
CInArchiveInfo ArchiveInfo;
|
||||
UInt32 *FolderStartPackStreamIndex;
|
||||
CFileSize *PackStreamStartPositions;
|
||||
UInt32 *FolderStartFileIndex;
|
||||
UInt32 *FileIndexToFolderIndexMap;
|
||||
}CArchiveDatabaseEx;
|
||||
|
||||
void SzArDbExInit(CArchiveDatabaseEx *db);
|
||||
void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *));
|
||||
CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder);
|
||||
CFileSize SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex);
|
||||
|
||||
typedef struct _ISzInStream
|
||||
{
|
||||
#ifdef _LZMA_IN_CB
|
||||
SZ_RESULT (*Read)(
|
||||
void *object, /* pointer to ISzInStream itself */
|
||||
void **buffer, /* out: pointer to buffer with data */
|
||||
size_t maxRequiredSize, /* max required size to read */
|
||||
size_t *processedSize); /* real processed size.
|
||||
processedSize can be less than maxRequiredSize.
|
||||
If processedSize == 0, then there are no more
|
||||
bytes in stream. */
|
||||
#else
|
||||
SZ_RESULT (*Read)(void *object, void *buffer, size_t size, size_t *processedSize);
|
||||
#endif
|
||||
SZ_RESULT (*Seek)(void *object, CFileSize pos);
|
||||
} ISzInStream;
|
||||
|
||||
|
||||
int SzArchiveOpen(
|
||||
ISzInStream *inStream,
|
||||
CArchiveDatabaseEx *db,
|
||||
ISzAlloc *allocMain,
|
||||
ISzAlloc *allocTemp);
|
||||
|
||||
#endif
|
@ -0,0 +1,133 @@
|
||||
/* 7zItem.c */
|
||||
|
||||
#include "7zItem.h"
|
||||
#include "7zAlloc.h"
|
||||
|
||||
void SzCoderInfoInit(CCoderInfo *coder)
|
||||
{
|
||||
SzByteBufferInit(&coder->Properties);
|
||||
}
|
||||
|
||||
void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p))
|
||||
{
|
||||
SzByteBufferFree(&coder->Properties, freeFunc);
|
||||
SzCoderInfoInit(coder);
|
||||
}
|
||||
|
||||
void SzFolderInit(CFolder *folder)
|
||||
{
|
||||
folder->NumCoders = 0;
|
||||
folder->Coders = 0;
|
||||
folder->NumBindPairs = 0;
|
||||
folder->BindPairs = 0;
|
||||
folder->NumPackStreams = 0;
|
||||
folder->PackStreams = 0;
|
||||
folder->UnPackSizes = 0;
|
||||
folder->UnPackCRCDefined = 0;
|
||||
folder->UnPackCRC = 0;
|
||||
folder->NumUnPackStreams = 0;
|
||||
}
|
||||
|
||||
void SzFolderFree(CFolder *folder, void (*freeFunc)(void *p))
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i < folder->NumCoders; i++)
|
||||
SzCoderInfoFree(&folder->Coders[i], freeFunc);
|
||||
freeFunc(folder->Coders);
|
||||
freeFunc(folder->BindPairs);
|
||||
freeFunc(folder->PackStreams);
|
||||
freeFunc(folder->UnPackSizes);
|
||||
SzFolderInit(folder);
|
||||
}
|
||||
|
||||
UInt32 SzFolderGetNumOutStreams(CFolder *folder)
|
||||
{
|
||||
UInt32 result = 0;
|
||||
UInt32 i;
|
||||
for (i = 0; i < folder->NumCoders; i++)
|
||||
result += folder->Coders[i].NumOutStreams;
|
||||
return result;
|
||||
}
|
||||
|
||||
int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex)
|
||||
{
|
||||
UInt32 i;
|
||||
for(i = 0; i < folder->NumBindPairs; i++)
|
||||
if (folder->BindPairs[i].InIndex == inStreamIndex)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int SzFolderFindBindPairForOutStream(CFolder *folder, UInt32 outStreamIndex)
|
||||
{
|
||||
UInt32 i;
|
||||
for(i = 0; i < folder->NumBindPairs; i++)
|
||||
if (folder->BindPairs[i].OutIndex == outStreamIndex)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
CFileSize SzFolderGetUnPackSize(CFolder *folder)
|
||||
{
|
||||
int i = (int)SzFolderGetNumOutStreams(folder);
|
||||
if (i == 0)
|
||||
return 0;
|
||||
for (i--; i >= 0; i--)
|
||||
if (SzFolderFindBindPairForOutStream(folder, i) < 0)
|
||||
return folder->UnPackSizes[i];
|
||||
/* throw 1; */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
int FindPackStreamArrayIndex(int inStreamIndex) const
|
||||
{
|
||||
for(int i = 0; i < PackStreams.Size(); i++)
|
||||
if (PackStreams[i] == inStreamIndex)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
void SzFileInit(CFileItem *fileItem)
|
||||
{
|
||||
fileItem->IsFileCRCDefined = 0;
|
||||
fileItem->HasStream = 1;
|
||||
fileItem->IsDirectory = 0;
|
||||
fileItem->IsAnti = 0;
|
||||
fileItem->Name = 0;
|
||||
}
|
||||
|
||||
void SzFileFree(CFileItem *fileItem, void (*freeFunc)(void *p))
|
||||
{
|
||||
freeFunc(fileItem->Name);
|
||||
SzFileInit(fileItem);
|
||||
}
|
||||
|
||||
void SzArchiveDatabaseInit(CArchiveDatabase *db)
|
||||
{
|
||||
db->NumPackStreams = 0;
|
||||
db->PackSizes = 0;
|
||||
db->PackCRCsDefined = 0;
|
||||
db->PackCRCs = 0;
|
||||
db->NumFolders = 0;
|
||||
db->Folders = 0;
|
||||
db->NumFiles = 0;
|
||||
db->Files = 0;
|
||||
}
|
||||
|
||||
void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *))
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i < db->NumFolders; i++)
|
||||
SzFolderFree(&db->Folders[i], freeFunc);
|
||||
for (i = 0; i < db->NumFiles; i++)
|
||||
SzFileFree(&db->Files[i], freeFunc);
|
||||
freeFunc(db->PackSizes);
|
||||
freeFunc(db->PackCRCsDefined);
|
||||
freeFunc(db->PackCRCs);
|
||||
freeFunc(db->Folders);
|
||||
freeFunc(db->Files);
|
||||
SzArchiveDatabaseInit(db);
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
/* 7zItem.h */
|
||||
|
||||
#ifndef __7Z_ITEM_H
|
||||
#define __7Z_ITEM_H
|
||||
|
||||
#include "7zMethodID.h"
|
||||
#include "7zHeader.h"
|
||||
#include "7zBuffer.h"
|
||||
|
||||
typedef struct _CCoderInfo
|
||||
{
|
||||
UInt32 NumInStreams;
|
||||
UInt32 NumOutStreams;
|
||||
CMethodID MethodID;
|
||||
CSzByteBuffer Properties;
|
||||
}CCoderInfo;
|
||||
|
||||
void SzCoderInfoInit(CCoderInfo *coder);
|
||||
void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p));
|
||||
|
||||
typedef struct _CBindPair
|
||||
{
|
||||
UInt32 InIndex;
|
||||
UInt32 OutIndex;
|
||||
}CBindPair;
|
||||
|
||||
typedef struct _CFolder
|
||||
{
|
||||
UInt32 NumCoders;
|
||||
CCoderInfo *Coders;
|
||||
UInt32 NumBindPairs;
|
||||
CBindPair *BindPairs;
|
||||
UInt32 NumPackStreams;
|
||||
UInt32 *PackStreams;
|
||||
CFileSize *UnPackSizes;
|
||||
int UnPackCRCDefined;
|
||||
UInt32 UnPackCRC;
|
||||
|
||||
UInt32 NumUnPackStreams;
|
||||
}CFolder;
|
||||
|
||||
void SzFolderInit(CFolder *folder);
|
||||
CFileSize SzFolderGetUnPackSize(CFolder *folder);
|
||||
int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex);
|
||||
UInt32 SzFolderGetNumOutStreams(CFolder *folder);
|
||||
CFileSize SzFolderGetUnPackSize(CFolder *folder);
|
||||
|
||||
/* #define CArchiveFileTime UInt64 */
|
||||
|
||||
typedef struct _CFileItem
|
||||
{
|
||||
/*
|
||||
CArchiveFileTime LastWriteTime;
|
||||
CFileSize StartPos;
|
||||
UInt32 Attributes;
|
||||
*/
|
||||
CFileSize Size;
|
||||
UInt32 FileCRC;
|
||||
char *Name;
|
||||
|
||||
Byte IsFileCRCDefined;
|
||||
Byte HasStream;
|
||||
Byte IsDirectory;
|
||||
Byte IsAnti;
|
||||
/*
|
||||
int AreAttributesDefined;
|
||||
int IsLastWriteTimeDefined;
|
||||
int IsStartPosDefined;
|
||||
*/
|
||||
}CFileItem;
|
||||
|
||||
void SzFileInit(CFileItem *fileItem);
|
||||
|
||||
typedef struct _CArchiveDatabase
|
||||
{
|
||||
UInt32 NumPackStreams;
|
||||
CFileSize *PackSizes;
|
||||
Byte *PackCRCsDefined;
|
||||
UInt32 *PackCRCs;
|
||||
UInt32 NumFolders;
|
||||
CFolder *Folders;
|
||||
UInt32 NumFiles;
|
||||
CFileItem *Files;
|
||||
}CArchiveDatabase;
|
||||
|
||||
void SzArchiveDatabaseInit(CArchiveDatabase *db);
|
||||
void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *));
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,225 @@
|
||||
/*
|
||||
7zMain.c
|
||||
Test application for 7z Decoder
|
||||
LZMA SDK 4.43 Copyright (c) 1999-2006 Igor Pavlov (2006-06-04)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "7zCrc.h"
|
||||
#include "7zIn.h"
|
||||
#include "7zExtract.h"
|
||||
|
||||
typedef struct _CFileInStream
|
||||
{
|
||||
ISzInStream InStream;
|
||||
FILE *File;
|
||||
} CFileInStream;
|
||||
|
||||
#ifdef _LZMA_IN_CB
|
||||
|
||||
#define kBufferSize (1 << 12)
|
||||
Byte g_Buffer[kBufferSize];
|
||||
|
||||
SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxRequiredSize, size_t *processedSize)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size, size_t *processedSize)
|
||||
{
|
||||
CFileInStream *s = (CFileInStream *)object;
|
||||
size_t processedSizeLoc = fread(buffer, 1, size, s->File);
|
||||
if (processedSize != 0)
|
||||
*processedSize = processedSizeLoc;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
|
||||
{
|
||||
CFileInStream *s = (CFileInStream *)object;
|
||||
int res = fseek(s->File, (long)pos, SEEK_SET);
|
||||
if (res == 0)
|
||||
return SZ_OK;
|
||||
return SZE_FAIL;
|
||||
}
|
||||
|
||||
void PrintError(const char *sz)
|
||||
{
|
||||
printf("\nERROR: %s\n", sz);
|
||||
}
|
||||
|
||||
int 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");
|
||||
if (numargs == 1)
|
||||
{
|
||||
printf(
|
||||
"\nUsage: 7zDec <command> <archive_name>\n\n"
|
||||
"<Commands>\n"
|
||||
" e: Extract files from archive\n"
|
||||
" l: List contents of archive\n"
|
||||
" t: Test integrity of archive\n");
|
||||
return 0;
|
||||
}
|
||||
if (numargs < 3)
|
||||
{
|
||||
PrintError("incorrect command");
|
||||
return 1;
|
||||
}
|
||||
|
||||
archiveStream.File = fopen(args[2], "rb");
|
||||
if (archiveStream.File == 0)
|
||||
{
|
||||
PrintError("can not open input file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
archiveStream.InStream.Read = SzFileReadImp;
|
||||
archiveStream.InStream.Seek = SzFileSeekImp;
|
||||
|
||||
allocImp.Alloc = SzAlloc;
|
||||
allocImp.Free = SzFree;
|
||||
|
||||
allocTempImp.Alloc = SzAllocTemp;
|
||||
allocTempImp.Free = SzFreeTemp;
|
||||
|
||||
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;
|
||||
|
||||
if (listCommand)
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i < db.Database.NumFiles; i++)
|
||||
{
|
||||
CFileItem *f = db.Database.Files + i;
|
||||
printf("%10d %s\n", (int)f->Size, f->Name);
|
||||
}
|
||||
}
|
||||
else if (testCommand || extractCommand)
|
||||
{
|
||||
UInt32 i;
|
||||
|
||||
/*
|
||||
if you need cache, use these 3 variables.
|
||||
if you use external function, you can make these variable as static.
|
||||
*/
|
||||
UInt32 blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
|
||||
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++)
|
||||
{
|
||||
size_t offset;
|
||||
size_t outSizeProcessed;
|
||||
CFileItem *f = db.Database.Files + i;
|
||||
if (f->IsDirectory)
|
||||
printf("Directory ");
|
||||
else
|
||||
printf(testCommand ?
|
||||
"Testing ":
|
||||
"Extracting");
|
||||
printf(" %s", f->Name);
|
||||
if (f->IsDirectory)
|
||||
{
|
||||
printf("\n");
|
||||
continue;
|
||||
}
|
||||
res = SzExtract(&archiveStream.InStream, &db, i,
|
||||
&blockIndex, &outBuffer, &outBufferSize,
|
||||
&offset, &outSizeProcessed,
|
||||
&allocImp, &allocTempImp);
|
||||
if (res != SZ_OK)
|
||||
break;
|
||||
if (!testCommand)
|
||||
{
|
||||
FILE *outputHandle;
|
||||
size_t processedSize;
|
||||
char *fileName = f->Name;
|
||||
size_t nameLen = strlen(f->Name);
|
||||
for (; nameLen > 0; nameLen--)
|
||||
if (f->Name[nameLen - 1] == '/')
|
||||
{
|
||||
fileName = f->Name + nameLen;
|
||||
break;
|
||||
}
|
||||
|
||||
outputHandle = fopen(fileName, "wb+");
|
||||
if (outputHandle == 0)
|
||||
{
|
||||
PrintError("can not open output file");
|
||||
res = SZE_FAIL;
|
||||
break;
|
||||
}
|
||||
processedSize = fwrite(outBuffer + offset, 1, outSizeProcessed, outputHandle);
|
||||
if (processedSize != outSizeProcessed)
|
||||
{
|
||||
PrintError("can not write output file");
|
||||
res = SZE_FAIL;
|
||||
break;
|
||||
}
|
||||
if (fclose(outputHandle))
|
||||
{
|
||||
PrintError("can not close output file");
|
||||
res = SZE_FAIL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
allocImp.Free(outBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintError("incorrect command");
|
||||
res = SZE_FAIL;
|
||||
}
|
||||
}
|
||||
SzArDbExFree(&db, allocImp.Free);
|
||||
|
||||
fclose(archiveStream.File);
|
||||
if (res == SZ_OK)
|
||||
{
|
||||
printf("\nEverything is Ok\n");
|
||||
return 0;
|
||||
}
|
||||
if (res == SZE_OUTOFMEMORY)
|
||||
PrintError("can not allocate memory");
|
||||
else
|
||||
printf("\nERROR #%d\n", res);
|
||||
return 1;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
/* 7zMethodID.c */
|
||||
|
||||
#include "7zMethodID.h"
|
||||
|
||||
int AreMethodsEqual(CMethodID *a1, CMethodID *a2)
|
||||
{
|
||||
int i;
|
||||
if (a1->IDSize != a2->IDSize)
|
||||
return 0;
|
||||
for (i = 0; i < a1->IDSize; i++)
|
||||
if (a1->ID[i] != a2->ID[i])
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue