Merged in botanic/rc-botanic-webdev/rc-botanic-webdev (pull request #37)

Fix's for installer for AMS
This commit is contained in:
Matthew Lagoe 2013-10-24 20:27:37 -07:00
commit df3da6f99b
15923 changed files with 3498328 additions and 0 deletions

26
.hgeol Normal file
View file

@ -0,0 +1,26 @@
[patterns]
**.h = native
**.cpp = native
**/database.xml = BIN
**/msg.xml = BIN
**.txt = native
**.xml = native
**.layout = native
**.looknfeel = native
**.imageset = native
**.font = native
**.scheme = native
**.xsd = native
**.dox = native
**.py = native
**.lua = native
**.pkg = native
[repository]
native = LF

228
.hgignore Normal file
View file

@ -0,0 +1,228 @@
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
core
*.pc
*.gch
# Mac OS X compile
*.dylib
# Log dump files
report_refused
report_failed
exception_catched
*.stat
*.log
log.txt
# Max plugin extensions
*.dlx
*.dlm
*.dlu
# makeall build
.mode_static
# cmake build files & directories
CMakeFiles
CMakeCache.txt
cmake_install.cmake
CTestTestfile.cmake
CPackConfig.cmake
CPackSourceConfig.cmake
.libs
# Linux garbage
Makefile*
aclocal.m4
config.guess
config.sub
configure
depcomp
config.h.in
nelconfig.h.in
install-sh
ltmain.sh
missing
ylwrap
*.mk
# Visual Studio garbage
*.opensdf
UpgradeLog*.XML
_UpgradeReport_Files
BuildLog.htm
mt.dep
ipch
*.suo
*.ncb
*.user
*.ilk
*.pdb
*.aps
*.exp
*.idb
*.sdf
# Mac OS X garbage
.DS_Store
# Ryzom server garbage
aes_alias_name.cfg
aes_nagios_report.txt
aes_state.txt
*.launch_ctrl
*.state
*.start_count
# Vim and kwrite cache
*~
# Kdevelop4 garbage
*.kdev4
.kdev4
# Python cache
*.pyd
*.pyc
# Qt compiler
moc_*.cpp
*.moc
# Misc garbage
*.rej
*.orig
*.cachefile
*.cache
*.patch
*.7z
external
external_stlport
3rdParty
.svn
thumbs.db
Thumbs.db
*.tpl.php
# build
code/nel/build/*
code/nelns/build/*
code/snowballs/build/*
code/ryzom/build/*
code/build/*
code/build-2010/*
build/*
install/*
# Linux nel compile
code/nel/build/nel-config
code/nel/config.status
code/nel/include/nelconfig.h
code/nel/include/stamp-h1
code/nel/libtool
code/nel/nel-config
code/nel/samples/3d/cluster_viewer/cluster_viewer
code/nel/samples/3d/font/font
code/nel/samples/georges/georges
code/nel/samples/misc/command/command
code/nel/samples/misc/configfile/configfile
code/nel/samples/misc/debug/debug
code/nel/samples/misc/i18n/i18n
code/nel/samples/misc/log/log
code/nel/samples/misc/strings/strings
code/nel/samples/net/chat/chatclient
code/nel/samples/net/chat/chatserver
code/nel/samples/net/login_system/nls_frontend_service
code/nel/samples/net/login_system/nls_login_client
code/nel/samples/net/udp/udp_bench_client
code/nel/samples/net/udp/udp_bench_service
code/nel/samples/pacs/pacs_sample
code/nel/tools/3d/build_coarse_mesh/build_coarse_mesh
code/nel/tools/3d/build_far_bank/build_far_bank
code/nel/tools/3d/build_smallbank/build_smallbank
code/nel/tools/3d/ig_lighter/ig_lighter
code/nel/tools/3d/zone_dependencies/zone_dependencies
code/nel/tools/3d/zone_ig_lighter/zone_ig_lighter
code/nel/tools/3d/zone_lighter/zone_lighter
code/nel/tools/3d/zone_welder/zone_welder
code/nel/tools/misc/bnp_make/bnp_make
code/nel/tools/misc/disp_sheet_id/disp_sheet_id
code/nel/tools/misc/make_sheet_id/make_sheet_id
code/nel/tools/misc/xml_packer/xml_packer
code/nel/tools/pacs/build_ig_boxes/build_ig_boxes
code/nel/tools/pacs/build_indoor_rbank/build_indoor_rbank
code/nel/tools/pacs/build_rbank/build_rbank
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/skills.skill_tree
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/xptable.xp_table
code/ryzom/tools/server/sql/ryzom_admin_default_data.sql
code/ryzom/tools/server/ryzom_ams/drupal
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php
code/ryzom/tools/server/ryzom_ams/www/html/templates_c
# Linux server compile
code/ryzom/server/src/entities_game_service/entities_game_service
code/ryzom/server/src/frontend_service/frontend_service
code/ryzom/server/src/gpm_service/gpm_service
code/ryzom/server/src/input_output_service/input_output_service
code/ryzom/server/src/mirror_service/mirror_service
code/ryzom/server/src/ryzom_admin_service/ryzom_admin_service
code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service
code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service
code/ryzom/server/src/tick_service/tick_service
# WebTT temp dir
code/ryzom/tools/server/www/webtt/app/tmp
code\ryzom\tools\server\ryzom_ams\old
# AMS ignore
code/ryzom/tools/server/ryzom_ams/www/config.php

308
code/CMakeLists.txt Normal file
View file

@ -0,0 +1,308 @@
#-----------------------------------------------------------------------------
#
# NeL
# Authors: Nevrax and the NeL Community
# Version: 0.9.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()
# Specify Mac OS X deployment target before including Darwin.cmake
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6")
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(RyzomCore CXX C)
SET(NL_VERSION_MAJOR 0)
SET(NL_VERSION_MINOR 9)
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_STATIC)
# libxml2 could need winsock2 library
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
# on Mac OS X libxml2 requires iconv and liblzma
IF(APPLE)
FIND_PACKAGE(Iconv REQUIRED)
FIND_PACKAGE(LibLZMA REQUIRED)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES} ${LIBLZMA_LIBRARIES})
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
ENDIF(APPLE)
ENDIF(WITH_STATIC)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
IF(FINAL_VERSION)
ADD_DEFINITIONS(-DFINAL_VERSION=1)
ENDIF(FINAL_VERSION)
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)
FIND_PACKAGE(CURL REQUIRED)
IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
SET(CURL_STATIC ON)
ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
IF(CURL_STATIC)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
FIND_PACKAGE(OpenSSL QUIET)
IF(OPENSSL_FOUND)
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
# CURL Macports version depends on libidn, libintl and libiconv too
IF(APPLE)
FIND_LIBRARY(IDN_LIBRARY idn)
FIND_LIBRARY(INTL_LIBRARY intl)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY})
ENDIF(APPLE)
ENDIF(CURL_STATIC)
ENDIF(WITH_GUI)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR})
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)
# 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 "NeL MMORPG Framework")
SET(CPACK_PACKAGE_VENDOR "NeL")
SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
SET(CPACK_PACKAGE_EXECUTABLES "nel${NL_VERSION}" "nel")
# NSIS Specific Packing Setup
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "NeL")
SET(CPACK_NSIS_MODIFY_PATH "ON")
SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} NeL")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
## Source Packages
SET(CPACK_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
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)

View file

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

View file

@ -0,0 +1,138 @@
# Macros to check if a library needs to be manually linked to another one
# because it's using a symbol from it but it's not linked to
# CHECK_UNDEFINED_SYMBOL
# Macro to check if a library is calling an undefined symbol
#
# Syntax:
# CHECK_UNDEFINED_SYMBOL(MYLIBRARY SYMBOL SYMBOL_FOUND)
# SYMBOL_FOUND will be set to TRUE if UNDEFINED
#
# Example:
# CHECK_UNDEFINED_SYMBOL(PNG_LIBRARY inflate INFLATE_FOUND)
#
MACRO(CHECK_UNDEFINED_SYMBOL MYLIBRARY SYMBOL SYMBOL_FOUND)
SET(${SYMBOL_FOUND} TRUE)
IF(WIN32)
# Always TRUE under Windows because we are using static libraries
ELSEIF(APPLE)
SET(CMAKE_NM nm)
IF(CMAKE_NM)
# Use nm to check if a library is using an external symbol
EXEC_PROGRAM(${CMAKE_NM} ARGS "-gu ${${MYLIBRARY}} | grep ${SYMBOL}" OUTPUT_VARIABLE NM_SYMBOL)
# MESSAGE(STATUS "Checking for undefined symbol ${SYMBOL} in ${${MYLIBRARY}}")
IF(NOT NM_SYMBOL MATCHES ${SYMBOL})
SET(${SYMBOL_FOUND} FALSE)
# MESSAGE(STATUS "Defined symbol ${SYMBOL} detected in ${${MYLIBRARY}}")
ENDIF(NOT NM_SYMBOL MATCHES ${SYMBOL})
ENDIF(CMAKE_NM)
ELSEIF(UNIX)
SET(CMAKE_OBJDUMP objdump)
IF(CMAKE_OBJDUMP)
# Use objdump to check if a library is using an external symbol
#MESSAGE(STATUS "exec ${CMAKE_OBJDUMP} -T ${${MYLIBRARY}} | grep ${SYMBOL}")
EXEC_PROGRAM(${CMAKE_OBJDUMP} ARGS "-T ${${MYLIBRARY}} | grep ${SYMBOL}" OUTPUT_VARIABLE OBJDUMP_SYMBOL)
IF(NOT OBJDUMP_SYMBOL MATCHES "UND")
#MESSAGE(STATUS "${${MYLIBRARY}} does not use symbol ${SYMBOL}")
SET(${SYMBOL_FOUND} FALSE)
ELSE(NOT OBJDUMP_SYMBOL MATCHES "UND")
#MESSAGE(STATUS "${${MYLIBRARY}} uses symbol ${SYMBOL}")
ENDIF(NOT OBJDUMP_SYMBOL MATCHES "UND")
ENDIF(CMAKE_OBJDUMP)
ENDIF(WIN32)
ENDMACRO(CHECK_UNDEFINED_SYMBOL)
# CHECK_LINKED_LIBRARY
# Macro to check if a library is linked to another one
#
# Syntax:
# CHECK_LINKED_LIBRARY(MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
# LIBRARY_FOUND will be set to TRUE if LINKED
#
# Example:
# CHECK_LINKED_LIBRARY(PNG_LIBRARY ZLIB_LIBRARY ZLIB_FOUND)
#
MACRO(CHECK_LINKED_LIBRARY MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
SET(${LIBRARY_FOUND} FALSE)
IF(WIN32)
# Always FALSE under Windows because we are using static libraries
ELSEIF(APPLE)
SET(CMAKE_OTOOL otool)
IF(CMAKE_OTOOL)
# Use otool to check if a library is linked to another library
GET_FILENAME_COMPONENT(LIBNAME "${${OTHERLIBRARY}}" NAME_WE)
EXEC_PROGRAM(${CMAKE_OTOOL} ARGS "-L ${${MYLIBRARY}} | grep ${LIBNAME}" OUTPUT_VARIABLE OTOOL_LIBRARY)
# MESSAGE(STATUS "Checking if ${LIBNAME} is linked to ${${MYLIBRARY}}")
IF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
SET(${LIBRARY_FOUND} TRUE)
# MESSAGE(STATUS "Library ${LIBNAME} already linked to ${${MYLIBRARY}}")
ENDIF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
ENDIF(CMAKE_OTOOL)
ELSEIF(UNIX)
SET(CMAKE_OBJDUMP objdump)
IF(CMAKE_OBJDUMP)
GET_FILENAME_COMPONENT(LIBNAME "${${OTHERLIBRARY}}" NAME)
# TODO: under Solaris use dump -Lv <lib>
# Use objdump to check if a library is linked to another library
#MESSAGE(STATUS "exec ${CMAKE_OBJDUMP} -p ${${MYLIBRARY}} | grep ${LIBNAME}")
EXEC_PROGRAM(${CMAKE_OBJDUMP} ARGS "-p ${${MYLIBRARY}} | grep ${LIBNAME}" OUTPUT_VARIABLE OBJDUMP_LIBRARY)
IF(OBJDUMP_LIBRARY MATCHES "NEEDED")
#MESSAGE(STATUS "${${MYLIBRARY}} references to ${LIBNAME}.")
SET(${LIBRARY_FOUND} TRUE)
ELSE(OBJDUMP_LIBRARY MATCHES "NEEDED")
#MESSAGE(STATUS "${${MYLIBRARY}} does not reference to ${LIBNAME}!")
ENDIF(OBJDUMP_LIBRARY MATCHES "NEEDED")
ENDIF(CMAKE_OBJDUMP)
ENDIF(WIN32)
ENDMACRO(CHECK_LINKED_LIBRARY)
MACRO(CHECK_DEPENDS MYLIBRARY OTHERLIBRARY SYMBOL MUSTLINK)
CHECK_UNDEFINED_SYMBOL(MYLIBRARY SYMBOL SYMBOL_FOUND)
IF(SYMBOL_FOUND)
CHECK_LINKED_LIBRARY(MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
ENDIF(SYMBOL_FOUND)
IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
SET(${MUSTLINK} YES)
ELSE(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
SET(${MUSTLINK} NO)
ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ENDMACRO(CHECK_DEPENDS)
# LINK_DEPENDS
# Macro to link a library if a symbol is used but is not already linked to it
#
# Syntax:
# LINK_DEPENDS(LIBRARIES MYLIBRARY OTHERLIBRARY SYMBOL)
# OTHERLIBRARY_LINKED will be set to TRUE or FALSE
#
# Example:
# LINK_DEPENDS(PNG_LIBRARIES PNG_LIBRARY ZLIB_LIBRARY inflate)
#
MACRO(LINK_DEPENDS LIBRARIES MYLIBRARY OTHERLIBRARY SYMBOL)
SET(MUST_LINK FALSE)
IF(${MYLIBRARY} AND ${OTHERLIBRARY} AND NOT ${OTHERLIBRARY}_LINKED)
IF(WIN32 OR WITH_STATIC)
# In static, we link all libraries because it will keep only used symbols
SET(MUST_LINK TRUE)
ELSE(WIN32 OR WITH_STATIC)
CHECK_UNDEFINED_SYMBOL(${MYLIBRARY} ${SYMBOL} SYMBOL_FOUND)
IF(SYMBOL_FOUND)
CHECK_LINKED_LIBRARY(${MYLIBRARY} ${OTHERLIBRARY} LIBRARY_FOUND)
ENDIF(SYMBOL_FOUND)
IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
MESSAGE(STATUS "Underlinking found: ${${MYLIBRARY}} needs ${${OTHERLIBRARY}} but is not linked to, manually linking...")
SET(MUST_LINK TRUE)
ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ENDIF(WIN32 OR WITH_STATIC)
ENDIF(${MYLIBRARY} AND ${OTHERLIBRARY} AND NOT ${OTHERLIBRARY}_LINKED)
IF(MUST_LINK)
MESSAGE(STATUS "Linking with ${${OTHERLIBRARY}}")
SET(${LIBRARIES} ${${LIBRARIES}} ${${OTHERLIBRARY}})
SET(${OTHERLIBRARY}_LINKED TRUE)
ENDIF(MUST_LINK)
ENDMACRO(LINK_DEPENDS)

View file

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

View file

@ -0,0 +1,76 @@
# - Find DirectInput
# Find the DirectSound includes and libraries
#
# 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_INCLUDE_DIR max.h
PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include"
)
find_path(MAXSDK_CS_INCLUDE_DIR bipexp.h
PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include/CS"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include/CS"
)
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/lib"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/lib"
)
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)

View file

@ -0,0 +1,53 @@
# - Locate CEGUI library
# This module defines
# CEGUI_LIBRARY, the library to link against
# CEGUI_FOUND, if false, do not try to link to CEGUI
# CEGUI_INCLUDE_DIRS, where to find headers.
IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
# in cache already
SET(CEGUI_FIND_QUIETLY TRUE)
ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
FIND_PATH(CEGUI_INCLUDE_DIRS
CEGUI
PATHS
$ENV{CEGUI_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES cegui CEGUI
)
FIND_LIBRARY(CEGUI_LIBRARY
NAMES CEGUIBase
PATHS
$ENV{CEGUI_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
)
GET_FILENAME_COMPONENT(CEGUI_LIB_DIR ${CEGUI_LIBRARY} PATH CACHE)
IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
SET(CEGUI_FOUND "YES")
SET(CEGUI_INCLUDE_DIRS "${CEGUI_INCLUDE_DIRS}/CEGUI")
IF(NOT CEGUI_FIND_QUIETLY)
MESSAGE(STATUS "Found CEGUI: ${CEGUI_LIBRARY}")
ENDIF(NOT CEGUI_FIND_QUIETLY)
ELSE(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
IF(NOT CEGUI_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find CEGUI!")
ENDIF(NOT CEGUI_FIND_QUIETLY)
ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)

View file

@ -0,0 +1,84 @@
#
# Find the CppTest includes and library
#
# This module defines
# CPPTEST_INCLUDE_DIR, where to find tiff.h, etc.
# CPPTEST_LIBRARIES, where to find the CppTest libraries.
# CPPTEST_FOUND, If false, do not try to use CppTest.
# also defined, but not for general use are
IF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR)
# in cache already
SET(CPPTEST_FIND_QUIETLY TRUE)
ENDIF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR)
FIND_PATH(CPPTEST_INCLUDE_DIR
cpptest.h
PATHS
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES cppunit cpptest
)
SET(LIBRARY_NAME_RELEASE cpptest)
SET(LIBRARY_NAME_DEBUG cpptestd)
IF(WITH_STLPORT)
SET(LIBRARY_NAME_RELEASE cpptest_stlport ${LIBRARY_NAME_RELEASE})
SET(LIBRARY_NAME_DEBUG cpptest_stlportd ${LIBRARY_NAME_DEBUG})
ENDIF(WITH_STLPORT)
FIND_LIBRARY(CPPTEST_LIBRARY_RELEASE
${LIBRARY_NAME_RELEASE}
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(CPPTEST_LIBRARY_DEBUG
${LIBRARY_NAME_DEBUG}
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(CPPTEST_INCLUDE_DIR)
IF(CPPTEST_LIBRARY_RELEASE)
SET(CPPTEST_FOUND TRUE)
SET(CPPTEST_LIBRARIES "optimized;${CPPTEST_LIBRARY_RELEASE}")
IF(CPPTEST_LIBRARY_DEBUG)
SET(CPPTEST_LIBRARIES "${CPPTEST_LIBRARIES};debug;${CPPTEST_LIBRARY_DEBUG}")
ENDIF(CPPTEST_LIBRARY_DEBUG)
ENDIF(CPPTEST_LIBRARY_RELEASE)
ENDIF(CPPTEST_INCLUDE_DIR)
IF(CPPTEST_FOUND)
IF(NOT CPPTEST_FIND_QUIETLY)
MESSAGE(STATUS "Found CppTest: ${CPPTEST_LIBRARIES}")
ENDIF(NOT CPPTEST_FIND_QUIETLY)
ELSE(CPPTEST_FOUND)
IF(NOT CPPTEST_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find CppTest!")
ENDIF(NOT CPPTEST_FIND_QUIETLY)
ENDIF(CPPTEST_FOUND)
MARK_AS_ADVANCED(CPPTEST_LIBRARY_RELEASE CPPTEST_LIBRARY_DEBUG)

View file

@ -0,0 +1,50 @@
# - Locate MFC libraries
# This module defines
# MFC_FOUND, if false, do not try to link to MFC
# MFC_LIBRARY_DIR, where to find libraries
# MFC_INCLUDE_DIR, where to find headers
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF(CustomMFC_FIND_REQUIRED)
# Try to find MFC using official module, MFC_FOUND is set
FIND_PACKAGE(MFC)
IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
IF(MFC_FOUND AND VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(MFC_FOUND AND VC_DIR)
FIND_PATH(MFC_DIR
include/afxwin.h
HINTS
${MFC_STANDARD_DIR}
)
ENDIF(NOT MFC_DIR)
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
IF(MFC_FOUND)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
ELSE(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
ENDIF(TARGET_X64)
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
# Set definitions for using MFC in DLL
SET(MFC_DEFINITIONS -D_AFXDLL)
ENDIF(MFC_FOUND)
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project

View file

@ -0,0 +1,36 @@
# - Find DirectSound
# Find the DirectSound includes and libraries
#
# DSOUND_INCLUDE_DIR - where to find dsound.h
# DSOUND_LIBRARIES - List of libraries when using dsound.
# DSOUND_FOUND - True if dsound found.
if(DSOUND_INCLUDE_DIR)
# Already in cache, be silent
set(DSOUND_FIND_QUIETLY TRUE)
endif(DSOUND_INCLUDE_DIR)
find_path(DSOUND_INCLUDE_DIR dsound.h
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Include"
)
find_library(DSOUND_LIBRARY dsound
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Lib"
"$ENV{DXSDK_DIR}/Lib/x86"
)
# Handle the QUIETLY and REQUIRED arguments and set DSOUND_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DSOUND DEFAULT_MSG
DSOUND_INCLUDE_DIR DSOUND_LIBRARY)
if(DSOUND_FOUND)
set(DSOUND_LIBRARIES ${DSOUND_LIBRARY})
else(DSOUND_FOUND)
set(DSOUND_LIBRARIES)
endif(DSOUND_FOUND)
mark_as_advanced(DSOUND_INCLUDE_DIR DSOUND_LIBRARY)

View file

@ -0,0 +1,70 @@
# - Find DirectX
# Find the DirectX includes and libraries
#
# DXSDK_INCLUDE_DIR - where to find baseinterface.h
# DXSDK_LIBRARIES - List of libraries when using 3DSMAX.
# DXSDK_FOUND - True if MAX SDK found.
IF(DXSDK_DIR)
# Already in cache, be silent
SET(DXSDK_FIND_QUIETLY TRUE)
ENDIF(DXSDK_DIR)
FIND_PATH(DXSDK_DIR
"Include/dxsdkver.h"
PATHS
"$ENV{DXSDK_DIR}"
"C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)"
"C:/Program Files/Microsoft DirectX SDK (June 2010)"
"C:/Program Files (x86)/Microsoft DirectX SDK (February 2010)"
"C:/Program Files/Microsoft DirectX SDK (February 2010)"
"C:/Program Files (x86)/Microsoft DirectX SDK (November 2007)"
"C:/Program Files/Microsoft DirectX SDK (November 2007)"
"C:/Program Files (x86)/Microsoft DirectX SDK"
"C:/Program Files/Microsoft DirectX SDK"
)
MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
"${DXSDK_LIBRARY_DIR}"
)
ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
IF(DXSDK_DIR)
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
IF(TARGET_X64)
SET(DXSDK_LIBRARY_DIR "${DXSDK_DIR}/Lib/x64")
ELSE(TARGET_X64)
SET(DXSDK_LIBRARY_DIR "${DXSDK_DIR}/Lib/x86")
ENDIF(TARGET_X64)
FIND_DXSDK_LIBRARY(DXSDK_GUID_LIBRARY dxguid)
FIND_DXSDK_LIBRARY(DXSDK_DINPUT_LIBRARY dinput8)
FIND_DXSDK_LIBRARY(DXSDK_DSOUND_LIBRARY dsound)
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
#FIND_DXSDK_LIBRARY(DXSDK_MESH_LIBRARY mesh)
#FIND_DXSDK_LIBRARY(DXSDK_MAXUTIL_LIBRARY maxutil)
#FIND_DXSDK_LIBRARY(DXSDK_MAXSCRIPT_LIBRARY maxscrpt)
#FIND_DXSDK_LIBRARY(DXSDK_PARAMBLK2_LIBRARY paramblk2)
#FIND_DXSDK_LIBRARY(DXSDK_BMM_LIBRARY bmm)
ENDIF(DXSDK_DIR)
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
# all listed variables are TRUE.
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectXSDK DEFAULT_MSG DXSDK_DIR DXSDK_GUID_LIBRARY DXSDK_DINPUT_LIBRARY)
MARK_AS_ADVANCED(DXSDK_INCLUDE_DIR
DXSDK_GUID_LIBRARY
DXSDK_DINPUT_LIBRARY
DXSDK_DSOUND_LIBRARY
DXSDK_XAUDIO_LIBRARY
DXSDK_D3DX9_LIBRARY
DXSDK_D3D9_LIBRARY)

View file

@ -0,0 +1,50 @@
# - Locate EFX-Util library
# This module defines
# EFXUTIL_LIBRARY, the library to link against
# EFXUTIL_FOUND, if false, do not try to link to EFX-Util
# EFXUTIL_INCLUDE_DIR, where to find headers.
IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
# in cache already
SET(EFXUTIL_FIND_QUIETLY TRUE)
ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
FIND_PATH(EFXUTIL_INCLUDE_DIR
EFX-Util.h
PATHS
$ENV{EFXUTIL_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES AL
)
FIND_LIBRARY(EFXUTIL_LIBRARY
NAMES EFX-Util efxutil libefxutil
PATHS
$ENV{EFXUTIL_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(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
SET(EFXUTIL_FOUND "YES")
IF(NOT EFXUTIL_FIND_QUIETLY)
MESSAGE(STATUS "Found EFX-Util: ${EFXUTIL_LIBRARY}")
ENDIF(NOT EFXUTIL_FIND_QUIETLY)
ELSE(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
IF(NOT EFXUTIL_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find EFX-Util!")
ENDIF(NOT EFXUTIL_FIND_QUIETLY)
ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)

View file

@ -0,0 +1,72 @@
# Look for a directory containing external libraries.
#
# The following values are defined
# EXTERNAL_PATH - where to find external
# EXTERNAL_INCLUDE_PATH - where to find external includes
# EXTERNAL_BINARY_PATH - where to find external binaries
# EXTERNAL_LIBRARY_PATH - where to find external libraries
# EXTERNAL_FOUND - True if the external libraries are available
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH})
SET(EXTERNAL_TEMP_FILE "include/wwwconf.h")
SET(EXTERNAL_NAME "external")
# If using STLport preprend external_stlport
IF(WITH_STLPORT)
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external_stlport ${CMAKE_CURRENT_SOURCE_DIR}/../external_stlport ${EXTERNAL_TEMP_PATH})
SET(EXTERNAL_TEMP_FILE "include/stlport/string")
SET(EXTERNAL_NAME "external with STLport")
ENDIF(WITH_STLPORT)
FIND_PATH(EXTERNAL_PATH
${EXTERNAL_TEMP_FILE}
PATHS
$ENV{EXTERNAL_PATH}
${EXTERNAL_TEMP_PATH}
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
IF(EXTERNAL_PATH)
SET(EXTERNAL_FOUND TRUE)
SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include")
# Using 32 or 64 bits binaries
IF(TARGET_X64 AND WIN32)
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64")
ELSE(TARGET_X64 AND WIN32)
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin")
ENDIF(TARGET_X64 AND WIN32)
# Using 32 or 64 bits libraries
IF(TARGET_X64 AND WIN32)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
ELSE(TARGET_X64 AND WIN32)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
ENDIF(TARGET_X64 AND WIN32)
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")
# Stupid hack for FindOpenAL.cmake
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")
SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")
ENDIF(EXTERNAL_PATH)
IF(EXTERNAL_FOUND)
IF(NOT External_FIND_QUIETLY)
MESSAGE(STATUS "Found ${EXTERNAL_NAME}: ${EXTERNAL_PATH}")
ENDIF(NOT External_FIND_QUIETLY)
ELSE(EXTERNAL_FOUND)
IF(External_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Unable to find ${EXTERNAL_NAME}!")
ELSE(External_FIND_REQUIRED)
IF(NOT External_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find ${EXTERNAL_NAME}!")
ENDIF(NOT External_FIND_QUIETLY)
ENDIF(External_FIND_REQUIRED)
ENDIF(EXTERNAL_FOUND)
MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH)

View file

@ -0,0 +1,50 @@
# - 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
)
FIND_LIBRARY(FMOD_LIBRARY
NAMES fmod fmodvc libfmod fmod64
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)

View file

@ -0,0 +1,105 @@
# - Locate FreeType library
# This module defines
# FREETYPE_LIBRARIES, libraries to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
# in cache already
SET(Freetype_FIND_QUIETLY TRUE)
ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
FIND_PATH(FREETYPE_INCLUDE_DIRS
freetype
PATHS
$ENV{FREETYPE_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES freetype freetype2
)
# ft2build.h does not reside in the freetype include dir
FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
ft2build.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(FREETYPE_ADDITIONAL_INCLUDE_DIR)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR})
ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE
NAMES freetype libfreetype freetype219 freetype246
PATHS
$ENV{FREETYPE_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/lib/x86_64-linux-gnu
)
FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG
NAMES freetyped libfreetyped freetype219d freetype246d
PATHS
$ENV{FREETYPE_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/lib/x86_64-linux-gnu
)
IF(FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES optimized ${FREETYPE_LIBRARY_RELEASE} debug ${FREETYPE_LIBRARY_DEBUG})
ELSEIF(FREETYPE_LIBRARY_RELEASE)
# Normal case
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_RELEASE})
ELSEIF(FREETYPE_LIBRARY_DEBUG)
# Case where Freetype is compiled from sources (debug version is compiled by default)
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG})
ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
ENDIF(FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_FOUND)
IF(WITH_STATIC_EXTERNAL AND APPLE)
FIND_PACKAGE(BZip2)
IF(BZIP2_FOUND)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR})
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES})
ENDIF(BZIP2_FOUND)
ENDIF(WITH_STATIC_EXTERNAL AND APPLE)
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}")
ENDIF(NOT Freetype_FIND_QUIETLY)
ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FreeType!")
ENDIF(NOT Freetype_FIND_QUIETLY)
ENDIF(FREETYPE_FOUND)

View file

@ -0,0 +1,470 @@
# - Try to find GTK2
# Once done this will define
#
# GTK2_FOUND - System has GTK2
# GTK2_INCLUDE_DIRS - GTK2 include directory
# GTK2_LIBRARIES - Link these to use GTK2
# GTK2_LIBRARY_DIRS - The path to where the GTK2 library files are.
# GTK2_DEFINITIONS - Compiler switches required for using GTK2
#
# Copyright (c) 2007 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
set(GTK2_DEBUG ON)
macro(GTK2_DEBUG_MESSAGE _message)
if (GTK2_DEBUG)
message(STATUS "(DEBUG) ${_message}")
endif (GTK2_DEBUG)
endmacro(GTK2_DEBUG_MESSAGE _message)
if (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
# in cache already
set(GTK2_FOUND TRUE)
else (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
if (UNIX)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
include(UsePkgConfig)
pkgconfig(gtk+-2.0 _GTK2IncDir _GTK2LinkDir _GTK2LinkFlags _GTK2Cflags)
find_path(GTK2_GTK_INCLUDE_DIR
NAMES
gtk/gtk.h
PATHS
$ENV{GTK2_HOME}
${_GTK2IncDir}
/usr/include/gtk-2.0
/usr/local/include/gtk-2.0
/opt/include/gtk-2.0
/opt/gnome/include/gtk-2.0
/sw/include/gtk-2.0
)
gtk2_debug_message("GTK2_GTK_INCLUDE_DIR is ${GTK2_GTK_INCLUDE_DIR}")
# Some Linux distributions (e.g. Red Hat) have glibconfig.h
# and glib.h in different directories, so we need to look
# for both.
# - Atanas Georgiev <atanas@cs.columbia.edu>
pkgconfig(glib-2.0 _GLIB2IncDir _GLIB2LinkDir _GLIB2LinkFlags _GLIB2Cflags)
pkgconfig(gmodule-2.0 _GMODULE2IncDir _GMODULE2LinkDir _GMODULE2LinkFlags _GMODULE2Cflags)
find_path(GTK2_GLIBCONFIG_INCLUDE_DIR
NAMES
glibconfig.h
PATHS
${_GLIB2IncDir}
${_GMODULE2IncDir}
/opt/gnome/lib64/glib-2.0/include
/opt/gnome/lib/glib-2.0/include
/opt/lib/glib-2.0/include
/usr/lib64/glib-2.0/include
/usr/lib/glib-2.0/include
/sw/lib/glib-2.0/include
/usr/lib/x86_64-linux-gnu/glib-2.0/include
)
gtk2_debug_message("GTK2_GLIBCONFIG_INCLUDE_DIR is ${GTK2_GLIBCONFIG_INCLUDE_DIR}")
find_path(GTK2_GLIB_INCLUDE_DIR
NAMES
glib.h
PATHS
${_GLIB2IncDir}
${_GMODULE2IncDir}
/opt/include/glib-2.0
/opt/gnome/include/glib-2.0
/usr/include/glib-2.0
/sw/include/glib-2.0
)
gtk2_debug_message("GTK2_GLIB_INCLUDE_DIR is ${GTK2_GLIB_INCLUDE_DIR}")
pkgconfig(gdk-2.0 _GDK2IncDir _GDK2LinkDir _GDK2LinkFlags _GDK2Cflags)
find_path(GTK2_GDK_INCLUDE_DIR
NAMES
gdkconfig.h
PATHS
${_GDK2IncDir}
/opt/gnome/lib/gtk-2.0/include
/opt/gnome/lib64/gtk-2.0/include
/opt/lib/gtk-2.0/include
/usr/lib/gtk-2.0/include
/usr/lib64/gtk-2.0/include
/sw/lib/gtk-2.0/include
/usr/lib/x86_64-linux-gnu/gtk-2.0/include
)
gtk2_debug_message("GTK2_GDK_INCLUDE_DIR is ${GTK2_GDK_INCLUDE_DIR}")
find_path(GTK2_GDK_PIXBUF_INCLUDE_DIR
NAMES
gdk-pixbuf/gdk-pixbuf.h
PATHS
${_GDK2IncDir}
/opt/gnome/lib/gtk-2.0/include
/opt/gnome/lib64/gtk-2.0/include
/opt/lib/gtk-2.0/include
/usr/lib/gtk-2.0/include
/usr/lib64/gtk-2.0/include
/sw/lib/gtk-2.0/include
/usr/include/gdk-pixbuf-2.0
)
gtk2_debug_message("GTK2_GDK_PIXBUF_INCLUDE_DIR is ${GTK2_GDK_PIXBUF_INCLUDE_DIR}")
find_path(GTK2_GTKGL_INCLUDE_DIR
NAMES
gtkgl/gtkglarea.h
PATHS
${_GLIB2IncDir}
/usr/include
/usr/include/gtkgl-2.0
/usr/local/include
/usr/openwin/share/include
/opt/gnome/include
/opt/include
/sw/include
)
gtk2_debug_message("GTK2_GTKGL_INCLUDE_DIR is ${GTK2_GTKGL_INCLUDE_DIR}")
pkgconfig(libglade-2.0 _GLADEIncDir _GLADELinkDir _GLADELinkFlags _GLADECflags)
find_path(GTK2_GLADE_INCLUDE_DIR
NAMES
glade/glade.h
PATHS
${_GLADEIncDir}
/opt/gnome/include/libglade-2.0
/usr/include/libglade-2.0
/opt/include/libglade-2.0
/sw/include/libglade-2.0
)
gtk2_debug_message("GTK2_GLADE_INCLUDE_DIR is ${GTK2_GLADE_INCLUDE_DIR}")
pkgconfig(pango _PANGOIncDir _PANGOLinkDir _PANGOLinkFlags _PANGOCflags)
find_path(GTK2_PANGO_INCLUDE_DIR
NAMES
pango/pango.h
PATHS
${_PANGOIncDir}
/usr/include/pango-1.0
/opt/gnome/include/pango-1.0
/opt/include/pango-1.0
/sw/include/pango-1.0
)
gtk2_debug_message("GTK2_PANGO_INCLUDE_DIR is ${GTK2_PANGO_INCLUDE_DIR}")
pkgconfig(cairo _CAIROIncDir _CAIROLinkDir _CAIROLinkFlags _CAIROCflags)
find_path(GTK2_CAIRO_INCLUDE_DIR
NAMES
cairo.h
PATHS
${_CAIROIncDir}
/opt/gnome/include/cairo
/usr/include
/usr/include/cairo
/opt/include
/opt/include/cairo
/sw/include
/sw/include/cairo
)
gtk2_debug_message("GTK2_CAIRO_INCLUDE_DIR is ${GTK2_CAIRO_INCLUDE_DIR}")
pkgconfig(atk _ATKIncDir _ATKLinkDir _ATKLinkFlags _ATKCflags)
find_path(GTK2_ATK_INCLUDE_DIR
NAMES
atk/atk.h
PATHS
${_ATKIncDir}
/opt/gnome/include/atk-1.0
/usr/include/atk-1.0
/opt/include/atk-1.0
/sw/include/atk-1.0
)
gtk2_debug_message("GTK2_ATK_INCLUDE_DIR is ${GTK2_ATK_INCLUDE_DIR}")
find_library(GTK2_GTK_LIBRARY
NAMES
gtk-x11-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GTK_LIBRARY is ${GTK2_GTK_LIBRARY}")
find_library(GTK2_GDK_LIBRARY
NAMES
gdk-x11-2.0
PATHS
${_GDK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GDK_LIBRARY is ${GTK2_GDK_LIBRARY}")
find_library(GTK2_GDK_PIXBUF_LIBRARY
NAMES
gdk_pixbuf-2.0
PATHS
${_GDK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GDK_PIXBUF_LIBRARY is ${GTK2_GDK_PIXBUF_LIBRARY}")
find_library(GTK2_GMODULE_LIBRARY
NAMES
gmodule-2.0
PATHS
${_GMODULE2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GMODULE_LIBRARY is ${GTK2_GMODULE_LIBRARY}")
find_library(GTK2_GTHREAD_LIBRARY
NAMES
gthread-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GTHREAD_LIBRARY is ${GTK2_GTHREAD_LIBRARY}")
find_library(GTK2_GOBJECT_LIBRARY
NAMES
gobject-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GOBJECT_LIBRARY is ${GTK2_GOBJECT_LIBRARY}")
find_library(GTK2_GLIB_LIBRARY
NAMES
glib-2.0
PATHS
${_GLIB2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GLIB_LIBRARY is ${GTK2_GLIB_LIBRARY}")
find_library(GTK2_GTKGL_LIBRARY
NAMES
gtkgl-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GTKGL_LIBRARY is ${GTK2_GTKGL_LIBRARY}")
find_library(GTK2_GLADE_LIBRARY
NAMES
glade-2.0
PATHS
${_GLADELinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GLADE_LIBRARY is ${GTK2_GLADE_LIBRARY}")
find_library(GTK2_PANGO_LIBRARY
NAMES
pango-1.0
PATHS
${_PANGOLinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_PANGO_LIBRARY is ${GTK2_PANGO_LIBRARY}")
find_library(GTK2_CAIRO_LIBRARY
NAMES
pangocairo-1.0
PATHS
${_CAIROLinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_PANGO_LIBRARY is ${GTK2_CAIRO_LIBRARY}")
find_library(GTK2_ATK_LIBRARY
NAMES
atk-1.0
PATHS
${_ATKinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_ATK_LIBRARY is ${GTK2_ATK_LIBRARY}")
set(GTK2_INCLUDE_DIRS
${GTK2_GTK_INCLUDE_DIR}
${GTK2_GLIBCONFIG_INCLUDE_DIR}
${GTK2_GLIB_INCLUDE_DIR}
${GTK2_GDK_INCLUDE_DIR}
${GTK2_GDK_PIXBUF_INCLUDE_DIR}
${GTK2_GLADE_INCLUDE_DIR}
${GTK2_PANGO_INCLUDE_DIR}
${GTK2_CAIRO_INCLUDE_DIR}
${GTK2_ATK_INCLUDE_DIR}
)
if (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR)
if (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR AND GTK2_GDK_PIXBUF_INCLUDE_DIR)
if (GTK2_GMODULE_LIBRARY)
if (GTK2_GTHREAD_LIBRARY)
if (GTK2_GOBJECT_LIBRARY)
if (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR)
if (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR)
if (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR)
if (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR)
# set GTK2 libraries
set (GTK2_LIBRARIES
${GTK2_GTK_LIBRARY}
${GTK2_GDK_LIBRARY}
${GTK2_GDK_PIXBUF_LIBRARY}
${GTK2_GMODULE_LIBRARY}
${GTK2_GTHREAD_LIBRARY}
${GTK2_GOBJECT_LIBRARY}
${GTK2_GLADE_LIBRARY}
${GTK2_PANGO_LIBRARY}
${GTK2_CAIRO_LIBRARY}
${GTK2_ATK_LIBRARY}
)
# check for gtkgl support
if (GTK2_GTKGL_LIBRARY AND GTK2_GTKGL_INCLUDE_DIR)
set(GTK2_GTKGL_FOUND TRUE)
set(GTK2_INCLUDE_DIRS
${GTK2_INCLUDE_DIRS}
${GTK2_GTKGL_INCLUDE_DIR}
)
set(GTK2_LIBRARIES
${GTK2_LIBRARIES}
${GTK2_GTKGL_LIBRARY}
)
endif (GTK2_GTKGL_LIBRARY AND GTK2_GTKGL_INCLUDE_DIR)
else (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR)
message(SEND_ERROR "Could not find ATK")
endif (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR)
else (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR)
message(SEND_ERROR "Could not find CAIRO")
endif (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR)
else (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR)
message(SEND_ERROR "Could not find PANGO")
endif (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR)
else (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR)
message(SEND_ERROR "Could not find GLADE")
endif (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR)
else (GTK2_GOBJECT_LIBRARY)
message(SEND_ERROR "Could not find GOBJECT")
endif (GTK2_GOBJECT_LIBRARY)
else (GTK2_GTHREAD_LIBRARY)
message(SEND_ERROR "Could not find GTHREAD")
endif (GTK2_GTHREAD_LIBRARY)
else (GTK2_GMODULE_LIBRARY)
message(SEND_ERROR "Could not find GMODULE")
endif (GTK2_GMODULE_LIBRARY)
else (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR AND GTK2_GDK_PIXBUF_INCLUDE_DIR)
message(SEND_ERROR "Could not find GDK (GDK_PIXBUF)")
endif (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR AND GTK2_GDK_PIXBUF_INCLUDE_DIR)
else (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR)
message(SEND_ERROR "Could not find GTK2-X11")
endif (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR)
if (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES)
set(GTK2_FOUND TRUE)
endif (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES)
if (GTK2_FOUND)
if (NOT GTK2_FIND_QUIETLY)
message(STATUS "Found GTK2: ${GTK2_LIBRARIES}")
endif (NOT GTK2_FIND_QUIETLY)
else (GTK2_FOUND)
if (GTK2_FIND_REQUIRED)
message(FATAL_ERROR "Could not find GTK2")
endif (GTK2_FIND_REQUIRED)
endif (GTK2_FOUND)
# show the GTK2_INCLUDE_DIRS and GTK2_LIBRARIES variables only in the advanced view
mark_as_advanced(GTK2_INCLUDE_DIRS GTK2_LIBRARIES)
endif (UNIX)
endif (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)

View file

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

View file

@ -0,0 +1,50 @@
# - Locate Jpeg library
# This module defines
# JPEG_LIBRARY, the library to link against
# JPEG_FOUND, if false, do not try to link to JPEG
# JPEG_INCLUDE_DIR, where to find headers.
IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
# in cache already
SET(JPEG_FIND_QUIETLY TRUE)
ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
FIND_PATH(JPEG_INCLUDE_DIR
jpeglib.h
PATHS
$ENV{JPEG_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES jpeg
)
FIND_LIBRARY(JPEG_LIBRARY
NAMES jpeg libjpeg
PATHS
$ENV{JPEG_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(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
SET(JPEG_FOUND "YES")
IF(NOT JPEG_FIND_QUIETLY)
MESSAGE(STATUS "Found Jpeg: ${JPEG_LIBRARY}")
ENDIF(NOT JPEG_FIND_QUIETLY)
ELSE(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
IF(NOT JPEG_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Jpeg!")
ENDIF(NOT JPEG_FIND_QUIETLY)
ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)

View file

@ -0,0 +1,70 @@
# - Locate LibOVR library
# This module defines
# LIBOVR_LIBRARIES, the libraries to link against
# LIBOVR_FOUND, if false, do not try to link to LIBOVR
# LIBOVR_INCLUDE_DIR, where to find headers.
IF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
# in cache already
SET(LIBOVR_FIND_QUIETLY TRUE)
ENDIF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
FIND_PATH(LIBOVR_INCLUDE_DIR
OVR.h
PATHS
$ENV{LIBOVR_DIR}/Include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
IF(UNIX)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/x86_64")
ELSE(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/i386")
ENDIF(TARGET_X64)
ELSEIF(APPLE)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/MacOS/Release")
ELSEIF(WIN32)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/x64")
ELSE(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Win32")
ENDIF(TARGET_X64)
ENDIF(UNIX)
FIND_LIBRARY(LIBOVR_LIBRARY
NAMES ovr
PATHS
$ENV{LIBOVR_DIR}/${LIBOVR_LIBRARY_BUILD_PATH}
/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(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibOVR: ${LIBOVR_LIBRARY}")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
SET(LIBOVR_FOUND "YES")
SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR")
IF(UNIX)
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread)
ELSE(UNIX)
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY})
ENDIF(UNIX)
ELSE(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibOVR!")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
ENDIF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)

View file

@ -0,0 +1,32 @@
# - Locate LibVR library
# This module defines
# LIBVR_LIBRARIES, the libraries to link against
# LIBVR_FOUND, if false, do not try to link to LIBVR
# LIBVR_INCLUDE_DIR, where to find headers.
IF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
# in cache already
SET(LIBVR_FIND_QUIETLY TRUE)
ENDIF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
FIND_PATH(LIBVR_INCLUDE_DIR hmd.h
PATH_SUFFIXES include/LibVR
)
FIND_LIBRARY(LIBVR_LIBRARY
NAMES vr
PATH_SUFFIXES lib
PATHS
)
IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibVR: ${LIBVR_LIBRARY}")
ENDIF(NOT LIBVR_FIND_QUIETLY)
SET(LIBVR_FOUND "YES")
SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR")
ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibVR!")
ENDIF(NOT LIBVR_FIND_QUIETLY)
ENDIF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)

View file

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

View file

@ -0,0 +1,81 @@
# Locate Lua library
# This module defines
# LUA52_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/lua52 include/lua5.2 include/lua-5.2 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUA_LIBRARY
NAMES lua52 lua5.2 lua-5.2 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(Lua52
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)

View file

@ -0,0 +1,141 @@
# - 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(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 luabind libluabind)
SET(LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
IF(WITH_STLPORT)
SET(LIBRARY_NAME_RELEASE luabind_stlport ${LIBRARY_NAME_RELEASE})
SET(LIBRARY_NAME_DEBUG luabind_stlportd ${LIBRARY_NAME_DEBUG})
ENDIF(WITH_STLPORT)
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)

View file

@ -0,0 +1,96 @@
# - 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")
IF(NOT MSVC12_REDIST_DIR)
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC11)
DETECT_VC_VERSION("11.0")
IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0")
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC10_REDIST_DIR)
ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0")
ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0")
ENDIF(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})

View file

@ -0,0 +1,113 @@
# - Extract information from a subversion working copy
# The module defines the following variables:
# Mercurial_HG_EXECUTABLE - path to hg command line client
# Mercurial_VERSION_HG - version of hg command line client
# Mercurial_FOUND - true if the command line client was found
# MERCURIAL_FOUND - same as Mercurial_FOUND, set for compatiblity reasons
#
# The minimum required version of Mercurial can be specified using the
# standard syntax, e.g. FIND_PACKAGE(Mercurial 1.4)
#
# If the command line client executable is found two macros are defined:
# Mercurial_WC_INFO(<dir> <var-prefix>)
# Mercurial_WC_LOG(<dir> <var-prefix>)
# Mercurial_WC_INFO extracts information of a subversion working copy at
# a given location. This macro defines the following variables:
# <var-prefix>_WC_URL - url of the repository (at <dir>)
# <var-prefix>_WC_ROOT - root url of the repository
# <var-prefix>_WC_REVISION - current revision
# <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit
# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
# <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
# <var-prefix>_WC_INFO - output of command `hg info <dir>'
# Mercurial_WC_LOG retrieves the log message of the base revision of a
# subversion working copy at a given location. This macro defines the
# variable:
# <var-prefix>_LAST_CHANGED_LOG - last log of base revision
# Example usage:
# FIND_PACKAGE(Mercurial)
# IF(MERCURIAL_FOUND)
# Mercurial_WC_INFO(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Current revision is ${Project_WC_REVISION}")
# Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
# ENDIF(MERCURIAL_FOUND)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Tristan Carel
#
# 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_PROGRAM(Mercurial_HG_EXECUTABLE hg
DOC "mercurial command line client"
PATHS
/opt/local/bin
"C:/Program Files/TortoiseHg"
"C:/Program Files (x86)/TortoiseHg"
)
MARK_AS_ADVANCED(Mercurial_HG_EXECUTABLE)
IF(Mercurial_HG_EXECUTABLE)
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} --version
OUTPUT_VARIABLE Mercurial_VERSION_HG
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE ".*version ([\\.0-9]+).*"
"\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}")
MACRO(Mercurial_WC_INFO dir prefix)
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}"
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_INFO
ERROR_VARIABLE Mercurial_hg_info_error
RESULT_VARIABLE Mercurial_hg_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT ${Mercurial_hg_info_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}")
ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0)
LIST(LENGTH ${prefix}_WC_INFO _COUNT)
IF(_COUNT EQUAL 4)
LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
ELSE(_COUNT EQUAL 4)
MESSAGE(STATUS "Bad output from HG")
SET(${prefix}_WC_REVISION "unknown")
SET(${prefix}_WC_CHANGESET "unknown")
SET(${prefix}_WC_BRANCH "unknown")
ENDIF(_COUNT EQUAL 4)
ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0)
ENDMACRO(Mercurial_WC_INFO)
MACRO(Mercurial_WC_LOG dir prefix)
# This macro can block if the certificate is not signed:
# hg ask you to accept the certificate and wait for your answer
# This macro requires a hg server network access (Internet most of the time)
# and can also be slow since it access the hg server
EXECUTE_PROCESS(COMMAND
${Mercurial_HG_EXECUTABLE} --non-interactive log -r BASE ${dir}
OUTPUT_VARIABLE ${prefix}_LAST_CHANGED_LOG
ERROR_VARIABLE Mercurial_hg_log_error
RESULT_VARIABLE Mercurial_hg_log_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT ${Mercurial_hg_log_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Mercurial_hg_log_error}")
ENDIF(NOT ${Mercurial_hg_log_result} EQUAL 0)
ENDMACRO(Mercurial_WC_LOG)
ENDIF(Mercurial_HG_EXECUTABLE)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE)

View file

@ -0,0 +1,81 @@
# - 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(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
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(WIN32 AND MSVC)
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(WIN32 AND MSVC)
IF(MYSQL_INCLUDE_DIR)
IF(MYSQL_LIBRARY_RELEASE)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE})
IF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_DEBUG})
ELSE(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_RELEASE})
ENDIF(MYSQL_LIBRARY_DEBUG)
FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
ENDIF(MYSQL_LIBRARY_RELEASE)
ENDIF(MYSQL_INCLUDE_DIR)
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND FALSE)
MESSAGE(STATUS "MySQL not found.")
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)

View file

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

View file

@ -0,0 +1,49 @@
# - Try to find OpenGL ES
# Once done this will define
#
# OPENGLES_FOUND - system has OpenGL ES
# OPENGLES_EGL_FOUND - system has EGL
# OPENGLES_LIBRARIES - Link these to use OpenGL ES and EGL
#
# If you want to use just GL ES you can use these values
# OPENGLES_GLES_LIBRARY - Path to OpenGL ES Library
# OPENGLES_EGL_LIBRARY - Path to EGL Library
FIND_LIBRARY(OPENGLES_GLES_LIBRARY
NAMES GLESv1_CM libGLESv1_CM gles_cm libgles_cm
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(OPENGLES_EGL_LIBRARY
NAMES EGL libEGL
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(OPENGLES_GLES_LIBRARY)
SET(OPENGLES_FOUND "YES")
SET(OPENGLES_LIBRARIES ${OPENGLES_GLES_LIBRARY} ${OPENGLES_LIBRARIES})
IF(OPENGLES_EGL_LIBRARY)
SET(OPENGLES_EGL_FOUND "YES")
SET(OPENGLES_LIBRARIES ${OPENGLES_EGL_LIBRARY} ${OPENGLES_LIBRARIES})
ELSE(OPENGLES_EGL_LIBRARY)
SET(OPENGLES_EGL_FOUND "NO")
ENDIF(OPENGLES_EGL_LIBRARY)
ENDIF(OPENGLES_GLES_LIBRARY)

View file

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

View file

@ -0,0 +1,81 @@
#
# 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}")
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)

View file

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

View file

@ -0,0 +1,311 @@
# - 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})
MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
# Search version in headers
IF(EXISTS ${WINSDK_DIR}/include/Msi.h)
SET(_MSI_FILE ${WINSDK_DIR}/include/Msi.h)
ENDIF(EXISTS ${WINSDK_DIR}/include/Msi.h)
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)
IF(EXISTS ${WINSDK_DIR}/include/winsdkver.h)
SET(_WINSDKVER_FILE ${WINSDK_DIR}/include/winsdkver.h)
ELSEIF(EXISTS ${WINSDK_DIR}/include/WinSDKVer.h)
SET(_WINSDKVER_FILE ${WINSDK_DIR}/include/WinSDKVer.h)
ENDIF(EXISTS ${WINSDK_DIR}/include/winsdkver.h)
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 AND EXISTS ${WINSDKENV_DIR}/include/Windows.h)
SET(WINSDK_DIR ${WINSDKENV_DIR})
ENDIF(WINSDKENV_DIR AND EXISTS ${WINSDKENV_DIR}/include/Windows.h)
# 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 environment variable in ${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 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})
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)

View file

@ -0,0 +1,46 @@
# - Locate Jpeg library
# This module defines
# XF86VidMode_LIBRARY, the library to link against
# XF86VidMode_FOUND, if false, do not try to link to XF86VidMode
# XF86VidMode_INCLUDE_DIR, where to find headers.
IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
# in cache already
SET(XF86VidMode_FIND_QUIETLY TRUE)
ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
FIND_PATH(XF86VidMode_INCLUDE_DIR
xf86vmode.h
PATHS
$ENV{XF86VidMode_DIR}/include
/usr/include/X11/
/usr/X11R6/include/
PATH_SUFFIXES extensions
)
FIND_LIBRARY(XF86VidMode_LIBRARY
Xxf86vm
PATHS
$ENV{XF86VidMode_DIR}/lib
/usr/X11R6/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
SET(XF86VidMode_FOUND "YES")
SET(XF86VidMode_DEFINITIONS -DXF86VIDMODE)
IF(NOT XF86VidMode_FIND_QUIETLY)
MESSAGE(STATUS "Found XF86VidMode: ${XF86VidMode_LIBRARY}")
ENDIF(NOT XF86VidMode_FIND_QUIETLY)
ELSE(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
IF(NOT XF86VidMode_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find XF86VidMode!")
ENDIF(NOT XF86VidMode_FIND_QUIETLY)
ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)

View file

@ -0,0 +1,77 @@
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(NOT ROOT_DIR AND SOURCE_DIR)
IF(NOT SOURCE_DIR AND ROOT_DIR)
SET(SOURCE_DIR ${ROOT_DIR})
ENDIF(NOT SOURCE_DIR AND ROOT_DIR)
ELSE(SOURCE_DIR)
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
ENDIF(SOURCE_DIR)
MACRO(NOW RESULT)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
IF(NOT DATETIME MATCHES "ERROR")
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
ENDIF(NOT DATETIME MATCHES "ERROR")
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
ELSE (WIN32)
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} "0000-00-00 00:00:00")
ENDIF (WIN32)
ENDMACRO(NOW)
IF(EXISTS "${ROOT_DIR}/.svn/")
FIND_PACKAGE(Subversion)
IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION})
ENDIF(SUBVERSION_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(MERCURIAL_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.hg/")
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)
SET(REVISION_FILE ${SOURCE_DIR}/revision)
IF(EXISTS ${REVISION_FILE})
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
MESSAGE(STATUS "Read revision ${REVISION} from file")
ENDIF(EXISTS ${REVISION_FILE})
ENDIF(SOURCE_DIR AND NOT DEFINED REVISION)
IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
MESSAGE(STATUS "Revision: ${REVISION}")
NOW(BUILD_DATE)
CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different
ENDIF(EXISTS ${SOURCE_DIR}/revision.h.in)
ENDIF(SOURCE_DIR AND DEFINED REVISION)

View file

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

View file

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

1116
code/CMakeModules/nel.cmake Normal file

File diff suppressed because it is too large Load diff

109
code/CMakePackaging.txt Normal file
View file

@ -0,0 +1,109 @@
cpack_add_install_type(Full DISPLAY_NAME "Full Install")
cpack_add_install_type(Developer DISPLAY_NAME "Developer Install")
cpack_add_install_type(Runtime DISPLAY_NAME "Runtime Files")
cpack_add_component_group(Drivers
EXPANDED
DESCRPTION "The drivers needed to run NeL-based software.")
cpack_add_component_group(Samples
EXPANDED
DESCRPTION "Sample applications and configurations demonstrating NeL.")
cpack_add_component_group(Tools
EXPANDED
DESCRPTION "Tools for NeL development and media creation.")
###############
# #
# Development #
# #
###############
cpack_add_component(libraries
DISPLAY_NAME "Libraries"
DESCRIPTION "Libraries used to build programs with NeL"
GROUP Development
INSTALL_TYPES Full Developer)
cpack_add_component(headers
DISPLAY_NAME "C++ Headers"
DESCRIPTION "C++ headers used to build programs with NeL"
GROUP Development
INSTALL_TYPES Full Developer)
###########
# #
# Drivers #
# #
###########
cpack_add_component(drivers3d
DISPLAY_NAME "3D Drivers"
DESCRIPTION "3D Drivers for running NeL based applications."
GROUP Drivers
INSTALL_TYPES Full Runtime)
cpack_add_component(driverssound
DISPLAY_NAME "Sound Drivers"
DESCRIPTION "Sound Drivers for running NeL based applications."
GROUP Drivers
INSTALL_TYPES Full Runtime)
#########
# #
# Tools #
# #
#########
cpack_add_component(toolsmisc
DISPLAY_NAME "Misc Tools"
DESCRIPTION "Misc. NeL Tools"
GROUP Tools
INSTALL_TYPES Full Runtime)
cpack_add_component(tools3d
DISPLAY_NAME "3D Tools"
DESCRIPTION "3D NeL Tools"
GROUP Tools
INSTALL_TYPES Full Runtime)
cpack_add_component(toolsgeorges
DISPLAY_NAME "Georges Tools"
DESCRIPTION "NeL Georges Tools"
GROUP Tools
INSTALL_TYPES Full Runtime)
cpack_add_component(toolspacs
DISPLAY_NAME "PACS Tools"
DESCRIPTION "NeL PACS Tools"
GROUP Tools
INSTALL_TYPES Full Runtime)
###########
# #
# Samples #
# #
###########
cpack_add_component(samplespacs
DISPLAY_NAME "PACS Samples"
DESCRIPTION "Sample applications demonstrating the PACS collision library."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samples3d
DISPLAY_NAME "3D Samples"
DESCRIPTION "Sample applications demonstrating the NeL 3D library."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samplesgeorges
DISPLAY_NAME "Georges Samples"
DESCRIPTION "Sample applications demonstrating the Georges data loading module."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samplesmisc
DISPLAY_NAME "Misc Samples"
DESCRIPTION "Sample applications demonstrating the core NeL functionality module."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samplesnet
DISPLAY_NAME "Net Samples"
DESCRIPTION "Sample applications demonstrating the NeL Network functionality."
GROUP Samples
INSTALL_TYPES Full)
cpack_add_component(samplessound
DISPLAY_NAME "Sound Samples"
DESCRIPTION "Sample applications demonstrating the NeL Sound functionality."
GROUP Samples
INSTALL_TYPES Full)

661
code/COPYING Normal file
View file

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://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 <http://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
<http://www.gnu.org/licenses/>.

13
code/CTestConfig.cmake Normal file
View file

@ -0,0 +1,13 @@
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(Dart)
set(CTEST_PROJECT_NAME "RyzomCore")
set(CTEST_NIGHTLY_START_TIME "00:00:00 CST")
set(CTEST_UPDATE_TYPE "hg")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "www.opennel.org")
set(CTEST_DROP_LOCATION "/cdash/submit.php?project=RyzomCore")
set(CTEST_DROP_SITE_CDASH TRUE)

32
code/README Normal file
View file

@ -0,0 +1,32 @@
Introduction
------------
Ryzom Core is a software platform for creating and running massively multi-user
entertainment in a 3D environment over the Internet.
The Ryzom Core library is further divided into specific modules: network, ai, 3d
and misc. If you want to use any of these, you also need to use the misc
part of the library, but ai, 3d and network are totally independant from
each other so you can use only the parts you really need in your project.
If you want know more about the library content and functionalities, you
should take a look on the documents present in the doc directory.
Ryzom Core is currently developped and tested under GNU/Linux and Windows
environments.
License
-------
Ryzom Core is a Free Software project under the GNU Affero General Public License v3,
which means all its code is available for everyone to download, examine,
use, modify, and distribute, subject to the usual restrictions attached
to any GPL software. If you are not familiar with the AGPL, see the COPYING
file for for more details on license terms and other legal issues.
Installation
------------
Please visit http://dev.ryzom.com for more information.

6
code/changelog.template Normal file
View file

@ -0,0 +1,6 @@
# To generate ChangeLog files use these commands :
# hg log -M --style ./changelog.template nel > nel/ChangeLog
# hg log -M --style ./changelog.template ryzom > ryzom/ChangeLog
header = '\n{date|shortdate} {author}\n\n'
changeset = '\t* {desc|fill68|tabindent|strip} [r{rev}]\n'

56
code/config.h.cmake Normal file
View file

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

1
code/nel/AUTHORS Normal file
View file

@ -0,0 +1 @@
Please check www.nevrax.org for more information

86
code/nel/CMakeLists.txt Normal file
View file

@ -0,0 +1,86 @@
PROJECT(NeL CXX C)
IF(WITH_STATIC_DRIVERS)
ADD_DEFINITIONS(-DNL_STATIC)
ENDIF(WITH_STATIC_DRIVERS)
# On Windows we need to find DirectInput for NLMISC.
# This is how we get events.
IF(WIN32)
FIND_PACKAGE(DirectXSDK REQUIRED)
# On Win32 we can also build the MAX plugins.
IF(WITH_NEL_MAXPLUGIN)
FIND_PACKAGE(3dsMaxSDK)
ENDIF(WITH_NEL_MAXPLUGIN)
ENDIF(WIN32)
IF(WITH_3D)
FIND_PACKAGE(FreeType)
IF(WITH_NEL_CEGUI)
FIND_PACKAGE(CEGUI)
ENDIF(WITH_NEL_CEGUI)
ENDIF(WITH_3D)
IF(WITH_SOUND)
FIND_PACKAGE(Ogg)
FIND_PACKAGE(Vorbis)
IF(WITH_DRIVER_OPENAL)
FIND_PACKAGE(OpenAL)
ENDIF(WITH_DRIVER_OPENAL)
IF(WITH_DRIVER_FMOD)
FIND_PACKAGE(FMOD)
ENDIF(WITH_DRIVER_FMOD)
ENDIF(WITH_SOUND)
IF(WITH_GTK)
FIND_PACKAGE(GTK2)
ENDIF(WITH_GTK)
IF(WITH_LIBOVR)
FIND_PACKAGE(LibOVR)
ENDIF(WITH_LIBOVR)
IF(WITH_LIBVR)
FIND_PACKAGE(LibVR)
ENDIF(WITH_LIBVR)
IF(WITH_INSTALL_LIBRARIES)
IF(UNIX)
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(exec_prefix ${NL_BIN_ABSOLUTE_PREFIX})
SET(libdir ${NL_LIB_ABSOLUTE_PREFIX})
SET(includedir ${CMAKE_INSTALL_PREFIX}/include)
SET(enable_ligo ${WITH_LIGO})
SET(enable_logic ${WITH_LOGIC})
SET(enable_georges ${WITH_GEORGES})
SET(enable_net ${WITH_NET})
SET(enable_3d ${WITH_3D})
SET(enable_pacs ${WITH_PACS})
SET(enable_sound ${WITH_SOUND})
CONFIGURE_FILE(nel-config.in ${CMAKE_CURRENT_BINARY_DIR}/nel-config)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nel-config DESTINATION ${NL_BIN_PREFIX})
ENDIF(UNIX)
ADD_SUBDIRECTORY(include)
ENDIF(WITH_INSTALL_LIBRARIES)
ADD_SUBDIRECTORY(src)
IF(WITH_NEL_SAMPLES)
ADD_SUBDIRECTORY(samples)
ENDIF(WITH_NEL_SAMPLES)
# Allow to compile only max plugins without other tools.
IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)
IF(WITH_NEL_TOOLS)
FIND_PACKAGE(Squish)
ENDIF(WITH_NEL_TOOLS)
ADD_SUBDIRECTORY(tools)
ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)

661
code/nel/COPYING Normal file
View file

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://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 <http://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
<http://www.gnu.org/licenses/>.

1
code/nel/ChangeLog Normal file
View file

@ -0,0 +1 @@
Please check http://dev.ryzom.com/projects/nel/roadmap for more information.

2
code/nel/INSTALL Normal file
View file

@ -0,0 +1,2 @@
Please check www.nevrax.org for more information

1
code/nel/NEWS Normal file
View file

@ -0,0 +1 @@
Please check www.nevrax.org for more information

32
code/nel/README Normal file
View file

@ -0,0 +1,32 @@
Introduction
------------
NeL is a software platform for creating and running massively multi-user
entertainment in a 3D environment over the Internet.
The NeL library is further divided into specific modules: network, ai, 3d
and misc. If you want to use any of these, you also need to use the misc
part of the library, but ai, 3d and network are totally independant from
each other so you can use only the parts you really need in your project.
If you want know more about the library content and functionalities, you
should take a look on the documents present in the doc directory.
NeL is currently developped and tested under GNU/Linux and Windows
environments.
License
-------
NeL is a Free Software project under the GNU Affero General Public License,
which means all its code is available for everyone to download, examine,
use, modify, and distribute, subject to the usual restrictions attached
to any GPL software. If you are not familiar with the AGPL, see the COPYING
file for for more details on license terms and other legal issues.
Installation
------------
Please check the dev.ryzom.com for more information

View file

@ -0,0 +1,283 @@
# Doxyfile 1.5.1-KDevelop
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = NeL
PROJECT_NUMBER = @NL_VERSION@
OUTPUT_DIRECTORY = doxygen
CREATE_SUBDIRS = YES
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = doxywarn.log
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = @CMAKE_SOURCE_DIR@
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.d \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.m \
*.mm \
*.dox \
*.py \
*.C \
*.CC \
*.C++ \
*.II \
*.I++ \
*.H \
*.HH \
*.H++ \
*.CS \
*.PHP \
*.PHP3 \
*.M \
*.MM \
*.PY \
*.C \
*.H \
*.tlh \
*.diff \
*.patch \
*.moc \
*.xpm \
*.dox
RECURSIVE = yes
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX = C
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = yes
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE = nel.tag
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = @HAVE_DOT@
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = YES

View file

@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
</head>
<body>
<h1>NeL Doxygen Documentations</h1>
<table class="list">
<thead><tr>
<th>Online Doc</th>
<th>Windows Help</th>
<th>Zipped HTML</th>
</tr></thead>
<tbody>
<tr class="even">
<td><a href="nel/index.html">NeL (online)</a></td>
<td><a href="download/nel.chm">NeL (chm)</a></td>
<td><a href="download/neldox.zip">NeL + NeLNS + NeLTools (zip)</a></td>
</tr>
<tr class="odd">
<td><a href="nelns/index.html">NeLNS (online)</a></td>
<td><a href="download/nelns.chm">NeLNS (chm)</a></td>
<td></td>
</tr>
<tr class="even">
<td><a href="tool/index.html">NeLTools (online)</a></td>
<td><a href="download/neltools.chm">NeLTools (chm)</a></td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>

6
code/nel/doc/make_all_dox.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
./make_nel_dox.sh
./make_nelns_dox.sh
./make_neltools_dox.sh
./make_packages_doc.sh

View file

@ -0,0 +1,11 @@
@echo off
del html\nel\*.* /Q
set WORKDIR=%CD%
cd ..
set CURDIR=%CD%
cd %WORKDIR%
doxygen nel.dox -DCURDIR
pause

9
code/nel/doc/make_nel_dox.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
rm -rf html/nel
WORKDIR=$(pwd)
cd ..
export CURDIR=$(pwd)
cd $WORKDIR
doxygen nel.dox -DCURDIR

View file

@ -0,0 +1,11 @@
@echo off
del html\nelns\*.* /Q
set WORKDIR=%CD%
cd ..\..\nelns
set CURDIR=%CD%
cd %WORKDIR%
doxygen nelns.dox -DCURDIR
pause

9
code/nel/doc/make_nelns_dox.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
rm -rf html/nelns
WORKDIR=$(pwd)
cd ../../nelns
export CURDIR=$(pwd)
cd $WORKDIR
doxygen nelns.dox -DCURDIR

View file

@ -0,0 +1,11 @@
@echo off
del html\tool\*.* /Q
set WORKDIR=%CD%
cd ..\..\tool
set CURDIR=%CD%
cd %WORKDIR%
doxygen neltools.dox -DCURDIR
pause

View file

@ -0,0 +1,9 @@
#!/bin/sh
rm -rf html/tool
WORKDIR=$(pwd)
cd ../../tool
export CURDIR=$(pwd)
cd $WORKDIR
doxygen neltools.dox -DCURDIR

View file

@ -0,0 +1,12 @@
hhc nel.hhp
hhc nelns.hhp
hhc neltools.hhp
del html\download\*.chm
move *.chm html\download\
del html\download\neldox.zip
zip -9 -r neldox.zip html\nel html\nelns html\tool html\index.html
move neldox.zip html\download\
pause

View file

@ -0,0 +1,5 @@
#!/bin/sh
rm -f html/download/neldox.zip
zip -9 -q -r neldox.zip html/nel html/nelns html/tool html/index.html
mv neldox.zip html/download/

Binary file not shown.

Binary file not shown.

Binary file not shown.

249
code/nel/doc/nel.dox Normal file
View file

@ -0,0 +1,249 @@
# Doxyfile 1.5.6
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = NeL
PROJECT_NUMBER =
OUTPUT_DIRECTORY =
CREATE_SUBDIRS = YES
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = $(CURDIR)
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../include/nel \
../src
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.h \
*.cpp \
*.dxt
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = *.lex.* \
*.yacc.*
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX = C \
I \
P
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html/nel
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 200
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE = nel.tag
ALLEXTERNALS = NO
EXTERNAL_GROUPS = NO
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = NO
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 10
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = YES

14
code/nel/doc/nel.hhp Normal file
View file

@ -0,0 +1,14 @@
[OPTIONS]
Auto Index=Yes
Compatibility=1.1 or later
Compiled file=nel.chm
Default topic=html\nel\index.html
Display compile progress=Yes
Language=0x809 Anglais (Royaume-Uni)
[FILES]
html\nel\index.html
[INFOTYPES]

248
code/nel/doc/nelns.dox Normal file
View file

@ -0,0 +1,248 @@
# Doxyfile 1.5.6
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = NeLNS
PROJECT_NUMBER =
OUTPUT_DIRECTORY =
CREATE_SUBDIRS = YES
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = $(CURDIR)
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../../nelns
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.h \
*.cpp \
*.dxt
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = *.lex.* \
*.yacc.*
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX = C \
I \
P
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html/nelns
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 200
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES = nel.tag=../nel
GENERATE_TAGFILE = nelns.tag
ALLEXTERNALS = NO
EXTERNAL_GROUPS = NO
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = NO
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 10
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = YES

14
code/nel/doc/nelns.hhp Normal file
View file

@ -0,0 +1,14 @@
[OPTIONS]
Auto Index=Yes
Compatibility=1.1 or later
Compiled file=nelns.chm
Default topic=html\nelns\index.html
Display compile progress=Yes
Language=0x809 Anglais (Royaume-Uni)
[FILES]
html\nelns\index.html
[INFOTYPES]

248
code/nel/doc/neltools.dox Normal file
View file

@ -0,0 +1,248 @@
# Doxyfile 1.5.6
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = NeLTools
PROJECT_NUMBER =
OUTPUT_DIRECTORY =
CREATE_SUBDIRS = YES
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = $(CURDIR)
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../../tool
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.h \
*.cpp \
*.dxt
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = *.lex.* \
*.yacc.*
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX = C \
I \
P
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html/tool
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 200
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES = nel.tag=../nel
GENERATE_TAGFILE = tool.tag
ALLEXTERNALS = NO
EXTERNAL_GROUPS = NO
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = NO
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 10
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = YES

14
code/nel/doc/neltools.hhp Normal file
View file

@ -0,0 +1,14 @@
[OPTIONS]
Auto Index=Yes
Compatibility=1.1 or later
Compiled file=neltools.chm
Default topic=html\tool\index.html
Display compile progress=Yes
Language=0x809 Anglais (Royaume-Uni)
[FILES]
html\tool\index.html
[INFOTYPES]

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

222
code/nel/doc/net/net.dxt Normal file
View file

@ -0,0 +1,222 @@
/**
\page network Network engine (until May 1, 2001)
\author Olivier Cado
Warning: this document describes the network engine as it was available in the NeL CVS tree until May 1, 2001. The updated documentation is available at http://www.nevrax.org/docs/nelnet.php3
\section networkintro Introduction
Conceptually, the network subsystem is divided into layers :
-# Layer 1 is the socket layer : it allows to send/receive any data synchronously using a network, either reliably or not.
-# Layer 2 is the message transfer layer : it allows to send/receive messages synchronously.
-# Layer 3 is the message handling layer : it allows to listen for messages and to call event-driven callback functions.
-# The recipient of a connection need not be an Internet address. It can be pointed to as a specific service using a Naming Service.
-# Any object can be serialized to/from a message.
-# Server software are called services and have a common interface.
Here is the implementation point of view :
-# Layer 1 is implemented by NLNET::CBaseSocket.
-# Layer 2 is implemented by NLNET::CSocket.
-# Layer 3 is implemented by NLNET::CMsgSocket.
-# The class NLNET::CNamingClient allows using the Naming Service. It is used by NLNET::CMsgSocket for service lookup. The addresses are implemented by NLNET::CInetAddress.
-# The class NLNET::CMessage inherits from NLMISC::IStream.
-# All services inherit from NLNET::IService. It provides the basic functionnalities such as registration to the Naming Service, server start-up and shutdown (see \ref new_service_howto).
To use the layer 3, you need to #include "nel/net/msg_socket.h".
\section networkusing Using the network engine
Example : I want to ask the "family service" (let's call it "FMLS") the age of Toto. Let's say the family service
understands a message of type "AGEREQ" and answers back a message of type "AGE" :
- How to send a synchronous request to a host, using CSocket (layer 2) ?
\code
#include "nel/net/socket.h"
#include "nel/net/naming_client.h"
(...)
uint16 validitytime;
CSocket client;
// Connect to the family service
if ( CNamingClient::lookupAndConnect( "FMLS", client, validitytime ) )
{
// Send request
CMessage msgout( "AGEREQ" );
msgout.serial( Toto.name() );
client.send( msgout );
// Receive answer
uint16 age;
CMessage msgin( "", true );
client.receive( msgin );
msgin.serial( age );
Toto.setAge( age );
}
\endcode
- How to send an asynchronous request to a host, using CMsgSocket, the message handling system (layer 3) ?
\code
#include "nel/net/msg_socket.h"
(...)
// Callback to process the answer
void cbProcessAge( CMessage& msgin, TSenderId idfrom )
{
uint16 age;
msgin.serial( age );
Toto.setAge( age );
}
// Callback array
TCallbackItem ClientCallbacks [] =
{
{ "AGE", cbProcessAge }
};
void main()
{
// Connect to the family service
CMsgSocket client ( ClientCallbacks, sizeof(ClientCallbacks)/sizeof(TCallbackItem), "FMLS" );
// Send request
CMessage msgout ( "AGEREQ" ); // The server should have a callback associated to "AGEREQ"
msgout.serial( Toto.name() );
client.send( msgout );
while ( true )
{
client.update(); // tests if a message has been received, and if the associated callback is called back
// Same as CMsgSocket::update()
}
}
\endcode
- How to send a container or an object ?
Symply serialize your container or your object in a message.
Example :
\code
vector<CMyClass> myvector;
CMessage msgout ( false );
msgout.serialCont( myvector );
client.send( msgout );
\endcode
This code serializes all objects contained in \e myvector. For this to work, you need to provide a method serial()
in your class CMyClass. This is explained in NLMISC::IStream. For a map or a multimap, use serialMap() instead of serialCont().
\section netenginev1 Features and implementation
\subsection msgtypebinding Message type binding
Let's study a communication between two machines, A and B, where A sends several messages, of the same type, to B. In the following, we explain the 4 steps. Steps (1) and (4) correspond to the sending of the messages from A to B.
- Step 1: The first time a type of message is sent by A, its header contains its "message name" (or message type as string).
- Step 2: The remote machine B, when it receives it, sends back a binding message with the index of its associated callback, i.e. the binded "message number" (or message type as number).
- Step 3: A processes the binding message by remembering the binding "message name" -> "message number" for this connection.
- Step 4: Next time A sents this type of message, the header contains the message number.
The data structures need to implement this protocol are listed below.
\subsection netlayers Network layers
-# Socket Layer:
- CBaseSocket
- Allows to send/receive any data (uint8*) synchronously over the network, either reliably or not (TCP streams or UDP datagrams)
-# Message Transfer Layer:
- CSocket
- Allows to send/receive messages (CMessage objects, in which you can serialize data) synchronously. TCP/UDP (not fully tested with UDP)
- Implements the encoding/decoding of message headers
- Implementation:
- Contains a set (_MsgsToBind : CMsgBindSet) that knows which messages have not been binded on the other side yet (when this set is empty, it means all bind messages have been set to the remote host (see step 2))
- Contains a map (_BindMapForSends : CMsgMap) that saves the message type bindings understood by the remote connection (see step 3),
-# Message Handling Layer:
- CMsgSocket
- Allows to listen for messages and to call event-driven callback functions.
- Initializing:
- A CMsgSocket object can be a server object or a client object. There is at most one server object by process, but there can be several client objects.
- When creating a server object, a passive listening socket is created, waiting for incoming connection requests.
- A client object connects to a server which is specified either by its address or by its service name. In the latter the Naming Service is asked for the service address.
- Anyone who creates a CMsgSocket object is required to define some callbacks and a callback array of the following form (its contents is only a sample):
\code
TCallbackItem MyCallbackArray [] =
{
{ "CHAT", cbDisplayChatMsg },
{ "PING", cbPing },
{ "PONG", cbPong },
{ "D", cbHandleDisconnection }
};
\endcode
- A method (addCallbackArray()) is provided for appending another callback array to the one specified at the beginning. Consequently you can provide callbacks in different modules of your program.
- Receiving messages and handling connections:
- When a message is received, the callback corresponding to its message name (if any) is called. Sample:
\code
void cbDisplayChatMsg( CMessage& inputmsg, TSenderId connectionid )
{
string line;
inputmsg.serial( line );
ChatOutput.addLine( line );
}
\endcode
- Two special message names are reserved : "C" and "D". C is called when a new connection is accepted by a server CMsgSocket object, and D is called when a connection is closed (either gracefully closed or broken). In both cases, an input message containing the address (CInetAddress) of the concerned remote host is passed to the callback (use serial() to get the address).
- The user can deliberately close a connection by calling close().
- Each connection is handled by a CSocket object. The list of connections is static, so that only one select() is performed for all connections, in the static method CMsgSocket::update(). This method receives only one message per socket at most.
- Sending messages:
- To send a message to a particular host, call clientsocket->send( outputmsg ) if you are a client of the remote host (i.e. you have created a client object) or call CMsgSocket::send( outputmsg, connectionid ).
- To send a message to all connected hosts, call sendToAll( outputmsg ) or sendToAllExceptHost( outputmsg, excludedhostid ) or even sendToAllExceptHosts( outputmsg, excludedhostidset ) if you want to exclude one host or more from the destination list.
- Controlling access:
- The class provides basic features for allowing/disallowing a specified host to access to the callbacks. In the "C" callback (called when a connection is accepted), you can call authorizeOnly( authcallback, hostid ) so that the specified host cannot call any callback but authcallback. If this host tries to call another callback (i.e. it sends a message with a wrong message type), it will be disconnected. In authcallback you can then allow the client to access the other callbacks, calling authorizeAll( hostid ).
- Gathering statistics:
- There are several methods used to gather statistic about the network traffic. The static ones (bytesSent(), bytesReceived(), newBytesSent(), newBytesReceived()) give the total amount of input/output transferred data. The others (the same, with the suffix -FromHost()) are relative to one particular host.
- Misc:
- To know about the other methods, read the Doxygen documentation of CMsgSocket or the header file.
- Implementation:
- Contains a static set (_SearchSet: CSearchSet) and one set (_ClientSearchSet) per client object, allowing a fast search in the callback array. This set is optimized by not storing the message names but the pointers to the items in the callback array, even sorting by comparing the names.
\subsection theservices Services
You can use the class CMsgSocket directly, as in the Snowballs client, but a framework is provided for building server applications (see the class IService and the Doxygen related page "How to create a new service").
\subsection dtcs Distributed Components Toolkit System (DTC System)
A set of services are available:
- The Naming Service (NS) locates a service by name/service identifier. It can also allocate port numbers. In NeL, the class CNamingClient allows the programmer to use the NS without writing network operations.
- The Log Service (LOGS) is a centralized logger for all services (client class: CNetDisplayer used by CLog, and CNetLog that logs to the Network Viewer tool)
- The Time Service (TS) is a centralized time reference manager (client class: CUniTime).
- The Login Service (LS) is a centralized user account manager for all shards. It is the only service that does not connect to the NS because it is not part of a shard.
- The Admin Executor Service (AES) collects stats about a physical machine.
- The Agent Service (AS) routes messages for inter-agent communication over several machines.
In CVS:/code/server you will find another service, the Moves Service (DRServer) which is the main server for Snowballs.
\subsection deadreck Dead Reckoning
NLNET contains a framework to handle networked virtual environments containing moving entities physically controlled on different computers. In the future, this framework may be removed from NeL and put somewhere else.
Here are the involved classes:
- IMovingEntity:
- CLocalEntity: a locally-controlled entity
- CReplica: an entity not controlled directly:
- CRemoteEntity: an remote-controlled replica, with convergency
- IEntityInterpolator: base class for convergency:
- LinearEntityInterpolator
- CubicEntityInterpolator: Bézier interpolation
- CLocalArea: a local entity and a list of remote entities. Call update() to update the position of the entities using dead reckoning.
A good example of usage can be found in the Snowballs source code (client.cpp and move_listener.cpp).
*/

View file

@ -0,0 +1,2 @@
SUBDIRS(nel)

View file

@ -0,0 +1,3 @@
FILE(GLOB HEADERS *.h)
INSTALL(FILES ${HEADERS} DESTINATION include/nel/3d COMPONENT headers)

View file

@ -0,0 +1,71 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIM_CTRL_H
#define NL_ANIM_CTRL_H
#include "nel/misc/types_nl.h"
namespace NL3D
{
// ***************************************************************************
class CBone;
class CSkeletonModel;
// ***************************************************************************
/**
* This is a handler for extra Animation behavior on Skeleton Models.
* When a bone has ended his compute, if it has an attached AnimCtrl, it calls its ::execute() code
* The AnimCtrl may modify all or part of the skeleton, knowing that the sons of the bone animCtrled are still not
* computed.
* Typically, animCtrls should modify the matrix parts of the bone, and then call bone->compute(..,..,NULL)
*
* Note: for convenience, when execute() is called on a bone, the LocalSkeletonMatrix and WorldMatrix
* of this bone are already computed.
*
* Important Note about Bone Loding:
* - AnimCtrl are not called if the bone is loded (ie not animated/computed)
* - AnimCtrl is called BEFORE Bone Lod interpolation, resulting in the excepted behavior.
*
* Note about UserInterface logic: CSkeletonModel and CBone appears here but are used only for the derivers of this
* class (that are still in 3D), so the UserInterface don't need and don't use it.
* Therefore, there is no way (for now) with the strict UserInterface scheme to implements new AnimCtrls.
* But the user is allowed to use the Layer2 (ie CScene, CSkeletonModel etc classes) to create its own AnimCtrls.
* \author Lionel Berenguier
* \author Nevrax France
* \date 2003
*/
class IAnimCtrl
{
public:
virtual ~IAnimCtrl() {}
/// Called at compute() time.
virtual void execute(CSkeletonModel *model, CBone *bone) =0;
};
} // NL3D
#endif // NL_ANIM_CTRL_H
/* End of anim_ctrl.h */

View file

@ -0,0 +1,102 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIM_DETAIL_TRAV_H
#define NL_ANIM_DETAIL_TRAV_H
#include "nel/misc/types_nl.h"
#include "nel/misc/matrix.h"
#include "nel/misc/plane.h"
#include "nel/3d/trav_scene.h"
namespace NL3D
{
using NLMISC::CVector;
using NLMISC::CPlane;
using NLMISC::CMatrix;
class CTransform;
// ***************************************************************************
/**
* The AnimDetail traversal.
* There is no AnimDetail graph. traverse() use the clipTrav VisibilityList to traverse all models.
*
* NB: see CScene for 3d conventions (orthonormal basis...)
* \author Lionel Berenguier
* \author Nevrax France
* \date 2000
*/
class CAnimDetailTrav : public CTraversal
{
public:
/// Constructor
CAnimDetailTrav();
/// \name ITrav/ITravScene Implementation.
//@{
/** render after Clip and before light.
* This order is important for possible lights sticked to bones of skeletons.
*/
void traverse();
//@}
public:
// ONLY FOR MODEL TRAVERSING.
sint64 CurrentDate; // The current date of the traversal, useful for evaldetail just one time..
// For clipTrav. cleared at beginning of CClipTrav::traverse
void clearVisibleList();
// For ClipTrav only. NB: list is cleared at begininng of traverse(). NB: only CTransform are supported
void addVisibleModel(CTransform *model)
{
_VisibleList[_CurrentNumVisibleModels]= model;
_CurrentNumVisibleModels++;
}
// for createModel().
void reserveVisibleList(uint numModels);
// ********************
private:
/// traverse the model recursively, following Hrc hierarchy
void traverseHrcRecurs(CTransform *model);
// traverse list of model visible and useful to animDetail.
std::vector<CTransform*> _VisibleList;
uint32 _CurrentNumVisibleModels;
};
} // NL3D
#endif // NL_ANIM_DETAIL_TRAV_H
/* End of anim_detail_trav.h */

View file

@ -0,0 +1,242 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATABLE_H
#define NL_ANIMATABLE_H
#include "nel/misc/types_nl.h"
#include "nel/misc/bit_set.h"
#include <string>
#include <vector>
#include <map>
namespace NL3D
{
class ITrack;
class CChannelMixer;
class IAnimatedValue;
/**
* An animatable object.
*
* This object can have a set of animated values. At Max 32 animated values can be set (because of bit and touch mgt)
* Animated values are animated by a CChannelMixer object.
* Each value have a name and a default track.
*
* An IAnimatable may have IAnimatable sons (list of bones, list of materials etc...). The value count and valueId of
* the IAnimatable DO NOT count those sons, but register() should register his sons too.
* A father propagated touch system (setFather()) is implemented. When a son is touched, he touchs his fathers, his grandfather
* and so on.
*
* When a class derives from IAnimatable, it must implement all the
* interface's methods:
*
* extend TAnimValues enum, beginning to BaseClass::AnimValueLast, and add a bit OwnerBit.
* ctor(): just type "IAnimatable::resize (AnimValueLast);"
* virtual IAnimatedValue* getValue (uint valueId);
* virtual const char *getValueName (uint valueId) const;
* virtual ITrack* getDefaultTrack (uint valueId);
*
* virtual register(CChannelMixer *, const string &prefix);
*
*
* Watch NL3D::ITransformable and NL3D::CTransform for a good example.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class IAnimatable : public NLMISC::CRefCount
{
friend class IAnimatedValue;
public:
/**
* Default Constructor. Set number of value to 0.
* Deriver: should just write: IAnimatable::resize (getValueCount());
*
*/
IAnimatable ()
{
_Father= NULL;
_BitSet= 0;
}
virtual ~IAnimatable() {}
/// \name Interface
// @{
/**
* The enum of animated values. (same system in CMOT). Deriver should extend this enum, beginning with OwnerBit= BaseClass::AnimValueLast.
* The number of values MUST NOT EXCEED 32, for fast touch() system.
* "OwnerBit" system: each deriver of IAnimatable should had an entry "OwnerBit" in this TAnimValues. This bit will be set when
* an IAnimatedValue of this deriver part is touched, or if one of his IAnimatable sons is touched (see setFather()).
*/
enum TAnimValues
{
AnimValueLast=0,
};
/**
* Get a value pointer.
*
* \param valueId is the animated value ID in the object. IGNORING IANIMATABLE SONS (eg: bones, materials...).
* \return The pointer on the animated value.
*/
virtual IAnimatedValue* getValue (uint valueId) =0;
/**
* Get animated value name.
*
* \param valueId is the animated value ID in the object we want the name. IGNORING IANIMATABLE SONS (eg: bones, materials...).
* \return the name of the animated value.
*/
virtual const char *getValueName (uint valueId) const =0;
/**
* Get default track pointer.
*
* \param valueId is the animated value ID in the object we want the default track. IGNORING IANIMATABLE SONS (eg: bones, materials...).
* \return The pointer on the default track of the value.
*/
virtual ITrack* getDefaultTrack (uint valueId) =0;
/**
* register the Animatable to a channelMixer (using CChannelMixer::addChannel()). You MUST use this method to register Animatable.
* This method should:
* - call is BaseClass method.
* - register local AnimatableValues, with channel name: prefix+getValueName().
* - register local sons!!. eg: matlist[0]->registerToChannelMixer(chanMixer, prefix+"mat0.").
*
* \param chanMixer is the channel mixer. Should not be NULL. for anim detail purpose , the IAnimatable may store a RefPtr on this channel mixer.
* \param prefix prefix to be append to valueNames
*/
virtual void registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix=std::string()) =0;
// @}
/// \name Touch flags management
// @{
/**
* Say which (if any) IAnimatable owns this one. This is important for Touch propagation.
* By this system, Fathers and ancestors know if they must check their sons (isTouched() return true).
*
* \param father the father we must inform of our update.
* \param fatherOwnerBit What bit of father we must set when we are updated
*/
void setFather(IAnimatable *father, uint fatherOwnerBit)
{
_Father= father; _FatherOwnerBit= fatherOwnerBit;
// propagate the touch to the fathers.
propagateTouch();
}
/**
* Touch a value because it has been modified.
*
* \param valueId is the animated value ID in the object we want to touch.
* \param ownerValueId is the bit of the IAnimatable part which owns this animated value.
*/
void touch (uint valueId, uint ownerValueId)
{
// Set the bit
setFlag(valueId);
// Set the owner bit
setFlag(ownerValueId);
// propagate the touch to the fathers.
propagateTouch();
}
/**
* Return non 0 int if the value as been touched else 0.
*
* \param valueId is the animated value ID in the object we want to test the touch flag. or it may be an OwnerBit.
*/
uint32 isTouched (uint valueId) const
{
return _BitSet&(1<<valueId);
}
/**
* Change value count, bit are set to 0
*
* \param count is the new value count.
*/
void resize (uint count)
{
// with the "uint32 _BitSet" implementation, juste check the size is correct
nlassert(count<=32);
}
// @}
private:
// Use a uint32 to manage the flags
uint32 _BitSet;
// The owner of this IAnimatable.
IAnimatable *_Father;
// What bit of father which must set when we are updated.
uint _FatherOwnerBit;
void propagateTouch()
{
IAnimatable *pCur= this;
// Stop when no father, or when father is already touched (and so the grandfather...!!!).
while(pCur->_Father && !pCur->_Father->isTouched(_FatherOwnerBit))
{
// The Owner bit is the "something is touched" flag. touch it.
pCur->_Father->setFlag(pCur->_FatherOwnerBit);
pCur= pCur->_Father;
}
}
protected:
/** This is a tool function which add a given value to a channel.
* \return -1 if the track was not found in the animationSet, else it return the channelId
* as if returned by CAnimationSet::getChannelIdByName(channelName).
*/
sint addValue(CChannelMixer *chanMixer, uint valueId, uint ownerValueId, const std::string &prefix, bool detail);
/// This method clear a bit in the bitset.
void clearFlag(uint valueId)
{
_BitSet&= ~(1<<valueId);
}
/// This method set a bit in the bitset.
void setFlag(uint valueId)
{
_BitSet|= (1<<valueId);
}
};
} // NL3D
#endif // NL_ANIMATABLE_H
/* End of animatable.h */

View file

@ -0,0 +1,107 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATED_LIGHTMAP_H
#define NL_ANIMATED_LIGHTMAP_H
#include "nel/misc/types_nl.h"
#include "nel/misc/smart_ptr.h"
#include "nel/3d/animatable.h"
#include "nel/3d/track.h"
#include <map>
namespace NL3D
{
// ***************************************************************************
/**
* An animated lightmap
* \author Matthieu Besson
* \author Nevrax France
* \date 2001
*/
class CAnimatedLightmap : public IAnimatable
{
public:
/// \name ctor / setup.
// @{
/** Constructor.
*/
CAnimatedLightmap (uint lightmapGroup);
virtual ~CAnimatedLightmap() {}
// @}
/// \name Herited from IAnimatable
// @{
/// Added values.
enum TAnimValues
{
OwnerBit= IAnimatable::AnimValueLast,
FactorValue,
AnimValueLast
};
/// From IAnimatable
virtual IAnimatedValue* getValue (uint valueId);
/// From IAnimatable
virtual const char *getValueName (uint valueId) const;
/// From IAnimatable.
virtual ITrack* getDefaultTrack (uint valueId);
/// From IAnimatable.
virtual void registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix);
// @}
void setName( const std::string &s ) { _Name = s; }
std::string getName() const { return _Name; }
// Update the group color with the scene
void updateGroupColors (class NL3D::CScene &scene);
NLMISC::CRGBA getFactor (uint group) const
{
if (group < _GroupColor.size ())
return _GroupColor[group];
else
return _Factor.Value;
}
// ********************
private:
std::string _Name;
// AnimValues.
CAnimatedValueRGBA _Factor;
CTrackDefaultRGBA _DefaultFactor;
std::vector<NLMISC::CRGBA> _GroupColor;
};
} // NL3D
#endif // NL_ANIMATED_LIGHTMAP_H
/* End of animated_lightmap.h */

View file

@ -0,0 +1,281 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATED_MATERIAL_H
#define NL_ANIMATED_MATERIAL_H
#include "nel/misc/types_nl.h"
#include "nel/misc/smart_ptr.h"
#include "nel/3d/animatable.h"
#include "nel/3d/material.h"
#include "nel/3d/track.h"
#include <map>
namespace NL3D
{
// ***************************************************************************
/**
* An material Reference for Animated reference. This object is stored in the mesh, and is serialised.
* NB: formated for 3ds Max :). Emissive anim is a float, with a constant RGB factor.
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class CMaterialBase : public NLMISC::CRefCount
{
public:
CMaterialBase();
/** setup the default tracks from a material
* This method:
* - copy the material contents into the Defaults tracks values.
*
* NB: for emissive part, emissive defaut track value is set to 1, and emissive factor is set to the
* RGB emissive value stored into pMat.
*/
void copyFromMaterial(CMaterial *pMat);
// Name of this material, for Animation access.
std::string Name;
// Default tracks.
CTrackDefaultRGBA DefaultAmbient;
CTrackDefaultRGBA DefaultDiffuse;
CTrackDefaultRGBA DefaultSpecular;
CTrackDefaultFloat DefaultShininess;
CTrackDefaultRGBA DefaultEmissive;
CTrackDefaultFloat DefaultOpacity;
CTrackDefaultInt DefaultTexture;
// Texture animation
struct CTexAnimTracks
{
CTrackDefaultFloat DefaultUTrans; // u translation
CTrackDefaultFloat DefaultVTrans; // v translation
CTrackDefaultFloat DefaultUScale; // u scale
CTrackDefaultFloat DefaultVScale; // u scale
CTrackDefaultFloat DefaultWRot; // v scale
// number of default tracks
enum { NumTexAnimatedValues = 5 };
void setDefaultValue()
{
DefaultUTrans.setDefaultValue(0);
DefaultVTrans.setDefaultValue(0);
DefaultUScale.setDefaultValue(1);
DefaultVScale.setDefaultValue(1);
DefaultWRot.setDefaultValue(0);
}
void serial(NLMISC::IStream &f)
{
(void)f.serialVersion(0);
f.serial(DefaultUTrans, DefaultVTrans, DefaultUScale, DefaultVScale);
}
};
CTexAnimTracks DefaultTexAnimTracks[IDRV_MAT_MAXTEXTURES];
/// save/load.
void serial(NLMISC::IStream &f);
/// \name Texture Animation mgt.
/** Animated materials support Texture animation. This is the place where you define your list of texture.
* This list of animated texture is serialised. AnimatedMaterial animate texture with sint32 Tracks. If the id is not
* found in CMaterialBase, then the CMaterial texture is left as before.
*
* NB: id 0x7FFFFFFF is a reserved id, used as default to indicate no valid Animated texture.
*/
// @{
/// assign a specific texture for an id (a uint32). It is valid to give a NULL ptr (=> untextured). Sorted as a SmartPtr.
void setAnimatedTexture(uint32 id, CSmartPtr<ITexture> pText);
/// is this Id valid?
bool validAnimatedTexture(uint32 id);
/// return the texture for this Id. return NULL either if NULL texture for this id or if(!validAnimatedTexture()).
ITexture* getAnimatedTexture(uint32 id);
// @}
// *********************
private:
struct CAnimatedTexture
{
CSmartPtr<ITexture> Texture;
// serial.
void serial(NLMISC::IStream &f);
};
typedef std::map<uint32, CAnimatedTexture> TAnimatedTextureMap;
TAnimatedTextureMap _AnimatedTextures;
};
// ***************************************************************************
/**
* An animated material Instance of CMaterialBase
* NB: formated for 3ds Max :). Emissive anim is a float, with a constant RGB factor.
* Texture animation: see update().
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class CAnimatedMaterial : public IAnimatable
{
public:
/// \name ctor / setup.
// @{
/** Constructor.
* This ctor:
* - store a RefPtr on the BaseMaterial (for getDefaultTracks() method).
* - copy the material default track value into Animated Values.
*/
CAnimatedMaterial(CMaterialBase *baseMat);
/** setup the material context for this animated material.
* This method:
* - store a RefPtr on the material, for future anim update.
*/
void setMaterial(CMaterial *pMat);
/** Return the name of this material (stored in CMaterialBase).
*/
std::string getMaterialName() const;
// @}
/** Check if the animated material is touched, and if necessary update the stored material (if any).
* Texture animation: for now, texture animation is possible only on stage 0. If TextureValue flag is touched (ie
* a texture anim track is linked to the animated value), update() look into the CMaterialBase what texture to set.
* If the track gives a bad Id for the texture, no-op.
*/
void update();
/// \name Get some track name
// @{
static const char *getAmbientValueName() {return "ambient";}
static const char *getDiffuseValueName() {return "diffuse";}
static const char *getSpecularValueName() {return "specular";}
static const char *getShininessValueName() {return "shininess";}
static const char *getEmissiveValueName() {return "emissive";}
static const char *getOpacityValueName() {return "opacity";}
static const char *getTextureValueName() {return "texture";}
//
static const char *getTexMatUTransName(uint stage);
static const char *getTexMatVTransName(uint stage);
static const char *getTexMatUScaleName(uint stage);
static const char *getTexMatVScaleName(uint stage);
static const char *getTexMatWRotName(uint stage);
// @}
/// number of animated values for each animated texture, taken from CMaterialBase
enum { NumTexAnimatedValues = CMaterialBase::CTexAnimTracks::NumTexAnimatedValues };
/// \name Herited from IAnimatable
// @{
/// Added values.
enum TAnimValues
{
OwnerBit= IAnimatable::AnimValueLast,
AmbientValue,
DiffuseValue,
SpecularValue,
ShininessValue,
EmissiveValue,
OpacityValue,
TextureValue,
TextureMatValues,
AnimValueLast = TextureMatValues + NumTexAnimatedValues * IDRV_MAT_MAXTEXTURES /* texture matrix anim */
};
/// From IAnimatable
virtual IAnimatedValue* getValue (uint valueId);
/// From IAnimatable
virtual const char *getValueName (uint valueId) const;
/// From IAnimatable.
virtual ITrack* getDefaultTrack (uint valueId);
/// From IAnimatable.
virtual void registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix);
// @}
// ********************
private:
// The material instantiator.
CRefPtr<CMaterialBase> _MaterialBase;
// The material.
CRefPtr<CMaterial> _Material;
// AnimValues.
CAnimatedValueRGBA _Ambient;
CAnimatedValueRGBA _Diffuse;
CAnimatedValueRGBA _Specular;
CAnimatedValueFloat _Shininess;
CAnimatedValueRGBA _Emissive;
CAnimatedValueFloat _Opacity;
CAnimatedValueInt _Texture;
struct CTexAnimatedMatValues
{
CAnimatedValueFloat _UTrans;
CAnimatedValueFloat _VTrans;
CAnimatedValueFloat _UScale;
CAnimatedValueFloat _VScale;
CAnimatedValueFloat _WRot;
void affect(CMaterialBase::CTexAnimTracks &at)
{
_UTrans.Value= at.DefaultUTrans.getDefaultValue();
_VTrans.Value= at.DefaultVTrans.getDefaultValue();
_UScale.Value= at.DefaultUScale.getDefaultValue();
_VScale.Value= at.DefaultVScale.getDefaultValue();
_WRot.Value= at.DefaultWRot.getDefaultValue();
}
};
CTexAnimatedMatValues _TexAnimatedMatValues[IDRV_MAT_MAXTEXTURES];
};
} // NL3D
#endif // NL_ANIMATED_MATERIAL_H
/* End of animated_material.h */

View file

@ -0,0 +1,116 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATED_MORPH_H
#define NL_ANIMATED_MORPH_H
#include "nel/misc/types_nl.h"
#include "nel/misc/smart_ptr.h"
#include "nel/3d/animatable.h"
#include "nel/3d/track.h"
#include <map>
namespace NL3D
{
// ***************************************************************************
/**
* An animated morph (blend shape) base
* \author Matthieu Besson
* \author Nevrax France
* \date 2001
*/
class CMorphBase : public NLMISC::CRefCount
{
public:
CMorphBase();
// Name of this material, for Animation access.
std::string Name;
// Default tracks.
CTrackDefaultFloat DefaultFactor;
/// save/load.
void serial(NLMISC::IStream &f);
};
// ***************************************************************************
/**
* An animated morph (blend shape)
* \author Matthieu Besson
* \author Nevrax France
* \date 2001
*/
class CAnimatedMorph : public IAnimatable
{
public:
/// \name ctor / setup.
// @{
/** Constructor.
*/
CAnimatedMorph (CMorphBase*mb);
// @}
/// \name Herited from IAnimatable
// @{
/// Added values.
enum TAnimValues
{
OwnerBit= IAnimatable::AnimValueLast,
FactorValue,
AnimValueLast
};
/// From IAnimatable
virtual IAnimatedValue* getValue (uint valueId);
/// From IAnimatable
virtual const char *getValueName (uint valueId) const;
/// From IAnimatable.
virtual ITrack* getDefaultTrack (uint valueId);
/// From IAnimatable.
virtual void registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix);
// @}
float getFactor() const { return _Factor.Value; }
void setFactor (float rFactor) { _Factor.Value = rFactor; }
const std::string& getName() const { return _MorphBase->Name; }
// ********************
private:
CMorphBase *_MorphBase;
CAnimatedValueFloat _Factor;
};
} // NL3D
#endif // NL_ANIMATED_MORPH_H
/* End of animated_morph.h */

View file

@ -0,0 +1,297 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATED_VALUE_H
#define NL_ANIMATED_VALUE_H
#include "nel/misc/types_nl.h"
#include "nel/misc/vector.h"
#include "nel/misc/quat.h"
#include "nel/misc/rgba.h"
namespace NL3D
{
/**
* A value handled by the animation system.
* This value must be managed by a IAnimatable object.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class IAnimatedValue
{
public:
virtual ~IAnimatedValue() {}
/**
* The blend method. This method blend two animated values and store the result
* in the object. The two first args can be reference on the object itself.
* Idealy, it performs the operation this->value=(this->value*blendFactor + value*(1.f-blendFactor))
*
* \param value is the first value in the blend operation.
* \param blendFactor must be in the range [0..1].
*/
virtual void blend (const IAnimatedValue& value, float blendFactor) =0;
/**
* An assignation method. This method assign a value to the object.
*
* \param value is the new value.
*/
virtual void affect (const IAnimatedValue& value) =0;
};
/**
* A template implementation of IAnimatedValue.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
template<class T>
class CAnimatedValueBlendable : public IAnimatedValue
{
public:
// NOT TESTED, JUST COMPILED. FOR PURPOSE ONLY.
/// A default blend method. Doesn't work for all type.
virtual void blend (const IAnimatedValue& value, float blendFactor)
{
// Check types of value. typeid is slow, assert only in debug
#ifdef NL_DEBUG
nlassert (typeid (value)==typeid(*this));
#endif
// Cast
CAnimatedValueBlendable<T> *pValue=(CAnimatedValueBlendable<T>*)&value;
// Blend
Value=(T) (Value*blendFactor+pValue->Value*(1.f-blendFactor));
}
/**
* An assignation method. This method assign a value to the object.
*
* \param value is the new value.
*/
virtual void affect (const IAnimatedValue& value)
{
// Check types of value. typeid is slow, assert only in debug
#ifdef NL_DEBUG
nlassert (typeid (value)==typeid(*this));
#endif
// Cast
CAnimatedValueBlendable<T> *pValue=(CAnimatedValueBlendable<T>*)&value;
// Blend
Value=pValue->Value;
}
// The value read and write
T Value;
};
/**
* A QUATERNION implementation of IAnimatedValue.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
template<> class CAnimatedValueBlendable<NLMISC::CQuat> : public IAnimatedValue
{
public:
/// A quat blend method.
virtual void blend (const IAnimatedValue& value, float blendFactor)
{
// Check types of value. typeid is slow, assert only in debug
#ifdef NL_DEBUG
nlassert (typeid (value)==typeid(*this));
#endif
// Cast.
CAnimatedValueBlendable<NLMISC::CQuat> *pValue=(CAnimatedValueBlendable<NLMISC::CQuat>*)&value;
// blend.
// Yoyo: no makeClosest is done, because the result seems to be better when done
// before: for all blend values, and not one after one.
Value= NLMISC::CQuat::slerp(Value, pValue->Value, 1-blendFactor);
}
/**
* An assignation method. This method assign a value to the object.
*
* \param value is the new value.
*/
virtual void affect (const IAnimatedValue& value)
{
// Check types of value. typeid is slow, assert only in debug
#ifdef NL_DEBUG
nlassert (typeid (value)==typeid(*this));
#endif
// Cast
CAnimatedValueBlendable<NLMISC::CQuat> *pValue=(CAnimatedValueBlendable<NLMISC::CQuat>*)&value;
// Blend
Value=pValue->Value;
}
// The value
NLMISC::CQuat Value;
};
/**
* A CRGBA implementation of IAnimatedValue.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
template<> class CAnimatedValueBlendable<NLMISC::CRGBA> : public IAnimatedValue
{
public:
/// A quat blend method.
virtual void blend (const IAnimatedValue& value, float blendFactor)
{
// Check types of value. typeid is slow, assert only in debug
#ifdef NL_DEBUG
nlassert (typeid (value)==typeid(*this));
#endif
// Cast.
CAnimatedValueBlendable<NLMISC::CRGBA> *pValue=(CAnimatedValueBlendable<NLMISC::CRGBA>*)&value;
// blend.
Value.blendFromui (pValue->Value, this->Value, (uint)(256.f*blendFactor));
}
/**
* An assignation method. This method assign a value to the object.
*
* \param value is the new value.
*/
virtual void affect (const IAnimatedValue& value)
{
// Check types of value. typeid is slow, assert only in debug
#ifdef NL_DEBUG
nlassert (typeid (value)==typeid(*this));
#endif
// Cast
CAnimatedValueBlendable<NLMISC::CRGBA> *pValue=(CAnimatedValueBlendable<NLMISC::CRGBA>*)&value;
// Blend
Value=pValue->Value;
}
// The value
NLMISC::CRGBA Value;
};
/**
* A template implementation of IAnimatedValue not blendable.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
template<class T>
class CAnimatedValueNotBlendable : public IAnimatedValue
{
public:
/// A default blend method. Doesn't work for all type.
virtual void blend (const IAnimatedValue& value, float blendFactor)
{
// Check types of value. typeid is slow, assert only in debug
#ifdef NL_DEBUG
nlassert (typeid (value)==typeid(*this));
#endif
// Cast
CAnimatedValueNotBlendable<T> *pValue=(CAnimatedValueNotBlendable<T>*)&value;
// Boolean blend
if (blendFactor<0.5f)
Value=pValue->Value;
}
/**
* An assignation method. This method assign a value to the object.
*
* \param value is the new value.
*/
virtual void affect (const IAnimatedValue& value)
{
// Check types of value. typeid is slow, assert only in debug
#ifdef NL_DEBUG
nlassert (typeid (value)==typeid(*this));
#endif
// Cast
CAnimatedValueNotBlendable<T> *pValue=(CAnimatedValueNotBlendable<T>*)&value;
// Blend
Value=pValue->Value;
}
// The value
T Value;
};
typedef CAnimatedValueNotBlendable<bool> CAnimatedValueBool;
typedef CAnimatedValueBlendable<sint32> CAnimatedValueInt;
typedef CAnimatedValueBlendable<float> CAnimatedValueFloat;
typedef CAnimatedValueBlendable<NLMISC::CVector> CAnimatedValueVector;
typedef CAnimatedValueNotBlendable<std::string> CAnimatedValueString;
typedef CAnimatedValueBlendable<NLMISC::CQuat> CAnimatedValueQuat;
typedef CAnimatedValueBlendable<NLMISC::CRGBA> CAnimatedValueRGBA;
// ***************************************************************************
/** This class must contain all the possible AnimatedValue, so the system can work
* It is used at ITrack evaluation to fill one of these values
*/
class CAnimatedValueBlock
{
public:
CAnimatedValueBool ValBool;
CAnimatedValueInt ValInt;
CAnimatedValueFloat ValFloat;
CAnimatedValueVector ValVector;
CAnimatedValueString ValString;
CAnimatedValueQuat ValQuat;
CAnimatedValueRGBA ValRGBA;
};
} // NL3D
#endif // NL_ANIMATED_VALUE_H
/* End of animated_value.h */

View file

@ -0,0 +1,208 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATION_H
#define NL_ANIMATION_H
#include "nel/misc/types_nl.h"
#include "nel/3d/animation_time.h"
#include "nel/3d/u_animation.h"
#include <memory>
#include <map>
#include <set>
#include <vector>
namespace NLMISC
{
class IStream;
struct EStream;
}
namespace NL3D
{
class ITrack;
class CAnimationSet;
/**
* This class describes animations for several tracks. Each track works
* with a IAnimatedValue for the IAnimatable objects.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class CAnimation : public UAnimation
{
public:
/// ctor
CAnimation();
/// Destructor
virtual ~CAnimation ();
/// \name Public interface.
enum { NotFound=0xffffffff };
/** Get track with its name.
*
* WARNING: slower if applyAnimHeaderCompression() has been called. try use getIdTrackByChannelId() instead
*
* \param name is the name of the desired track.
* \return CAnimation::NotFound if the track doesn't exist else the id of the track.
*/
uint getIdTrackByName (const std::string& name) const;
/**
* Fill the set of string with the name of the channels.
*
* \return the count of track in this animation
*/
void getTrackNames (std::set<std::string>& setString) const;
/** see applyAnimHeaderCompression()
* \return CAnimation::NotFound if the track doesn't exist (or anim header not compressed)
* else return the id of the track.
*/
uint getIdTrackByChannelId (uint16 channelId) const;
/** Get a const track pointer
*
* \param channelId is the id of the desired channel.
*/
const ITrack* getTrack (uint trackId) const
{
// Get the trackId-th track pointer
return _TrackVector[trackId];
}
/** Get a track pointer
*
* \param channelId is the id of the desired channel.
*/
ITrack* getTrack (uint trackId)
{
// Get the trackId-th track pointer
return _TrackVector[trackId];
}
/** Add a track at the end of the track list.
*
* This method is used to insert tracks in the animation.
* Tracks must be allocated with new. The pointer is then handeled
* by the CAnimation.
*/
void addTrack (const std::string& name, ITrack* pChannel);
/// Serial the template
void serial (NLMISC::IStream& f);
/// Set animation min end time
void setMinEndTime (TAnimationTime minEndTime);
/// \name From UAnimation
// @{
virtual UTrack* getTrackByName (const char* name);
virtual void releaseTrack (UTrack* track);
virtual TAnimationTime getBeginTime () const;
virtual TAnimationTime getEndTime () const;
virtual bool allTrackLoop() const;
// @}
/** For SkeletonSpawnScript (SSS) animation.
* Add manualy the shapes that can be spawned by the channel "spawn_script" in this animation
* This add into a vector (avoid duplicates)
*
* Then CAnimationSet::preloadSSSShapes() can be used after CAnimationSet::build() to force loading
* into the ShapeBank/Texture of thoses shapes, so there is no problem of shape loading during animation
*/
void addSSSShape(const std::string &shape);
const std::vector<std::string> &getSSSShapes() const {return _SSSShapes;}
/// \name CAnimationSet private
// @{
/** For each track that support it (CTrackSampled for instance), divide its number of sampled keys,
* to lower the memory lod. Used typically by CAnimationSet
*/
void applySampleDivisor(uint sampleDivisor);
/** For CTrackSampledQuat only, compress header. Used typically by CAnimationSet
* NB: Animation cannot be serialized after this operation (unserialisable tracks)
*/
void applyTrackQuatHeaderCompression();
/** Used by CAnimationSet to lower the memory Size. After this, you can
* (and should for better performances) use getIdTrackByChannelId()
* Does not support more than 65536 channels (nlassert)
*/
void applyAnimHeaderCompression(CAnimationSet *animationSetOwner, const std::map <std::string, uint32> &channelMap);
// @}
private:
/// \name Members
typedef std::map<std::string, uint32> TMapStringUInt;
typedef std::vector<ITrack* > TVectAPtrTrack;
// Animation name
std::string _Name;
// Map to get a channel id with a name. EMPTY if applyAnimHeaderCompression() called
TMapStringUInt _IdByName;
// Vector of channel pointer.
TVectAPtrTrack _TrackVector;
// Force animation min end time
TAnimationTime _MinEndTime;
/// \name Anim time caching
// @{
mutable TAnimationTime _BeginTime;
mutable TAnimationTime _EndTime;
mutable bool _AnimLoop;
mutable bool _BeginTimeTouched;
mutable bool _EndTimeTouched;
mutable bool _AnimLoopTouched;
// @}
/// CTrackSampledQuat header compression
class CTrackSamplePack *_TrackSamplePack;
// Sorted array of ChannelId. Same size as _TrackVector. EMPTY if applyAnimHeaderCompression() NOT called
std::vector<uint16> _IdByChannelId;
// The AnimationSet. NULL if applyAnimHeaderCompression() NOT called
class CAnimationSet *_AnimationSetOwner;
// see addSSSShape()
std::vector<std::string> _SSSShapes;
};
} // NL3D
#endif // NL_ANIMATION_H
/* End of animation.h */

View file

@ -0,0 +1,187 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATION_OPTIMIZER_H
#define NL_ANIMATION_OPTIMIZER_H
#include "nel/misc/types_nl.h"
#include "nel/misc/quat.h"
#include "nel/misc/vectord.h"
namespace NL3D
{
using NLMISC::CQuat;
using NLMISC::CQuatD;
using NLMISC::CVector;
using NLMISC::CVectorD;
class CAnimation;
class ITrack;
// ***************************************************************************
/**
* Purpose of this class is to optimize for memory and speed a CAnimation.
* Quaternion tracks are optimized. They are transformed to CTrackSampledQuat or CTrackDefaultQuat.
* Vector tracks are optimized. They are transformed to CTrackSampledVector or CTrackDefaultVector.
* \author Lionel Berenguier
* \author Nevrax France
* \date 2002
*/
class CAnimationOptimizer
{
public:
/// Constructor
CAnimationOptimizer();
/** Set the Quaternion Error Thresholds. must be >=0.
* Default is 0.0001 and 0.000001. Above this value, 2 quaternions are said different.
* NB: comparing 2 quaternions is made by multiplying the one with the inverse of the other.
* the W component is then tested and must be >1-threshold (modulo sign) to conclude to equality.
* Since quat.W=cos(angle/2), you can deduce the angle threshold with angleThre=acos(1-thre)*2
*
* Give 2 values, one For Low precision and High precision. Default setup use high precision. Use
* addLowPrecisionTrack() to drive low precision tracks.
*/
void setQuaternionThreshold(double lowPrecThre, double highPrecThre);
/** Same principle as for setQuaternionThreshold(), but for vector tracks (positions/scale).
* Default is 0.001 and 0.0001. Above this value, 2 vectors are said different.
* NB: comparing 2 vectors is made by geting the norm of the difference
*
* Give 2 values, one For Low precision and High precision. Default setup use high precision. Use
* addLowPrecisionTrack() to drive low precision tracks.
*/
void setVectorThreshold(double lowPrecThre, double highPrecThre);
/** see setQuaternionThreshold(). Any track which contains this name will be considered as a
* low precision track. Default setup is empty, so all tracks are "high precision" tracks.
* A good setup is for example addLowPrecisionTrack("Finger") and addLowPrecisionTrack("Ponytail")
* Warning: case sensitive
*/
void addLowPrecisionTrack(const std::string &name);
/// see addLowPrecisionTrack. This clears the array.
void clearLowPrecisionTracks();
/** Set the Sample Frame Rate (>0)
* Default is 30 fps. NB: final numSamples must be <65535, else assert at optimize() time.
*/
void setSampleFrameRate(float frameRate);
/** optimize an animation
* animOut is the same as animIn, but optimized.
* If a track can't be optimized, it is just duplicated in animOut.
*/
void optimize(const CAnimation &animIn, CAnimation &animOut);
// ******************
private:
float _SampleFrameRate;
double _QuaternionThresholdLowPrec;
double _QuaternionThresholdHighPrec;
double _QuaternionThreshold;
double _VectorThresholdLowPrec;
double _VectorThresholdHighPrec;
double _VectorThreshold;
// see addLowPrecisionTrack
std::vector<std::string> _LowPrecTrackKeyName;
// For Sampling of Quaternion Tracks.
std::vector<uint16> _TimeList;
std::vector<CQuat> _QuatKeyList;
// For Sampling of Vector Tracks.
std::vector<CVector> _VectorKeyList;
private:
// Clone a ITrack (using a CMemStream)
ITrack *cloneTrack(const ITrack *trackIn);
// true if the track can be optimized.
bool isTrackOptimisable(const ITrack *trackIn);
// return an optimized version of trackIn. Type returned should be different (eg: CTrackSampledQuat)
ITrack *optimizeTrack(const ITrack *trackIn);
// see addLowPrecisionTrack()
bool isLowPrecisionTrack(const std::string &trackName);
/// Quaternion optimisation.
// @{
/** sample the track from beginTime to endTime, sample to numSamples, such that
* key[0].Time==beginTime and key[numSamples-1].Time==endTime.
* NB: quaternions are normalized, and are makeClosest()-ed from sample to the next.
*/
void sampleQuatTrack(const ITrack *trackIn, float beginTime, float endTime, uint numSamples);
/** Test if the current track is constant (ie always same quaternion value)
* NB: test if q==qRef or q==-qRef of course.
*/
bool testConstantQuatTrack();
/** optimze the current track
*/
void optimizeQuatTrack();
/** return true if suppose same quaternion. NB: quaternion must be normalized.
* NB: test if quat1==quat0 or quat1==-quat0 of course.
*/
bool nearlySameQuaternion(const CQuatD &quat0, const CQuatD &quat1);
// @}
/// Vector optimisation.
// @{
/** sample the track from beginTime to endTime, sample to numSamples, such that
* key[0].Time==beginTime and key[numSamples-1].Time==endTime.
*/
void sampleVectorTrack(const ITrack *trackIn, float beginTime, float endTime, uint numSamples);
/** Test if the current track is constant (ie always same Vector value)
*/
bool testConstantVectorTrack();
/** optimze the current track
*/
void optimizeVectorTrack();
/** return true if suppose same vector.
*/
bool nearlySameVector(const CVectorD &v0, const CVectorD &v1);
// @}
};
} // NL3D
#endif // NL_ANIMATION_OPTIMIZER_H
/* End of animation_optimizer.h */

View file

@ -0,0 +1,304 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATION_PLAYLIST_H
#define NL_ANIMATION_PLAYLIST_H
#include "nel/misc/types_nl.h"
#include "nel/3d/channel_mixer.h"
namespace NL3D
{
/**
* This class
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class CAnimationPlaylist : public NLMISC::CRefCount
{
public:
enum
{
//
empty=0xffffffff
};
/// Wrap mode for the play list
enum TWrapMode
{
/// Clamp the animation time. (default)
Clamp=0,
/// Repeat the animation.
Repeat,
/// Disable the animation.
Disable,
WrapModeCount
};
/// Constructor
CAnimationPlaylist();
/**
* Empty the playlist. Each slot is set to its default value.
*/
void emptyPlayList ();
/**
* Set the animation of a slot. Default value is empty.
*
* \param slot is the id of the slot to set.
* \param animation is the animation number to use in this slot. To empty the slot, use CAnimationPlaylist::empty.
*/
void setAnimation (uint8 slot, uint animation);
/**
* Get the animation of a slot. Default value is empty.
*
* \param slot is the id of the slot to set.
* \return the animation number in use in this slot. Return CAnimationPlaylist::empty if the slot is empty.
*/
uint getAnimation (uint8 slot) const;
/**
* Set the skeleton weight animation of a slot. Default value is empty.
*
* \param slot is the id of the slot to set.
* \param skeletonId is the skeleton weight number to use in this slot. To empty the slot, use CAnimationPlaylist::empty.
* \param inverted is false if the weights must be used as they are, true if the weights to used are 1.f - weight.
*/
void setSkeletonWeight (uint8 slot, uint skeletonId, bool inverted=false);
/**
* Get the skeleton weight of a slot. Default value is empty.
*
* \param slot is the id of the slot to set.
* \param inverted will receive the invert flag.
* \return the skeleton weight number in use in this slot. Return CAnimationPlaylist::empty if the slot is empty.
*/
uint getSkeletonWeight (uint8 slot, bool &inverted) const;
/**
* Set animation time origin, ie, the time in the playlist for which slot time is the startTime of the slot animation.
* Default value is 0.f.
*
* \param slot is the id of the slot to set.
* \param timeOrigin time origin to use in the slot.
*/
void setTimeOrigin (uint8 slot, TGlobalAnimationTime timeOrigin);
/**
* Get animation time origin, ie, the time in the playlist for which slot time is the startTime of the slot animation.
* Default value is 0.f.
*
* \param slot is the id to get the slot.
* \return time origin used in the slot.
*/
TGlobalAnimationTime getTimeOrigin (uint8 slot) const;
/**
* Set animation speed factor.
* Default value is 1.f.
*
* \param slot is the id of the slot to set.
* \param speedFactor is the factor to use in this slot. The animation will go speedFactor* faster.
*/
void setSpeedFactor (uint8 slot, float speedFactor);
/**
* Get animation speed factor.
* Default value is 1.f.
*
* \param slot is the id to get the slot.
* \return the speed factor used in the slot.
*/
float getSpeedFactor (uint8 slot) const;
/**
* Set animation start weight. This is the weight for this animation use at the beginning of the animation slot.
* Default value is 1.f.
*
* \param slot is the id of the slot to set.
* \param startWeight is the factor to use in this slot.
* \param time is the playlist time for which the start weight is set. Default is 0.f.
*/
void setStartWeight (uint8 slot, float startWeight, TGlobalAnimationTime time);
/**
* Get animation start weight.
* Default value is 1.f.
*
* \param slot is the id to get the slot.
* \param time will get the playlist time for which the start weight is set. Default time is 0.f.
* \return the start weight used in the slot.
*/
float getStartWeight (uint8 slot, TGlobalAnimationTime& time) const;
/**
* Set animation end weight. This is the weight for this animation use at the end of the animation slot.
* Default value is 1.f.
*
* \param slot is the id of the slot to set.
* \param time is the playlist time for which the end weight is set. Default time is 0.f.
* \param endWeight is the factor to use in this slot.
*/
void setEndWeight (uint8 slot, float endWeight, TGlobalAnimationTime time);
/**
* Get animation end weight.
* Default value is 1.f.
*
* \param slot is the id to get the slot.
* \param time will get the playlist time for which the start weight is set. Default is 0.f.
* \return the end weight used in the slot.
*/
float getEndWeight (uint8 slot, TGlobalAnimationTime& time) const;
/**
* Set weight smoothness.
* This is the smoothness of the weight interpolation.
* Must be between 0.f and 1.f. 0.f is a sharp interpolation (linear), 1.f is a smooth interpolation (quadratic).
* Default value is 0.f.
*
* \param slot is the id of the slot to set.
* \param smoothness is the smoothness value.
*/
void setWeightSmoothness (uint8 slot, float smoothness);
/**
* Get weight smoothness.
* This is the smoothness of the weight interpolation.
* Must be between 0.f and 1.f. 0.f is a sharp interpolation (linear), 1.f is a smooth interpolation (quadratic).
* Default value is 0.f.
*
* \param slot is the id of the slot to set.
* \return the smoothness value.
*/
float getWeightSmoothness (uint8 slot) const;
/**
* Setup a channel mixer.
*
* For each slot, it sets :
* * the animation id used by the slot.
* * the animation time according with the begin time of each slot, the speed factor of each slot and the current time passed in parameter.
* * the skeleton weight id.
* * the weight interpolated with the start and end values. The weight value are clamped before and after the animation.
*/
void setupMixer (CChannelMixer& mixer, TGlobalAnimationTime time) const;
/**
* Static interpolation method of blend value
*
* \param startBlendTime is the time when the blend starts.
* \param endBlendTime is the time when the blend ends.
* \param time is the current time.
* \param startBlend is the blend value at start.
* \param endBlend is the blend value at end.
* \param smoothness is the smoothnes value. (Must be between 0 and 1)
*/
static float getWeightValue (TGlobalAnimationTime startWeightTime, TGlobalAnimationTime endWeightTime, TGlobalAnimationTime time, float startWeight, float endWeight, float smoothness);
/**
* Set the wrap mode to use in the play list.
*
* Wrap mode tells the play list how to use an animation when current time is not in the animation.
* \param wrapMode is the mode to use.
*/
void setWrapMode (uint8 slot, TWrapMode wrapMode);
/**
* Get the wrap mode in use in the play list.
*
* Wrap mode tells the play list how to use an animation when current time is not in the animation.
* \return the wrap mode in use.
*/
TWrapMode getWrapMode (uint8 slot) const;
/**
* Convert a playlist global time in local time in a slot animation including wrap evaluation.
*
* \param slot is the slot in which the local time must be computed
* \param time is the global time of the playlist
*
* \return the local time in the slot. If no animation are set in the slot, globalTime is returned.
*/
TAnimationTime getLocalTime (uint8 slot, TGlobalAnimationTime globalTime, const CAnimationSet& animSet) const;
/**
* Compute weight of a slot at a given global playlist time
*
* \param slot is the slot in which the weight must be computed
* \param time is the global time of the playlist
*
* \return the weight of the slot for the given time.
*/
float getLocalWeight (uint8 slot, TGlobalAnimationTime globalTime) const;
/**
* Serial
*/
void serial (NLMISC::IStream& f);
private:
// Animation in slot
uint32 _Animations[CChannelMixer::NumAnimationSlot];
// Skeleton weight in slot
uint32 _SkeletonWeight[CChannelMixer::NumAnimationSlot];
// Invert Skeleton weight in slot
bool _InvertWeight[CChannelMixer::NumAnimationSlot];
// Time origin in slot
TGlobalAnimationTime _TimeOrigin[CChannelMixer::NumAnimationSlot];
// Speed factor in slot
float _SpeedFactor[CChannelMixer::NumAnimationSlot];
// Start weight
float _StartWeight[CChannelMixer::NumAnimationSlot];
// Start weight time
TGlobalAnimationTime _StartWeightTime[CChannelMixer::NumAnimationSlot];
// End weight
float _EndWeight[CChannelMixer::NumAnimationSlot];
// End weight time
TGlobalAnimationTime _EndWeightTime[CChannelMixer::NumAnimationSlot];
// Smoothness of the weight interpolation
float _Smoothness[CChannelMixer::NumAnimationSlot];
// Wrap mode
TWrapMode _WrapMode[CChannelMixer::NumAnimationSlot];
};
} // NL3D
#endif // NL_ANIMATION_PLAYLIST_H
/* End of animation_playlist.h */

View file

@ -0,0 +1,287 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATION_SET_H
#define NL_ANIMATION_SET_H
#include "nel/misc/types_nl.h"
#include "nel/3d/animation.h"
#include "nel/3d/skeleton_weight.h"
#include "nel/misc/smart_ptr.h"
#include <map>
#include <string>
#include <vector>
namespace NLMISC
{
class IStream;
struct EStream;
}
namespace NL3D
{
class IDriver;
class CShapeBank;
/**
* An CAnimationSet is set of CAnimation. It manages global channel ID for a set of
* animations with many tracks. An Id is associed with each track name.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class CAnimationSet : public NLMISC::CRefCount
{
public:
enum { NotFound=0xffffffff };
/**
* \param headerOptim if true, the animationSet cannot be serialized (nlassert), but could save
* lot of memory load: CTrackSampleQuat memory are optimized (48 bytes to 12) and map<string, id>
* per animation is replaced with a (IdChannelInAnimSet, IdTrackInAnim) association
*/
CAnimationSet (bool headerOptim= false);
~CAnimationSet ();
/**
* Get channel ID count. This number is the count of different track name in the animation set.
*/
uint getNumChannelId () const;
/** Get a channel Name by its Id.
*/
const std::string &getChannelName(uint channelId) const
{
nlassert(channelId<_ChannelName.size());
return _ChannelName[channelId];
}
/**
* Get a channel ID with its name. If no channel is found, method returns NotFound.
*/
uint getChannelIdByName (const std::string& name) const
{
// Look for an id with this name
std::map <std::string, uint32>::const_iterator ite=_ChannelIdByName.find (name);
if (ite!=_ChannelIdByName.end ())
return ite->second;
else
return NotFound;
}
/**
* Get a animation ID by name. If no channel is found, method returns NotFound.
*/
uint getAnimationIdByName (const std::string& name) const
{
// Look for an id with this name
std::map <std::string, uint32>::const_iterator ite=_AnimationIdByName.find (name);
if (ite!=_AnimationIdByName.end ())
return ite->second;
else
return NotFound;
}
/**
* Get animations count.
*/
uint getNumAnimation () const
{
return (uint)_Animation.size();
}
/**
* Get animation name.
*/
const std::string& getAnimationName (uint animationId) const
{
nlassert(animationId<_AnimationName.size());
return _AnimationName[animationId];
}
/**
* Get a read only animation pointer.
*/
const CAnimation* getAnimation (uint animationId) const
{
nlassert(animationId<_Animation.size());
return _Animation[animationId];
}
/**
* Get a writable animation pointer.
*/
CAnimation* getAnimation (uint animationId)
{
nlassert(animationId<_Animation.size());
return _Animation[animationId];
}
/**
* Get skeleton weight count.
*/
uint getNumSkeletonWeight () const
{
return (uint)_SkeletonWeight.size();
}
/**
* Get a skeleton weight ID by name. If no skeleton weight is found, method returns NotFound.
*/
uint getSkeletonWeightIdByName (const std::string& name) const
{
// Look for an id with this name
std::map <std::string, uint32>::const_iterator ite=_SkeletonWeightIdByName.find (name);
if (ite!=_SkeletonWeightIdByName.end ())
return ite->second;
else
return NotFound;
}
/**
* Get skeleton template name.
*/
const std::string& getSkeletonWeightName (uint skeletonId) const
{
nlassert(skeletonId<_SkeletonWeightName.size());
return _SkeletonWeightName[skeletonId];
}
/**
* Get a read only skeleton weight pointer.
*/
const CSkeletonWeight* getSkeletonWeight (uint skeletonId) const
{
nlassert(skeletonId<_SkeletonWeight.size());
return _SkeletonWeight[skeletonId];
}
/**
* Get a writable skeleton weight pointer.
*/
CSkeletonWeight* getSkeletonWeight (uint skeletonId)
{
nlassert(skeletonId<_SkeletonWeight.size());
return _SkeletonWeight[skeletonId];
}
/**
* Add an animation to the set. The pointer of the animation must be allocated with new.
* It is then handled by the animation set.
*
* WARNING: it assert if you call addAnimation() after build(), while the animation set is in HeadOptim mode
*
* \param name is the name of the animation.
* \param animation is the animation pointer.
* \return the id of the new animation.
*/
uint addAnimation (const char* name, CAnimation* animation);
/**
* Add a skeleton weight to the set. The pointer of the skeletonWeight must be allocated with new.
* It is then handled by the animation set.
*
* \return the id of the new skeleton.
*/
uint addSkeletonWeight (const char* name, CSkeletonWeight* skeletonWeight);
/**
* Reset the animation set.
*/
void reset ();
/**
* Final build of the animation set.
*
* First, for each animation you want to add to the set, you must add the animation in the set.
*
* When all animations are built, call this method to finalize the set.
*
* NoOp if already built
*/
void build ();
/// Serial the template
void serial (NLMISC::IStream& f);
/**
* Helper method.
* Load an animation set from animation files in a directory, then call build().
* \param path Path to look at for animations
* \param recurse whether to recurse to load animation in sub folders
* \param ext the extension for animation files
* \param wantWarningMessage displays warning if some of the files could not be loaded
* \return true if everything loaded ok
*/
bool loadFromFiles
(
const std::string &path,
bool recurse = true,
const char *ext = "anim",
bool wantWarningMessage = true
);
/** Set the animation Set in "Low Memory" mode by skipping some keys
* Each added animation will loose some keys for CTrackSampledQuat and CTrackSampledVector
* \param sampleDivisor if set to 5 for instance, the number of keys will be divided (ideally) by 5.
* if 0, set to 1. if 1 => no key skip (default to 1)
*/
void setAnimationSampleDivisor(uint sampleDivisor);
/** see setAnimationSampleDivisor
*/
uint getAnimationSampleDivisor() const;
/// see CAnimationSet ctor
bool isAnimHeaderOptimized() const {return _AnimHeaderOptimisation;}
/** For SkeletonSpawnScript (SSS) animation.
* call this after build(). This method preload ALL the shapes/texture
* that can be spawned due to any animation
*/
void preloadSSSShapes(IDriver &drv, CShapeBank &shapeBank);
private:
std::vector <CAnimation*> _Animation;
std::vector <CSkeletonWeight*> _SkeletonWeight;
std::vector <std::string> _ChannelName;
std::vector <std::string> _AnimationName;
std::vector <std::string> _SkeletonWeightName;
std::map <std::string, uint32> _ChannelIdByName;
std::map <std::string, uint32> _AnimationIdByName;
std::map <std::string, uint32> _SkeletonWeightIdByName;
uint _SampleDivisor;
bool _AnimHeaderOptimisation;
bool _Built;
/// All Shapes that can be spawned in any animation
std::set<std::string> _SSSShapes;
void buildChannelNameFromMap();
};
} // NL3D
#endif // NL_ANIMATION_SET_H
/* End of animation_set.h */

View file

@ -0,0 +1,239 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATION_SET_USER_H
#define NL_ANIMATION_SET_USER_H
#include "nel/misc/types_nl.h"
#include "nel/misc/stream.h"
#include "nel/misc/smart_ptr.h"
#include "nel/misc/file.h"
#include "nel/misc/path.h"
#include "nel/3d/u_animation_set.h"
#include "nel/3d/animation_set.h"
namespace NL3D
{
class CPlayListManagerUser;
class CDriverUser;
// ***************************************************************************
/**
* UAnimationSet implementation
* \author Lionel Berenguier
* \author Nevrax France
* \date 2001
*/
class CAnimationSetUser : public UAnimationSet
{
private:
NLMISC::CSmartPtr<CAnimationSet> _AnimationSet;
CDriverUser *_Owner;
friend class CPlayListManagerUser;
friend class CSceneUser;
public:
/// Constructor
CAnimationSetUser(CDriverUser *owner, bool headerOptim = true)
{
nlassert(owner);
_Owner= owner;
nlassert((uint)UAnimationSet::NotFound == (uint)CAnimationSet::NotFound );
// create a smartptred animation set. Allow header compression
_AnimationSet= new CAnimationSet(headerOptim);
}
/// Constructor
CAnimationSetUser(CDriverUser *owner, NLMISC::IStream &f)
{
nlassert(owner);
_Owner= owner;
nlassert((uint)UAnimationSet::NotFound == (uint)CAnimationSet::NotFound );
// create a smartptred animation set. DO NOT Allow header compression, cause serial()
_AnimationSet= new CAnimationSet(false);
_AnimationSet->serial(f);
}
virtual void setAnimationSampleDivisor(uint sampleDivisor);
virtual uint getAnimationSampleDivisor() const;
/**
* Add an animation in the animation set. After adding all your animations, call build().
*
* \param fileName is the animation filename
* \param animName is the name of the animation in the animation set.
* \return NotFound if the file is not found.
*/
uint addAnimation (const char* fileName, const char* animName, bool displayMissingFileWarning = true)
{
// Allocate an animation
std::auto_ptr<CAnimation> anim (new CAnimation);
// Read it
NLMISC::CIFile file;
std::string path = NLMISC::CPath::lookup (fileName, false, displayMissingFileWarning);
if (path.empty())
path = fileName;
if ( file.open ( path ) )
{
// Serial the animation
file.serial (*anim);
// Add the animation
uint id=_AnimationSet->addAnimation (animName, anim.release());
// Return id
return id;
}
else return UAnimationSet::NotFound;
}
/**
* Build the animation set. Call build after adding all your animations.
*/
virtual void build ();
/**
* Add a skeleton weight in the animation set.
* This method use CPath to search the skeleton file.
*
* \param fileName is the skeleton weight filename
* \param animName is the name of the skeleton weight in the animation set.
* \return the id of the new skeleton or NotFound if the file is not found.
*/
virtual uint addSkeletonWeight (const char* fileName, const char* skelName)
{
// Allocate an animation
std::auto_ptr<CSkeletonWeight> skeletonWeight (new CSkeletonWeight);
// Read it
NLMISC::CIFile file;
if (file.open ( NLMISC::CPath::lookup( fileName ) ) )
{
// Serial the animation
file.serial (*skeletonWeight);
// Add the animation
uint id=_AnimationSet->addSkeletonWeight (skelName, skeletonWeight.release());
// Return id
return id;
}
else return UAnimationSet::NotFound;
}
/// \name Animations mgt.
// @{
/**
* Get animations count.
*/
virtual uint getNumAnimation () const
{
return _AnimationSet->getNumAnimation();
}
/**
* Get an animation ID by name. If no animation is found, method returns NotFound.
*/
virtual uint getAnimationIdByName (const std::string& name) const
{
return _AnimationSet->getAnimationIdByName(name);
}
/**
* Get animation name.
*/
virtual const std::string& getAnimationName (uint animationId) const
{
if(animationId>=getNumAnimation())
nlerror("getAnimation*(): bad animation Id");
return _AnimationSet->getAnimationName(animationId);
}
/**
* Get a writable animation pointer.
*
* \return the end time.
*/
virtual UAnimation* getAnimation (uint animationId);
// @}
/// \name SkeletonWeight mgt.
// @{
/**
* Get skeleton weight count.
*/
virtual uint getNumSkeletonWeight () const
{
return _AnimationSet->getNumSkeletonWeight();
}
/**
* Get a SkeletonWeight ID by name. If no SkeletonWeight is found, method returns NotFound.
*/
virtual uint getSkeletonWeightIdByName (const std::string& name) const
{
return _AnimationSet->getSkeletonWeightIdByName(name);
}
/**
* Get skeleton template name.
*/
virtual const std::string& getSkeletonWeightName (uint skeletonId) const
{
if(skeletonId>=getNumSkeletonWeight())
nlerror("getSkeletonWeight*(): bad SkeletonWeight Id");
return _AnimationSet->getSkeletonWeightName(skeletonId);
}
// @}
/// \name Channel mgt.
// @{
virtual uint getChannelIdByName (const std::string& name) const
{
return _AnimationSet->getChannelIdByName(name);
}
// @}
// Access the animation set
const CAnimationSet* getAnimationSet () const;
};
} // NL3D
#endif // NL_ANIMATION_SET_USER_H
/* End of animation_set_user.h */

View file

@ -0,0 +1,44 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ANIMATION_TIME_H
#define NL_ANIMATION_TIME_H
#include "nel/misc/types_nl.h"
namespace NL3D
{
/**
* Animation time in second.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
typedef float CAnimationTime;
typedef float TAnimationTime;
typedef double TGlobalAnimationTime;
} // NL3D
#endif // NL_ANIMATION_TIME_H
/* End of animation_time.h */

View file

@ -0,0 +1,143 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ASYNC_FILE_MANAGER_3D_H
#define NL_ASYNC_FILE_MANAGER_3D_H
#include "nel/misc/types_nl.h"
#include "nel/misc/thread.h"
#include "nel/misc/async_file_manager.h"
namespace NL3D
{
class IShape;
class IDriver;
class CInstanceGroup;
class UInstanceGroup;
class CTextureFile;
/**
* CAsyncFileManager is a class that manage file loading in a seperate thread
* \author Matthieu Besson
* \author Nevrax France
* \date 2002
*/
class CAsyncFileManager3D
{
NLMISC_SAFE_SINGLETON_DECL(CAsyncFileManager3D);
CAsyncFileManager3D();
public:
// static CAsyncFileManager3D &getInstance (); // Must be called instead of constructing the object
static void terminate (); // release singleton
void loadMesh (const std::string &sMeshName, IShape **ppShp, IDriver *pDriver, const NLMISC::CVector &position, uint textureSlot);
bool cancelLoadMesh (const std::string& sMeshName);
void loadIG (const std::string &igName, CInstanceGroup **ppIG);
void loadIGUser (const std::string &igName, UInstanceGroup **ppIG);
void loadTexture (CTextureFile *textureFile, bool *pSgn, const NLMISC::CVector &position);
bool cancelLoadTexture (CTextureFile *textFile);
// Do not use these methods with the bigfile manager
void loadFile (const std::string &fileName, uint8 **pPtr);
void loadFiles (const std::vector<std::string> &vFileNames, const std::vector<uint8**> &vPtrs);
void signal (bool *pSgn); // Signal a end of loading for a group of "mesh or file" added
void cancelSignal (bool *pSgn);
private:
// CAsyncFileManager3D (); // Singleton mode -> access it with the getInstance function
// static CAsyncFileManager3D *_Singleton;
friend class CLoadMeshCancel;
friend class CLoadTextureCancel;
// All the tasks
// -------------
// Load a .shape
class CMeshLoad : public NLMISC::IRunnablePos
{
IShape **_ppShp;
IDriver *_pDriver;
uint _SelectedTexture;
public:
std::string MeshName;
public:
CMeshLoad (const std::string &meshName, IShape **ppShp, IDriver *pDriver, const CVector &position, uint selectedTexture);
void run (void);
void getName (std::string &result) const;
};
// Load a .ig
class CIGLoad : public NLMISC::IRunnable
{
std::string _IGName;
CInstanceGroup **_ppIG;
public:
CIGLoad (const std::string& meshName, CInstanceGroup **ppIG);
void run (void);
void getName (std::string &result) const;
};
// Load a .ig User Interface
class CIGLoadUser : public NLMISC::IRunnable
{
std::string _IGName;
UInstanceGroup **_ppIG;
public:
CIGLoadUser (const std::string& meshName, UInstanceGroup **ppIG);
void run (void);
void getName (std::string &result) const;
};
// Load a texture
class CTextureLoad : public NLMISC::IRunnablePos
{
public:
CTextureFile *TextureFile;
bool *Signal;
public:
CTextureLoad(CTextureFile *textureFile, bool *psgn, const CVector &position)
: TextureFile(textureFile), Signal(psgn)
{
Position = position;
}
void run();
void getName (std::string &result) const;
};
};
} // NL3D
#endif // NL_ASYNC_FILE_MANAGER_3D_H
/* End of async_file_manager.h */

View file

@ -0,0 +1,70 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ASYNC_TEXTURE_BLOCK_H
#define NL_ASYNC_TEXTURE_BLOCK_H
#include "nel/misc/types_nl.h"
#include "nel/3d/material.h"
#include <limits>
namespace NL3D
{
class CMeshBaseInstance;
// ***************************************************************************
/**
* Descriptor of TextureFile Names.
* \author Lionel Berenguier
* \author Nevrax France
* \date 2002
*/
class CAsyncTextureBlock
{
public:
// List of texture file names for a material
std::string TextureNames[IDRV_MAT_MAXTEXTURES];
CAsyncTextureBlock()
{
for(uint i=0;i<IDRV_MAT_MAXTEXTURES;i++)
{
TextIds[i]= std::numeric_limits<uint>::max();
IsTextureFile[i]= false;
}
}
bool isTextureFile(uint stage) const {return IsTextureFile[stage];}
private:
friend class CMeshBaseInstance;
// Ids in the CAsyncTextureManager
uint TextIds[IDRV_MAT_MAXTEXTURES];
// true if the texture in the stage is really a texture file.
bool IsTextureFile[IDRV_MAT_MAXTEXTURES];
};
} // NL3D
#endif // NL_ASYNC_TEXTURE_BLOCK_H
/* End of async_texture_block.h */

View file

@ -0,0 +1,250 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_ASYNC_TEXTURE_MANAGER_H
#define NL_ASYNC_TEXTURE_MANAGER_H
#include "nel/misc/types_nl.h"
#include "nel/3d/texture_file.h"
#include "nel/3d/hls_texture_manager.h"
#include <vector>
#include "nel/misc/bitmap.h"
namespace NL3D
{
class CMeshBaseInstance;
// ***************************************************************************
/**
* Async Loader of textures and Texture Load Balancer.
* Additionaly, store in RAM for each texture load a very low, DXTC1 compressed version of the texture.
* Used for some Lod systems.
* \author Lionel Berenguier
* \author Nevrax France
* \date 2002
*/
class CAsyncTextureManager
{
public:
/// User is free to add bank to this manager. Other methods are used by the async manager
CHLSTextureManager HLSManager;
public:
/// Constructor
CAsyncTextureManager();
~CAsyncTextureManager();
/** setup the mipMap levels.
* \baseLevel When the texture is first added, it is loaded skipping the baseLevel
* first mipmap
* \maxLevel During time, further mipmap are loaded, according to instance position etc... maxLevel
* tells where to stop. If 0, the texture will finally be entirely uploaded.
* Default is 3,1.
*/
void setupLod(uint baseLevel, uint maxLevel);
/// Setup max texture upload in driver per update() call (in bytes). Default to 64K
void setupMaxUploadPerFrame(uint maxup);
/// Setup max texture HLS Coloring per update() call (in bytes). Default to 20K.
void setupMaxHLSColoringPerFrame(uint maxCol);
/// Setup max total texture size allowed. Default is 10Mo
void setupMaxTotalTextureSize(uint maxText);
/** Add a reference to a texture owned by an instance.
* If the texture still exists, only the refcount is incremented
* Else if texture is found in the HLSTextureManager, it is builded (async) from it, else Begin Async loading
*
* Therefore, only CTextureFile are possible. Also note that the texture is uploaded with mipmap by default, and
* UpLoadFormat is also default (say ITexture::Auto)
*
* If the texture file is not a DDS with mipmap, this is an error. But the system doesn't fail and
* the file is entirely loaded and uploaded. The problem is that upload is not cut according to maxUpLoadPerFrame, so
* some freeze may occur.
*/
uint addTextureRef(const std::string &textName, CMeshBaseInstance *instance, const NLMISC::CVector &position);
/// release a texture-instance tuple. The texture is released if no more instance use it.
void releaseTexture(uint id, CMeshBaseInstance *instance);
/// tells if a texture is loaded in the driver (ie. ready to use)
bool isTextureUpLoaded(uint id) const;
/** get the RAM LowDef version of a texture. Used For CLodCharacters
* return NULL if bad Id or if the texture is still not loaded.
* The bitmap returned has no mipmaps and should be in DXTC1 (not guaranteed).
*/
const NLMISC::CBitmap *getCoarseBitmap(uint id) const;
/** update the manager. New loaded textures are uploaded. Instances are updated to know if all their
* pending textures have been uploaded.
*/
void update(IDriver *pDriver);
/// get the async texture size asked (ie. maybe bigger than MaxTotalTextureSize).
uint getTotalTextureSizeAsked() const {return _TotalTextureSizeAsked;}
/// get what the system really allows
uint getLastTextureSizeGot() const {return _LastTextureSizeGot;}
// ***************************************************************************
private:
typedef std::map<std::string, uint> TTextureEntryMap;
typedef TTextureEntryMap::iterator ItTextureEntryMap;
// A base texture uploadable.
class CTextureBase
{
public:
// the texture currently loaded / uploaded.
NLMISC::CSmartPtr<CTextureFile> Texture;
bool isTextureEntry() const {return IsTextureEntry;}
protected:
bool IsTextureEntry;
};
class CTextureEntry;
// A Lod version of a texture entry.
class CTextureLod : public CTextureBase
{
public:
CTextureLod();
// A Ptr on the real texture used.
CTextureEntry *TextureEntry;
// Weight of the lod, according to distance and level.
float Weight;
// the level of this Lod. 0 means full original texture resolution.
uint8 Level;
// True if loading has ended
bool Loaded;
// True if TextureEntry has at least this lod in VRAM
bool UpLoaded;
// The size that this lod takes in VRAM (minus TextureEntry->BaseSize)
uint ExtraSize;
};
struct CTextureLodToSort
{
CTextureLod *Lod;
CVector Position;
bool operator<(const CTextureLodToSort &other) const
{
return Lod->Weight<other.Lod->Weight;
}
};
// A texture entry
class CTextureEntry : public CTextureBase
{
public:
// The it in the map.
ItTextureEntryMap ItMap;
// true if async loading has ended
bool Loaded;
// true if the texture is loaded in the driver (at least the coarsest level).
bool UpLoaded;
// true if first loading ended, and if DXTC with mipmap
bool CanHaveLOD;
// true if this texture must be built from the HLSManager (at first load)
bool BuildFromHLSManager;
// if BuildFromHLSManager, gives the text id in the manager
sint HLSManagerTextId;
// Base Size of the texture, without HDLod
uint BaseSize;
// list of instances currently using this texture.
std::vector<CMeshBaseInstance*> Instances;
// min distance of all Instances.
float MinDistance;
// min position.
NLMISC::CVector MinPosition;
// with all mipmaps loaded, what place this takes.
uint TotalTextureSizeAsked;
// The High Def Lod.
CTextureLod HDLod;
// The Coarse Bitmap stored in RAM for CLod
NLMISC::CBitmap CoarseBitmap;
public:
CTextureEntry();
void createCoarseBitmap();
};
private:
uint _BaseLodLevel, _MaxLodLevel;
uint _MaxUploadPerFrame;
uint _MaxHLSColoringPerFrame;
uint _MaxTotalTextureSize;
uint _TotalTextureSizeAsked;
uint _LastTextureSizeGot;
// Textures Entries.
std::vector<CTextureEntry*> _TextureEntries;
std::vector<uint> _FreeTextureIds;
TTextureEntryMap _TextureEntryMap;
std::vector<uint> _WaitingTextures;
// Upload of texture piece by piece.
CTextureBase *_CurrentUploadTexture;
uint _CurrentUploadTextureMipMap;
uint _CurrentUploadTextureLine;
// The current HDLod async loaded (NB: loaded / or upLoaded)
CTextureLod *_CurrentTextureLodLoaded;
// For texture profiling
NLMISC::CSmartPtr<ITexture::CTextureCategory> _TextureCategory;
private:
static bool validDXTCMipMap(ITexture *pText);
// delete the texture and all references in map/array, instance refcount etc...
void deleteTexture(uint id);
// Fill _CurrentUploadTexture with next texture to upload, or set NULL if none
void getNextTextureToUpLoad(uint &nTotalColored, IDriver *pDriver);
bool uploadTexturePart(ITexture *pText, IDriver *pDriver, uint &nTotalUpload);
// update list of texture lods.
void updateTextureLodSystem(IDriver *pDriver);
};
} // NL3D
#endif // NL_ASYNC_TEXTURE_MANAGER_H
/* End of async_texture_manager.h */

View file

@ -0,0 +1,136 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_BEZIER_PATCH_H
#define NL_BEZIER_PATCH_H
#include "nel/misc/types_nl.h"
#include "nel/misc/vector.h"
#include "nel/misc/vectord.h"
#include "nel/misc/matrix.h"
namespace NL3D
{
using NLMISC::CVector;
using NLMISC::CVectorD;
using NLMISC::CMatrix;
// ***************************************************************************
/**
* A standard bezier patch of float. (quadpatch only).
* QuadPatch layout (same notations as 3ds Max SDK).
*
*
*
* 0 ---s---> 3
*
* A---> ad ---- da <---D
* | |
* | | |
* | v v
* | ab ia id dc
* t
* | | |
* | | |
* v
* ba ib ic cd
* ^ ^
* | |
* | |
* B---> bc ---- cb <---C
* 1 2
*
* \author Lionel Berenguier
* \author Nevrax France
* \date 2000
*/
class CBezierPatch
{
public:
/// The vertices a,b,c,d of the quad patch.
CVector Vertices[4];
/// The tangents ab, ba, bc, cb, cd, dc, da, ad. NB: tangents are points, not vectors.
CVector Tangents[8];
/// The interiors, ia,ib,ic,id. NB: interiors are points, not vectors.
CVector Interiors[4];
public:
/// Constructor: undefined Bezier patch!!
CBezierPatch() {}
/// complete computation of Vertices, Tangents, and Interiors, providing the vertices and vertex normals.
void make(CVector vertices[4], CVector normals[4]);
/// make default Interiors, according to Vertices and Tangents.
void makeInteriors();
/// Do the matrix transformation m*patch.
void applyMatrix(const CMatrix &m);
/// Evaluate.
CVector eval(float s, float t) const; // s,t coordinates for quad.
/// Evaluate, but return a vector double.
CVectorD evalDouble(double s, double t) const; // s,t coordinates for quad.
/// Evaluate the normal at (s,t). returned vector is normalized.
CVector evalNormal(float s, float t) const; // s,t coordinates for quad.
/// Evaluate the tangentS at (s,t). returned vector is normalized.
CVector evalTangentS(float s, float t) const; // s,t coordinates for quad.
/// Evaluate the tangentT at (s,t). returned vector is normalized.
CVector evalTangentT(float s, float t) const; // s,t coordinates for quad.
/// \name Subdivision.
// @{
/** Subdivide the bezier patch in 2 bezier patches along s, at s (beetween [0,1]).
* NB: left goes from 0 to s, right goes from s to 1.
*/
void subdivideS(CBezierPatch &left, CBezierPatch &right, float s=0.5f) const;
/** Subdivide the bezier patch in 2 bezier patches along t, at t (beetween [0,1]).
* NB: top goes from 0 to t, bottom goes from t to 1.
*/
void subdivideT(CBezierPatch &top, CBezierPatch &bottom, float t=0.5f) const;
// @}
// **********************************
private:
struct CBezierCurve
{
CVector P0, P1, P2, P3;
void subdivide(CBezierCurve &left, CBezierCurve &right, float t);
void set(const CVector &a, const CVector &b, const CVector &c, const CVector &d)
{
P0= a; P1= b; P2= c; P3= d;
}
void get(CVector &a, CVector &b, CVector &c, CVector &d)
{
a= P0; b= P1; c= P2; d= P3;
}
};
};
} // NL3D
#endif // NL_BEZIER_PATCH_H
/* End of bezier_patch.h */

View file

@ -0,0 +1,180 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_BLOOM_EFFECT_H
#define NL_BLOOM_EFFECT_H
// Misc
#include "nel/misc/singleton.h"
#include "nel/misc/vector_2f.h"
#include "nel/misc/geom_ext.h"
// 3D
#include "nel/3d/u_material.h"
#include "nel/3d/texture.h"
namespace NL3D
{
class UDriver;
class UScene;
//-----------------------------------------------------------------------------------------------------------
//---------------------------------------- CBloomEffect -----------------------------------------------------
//-----------------------------------------------------------------------------------------------------------
// CBloomEffect class apply a bloom effect on the whole scene. The whole scene is rendered in a
// render target (a Frame Buffer Object on OpengL, the normal back buffer in Direct3D) which is stretched
// in a 256*256 another render target.
// We apply a horizontal blur on this 256*256 render target, then a vertical blur on the result of this first pass.
// The final blurred render target is blend with the initial render target of scene, with a dest + src - dest*src
// blend operation.
//-----------------------------------------------------------------------------------------------------------
class CBloomEffect : public NLMISC::CSingleton<CBloomEffect>
{
public:
/// Constructor
CBloomEffect();
// Destructor
~CBloomEffect();
// Called after the Driver initialization to indicate if OpenGL or Direct3D is used.
// They are some differences in bloom algorithm depending on this API choice.
// If bloom effect is activated and supported, private method init() is called to initialize
// textures and materials.
// initBloomEffect = false => directx
// initBloomEffect = true => opengl
void init(bool initBloomEffect);
// must be called before init
void setDriver(UDriver *driver) { _Driver = driver; }
UDriver* getDriver() const { return _Driver; }
// must be called before initBloom
void setScene(UScene *scene) { _Scene = scene; }
UScene* getScene() const { return _Scene; }
// enable or disable square bloom
void setSquareBloom(bool squareBloom) { _SquareBloom = squareBloom; }
bool getSquareBloom() const { return _SquareBloom; }
// set bloom density
void setDensityBloom(uint8 densityBloom) { _DensityBloom = densityBloom; }
uint8 getDensityBloom() const { return _DensityBloom; }
// Called at the beginning of renderAll method in the main loop, if window has been resized,
// reinitialize bloom textures according to new window size.
// The bloom texture (_InitText attribute) which is used as render target during scene render
// is reinitialized with window dimensions.
// If window size exceeds 256*256 the textures used to apply blur are reinitialized with
// 256*256 size. If a dimension is less than 256, the texture is initialized with the nearer
// power of 2, lower than this window dimension.
void initBloom();
// Called at the end of renderAll method in the main loop, recover stretched texture, apply
// both blur passes, and the blending operation between initial render target and the blured one.
void endBloom();
// In OpenGL, the use of FBO implies that Z buffer values of scene render have been stored in
// a depth render target. Then, to display 3D interfaces, we must display them in the same FBO,
// to keep Z tests correct.
// This method is called at the end of interfaces display in the main loop, to display final render target
// (with added interfaces) in the color frame buffer.
// NB : In Direct3D, the final render target is displayed at the end of endBloom call.
void endInterfacesDisplayBloom();
private:
// Initialize textures and materials.
void init();
// Initialize a bloom texture with new dimensions.
void initTexture(NLMISC::CSmartPtr<NL3D::ITexture> & tex, bool isMode2D, uint32 width, uint32 height);
// Called in endBloom method to build a blurred texture. Two passes (then two calls)
// are necessary : horizontal and vertical.
// For the first pass, blur is applied horizontally to stretched texture _BlurFinalTex and recover in
// _BlurHorizontalTex render target texture.
// For the second pass, blur is applied vertically to precedent _BlurHorizontalTex texture and recover
// in _BlurFinalTex render target texture.
// For each pass, thanks to a vertex program, first texture is displayed with several little decals
// in order to obtain in the render target texture a mix of color of a texel and its neighboured texels
// on the axis of the pass.
void doBlur(bool horizontalBlur);
// Called in endBloom method after the both doBlur passes. Apply blend operation between initial render target
// texture _InitText of scene and the blurred texture _BlurFinalTex.
void applyBlur();
// the driver to use
UDriver* _Driver;
// the scene to use
UScene* _Scene;
// use square bloom
bool _SquareBloom;
// density of bloom
uint8 _DensityBloom;
// render target textures
// used to display scene
NLMISC::CSmartPtr<NL3D::ITexture> _InitText;
// used as stretched texture from _InitText, as displayed texture in first blur pass,
// and as render target in second blur pass.
NLMISC::CSmartPtr<NL3D::ITexture> _BlurFinalTex;
// used as render target in first blur pass, and as displayed texture on second blur pass.
NLMISC::CSmartPtr<NL3D::ITexture> _BlurHorizontalTex;
// original render target
NLMISC::CSmartPtr<NL3D::ITexture> _OriginalRenderTarget;
// materials
// used to display first texture in doBlur passes.
NL3D::UMaterial _BlurMat;
// used to display final render target texture in endInterfacesDisplayBloom call (OpenGL).
NL3D::UMaterial _DisplayInitMat;
// used to blend initial scene render target texture and blur texture according to a
// dest+src - dest*src blend operation.
NL3D::UMaterial _DisplayBlurMat;
// used to blend initial scene render target texture and blur texture according to a
// dest+src - dest*src blend operation, with a square stage operation.
NL3D::UMaterial _DisplaySquareBlurMat;
// quads
NLMISC::CQuadUV _BlurQuad;
NLMISC::CQuadUV _DisplayQuad;
// openGL or Direct3D?
bool _InitBloomEffect;
// textures and materials already initialized?
bool _Init;
// current window dimensions
uint32 _WndWidth;
uint32 _WndHeight;
// current blur texture dimensions
uint32 _BlurWidth;
uint32 _BlurHeight;
};
} // NL3D
#endif // NL_BLOOM_EFFECT_H
/* End of bloom_effect.h */

View file

@ -0,0 +1,220 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_BONE_H
#define NL_BONE_H
#include "nel/misc/types_nl.h"
#include "nel/3d/transformable.h"
#include "nel/3d/channel_mixer.h"
#include "nel/misc/smart_ptr.h"
#include "nel/misc/bsphere.h"
namespace NL3D
{
// ***************************************************************************
class IAnimCtrl;
class CSkeletonModel;
// ***************************************************************************
/**
* This is a bone default value. This object is stored in the SkeletonShape, and is serialised.
* For hierarchy of bones, it contains the id of his father.
* \author Lionel Berenguier
* \author Nevrax France
* \date 2001
*/
class CBoneBase : public NLMISC::CRefCount
{
public:
/// Name of this bone, for Animation access.
std::string Name;
/// The Inverse of bindpos for this bone.
CMatrix InvBindPos;
/// The Father of this bone. -1 means no one.
sint32 FatherId;
/// true if unheritScale from father (default==true).
bool UnheritScale;
/// Default tracks.
CTrackDefaultVector DefaultPos;
CTrackDefaultVector DefaultRotEuler;
CTrackDefaultQuat DefaultRotQuat;
CTrackDefaultVector DefaultScale;
CTrackDefaultVector DefaultPivot;
/// The distance at which the bone is disabled in the skeleton. If 0, never disable.
float LodDisableDistance;
/** Additionally to the standard scale, you can multiply the effect on the skin with a special SkinScale
* This scale is applied only on the skin (even son bones positions won't be affected)
* Default to (1,1,1)
*/
CVector SkinScale;
public:
/// ctor, with default pos as NULL (but scale as 1,1,1).
CBoneBase();
/// save/load.
void serial(NLMISC::IStream &f);
};
// ***************************************************************************
/**
* This is a bone, for skeleton animation, with information for result WorldMatrix.
* \author Lionel Berenguier
* \author Nevrax France
* \date 2001
*/
class CBone : public ITransformable
{
public:
/** Constructor. build a bone from a CBoneBase*.
* By default, a bone is in RotQuat transform mode.
* This ctor:
* - store a RefPtr on the bonebase (for getDefaultTracks() method). the refptr is just for nlassert.
* - copy the bonebase default track value into Animated Values Pos/Rot etc....
*/
CBone(CBoneBase *boneBase);
/// retrieve the boneName from BoneBase.
const std::string &getBoneName() const {nlassert(_BoneBase); return _BoneBase->Name;}
/// retrieve the fatherId from BoneBase.
sint32 getFatherId() const {nlassert(_BoneBase); return _BoneBase->FatherId;}
/// retrieve the boneBase
CBoneBase &getBoneBase() const {nlassert(_BoneBase); return *_BoneBase;}
/// \name Herited from ITransformable
// @{
/// retrieve the default track from skeleton shape.
virtual ITrack* getDefaultTrack (uint valueId);
/// register the ITransformable channels as detailled channels.
virtual void registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix);
// @}
/** Compute the LocalSkeletonMatrix, the WorldMatrix, and the BoneSkinMatrix (for skinning).
* NB: the result localSkeletonMatrix depends on BoneBase::UnheritScale. \n
* NB: the result worldMatrix depends on BoneBase::UnheritScale. \n
* NB: the result boneSkinMatrix depends on BoneBase::InvBindPos. \n
* \param parent the parent of this bone (maybe NULL if root). His WorldMatrix is used, so it should be computed before.
* \param rootMatrix is used as father worldmatrix if parent==NULL. Useful for computing WorldMatrix.
* \param skeletonForAnimCtrl if NULL, no AnimCtrl is performed, else skeletonForAnimCtrl->getWorldMAtrix() should be == to rootMatrix
*/
void compute(CBone *parent, const CMatrix &rootMatrix, CSkeletonModel *skeletonForAnimCtrl);
/** Interpolate the current result of _BoneSkinMatrix with otherMatrix.
* when interp==0.f, _BoneSkinMatrix= otherMatrix.
* NB: the interpolation is made on per-vector basis => bad matrix interpolation.
*/
void interpolateBoneSkinMatrix(const CMatrix &otherMatrix, float interp);
/// retrieve the matrix local to the skeleton, computed in compute().
const CMatrix &getLocalSkeletonMatrix() const {return _LocalSkeletonMatrix;}
/// retrieve the WorldMatrix computed in compute().
const CMatrix &getWorldMatrix() const {return _WorldMatrix;}
/// retrieve the BoneSkinMatrix computed in compute().
const CMatrix &getBoneSkinMatrix() const {return _BoneSkinMatrix;}
/// enable the channels (lodEnable) associated to this bone in the channelMixer.
void lodEnableChannels(CChannelMixer *chanMixer, bool enable);
/** Force to eval the animation of that bone
* Useful when a bone position is needed, and if the father skeleton has been clipped (and thus not detail-animated)
* \param chanMixer the channel mixer to which that bone has been registered
*/
inline void forceAnimate(CChannelMixer &chanMixer);
/** Additionally to the standard scale, you can multiply the effect on the skin with a special SkinScale
* This scale is applied only on the skin (even son bones positions won't be affected)
* Default to (1,1,1)
*/
void setSkinScale(CVector &skinScale);
const CVector &getSkinScale() const {return _SkinScale;}
// *************************
public:
// Private to SkeletonModel. You should not set this ptr directly. see CSkeletonModel::setBoneAnimCtrl()
// The extra controller (IK...) on this bone
IAnimCtrl *_AnimCtrl;
// Private to SkeletonModel. This represent the max sphere for all skins around this bone
NLMISC::CBSphere _MaxSphere;
private:
// the boneBase of the skeletonShape which create this bone..
NLMISC::CRefPtr<CBoneBase> _BoneBase;
// The result Matrix, local to the skeleton.
CMatrix _LocalSkeletonMatrix;
// The result WorldMatrix.
CMatrix _WorldMatrix;
// The result Disaplcement _LocalSkeletonMatrix, local to the skeleton.
CMatrix _BoneSkinMatrix;
// The bkuped channelIds for each channel of the bone. -1 if not registered (or no tracks in animationSet).
sint _PosChannelId;
sint _RotEulerChannelId;
sint _RotQuatChannelId;
sint _ScaleChannelId;
sint _PivotChannelId;
// see setSkinScale()
CVector _SkinScale;
};
/////////////
// INLINES //
/////////////
inline void CBone::forceAnimate(CChannelMixer &chanMixer)
{
sint ids[] =
{
_PosChannelId,
_RotEulerChannelId,
_RotQuatChannelId,
_ScaleChannelId,
_PivotChannelId
};
chanMixer.evalChannels(ids, sizeof(ids) / sizeof(ids[0]));
}
} // NL3D
#endif // NL_BONE_H
/* End of bone.h */

View file

@ -0,0 +1,293 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_BSP_TREE_H
#define NL_BSP_TREE_H
#include "nel/misc/debug.h"
#include "nel/misc/vector.h"
#include "nel/misc/plane.h"
#include "nel/misc/matrix.h"
#include "nel/misc/triangle.h"
#include <list>
#include <vector>
namespace NL3D
{
/**
* class: CBSPTree.
*
*
* A template CBSPTree.
*
*/
template<class T> class CBSPTree
{
public:
/// Default constructor, use axes XZ
CBSPTree();
/// dtor.
~CBSPTree();
public:
void insert( NLMISC::CTriangle &tri, T &value );
sint32 select( CVector &v1, CVector &v2 );
T getSelection( sint32 i );
sint32 getNbNode();
private:
class CBSPNode;
std::vector<CBSPNode*> _Selection;
private:
class CBSPNode
{
CBSPNode *pBack, *pFront;
CPlane p;
public:
T Value;
public:
CBSPNode( NLMISC::CTriangle &tri, T &val ) : Value(val), pBack(NULL), pFront(NULL)
{
p.make( tri.V0, tri.V1, tri.V2 );
p.normalize();
}
~CBSPNode()
{
if( pBack != NULL )
delete pBack;
if( pFront != NULL )
delete pFront;
}
void insert( NLMISC::CTriangle &tri, T &val )
{
float f[3];
CBSPNode *pCurrent = this;
while( true )
{
f[0] = pCurrent->p*tri.V0;
f[1] = pCurrent->p*tri.V1,
f[2] = pCurrent->p*tri.V2;
if( fabs( f[0] ) < 0.00001 ) f[0] = 0.0f;
if( fabs( f[1] ) < 0.00001 ) f[1] = 0.0f;
if( fabs( f[2] ) < 0.00001 ) f[2] = 0.0f;
if( ( f[0] >= 0.0f ) && ( f[1] >= 0.0f ) && ( f[2] >= 0.0f ) )
{ // All front
if( pCurrent->pFront == NULL )
{
pCurrent->pFront = new CBSPNode( tri, val );
return;
}
else
{
pCurrent = pCurrent->pFront;
}
}
else
if( ( f[0] <= 0.0f ) && ( f[1] <= 0.0f ) && ( f[2] <= 0.0f ) )
{ // All back
if( pCurrent->pBack == NULL )
{
pCurrent->pBack = new CBSPNode( tri, val );
return;
}
else
{
pCurrent = pCurrent->pBack;
}
}
else
{
if( pCurrent->pFront == NULL )
{
pCurrent->pFront = new CBSPNode( tri, val );
}
else
{
pCurrent->pFront->insert( tri, val );
}
if( pCurrent->pBack == NULL )
{
pCurrent->pBack = new CBSPNode( tri, val );
}
else
{
pCurrent->pBack->insert( tri, val );
}
return;
}
}
}
sint32 getNbNode()
{
sint32 nBack = 0, nFront= 0;
if( pBack != NULL )
nBack = pBack->getNbNode();
if( pFront != NULL )
nFront = pFront->getNbNode();
return 1+nBack+nFront;
}
void select( std::vector<CBSPNode*> &sel, CVector &v1, CVector &v2 )
{
float f[2];
CBSPNode *pCurrent = this;
while( true )
{
f[0] = pCurrent->p*v1;
f[1] = pCurrent->p*v2;
if( fabs( f[0] ) < 0.00001 ) f[0] = 0.0;
if( fabs( f[1] ) < 0.00001 ) f[1] = 0.0;
if( ( f[0] >= 0.0 ) && ( f[1] >= 0.0 ) )
{ // All front
if( pCurrent->pFront == NULL )
{
return;
}
else
{
pCurrent = pCurrent->pFront;
}
}
else
if( ( f[0] <= 0.0 ) && ( f[1] <= 0.0 ) )
{ // All back
if( pCurrent->pBack == NULL )
{
return;
}
else
{
pCurrent = pCurrent->pBack;
}
}
else
{
if( sel.size() == sel.capacity() )
sel.reserve( sel.size() + 64 );
sel.push_back( this );
if( pCurrent->pFront == NULL )
{
}
else
{
//CVector newV1 = v1;
//CVector newV2 = v2;
//pCurrent->p.clipSegmentFront( newV1, newV2 );
//pCurrent->pFront->select( sel, newV1, newV2 );
pCurrent->pFront->select( sel, v1, v2 );
}
if( pCurrent->pBack == NULL )
{
}
else
{
//CVector newV1 = v1;
//CVector newV2 = v2;
//pCurrent->p.clipSegmentBack( newV1, newV2 );
//pCurrent->pBack->select( sel, newV1, newV2 );
pCurrent->pBack->select( sel, v1, v2 );
}
return;
}
}
}
};
private:
CBSPNode *_Root;
};
// ============================================================================================
// ============================================================================================
// Template CBSPTree implementation. Construction/Destruction.
// ============================================================================================
// ============================================================================================
template<class T> CBSPTree<T>::CBSPTree() : _Root(NULL)
{
_Selection.reserve( 64 );
}
template<class T> CBSPTree<T>::~CBSPTree()
{
if( _Root != NULL )
delete _Root;
}
// ============================================================================================
// ============================================================================================
// Template CBSPTree implementation.
// ============================================================================================
// ============================================================================================
template<class T> void CBSPTree<T>::insert( NLMISC::CTriangle &tri, T &val )
{
if( _Root == NULL )
_Root = new CBSPNode( tri, val );
else
_Root->insert( tri, val );
}
template<class T> sint32 CBSPTree<T>::select( CVector &v1, CVector &v2 )
{
_Selection.clear();
if( _Root != NULL )
{
_Root->select( _Selection, v1, v2 );
return _Selection.size();
}
else
return 0;
}
template<class T> T CBSPTree<T>::getSelection( sint32 i )
{
return _Selection[i]->Value;
}
template<class T> sint32 CBSPTree<T>::getNbNode()
{
return _Root->getNbNode();
}
}
#endif // NL_BSP_TREE_H

View file

@ -0,0 +1,263 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_CAMERA_H
#define NL_CAMERA_H
#include "nel/3d/frustum.h"
#include "nel/3d/transform.h"
namespace NL3D
{
// ***************************************************************************
// ClassIds.
const NLMISC::CClassId CameraId=NLMISC::CClassId(0x5752634c, 0x6abe76f5);
// ***************************************************************************
/**
* A camera descriptor
*
* Used to export or build a CCamera.
*/
class CCameraInfo
{
public:
CCameraInfo ();
NLMISC::CVector Pos;
NLMISC::CVector TargetPos;
float Roll;
float Fov;
bool TargetMode;
bool UseFov;
void serial (NLMISC::IStream &s);
};
// ***************************************************************************
/**
* A Camera node, based on a CTransform node.
* The camera looks in his local Y direction (see CScene).
*
* No special traverse*()
* - has default behavior of a transform.
* - can't be clipped (well... :) ).
* - is not lightable
* - is not renderable
* \author Lionel Berenguier
* \author Nevrax France
* \date 2000
*/
class CCamera : public CTransform
{
public:
/// Call at the beginning of the program, to register the model
static void registerBasic();
public:
/// Build a camera
void build (const CCameraInfo &info);
/// Set the frustum of the camera.
void setFrustum(const CFrustum &f) {_Frustum= f;}
/// Get the frustum of the camera.
const CFrustum& getFrustum() const {return _Frustum;}
/// Setup the camera mode as a perspective/ortho camera. NB: znear and zfar must be >0 (if perspective).
void setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective= true);
/// Setup the camera mode as a perspective/ortho camera. NB: znear and zfar must be >0 (if perspective).
void setFrustum(float width, float height, float znear, float zfar, bool perspective= true);
/// Get the camera frustum.
void getFrustum(float &left, float &right, float &bottom, float &top, float &znear, float &zfar) const;
/// Is a ortho camera?
bool isOrtho() const;
/// Is a perspective camera?
bool isPerspective() const;
/** Setup a perspective camera, giving a fov in radians.
* \param fov the horizontal angle of view, in radians. (Pi/2 as example)
* \param aspectRatio the ratio horizontal/vertical (1.33 as example).
* \param znear the front clipping plane distance.
* \param zfar the back clipping plane distance.
*/
void setPerspective(float fov, float aspectRatio, float znear, float zfar);
/** enable FOV animation. (default is false). see setPerspective(). znear and zfar are kept from previous setup.
* NB: as setPerspective(), fov is the full horizontal angle of camera (in radians).
*/
bool enableFovAnimation(bool en, float aspectRatio= 4.0f / 3.0f)
{
_FovAnimationEnabled= en;
if(en)
_FovAnimationAspectRatio= aspectRatio;
return true;
}
/** enable Target/Roll animation. (default is false). TTransform mode is forced to RotQuatMode. Roll is forced to 0.
* The camera builds the rot matrix from the animated target/roll.
*/
bool enableTargetAnimation(bool en)
{
setTransformMode(ITransformable::RotQuat);
_TargetAnimationEnabled= en;
_Roll.Value= 0;
return true;
}
/// \name Get / Set some values
/// Works only if enableTargetAnimation.
void setTargetPos(const CVector &pos)
{
nlassert(_TargetAnimationEnabled);
_Target.Value= pos;
touch(TargetValue, OwnerBit);
}
/// Works only if enableTargetAnimation.
void setTargetPos(float x, float y, float z)
{
setTargetPos(CVector(x,y,z));
}
/// Works only if enableTargetAnimation.
void setRoll(float roll)
{
nlassert(_TargetAnimationEnabled);
_Roll.Value = roll;
touch(RollValue, OwnerBit);
}
/// Works only if enableFovAnimation.
void setFov(float fov)
{
nlassert(_FovAnimationEnabled);
_Fov.Value = fov;
touch(FovValue, OwnerBit);
}
/// Works only if enableTargetAnimation.
void getTargetPos(CVector &pos) const
{
nlassert(_TargetAnimationEnabled);
pos=_Target.Value;
}
/// Works only if enableTargetAnimation.
float getRoll() const
{
nlassert(_TargetAnimationEnabled);
return _Roll.Value;
}
/// Works only if enableFovAnimation.
float getFov() const
{
nlassert(_FovAnimationEnabled);
return _Fov.Value;
}
/// \name Get some track name
// @{
/** Return the name of the fov track.
* NB: as setPerspective(), fov is the full horizontal angle of camera (in radians).
*/
static const char *getFovValueName() {return "fov";}
/// Return the name of the target track. This target is in the parent space of camera.
static const char *getTargetValueName() {return "target";}
/// Return the name of the roll track
static const char *getRollValueName() {return "roll";}
// @}
/// \name From Ianimatable.
// @{
enum TAnimValues
{
OwnerBit= CTransform::AnimValueLast,
FovValue ,
TargetValue,
RollValue, // Roll is the roll angle in radians.
AnimValueLast,
};
/// From IAnimatable
virtual IAnimatedValue* getValue (uint valueId);
/// From IAnimatable
virtual const char *getValueName (uint valueId) const;
/// Default Track Values for are identity (roll= 0, target= CVector::Null, fov=Pi/2).
virtual ITrack* getDefaultTrack (uint valueId);
/// register camera channels (in global anim mode).
virtual void registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix);
// @}
/// \name access default tracks.
// @{
CTrackDefaultVector* getDefaultPos () {return &_DefaultPos;}
CTrackDefaultVector* getDefaultTargetPos () {return &_DefaultTargetPos;}
// @}
/// Build the camera Pyramid from current worldMatrix, and frustum
void buildCameraPyramid(std::vector<NLMISC::CPlane> &pyramid, bool useWorldMatrix);
/// Compute corners of the camera Pyramid from current worldMatrix, and frustum
void buildCameraPyramidCorners(std::vector<NLMISC::CVector> &pyramidCorners, bool useWorldMatrix);
protected:
/// Constructor
CCamera();
/// Destructor
virtual ~CCamera() {}
// NB: znear and zfar are be >0 (if perspective).
CFrustum _Frustum;
/// Implement the update method.
virtual void update();
private:
static CTransform *creator() {return new CCamera;}
private:
bool _FovAnimationEnabled;
bool _TargetAnimationEnabled;
float _FovAnimationAspectRatio;
// AnimValues.
CAnimatedValueFloat _Fov;
CAnimatedValueVector _Target;
CAnimatedValueFloat _Roll;
CTrackDefaultVector _DefaultPos;
CTrackDefaultVector _DefaultTargetPos;
// Default tracks.
static CTrackDefaultFloat DefaultFov; //( NLMISC::Pi/2 );
static CTrackDefaultFloat DefaultRoll; //( 0 );
};
}
#endif // NL_CAMERA_H
/* End of camera.h */

View file

@ -0,0 +1,113 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_CAMERA_COL_H
#define NL_CAMERA_COL_H
#include "nel/misc/types_nl.h"
#include "nel/misc/vector.h"
#include "nel/misc/plane.h"
namespace NL3D {
// ***************************************************************************
/**
* A tool class used to compute differents info for camera collision
* \author Lionel Berenguier
* \author Nevrax France
* \date 2003
*/
class CCameraCol
{
public:
CCameraCol();
/** build the camera collision as a cone or a cylinder
*/
void build(const CVector &start, const CVector &end, float radius, bool cone);
/** build the camera collision as a simple ray
*/
void buildRay(const CVector &start, const CVector &end);
/** compute the intersection of the Camera Volume against the triangle, and minimize
* minDist (actual square of distance) with min sqr distance of the poly.
*/
void minimizeDistanceAgainstTri(const CVector &p0, const CVector &p1, const CVector &p2, float &sqrMinDist);
/** Compute into this the camera collision 'other' mul by 'matrix'
* NB: for cone Radius, suppose uniform scale, else will have strange result (a uniform scale is deduced)
*/
void setApplyMatrix(const CCameraCol &other, const NLMISC::CMatrix &matrix);
/** Get The World Bbox enclosing the camera collision volume
*/
const NLMISC::CAABBox &getBBox() const {return _BBox;}
/** Get the length of the ray built
*/
float getRayLen() const {return _RayLen;}
bool isSimpleRay() const { return _SimpleRay; }
private:
enum {MaxNPlanes=6};
// The start of the camera raycast
CVector _Start;
// The end of the camera raycast
CVector _End;
// The radius (at end only if cone)
float _Radius;
// cone or cylinder?
bool _Cone;
// Simple Ray?
bool _SimpleRay;
// The World Bbox enclosing the camera collision volume
NLMISC::CAABBox _BBox;
// Temp Data for minimizeDistanceAgainstTri
CVector _ArrayIn[3+MaxNPlanes];
CVector _ArrayOut[3+MaxNPlanes];
// The pyramid representing the camera collision volume. Nb: local to start for precision problems
NLMISC::CPlane _Pyramid[MaxNPlanes];
uint _NPlanes;
// For Camera smoothing. => the pyramid is bigger
float _MaxRadius;
// projection of the radius at 1 meter
float _MinRadiusProj;
float _MaxRadiusProj;
float _OODeltaRadiusProj;
float _RayLen;
CVector _RayNorm;
// simpler method for simple ray
void intersectRay(const CVector &p0, const CVector &p1, const CVector &p2, float &sqrMinDist);
};
} // NL3D
#endif // NL_CAMERA_COL_H
/* End of camera_col.h */

View file

@ -0,0 +1,484 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_CHANNEL_MIXER_H
#define NL_CHANNEL_MIXER_H
#include "nel/misc/types_nl.h"
#include "nel/misc/debug.h"
#include "nel/misc/smart_ptr.h"
#include "nel/3d/animation_time.h"
#include "nel/3d/animation_set.h"
#include <map>
#include <vector>
namespace NL3D
{
class CAnimation;
class IAnimatable;
class IAnimatedValue;
class ITrack;
class CAnimationSet;
/**
* A channel mixer. Animated value are registred in it.
* Each animated value create a channel in the mixer. Then, mixer animates
* all those channels with 1 to CChannelMixer::NumAnimationSlot animations.
*
* Animation are referenced in an animation slot (CSlot).
*
* Each slot have an IAnimation pointer, a weight for this animation
* between [0.f ~ 1.f] and a time for this animation.
*
* Each CChannel have a weight on each animation slot between [0.f ~ 1.f].
*
* Blending is normalized internaly so, weight sum have not to be == 1.f.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class CChannelMixer : public NLMISC::CRefCount
{
public:
/// \name Const values
enum
{
/// Number of animation slot in the CChannelMixer
NumAnimationSlot=8
};
private:
/// \name Internal classes
/// An animation slot.
class CSlot
{
friend class CChannelMixer;
/// Default Ctor
CSlot ()
{
// Not modified
_Dirt=false;
// default is 1.
_Weight= 1.f;
// Set it empty
empty ();
}
/// Empty the slot
void empty ()
{
_Animation=NULL;
_SkeletonWeight=NULL;
_InvertedSkeletonWeight=false;
}
/// Is the slot empty ?
bool isEmpty ()
{
return _Animation==NULL;
}
private:
/// Animation pointer to use by this slot. If NULL, slot is empty.
const CAnimation* _Animation;
/// Skeleton weight pointer
const CSkeletonWeight* _SkeletonWeight;
/// Skeleton weight pointer inverted or not
bool _InvertedSkeletonWeight;
/// Time to use to eval the animation.
TAnimationTime _Time;
/**
* Global weight to apply to the animation of this slot.
* This weight can be given in any range because renormalisation is done in final
* weight evaluation. If weight is 0.f, the final mix is not influenced by the animation
* of this slot.
*/
float _Weight;
/// Dirt flag. True if the animation of this slot as been modified
bool _Dirt;
};
/**
* An animated channel of the CChannelMixer. This class is used internaly in the
* CChannelMixer.
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class CChannel
{
friend class CChannelMixer;
public:
enum {EnableUserFlag= 1, EnableLodFlag= 2, EnableAllFlag= 3};
public:
/// Default ctor
CChannel ()
{
// not in the list
_InTheList=false;
// enabled by default.
_EnableFlags= EnableAllFlag;
}
private:
/// True if this channel is in the list
bool _InTheList;
/// the detail mode.
bool _Detail;
/// enabled Flags. User | Lod
uint8 _EnableFlags;
/// Is this Animated Value a CQuat Animated Value???
bool _IsQuat;
/// Name of the channel in the channel mixer. Must be the same than the animated value name.
std::string _ChannelName;
/// A pointer on the IAnimatable object that handles the channel value. (ref ptr to ensure Animated value access)
NLMISC::CRefPtr<IAnimatable> _Object;
/// A pointer on the IAnimatedValue animated by this channel. If NULL, the channel is empty
IAnimatedValue* _Value;
/// The id of the animated value in the IAnimatable object.
uint32 _ValueId;
/// The id of the OwnerBit to touch the IAnimatable object. Useful for IAnimatable derivation.
uint32 _OwnerValueId;
/// The default track pointer used when track are missing in the animation. Can't be NULL.
const ITrack* _DefaultTracks;
/**
* A track pointer on each slot CAnimation. Can't be NULL. If no track found for this
* channel, the pointer is _DefaultTracks.
*/
const ITrack* _Tracks[NumAnimationSlot];
/**
* A weight array for to blend each slot.
* This value must be between 0.f and 1.f. If it is 0.f, the slot is not used. If it is 1.f,
* the slot is used at 100%. This weight can be set using a "skeleton template weight".
* Default value is 1.f.
*/
float _Weights[NumAnimationSlot];
/**
* Pointer on the next channel selected for the animations selected in the slots
*
* This list is used to only visit the channels animated by the animations set in the slots
* of the mixer
*/
CChannel* _Next;
};
public:
/// Constructor. The default constructor resets the slots and the channels.
CChannelMixer();
~CChannelMixer();
/// \name Setup the mixer
/**
* Set the animation set used by this channel mixer.
* The pointer is hold by the channel mixer until it changes.
*/
void setAnimationSet (const CAnimationSet* animationSet);
/**
* Get the animation set used by this channel mixer.
* The pointer is hold by the channel mixer until it changes. Return NULL if no animationSet defined.
*/
const CAnimationSet* getAnimationSet () const;
/**
* Launch evaluation of all channels.
*
* This is the main method. It evals animations selected in the slots for listed
* channels.
*
* Only the channels that are animated by animations selected in the slots are evaluated.
* They are stored in a linked list managed by the channel array.
*
* Others are initialized with the default channel value.
*
* \param detail true if eval the detail part of animation. (done after clipping).
* \param evalDetailDate chann mixer store the last date of anim detail evaluated. if same, do nothing,
* else if < or >, compute the anim. ingored if detail is false.
*/
void eval (bool detail, uint64 evalDetailDate=0);
/**
* Launch evaluation of some channels.
*
* \param channelIdArray array that contains the id of the channel to eval.
* \param numID number of ids in the array
*
*/
void evalChannels(sint *channelIdArray, uint numID);
/**
* Force evaluation of a single channel
*/
inline void evalSingleChannel(sint channelId);
/// \name Channel access
/**
* Add a channel for a specific value of an IAnimatable object.
* Warning: this method will assign the default value in the animated value.
*
* \param channelName is the name of the channel.
* \param animatable is a pointer on the IAnimatable object in which the value is stored. It will be kept
* by the CChannelMixer until it is removed from the channel.
* \param value is a pointer on the value the channel works with. It will be kept
* by the CChannelMixer until it is removed from the channel.
* \param defaultValue is a track used by default if a track is not presents in the animation for this channel.
* It will be kept by the CChannelMixer until it is removed from the channel.
* \param valueId is the value ID in the IAnimatable object.
* \param ownerId is the owner Bit of the animated vlaue, in the IAnimatable object. touched when the animatedvalue is touched.
* \param detail true if this channel must be evaluated in detail mode (see eval()).
* \return -1 if the track was not found in the animationSet, else it return the channelId
* as if returned by CAnimationSet::getChannelIdByName(channelName).
*/
sint addChannel (const std::string& channelName, IAnimatable* animatable, IAnimatedValue* value, ITrack* defaultValue, uint32 valueId, uint32 ownerValueId, bool detail);
/// Reset the channel list if the mixer. All channels are removed from the mixer.
void resetChannels ();
/** disabling a channel means it is no more modified during animation. Default is enabled.
* NB: this channel must have been added (via addChannel()....).
* \param channelId channelId get from CAnimationSet::getChannelIdByName() or addChannel()
*/
void enableChannel (uint channelId, bool enable);
/** see enableChannel(). return false if channel does not exist...
* \param channelId channelId get from CAnimationSet::getChannelIdByName() or addChannel()
*/
bool isChannelEnabled (uint channelId) const;
/** Same as enableChannel but for Animation Lod system. The channel is animated only if both
* enableChannel() and lodEnableChannel() are true. Default is enabled.
* NB: this channel must have been added (via addChannel()....).
* \param channelId channelId get from CAnimationSet::getChannelIdByName() or addChannel()
*/
void lodEnableChannel (uint channelId, bool enable);
/** see enableChannel(). return false if channel does not exist...
* \param channelId channelId get from CAnimationSet::getChannelIdByName() or addChannel()
*/
bool isChannelLodEnabled (uint channelId) const;
/// \name Slots acces
/**
* Set slot animation.
*
* You must set an animationSet in the channel mixer before calling this.
*
* Calling this method will dirt the mixer, ie, all the mixer's channels will
* be visited to check if they are used by the new animation. If they are, they
* will be linked in the internal CChannel list.
*
* \param slot is the slot number to change the animation. Must be >= 0 and < NumAnimationSlot.
* \param animation is the new animation index in the animationSet use by this slot.
* \see CAnimationSet, CAnimation
*/
void setSlotAnimation (uint slot, uint animation);
/// Get the animation used by a given slot
const CAnimation *getSlotAnimation(uint slot) const;
/**
* Set time of a slot.
*
* This time will be used to eval the animation set in this slot.
* Each slot can have different time.
*
* Calling this method won't dirt the mixer.
*
* \param slot is the slot number to change the time. Must be >= 0 and < NumAnimationSlot.
* \param time is the new time to use in the slot.
* \see TAnimationTime
*/
void setSlotTime (uint slot, TAnimationTime time)
{
// Check alot arg
nlassert (slot<NumAnimationSlot);
// Set the time
_SlotArray[slot]._Time=time;
}
/**
* Set slot weight.
*
* This weight will be used to eval the animation set in this slot.
* Each slot can have different weight. Calling this method won't dirt the mixer.
*
* By default the weight of the slot is 1.0f.
*
* \param slot is the slot number to change the weight.
* \param weight is the new weight to use in the slot. No range for this weight. If the weight == 0.f,
* the slot have no effect on the final mix.
*/
void setSlotWeight (uint slot, float weight)
{
// Check alot arg
nlassert (slot<NumAnimationSlot);
// Set the time
_SlotArray[slot]._Weight=weight;
}
/**
* Empty a slot.
*
* Calling this method will dirt the mixer, ie, all the mixer's channels will
* be visited to check if they are used by the old animation. If they are, they
* will be linked in the internal CChannel list.
*
* Warning: this method will assign the default value in the animated value that are removed from the active channel queue.
*
* \param slot is the slot number to empty. Must be >= 0 and < NumAnimationSlot.
*/
void emptySlot (uint slot);
/**
* Reset the slot of the mixer. All slot will be empty.
*
* Calling this method will dirt the mixer, ie, all the mixer's channels will
* be visited to check if they are used by the old animation. If they are, they
* will be linked in the internal CChannel list.
*
*/
void resetSlots ();
/**
* Apply a skeleton template weight on a specific slot.
*
* This method apply the weight of each node contains in skelWeight to the channel's slot weight.
*
* \param slot is the slot number to empty. Must be >= 0 and < NumAnimationSlot.
* \param skeleton is the index of a skeleton in the animationSet.
* \param invert is true if the weights to attach to the channels are the weights of the skeleton template.
* false if the weights to attach to the channels are the 1.f-weights of the skeleton template.
*/
void applySkeletonWeight (uint slot, uint skeleton, bool invert=false);
/**
* Reset the skeleton weight for a specific slot.
*
* This method apply set each channel's slot weight to 1.f.
*
* \param slot is the slot number to empty. Must be >= 0 and < NumAnimationSlot.
*/
void resetSkeletonWeight (uint slot);
/// reset to -1 the evalDetailDate. Hence next eval(true,..) will be forced to compute
void resetEvalDetailDate();
private:
/// /name Internal methods
/// Clean the mixer
void cleanAll ();
/// Dirt all slots
void dirtAll ();
/// Refresh channel list
void refreshList ();
// The slot array
CSlot _SlotArray[NumAnimationSlot];
// The animation set
const CAnimationSet* _AnimationSet;
// The set of CChannel infos. Only channels added by addChannel are present.
std::map<uint, CChannel> _Channels;
// The first Global channel. If NULL, no channel to animate. (animed in eval(false))
CChannel* _FirstChannelGlobal;
// The first detail channel. If NULL, no channel to animate. (animed in eval(true))
CChannel* _FirstChannelDetail;
// last date of evalDetail().
sint64 _LastEvalDetailDate;
// The channels list is dirty if true.
bool _Dirt;
// true if must update animateList. (set in refreshList())
bool _ListToEvalDirt;
// Raw lists of channels to animate, acording to _EnableFlags
std::vector<CChannel*> _GlobalListToEval;
std::vector<CChannel*> _DetailListToEval;
/// Refresh animate list
void refreshListToEval ();
/**
* Force evaluation of a single channel
*
* \param chan the channel to eval
* \param numActiveSlots number of active slots
* \param activeSlot array of contiguous slots ids (there are 'numActiveSlots' of them)
*/
void evalSingleChannel (CChannel &chan, uint numActiveSlots, uint activeSlot[NumAnimationSlot]);
};
/////////////
// INLINES //
/////////////
inline void CChannelMixer::evalSingleChannel(sint channelId)
{
evalChannels(&channelId, 1);
}
} // NL3D
#endif // NL_CHANNEL_MIXER_H
/* End of channel_mixer.h */

View file

@ -0,0 +1,190 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_CLIP_TRAV_H
#define NL_CLIP_TRAV_H
#include "nel/3d/trav_scene.h"
#include "nel/3d/quad_grid.h"
#include "nel/3d/transform.h"
#include "nel/misc/vector.h"
#include "nel/misc/plane.h"
#include "nel/misc/matrix.h"
namespace NL3D
{
using NLMISC::CVector;
using NLMISC::CPlane;
using NLMISC::CMatrix;
class CRenderTrav;
class CAnimDetailTrav;
class CLoadBalancingTrav;
class CHrcTrav;
class CLightTrav;
class CCluster;
class CInstanceGroup;
class CCamera;
class CQuadGridClipManager;
class CTransform;
class CSkeletonModel;
// ***************************************************************************
// This is the order of clip planes.
#define NL3D_CLIP_PLANE_NEAR 0
#define NL3D_CLIP_PLANE_FAR 1
#define NL3D_CLIP_PLANE_LEFT 2
#define NL3D_CLIP_PLANE_TOP 3
#define NL3D_CLIP_PLANE_RIGHT 4
#define NL3D_CLIP_PLANE_BOTTOM 5
// ***************************************************************************
/**
* The clip traversal.
* The purpose of this traversal is to insert in the post-clip Traversal the models which are
* said to be not clipped.
*
* Models should use the CTransform->clip() method to implement their models, or completly redefine the traverseClip() method.
*
* \b USER \b RULES: Before using traverse() on a clip traversal, you should:
* - setFrustum() the camera shape (focale....)
* - setCamMatrix() for the camera transform
*
* NB: see CScene for 3d conventions (orthonormal basis...)
* \author Lionel Berenguier
* \author Nevrax France
* \date 2000
*/
class CClipTrav : public CTravCameraScene
{
public:
/// Constructor
CClipTrav();
~CClipTrav();
/// traverse
void traverse ();
void registerCluster (CCluster* pCluster);
void unregisterCluster (CCluster* pCluster);
/// Setup the render traversal (else traverse() won't work)
void setQuadGridClipManager(CQuadGridClipManager *mgr);
const CQuadGridClipManager *getQuadGridClipManager() const {return _QuadGridClipManager;}
/// \name Visible List mgt. Those visible models are updated each traverse().
//@{
// NB: list is cleared at beginning of traverse().
void addVisibleModel(CTransform *model)
{
model->_IndexInVisibleList= _CurrentNumVisibleModels;
_VisibleList[_CurrentNumVisibleModels]= model;
_CurrentNumVisibleModels++;
}
// for createModel().
void reserveVisibleList(uint numModels);
//@}
/// \name Cluster system related methods.
//@{
/** Retrieve a list of clusters for which the position is inside. At least return the RootCluster one
*/
bool fullSearch (std::vector<CCluster*>& result, const CVector& pos);
/// Set cluster tracking on/off (ie storage of the visible cluster during clip traversal)
void setClusterVisibilityTracking(bool track);
/// Check the activation of cluster visibility tracking.
bool getClusterVisibilityTracking();
/// Add a visible cluster to the list
void addVisibleCluster(CCluster *cluster);
/** Return the list of cluster visible after the clip traversal
* You must activate the cluster tracking to obtain a result.
*/
const std::vector<CCluster*> &getVisibleClusters();
bool _TrackClusterVisibility;
std::vector<CCluster*> _VisibleClusters;
//@}
public:
/** \name FOR MODEL TRAVERSAL ONLY. (Read only)
* Those variables are valid only in traverse*().
*/
//@{
/// Vision Pyramid (6 normalized planes) in the view basis.
std::vector<CPlane> ViewPyramid;
/// Vision Pyramid (6 normalized planes) in the world basis. NB: NOT modified by the ClusterSystem.
std::vector<CPlane> WorldFrustumPyramid;
/// Vision Pyramid in the world basis. NB: may be modified by the ClusterSystem.
std::vector<CPlane> WorldPyramid;
//@}
sint64 CurrentDate;
CCluster *RootCluster;
CCamera *Camera;
CQuadGrid<CCluster*> Accel;
/** for CQuadGridClipClusterClip only. This flag means models traversed do not need to clip,
* they are sure to be visible.
*/
bool ForceNoFrustumClip;
// **********************
private:
friend class CTransform;
std::vector<CTransform*> _VisibleList;
uint32 _CurrentNumVisibleModels;
CQuadGridClipManager *_QuadGridClipManager;
// For skeleton CLod Load balancing
struct CSkeletonKey
{
uint Priority;
CSkeletonModel *SkeletonModel;
bool operator<(const CSkeletonKey &k) const
{
return Priority<k.Priority;
}
};
std::vector<CSkeletonKey> _TmpSortSkeletons;
void loadBalanceSkeletonCLod();
// clip the shadow casters to know if they still need some process
void clipShadowCasters();
};
}
#endif // NL_CLIP_TRAV_H
/* End of clip_trav.h */

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