diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..3fd6967c7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +; Top-most EditorConfig file +root = true + +; 4-column tab indentation +[*.cpp] +indent_style = tab +indent_size = 4 + +[*.c] +indent_style = tab +indent_size = 4 + +[*.h] +indent_style = tab +indent_size = 4 + +[*.py] +indent_style = tab +indent_size = 4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..6d75a91f5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,265 @@ +syntax: glob + +# Various build directories +bin +obj +Debug +Release +ReleaseDebug +DebugFast +ReleaseDebugStatic +DebugFastStatic + +# Test and application directories +screenshots +release +test +Temp + +# NeL cache +*.packed_sheets + +# Ryzom save +save_shard +last_loaded_char.bin +*.binprim +*.string_cache +graphs_output +default_c + +# Windows compile +*.exe +*.dll +*.lib +*.obj + +# Linux compile +*.a +*.la +*.lo +*.Po +*.Plo +*.o +*.so +*.so.* +*_debug +*.pc +*.gch + +# Mac OS X compile +*.dylib + +# Log dump files +report_refused +report_failed +exception_catched +*.stat +*.log +log.txt + +# Max plugin extensions +*.dlx +*.dlm +*.dlu + +# makeall build +.mode_static + +# cmake build files & directories +CMakeFiles +CMakeCache.txt +cmake_install.cmake +CTestTestfile.cmake +CPackConfig.cmake +CPackSourceConfig.cmake +.libs + +# Linux garbage +Makefile* +aclocal.m4 +config.guess +config.sub +configure +depcomp +config.h.in +nelconfig.h.in +install-sh +ltmain.sh +missing +ylwrap +*.mk + +# Visual Studio garbage +*.opensdf +UpgradeLog*.XML +_UpgradeReport_Files +BuildLog.htm +mt.dep +ipch +*.suo +*.ncb +*.user +*.ilk +*.pdb +*.aps +*.exp +*.idb +*.sdf + +# Mac OS X garbage +.DS_Store + +# Ryzom server garbage +aes_alias_name.cfg +aes_nagios_report.txt +aes_state.txt +*.launch_ctrl +*.state +*.start_count + +# Vim and kwrite cache +*~ + +# Kdevelop4 garbage +*.kdev4 +.kdev4 + +# intellij project folder +.idea/ + +# Python cache +*.pyd +*.pyc + +# Qt compiler +moc_*.cpp +*.moc + +# Misc garbage +*.rej +*.orig +*.cachefile +*.cache +*.patch +*.7z +3rdParty +.svn +thumbs.db +Thumbs.db +*.tpl.php +.SyncID +.SyncIgnore +.SyncArchive + +# build +code/nel/build/* +code/nelns/build/* +code/snowballs/build/* +code/ryzom/build/* +code/build/* +code/build-2010/* +build/* +install/* +build_vc* +code/nel/tools/build_gamedata/configuration/buildsite.py + +# Linux nel compile +code/nel/build/nel-config +code/nel/config.status +code/nel/include/nelconfig.h +code/nel/include/stamp-h1 +code/nel/libtool +code/nel/nel-config +code/nel/samples/3d/cluster_viewer/cluster_viewer +code/nel/samples/3d/font/font +code/nel/samples/georges/georges +code/nel/samples/misc/command/command +code/nel/samples/misc/configfile/configfile +code/nel/samples/misc/debug/debug +code/nel/samples/misc/i18n/i18n +code/nel/samples/misc/log/log +code/nel/samples/misc/strings/strings +code/nel/samples/net/chat/chatclient +code/nel/samples/net/chat/chatserver +code/nel/samples/net/login_system/nls_frontend_service +code/nel/samples/net/login_system/nls_login_client +code/nel/samples/net/udp/udp_bench_client +code/nel/samples/net/udp/udp_bench_service +code/nel/samples/pacs/pacs_sample +code/nel/tools/3d/build_coarse_mesh/build_coarse_mesh +code/nel/tools/3d/build_far_bank/build_far_bank +code/nel/tools/3d/build_smallbank/build_smallbank +code/nel/tools/3d/ig_lighter/ig_lighter +code/nel/tools/3d/zone_dependencies/zone_dependencies +code/nel/tools/3d/zone_ig_lighter/zone_ig_lighter +code/nel/tools/3d/zone_lighter/zone_lighter +code/nel/tools/3d/zone_welder/zone_welder +code/nel/tools/misc/bnp_make/bnp_make +code/nel/tools/misc/disp_sheet_id/disp_sheet_id +code/nel/tools/misc/make_sheet_id/make_sheet_id +code/nel/tools/misc/xml_packer/xml_packer +code/nel/tools/pacs/build_ig_boxes/build_ig_boxes +code/nel/tools/pacs/build_indoor_rbank/build_indoor_rbank +code/nel/tools/pacs/build_rbank/build_rbank +code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/skills.skill_tree +code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/xptable.xp_table +code/ryzom/tools/server/sql/ryzom_admin_default_data.sql + + +# Linux server compile +code/ryzom/server/src/entities_game_service/entities_game_service +code/ryzom/server/src/frontend_service/frontend_service +code/ryzom/server/src/gpm_service/gpm_service +code/ryzom/server/src/input_output_service/input_output_service +code/ryzom/server/src/mirror_service/mirror_service +code/ryzom/server/src/ryzom_admin_service/ryzom_admin_service +code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service +code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service +code/ryzom/server/src/tick_service/tick_service +# WebTT temp dir +code/ryzom/tools/server/www/webtt/app/tmp + +# AMS ignore +code/web/public_php/ams/is_installed +code/web/docs/ams/html +code/web/public_php/ams/templates_c +code/ryzom/tools/server/ryzom_ams/drupal +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php +code/ryzom/tools/server/ryzom_ams/old + + + +#tools and external dir's +external +external_stlport +nel_tools* +ryzom_tools* + +#Dumps +*.dmp + +code/nel/tools/build_gamedata/processes/ai_wmap/ai_build_wmap.cfg +code/nel/tools/build_gamedata/processes/sheets/sheets_packer.cfg +code/nel/tools/build_gamedata/processes/rbank/build_rbank.cfg +code/nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg +code/web/public_php/config.php +code/web/public_php/is_installed +code/web/public_php/ams/files +code/web/public_php/db_version_lib +code/web/public_php/db_version_shard +code/web/public_php/db_version_tool +code/web/public_php/db_version_web +code/web/public_php/role_service +code/web/public_php/role_support +code/web/public_php/role_domain +code/web/public_php/db_version_ring +code/web/public_php/config_user.php +code/nel/tools/build_gamedata/processes/pz/build_world_packed_col.cfg +code/nel/tools/build_gamedata/processes/cartographer/island_screenshots.cfg diff --git a/.hgignore b/.hgignore index 7892f93af..41a0e58cf 100644 --- a/.hgignore +++ b/.hgignore @@ -124,6 +124,9 @@ aes_state.txt *.kdev4 .kdev4 +# intellij project folder +.idea/ + # Python cache *.pyd *.pyc @@ -139,8 +142,6 @@ moc_*.cpp *.cache *.patch *.7z -external -external_stlport 3rdParty .svn thumbs.db diff --git a/.hgtags b/.hgtags index 315e68df2..f13a14cd9 100644 --- a/.hgtags +++ b/.hgtags @@ -7,3 +7,4 @@ edaa3624a56420b02ccc64c26059801a389927ee ryzomcore/v0.11.0 e3fe4855f22c3e75722e015dc33c091c340b3ad7 ryzomcore/v0.11.1 9e583b717fd63be0be9fd60b99087abf1691ea49 ryzomcore/v0.11.2 bfe5628e14a024ba7ea32e4b326ae433a07856b9 ryzomcore/v0.11.3 +9a6120735daa97c96ac5d85ca35c7f21f607bd87 ryzomcore/v0.12.0 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..c3835f23b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,53 @@ +sudo: false +language: cpp + +compiler: + - gcc + +os: + - linux +matrix: + fast_finish: true +env: + - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS:BOOL=off -DWITH_LUA51:BOOL=on -DWITH_LUA52:BOOL=off -DWITH_LUA53:BOOL=off" + - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS:BOOL=off -DWITH_LUA51:BOOL=off -DWITH_LUA52:BOOL=on -DWITH_LUA53:BOOL=off" + - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS:BOOL=off -DWITH_LUA51:BOOL=off -DWITH_LUA52:BOOL=off -DWITH_LUA53:BOOL=on" + - CMAKE_CONFIGURE_OPTIONS="-DCPPTEST_LIBRARY_DEBUG:STRING=/usr/lib/libcpptest.so" + CMAKE_BUILD_OPTIONS="--target nel_unit_test -- -j 2" + RUN="build/bin/nel_unit_test" + +addons: + apt: + packages: + - liblua5.1-0-dev + - liblua5.1-0-dbg + - liblua5.2-0-dev + - liblua5.2-0-dbg + - libluabind-dev + - libcpptest-dev + - libogg-dev + - libvorbis-dev + - libopenal-dev + - libgif-dev + - libfreetype6-dev + - libxml2-dev + +before_script: + - mkdir build + - cmake --version + - cmake -Hcode -Bbuild $CMAKE_CONFIGURE_OPTIONS + - cat build/CMakeCache.txt + +script: + - cmake --build build $CMAKE_BUILD_OPTIONS + - $RUN + +notifications: + irc: + channels: + - $NOTIFICATION_IRC_CHANNEL + template: + - "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}" + - "Description : %{commit_message}" + - "Change view : %{compare_url}" + - "Build details : %{build_url}" diff --git a/README.md b/README.md index 19e5bef3a..c60d1bc0b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ +# Ryzom Core [![Build Status](https://travis-ci.org/ryzom/ryzomcore.svg)](https://travis-ci.org/ryzom/ryzomcore) + Ryzom Core is the open-source project related to Ryzom Game. Written in C++, Ryzom Core contains the whole code (client, server, tools) used to make the commercial MMORPG Ryzom. Ryzom Core is a toolkit for the development of massively multiplayer online universes. It provides the base technologies and a set of development methodologies for the development of both client and server code. - -Ryzom Core is open source and released under the terms of the GNU Affero General Public License 3.0 (GNU/AGPLv3) for the source code and the Creative Commons Attributions-ShareAlike 3.0 (CC-BY-SA) for the art assets. Which means you can create your own game using Ryzom Core, for more information on doing so check out Creating Your Own Game Using Ryzom Core. \ No newline at end of file + +Ryzom Core is open source and released under the terms of the GNU Affero General Public License 3.0 (GNU/AGPLv3) for the source code and the Creative Commons Attributions-ShareAlike 3.0 (CC-BY-SA) for the art assets. Which means you can create your own game using Ryzom Core, for more information on doing so check out Creating Your Own Game Using Ryzom Core. diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 9d607579c..c14632a0a 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -2,7 +2,7 @@ # # Ryzom Core # Authors: Nevrax and the Ryzom Core Community -# Version: 0.11.3 +# Version: 0.12.0 # # Notes: # * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path @@ -31,11 +31,16 @@ IF(COMMAND cmake_policy) # Works around warnings about escaped quotes in ADD_DEFINITIONS # statements cmake_policy(SET CMP0005 OLD) + + # allow to link to qtmain automatically under Windows + IF(POLICY CMP0020) + CMAKE_POLICY(SET CMP0020 NEW) + ENDIF() ENDIF(COMMAND cmake_policy) -INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/nel.cmake) -INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/ConfigureChecks.cmake) -INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/CheckDepends.cmake) +INCLUDE(nel) +INCLUDE(ConfigureChecks) +INCLUDE(CheckDepends) INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) # Force out of source builds. @@ -44,12 +49,19 @@ CHECK_OUT_OF_SOURCE() # To be able to specify a different deployment target on Mac OS X : # export MACOSX_DEPLOYMENT_TARGET=10.6 +IF(CMAKE_VERSION VERSION_GREATER "2.8.10") + STRING(TIMESTAMP CURRENT_YEAR "%Y") +ELSE() + SET(CURRENT_YEAR "2016") +ENDIF() + CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(RyzomCore CXX C) SET(NL_VERSION_MAJOR 0) -SET(NL_VERSION_MINOR 11) -SET(NL_VERSION_PATCH 3) -SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}") +SET(NL_VERSION_MINOR 12) +SET(NL_VERSION_PATCH 0) +SET(YEAR "2004-${CURRENT_YEAR}") +SET(AUTHOR "Winchgate and The Ryzom Core Community") #----------------------------------------------------------------------------- # Redirect output files @@ -67,10 +79,6 @@ IF(WIN32) IF(WITH_MFC) FIND_PACKAGE(MFC QUIET) ENDIF(WITH_MFC) - - IF(NOT DEFINED ENV{QTDIR}) - SET(ENV{QTDIR} "c:/qt/4.6.3") - ENDIF(NOT DEFINED ENV{QTDIR}) ENDIF(WIN32) #----------------------------------------------------------------------------- @@ -94,7 +102,6 @@ NL_SETUP_BUILD_FLAGS() #Platform specifics SETUP_EXTERNAL() -NL_GEN_REVISION_H() IF(WIN32) SET(WINSOCK2_LIB ws2_32.lib) @@ -104,8 +111,11 @@ IF(WIN32) ENDIF(WITH_MFC) ENDIF(WIN32) +FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(LibXml2 REQUIRED) FIND_PACKAGE(PNG REQUIRED) +FIND_PACKAGE(OpenSSL REQUIRED) +FIND_PACKAGE(GIF) FIND_PACKAGE(Jpeg) IF(WITH_STATIC_LIBXML2) @@ -120,13 +130,17 @@ ENDIF(WITH_LIBXML2_ICONV) IF(WITH_STATIC) # libxml2 could need winsock2 library - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB}) - - # on Mac OS X libxml2 requires iconv and liblzma - IF(APPLE) - FIND_PACKAGE(LibLZMA REQUIRED) - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES}) - ENDIF(APPLE) + IF(WINSOCK2_LIB) + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB}) + ENDIF() + + IF(UNIX) + # under Linux and OS X, recent libxml2 versions are linked against liblzma + FIND_PACKAGE(LibLZMA) + IF(LIBLZMA_LIBRARIES) + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES}) + ENDIF() + ENDIF() ENDIF(WITH_STATIC) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake) @@ -142,48 +156,284 @@ IF(WITH_SSE2) ENDIF(WITH_SSE3) ENDIF(WITH_SSE2) +IF(APPLE_CERTIFICATE) + # Find codesign_allocate + + # Xcode 7.0 and later versions + SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate) + + IF(NOT EXISTS "${CODESIGN_ALLOCATE}") + # Xcode 6.4 and previous versions + SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate) + ENDIF() + + IF(NOT EXISTS "${CODESIGN_ALLOCATE}") + # System path + SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate) + ENDIF() + + IF(NOT EXISTS "${CODESIGN_ALLOCATE}") + MESSAGE(WARNING "Unable to find codesign_allocate in standard directories") + SET(CODESIGN_ALLOCATE) + ENDIF() +ENDIF() + +MACRO(ADD_QT_LIBRARY _NAME) + IF(WIN32) + SET(_PREFIX "Qt5") + SET(_EXT "lib") + ELSE() + SET(_PREFIX "libQt5") + SET(_EXT "a") + ENDIF() + SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}.${_EXT}") + IF(EXISTS ${_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB}) + ENDIF() + SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}") + IF(EXISTS ${_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB}) + ENDIF() +ENDMACRO() + +MACRO(ADD_QT_PLUGIN _TYPE _NAME) + IF(WIN32) + SET(_PREFIX "") + SET(_EXT "lib") + ELSE() + SET(_PREFIX "lib") + SET(_EXT "a") + ENDIF() + SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}.${_EXT}") + IF(EXISTS ${_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB}) + ENDIF() + SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}") + IF(EXISTS ${_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB}) + ENDIF() +ENDMACRO() + +IF(WITH_QT5) + CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR) + + SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR}) + + FIND_PACKAGE(Qt5Core QUIET) + + IF(Qt5Core_FOUND) + # Check if we are using Qt static or shared libraries + GET_TARGET_PROPERTY(_FILE Qt5::Core IMPORTED_LOCATION_RELEASE) + + SET(QT_VERSION "${Qt5Core_VERSION_STRING}") + SET(_VERSION "${QT_VERSION}") + + IF(_FILE MATCHES "\\.(lib|a)$") + SET(QT_STATIC ON) + SET(_VERSION "${_VERSION} static version") + ELSE() + SET(QT_STATIC OFF) + SET(_VERSION "${_VERSION} shared version") + ENDIF() + + MESSAGE(STATUS "Found Qt ${_VERSION}") + + # These variables are not defined with Qt5 CMake modules + SET(QT_BINARY_DIR "${_qt5Core_install_prefix}/bin") + SET(QT_LIBRARY_DIR "${_qt5Core_install_prefix}/lib") + SET(QT_PLUGINS_DIR "${_qt5Core_install_prefix}/plugins") + SET(QT_TRANSLATIONS_DIR "${_qt5Core_install_prefix}/translations") + + # Fix wrong include directories with Qt 5 under Mac OS X + INCLUDE_DIRECTORIES("${_qt5Core_install_prefix}/include") + + FIND_PACKAGE(Qt5Gui) + FIND_PACKAGE(Qt5Widgets) + FIND_PACKAGE(Qt5OpenGL) + FIND_PACKAGE(Qt5Xml) + FIND_PACKAGE(Qt5LinguistTools) + FIND_PACKAGE(Qt5Network) + + IF(QT_STATIC) + ADD_DEFINITIONS(-DQT_STATICPLUGIN) + + SET(QT_LIBRARIES Qt5::Widgets) + + # Gui + SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Gui Qt5::OpenGL) + + ADD_QT_LIBRARY(PrintSupport) + + IF(WIN32) + SET(QT_LIBRARIES ${QT_LIBRARIES} + ${WINSDK_LIBRARY_DIR}/Imm32.lib + ${WINSDK_LIBRARY_DIR}/OpenGL32.lib + ${WINSDK_LIBRARY_DIR}/WinMM.Lib) + ADD_QT_PLUGIN(platforms qwindows) + ADD_QT_LIBRARY(PlatformSupport) + ELSEIF(APPLE) + # Cups needs .dylib + SET(OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib) + FIND_LIBRARY(CUPS_LIBRARY cups) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES}) + + FIND_LIBRARY(IOKIT_FRAMEWORK IOKit) + FIND_LIBRARY(COCOA_FRAMEWORK Cocoa) + FIND_LIBRARY(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration) + FIND_LIBRARY(OPENGL_FRAMEWORK NAMES OpenGL) + + SET(QT_LIBRARIES ${QT_LIBRARIES} + ${CUPS_LIBRARY} + ${COCOA_FRAMEWORK} + ${SYSTEMCONFIGURATION_FRAMEWORK} + ${IOKIT_FRAMEWORK} + ${OPENGL_FRAMEWORK}) + + ADD_QT_PLUGIN(printsupport cocoaprintersupport) + ADD_QT_PLUGIN(platforms qcocoa) + ADD_QT_LIBRARY(PlatformSupport) + ELSE() + # order is very important there + ADD_QT_PLUGIN(platforms qxcb) + ADD_QT_PLUGIN(xcbglintegrations qxcb-glx-integration) + + ADD_QT_LIBRARY(XcbQpa) + ADD_QT_LIBRARY(PlatformSupport) + SET(QT_LIBRARIES ${QT_LIBRARIES} -lX11-xcb -lXi -lSM -lICE -lxcb -lGL) + IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a") + SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_LIBRARY_DIR}/libxcb-static.a") + ENDIF() + SET(QT_LIBRARIES ${QT_LIBRARIES} -lfontconfig) + ADD_QT_LIBRARY(DBus) + ENDIF() + + ADD_QT_PLUGIN(imageformats qgif) + ADD_QT_PLUGIN(imageformats qicns) + ADD_QT_PLUGIN(imageformats qico) + ADD_QT_PLUGIN(imageformats qjpeg) + + # harfbuzz is needed since Qt 5.3 + IF(UNIX) + SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzzng.a") + ELSEIF(WIN32) + SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib") + ENDIF() + IF(EXISTS ${HB_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${HB_LIB}) + ENDIF() + + # freetype is needed since Qt 5.5 + IF(UNIX) + SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a") + ELSEIF(WIN32) + SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib") + ENDIF() + IF(EXISTS ${FREETYPE_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB}) + ENDIF() + + ADD_QT_PLUGIN(accessible qtaccessiblewidgets) + + SET(QT_LIBRARIES ${QT_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARY}) + + # Network + SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Network Qt5::Xml) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES}) + + IF(WIN32) + SET(QT_LIBRARIES ${QT_LIBRARIES} + ${WINSDK_LIBRARY_DIR}/Crypt32.lib + ${WINSDK_LIBRARY_DIR}/WS2_32.Lib) + ENDIF() + + # Core + SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Core) + + # pcre is needed since Qt 5.5 + IF(UNIX) + SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a") + ELSEIF(WIN32) + SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib") + ENDIF() + IF(EXISTS ${PCRE_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${PCRE_LIB}) + ENDIF() + + IF(APPLE) + FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre) + + FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation) + FIND_LIBRARY(CARBON_FRAMEWORK Carbon) + FIND_LIBRARY(SECURITY_FRAMEWORK Security) + + SET(QT_LIBRARIES ${QT_LIBRARIES} + ${PCRE_LIBRARY} + ${FOUNDATION_FRAMEWORK} + ${CARBON_FRAMEWORK} + ${SECURITY_FRAMEWORK}) + ELSEIF(UNIX) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} -ldl -lrt) + ENDIF() + ELSE() + SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core) + ENDIF() + ELSE() + MESSAGE(WARNING "Unable to find Qt 5") + ENDIF() +ENDIF() + IF(WITH_QT) + SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR}) + + # Use Qt 4 FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED) ENDIF(WITH_QT) +IF(WITH_ASSIMP) + FIND_PACKAGE(assimp REQUIRED) +ENDIF(WITH_ASSIMP) + IF(WITH_NEL) IF(WITH_NEL_TESTS) FIND_PACKAGE(CppTest) ENDIF(WITH_NEL_TESTS) IF(WITH_GUI) - FIND_PACKAGE(Libwww REQUIRED) FIND_PACKAGE(Luabind REQUIRED) FIND_PACKAGE(CURL REQUIRED) IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) SET(CURL_STATIC ON) - ELSE((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) + ELSE() SET(CURL_STATIC OFF) - ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) + ENDIF() IF(CURL_STATIC) SET(CURL_DEFINITIONS -DCURL_STATICLIB) - FIND_PACKAGE(OpenSSL QUIET) - - IF(OPENSSL_FOUND) - SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) - ENDIF(OPENSSL_FOUND) + SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) - # CURL Macports version depends on libidn, libintl and libiconv too - IF(APPLE) + IF(UNIX) + # CURL depends on libidn FIND_LIBRARY(IDN_LIBRARY idn) - FIND_LIBRARY(INTL_LIBRARY intl) - - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY}) - ENDIF(APPLE) - ENDIF(CURL_STATIC) - ENDIF(WITH_GUI) - - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR}) - ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) + IF(IDN_LIBRARY) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY}) + ENDIF() + + # CURL Macports version depends on libidn, libintl and libiconv too + IF(APPLE) + FIND_LIBRARY(INTL_LIBRARY intl) + IF(INTL_LIBRARY) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY}) + ENDIF() + ENDIF() + ENDIF() + ENDIF() + ENDIF() + + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include) ADD_SUBDIRECTORY(nel) ENDIF(WITH_NEL) @@ -201,7 +451,7 @@ ENDIF(WITH_SNOWBALLS) IF(WITH_TOOLS) ADD_SUBDIRECTORY(tool) -ENDIF(WITH_TOOLS) +ENDIF() IF(WITH_STUDIO) ADD_SUBDIRECTORY(studio) diff --git a/code/CMakeModules/AndroidToolChain.cmake b/code/CMakeModules/AndroidToolChain.cmake index 6690497d4..81d9fe566 100644 --- a/code/CMakeModules/AndroidToolChain.cmake +++ b/code/CMakeModules/AndroidToolChain.cmake @@ -15,48 +15,76 @@ IF(NOT NDK_ROOT) IF(CMAKE_HOST_WIN32) FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT) - ENDIF(CMAKE_HOST_WIN32) -ENDIF(NOT NDK_ROOT) + ENDIF() +ENDIF() IF(NOT TARGET_CPU) SET(TARGET_CPU "armv7") -ENDIF(NOT TARGET_CPU) +ENDIF() + +SET(ARMV7_HARD_FLOAT OFF) IF(TARGET_CPU STREQUAL "armv7") SET(LIBRARY_ARCHITECTURE "armeabi-v7a") + IF(ARMV7_HARD_FLOAT) + SET(LIBRARY_ARCHITECTURE "${LIBRARY_ARCHITECTURE}-hard") + ENDIF() SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(TOOLCHAIN_ARCH "arm") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi") - SET(TOOLCHAIN_BIN_PREFIX "arm") + SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi") SET(MINIMUM_NDK_TARGET 4) ELSEIF(TARGET_CPU STREQUAL "armv5") SET(LIBRARY_ARCHITECTURE "armeabi") SET(CMAKE_SYSTEM_PROCESSOR "armv5") SET(TOOLCHAIN_ARCH "arm") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi") - SET(TOOLCHAIN_BIN_PREFIX "arm") + SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi") SET(MINIMUM_NDK_TARGET 4) +ELSEIF(TARGET_CPU STREQUAL "arm64") + SET(LIBRARY_ARCHITECTURE "arm64-v8a") + SET(CMAKE_SYSTEM_PROCESSOR "arm64") + SET(TOOLCHAIN_ARCH "arm64") + SET(GCC_TOOLCHAIN_PREFIX "aarch64-linux-android") + SET(TOOLCHAIN_BIN_PREFIX "aarch64-linux-android") + SET(MINIMUM_NDK_TARGET 21) ELSEIF(TARGET_CPU STREQUAL "x86") SET(LIBRARY_ARCHITECTURE "x86") SET(CMAKE_SYSTEM_PROCESSOR "x86") SET(TOOLCHAIN_ARCH "x86") SET(GCC_TOOLCHAIN_PREFIX "x86") - SET(TOOLCHAIN_BIN_PREFIX "i686") + SET(TOOLCHAIN_BIN_PREFIX "i686-linux-android") SET(MINIMUM_NDK_TARGET 9) +ELSEIF(TARGET_CPU STREQUAL "x86_64") + SET(LIBRARY_ARCHITECTURE "x86_64") + SET(CMAKE_SYSTEM_PROCESSOR "x86_64") + SET(TOOLCHAIN_ARCH "x86_64") + SET(GCC_TOOLCHAIN_PREFIX "x86_64") + SET(TOOLCHAIN_BIN_PREFIX "x86_64-linux-android") + SET(MINIMUM_NDK_TARGET 21) ELSEIF(TARGET_CPU STREQUAL "mips") SET(LIBRARY_ARCHITECTURE "mips") SET(CMAKE_SYSTEM_PROCESSOR "mips") SET(TOOLCHAIN_ARCH "mips") SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android") - SET(TOOLCHAIN_BIN_PREFIX "mipsel") + SET(TOOLCHAIN_BIN_PREFIX "mipsel-linux-android") SET(MINIMUM_NDK_TARGET 9) -ENDIF(TARGET_CPU STREQUAL "armv7") +ELSEIF(TARGET_CPU STREQUAL "mips64") + SET(LIBRARY_ARCHITECTURE "mips64") + SET(CMAKE_SYSTEM_PROCESSOR "mips64") + SET(TOOLCHAIN_ARCH "mips64") + SET(GCC_TOOLCHAIN_PREFIX "mips64el-linux-android") + SET(TOOLCHAIN_BIN_PREFIX "mips64el-linux-android") + SET(MINIMUM_NDK_TARGET 21) +ELSE() + MESSAGE(FATAL_ERROR "Unable to process TARGET_CPU ${TARGET_CPU}") +ENDIF() +SET(CLANG_TOOLCHAIN_PREFIX "llvm") SET(ANDROID_COMPILER "GCC") IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang") SET(ANDROID_COMPILER "clang") - SET(CLANG_TOOLCHAIN_PREFIX "llvm") SET(CLANG ON) ELSE() SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION}) @@ -64,7 +92,11 @@ ENDIF() IF(NOT NDK_TARGET) SET(NDK_TARGET ${MINIMUM_NDK_TARGET}) -ENDIF(NOT NDK_TARGET) +ELSE() + IF(NDK_TARGET LESS MINIMUM_NDK_TARGET) + SET(NDK_TARGET ${MINIMUM_NDK_TARGET}) + ENDIF() +ENDIF() IF(CMAKE_HOST_WIN32) SET(TOOLCHAIN_HOST "windows") @@ -75,7 +107,7 @@ ELSEIF(CMAKE_HOST_APPLE) ELSEIF(CMAKE_HOST_UNIX) SET(TOOLCHAIN_HOST "linux") SET(TOOLCHAIN_BIN_SUFFIX "") -ENDIF(CMAKE_HOST_WIN32) +ENDIF() MACRO(SEARCH_TOOLCHAIN _COMPILER) SET(${_COMPILER}_TOOLCHAIN_VERSIONS) @@ -110,7 +142,7 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER) FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*") IF(_TOOLCHAIN_PREFIXES) LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT) - ENDIF(_TOOLCHAIN_PREFIXES) + ENDIF() ENDIF() ENDMACRO() @@ -123,8 +155,14 @@ ENDIF() SEARCH_TOOLCHAIN(GCC) MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}") -MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}") -MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}") + +IF(CLANG_TOOLCHAIN_ROOT) + MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}") +ENDIF() + +IF(GCC_TOOLCHAIN_ROOT) + MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}") +ENDIF() SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}") @@ -137,14 +175,7 @@ SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++") IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}") # NDK version >= 8b SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}") -ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}") - -# Determine bin prefix for toolchain -FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}") -IF(_TOOLCHAIN_BIN_PREFIXES) - LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX) - STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}") -ENDIF(_TOOLCHAIN_BIN_PREFIXES) +ENDIF() SET(STL_INCLUDE_DIR "${STL_DIR}/include") SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}") @@ -160,39 +191,45 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY) - IF("${_BINARY}" MATCHES "clang") - SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE ) - ELSE() - SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE) - ENDIF() -ENDMACRO(SET_TOOLCHAIN_BINARY) +MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY) + SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE ) +ENDMACRO() + +MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY) + SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE) +ENDMACRO() # Force the compilers to GCC for Android include (CMakeForceCompiler) IF(CLANG) - SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang) - SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++) + MESSAGE(STATUS "Using clang compiler") + + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++) CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang) CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang) - MESSAGE(STATUS "Using clang compiler") + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++) ELSE() - SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc) - SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++) + MESSAGE(STATUS "Using GCC compiler") + + SET_TOOLCHAIN_BINARY_GCC(CMAKE_C_COMPILER gcc) + SET_TOOLCHAIN_BINARY_GCC(CMAKE_CXX_COMPILER g++) CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU) CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU) - MESSAGE(STATUS "Using GCC compiler") + SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as) + SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar) + SET_TOOLCHAIN_BINARY_GCC(CMAKE_LINKER ld) ENDIF() -SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip) -SET_TOOLCHAIN_BINARY(CMAKE_AR ar) -SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld) -SET_TOOLCHAIN_BINARY(CMAKE_NM nm) -SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy) -SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump) -SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_NM nm) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJCOPY objcopy) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_OBJDUMP objdump) +SET_TOOLCHAIN_BINARY_GCC(CMAKE_RANLIB ranlib) diff --git a/code/CMakeModules/ConfigureChecks.cmake b/code/CMakeModules/ConfigureChecks.cmake index baf6e0e7c..3929d65c9 100644 --- a/code/CMakeModules/ConfigureChecks.cmake +++ b/code/CMakeModules/ConfigureChecks.cmake @@ -1,79 +1,56 @@ MACRO(NL_CONFIGURE_CHECKS) - INCLUDE(CheckIncludeFiles) - INCLUDE(CheckFunctionExists) - INCLUDE(CheckLibraryExists) - INCLUDE(CheckTypeSize) - - CHECK_INCLUDE_FILES ("execinfo.h" HAVE_EXECINFO_H) - CHECK_INCLUDE_FILES ("stdint.h" HAVE_STDINT_H) - CHECK_INCLUDE_FILES ("sys/types.h" HAVE_SYS_TYPES_H) - CHECK_INCLUDE_FILES ("inttypes.h" HAVE_INTTYPES_H) - CHECK_INCLUDE_FILES ("unistd.h" HAVE_UNISTD_H) - CHECK_INCLUDE_FILES ("utime.h" HAVE_UTIME_H) - - CHECK_INCLUDE_FILES ("dl.h" HAVE_DL_H) - CHECK_INCLUDE_FILES ("limits.h" HAVE_LIMITS_H) - CHECK_INCLUDE_FILES ("malloc.h" HAVE_MALLOC_H) - CHECK_INCLUDE_FILES ("sys/param.h" HAVE_SYS_PARAM_H) - CHECK_INCLUDE_FILES ("sys/param.h;sys/mount.h" HAVE_SYS_MOUNT_H) - CHECK_INCLUDE_FILES ("sys/statvfs.h" HAVE_SYS_STATVFS_H) - - CHECK_INCLUDE_FILES ("pthread.h" HAVE_PTHREAD) - - CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T) - #if (NOT HAVE_SIZEOF_SIZE_T) - # MESSAGE(FATAL_ERROR "size_t is not present on this architecture - aborting") - #endif (NOT HAVE_SIZEOF_SIZE_T) - MESSAGE(STATUS "DEBUG size_t is ${SIZEOF_SIZE_T}") - - CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T) - MESSAGE(STATUS "DEBUG off_t is ${SIZEOF_OFF_T}") - - CHECK_FUNCTION_EXISTS("backtrace" HAVE_BACKTRACE) - CHECK_FUNCTION_EXISTS("getsockname" HAVE_GETSOCKNAME) - CHECK_FUNCTION_EXISTS("inet_ntoa" HAVE_INET_NTOA) - CHECK_FUNCTION_EXISTS("inet_ntop" HAVE_INET_NTOP) - CHECK_FUNCTION_EXISTS("inet_pton" HAVE_INET_PTON) - CHECK_FUNCTION_EXISTS("regcomp" HAVE_REGCOMP) - CHECK_FUNCTION_EXISTS("strerror" HAVE_STRERROR) - CHECK_FUNCTION_EXISTS("strlcat" HAVE_STRLCAT) - CHECK_FUNCTION_EXISTS("strptime" HAVE_STRPTIME) - CHECK_FUNCTION_EXISTS("strtok_r" HAVE_STRTOK_R) - CHECK_FUNCTION_EXISTS("strtoull" HAVE_STRTOULL) - CHECK_FUNCTION_EXISTS("statvfs" HAVE_STATVFS) - CHECK_FUNCTION_EXISTS("stat64" HAVE_STAT64) + INCLUDE(GetRevision) # 3D drivers IF(WITH_DRIVER_OPENGL) SET(NL_OPENGL_AVAILABLE 1) - ENDIF(WITH_DRIVER_OPENGL) + ENDIF() IF(WITH_DRIVER_OPENGLES) SET(NL_OPENGLES_AVAILABLE 1) - ENDIF(WITH_DRIVER_OPENGLES) - + ENDIF() + IF(WITH_DRIVER_DIRECT3D) SET(NL_DIRECT3D_AVAILABLE 1) - ENDIF(WITH_DRIVER_DIRECT3D) + ENDIF() # sound drivers IF(WITH_DRIVER_FMOD) SET(NL_FMOD_AVAILABLE 1) - ENDIF(WITH_DRIVER_FMOD) + ENDIF() IF(WITH_DRIVER_OPENAL) SET(NL_OPENAL_AVAILABLE 1) - ENDIF(WITH_DRIVER_OPENAL) + ENDIF() IF(WITH_DRIVER_DSOUND) SET(NL_DSOUND_AVAILABLE 1) - ENDIF(WITH_DRIVER_DSOUND) + ENDIF() IF(WITH_DRIVER_XAUDIO2) SET(NL_XAUDIO2_AVAILABLE 1) - ENDIF(WITH_DRIVER_XAUDIO2) + ENDIF() + + IF(NOT RYZOM_VERSION_MAJOR) + SET(RYZOM_VERSION_MAJOR ${NL_VERSION_MAJOR}) + SET(RYZOM_VERSION_MINOR ${NL_VERSION_MINOR}) + SET(RYZOM_VERSION_PATCH ${NL_VERSION_PATCH}) + ENDIF() + + SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}.${REVISION}") + SET(NL_VERSION_RC "${NL_VERSION_MAJOR},${NL_VERSION_MINOR},${NL_VERSION_PATCH},${REVISION}") + + SET(RYZOM_VERSION "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}.${REVISION}") + SET(RYZOM_VERSION_RC "${RYZOM_VERSION_MAJOR},${RYZOM_VERSION_MINOR},${RYZOM_VERSION_PATCH},${REVISION}") + NOW(BUILD_DATE) + + SET(COPYRIGHT "${YEAR} ${AUTHOR}") + + IF(NOT RYZOM_CLIENT_ICON) + SET(RYZOM_CLIENT_ICON "ryzom_client") + ENDIF() - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) + CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h) + INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) ADD_DEFINITIONS(-DHAVE_CONFIG_H) -ENDMACRO(NL_CONFIGURE_CHECKS) +ENDMACRO() diff --git a/code/CMakeModules/Find3dsMaxSDK.cmake b/code/CMakeModules/Find3dsMaxSDK.cmake index 0510d3a6e..bde126208 100644 --- a/code/CMakeModules/Find3dsMaxSDK.cmake +++ b/code/CMakeModules/Find3dsMaxSDK.cmake @@ -9,7 +9,7 @@ if(MAXSDK_INCLUDE_DIR) # Already in cache, be silent SET(MAXSDK_FIND_QUIETLY TRUE) -endif(MAXSDK_INCLUDE_DIR) +endif() FIND_PATH(MAXSDK_DIR "include/maxversion.h" @@ -37,9 +37,9 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h IF(TARGET_X64) SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib) -ELSE(TARGET_X64) +ELSE() SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib) -ENDIF(TARGET_X64) +ENDIF() MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) FIND_LIBRARY(${MYLIBRARY} @@ -47,7 +47,7 @@ MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) HINTS ${MAXSDK_LIBRARY_DIRS} ) -ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) +ENDMACRO() FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core) FIND_3DS_LIBRARY(MAXSDK_GEOM_LIBRARY geom) diff --git a/code/CMakeModules/FindCustomMFC.cmake b/code/CMakeModules/FindCustomMFC.cmake index 621bf49ae..45d5b8cce 100644 --- a/code/CMakeModules/FindCustomMFC.cmake +++ b/code/CMakeModules/FindCustomMFC.cmake @@ -45,6 +45,6 @@ IF(MFC_FOUND) # Set CMake flag to use MFC DLL SET(CMAKE_MFC_FLAG 2) -ENDIF(MFC_FOUND) +ENDIF() # TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project diff --git a/code/CMakeModules/FindDirectXSDK.cmake b/code/CMakeModules/FindDirectXSDK.cmake index b64fca6ea..847a6d596 100644 --- a/code/CMakeModules/FindDirectXSDK.cmake +++ b/code/CMakeModules/FindDirectXSDK.cmake @@ -30,16 +30,16 @@ MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME) HINTS "${DXSDK_LIBRARY_DIR}" ) -ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME) +ENDMACRO() IF(DXSDK_DIR) SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include") IF(TARGET_X64) SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x64 ${DXSDK_DIR}/lib/amd64) - ELSE(TARGET_X64) + ELSE() SET(DXSDK_LIBRARY_DIRS ${DXSDK_DIR}/Lib/x86 ${DXSDK_DIR}/lib) - ENDIF(TARGET_X64) + ENDIF() FIND_PATH(DXSDK_LIBRARY_DIR dxguid.lib @@ -52,7 +52,7 @@ IF(DXSDK_DIR) FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio) FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9) FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9) -ENDIF(DXSDK_DIR) +ENDIF() # Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if # all listed variables are TRUE. diff --git a/code/CMakeModules/FindExternal.cmake b/code/CMakeModules/FindExternal.cmake index 5d6086bc6..80b3eda0c 100644 --- a/code/CMakeModules/FindExternal.cmake +++ b/code/CMakeModules/FindExternal.cmake @@ -8,7 +8,7 @@ # EXTERNAL_FOUND - True if the external libraries are available SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH}) -SET(EXTERNAL_TEMP_FILE "include/wwwconf.h") +SET(EXTERNAL_TEMP_FILE "include/zlib.h") SET(EXTERNAL_NAME "external") # If using STLport preprend external_stlport @@ -38,35 +38,35 @@ IF(EXTERNAL_PATH) # Using 32 or 64 bits binaries IF(TARGET_X64 AND WIN32) SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64") - ELSE(TARGET_X64 AND WIN32) + ELSE() SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin") - ENDIF(TARGET_X64 AND WIN32) + ENDIF() # Using 32 or 64 bits libraries IF(TARGET_X64 AND WIN32) SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64") - ELSE(TARGET_X64 AND WIN32) + ELSE() SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib") - ENDIF(TARGET_X64 AND WIN32) + ENDIF() SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}") # Stupid hack for FindOpenAL.cmake SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}") SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}") -ENDIF(EXTERNAL_PATH) +ENDIF() IF(EXTERNAL_FOUND) IF(NOT External_FIND_QUIETLY) MESSAGE(STATUS "Found ${EXTERNAL_NAME}: ${EXTERNAL_PATH}") - ENDIF(NOT External_FIND_QUIETLY) -ELSE(EXTERNAL_FOUND) + ENDIF() +ELSE() IF(External_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Unable to find ${EXTERNAL_NAME}!") - ELSE(External_FIND_REQUIRED) + ELSE() IF(NOT External_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find ${EXTERNAL_NAME}!") - ENDIF(NOT External_FIND_QUIETLY) - ENDIF(External_FIND_REQUIRED) -ENDIF(EXTERNAL_FOUND) + ENDIF() + ENDIF() +ENDIF() MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH) diff --git a/code/CMakeModules/FindLibOVR.cmake b/code/CMakeModules/FindLibOVR.cmake index 707949613..b182da00c 100644 --- a/code/CMakeModules/FindLibOVR.cmake +++ b/code/CMakeModules/FindLibOVR.cmake @@ -58,6 +58,7 @@ IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR) ENDIF(NOT LIBOVR_FIND_QUIETLY) SET(LIBOVR_FOUND "YES") SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR") + SET(NL_STEREO_AVAILABLE ON) IF(UNIX) SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread) ELSE(UNIX) diff --git a/code/CMakeModules/FindLibVR.cmake b/code/CMakeModules/FindLibVR.cmake index eba9c347e..e8bcf2fde 100644 --- a/code/CMakeModules/FindLibVR.cmake +++ b/code/CMakeModules/FindLibVR.cmake @@ -25,6 +25,7 @@ IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) ENDIF(NOT LIBVR_FIND_QUIETLY) SET(LIBVR_FOUND "YES") SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR") + SET(NL_STEREO_AVAILABLE ON) ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) IF(NOT LIBVR_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find LibVR!") diff --git a/code/CMakeModules/FindLibwww.cmake b/code/CMakeModules/FindLibwww.cmake deleted file mode 100644 index e742c6ae5..000000000 --- a/code/CMakeModules/FindLibwww.cmake +++ /dev/null @@ -1,190 +0,0 @@ -# -# Find the W3C libwww includes and library -# -# This module defines -# LIBWWW_INCLUDE_DIR, where to find tiff.h, etc. -# LIBWWW_LIBRARY, where to find the Libwww library. -# LIBWWW_FOUND, If false, do not try to use Libwww. - -OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF) - -# also defined, but not for general use are -IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) - # in cache already - SET(Libwww_FIND_QUIETLY TRUE) -ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) - -FIND_PATH(LIBWWW_INCLUDE_DIR - WWWInit.h - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES libwww w3c-libwww -) - -# when installing libwww on mac os x using macports the file wwwconf.h resides -# in /opt/local/include and not in the real libwww include dir :/ -FIND_PATH(LIBWWW_ADDITIONAL_INCLUDE_DIR - wwwconf.h - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include -) - -# combine both include directories into one variable -IF(LIBWWW_ADDITIONAL_INCLUDE_DIR) - SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_ADDITIONAL_INCLUDE_DIR}) -ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR) - -# helper to find all the libwww sub libraries -MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION FILE) - IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) - SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") - ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) - - FIND_LIBRARY(${MYLIBRARY}_RELEASE - NAMES ${FILE} - PATHS - /usr/local/lib - /usr/lib - /usr/lib/x86_64-linux-gnu - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - ) - - FIND_LIBRARY(${MYLIBRARY}_DEBUG - NAMES ${FILE}d - PATHS - /usr/local/lib - /usr/lib - /usr/lib/x86_64-linux-gnu - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 - ) - - IF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) - ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) - - IF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} optimized ${${MYLIBRARY}_RELEASE} debug ${${MYLIBRARY}_DEBUG}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSEIF(${MYLIBRARY}_RELEASE) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_RELEASE}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSEIF(${MYLIBRARY}_DEBUG) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_DEBUG}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSE(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - IF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) - MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}") - ENDIF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) - ENDIF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - - MARK_AS_ADVANCED(${MYLIBRARY}_RELEASE ${MYLIBRARY}_DEBUG) -ENDMACRO(FIND_WWW_LIBRARY) - -MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL) - IF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) - LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL}) - ENDIF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) -ENDMACRO(LINK_WWW_LIBRARY) - -# Find and link required libs for static or dynamic -FIND_WWW_LIBRARY(LIBWWWAPP_LIBRARY REQUIRED wwwapp) # cache core file ftp gopher html http mime news stream telnet trans utils zip xml xmlparse -FIND_WWW_LIBRARY(LIBWWWCORE_LIBRARY REQUIRED wwwcore) # utils -FIND_WWW_LIBRARY(LIBWWWFILE_LIBRARY REQUIRED wwwfile) # core trans utils html -FIND_WWW_LIBRARY(LIBWWWHTML_LIBRARY REQUIRED wwwhtml) # core utils -FIND_WWW_LIBRARY(LIBWWWHTTP_LIBRARY REQUIRED wwwhttp) # md5 core mime stream utils -FIND_WWW_LIBRARY(LIBWWWMIME_LIBRARY REQUIRED wwwmime) # core cache stream utils - -# Required for static or if underlinking -FIND_WWW_LIBRARY(LIBWWWCACHE_LIBRARY OPTIONAL wwwcache) # core trans utils -FIND_WWW_LIBRARY(LIBWWWSTREAM_LIBRARY OPTIONAL wwwstream) # core file utils - -FIND_WWW_LIBRARY(LIBWWWTRANS_LIBRARY REQUIRED wwwtrans) # core utils -FIND_WWW_LIBRARY(LIBWWWUTILS_LIBRARY REQUIRED wwwutils) - - -# Required only if underlinking - -# Unused protocols -FIND_WWW_LIBRARY(LIBWWWFTP_LIBRARY OPTIONAL wwwftp) # core file utils -FIND_WWW_LIBRARY(LIBWWWGOPHER_LIBRARY OPTIONAL wwwgopher) # core html utils file -FIND_WWW_LIBRARY(LIBWWWNEWS_LIBRARY OPTIONAL wwwnews) # core html mime stream utils -FIND_WWW_LIBRARY(LIBWWWTELNET_LIBRARY OPTIONAL wwwtelnet) # core utils - -# Other used by app -FIND_WWW_LIBRARY(LIBWWWDIR_LIBRARY OPTIONAL wwwdir) # file -FIND_WWW_LIBRARY(LIBWWWINIT_LIBRARY OPTIONAL wwwinit) # app cache core file html utils -FIND_WWW_LIBRARY(LIBWWWMUX_LIBRARY OPTIONAL wwwmux) # core stream trans utils -FIND_WWW_LIBRARY(LIBWWWXML_LIBRARY OPTIONAL wwwxml) # core utils xmlparse -FIND_WWW_LIBRARY(LIBWWWZIP_LIBRARY OPTIONAL wwwzip) # core utils -FIND_WWW_LIBRARY(LIBXMLPARSE_LIBRARY OPTIONAL xmlparse) # xmltok - -# Other used by other -FIND_WWW_LIBRARY(LIBXMLTOK_LIBRARY OPTIONAL xmltok) -FIND_WWW_LIBRARY(LIBWWWSSL_LIBRARY OPTIONAL wwwssl) -FIND_WWW_LIBRARY(LIBMD5_LIBRARY OPTIONAL md5) -FIND_WWW_LIBRARY(LIBPICS_LIBRARY OPTIONAL pics) - -# Other external libraries -FIND_PACKAGE(EXPAT QUIET) -FIND_PACKAGE(OpenSSL QUIET) -FIND_WWW_LIBRARY(LIBREGEX_LIBRARY OPTIONAL gnu_regex) - -# Now link all libs together -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTLoadCache) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWCACHE_LIBRARY HTCacheAppend) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWFTP_LIBRARY HTLoadFTP) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWGOPHER_LIBRARY HTLoadGopher) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWNEWS_LIBRARY HTLoadNews) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWTELNET_LIBRARY HTLoadTelnet) - -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTStreamToChunk) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWSTREAM_LIBRARY HTGuess_new) -LINK_WWW_LIBRARY(LIBWWWFILE_LIBRARY LIBWWWDIR_LIBRARY HTDir_new) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWINIT_LIBRARY HTProtocolInit) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWXML_LIBRARY HTXML_new) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBWWWZIP_LIBRARY HTZLib_inflate) - -# libwwwxml can be linked to xmlparse or expat -LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY LIBXMLPARSE_LIBRARY XML_ParserCreate) - -IF(LIBXMLPARSE_LIBRARY_LINKED) - LINK_WWW_LIBRARY(LIBXMLPARSE_LIBRARY EXPAT_LIBRARY XmlInitEncoding) -ELSE(LIBXMLPARSE_LIBRARY_LINKED) - LINK_WWW_LIBRARY(LIBWWWXML_LIBRARY EXPAT_LIBRARY XML_ParserCreate) -ENDIF(LIBXMLPARSE_LIBRARY_LINKED) - -LINK_WWW_LIBRARY(LIBWWWHTTP_LIBRARY LIBMD5_LIBRARY MD5Init) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBREGEX_LIBRARY regexec) -LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY OPENSSL_LIBRARIES SSL_new) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libwww DEFAULT_MSG - LIBWWW_LIBRARIES - LIBWWW_INCLUDE_DIR -) diff --git a/code/CMakeModules/FindLua53.cmake b/code/CMakeModules/FindLua53.cmake new file mode 100644 index 000000000..012f27c3f --- /dev/null +++ b/code/CMakeModules/FindLua53.cmake @@ -0,0 +1,81 @@ +# Locate Lua library +# This module defines +# LUA53_FOUND, if false, do not try to link to Lua +# LUA_LIBRARIES +# LUA_INCLUDE_DIR, where to find lua.h +# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8) +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(LUA_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES include/lua53 include/lua5.3 include/lua-5.3 include/lua include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +find_library(LUA_LIBRARY + NAMES lua53 lua5.3 lua-5.3 lua + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) + +if(LUA_LIBRARY) + # include the math library for Unix + if(UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") + # For Windows and Mac, don't need to explicitly include the math library + else() + set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") + endif() +endif() + +if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") + + string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") + unset(lua_version_str) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua53 + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUA_VERSION_STRING) + +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) + diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index 73255077a..64fd5e1cf 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -9,53 +9,81 @@ MACRO(FIND_CORRECT_LUA_VERSION) IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") INCLUDE(CheckDepends) - SET(LUA52_LIBRARY "liblua5.2") - CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) - + # check for Lua 5.3 + SET(LUA53_LIBRARIES liblua5.3 liblua-5.3 liblua.so.5.3) + + FOREACH(_LIB ${LUA53_LIBRARIES}) + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND) + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.3") + FIND_PACKAGE(Lua53 REQUIRED) + BREAK() + ENDIF() + ENDFOREACH() + IF(NOT LUALIB_FOUND) - # fedora (v20) - SET(LUA52_LIBRARY "liblua-5.2") - CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) - ENDIF(NOT LUALIB_FOUND) + # check for Lua 5.2 + SET(LUA52_LIBRARIES liblua5.2 liblua-5.2 liblua.so.5.2) - IF(LUALIB_FOUND) - MESSAGE(STATUS "Luabind is using Lua 5.2") - FIND_PACKAGE(Lua52 REQUIRED) - ELSE(LUALIB_FOUND) - SET(LUA51_LIBRARY "liblua5.1") - CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND) + FOREACH(_LIB ${LUA52_LIBRARIES}) + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND) + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.2") + FIND_PACKAGE(Lua52 REQUIRED) + BREAK() + ENDIF() + ENDFOREACH() + ENDIF() - IF(LUALIB_FOUND) - MESSAGE(STATUS "Luabind is using Lua 5.1") - FIND_PACKAGE(Lua51 REQUIRED) - ELSE(LUALIB_FOUND) - SET(LUA50_LIBRARY "liblua5.0") - CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND) + IF(NOT LUALIB_FOUND) + # check for Lua 5.1 + SET(LUA51_LIBRARIES liblua5.1 liblua-5.1 liblua.so.5.1) + FOREACH(_LIB ${LUA51_LIBRARIES}) + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND) + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.1") + FIND_PACKAGE(Lua51 REQUIRED) + BREAK() + ENDIF() + ENDFOREACH() + ENDIF() + + IF(NOT LUALIB_FOUND) + # check for Lua 5.0 + SET(LUA50_LIBRARIES liblua5.0 liblua-5.0 liblua.so.5.0) + + FOREACH(_LIB ${LUA50_LIBRARIES}) + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE _LIB LUALIB_FOUND) IF(LUALIB_FOUND) MESSAGE(STATUS "Luabind is using Lua 5.0") FIND_PACKAGE(Lua50 REQUIRED) - ELSE(LUALIB_FOUND) - MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind") - ENDIF(LUALIB_FOUND) - ENDIF(LUALIB_FOUND) - ENDIF(LUALIB_FOUND) - ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") + BREAK() + ENDIF() + ENDFOREACH() + ENDIF() + + IF(NOT LUALIB_FOUND) + MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind") + ENDIF() + ELSE() # TODO: find a way to detect Lua version - IF(WITH_LUA52) + IF(WITH_LUA53) + FIND_PACKAGE(Lua53 REQUIRED) + ELSEIF(WITH_LUA52) FIND_PACKAGE(Lua52 REQUIRED) ELSEIF(WITH_LUA51) FIND_PACKAGE(Lua51 REQUIRED) - ELSE(WITH_LUA52) + ELSE() FIND_PACKAGE(Lua50 REQUIRED) - ENDIF(WITH_LUA52) - ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") -ENDMACRO(FIND_CORRECT_LUA_VERSION) + ENDIF() + ENDIF() +ENDMACRO() IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) # in cache already SET(Luabind_FIND_QUIETLY TRUE) -ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) +ENDIF() FIND_PATH(LUABIND_INCLUDE_DIR luabind/luabind.hpp @@ -72,11 +100,21 @@ FIND_PATH(LUABIND_INCLUDE_DIR SET(LIBRARY_NAME_RELEASE) SET(LIBRARY_NAME_DEBUG) +IF(WITH_LUA53) + IF(WITH_STLPORT) + LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua53) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua53d) + ENDIF() + + LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua53) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua53d) +ENDIF() + IF(WITH_LUA52) IF(WITH_STLPORT) LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52) LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d) - ENDIF(WITH_STLPORT) + ENDIF() LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52) LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d) diff --git a/code/CMakeModules/FindMSVC.cmake b/code/CMakeModules/FindMSVC.cmake index 94146775d..6a8bdd33a 100644 --- a/code/CMakeModules/FindMSVC.cmake +++ b/code/CMakeModules/FindMSVC.cmake @@ -14,8 +14,8 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE) IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/") - ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") - ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry") + ENDIF() + ENDIF() IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") SET(VC${_VERSION}_FOUND ON) @@ -24,14 +24,14 @@ MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) SET(_VERSION_STR ${_VERSION}) IF(MSVC_EXPRESS) SET(_VERSION_STR "${_VERSION_STR} Express") - ENDIF(MSVC_EXPRESS) + ENDIF() MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}") - ENDIF(NOT MSVC_FIND_QUIETLY) + ENDIF() ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") SET(VC${_VERSION}_FOUND OFF) SET(VC${_VERSION}_DIR "") - ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") -ENDMACRO(DETECT_VC_VERSION_HELPER) + ENDIF() +ENDMACRO() MACRO(DETECT_VC_VERSION _VERSION) SET(VC${_VERSION}_FOUND OFF) @@ -39,21 +39,21 @@ MACRO(DETECT_VC_VERSION _VERSION) IF(NOT VC${_VERSION}_FOUND) DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) - ENDIF(NOT VC${_VERSION}_FOUND) + ENDIF() IF(VC${_VERSION}_FOUND) SET(VC_FOUND ON) SET(VC_DIR "${VC${_VERSION}_DIR}") - ENDIF(VC${_VERSION}_FOUND) -ENDMACRO(DETECT_VC_VERSION) + ENDIF() +ENDMACRO() MACRO(DETECT_EXPRESS_VERSION _VERSION) GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE) IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") SET(MSVC_EXPRESS ON) - ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") -ENDMACRO(DETECT_EXPRESS_VERSION) + ENDIF() +ENDMACRO() IF(MSVC12) DETECT_VC_VERSION("12.0") @@ -62,7 +62,7 @@ IF(MSVC12) IF(NOT MSVC12_REDIST_DIR) # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC12_REDIST_DIR) + ENDIF() ELSEIF(MSVC11) DETECT_VC_VERSION("11.0") SET(MSVC_TOOLSET "110") @@ -70,7 +70,7 @@ ELSEIF(MSVC11) IF(NOT MSVC11_REDIST_DIR) # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC11_REDIST_DIR) + ENDIF() ELSEIF(MSVC10) DETECT_VC_VERSION("10.0") SET(MSVC_TOOLSET "100") @@ -78,23 +78,28 @@ ELSEIF(MSVC10) IF(NOT MSVC10_REDIST_DIR) # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC10_REDIST_DIR) + ENDIF() ELSEIF(MSVC90) DETECT_VC_VERSION("9.0") SET(MSVC_TOOLSET "90") ELSEIF(MSVC80) DETECT_VC_VERSION("8.0") SET(MSVC_TOOLSET "80") -ENDIF(MSVC12) +ENDIF() # If you plan to use VC++ compilers with WINE, set VC_DIR environment variable IF(NOT VC_DIR) SET(VC_DIR $ENV{VC_DIR}) -ENDIF(NOT VC_DIR) +ENDIF() IF(NOT VC_DIR) - STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER}) -ENDIF(NOT VC_DIR) + IF(CMAKE_CXX_COMPILER) + SET(_COMPILER ${CMAKE_CXX_COMPILER}) + ELSE() + SET(_COMPILER ${CMAKE_C_COMPILER}) + ENDIF() + STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${_COMPILER}) +ENDIF() SET(VC_INCLUDE_DIR "${VC_DIR}/include") SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR}) diff --git a/code/CMakeModules/FindMercurial.cmake b/code/CMakeModules/FindMercurial.cmake index dbb2110ff..f85952557 100644 --- a/code/CMakeModules/FindMercurial.cmake +++ b/code/CMakeModules/FindMercurial.cmake @@ -31,7 +31,7 @@ # MESSAGE("Current revision is ${Project_WC_REVISION}") # Mercurial_WC_LOG(${PROJECT_SOURCE_DIR} Project) # MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}") -# ENDIF(MERCURIAL_FOUND) +# ENDIF() #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -74,22 +74,22 @@ IF(Mercurial_HG_EXECUTABLE) IF(NOT ${Mercurial_hg_info_result} EQUAL 0) MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}") - ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0) + ELSE() LIST(LENGTH ${prefix}_WC_INFO _COUNT) IF(_COUNT EQUAL 4) LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION) LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET) LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH) LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR) - ELSE(_COUNT EQUAL 4) + ELSE() MESSAGE(STATUS "Bad output from HG") SET(${prefix}_WC_REVISION "unknown") SET(${prefix}_WC_CHANGESET "unknown") SET(${prefix}_WC_BRANCH "unknown") - ENDIF(_COUNT EQUAL 4) - ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0) + ENDIF() + ENDIF() - ENDMACRO(Mercurial_WC_INFO) + ENDMACRO() MACRO(Mercurial_WC_LOG dir prefix) # This macro can block if the certificate is not signed: @@ -105,9 +105,9 @@ IF(Mercurial_HG_EXECUTABLE) IF(NOT ${Mercurial_hg_log_result} EQUAL 0) MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log -r BASE ${dir}\" failed with output:\n${Mercurial_hg_log_error}") - ENDIF(NOT ${Mercurial_hg_log_result} EQUAL 0) - ENDMACRO(Mercurial_WC_LOG) -ENDIF(Mercurial_HG_EXECUTABLE) + ENDIF() + ENDMACRO() +ENDIF() INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mercurial DEFAULT_MSG Mercurial_HG_EXECUTABLE) diff --git a/code/CMakeModules/FindMySQL.cmake b/code/CMakeModules/FindMySQL.cmake index 0e0ebfd48..f2b62fc59 100644 --- a/code/CMakeModules/FindMySQL.cmake +++ b/code/CMakeModules/FindMySQL.cmake @@ -17,9 +17,12 @@ ELSE() FIND_PATH(MYSQL_INCLUDE_DIR mysql.h PATH_SUFFIXES mysql + PATHS /usr/include/mysql /usr/local/include/mysql /opt/local/include/mysql5/mysql + /opt/local/include/mysql55/mysql + /opt/local/include/mysql51/mysql $ENV{ProgramFiles}/MySQL/*/include $ENV{SystemDrive}/MySQL/*/include) @@ -41,6 +44,8 @@ ELSE() /usr/lib/mysql /usr/local/lib/mysql /opt/local/lib/mysql5/mysql + /opt/local/lib/mysql55/mysql + /opt/local/lib/mysql51/mysql ) FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd @@ -50,6 +55,8 @@ ELSE() /usr/lib/mysql /usr/local/lib/mysql /opt/local/lib/mysql5/mysql + /opt/local/lib/mysql55/mysql + /opt/local/lib/mysql51/mysql ) ENDIF() diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 31288eb03..b91c932f8 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -9,7 +9,7 @@ IF(WINSDK_FOUND) # If Windows SDK already found, skip it RETURN() -ENDIF(WINSDK_FOUND) +ENDIF() # Values can be CURRENT or any existing versions 7.1, 8.0A, etc... SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer") @@ -17,16 +17,31 @@ SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer") MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION) GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};InstallationFolder]" ABSOLUTE) - IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") + IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry" AND EXISTS "${WINSDK${_VERSION}_DIR}/Include") SET(WINSDK${_VERSION}_FOUND ON) GET_FILENAME_COMPONENT(WINSDK${_VERSION}_VERSION_FULL "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};ProductVersion]" NAME) IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}") - ENDIF(NOT WindowsSDK_FIND_QUIETLY) - ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") + ENDIF() + ELSE() SET(WINSDK${_VERSION}_DIR "") - ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") -ENDMACRO(DETECT_WINSDK_VERSION_HELPER) + ENDIF() +ENDMACRO() + +MACRO(DETECT_WINKIT_VERSION _VERSION _SUFFIX) + GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot${_SUFFIX}]" ABSOLUTE) + + IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") + SET(WINSDK${_VERSION}_FOUND ON) + SET(WINSDK${_VERSION}_VERSION_FULL "${_VERSION}") + IF(NOT WindowsSDK_FIND_QUIETLY) + MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}") + ENDIF() + LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION}) + ELSE() + SET(WINSDK${_VERSION}_DIR "") + ENDIF() +ENDMACRO() MACRO(DETECT_WINSDK_VERSION _VERSION) SET(WINSDK${_VERSION}_FOUND OFF) @@ -34,43 +49,52 @@ MACRO(DETECT_WINSDK_VERSION _VERSION) IF(NOT WINSDK${_VERSION}_FOUND) DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) - ENDIF(NOT WINSDK${_VERSION}_FOUND) -ENDMACRO(DETECT_WINSDK_VERSION) + ENDIF() +ENDMACRO() -SET(WINSDK_VERSIONS "8.0" "8.0A" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A") SET(WINSDK_DETECTED_VERSIONS) +# Fixed versions for Windows Kits (VC++ from 2012) +DETECT_WINKIT_VERSION("10.0" "10") +DETECT_WINKIT_VERSION("8.1" "81") +DETECT_WINKIT_VERSION("8.0" "") + +# For VC++ up to 2010 +SET(WINSDK_VERSIONS "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A") + # Search all supported Windows SDKs FOREACH(_VERSION ${WINSDK_VERSIONS}) DETECT_WINSDK_VERSION(${_VERSION}) IF(WINSDK${_VERSION}_FOUND) LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION}) - ENDIF(WINSDK${_VERSION}_FOUND) -ENDFOREACH(_VERSION) + ENDIF() +ENDFOREACH() -SET(WINSDK_SUFFIX) +SET(WINSDK_SUFFIXES) -IF(TARGET_ARM) +IF(TARGET_ARM64) + SET(WINSDK8_SUFFIX "arm64") +ELSEIF(TARGET_ARM) SET(WINSDK8_SUFFIX "arm") ELSEIF(TARGET_X64) SET(WINSDK8_SUFFIX "x64") - SET(WINSDK_SUFFIX "x64") + SET(WINSDK_SUFFIXES "x64" "amd64") ELSEIF(TARGET_X86) SET(WINSDK8_SUFFIX "x86") -ENDIF(TARGET_ARM) +ENDIF() SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE}) IF(WINSDKCURRENT_VERSION_INCLUDE) FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE) -ENDIF(WINSDKCURRENT_VERSION_INCLUDE) +ENDIF() SET(WINSDKENV_DIR $ENV{WINSDK_DIR}) IF(NOT WINSDKENV_DIR) SET(WINSDKENV_DIR $ENV{WindowsSDKDir}) -ENDIF(NOT WINSDKENV_DIR) +ENDIF() MACRO(FIND_WINSDK_VERSION_HEADERS) IF(WINSDK_DIR AND NOT WINSDK_VERSION) @@ -82,17 +106,28 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) ) IF(_MSI_FILE) - # Look for Windows SDK 8.0 - FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8") + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 8.1 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINBLUE") + + IF(_CONTENT) + SET(WINSDK_VERSION "8.1") + ENDIF() + ENDIF() + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 8.0 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8") + + IF(_CONTENT) + SET(WINSDK_VERSION "8.0") + ENDIF() + ENDIF() - IF(_CONTENT) - SET(WINSDK_VERSION "8.0") - ENDIF(_CONTENT) - IF(NOT WINSDK_VERSION) # Look for Windows SDK 7.0 FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN7") - + IF(_CONTENT) FIND_FILE(_WINSDKVER_FILE winsdkver.h WinSDKVer.h PATHS @@ -112,23 +147,23 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) SET(WINSDK_VERSION "7.1") ELSEIF(_WINSDKVER STREQUAL "0601") SET(WINSDK_VERSION "7.0A") - ELSE(_WINSDKVER STREQUAL "06010000") + ELSE() MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}") - ENDIF(_WINSDKVER STREQUAL "06010000") - ELSE(_WINSDKVER_FILE) + ENDIF() + ELSE() SET(WINSDK_VERSION "7.0") - ENDIF(_WINSDKVER_FILE) - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 6.0 FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_VISTA") - + IF(_CONTENT) SET(WINSDK_VERSION "6.0") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 5.2 @@ -136,8 +171,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) IF(_CONTENT) SET(WINSDK_VERSION "5.2") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 5.1 @@ -145,8 +180,8 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) IF(_CONTENT) SET(WINSDK_VERSION "5.1") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() IF(NOT WINSDK_VERSION) # Look for Windows SDK 5.0 @@ -154,13 +189,13 @@ MACRO(FIND_WINSDK_VERSION_HEADERS) IF(_CONTENT) SET(WINSDK_VERSION "5.0") - ENDIF(_CONTENT) - ENDIF(NOT WINSDK_VERSION) - ELSE(_MSI_FILE) + ENDIF() + ENDIF() + ELSE() MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}") - ENDIF(_MSI_FILE) - ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION) -ENDMACRO(FIND_WINSDK_VERSION_HEADERS) + ENDIF() + ENDIF() +ENDMACRO() MACRO(USE_CURRENT_WINSDK) SET(WINSDK_DIR "") @@ -174,7 +209,7 @@ MACRO(USE_CURRENT_WINSDK) ${WINSDKENV_DIR}/Include/um ${WINSDKENV_DIR}/Include ) - ENDIF(WINSDKENV_DIR) + ENDIF() # Use INCLUDE environment variable IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) @@ -186,9 +221,9 @@ MACRO(USE_CURRENT_WINSDK) STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE}) MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}") BREAK() - ENDIF(EXISTS ${_INCLUDE}/Windows.h) - ENDFOREACH(_INCLUDE) - ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) + ENDIF() + ENDFOREACH() + ENDIF() IF(WINSDK_DIR) # Compare WINSDK_DIR with registered Windows SDKs @@ -197,38 +232,44 @@ MACRO(USE_CURRENT_WINSDK) SET(WINSDK_VERSION ${_VERSION}) SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") BREAK() - ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}") - ENDFOREACH(_VERSION) + ENDIF() + ENDFOREACH() FIND_WINSDK_VERSION_HEADERS() - ENDIF(WINSDK_DIR) + ENDIF() IF(NOT WINSDK_DIR) # Use Windows SDK versions installed with VC++ when possible - IF(MSVC12) - SET(WINSDK_VERSION "8.1A") + IF(MSVC14) + SET(WINSDK_VERSION "8.1") + ELSEIF(MSVC12) + SET(WINSDK_VERSION "8.1") ELSEIF(MSVC11) - SET(WINSDK_VERSION "8.0A") + SET(WINSDK_VERSION "8.0") ELSEIF(MSVC10) IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) SET(WINSDK_VERSION "7.0A") - ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) + ENDIF() ELSEIF(MSVC90) IF(NOT MSVC_EXPRESS) SET(WINSDK_VERSION "6.0A") - ENDIF(NOT MSVC_EXPRESS) + ENDIF() ELSEIF(MSVC80) IF(NOT MSVC_EXPRESS) # TODO: fix this version SET(WINSDK_VERSION "5.2A") - ENDIF(NOT MSVC_EXPRESS) - ELSE(MSVC12) + ENDIF() + ELSE() MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.") - ENDIF(MSVC12) + ENDIF() # Use installed Windows SDK IF(NOT WINSDK_VERSION) - IF(WINSDK7.1_FOUND) + IF(WINSDK8.1_FOUND) + SET(WINSDK_VERSION "8.1") + ELSEIF(WINSDK8.0_FOUND) + SET(WINSDK_VERSION "8.0") + ELSEIF(WINSDK7.1_FOUND) SET(WINSDK_VERSION "7.1") ELSEIF(WINSDK7.0_FOUND) SET(WINSDK_VERSION "7.0") @@ -236,10 +277,10 @@ MACRO(USE_CURRENT_WINSDK) SET(WINSDK_VERSION "6.1") ELSEIF(WINSDK6.0_FOUND) SET(WINSDK_VERSION "6.0") - ELSE(WINSDK7.1_FOUND) + ELSE() MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.") - ENDIF(WINSDK7.1_FOUND) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() # Look for correct registered Windows SDK version FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS}) @@ -247,27 +288,37 @@ MACRO(USE_CURRENT_WINSDK) SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}") BREAK() - ENDIF(WINSDK_VERSION STREQUAL _VERSION) - ENDFOREACH(_VERSION) - ENDIF(NOT WINSDK_DIR) -ENDMACRO(USE_CURRENT_WINSDK) + ENDIF() + ENDFOREACH() + ENDIF() +ENDMACRO() + +IF(MSVC14) + # Under VC++ 2015, stdio.h, stdlib.h, etc... are part of UCRT + SET(WINSDK_UCRT_VERSION "10.0") +ENDIF() + +# Look for correct UCRT +IF(WINSDK_UCRT_VERSION AND WINSDK${WINSDK_UCRT_VERSION}_FOUND) + SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}") +ENDIF() IF(WINSDK_VERSION STREQUAL "CURRENT") USE_CURRENT_WINSDK() -ELSE(WINSDK_VERSION STREQUAL "CURRENT") +ELSE() IF(WINSDK${WINSDK_VERSION}_FOUND) SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}") - ELSE(WINSDK${WINSDK_VERSION}_FOUND) + ELSE() USE_CURRENT_WINSDK() - ENDIF(WINSDK${WINSDK_VERSION}_FOUND) -ENDIF(WINSDK_VERSION STREQUAL "CURRENT") + ENDIF() +ENDIF() IF(WINSDK_DIR) MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}") -ELSE(WINSDK_DIR) +ELSE() MESSAGE(FATAL_ERROR "Unable to find Windows SDK!") -ENDIF(WINSDK_DIR) +ENDIF() # directory where Win32 headers are found FIND_PATH(WINSDK_INCLUDE_DIR Windows.h @@ -276,30 +327,64 @@ FIND_PATH(WINSDK_INCLUDE_DIR Windows.h ${WINSDK_DIR}/Include ) +# directory where WinRT headers are found +FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h + HINTS + ${WINSDK_DIR}/Include/winrt +) + # directory where DirectX headers are found FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h HINTS ${WINSDK_DIR}/Include/shared - ${WINSDK_DIR}/Include ) # directory where OpenGL headers are found FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h HINTS + ${WINSDK_DIR}/Include/um/gl ${WINSDK_DIR}/Include/gl - ${WINSDK_DIR}/Include ) +SET(WINSDK_LIBRARY_DIRS + ${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX} + ${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX} +) + +IF(WINSDK_SUFFIXES) + FOREACH(_SUFFIX ${WINSDK_SUFFIXES}) + SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib/${_SUFFIX}) + ENDFOREACH() +ELSE() + SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib) +ENDIF() + # directory where all libraries are found FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib HINTS - ${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX} - ${WINSDK_DIR}/Lib/${WINSDK_SUFFIX} + ${WINSDK_LIBRARY_DIRS} ) +IF(WINSDK_UCRT_DIR) + # directory where UCRT headers are found + FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h + HINTS + ${WINSDK_UCRT_DIR}/Include/10.0.10056.0/ucrt + ${WINSDK_UCRT_DIR}/Include/10.0.10150.0/ucrt + ) + + # directory where UCRT libraries are found + FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib + HINTS + ${WINSDK_UCRT_DIR}/Lib/10.0.10056.0/ucrt/${WINSDK8_SUFFIX} + ${WINSDK_UCRT_DIR}/Lib/10.0.10150.0/ucrt/${WINSDK8_SUFFIX} + ) +ENDIF() + # signtool is used to sign executables FIND_PROGRAM(WINSDK_SIGNTOOL signtool HINTS + ${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX} ${WINSDK_DIR}/Bin/x86 ${WINSDK_DIR}/Bin ) @@ -307,22 +392,46 @@ FIND_PROGRAM(WINSDK_SIGNTOOL signtool # midl is used to generate IDL interfaces FIND_PROGRAM(WINSDK_MIDL midl HINTS + ${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX} ${WINSDK_DIR}/Bin/x86 ${WINSDK_DIR}/Bin ) IF(WINSDK_INCLUDE_DIR) SET(WINSDK_FOUND ON) - SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR} ${WINSDK_OPENGL_INCLUDE_DIR}) + + IF(WINSDK_UCRT_INCLUDE_DIR) + SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_UCRT_INCLUDE_DIR}) + ENDIF() + + IF(WINSDK_SHARED_INCLUDE_DIR) + SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_SHARED_INCLUDE_DIR}) + ENDIF() + + SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_INCLUDE_DIR}) + + IF(WINSDK_OPENGL_INCLUDE_DIR) + SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_OPENGL_INCLUDE_DIR}) + ENDIF() + + IF(WINSDK_WINRT_INCLUDE_DIR) + SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_WINRT_INCLUDE_DIR}) + ENDIF() + + INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) # TODO: Move this after all other includes somehow... + + IF(WINSDK_UCRT_LIBRARY_DIR) + SET(CMAKE_LIBRARY_PATH ${WINSDK_UCRT_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) + ENDIF() + SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) - INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) # Fix for using Windows SDK 7.1 with Visual C++ 2012 IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11) ADD_DEFINITIONS(-D_USING_V110_SDK71_) - ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11) -ELSE(WINSDK_INCLUDE_DIR) + ENDIF() +ELSE() IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Windows SDK!") - ENDIF(NOT WindowsSDK_FIND_QUIETLY) -ENDIF(WINSDK_INCLUDE_DIR) + ENDIF() +ENDIF() diff --git a/code/CMakeModules/Findassimp.cmake b/code/CMakeModules/Findassimp.cmake new file mode 100644 index 000000000..41e53cf94 --- /dev/null +++ b/code/CMakeModules/Findassimp.cmake @@ -0,0 +1,29 @@ +FIND_PATH( + assimp_INCLUDE_DIRS + NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h assimp/cimport.h + PATHS /usr/local/include/ +) + +FIND_LIBRARY( + assimp_LIBRARIES + NAMES assimp + PATHS /usr/local/lib/ +) + +IF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES) + SET(assimp_FOUND TRUE) + FIND_PACKAGE(ZLIB) + IF(ZLIB_FOUND) + SET(assimp_LIBRARIES ${assimp_LIBRARIES} ${ZLIB_LIBRARIES}) + ENDIF() +ENDIF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES) + +IF (assimp_FOUND) + IF (NOT assimp_FIND_QUIETLY) + MESSAGE(STATUS "Found asset importer library: ${assimp_LIBRARIES}") + ENDIF (NOT assimp_FIND_QUIETLY) +ELSE (assimp_FOUND) + IF (assimp_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find asset importer library") + ENDIF (assimp_FIND_REQUIRED) +ENDIF (assimp_FOUND) diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake index 7f0a4e5f1..b29a8763e 100644 --- a/code/CMakeModules/GetRevision.cmake +++ b/code/CMakeModules/GetRevision.cmake @@ -2,12 +2,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) # ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory) # SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt) +# BINARY_DIR should be set to root of your build directory IF(SOURCE_DIR) # Replace spaces by semi-columns IF(CMAKE_MODULE_PATH) STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) - ENDIF(CMAKE_MODULE_PATH) + ENDIF() SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH}) @@ -20,23 +21,30 @@ IF(SOURCE_DIR) ENDIF() ELSE() SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}) - SET(ROOT_DIR ${CMAKE_SOURCE_DIR}) + SET(ROOT_DIR ${CMAKE_SOURCE_DIR}/..) + + # convert ROOT_DIR to absolute path + GET_FILENAME_COMPONENT(ROOT_DIR ${ROOT_DIR} ABSOLUTE) ENDIF() MACRO(NOW RESULT) - IF (WIN32) - EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME) - IF(NOT DATETIME MATCHES "ERROR") - STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}") - ENDIF() - ELSEIF(UNIX) - EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME) - STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}") + IF(CMAKE_VERSION VERSION_GREATER "2.8.10") + STRING(TIMESTAMP ${RESULT} "%Y-%m-%d %H:%M:%S") ELSE() - MESSAGE(SEND_ERROR "date not implemented") - SET(${RESULT} "0000-00-00 00:00:00") + IF(WIN32) + EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME) + IF(NOT DATETIME MATCHES "ERROR") + STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}") + ENDIF() + ELSEIF(UNIX) + EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME) + STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}") + ELSE() + MESSAGE(SEND_ERROR "date not implemented") + SET(${RESULT} "0000-00-00 00:00:00") + ENDIF() ENDIF() -ENDMACRO(NOW) +ENDMACRO() IF(EXISTS "${ROOT_DIR}/.svn/") FIND_PACKAGE(Subversion QUIET) @@ -44,14 +52,14 @@ IF(EXISTS "${ROOT_DIR}/.svn/") IF(SUBVERSION_FOUND) Subversion_WC_INFO(${ROOT_DIR} ER) SET(REVISION ${ER_WC_REVISION}) - ENDIF(SUBVERSION_FOUND) + ENDIF() FIND_PACKAGE(TortoiseSVN QUIET) IF(TORTOISESVN_FOUND) TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION) - ENDIF(TORTOISESVN_FOUND) -ENDIF(EXISTS "${ROOT_DIR}/.svn/") + ENDIF() +ENDIF() IF(EXISTS "${ROOT_DIR}/.hg/") FIND_PACKAGE(Mercurial) @@ -73,11 +81,6 @@ IF(SOURCE_DIR AND NOT DEFINED REVISION) ENDIF() ENDIF() -IF(SOURCE_DIR AND DEFINED REVISION) - IF(EXISTS ${SOURCE_DIR}/revision.h.in) - MESSAGE(STATUS "Revision: ${REVISION}") - NOW(BUILD_DATE) - CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt) - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different - ENDIF() +IF(DEFINED REVISION) + MESSAGE(STATUS "Found revision ${REVISION}") ENDIF() diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 97b5ed88d..20539e87f 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -10,22 +10,22 @@ IF(MSVC) SET(PCHSupport_FOUND TRUE) -ELSE(MSVC) +ELSE() IF(CMAKE_COMPILER_IS_GNUCXX) EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion OUTPUT_VARIABLE gcc_compiler_version) - IF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?") + IF(gcc_compiler_version VERSION_LESS "4.2") SET(PCHSupport_FOUND FALSE) - ELSEIF(gcc_compiler_version MATCHES "^4\\.[0-9]+(\\.[0-9]+)?") + ELSE() SET(PCHSupport_FOUND TRUE) - ENDIF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?") - ELSE(CMAKE_COMPILER_IS_GNUCXX) + ENDIF() + ELSE() # TODO: make tests for other compilers than GCC SET(PCHSupport_FOUND TRUE) - ENDIF(CMAKE_COMPILER_IS_GNUCXX) -ENDIF(MSVC) + ENDIF() +ENDIF() # Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs MACRO(PCH_SET_COMPILE_FLAGS _target) @@ -40,19 +40,21 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) GET_TARGET_PROPERTY(_targetType ${_target} TYPE) - IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + SET(_USE_PIC OFF) + + IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY") LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") - ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + ELSE() GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE) IF(_pic) - LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}") - ENDIF(_pic) - ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + SET(_USE_PIC ON) + ENDIF() + ENDIF() GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES) FOREACH(item ${DIRINC}) LIST(APPEND _FLAGS " -I\"${item}\"") - ENDFOREACH(item) + ENDFOREACH() # Required for CMake 2.6 SET(GLOBAL_DEFINITIONS) @@ -60,61 +62,123 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDFOREACH(item) - ENDIF(DEFINITIONS) + ENDFOREACH() + ENDIF() GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDFOREACH(item) - ENDIF(DEFINITIONS) + ENDFOREACH() + ENDIF() + + GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS) + IF(DEFINITIONS) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH() + ENDIF() + + GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD}) + IF(DEFINITIONS) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH() + ENDIF() GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS) IF(oldProps) LIST(APPEND _FLAGS " ${oldProps}") - ENDIF(oldProps) + ENDIF() GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD}) IF(oldPropsBuild) LIST(APPEND _FLAGS " ${oldPropsBuild}") - ENDIF(oldPropsBuild) + ENDIF() GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES) IF(DIRINC) FOREACH(item ${DIRINC}) LIST(APPEND _FLAGS " -I\"${item}\"") - ENDFOREACH(item) - ENDIF(DIRINC) + ENDFOREACH() + ENDIF() GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDFOREACH(item) - ENDIF(DEFINITIONS) + ENDFOREACH() + ENDIF() GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDFOREACH(item) - ENDIF(DEFINITIONS) + ENDFOREACH() + ENDIF() + + GET_TARGET_PROPERTY(_LIBS ${_target} INTERFACE_LINK_LIBRARIES) + IF(_LIBS) + FOREACH(_LIB ${_LIBS}) + IF(TARGET "${_LIB}") + # use same include directories + GET_TARGET_PROPERTY(_DIRS ${_LIB} INTERFACE_INCLUDE_DIRECTORIES) + + IF(_DIRS) + FOREACH(item ${_DIRS}) + LIST(APPEND GLOBAL_DEFINITIONS " -I\"${item}\"") + ENDFOREACH() + ENDIF() + + # use same compile definitions + GET_TARGET_PROPERTY(_DEFINITIONS ${_LIB} INTERFACE_COMPILE_DEFINITIONS) + + IF(_DEFINITIONS) + FOREACH(item ${_DEFINITIONS}) + # don't use dynamic expressions + IF(NOT item MATCHES "\\$<") + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDIF() + ENDFOREACH() + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() + + # Special Qt 5 cases + IF(GLOBAL_DEFINITIONS MATCHES "QT_CORE_LIB") + # Hack to define missing QT_NO_DEBUG with Qt 5.2 + IF(_UPPER_BUILD STREQUAL "RELEASE") + LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG") + ENDIF() + + # Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIC + IF(Qt5_POSITION_INDEPENDENT_CODE) + SET(_USE_PIC ON) + ENDIF() + + IF(_USE_PIC) + LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}") + ENDIF() + ENDIF() - GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) - GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}") - LIST(APPEND _FLAGS " ${_directory_flags}") - LIST(APPEND _FLAGS " ${_directory_definitions}") + + IF(CMAKE_VERSION VERSION_LESS "3.3.0") + GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) + GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) + LIST(APPEND _FLAGS " ${_directory_flags}") + LIST(APPEND _FLAGS " ${_directory_definitions}") + ENDIF() # Format definitions IF(MSVC) # Fix path with space SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}") - ELSE(MSVC) + ELSE() STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS}) SEPARATE_ARGUMENTS(_FLAGS) - ENDIF(MSVC) + ENDIF() IF(CLANG) # Determining all architectures and get common flags @@ -127,11 +191,11 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) LIST(APPEND PCH_ARCHS ${item}) STRING(TOUPPER "${item}" _UPPER_ARCH) SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item}) - ENDIF(ITEM_FOUND EQUAL -1) + ENDIF() SET(_ARCH_NEXT OFF) ELSEIF(_XARCH_NEXT) SET(_XARCH_NEXT OFF) - ELSE(_ARCH_NEXT) + ELSE() IF(item MATCHES "^-arch") SET(_ARCH_NEXT ON) ELSEIF(item MATCHES "^-Xarch_") @@ -141,13 +205,13 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) LIST(APPEND PCH_ARCHS ${item}) STRING(TOUPPER "${item}" _UPPER_ARCH) SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item}) - ENDIF(ITEM_FOUND EQUAL -1) + ENDIF() SET(_XARCH_NEXT ON) - ELSE(item MATCHES "^-arch") + ELSE() LIST(APPEND PCH_FLAGS ${item}) - ENDIF(item MATCHES "^-arch") - ENDIF(_ARCH_NEXT) - ENDFOREACH(item) + ENDIF() + ENDIF() + ENDFOREACH() # Get architcture specific flags SET(_XARCH_NEXT) @@ -156,25 +220,25 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH) LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item}) SET(_XARCH_NEXT OFF) - ELSE(_XARCH_NEXT) + ELSE() IF(item MATCHES "^-Xarch_") STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT) - ENDIF(item MATCHES "^-Xarch_") - ENDIF(_XARCH_NEXT) - ENDFOREACH(item) + ENDIF() + ENDIF() + ENDFOREACH() # Remove duplicated architectures IF(_ARCHS AND PCH_ARCHS) LIST(REMOVE_DUPLICATES PCH_ARCHS) - ENDIF(_ARCHS AND PCH_ARCHS) - ELSE(CLANG) + ENDIF() + ELSE() SET(PCH_FLAGS ${_FLAGS}) - ENDIF(CLANG) + ENDIF() IF(PCH_FLAGS) LIST(REMOVE_DUPLICATES PCH_FLAGS) - ENDIF(PCH_FLAGS) -ENDMACRO(PCH_SET_COMPILE_FLAGS) + ENDIF() +ENDMACRO() MACRO(GET_PDB_FILENAME _out_filename _target) # determine output directory based on target type @@ -201,9 +265,9 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS) IF(CMAKE_CXX_COMPILER_ARG1) # remove leading space in compiler argument STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1}) - ELSE(CMAKE_CXX_COMPILER_ARG1) + ELSE() SET(pchsupport_compiler_cxx_arg1 "") - ENDIF(CMAKE_CXX_COMPILER_ARG1) + ENDIF() IF(MSVC) GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target}) @@ -211,16 +275,16 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS) # Ninja PCH Support # http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj") - ELSE(MSVC) + ELSE() SET(HEADER_FORMAT "c++-header") SET(_FLAGS "") IF(APPLE) SET(HEADER_FORMAT "objective-${HEADER_FORMAT}") SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch) - ENDIF(APPLE) + ENDIF() SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT}) - ENDIF(MSVC) -ENDMACRO(PCH_SET_COMPILE_COMMAND) + ENDIF() +ENDMACRO() MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language) SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch") @@ -230,14 +294,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language) GET_FILENAME_COMPONENT(_name ${_input} NAME_WE) SET(PCH_INPUT ${_input}) SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch") - ELSE(MSVC) + ELSE() IF(NOT "${_arch}" STREQUAL "") SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}") - ENDIF(NOT "${_arch}" STREQUAL "") + ENDIF() IF(NOT "${_language}" STREQUAL "") SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}") - ENDIF(NOT "${_language}" STREQUAL "") + ENDIF() GET_FILENAME_COMPONENT(_name ${_input} NAME) @@ -251,14 +315,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language) IF(CLANG) SET(PCH_EXT "pth") - ELSE(CLANG) + ELSE() SET(PCH_EXT "gch") - ENDIF(CLANG) + ENDIF() # For GCC and Clang, PCH needs to be in the same directory as .h SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}") - ENDIF(MSVC) -ENDMACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT) + ENDIF() +ENDMACRO() # Add common flags MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) @@ -266,7 +330,7 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) IF(${oldProps} MATCHES NOTFOUND) SET(oldProps "") - ENDIF(${oldProps} MATCHES NOTFOUND) + ENDIF() IF(MSVC) SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"") @@ -279,17 +343,17 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS) IF(NOT _STATIC_LIBRARY_FLAGS) SET(_STATIC_LIBRARY_FLAGS) - ENDIF(NOT _STATIC_LIBRARY_FLAGS) + ENDIF() SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}") GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS) IF(NOT _LINK_FLAGS) SET(_LINK_FLAGS) - ENDIF(NOT _LINK_FLAGS) + ENDIF() SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}") SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS}) - ELSE(MSVC) + ELSE() # for use with distcc and gcc >4.0.1 if preprocessed files are accessible # on all remote machines set # PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess @@ -299,21 +363,21 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) # If no arch is specified, create common flags IF(PCH_ARCHS_COUNT LESS 2) SET(PCH_ADDITIONAL_COMPILER_FLAGS "-include ${PCH_INPUT} ${PCH_ADDITIONAL_COMPILER_FLAGS}") - ENDIF(PCH_ARCHS_COUNT LESS 2) + ENDIF() IF(APPLE) SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}") - ENDIF(APPLE) - + ENDIF() + IF(WITH_PCH_DEBUG) SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}") - ENDIF(WITH_PCH_DEBUG) + ENDIF() SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch") - ENDIF(MSVC) + ENDIF() SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags}) -ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET) +ENDMACRO() # Add specific flags for an arch MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch) @@ -324,19 +388,19 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch) IF(${_FLAGS} MATCHES NOTFOUND) SET(_FLAGS "") - ENDIF(${_FLAGS} MATCHES NOTFOUND) + ENDIF() SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}") SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS}) - ENDIF(PCH_ARCHS_COUNT GREATER 1) -ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH) + ENDIF() +ENDMACRO() MACRO(PCH_CREATE_TARGET _targetName _targetNamePCH) ADD_CUSTOM_COMMAND(OUTPUT ${PCH_OUTPUT} COMMAND ${PCH_COMMAND} COMMENT "Generating ${_targetNamePCH}" DEPENDS ${PCH_INPUT}) ADD_CUSTOM_TARGET(${_targetNamePCH} DEPENDS ${PCH_INPUT} ${PCH_OUTPUT}) ADD_DEPENDENCIES(${_targetName} ${_targetNamePCH}) -ENDMACRO(PCH_CREATE_TARGET _targetName _inputh _inputcpp) +ENDMACRO() MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) SET(_PCH_current_target ${_targetName}) @@ -346,7 +410,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) "This is the ADD_PRECOMPILED_HEADER macro. " "You must set CMAKE_BUILD_TYPE!" ) - ENDIF(NOT CMAKE_BUILD_TYPE) + ENDIF() PCH_SET_COMPILE_FLAGS(${_targetName}) @@ -362,68 +426,67 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH}) ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH}) - ENDFOREACH(_ARCH) - ELSE(PCH_ARCHS) + ENDFOREACH() + ELSE() PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "") LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT}) PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}") PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch) - ENDIF(PCH_ARCHS) + ENDIF() ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName}) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}") -ENDMACRO(ADD_PRECOMPILED_HEADER) +ENDMACRO() MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) - IF(NOT PCHSupport_FOUND) + IF(PCHSupport_FOUND) + # 0 => creating a new target for PCH, works for all makefiles + # 1 => setting PCH for VC++ project, works for VC++ projects + # 2 => setting PCH for XCode project, works for XCode projects + IF(CMAKE_GENERATOR MATCHES "Visual Studio") + SET(PCH_METHOD 1) + ELSEIF(CMAKE_GENERATOR MATCHES "Xcode") + SET(PCH_METHOD 2) + ELSE() + SET(PCH_METHOD 0) + ENDIF() + + IF(PCH_METHOD EQUAL 1) + # Auto include the precompile (useful for moc processing, since the use of + # precompiled is specified at the target level + # and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt) + + GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) + IF(${oldProps} MATCHES NOTFOUND) + SET(oldProps "") + ENDIF() + + SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"") + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}") + + #also inlude ${oldProps} to have the same compile options + SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"") + ELSEIF(PCH_METHOD EQUAL 2) + # For Xcode, cmake needs my patch to process + # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties + + # When buiding out of the tree, precompiled may not be located + # Use full path instead. + GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE) + + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}") + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") + ELSE() + #Fallback to the "old" precompiled suppport + ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) + ENDIF() + + IF(TARGET ${_targetName}_static) + ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp}) + ENDIF() + ELSE() MESSAGE(STATUS "PCH disabled because compiler doesn't support them") - RETURN() - ENDIF(NOT PCHSupport_FOUND) - - # 0 => creating a new target for PCH, works for all makefiles - # 1 => setting PCH for VC++ project, works for VC++ projects - # 2 => setting PCH for XCode project, works for XCode projects - IF(CMAKE_GENERATOR MATCHES "Visual Studio") - SET(PCH_METHOD 1) - ELSEIF(CMAKE_GENERATOR MATCHES "Xcode") - SET(PCH_METHOD 2) - ELSE(CMAKE_GENERATOR MATCHES "Visual Studio") - SET(PCH_METHOD 0) - ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio") - - IF(PCH_METHOD EQUAL 1) - # Auto include the precompile (useful for moc processing, since the use of - # precompiled is specified at the target level - # and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt) - - GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) - IF(${oldProps} MATCHES NOTFOUND) - SET(oldProps "") - ENDIF(${oldProps} MATCHES NOTFOUND) - - SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"") - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}") - - #also inlude ${oldProps} to have the same compile options - SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"") - ELSEIF(PCH_METHOD EQUAL 2) - # For Xcode, cmake needs my patch to process - # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties - - # When buiding out of the tree, precompiled may not be located - # Use full path instead. - GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE) - - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}") - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") - ELSE(PCH_METHOD EQUAL 1) - #Fallback to the "old" precompiled suppport - ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) - ENDIF(PCH_METHOD EQUAL 1) - - IF(TARGET ${_targetName}_static) - ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp}) - ENDIF(TARGET ${_targetName}_static) -ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER) + ENDIF() +ENDMACRO() diff --git a/code/CMakeModules/iOSToolChain.cmake b/code/CMakeModules/iOSToolChain.cmake index 5b419778e..bccfc0236 100644 --- a/code/CMakeModules/iOSToolChain.cmake +++ b/code/CMakeModules/iOSToolChain.cmake @@ -40,48 +40,67 @@ include (CMakeForceCompiler) CMAKE_FORCE_C_COMPILER (clang Clang) CMAKE_FORCE_CXX_COMPILER (clang++ Clang) +IF(CMAKE_CXX_COMPILER) + EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version + OUTPUT_VARIABLE CLANG_VERSION_RAW + OUTPUT_STRIP_TRAILING_WHITESPACE) + + STRING(REGEX REPLACE "Apple LLVM version ([\\.0-9]+).*" + "\\1" CMAKE_CXX_COMPILER_VERSION "${CLANG_VERSION_RAW}") + + SET(CMAKE_C_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) + SET(CMAKE_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) +ENDIF() + # Setup iOS platform -if (NOT DEFINED IOS_PLATFORM) - set (IOS_PLATFORM "OS") -endif (NOT DEFINED IOS_PLATFORM) -set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform") +IF(NOT DEFINED IOS_PLATFORM) + SET(IOS_PLATFORM "OS") +ENDIF() + +SET(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform") SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform") SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform") # Check the platform selection and setup for developer root -if (${IOS_PLATFORM} STREQUAL "OS") +if(${IOS_PLATFORM} STREQUAL "OS") # This causes the installers to properly locate the output libraries set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos") -elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR") +elseif(${IOS_PLATFORM} STREQUAL "SIMULATOR") # This causes the installers to properly locate the output libraries set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator") -elseif (${IOS_PLATFORM} STREQUAL "ALL") +elseif(${IOS_PLATFORM} STREQUAL "ALL") # This causes the installers to properly locate the output libraries set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos") -else (${IOS_PLATFORM} STREQUAL "OS") +else() message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR") -endif (${IOS_PLATFORM} STREQUAL "OS") +endif() set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform") # Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT # Note Xcode 4.3 changed the installation location, choose the most recent one available -SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms") -SET(XCODE_PRE_43_ROOT "/Developer/Platforms") +SET(XCODE_DEFAULT_ROOT "/Applications/Xcode.app/Contents") IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) - IF(EXISTS ${XCODE_POST_43_ROOT}) - SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT}) - ELSEIF(EXISTS ${XCODE_PRE_43_ROOT}) - SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT}) - ENDIF(EXISTS ${XCODE_POST_43_ROOT}) - IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) - SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) - ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) - IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) - SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) - ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) -ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) + IF(NOT DEFINED CMAKE_XCODE_ROOT) + IF(EXISTS ${XCODE_DEFAULT_ROOT}) + SET(CMAKE_XCODE_ROOT ${XCODE_DEFAULT_ROOT} CACHE STRING "Xcode root") + ELSE() + MESSAGE(FATAL_ERROR "Xcode directory ${XCODE_DEFAULT_ROOT} doesn't exist") + ENDIF() + ENDIF() + SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer) + IF(EXISTS ${TMP}) + SET(CMAKE_IOS_DEVELOPER_ROOT ${TMP}) + MESSAGE(STATUS "Use iOS developer root: ${CMAKE_IOS_DEVELOPER_ROOT}") + ENDIF() + SET(TMP ${CMAKE_XCODE_ROOT}/Developer/Platforms/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) + IF(EXISTS ${TMP}) + SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${TMP}) + MESSAGE(STATUS "Use iOS simulator developer root: ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}") + ENDIF() +ENDIF() + SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform") SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform") @@ -93,36 +112,36 @@ MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS) FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS}) STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}") LIST(APPEND ${VERSIONS} ${_IOS_SDK}) - ENDFOREACH(_CMAKE_IOS_SDK) - ENDIF(_CMAKE_IOS_SDKS) -ENDMACRO(GET_AVAILABLE_SDK_VERSIONS) + ENDFOREACH() + ENDIF() +ENDMACRO() -# Find and use the most recent iOS sdk +# Find and use the most recent iOS sdk IF(NOT DEFINED CMAKE_IOS_SDK_ROOT) # Search for a specific version of a SDK GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} IOS_VERSIONS) IF(NOT IOS_VERSIONS) MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.") - ENDIF(NOT IOS_VERSIONS) - + ENDIF() + IF(IOS_VERSION) LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX) IF(_INDEX EQUAL -1) LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION) - ELSE(_INDEX EQUAL -1) + ELSE() SET(IOS_SDK_VERSION ${IOS_VERSION}) - ENDIF(_INDEX EQUAL -1) - ELSE(IOS_VERSION) + ENDIF() + ELSE() LIST(GET IOS_VERSIONS 0 IOS_VERSION) SET(IOS_SDK_VERSION ${IOS_VERSION}) - ENDIF(IOS_VERSION) + ENDIF() MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}") SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk) SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk) -endif (NOT DEFINED CMAKE_IOS_SDK_ROOT) +endif() SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK") SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK") @@ -134,31 +153,32 @@ SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS sup SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support") IF(CMAKE_GENERATOR MATCHES Xcode) - SET(ARCHS "$(ARCHS_STANDARD_32_BIT)") IF(${IOS_PLATFORM} STREQUAL "OS") SET(CMAKE_SYSTEM_PROCESSOR "armv7") ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") SET(CMAKE_SYSTEM_PROCESSOR "x86") ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") SET(CMAKE_SYSTEM_PROCESSOR "armv7") - ENDIF(${IOS_PLATFORM} STREQUAL "OS") -ELSE(CMAKE_GENERATOR MATCHES Xcode) + ENDIF() +ELSE() IF(${IOS_PLATFORM} STREQUAL "OS") - SET(ARCHS "armv7") + SET(ARCHS "armv7;arm64") SET(CMAKE_SYSTEM_PROCESSOR "armv7") ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") # iPhone simulator targets i386 SET(ARCHS "i386") SET(CMAKE_SYSTEM_PROCESSOR "x86") ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") - SET(ARCHS "armv7;i386") + SET(ARCHS "armv7;arm64;i386;x86_64") SET(CMAKE_SYSTEM_PROCESSOR "armv7") - ENDIF(${IOS_PLATFORM} STREQUAL "OS") -ENDIF(CMAKE_GENERATOR MATCHES Xcode) + ENDIF() +ENDIF() -# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard. +# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard. # The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only -set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS") +IF(ARCHS) + SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS") +ENDIF() # Set the find root to the iOS developer roots and to user defined paths set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root") @@ -174,10 +194,9 @@ set (CMAKE_SYSTEM_FRAMEWORK_PATH ) # only search the iOS sdks, not the remainder of the host filesystem -set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include) -#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib) -#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin) +# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH +include(CMakeFindBinUtils) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 0bdd83cda..ab1e2a78c 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -20,60 +20,6 @@ MACRO(NL_GEN_PC name) ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) ENDMACRO(NL_GEN_PC) -### -# Helper macro that generates revision.h from revision.h.in -### -MACRO(NL_GEN_REVISION_H) - IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in) - SET(TOOL_FOUND OFF) - - IF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/") - FIND_PACKAGE(Subversion) - - IF(SUBVERSION_FOUND) - SET(TOOL_FOUND ON) - ENDIF(SUBVERSION_FOUND) - ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/") - - IF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/") - FIND_PACKAGE(Mercurial) - - IF(MERCURIAL_FOUND) - SET(TOOL_FOUND ON) - ENDIF(MERCURIAL_FOUND) - ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/") - - # if already generated - IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h) - # copy it - MESSAGE(STATUS "Copying provided revision.h...") - FILE(COPY ${CMAKE_SOURCE_DIR}/revision.h DESTINATION ${CMAKE_BINARY_DIR}) - SET(HAVE_REVISION_H ON) - ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h) - - IF(TOOL_FOUND) - # a custom target that is always built - ADD_CUSTOM_TARGET(revision ALL - COMMAND ${CMAKE_COMMAND} - -DSOURCE_DIR=${CMAKE_SOURCE_DIR} - -DROOT_DIR=${CMAKE_SOURCE_DIR}/.. - -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/CMakeModules - -P ${CMAKE_SOURCE_DIR}/CMakeModules/GetRevision.cmake) - - # revision.h is a generated file - SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/revision.h - PROPERTIES GENERATED TRUE - HEADER_FILE_ONLY TRUE) - SET(HAVE_REVISION_H ON) - ENDIF(TOOL_FOUND) - - IF(HAVE_REVISION_H) - INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) - ADD_DEFINITIONS(-DHAVE_REVISION_H) - ENDIF(HAVE_REVISION_H) - ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in) -ENDMACRO(NL_GEN_REVISION_H) - ### # ### @@ -102,10 +48,10 @@ ENDMACRO(NL_TARGET_DRIVER) # Argument: ### MACRO(NL_DEFAULT_PROPS name label) - IF(HAVE_REVISION_H) + IF(TARGET revision) # explicitly say that the target depends on revision.h ADD_DEPENDENCIES(${name} revision) - ENDIF(HAVE_REVISION_H) + ENDIF() # Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name. # CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819 @@ -243,13 +189,14 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) IF(WITH_QT) OPTION(WITH_STUDIO "Build Core Studio" OFF ) ENDIF(WITH_QT) - + ### # Features ### OPTION(WITH_LOGGING "With Logging" ON ) OPTION(WITH_COVERAGE "With Code Coverage Support" OFF) OPTION(WITH_PCH "With Precompiled Headers" ON ) + OPTION(WITH_LOW_MEMORY "With low memory (use the least of RAM)" OFF) OPTION(FINAL_VERSION "Build in Final Version mode" ON ) # Default to static building on Windows. @@ -280,13 +227,21 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) OPTION(WITH_EXTERNAL "With provided external." OFF) ENDIF(WIN32) OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF) + IF(UNIX AND NOT APPLE) + OPTION(WITH_UNIX_STRUCTURE "Use UNIX structure (bin, include, lib)" ON ) + ELSE() + OPTION(WITH_UNIX_STRUCTURE "Use UNIX structure (bin, include, lib)" OFF) + ENDIF() OPTION(WITH_INSTALL_LIBRARIES "Install development files." ON ) + OPTION(WITH_ASSIMP "Use assimp exporter" OFF) + ### # GUI toolkits ### OPTION(WITH_GTK "With GTK Support" OFF) - OPTION(WITH_QT "With QT Support" OFF) + OPTION(WITH_QT "With Qt 4 Support" OFF) + OPTION(WITH_QT5 "With Qt 5 Support" OFF) IF(WIN32 AND MFC_FOUND) OPTION(WITH_MFC "With MFC Support" ON ) @@ -311,6 +266,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) OPTION(WITH_NELNS "Build NeL Network Services." OFF) OPTION(WITH_RYZOM "Build Ryzom Core." ON ) OPTION(WITH_SNOWBALLS "Build Snowballs." OFF) + OPTION(WITH_TOOLS "Build Tools" OFF) ENDMACRO(NL_SETUP_DEFAULT_OPTIONS) MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) @@ -350,10 +306,10 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) OPTION(WITH_LIBOVR "With LibOVR support" OFF) OPTION(WITH_LIBVR "With LibVR support" OFF) OPTION(WITH_PERFHUD "With NVIDIA PerfHUD support" OFF) - + OPTION(WITH_SSE2 "With SSE2" ON ) OPTION(WITH_SSE3 "With SSE3" ON ) - + IF(NOT MSVC) OPTION(WITH_GCC_FPMATH_BOTH "With GCC -mfpmath=both" OFF) ENDIF(NOT MSVC) @@ -375,14 +331,16 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) OPTION(WITH_RYZOM_TOOLS "Build Ryzom Core Tools" ON ) OPTION(WITH_RYZOM_SERVER "Build Ryzom Core Services" ON ) OPTION(WITH_RYZOM_SOUND "Enable Ryzom Core Sound" ON ) - OPTION(WITH_RYZOM_PATCH "Enable Ryzom in-game patch support" OFF) ### # Optional support ### OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON ) OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF) + OPTION(WITH_LUA53 "Build Ryzom Core using Lua 5.3" OFF) OPTION(WITH_RYZOM_CLIENT_UAC "Ask to run as Administrator" OFF) + OPTION(WITH_RYZOM_PATCH "Enable Ryzom in-game patch support" OFF) + OPTION(WITH_RYZOM_CUSTOM_PATCH_SERVER "Only use patch server from CFG file" OFF) ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) @@ -426,7 +384,7 @@ MACRO(NL_SETUP_BUILD) ELSEIF(HOST_CPU MATCHES "i.86") SET(HOST_CPU "x86") ENDIF(HOST_CPU MATCHES "(amd|AMD)64") - + # Determine target CPU # If not specified, use the same CPU as host @@ -577,7 +535,13 @@ MACRO(NL_SETUP_BUILD) # Ignore default include paths ADD_PLATFORM_FLAGS("/X") - IF(MSVC12) + IF(MSVC14) + ADD_PLATFORM_FLAGS("/Gy- /MP") + # /Ox is working with VC++ 2015, but custom optimizations don't exist + SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") + # without inlining it's unusable, use custom optimizations again + SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") + ELSEIF(MSVC12) ADD_PLATFORM_FLAGS("/Gy- /MP") # /Ox is working with VC++ 2013, but custom optimizations don't exist SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") @@ -609,7 +573,7 @@ MACRO(NL_SETUP_BUILD) SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}") ELSE(MSVC12) MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") - ENDIF(MSVC12) + ENDIF(MSVC14) ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250") @@ -861,7 +825,11 @@ MACRO(NL_SETUP_BUILD) ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") ENDIF(APPLE) - ADD_PLATFORM_FLAGS("-D_REENTRANT -pipe -fno-strict-aliasing") + ADD_PLATFORM_FLAGS("-D_REENTRANT -fno-strict-aliasing") + + IF(NOT WITH_LOW_MEMORY) + ADD_PLATFORM_FLAGS("-pipe") + ENDIF() IF(WITH_COVERAGE) ADD_PLATFORM_FLAGS("-fprofile-arcs -ftest-coverage") @@ -869,11 +837,6 @@ MACRO(NL_SETUP_BUILD) IF(WITH_WARNINGS) ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused") - IF(CLANG) - ADD_PLATFORM_FLAGS("-std=gnu99") - ELSE(CLANG) - ADD_PLATFORM_FLAGS("-ansi") - ENDIF(CLANG) ENDIF(WITH_WARNINGS) IF(ANDROID) @@ -972,141 +935,140 @@ ENDMACRO(NL_SETUP_BUILD_FLAGS) MACRO(NL_MAKE_ABSOLUTE_PREFIX NAME_RELATIVE NAME_ABSOLUTE) IF(IS_ABSOLUTE "${${NAME_RELATIVE}}") SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}}) - ELSE(IS_ABSOLUTE "${${NAME_RELATIVE}}") - IF(WIN32) - SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}}) - ELSE(WIN32) + ELSE() + IF(WITH_UNIX_STRUCTURE) SET(${NAME_ABSOLUTE} ${CMAKE_INSTALL_PREFIX}/${${NAME_RELATIVE}}) - ENDIF(WIN32) + ELSE() + SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}}) + ENDIF() ENDIF(IS_ABSOLUTE "${${NAME_RELATIVE}}") ENDMACRO(NL_MAKE_ABSOLUTE_PREFIX) MACRO(NL_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/etc path. IF(NOT NL_ETC_PREFIX) - IF(WIN32) - SET(NL_ETC_PREFIX "." CACHE PATH "Installation path for configurations") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) SET(NL_ETC_PREFIX "etc/nel" CACHE PATH "Installation path for configurations") - ENDIF(WIN32) - ENDIF(NOT NL_ETC_PREFIX) + ELSE() + SET(NL_ETC_PREFIX "." CACHE PATH "Installation path for configurations") + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(NL_ETC_PREFIX NL_ETC_ABSOLUTE_PREFIX) ## Allow override of install_prefix/share path. IF(NOT NL_SHARE_PREFIX) - IF(WIN32) - SET(NL_SHARE_PREFIX "." CACHE PATH "Installation path for data.") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) SET(NL_SHARE_PREFIX "share/nel" CACHE PATH "Installation path for data.") - ENDIF(WIN32) - ENDIF(NOT NL_SHARE_PREFIX) + ELSE() + SET(NL_SHARE_PREFIX "." CACHE PATH "Installation path for data.") + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(NL_SHARE_PREFIX NL_SHARE_ABSOLUTE_PREFIX) ## Allow override of install_prefix/sbin path. IF(NOT NL_SBIN_PREFIX) - IF(WIN32) - SET(NL_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) SET(NL_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.") - ENDIF(WIN32) - ENDIF(NOT NL_SBIN_PREFIX) + ELSE() + SET(NL_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(NL_SBIN_PREFIX NL_SBIN_ABSOLUTE_PREFIX) ## Allow override of install_prefix/bin path. IF(NOT NL_BIN_PREFIX) - IF(WIN32) - SET(NL_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) SET(NL_BIN_PREFIX "bin" CACHE PATH "Installation path for tools and applications.") - ENDIF(WIN32) - ENDIF(NOT NL_BIN_PREFIX) + ELSE() + SET(NL_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(NL_BIN_PREFIX NL_BIN_ABSOLUTE_PREFIX) ## Allow override of install_prefix/lib path. IF(NOT NL_LIB_PREFIX) IF(LIBRARY_ARCHITECTURE) SET(NL_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") - ELSE(LIBRARY_ARCHITECTURE) + ELSE() SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") - ENDIF(LIBRARY_ARCHITECTURE) - ENDIF(NOT NL_LIB_PREFIX) + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX) ## Allow override of install_prefix/lib path. IF(NOT NL_DRIVER_PREFIX) - IF(WIN32) - SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) IF(LIBRARY_ARCHITECTURE) SET(NL_DRIVER_PREFIX "lib/${LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.") - ELSE(LIBRARY_ARCHITECTURE) + ELSE() SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.") - ENDIF(LIBRARY_ARCHITECTURE) - ENDIF(WIN32) - ENDIF(NOT NL_DRIVER_PREFIX) + ENDIF() + ELSE() + SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.") + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(NL_DRIVER_PREFIX NL_DRIVER_ABSOLUTE_PREFIX) - ENDMACRO(NL_SETUP_PREFIX_PATHS) MACRO(RYZOM_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/etc path. IF(NOT RYZOM_ETC_PREFIX) - IF(WIN32) - SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) SET(RYZOM_ETC_PREFIX "etc/ryzom" CACHE PATH "Installation path for configurations") - ENDIF(WIN32) + ELSE() + SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations") + ENDIF() ENDIF(NOT RYZOM_ETC_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(RYZOM_ETC_PREFIX RYZOM_ETC_ABSOLUTE_PREFIX) ## Allow override of install_prefix/share path. IF(NOT RYZOM_SHARE_PREFIX) - IF(WIN32) - SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) SET(RYZOM_SHARE_PREFIX "share/ryzom" CACHE PATH "Installation path for data.") - ENDIF(WIN32) - ENDIF(NOT RYZOM_SHARE_PREFIX) + ELSE() + SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.") + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(RYZOM_SHARE_PREFIX RYZOM_SHARE_ABSOLUTE_PREFIX) ## Allow override of install_prefix/sbin path. IF(NOT RYZOM_SBIN_PREFIX) - IF(WIN32) - SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) SET(RYZOM_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.") - ENDIF(WIN32) - ENDIF(NOT RYZOM_SBIN_PREFIX) + ELSE() + SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(RYZOM_SBIN_PREFIX RYZOM_SBIN_ABSOLUTE_PREFIX) ## Allow override of install_prefix/bin path. IF(NOT RYZOM_BIN_PREFIX) - IF(WIN32) - SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) SET(RYZOM_BIN_PREFIX "bin" CACHE PATH "Installation path for tools.") - ENDIF(WIN32) - ENDIF(NOT RYZOM_BIN_PREFIX) + ELSE() + SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(RYZOM_BIN_PREFIX RYZOM_BIN_ABSOLUTE_PREFIX) ## Allow override of install_prefix/lib path. IF(NOT RYZOM_LIB_PREFIX) IF(LIBRARY_ARCHITECTURE) SET(RYZOM_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") - ELSE(LIBRARY_ARCHITECTURE) + ELSE() SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") - ENDIF(LIBRARY_ARCHITECTURE) + ENDIF() ENDIF(NOT RYZOM_LIB_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX) ## Allow override of install_prefix/games path. IF(NOT RYZOM_GAMES_PREFIX) - IF(WIN32) - SET(RYZOM_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.") - ELSE(WIN32) + IF(WITH_UNIX_STRUCTURE) SET(RYZOM_GAMES_PREFIX "games" CACHE PATH "Installation path for client.") - ENDIF(WIN32) - ENDIF(NOT RYZOM_GAMES_PREFIX) + ELSE() + SET(RYZOM_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.") + ENDIF() + ENDIF() NL_MAKE_ABSOLUTE_PREFIX(RYZOM_GAMES_PREFIX RYZOM_GAMES_ABSOLUTE_PREFIX) ENDMACRO(RYZOM_SETUP_PREFIX_PATHS) @@ -1130,19 +1092,19 @@ MACRO(SETUP_EXTERNAL) IF(APPLE) IF(WITH_STATIC_EXTERNAL) SET(CMAKE_FIND_LIBRARY_SUFFIXES .a) - ELSE(WITH_STATIC_EXTERNAL) + ELSE() SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a) - ENDIF(WITH_STATIC_EXTERNAL) + ENDIF() ELSE(APPLE) IF(WITH_STATIC_EXTERNAL) SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .so) - ELSE(WITH_STATIC_EXTERNAL) + ELSE() SET(CMAKE_FIND_LIBRARY_SUFFIXES .so .a) - ENDIF(WITH_STATIC_EXTERNAL) + ENDIF() ENDIF(APPLE) ENDIF(WIN32) - # Android and iOS have pthread + # Android and iOS have pthread IF(ANDROID OR IOS) SET(CMAKE_USE_PTHREADS_INIT 1) SET(Threads_FOUND TRUE) @@ -1156,6 +1118,14 @@ MACRO(SETUP_EXTERNAL) INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) ENDIF(WITH_STLPORT) + IF(WIN32) + # Must include DXSDK before WINSDK + FIND_PACKAGE(DirectXSDK REQUIRED) + # IF(DXSDK_INCLUDE_DIR) + # INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) + # ENDIF() + ENDIF(WIN32) + IF(MSVC) FIND_PACKAGE(MSVC REQUIRED) FIND_PACKAGE(WindowsSDK REQUIRED) diff --git a/code/config.h.cmake b/code/config.h.cmake index d3c9f701d..69171cf68 100644 --- a/code/config.h.cmake +++ b/code/config.h.cmake @@ -1,39 +1,6 @@ #ifndef CONFIG_H #define CONFIG_H -#cmakedefine HAVE_DL_H 1 -#cmakedefine HAVE_EXECINFO_H 1 -#cmakedefine HAVE_ICONV 1 -#cmakedefine HAVE_INTTYPES_H 1 -#cmakedefine HAVE_LANGINFO_CODESET 1 -#cmakedefine HAVE_LIMITS_H 1 -#cmakedefine HAVE_MALLOC_H 1 -#cmakedefine HAVE_PAM_MISC_H 1 -#cmakedefine HAVE_PAM_PAM_APPL_H 1 -#cmakedefine HAVE_PTHREAD 1 -#cmakedefine HAVE_SECURITY_PAM_APPL_H 1 -#cmakedefine HAVE_SECURITY_PAM_MISC_H 1 -#cmakedefine HAVE_STDINT_H 1 -#cmakedefine HAVE_SYS_MOUNT_H 1 -#cmakedefine HAVE_SYS_PARAM_H 1 -#cmakedefine HAVE_SYS_STATVFS_H 1 -#cmakedefine HAVE_SYS_TYPES_H 1 -#cmakedefine HAVE_UNISTD_H 1 -#cmakedefine HAVE_UTIME_H 1 -#cmakedefine HAVE_WCHAR_H 1 - -#cmakedefine HAVE_BACKTRACE 1 -#cmakedefine HAVE_INET_NTOA 1 -#cmakedefine HAVE_INET_NTOP 1 -#cmakedefine HAVE_INET_PTON 1 -#cmakedefine HAVE_STRERROR 1 -#cmakedefine HAVE_STRLCAT 1 -#cmakedefine HAVE_STRPTIME 1 -#cmakedefine HAVE_STRTOK_R 1 -#cmakedefine HAVE_STRTOULL 1 -#cmakedefine HAVE_STATVFS 1 -#cmakedefine HAVE_STAT64 1 - #cmakedefine NL_OPENGL_AVAILABLE ${NL_OPENGL_AVAILABLE} #cmakedefine NL_OPENGLES_AVAILABLE ${NL_OPENGLES_AVAILABLE} #cmakedefine NL_DIRECT3D_AVAILABLE ${NL_DIRECT3D_AVAILABLE} @@ -43,6 +10,8 @@ #cmakedefine NL_DSOUND_AVAILABLE ${NL_DSOUND_AVAILABLE} #cmakedefine NL_XAUDIO2_AVAILABLE ${NL_XAUDIO2_AVAILABLE} +#cmakedefine NL_STEREO_AVAILABLE ${NL_STEREO_AVAILABLE} + #cmakedefine NL_BIN_PREFIX "${NL_BIN_ABSOLUTE_PREFIX}" #cmakedefine NL_ETC_PREFIX "${NL_ETC_ABSOLUTE_PREFIX}" #cmakedefine NL_SHARE_PREFIX "${NL_SHARE_ABSOLUTE_PREFIX}" @@ -53,4 +22,18 @@ #cmakedefine RYZOM_ETC_PREFIX "${RYZOM_ETC_ABSOLUTE_PREFIX}" #cmakedefine RYZOM_SHARE_PREFIX "${RYZOM_SHARE_ABSOLUTE_PREFIX}" +#cmakedefine REVISION "${REVISION}" +#cmakedefine BUILD_DATE "${BUILD_DATE}" + +#cmakedefine NL_VERSION "${NL_VERSION}" +#cmakedefine NL_VERSION_RC ${NL_VERSION_RC} + +#cmakedefine RYZOM_VERSION "${RYZOM_VERSION}" +#cmakedefine RYZOM_VERSION_RC ${RYZOM_VERSION_RC} +#cmakedefine AUTHOR "${AUTHOR}" +#cmakedefine YEAR "${YEAR}" +#cmakedefine COPYRIGHT "${COPYRIGHT}" + +#cmakedefine RYZOM_CLIENT_ICON "${RYZOM_CLIENT_ICON}" + #endif // CONFIG_H diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index 16a8166fe..b538feb4d 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -4,11 +4,7 @@ IF(WITH_STATIC_DRIVERS) ADD_DEFINITIONS(-DNL_STATIC) ENDIF(WITH_STATIC_DRIVERS) -# On Windows we need to find DirectInput for NLMISC. -# This is how we get events. IF(WIN32) - FIND_PACKAGE(DirectXSDK REQUIRED) - # On Win32 we can also build the MAX plugins. IF(WITH_NEL_MAXPLUGIN) FIND_PACKAGE(3dsMaxSDK) @@ -68,18 +64,12 @@ IF(WITH_INSTALL_LIBRARIES) ENDIF(UNIX) ADD_SUBDIRECTORY(include) -ENDIF(WITH_INSTALL_LIBRARIES) +ENDIF() ADD_SUBDIRECTORY(src) IF(WITH_NEL_SAMPLES) ADD_SUBDIRECTORY(samples) -ENDIF(WITH_NEL_SAMPLES) - -# Allow to compile only max plugins without other tools. -IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) - IF(WITH_NEL_TOOLS) - FIND_PACKAGE(Squish) - ENDIF(WITH_NEL_TOOLS) - ADD_SUBDIRECTORY(tools) -ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) +ENDIF() + +ADD_SUBDIRECTORY(tools) diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index c4cc93106..a14bd3d6c 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -415,6 +415,16 @@ public: */ virtual void setAnisotropicFilter(sint filter) = 0; + /** + * Get current anisotropic filter value + */ + virtual uint getAnisotropicFilter() const = 0; + + /** + * Get maximum anisotropic filter value + */ + virtual uint getAnisotropicFilterMaximum() const = 0; + /** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..) * to be divided by Divisor (2, 4, 8...) * Default is 1. @@ -855,6 +865,12 @@ public: * get the official name of the driver */ virtual const char *getVideocardInformation () = 0; + + /** + * Get total video memory. + * get the amount of video memory of current adapter, result is in KiB, -1 if unable to determine + */ + virtual sint getTotalVideoMemory () const = 0; // @} @@ -1332,6 +1348,7 @@ public: uint32 DeviceId; uint32 SubSysId; uint32 Revision; + sint32 VideoMemory; // video memory in KiB, -1 if unable to determine }; // Get the number of hardware renderer available on the client platform. diff --git a/code/nel/include/nel/3d/driver_user.h b/code/nel/include/nel/3d/driver_user.h index f1e1fad84..62c6fd6db 100644 --- a/code/nel/include/nel/3d/driver_user.h +++ b/code/nel/include/nel/3d/driver_user.h @@ -412,6 +412,7 @@ public: virtual uint32 getImplementationVersion () const; virtual const char* getDriverInformation (); virtual const char* getVideocardInformation (); + virtual sint getTotalVideoMemory () const; virtual uint getNbTextureStages(); virtual void getWindowSize (uint32 &width, uint32 &height); virtual uint getWindowWidth (); @@ -474,6 +475,8 @@ public: virtual TPolygonMode getPolygonMode (); virtual void forceDXTCCompression(bool dxtcComp); virtual void setAnisotropicFilter(sint filter); + virtual uint getAnisotropicFilter() const; + virtual uint getAnisotropicFilterMaximum() const; virtual void forceTextureResize(uint divisor); virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties); // @} diff --git a/code/nel/include/nel/3d/font_generator.h b/code/nel/include/nel/3d/font_generator.h index 36dbf309a..5a07733a0 100644 --- a/code/nel/include/nel/3d/font_generator.h +++ b/code/nel/include/nel/3d/font_generator.h @@ -54,11 +54,13 @@ public: /** generate and return a bitmap * \param c the unicode char * \param size size of the generated font in ??? format + * \param embolden set embolden style (bold) + * \param oblique set oblique style (slanted, italic) * \param width width of the generated bitmap, this value is set by this function * \param height height of the generated bitmap, this value is set by this function * \param pitch pitch of the generated bitmap (+ or - the number of bytes per row), this value is set by this function */ - uint8 *getBitmap (ucchar c, uint32 size, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex); + uint8 *getBitmap (ucchar c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex); /** returns the width and height of a character using a specific size and * diff --git a/code/nel/include/nel/3d/font_manager.h b/code/nel/include/nel/3d/font_manager.h index 41bb935e5..26ea02ce0 100644 --- a/code/nel/include/nel/3d/font_manager.h +++ b/code/nel/include/nel/3d/font_manager.h @@ -102,6 +102,8 @@ public: * \param fontGen font generator * \param color primitive blocks color * \param fontSize font size + * \param embolden font style bold + * \param oblique font style slanted (italic) * \param desc display descriptor (screen size, font ratio) * \param output computed string * \param keep800x600Ratio true if you want that CFontManager look at Driver window size, and resize fontSize so it keeps same size... @@ -110,6 +112,8 @@ public: CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, + bool embolden, + bool oblique, IDriver *driver, CComputedString& output, bool keep800x600Ratio= true); @@ -121,6 +125,8 @@ public: CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, + bool embolden, + bool oblique, IDriver *driver, CComputedString &output, bool keep800x600Ratio= true); @@ -132,6 +138,8 @@ public: CFontGenerator *fontGen, const NLMISC::CRGBA &color, uint32 fontSize, + bool embolden, + bool oblique, IDriver *driver, CComputedString &output, bool keep800x600Ratio= true); diff --git a/code/nel/include/nel/3d/index_buffer.h b/code/nel/include/nel/3d/index_buffer.h index d5872f5e9..3d9c289ee 100644 --- a/code/nel/include/nel/3d/index_buffer.h +++ b/code/nel/include/nel/3d/index_buffer.h @@ -429,7 +429,7 @@ private: void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);} // Force non resident memory - void restaureNonResidentMemory(); + void restoreNonResidentMemory(); // Convert current index to a serializable vector void buildSerialVector(std::vector &dest) const; diff --git a/code/nel/include/nel/3d/particle_system.h b/code/nel/include/nel/3d/particle_system.h index 68f67ae6d..7255cfec9 100644 --- a/code/nel/include/nel/3d/particle_system.h +++ b/code/nel/include/nel/3d/particle_system.h @@ -992,8 +992,8 @@ public: * NB : the system should be restarted for this to work correctly * The default is true */ - void enableEmitThreshold(bool enabled = true) { _EmitThreshold = enabled; } - bool isEmitThresholdEnabled() const { return _EmitThreshold; } + void enableEmitThreshold(bool enabled = true) { _EmitThreshold = enabled; } + bool isEmitThresholdEnabled() const { return _EmitThreshold; } // activate // deactivate all emitters in the system void activateEmitters(bool active); diff --git a/code/nel/include/nel/3d/text_context.h b/code/nel/include/nel/3d/text_context.h index 8cf7ad7f0..156ea9f79 100644 --- a/code/nel/include/nel/3d/text_context.h +++ b/code/nel/include/nel/3d/text_context.h @@ -74,6 +74,10 @@ public: void setFontSize (uint32 fontSize) { _FontSize = fontSize; } + void setEmbolden (bool b) { _Embolden = b; } + + void setOblique (bool b) { _Oblique = b; } + void setHotSpot (CComputedString::THotSpot hotSpot) { _HotSpot = hotSpot; } void setScaleX (float scaleX) { _ScaleX = scaleX; } @@ -101,6 +105,10 @@ public: uint32 getFontSize () const { return _FontSize; } + bool getEmbolden () const { return _Embolden; } + + bool getOblique () const { return _Oblique; } + CComputedString::THotSpot getHotSpot() const { return _HotSpot; } float getScaleX() const { return _ScaleX; } @@ -240,7 +248,7 @@ public: nlassert(_FontGen); // compute the string just one time - _FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio); + _FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, _TempString, _Keep800x600Ratio); // draw shaded if (_Shaded) @@ -279,7 +287,7 @@ public: // compute the string just one time char *str; NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize); - _FontManager->computeString (str, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio); + _FontManager->computeString (str, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, _TempString, _Keep800x600Ratio); // draw shaded if (_Shaded) @@ -334,7 +342,7 @@ public: */ void computeString (const std::string& s, CComputedString& output) { - _FontManager->computeString (s, _FontGen, _Color, _FontSize, _Driver, output, _Keep800x600Ratio); + _FontManager->computeString (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio); } /** @@ -345,12 +353,12 @@ public: */ void computeString (const ucstring& s, CComputedString& output) { - _FontManager->computeString (s, _FontGen, _Color, _FontSize, _Driver, output, _Keep800x600Ratio); + _FontManager->computeString (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio); } void computeStringInfo (const ucstring& s, CComputedString& output) { - _FontManager->computeStringInfo (s, _FontGen, _Color, _FontSize, _Driver, output, _Keep800x600Ratio); + _FontManager->computeStringInfo (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio); } /// Debug : write to the disk the texture cache @@ -381,6 +389,10 @@ private: /// Font size; uint32 _FontSize; + bool _Embolden; + + bool _Oblique; + /// Current text color NLMISC::CRGBA _Color; diff --git a/code/nel/include/nel/3d/text_context_user.h b/code/nel/include/nel/3d/text_context_user.h index 8e14dc878..b05238dbf 100644 --- a/code/nel/include/nel/3d/text_context_user.h +++ b/code/nel/include/nel/3d/text_context_user.h @@ -66,6 +66,10 @@ public: void setColor(NLMISC::CRGBA color); void setFontSize(uint32 fontSize); uint32 getFontSize() const; + void setEmbolden(bool b); + bool getEmbolden() const; + void setOblique(bool b); + bool getOblique() const; void setHotSpot(THotSpot hotSpot); THotSpot getHotSpot() const; void setScaleX(float scaleX); diff --git a/code/nel/include/nel/3d/texture_font.h b/code/nel/include/nel/3d/texture_font.h index 98e94c82f..3aeb77b65 100644 --- a/code/nel/include/nel/3d/texture_font.h +++ b/code/nel/include/nel/3d/texture_font.h @@ -43,6 +43,8 @@ public: ucchar Char; CFontGenerator *FontGenerator; sint Size; + bool Embolden; + bool Oblique; // The less recently used infos @@ -66,6 +68,8 @@ public: ucchar Char; CFontGenerator *FontGenerator; sint Size; + bool Embolden; + bool Oblique; uint32 getVal(); //bool operator < (const SLetterKey&k) const; diff --git a/code/nel/include/nel/3d/tile_bank.h b/code/nel/include/nel/3d/tile_bank.h index 00e0f2cae..32a205e6d 100644 --- a/code/nel/include/nel/3d/tile_bank.h +++ b/code/nel/include/nel/3d/tile_bank.h @@ -20,6 +20,7 @@ #include "nel/misc/debug.h" #include "nel/misc/stream.h" #include "nel/misc/rgba.h" +#include "nel/misc/path.h" #include #include #include @@ -82,8 +83,8 @@ public: // not free _Flags&=~NL3D_CTILE_FREE_FLAG; - // set filename - _BitmapName[bitmapType]=name; + // set filename, replacing \\ by / if needed + _BitmapName[bitmapType] = NLMISC::CPath::standardizePath(name, false); } std::string getFileName (TBitmap bitmapType) const diff --git a/code/nel/include/nel/3d/u_driver.h b/code/nel/include/nel/3d/u_driver.h index ae5f3e3a9..7112d7be5 100644 --- a/code/nel/include/nel/3d/u_driver.h +++ b/code/nel/include/nel/3d/u_driver.h @@ -505,6 +505,12 @@ public: */ virtual const char* getVideocardInformation () = 0; + /** + * Get total video memory. + * get the amount of video memory of current adapter, result is in KiB, -1 if unable to determine + */ + virtual sint getTotalVideoMemory () const = 0; + /// Get the number of texture stage available, for multitexturing (Normal material shaders). Valid only after setDisplay(). virtual uint getNbTextureStages() = 0; @@ -646,6 +652,16 @@ public: */ virtual void setAnisotropicFilter(sint filter)=0; + /** + * Get current anisotropic filter value + */ + virtual uint getAnisotropicFilter() const = 0; + + /** + * Get maximum anisotropic filter value + */ + virtual uint getAnisotropicFilterMaximum() const = 0; + /** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..) * to be divided by Divisor (2, 4, 8...) * Default is 1. diff --git a/code/nel/include/nel/3d/u_text_context.h b/code/nel/include/nel/3d/u_text_context.h index 1056d3839..0aa9ea2f9 100644 --- a/code/nel/include/nel/3d/u_text_context.h +++ b/code/nel/include/nel/3d/u_text_context.h @@ -137,6 +137,24 @@ public: * \return the font size */ virtual uint32 getFontSize () const = 0; + /** + * set embolden (bold) state + * \param embolden the embbolden state + */ + virtual void setEmbolden (bool b) = 0; + /** + * \return the embolden state + */ + virtual bool getEmbolden () const = 0; + /** + * set oblique (italic) state + * \param oblique the oblique state + */ + virtual void setOblique (bool b) = 0; + /** + * \return the oblique state + */ + virtual bool getOblique () const = 0; /** * set the hot spot * \param fonSize the font size diff --git a/code/nel/include/nel/3d/vertex_buffer.h b/code/nel/include/nel/3d/vertex_buffer.h index 745124ad0..b3cc59371 100644 --- a/code/nel/include/nel/3d/vertex_buffer.h +++ b/code/nel/include/nel/3d/vertex_buffer.h @@ -653,7 +653,7 @@ private: void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);} // Force non resident memory - void restaureNonResidentMemory(); + void restoreNonResidentMemory(); private: diff --git a/code/nel/include/nel/georges/header.h b/code/nel/include/nel/georges/header.h index 21b05445e..343b2baa1 100644 --- a/code/nel/include/nel/georges/header.h +++ b/code/nel/include/nel/georges/header.h @@ -19,8 +19,12 @@ #include "nel/misc/types_nl.h" -// Include from libxml2 -#include +// Forward declarations for libxml2 +typedef struct _xmlNode xmlNode; +typedef xmlNode *xmlNodePtr; + +typedef struct _xmlDoc xmlDoc; +typedef xmlDoc *xmlDocPtr; namespace NLGEORGES { diff --git a/code/nel/include/nel/georges/u_form_elm.h b/code/nel/include/nel/georges/u_form_elm.h index ebb950429..6ec80938f 100644 --- a/code/nel/include/nel/georges/u_form_elm.h +++ b/code/nel/include/nel/georges/u_form_elm.h @@ -225,7 +225,7 @@ public: /// Returns the type of the atom. NULL otherwise. - virtual const class UType *getType () = 0; + virtual const class UType *getType () = 0; /// Return true if the element is an atom virtual bool isAtom () const = 0; diff --git a/code/nel/include/nel/gui/action_handler.h b/code/nel/include/nel/gui/action_handler.h index 48b49e451..f0f4c46f8 100644 --- a/code/nel/include/nel/gui/action_handler.h +++ b/code/nel/include/nel/gui/action_handler.h @@ -17,13 +17,16 @@ #ifndef NL_ACTION_HANDLER_H #define NL_ACTION_HANDLER_H -#include "nel/misc/types_nl.h" -#include #include "nel/misc/types_nl.h" #include "nel/misc/debug.h" #include "nel/misc/xml_auto_ptr.h" + #include +// Forward declarations for libxml2 +typedef struct _xmlNode xmlNode; +typedef xmlNode *xmlNodePtr; + namespace NLGUI { diff --git a/code/nel/include/nel/gui/ctrl_base.h b/code/nel/include/nel/gui/ctrl_base.h index 3b522e114..35148b5b0 100644 --- a/code/nel/include/nel/gui/ctrl_base.h +++ b/code/nel/include/nel/gui/ctrl_base.h @@ -151,8 +151,12 @@ namespace NLGUI // called when keyboard capture has been lost virtual void onKeyboardCaptureLost() {} + // 'tooltip' property expects string to be ucstring or latin1 which is not possible from html page + int luaSetTooltipUtf8(CLuaState &ls); + REFLECT_EXPORT_START(CCtrlBase, CViewBase) REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp); + REFLECT_LUA_METHOD("setTooltipUtf8", luaSetTooltipUtf8); REFLECT_EXPORT_END // special for mouse over : return true and fill the name of the cursor to display diff --git a/code/nel/include/nel/gui/ctrl_scroll.h b/code/nel/include/nel/gui/ctrl_scroll.h index b01a3bf81..cf01ada78 100644 --- a/code/nel/include/nel/gui/ctrl_scroll.h +++ b/code/nel/include/nel/gui/ctrl_scroll.h @@ -147,7 +147,7 @@ namespace NLGUI sint32 _Aligned; // 0-Top 1-Bottom 2-Left 3-Right sint32 _TrackDispPos; - sint32 _TrackPos; + float _TrackPos; sint32 _TrackSize; sint32 _TrackSizeMin; diff --git a/code/nel/include/nel/gui/dbgroup_combo_box.h b/code/nel/include/nel/gui/dbgroup_combo_box.h index e7be1de4b..1aac8bb1f 100644 --- a/code/nel/include/nel/gui/dbgroup_combo_box.h +++ b/code/nel/include/nel/gui/dbgroup_combo_box.h @@ -63,6 +63,8 @@ namespace NLGUI uint getTextId(uint i) const; uint getTextPos(uint nId) const; const ucstring &getTexture(uint i) const; + void setGrayed(uint i, bool g); + const bool getGrayed(uint i) const; void removeText(uint nPos); uint getNumTexts() const {return (uint)_Texts.size();} void sortText(); @@ -132,6 +134,7 @@ namespace NLGUI sint32 _NotLinkedToDBSelection; std::vector > _Texts; std::vector _Textures; + std::vector _Grayed; // Action Handler called on combo click std::string _AHOnSelectStart; diff --git a/code/nel/include/nel/gui/group_container_base.h b/code/nel/include/nel/gui/group_container_base.h index 3e9d1c8bf..6aa7425b7 100644 --- a/code/nel/include/nel/gui/group_container_base.h +++ b/code/nel/include/nel/gui/group_container_base.h @@ -82,13 +82,13 @@ namespace NLGUI // Get the header color draw. NB: depends if grayed, and if active. virtual NLMISC::CRGBA getDrawnHeaderColor () const{ return NLMISC::CRGBA(); }; - uint8 getCurrentContainerAlpha() const{ return _CurrentContainerAlpha; } - uint8 getCurrentContentAlpha() const{ return _CurrentContentAlpha; } + uint8 getCurrentContainerAlpha() const { return _CurrentContainerAlpha; } + uint8 getCurrentContentAlpha() const { return _CurrentContentAlpha; } - virtual bool isGrayed() const{ return false; } - virtual bool getTouchFlag(bool clearFlag) const{ return false; } - virtual void backupPosition(){} - virtual void restorePosition(){} + virtual bool isGrayed() const { return false; } + virtual bool getTouchFlag(bool /* clearFlag */) const { return false; } + virtual void backupPosition() {} + virtual void restorePosition() {} protected: void triggerAlphaSettingsChangedAH(); diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 4f9bee46c..635136220 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -25,23 +25,21 @@ #include "nel/gui/group_tree.h" #include "nel/gui/ctrl_button.h" #include "nel/gui/group_table.h" +#include "nel/gui/libwww_types.h" typedef std::map TStyle; -extern "C" -{ -#include "WWWInit.h" -} - namespace NLGUI { class CCtrlButton; class CCtrlScroll; class CGroupList; + class CGroupMenu; class CDBGroupComboBox; class CGroupParagraph; - + extern std::string CurrentCookie; + extern std::string HTTPCurrentDomain; // HTML group /** @@ -55,15 +53,6 @@ namespace NLGUI public: DECLARE_UI_CLASS( CGroupHTML ) - friend void TextAdd (struct _HText *me, const char * buf, int len); - friend void TextBeginElement (_HText *me, int element_number, const BOOL *present, const char ** value); - friend void TextEndElement (_HText *me, int element_number); - friend void TextLink (struct _HText *me, int element_number, int attribute_number, struct _HTChildAnchor *anchor, const BOOL *present, const char **value); - friend void TextBuild (HText * me, HTextStatus status); - friend void TextBeginUnparsedElement(HText *me, const char *buffer, int length); - friend void TextEndUnparsedElement(HText *me, const char *buffer, int length); - friend int requestTerminater (HTRequest * request, HTResponse * response, void * param, int status); - /// Web browser options for CGroupHTML struct SWebOptions { @@ -76,13 +65,42 @@ namespace NLGUI std::string languageCode; /// List of domains the widget can consider secure. std::vector< std::string > trustedDomains; + /// Maximum concurrent MultiCurl connections per CGroupHTML instance + sint32 curlMaxConnections; - SWebOptions() + SWebOptions(): curlMaxConnections(2) { } }; static SWebOptions options; + + class CStyleParams + { + public: + CStyleParams () : TextColor(255,255,255,255) + { + FontSize=10; + FontWeight=400; + FontOblique=false; + Underlined=false; + StrikeThrough=false; + Width=-1; + Height=-1; + MaxWidth=-1; + MaxHeight=-1; + } + uint FontSize; + uint FontWeight; + bool FontOblique; + NLMISC::CRGBA TextColor; + bool Underlined; + bool StrikeThrough; + sint32 Width; + sint32 Height; + sint32 MaxWidth; + sint32 MaxHeight; + }; // Constructor CGroupHTML(const TCtorParam ¶m); @@ -102,6 +120,9 @@ namespace NLGUI // Browse virtual void browse (const char *url); + // parse html string using libxml2 parser + virtual bool parseHtml(std::string htmlString); + // Refresh void refresh(); @@ -169,12 +190,44 @@ namespace NLGUI std::string DefaultFormTextGroup; std::string DefaultFormTextAreaGroup; std::string DefaultFormSelectGroup; + std::string DefaultFormSelectBoxMenuGroup; std::string DefaultCheckBoxBitmapNormal; std::string DefaultCheckBoxBitmapPushed; std::string DefaultCheckBoxBitmapOver; + std::string DefaultRadioButtonBitmapNormal; + std::string DefaultRadioButtonBitmapPushed; + std::string DefaultRadioButtonBitmapOver; std::string DefaultBackgroundBitmapView; std::string CurrentLinkTitle; + struct TFormField { + public: + TFormField(const std::string &k, const std::string &v) + :name(k),value(v) + {} + std::string name; + std::string value; + }; + + struct SFormFields { + public: + SFormFields() + { + } + + void clear() + { + Values.clear(); + } + + void add(const std::string &key, const std::string &value) + { + Values.push_back(TFormField(key, value)); + } + + std::vector Values; + }; + // Browser home std::string Home; @@ -199,6 +252,7 @@ namespace NLGUI int luaBeginElement(CLuaState &ls); int luaEndElement(CLuaState &ls); int luaShowDiv(CLuaState &ls); + int luaParseHtml(CLuaState &ls); REFLECT_EXPORT_START(CGroupHTML, CGroupScrollText) REFLECT_LUA_METHOD("browse", luaBrowse) @@ -210,6 +264,7 @@ namespace NLGUI REFLECT_LUA_METHOD("beginElement", luaBeginElement) REFLECT_LUA_METHOD("endElement", luaEndElement) REFLECT_LUA_METHOD("showDiv", luaShowDiv) + REFLECT_LUA_METHOD("parseHtml", luaParseHtml) REFLECT_STRING("url", getURL, setURL) REFLECT_FLOAT("timeout", getTimeout, setTimeout) REFLECT_EXPORT_END @@ -228,10 +283,10 @@ namespace NLGUI virtual void addText (const char * buf, int len); // A link has been parsed - virtual void addLink (uint element_number, uint attribute_number, HTChildAnchor *anchor, const BOOL *present, const char **value); + virtual void addLink (uint element_number, const std::vector &present, const std::vector &value); // A new begin HTML element has been parsed ( for exemple) - virtual void beginElement (uint element_number, const BOOL *present, const char **value); + virtual void beginElement (uint element_number, const std::vector &present, const std::vector &value); // A new end HTML element has been parsed ( for exemple) virtual void endElement (uint element_number); @@ -246,10 +301,14 @@ namespace NLGUI virtual void addHTTPGetParams (std::string &url, bool trustedDomain); // Add POST params to the libwww list - virtual void addHTTPPostParams (HTAssocList *formfields, bool trustedDomain); + virtual void addHTTPPostParams (SFormFields &formfields, bool trustedDomain); // the current request is terminated - virtual void requestTerminated(HTRequest *request); + virtual void requestTerminated(); + + // libxml2 html parser functions + void htmlElement(xmlNode *node, int element_number); + void htmlWalkDOM(xmlNode *a_node); // Get Home URL virtual std::string home(); @@ -281,17 +340,19 @@ namespace NLGUI void addString(const ucstring &str); // Add an image in the current paragraph - void addImage(const char *image, bool globalColor, bool reloadImg=false); + void addImage(const char *image, bool globalColor, bool reloadImg=false, const CStyleParams &style = CStyleParams()); // Add a text area in the current paragraph CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength); // Add a combo box in the current paragraph CDBGroupComboBox *addComboBox(const std::string &templateName, const char *name); + CGroupMenu *addSelectBox(const std::string &templateName, const char *name); // Add a button in the current paragraph. actionHandler, actionHandlerParams and tooltip can be NULL. CCtrlButton *addButton(CCtrlButton::EType type, const std::string &name, const std::string &normalBitmap, const std::string &pushedBitmap, - const std::string &overBitmap, bool useGlobalColor, const char *actionHandler, const char *actionHandlerParams, const char *tooltip); + const std::string &overBitmap, bool useGlobalColor, const char *actionHandler, const char *actionHandlerParams, const char *tooltip, + const CStyleParams &style = CStyleParams()); // Set the background color void setBackgroundColor (const NLMISC::CRGBA &bgcolor); @@ -311,8 +372,20 @@ namespace NLGUI // Delete page content and prepare next page void removeContent (); - // Current URL + // Current URL for relative links in page std::string _URL; + // Current URL + std::string _DocumentUrl; + // Valid base href was found + bool _IgnoreBaseUrlTag; + // Fragment from loading url + std::string _UrlFragment; + std::map _Anchors; + std::vector _AnchorName; + + // Parser context + bool _ReadingHeadTag; + bool _IgnoreHeadTag; // Current DOMAIN bool _TrustedDomain; @@ -338,6 +411,11 @@ namespace NLGUI bool _Connecting; double _TimeoutValue; // the timeout in seconds double _ConnectingTimeout; + sint _RedirectsRemaining; + // Automatic page refresh + double _LastRefreshTime; + double _NextRefreshTime; + std::string _RefreshUrl; // minimal embeded lua script support // Note : any embeded script is executed immediately after the closing @@ -347,15 +425,13 @@ namespace NLGUI bool _IgnoreText; // the script to execute std::string _LuaScript; + bool _LuaHrefHack; bool _Object; std::string _ObjectScript; - // Someone is conecting. We got problem with libwww : 2 connection requests can deadlock the client. - static CGroupHTML *_ConnectingLock; - - // LibWWW data - class CLibWWWData *_LibWWW; + // Data container for active curl transfer + class CCurlWWWData * _CurlWWW; // Current paragraph std::string _DivName; @@ -377,14 +453,33 @@ namespace NLGUI return _PRE.back(); } - // UL mode - std::vector _UL; - inline bool getUL() const - { - if (_UL.empty()) - return false; - return _UL.back(); - } + // DL list + class HTMLDListElement { + public: + HTMLDListElement() + : DT(false), DD(false) + { } + + public: + bool DT; + bool DD; + }; + std::vector _DL; + + // OL and UL + class HTMLOListElement { + public: + HTMLOListElement(int start, std::string type) + : Value(start),Type(type), First(true) + { } + + std::string getListMarkerText() const; + public: + sint32 Value; + std::string Type; + bool First; + }; + std::vector _UL; // A mode std::vector _A; @@ -424,6 +519,44 @@ namespace NLGUI return TextFontSize; return _FontSize.back(); } + inline uint getFontSizeSmaller() const + { + if (getFontSize() < 5) + return 3; + return getFontSize()-2; + } + + std::vector _FontWeight; + inline uint getFontWeight() const + { + if (_FontWeight.empty()) + return 400; + return _FontWeight.back(); + } + + std::vector _FontOblique; + inline bool getFontOblique() const + { + if (_FontOblique.empty()) + return false; + return _FontOblique.back(); + } + + std::vector _FontUnderlined; + inline bool getFontUnderlined() const + { + if (_FontUnderlined.empty()) + return false; + return _FontUnderlined.back(); + } + + std::vector _FontStrikeThrough; + inline bool getFontStrikeThrough() const + { + if (_FontStrikeThrough.empty()) + return false; + return _FontStrikeThrough.back(); + } // Current link std::vector _Link; @@ -448,7 +581,15 @@ namespace NLGUI return ""; return _LinkClass.back().c_str(); } - + + std::vector _BlockLevelElement; + inline bool isBlockLevelElement() const + { + if (_BlockLevelElement.empty()) + return false; + return _BlockLevelElement.back(); + } + // Divs (i.e. interface group) std::vector _Divs; inline CInterfaceGroup *getDiv() const @@ -492,6 +633,10 @@ namespace NLGUI TextArea = NULL; Checkbox = NULL; ComboBox = NULL; + SelectBox = NULL; + sbRBRef = NULL; + sbMultiple = false; + sbOptionDisabled = -1; InitialSelection = 0; } @@ -510,6 +655,19 @@ namespace NLGUI // Combobox group CDBGroupComboBox *ComboBox; + // Combobox with multiple selection or display size >= 2 + CGroupMenu *SelectBox; + + // Single or multiple selections for SelectBox + bool sbMultiple; + + // Marks OPTION element as disabled + // Only valid when parsing html + sint sbOptionDisabled; + + // First radio button in SelectBox if single selection + CCtrlBaseButton *sbRBRef; + // select values (for the " << std::endl; + std::cout << std::endl; + std::cout << " Try to optimize TGA or PNG textures by removing useless alpha channel or converting a RGB with black and white values to grayscale" << std::endl; + std::cout << " By default, it only make checks and display if texture can optimized or not" << std::endl; + std::cout << std::endl; + std::cout << "with" << std::endl; + std::cout << "-a : Remove alpha channel if useless (255)" << std::endl; + std::cout << "-g : Convert to grayscale if all pixels are gray" << std::endl; + std::cout << "-t : Apply texture optimizations (same as -a -g)" << std::endl; + std::cout << "-m : Apply mask optimizations (convert to grayscale using red value and remove alpha)" << std::endl; + std::cout << std::endl; + std::cout << "-h or -? for this help" << std::endl; + std::cout << std::endl; +} + +bool FixAlpha = false; +bool FixGrayscale = false; +bool TextureOptimizations = false; +bool MaskOptimizations = false; + +std::vector InputFilenames; + +bool parseOptions(int argc, char **argv) +{ + // process each argument + for(sint i = 1; i < argc; ++i) + { + std::string option = argv[i]; + + if (option.length() > 0) + { + bool isOption = option[0] == '-'; + +#ifdef NL_OS_WINDOWS + // authorize / for options only under Windows, + // because under Linux it could be a full path + if (!isOption) isOption = (option[0] == '/'); +#endif + + // Option + if (isOption) + { + // remove option prefix + option = option.substr(1); + + // Fix alpha + if (option == "a") + { + FixAlpha = true; + } + // Fix grayscale + else if (option == "g") + { + FixGrayscale = true; + } + // Texture optimizations + else if (option == "t") + { + TextureOptimizations = true; + FixAlpha = true; + FixGrayscale = true; + } + // Mask optimizations + else if (option == "m") + { + MaskOptimizations = true; + } + else if (option == "h" || option == "?") + { + return false; + } + else + { + nlwarning("Unknown option -%s", option.c_str()); + + return false; + } + } + // Filename + else + { + std::string ext = NLMISC::toLower(NLMISC::CFile::getExtension(option)); + + if (ext == "png" || ext == "tga") + { + InputFilenames.push_back(option); + } + else + { + nlwarning("Only PNG and TGA files supported, %s won't be processed", option.c_str()); + } + } + } + } + + return !InputFilenames.empty(); +} + +#include "nel/misc/system_utils.h" + +int main(int argc, char **argv) +{ + NLMISC::CApplicationContext applicationContext; + + if (!parseOptions(argc, argv)) + { + writeInstructions(); + return 0; + } + + for(uint i = 0; i < InputFilenames.size(); ++i) + { + std::string ext = NLMISC::toLower(NLMISC::CFile::getExtension(InputFilenames[i])); + + NLMISC::CIFile input; + + if (!input.open(InputFilenames[i])) + { + std::cerr << "Unable to open " << InputFilenames[i] << std::endl; + return 1; + } + + NLMISC::CBitmap bitmap; + + // all 8 bits textures are grayscale and not alpha + bitmap.loadGrayscaleAsAlpha(false); + + uint8 depth = bitmap.load(input); + + // don't need file so close it + input.close(); + + if (depth == 0) + { + std::cerr << "Unable to decode " << InputFilenames[i] << std::endl; + return 1; + } + + bool modified = false; + bool hasAlpha = false; + bool isGrayscale = false; + + if (bitmap.getPixelFormat() == NLMISC::CBitmap::RGBA && depth == 32) + { + hasAlpha = true; + } + else if (bitmap.getPixelFormat() == NLMISC::CBitmap::AlphaLuminance) + { + hasAlpha = true; + isGrayscale = true; + } + else if (bitmap.getPixelFormat() == NLMISC::CBitmap::Luminance) + { + isGrayscale = true; + } + else if (bitmap.getPixelFormat() == NLMISC::CBitmap::Alpha) + { + hasAlpha = true; + isGrayscale = true; + } + + if (MaskOptimizations && (!isGrayscale || hasAlpha)) + { + std::cout << InputFilenames[i] << " (mask with wrong format)" << std::endl; + + if (!isGrayscale) + { + // get a pointer on original RGBA data + uint32 size = bitmap.getPixels().size(); + uint32 *data = (uint32*)bitmap.getPixels().getPtr(); + uint32 *endData = (uint32*)((uint8*)data + size); + + NLMISC::CRGBA *color = NULL; + + // process all pixels + while(data < endData) + { + color = (NLMISC::CRGBA*)data; + + // copy red value to green and blue, + // because only red is used for mask + color->B = color->G = color->R; + + // make opaque + color->A = 255; + + ++data; + } + } + + // already in grayscale, just remove alpha + bitmap.convertToType(NLMISC::CBitmap::Luminance); + + isGrayscale = true; + hasAlpha = false; + modified = true; + } + else + { + if (!isGrayscale && bitmap.isGrayscale()) + { + std::cout << InputFilenames[i] << " (grayscale image with RGB colors)" << std::endl; + + if (FixGrayscale) + { + if (!bitmap.convertToType(hasAlpha ? NLMISC::CBitmap::AlphaLuminance:NLMISC::CBitmap::Luminance)) + { + std::cerr << "Unable to convert to Luminance" << std::endl; + return 1; + } + + isGrayscale = true; + modified = true; + } + } + + uint8 alpha = 0; + + if (hasAlpha && bitmap.isAlphaUniform(&alpha)) + { + std::cout << InputFilenames[i] << " (image with uniform alpha channel " << (sint)alpha << ")" << std::endl; + + if (FixAlpha && alpha == 255) + { + bitmap.makeOpaque(); + + hasAlpha = false; + modified = true; + } + } + } + + if (!modified) continue; + + NLMISC::COFile output; + + if (!output.open(InputFilenames[i])) + { + std::cerr << "Unable to open" << std::endl; + return 1; + } + + uint32 newDepth = isGrayscale ? 8:24; + + if (hasAlpha) newDepth += 8; + + bool res = false; + + if (ext == "png") + { + res = bitmap.writePNG(output, newDepth); + } + else if (ext == "tga") + { + res = bitmap.writePNG(output, newDepth); + } + + if (!res) + { + std::cerr << "Unable to encode" << std::endl; + return 1; + } + } + + return 0; +} diff --git a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp index 292280349..7f3275694 100644 --- a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp +++ b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp @@ -21,6 +21,8 @@ #include "nel/misc/bitmap.h" #include "nel/misc/path.h" #include "nel/misc/debug.h" +#include "nel/misc/cmd_args.h" + #include #include "../s3tc_compressor_lib/s3tc_compressor.h" @@ -40,7 +42,6 @@ using namespace std; bool sameType(const std::string &sFileNameDest, uint8 algo); bool dataCheck(const std::string &sFileNameSrc, const std::string &FileNameDest, uint8 algo); std::string getOutputFileName(const std::string &inputFileName); -void writeInstructions(); @@ -197,39 +198,6 @@ bool dataCheck(const std::string &sFileNameSrc, const std::string &sFileNameDest return true; } -void writeInstructions() -{ - cout< [-o ] [-a ] [-m]"<=argc) return false; - OptOutputFileName= argv[i]; - } - // Algo. - else if(!strcmp(argv[i], "-a")) - { - i++; - if(i>=argc) return false; - if(!strcmp(argv[i],"1")) OptAlgo = DXT1; - else - if(!strcmp(argv[i],"1A")) OptAlgo = DXT1A; - else - if(!strcmp(argv[i],"1a")) OptAlgo = DXT1A; - else - if(!strcmp(argv[i],"3")) OptAlgo = DXT3; - else - if(!strcmp(argv[i],"5")) OptAlgo = DXT5; - else - if(!strcmp(argv[i],"tga16")) OptAlgo = TGA16; - else - if(!strcmp(argv[i],"tga8")) OptAlgo = TGA8; - else - if(!strcmp(argv[i],"png16")) OptAlgo = PNG16; - else - if(!strcmp(argv[i],"png8")) OptAlgo = PNG8; - else - { - cerr<<"Algorithm unknown : "< 8) Reduce = 8; + } } - // Reading TGA or PNG and converting to RGBA - //==================================== - CBitmap picTga; - CBitmap picTga2; - CBitmap picSrc; + std::vector inputFileNames = args.getAdditionalArg("input"); - std::string inputFileName(argv[1]); - if(inputFileName.find("_usercolor") 1) + { + cerr<<"WARNING! Several files to convert to the same output filename! Use an output directory instead."< RGBASrc = picTga.getPixels(); - CObjectVector RGBASrc2; - CObjectVector RGBADest; - RGBADest.resize(height*width*4); - uint dstRGBADestId= 0; + // Data check + //=========== + if(dataCheck(inputFileName,outputFileName, OptAlgo, OptMipMap)) + { + cout<4) - { - if(strcmp("-usercolor",argv[4])==0) + + // Vectors for RGBA data + CObjectVector RGBASrc = picTga.getPixels(); + CObjectVector RGBASrc2; + CObjectVector RGBADest; + RGBADest.resize(height*width*4); + uint dstRGBADestId= 0; + + // UserColor + //=========== + /* + // Checking if option "usercolor" has been used + std::string userColorFileName; + if(argc>4) { - if(argc!=6) + if(strcmp("-usercolor",argv[4])==0) + { + if(argc!=6) + { + writeInstructions(); + return; + } + userColorFileName = argv[5]; + } + else { writeInstructions(); return; } - userColorFileName = argv[5]; + } + */ + // Checking if associate usercolor file exists + std::string userColorFileName; + std::string::size_type pos = inputFileName.rfind("."); + if (pos == std::string::npos) + { + // name without extension + userColorFileName = inputFileName + "_usercolor"; } else { - writeInstructions(); - return; + // append input filename extension + userColorFileName = inputFileName.substr(0,pos) + "_usercolor" + inputFileName.substr(pos); } - } - */ - // Checking if associate usercolor file exists - std::string userColorFileName; - std::string::size_type pos = inputFileName.rfind("."); - if (pos == std::string::npos) - { - // name whithout extension - userColorFileName = inputFileName + "_usercolor"; - } - else - { - // append input filename extension - userColorFileName = inputFileName.substr(0,pos) + "_usercolor" + inputFileName.substr(pos); - } - // Reading second Tga for user color, don't complain if _usercolor is missing - NLMISC::CIFile input2; - if (CPath::exists(userColorFileName) && input2.open(userColorFileName)) - { - picTga2.load(input2); - uint32 height2 = picTga2.getHeight(); - uint32 width2 = picTga2.getWidth(); - nlassert(width2==width); - nlassert(height2==height); - picTga2.convertToType (CBitmap::RGBA); - - RGBASrc2 = picTga2.getPixels(); - - NLMISC::CRGBA *pRGBASrc = (NLMISC::CRGBA*)&RGBASrc[0]; - NLMISC::CRGBA *pRGBASrc2 = (NLMISC::CRGBA*)&RGBASrc2[0]; - - for(uint32 i = 0; i0) + // If no UserColor, must take same RGB, and keep same Alpha from src1 !!! So texture can have both alpha + // userColor and other alpha usage. + if(pRGBASrc2[i].A==255) { - Rtm= Rt*At / Atm; - Gtm= Gt*At / Atm; - Btm= Bt*At / Atm; + RGBADest[dstRGBADestId++]= pRGBASrc[i].R; + RGBADest[dstRGBADestId++]= pRGBASrc[i].G; + RGBADest[dstRGBADestId++]= pRGBASrc[i].B; + RGBADest[dstRGBADestId++]= pRGBASrc[i].A; } - // Else special case: At==0, and Lt==1. else { - Rtm= Gtm= Btm= 0; + // Old code. + /*uint8 F = (uint8) ((float)pRGBASrc[i].R*0.3 + (float)pRGBASrc[i].G*0.56 + (float)pRGBASrc[i].B*0.14); + uint8 Frgb; + if((F*pRGBASrc2[i].A/255)==255) + Frgb = 0; + else + Frgb = (255-pRGBASrc2[i].A)/(255-F*pRGBASrc2[i].A/255); + RGBADest[dstRGBADestId++]= Frgb*pRGBASrc[i].R/255; + RGBADest[dstRGBADestId++]= Frgb*pRGBASrc[i].G/255; + RGBADest[dstRGBADestId++]= Frgb*pRGBASrc[i].B/255; + RGBADest[dstRGBADestId++]= F*pRGBASrc[i].A/255;*/ + + // New code: use new restrictions from IDriver. + float Rt, Gt, Bt, At; + float Lt; + float Rtm, Gtm, Btm, Atm; + + // read 0-1 RGB pixel. + Rt= (float)pRGBASrc[i].R/255; + Gt= (float)pRGBASrc[i].G/255; + Bt= (float)pRGBASrc[i].B/255; + Lt= Rt*0.3f + Gt*0.56f + Bt*0.14f; + + // take Alpha from userColor src. + At= (float)pRGBASrc2[i].A/255; + Atm= 1-Lt*(1-At); + + // If normal case. + if(Atm>0) + { + Rtm= Rt*At / Atm; + Gtm= Gt*At / Atm; + Btm= Bt*At / Atm; + } + // Else special case: At==0, and Lt==1. + else + { + Rtm= Gtm= Btm= 0; + } + + // copy to buffer. + sint r,g,b,a; + r= (sint)floor(Rtm*255+0.5f); + g= (sint)floor(Gtm*255+0.5f); + b= (sint)floor(Btm*255+0.5f); + a= (sint)floor(Atm*255+0.5f); + clamp(r, 0,255); + clamp(g, 0,255); + clamp(b, 0,255); + clamp(a, 0,255); + RGBADest[dstRGBADestId++]= r; + RGBADest[dstRGBADestId++]= g; + RGBADest[dstRGBADestId++]= b; + RGBADest[dstRGBADestId++]= a; } - - // copy to buffer. - sint r,g,b,a; - r= (sint)floor(Rtm*255+0.5f); - g= (sint)floor(Gtm*255+0.5f); - b= (sint)floor(Btm*255+0.5f); - a= (sint)floor(Atm*255+0.5f); - clamp(r, 0,255); - clamp(g, 0,255); - clamp(b, 0,255); - clamp(a, 0,255); - RGBADest[dstRGBADestId++]= r; - RGBADest[dstRGBADestId++]= g; - RGBADest[dstRGBADestId++]= b; - RGBADest[dstRGBADestId++]= a; } } - } - else - RGBADest = RGBASrc; - - // Copy to the dest bitmap. - picSrc.resize(width, height, CBitmap::RGBA); - picSrc.getPixels(0)= RGBADest; + else + RGBADest = RGBASrc; - // Resize the destination bitmap ? - while (Reduce != 0) - { - dividSize (picSrc); - Reduce--; - } + // Copy to the dest bitmap. + picSrc.resize(width, height, CBitmap::RGBA); + picSrc.getPixels(0)= RGBADest; - // 8 or 16 bits TGA or PNG ? - if ((algo == TGA16) || (algo == TGA8) || (algo == PNG16) || (algo == PNG8)) - { - // Saving TGA or PNG file - //================= - NLMISC::COFile output; - if(!output.open(outputFileName)) + // Resize the destination bitmap ? + while (Reduce != 0) { - cerr<<"Can't open output file "< &rgba = picSrc.getPixels(0); + const uint32 w = picSrc.getWidth(0); + uint32 x = 0; + uint32 y = 0; + for (uint32 i = 0; i < rgba.size(); i += 4) { - picSrc.writeTGA (output, 16); + NLMISC::CRGBA &c = reinterpret_cast(rgba[i]); + c.R = (uint8)std::min(255, (int)c.R + bayerDiv8R[x % 4][y % 4]); + c.G = (uint8)std::min(255, (int)c.G + bayerDiv8G[x % 4][y % 4]); + c.B = (uint8)std::min(255, (int)c.B + bayerDiv8B[x % 4][y % 4]); + ++x; + x %= w; + if (x == 0) + ++y; } - else if (algo == TGA8) + } + + // 8 or 16 bits TGA or PNG ? + if ((algo == TGA16) || (algo == TGA8) || (algo == PNG16) || (algo == PNG8)) + { + // Saving TGA or PNG file + //================= + NLMISC::COFile output; + if(!output.open(outputFileName)) { - picSrc.convertToType(CBitmap::Luminance); - picSrc.writeTGA (output, 8); + cerr<<"Can't open output file "<. -#include +#include "common.h" #include "browser_model.h" -#include - -#include -#include -#include - -#include - -#include "pic/readpic.h" - using namespace std; using namespace NL3D; using namespace NLMISC; @@ -34,6 +24,37 @@ using namespace NLMISC; extern CTileBank tileBankBrowser; static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""}; +static bool loadPic(const string &path, std::vector &tampon, uint &width, uint &height) +{ + try + { + NLMISC::CIFile file; + if (file.open(path.c_str())) + { + NLMISC::CBitmap bitmap; + bitmap.load(file); + width = bitmap.getWidth(); + height = bitmap.getHeight(); + tampon.resize(width * height); + bitmap.convertToType(NLMISC::CBitmap::RGBA); + for (uint y = 0; y < height; ++y) + { + for (uint x = 0; x < width; ++x) + { + NLMISC::CRGBA c = bitmap.getPixelColor(x, y, 0); + c.R = (c.R * c.A) / 255; + c.G = (c.G * c.A) / 255; + c.B = (c.B * c.A) / 255; + tampon[(y * width) + x] = c; + } + } + return true; + } + } + catch (NLMISC::Exception& ) { } + return false; +} + bool RemovePath (std::string& path, const char* absolutePathToRemplace); // Rotate a buffer @@ -65,7 +86,7 @@ int loadPixmapBuffer(const std::string& path, std::vector& Buffer { uint Width; uint Height; - if (PIC_LoadPic(path, Buffer, Width, Height)) + if (loadPic(path, Buffer, Width, Height)) { while (rot) { @@ -272,13 +293,13 @@ int TileList::addTile256 () bool TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitmap type) { // Remove the absolute path from the path name - std::string troncated=name; - if (RemovePath (troncated, tileBankBrowser.getAbsPath ().c_str())) + std::string troncated = name; + if (RemovePath(troncated, tileBankBrowser.getAbsPath ().c_str())) { vector tampon; uint Width; uint Height; - if (!PIC_LoadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) + if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) { return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap."), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No)); } @@ -343,7 +364,7 @@ bool TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitm vector tampon; uint Width; uint Height; - if (!PIC_LoadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) + if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) { return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap."), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No) ); @@ -409,7 +430,7 @@ bool TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile vector tampon; uint Width; uint Height; - if (!PIC_LoadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) + if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) { return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap."), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No) ); } @@ -473,7 +494,7 @@ bool TileList::setDisplacement (int tile, const std::string& name, NL3D::CTile:: vector tampon; uint Width; uint Height; - if (!PIC_LoadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) + if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) { return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap"), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No) ); } @@ -516,7 +537,7 @@ bool TileList::setTileTransitionAlpha (int tile, const std::string& name, int ro vector tampon; uint Width; uint Height; - if (!PIC_LoadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) + if (!loadPic(tileBankBrowser.getAbsPath ()+troncated, tampon, Width, Height)) { return ( QMessageBox::Yes == QMessageBox::question( NULL, QObject::tr("Can't load bitmap"), QString( ((tileBankBrowser.getAbsPath ()+troncated)+"\nContinue ?").c_str() ), QMessageBox::Yes | QMessageBox::No) ); } diff --git a/code/nel/tools/3d/tile_edit_qt/common.cpp b/code/nel/tools/3d/tile_edit_qt/common.cpp new file mode 100644 index 000000000..e415c3f6f --- /dev/null +++ b/code/nel/tools/3d/tile_edit_qt/common.cpp @@ -0,0 +1,17 @@ +// NeL - MMORPG Framework +// 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 . + +#include "common.h" diff --git a/code/nel/tools/3d/tile_edit_qt/common.h b/code/nel/tools/3d/tile_edit_qt/common.h new file mode 100644 index 000000000..685195251 --- /dev/null +++ b/code/nel/tools/3d/tile_edit_qt/common.h @@ -0,0 +1,56 @@ +// NeL - MMORPG Framework +// 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 . + +#ifndef COMMON_H +#define COMMON_H + +#if defined(_MSC_VER) && defined(_DEBUG) + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) + #undef realloc + #undef free +#endif + +#include + +#ifdef Q_COMPILER_RVALUE_REFS +#undef Q_COMPILER_RVALUE_REFS +#endif + +#include +#include + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) +#define USE_QT5 +#endif + +#ifdef USE_QT5 +#include +#include +#endif + +#include + +#include +#include +#include +#include +#include +#include + +#endif diff --git a/code/nel/tools/3d/tile_edit_qt/items_edit_dlg.cpp b/code/nel/tools/3d/tile_edit_qt/items_edit_dlg.cpp index 3fd9d3350..0ac2f2eda 100644 --- a/code/nel/tools/3d/tile_edit_qt/items_edit_dlg.cpp +++ b/code/nel/tools/3d/tile_edit_qt/items_edit_dlg.cpp @@ -1,3 +1,4 @@ +#include "common.h" #include #include #include "items_edit_dlg.h" diff --git a/code/nel/tools/3d/tile_edit_qt/items_edit_dlg.h b/code/nel/tools/3d/tile_edit_qt/items_edit_dlg.h index 0f65bcef5..73ed5b0b8 100644 --- a/code/nel/tools/3d/tile_edit_qt/items_edit_dlg.h +++ b/code/nel/tools/3d/tile_edit_qt/items_edit_dlg.h @@ -1,8 +1,6 @@ #ifndef ITEMS_EDITDLG_H #define ITEMS_EDITDLG_H -#include -#include #include "ui_items_edit_qt.h" class CItems_edit_dlg : public QDialog diff --git a/code/nel/tools/3d/tile_edit_qt/main.cpp b/code/nel/tools/3d/tile_edit_qt/main.cpp index 2f3d51012..2b00dcbb8 100644 --- a/code/nel/tools/3d/tile_edit_qt/main.cpp +++ b/code/nel/tools/3d/tile_edit_qt/main.cpp @@ -1,7 +1,22 @@ -#include -#include "nel/misc/app_context.h" +#include "common.h" + #include "tile_edit_dlg.h" +#ifdef QT_STATICPLUGIN + +#include + +#if defined(Q_OS_WIN32) + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) +#elif defined(Q_OS_MAC) + Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) +#elif defined(Q_OS_UNIX) + Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) +#endif + +#endif + +#include "../shared_widgets/common.h" int main(int argc, char *argv[]) { @@ -12,11 +27,12 @@ int main(int argc, char *argv[]) // the specific initialization routines you do not need. NLMISC::CApplicationContext myApplicationContext; + NLQT::preApplication(); Q_INIT_RESOURCE(tile_edit_qt); QApplication app(argc, argv); - CTile_edit_dlg *tileEdit = new CTile_edit_dlg; - tileEdit->show(); + CTile_edit_dlg tileEdit; + tileEdit.show(); return app.exec(); } \ No newline at end of file diff --git a/code/nel/tools/3d/tile_edit_qt/pic/PIC_System.c b/code/nel/tools/3d/tile_edit_qt/pic/PIC_System.c deleted file mode 100644 index 498e5d302..000000000 --- a/code/nel/tools/3d/tile_edit_qt/pic/PIC_System.c +++ /dev/null @@ -1,134 +0,0 @@ -#include -#include -#if !defined(__APPLE__) -#include -#endif -#include -#include - -#define PIC_ERRSIZE 256 - -static size_t PIC_Sys_MEM_Allocated; -static size_t PIC_Sys_MEM_NbAllocs; - -#if defined(__APPLE__) -#define _msize malloc_size -#elif defined(__GNUC__) -#define _msize malloc_usable_size -#endif /* __GNUC__ */ - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -void *Pic_malloc(unsigned long size) -{ - void *mem; - mem=malloc(size); - if (mem) - { - PIC_Sys_MEM_Allocated+=size; - PIC_Sys_MEM_NbAllocs++; - } - return(mem); -} -/* ----- */ -void *Pic_calloc(size_t count, size_t size) -{ - void *mem; - mem=calloc(count,size); - if (mem) - { - PIC_Sys_MEM_Allocated+=(size*count); - PIC_Sys_MEM_NbAllocs++; - } - return(mem); -} -/* ----- */ -void Pic_free(void *memblock) -{ - size_t size; - size=_msize(memblock); - PIC_Sys_MEM_Allocated-=size; - PIC_Sys_MEM_NbAllocs--; - free(memblock); -} -/* ----- */ -size_t Pic__msize(void *memblock) -{ - return(_msize(memblock)); -} -/* ----- */ -size_t PIC_GetMemNbAllocs(void) -{ - return(PIC_Sys_MEM_NbAllocs); -} -/* ----- */ -size_t PIC_GetMemAllocated(void) -{ - return(PIC_Sys_MEM_Allocated); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -static unsigned char PIC_ErrorFlag; -static unsigned char PIC_ErrorString[PIC_ERRSIZE]; -static unsigned char PIC_Sys_FnctActive=0; -static void (*PIC_Sys_Fnct)(void); - -void Pic_SetError(const char *msg, ...) -{ - unsigned char curerr[PIC_ERRSIZE],olderr[PIC_ERRSIZE]; - va_list args; - - va_start(args,msg); - vsprintf(curerr,msg,args); - va_end(args); - if ( (strlen(curerr)+strlen(PIC_ErrorString))>PIC_ERRSIZE ) return; - - if (PIC_ErrorFlag) - { - strcpy(olderr,PIC_ErrorString); - sprintf(PIC_ErrorString,"--- [PIC#%03d] :\n%s",PIC_ErrorFlag,curerr); - strcat(PIC_ErrorString,"\n"); - strcat(PIC_ErrorString,olderr); - } - else - { - sprintf(PIC_ErrorString,"--- [PIC#%03d] :\n%s",PIC_ErrorFlag,curerr); - } - PIC_ErrorFlag++; - if (PIC_Sys_FnctActive) PIC_Sys_Fnct(); - return; -} -/* ----- */ -char* PIC_GetError(void) -{ - return(PIC_ErrorString); -} -/* ----- */ -unsigned char PIC_Error(void) -{ - return(PIC_ErrorFlag); -} -/* ----- */ -void PIC_ResetError(void) -{ - strcpy(PIC_ErrorString,""); - PIC_ErrorFlag=0; -} -/* ----- */ -unsigned char PIC_OnErrorCall( void pFnct(void) ) -{ - if (pFnct != NULL) - { - PIC_Sys_Fnct=pFnct; - PIC_Sys_FnctActive=1; - } - else - { - PIC_Sys_FnctActive=0; - } - return(1); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - diff --git a/code/nel/tools/3d/tile_edit_qt/pic/Pic_BMP.c b/code/nel/tools/3d/tile_edit_qt/pic/Pic_BMP.c deleted file mode 100644 index 1119766da..000000000 --- a/code/nel/tools/3d/tile_edit_qt/pic/Pic_BMP.c +++ /dev/null @@ -1,215 +0,0 @@ -#include -#include -#include - -#include "pic_private.h" -#include "pic.h" - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -#pragma pack(1) -typedef struct BMP_HEADER -{ - unsigned short bfType; - unsigned long bfSize; - unsigned short Res1; - unsigned short Res2; - unsigned long bfOffBits; - unsigned long biSize; - unsigned long biWidth; - unsigned long biHeight; - unsigned short biPlanes; - unsigned short biBitCount; - unsigned long biCompression; - unsigned long biSizeImage; - unsigned long biXPelsPerMeter; - unsigned long biYPelsPerMeter; - unsigned long biClrUsed; - unsigned long biClrImportant; -} BMP_HEADER; -#pragma pack() - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -unsigned long Pic_BMP_Write( const char *FileName, - unsigned char *pPal,unsigned char *pDatas, - unsigned long w, unsigned long h, unsigned long d) - -{ - FILE *file; - BMP_HEADER bmph; - unsigned long slsize; - unsigned char *scanline; - unsigned long i; - long x,y,rest; - unsigned char r,g,b; - - file=fopen(FileName,"wb"); - if (!file) - { - return(0); - } - memset(&bmph,0,sizeof(BMP_HEADER)); - bmph.bfType=19778; - bmph.bfSize=sizeof(BMP_HEADER); - bmph.bfSize+=w*h*d/8; - if (pPal) - { - bmph.bfSize+=(256*4); - } - bmph.bfOffBits=sizeof(BMP_HEADER); - if (pPal) - { - bmph.bfOffBits+=(256*4); - } - bmph.biSize=40;/*sizeof(BMP_HEADER);*/ - bmph.biWidth=w; - bmph.biHeight=h; - bmph.biPlanes=1; - bmph.biBitCount=(unsigned short)d; - bmph.biCompression=0; - bmph.biSizeImage=w*h*d/8; - - fwrite(&bmph,1,sizeof(BMP_HEADER),file); - if (pPal) - { - for(i=0 ; i<256 ; i++) - { - fwrite(&pPal[i*3+0],1,1,file); - fwrite(&pPal[i*3+1],1,1,file); - fwrite(&pPal[i*3+2],1,1,file); - fwrite(&pPal[i*3+2],1,1,file); - } - } - slsize=w*d/8; - scanline=Pic_calloc(1,slsize); - if (!scanline) - { - Pic_SetError("BMP_Write, not enough memory for scanline"); - return(0); - } - for(rest=0 ; ((w*d/8)+rest)%4!=0 ; rest++); - for(y=0 ; y<(long)h ; y++) - { - memcpy(scanline,&pDatas[(h-y-1)*slsize],slsize); - if (d==24) - { - for(x=0 ; x<(long)w ; x++) - { - b=scanline[x*3+0]; - g=scanline[x*3+1]; - r=scanline[x*3+2]; - scanline[x*3+0]=b; - scanline[x*3+1]=g; - scanline[x*3+2]=r; - } - } - fwrite(scanline,1,slsize,file); - if (rest) - { - fwrite(scanline,1,rest,file); - } - } - Pic_free(scanline); - fclose(file); - return(1); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -unsigned long Pic_BMP_Read( const char *FileName, - unsigned char **ppPal, unsigned char **ppDatas, - unsigned long *pWidth, unsigned long *pHeight, - unsigned long *pDepth) -{ - FILE *file; - BMP_HEADER bmph; - unsigned char *pPal; - unsigned char *pDatas; - unsigned char *scanline; - long w,h,d; - long i,x,y,rest; - unsigned char r,g,b; - unsigned char pad[4]; - - pPal=NULL; - pDatas=NULL; - file=fopen(FileName,"rb"); - if (!file) - { - Pic_SetError("BMP_Read, unable to open %s",FileName); - return(0); - } - fread(&bmph,1,sizeof(BMP_HEADER),file); - *pWidth=w=bmph.biWidth; - *pHeight=h=bmph.biHeight; - *pDepth=d=bmph.biBitCount; - if (d!=8 && d!=24) - { - Pic_SetError("BMP_Read, number of bits per pixel unsupported"); - return(0); - } - if (*pDepth==8) - { - pPal=Pic_calloc(1,256*3); - if (!pPal) - { - Pic_SetError("BMP_Read, not enough memory for palette"); - return(0); - } - for(i=0 ; i<256 ; i++) - { - fread(&pPal[i*3+2],1,1,file); - fread(&pPal[i*3+1],1,1,file); - fread(&pPal[i*3+0],1,1,file); - fread(&pad[0],1,1,file); - } - } - pDatas=Pic_calloc(1,w*h*d/8); - if (!pDatas) - { - if (pPal) - { - Pic_free(pPal); - } - Pic_SetError("BMP_Read, not enough memory for datas"); - return(0); - } - scanline=Pic_calloc(1,w*h*d/8); - if (!scanline) - { - if (pPal) - { - Pic_free(pPal); - } - Pic_free(pDatas); - Pic_SetError("BMP_Read, not enough memory for scanline"); - return(0); - } - for(rest=0 ; (w+rest)%4!=0 ; rest++); - for(y=0 ; y -#include -#include -#include - -#include "jpeglib.h" -#include "pic_private.h" -#include "pic.h" - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -struct my_error_mgr -{ - struct jpeg_error_mgr pub; - jmp_buf setjmp_buffer; -}; -typedef struct my_error_mgr * my_error_ptr; - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -static unsigned char error; - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -void my_error_exit(j_common_ptr cinfo) -{ - my_error_ptr myerr = (my_error_ptr) cinfo->err; - error=1; - longjmp(myerr->setjmp_buffer, 1); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -unsigned long Pic_JPG_Read(const char *FileName, unsigned char **ppPal, unsigned char **ppDatas, unsigned long *w, unsigned long *h) -{ - struct jpeg_decompress_struct cinfo; - struct my_error_mgr jerr; - FILE *file; - JSAMPARRAY buffer; - int row_stride,i; - unsigned char *pDatas,*pPal; - unsigned long ptr; - - error=0; - ptr=0; - file=fopen(FileName, "rb"); - if (!file) - { - Pic_SetError("JPG_Read, unable to open %s",FileName); - return(0); - } - cinfo.err = jpeg_std_error(&jerr.pub); - jerr.pub.error_exit = my_error_exit; - setjmp(jerr.setjmp_buffer); - if (error) - { - Pic_SetError("JPG_Read, internal decompression error"); - jpeg_destroy_decompress(&cinfo); - return(0); - } - jpeg_create_decompress(&cinfo); - jpeg_stdio_src(&cinfo, file); - (void) jpeg_read_header(&cinfo, TRUE); - *w=cinfo.image_width; - *h=cinfo.image_height; - if (!ppPal) - { - pDatas=Pic_calloc(1,(*w)*(*h)*3); - } - else - { - pDatas=Pic_calloc(1,(*w)*(*h)); - pPal=Pic_calloc(1,256*3); - if (!pPal) - { - Pic_SetError("JPG_Read, not enough memory for palette"); - return(0); - } - cinfo.desired_number_of_colors = 256; - cinfo.quantize_colors = TRUE; - cinfo.dither_mode = JDITHER_ORDERED; - } - if (!pDatas) - { - Pic_SetError("JPG_Read, not enough memory for pic"); - return(0); - } - (void) jpeg_start_decompress(&cinfo); - row_stride = cinfo.output_width * cinfo.output_components; - buffer = (*cinfo.mem->alloc_sarray) - ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1); - while (cinfo.output_scanline < cinfo.output_height) - { - (void) jpeg_read_scanlines(&cinfo, buffer, 1); - memcpy(&pDatas[ptr],buffer[0],row_stride); - ptr+=row_stride; - } - *ppDatas=pDatas; - if (ppPal) - { - for(i=0 ; i<256 ; i++) - { - pPal[i*3+0]=cinfo.colormap[2][i]; - pPal[i*3+1]=cinfo.colormap[1][i]; - pPal[i*3+2]=cinfo.colormap[0][i]; - } - *ppPal=pPal; - } - (void) jpeg_finish_decompress(&cinfo); - jpeg_destroy_decompress(&cinfo); - fclose(file); - return(1); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -unsigned long Pic_JPG_Write(const char *FileName, unsigned long Qual, unsigned char *pDatas, unsigned long w, unsigned long h) -{ - struct jpeg_compress_struct cinfo; - struct my_error_mgr jerr; - FILE *file; - JSAMPROW row_pointer[1]; - int row_stride; - - error=0; - file=fopen(FileName,"wb"); - if (!file) - { - Pic_SetError("JPG_Write, unable to open %s",FileName); - return(0); - } - jpeg_create_compress(&cinfo); - cinfo.err = jpeg_std_error(&jerr.pub); - jerr.pub.error_exit = my_error_exit; - setjmp(jerr.setjmp_buffer); - if (error) - { - Pic_SetError("JPG_Write, internal compression error"); - jpeg_destroy_compress(&cinfo); - return(0); - } - jpeg_stdio_dest(&cinfo, file); - cinfo.image_width = w; - cinfo.image_height = h; - cinfo.input_components = 3; - cinfo.in_color_space = JCS_RGB; - jpeg_set_defaults(&cinfo); - jpeg_set_quality(&cinfo, Qual, TRUE); - jpeg_start_compress(&cinfo, TRUE); - row_stride = w * 3; - while(cinfo.next_scanline -#include "pic_private.h" -#include "pic.h" - -static unsigned long NbPics=0; -static PIC_PICTURE *HeadPic=NULL; - -#ifdef __GNUC__ -#include - -char *strupr(char *string) -{ - char *s; - - if (string) - { - for (s = string; *s; ++s) - *s = toupper(*s); - } - return string; -} -#endif /* __GNUC__ */ - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -static PIC_PICTURE *GetPic(unsigned long id) -{ - PIC_PICTURE *pic; - - for(pic=HeadPic ; pic ; pic=pic->Next) - { - if (pic->ID==id) - { - return(pic); - } - } - return(NULL); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -unsigned long PIC_Load(char* FileName, unsigned char Quantize) -{ - unsigned char ext[4]; - unsigned long type; - unsigned long i,taken,id; - PIC_PICTURE *pic; - unsigned char *pDatas; - unsigned char *pPal; - unsigned long w,h,Depth; - unsigned long ret; - - /* --- Init */ - - ret=0; - type=0; - id=0; - taken=0; - w=0; - h=0; - Depth=0; - pic=NULL; - pDatas=NULL; - pPal=NULL; - /* --- Get 1st available ID */ - for(i=1 ; i<=NbPics+1 ; i++) - { - taken=0; - for(pic=HeadPic ; pic ; pic=pic->Next) - { - if (pic->ID==i) - { - taken=1; - break; - } - } - if (!taken) - { - id=i; - break; - } - } - if (!id) - { - Pic_SetError("Load, unable to create ID"); - return(0); - } - /* --- Load pic */ - if (FileName) - { - ext[0]=FileName[strlen(FileName)-3]; - ext[1]=FileName[strlen(FileName)-2]; - ext[2]=FileName[strlen(FileName)-1]; - ext[3]=0; - strupr(ext); - if ( !strcmp(ext,"JPG") ) - { - type=1; - } - else if ( !strcmp(ext,"TGA") ) - { - type=2; - } - else if ( !strcmp(ext,"BMP") ) - { - type=3; - } - - switch(type) - { - /* - JPG */ - case 1: - if (!Quantize) - { - Depth=24; - ret=Pic_JPG_Read(FileName,NULL,&pDatas,&w,&h); - } - else - { - Depth=8; - ret=Pic_JPG_Read(FileName,&pPal,&pDatas,&w,&h); - } - if (!ret) - { - Pic_SetError("Load, unable to load JPG file %s",FileName); - return(0); - } - break; - /* - TGA */ - case 2: - ret=Pic_TGA_Read(FileName,&pPal,&pDatas,&w,&h,&Depth); - if (!ret) - { - Pic_SetError("Load, unable to load TGA file %s",FileName); - return(0); - } - break; - /* - BMP */ - case 3: - ret=Pic_BMP_Read(FileName,&pPal,&pDatas,&w,&h,&Depth); - if (!ret) - { - Pic_SetError("Load, unable to load BMP file %s",FileName); - return(0); - } - break; - /* - Unknown */ - default: - Pic_SetError("Load, unknown extension for %s",FileName); - return(0); - } - } - - /* --- Create and place new pic struct */ - pic=Pic_calloc(1,sizeof(PIC_PICTURE)); - if (!pic) - { - Pic_SetError("Load, not enough memory for internal structure"); - return(0); - } - pic->Next=HeadPic; - HeadPic=pic; - NbPics++; - pic->ID=id; - pic->pDatas=pDatas; - pic->pPal=pPal; - pic->Width=w; - pic->Height=h; - pic->Depth=Depth; - return(id); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -unsigned long PIC_Create(unsigned char* pPal, unsigned char* pDatas, unsigned long w, unsigned long h, unsigned long d) -{ - unsigned long i,taken,id; - PIC_PICTURE *pic; - - /* --- Init */ - id=0; - taken=0; - pic=NULL; - /* --- Get 1st available ID */ - for(i=1 ; i<=NbPics+1 ; i++) - { - taken=0; - for(pic=HeadPic ; pic ; pic=pic->Next) - { - if (pic->ID==i) - { - taken=1; - break; - } - } - if (!taken) - { - id=i; - break; - } - } - if (!id) - { - Pic_SetError("Create, unable to create ID"); - return(0); - } - /* --- Create pic */ - if (!pDatas) - { - pDatas=Pic_calloc(1,w*h*d/8); - if (!pDatas) - { - Pic_SetError("Create, not enough memory for datas"); - return(0); - } - } - if (d==8) - { - if (!pPal) - { - pPal=Pic_calloc(1,256*3); - if (!pPal) - { - Pic_SetError("Create, not enough memory for palette"); - return(0); - } - } - } - else - { - pPal=NULL; - } - /* --- Create and place new pic struct */ - pic=Pic_calloc(1,sizeof(PIC_PICTURE)); - if (!pic) - { - Pic_SetError("Create, not enough memory for internal structure"); - return(0); - } - pic->Next=HeadPic; - HeadPic=pic; - NbPics++; - pic->ID=id; - pic->pDatas=pDatas; - pic->pPal=pPal; - pic->Width=w; - pic->Height=h; - pic->Depth=d; - return(id); - -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -unsigned long PIC_GetInfos( unsigned long id, - unsigned char* *ppPal, unsigned char* *ppDatas, - unsigned long *pW, unsigned long *pH, unsigned long *pD) -{ - PIC_PICTURE *pic; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("GetInfos, picture internal structure not found"); - return(0); - } - if (ppPal) - { - *ppPal=pic->pPal; - } - if (ppDatas) - { - *ppDatas=pic->pDatas; - } - if (pW) - { - *pW=pic->Width; - } - if (pH) - { - *pH=pic->Height; - } - if (pD) - { - *pD=pic->Depth; - } - return(id); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -static char* Conv8To24(unsigned long id) -{ - PIC_PICTURE *pic; - unsigned char *buf; - unsigned long i; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Conv8To24, picture internal structure not found"); - return(NULL); - } - buf=Pic_malloc(pic->Width*pic->Height*3); - if (!buf) - { - Pic_SetError("Conv8To24, not enough memory for temporary buffer"); - return(NULL); - } - for(i=0 ; iWidth*pic->Height ; i++) - { - buf[i*3+0]=pic->pPal[pic->pDatas[i]*3+0]; - buf[i*3+1]=pic->pPal[pic->pDatas[i]*3+1]; - buf[i*3+2]=pic->pPal[pic->pDatas[i]*3+2]; - } - return(buf); -} - -/* ---------------------------------------- */ -static char* Conv8To16(unsigned long id) -{ - PIC_PICTURE *pic; - unsigned short *buf; - unsigned long i; - unsigned short r,g,b,pix16; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Conv8To24, picture internal structure not found"); - return(NULL); - } - buf=(unsigned short*)Pic_malloc(pic->Width*pic->Height*2); - if (!buf) - { - Pic_SetError("Conv8To24, not enough memory for temporary buffer"); - return(NULL); - } - for(i=0 ; iWidth*pic->Height ; i++) - { - b=pic->pPal[pic->pDatas[i]*3+0]; - g=pic->pPal[pic->pDatas[i]*3+1]; - r=pic->pPal[pic->pDatas[i]*3+2]; - r>>=3; - g>>=3; g&=0x3E; - b>>=3; - pix16=(r<<10)+(g<<5)+b; - buf[i]=pix16; - } - return((unsigned char*)buf); -} - -/* ---------------------------------------- */ - -static char* Conv16To24(unsigned long id) -{ - PIC_PICTURE *pic; - unsigned short *pDatas; - unsigned char *buf; - unsigned long i; - unsigned short r,g,b; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Conv16To24, picture internal structure not found"); - return(NULL); - } - buf=Pic_malloc(pic->Width*pic->Height*3); - if (!buf) - { - Pic_SetError("Conv16To24, not enough memory for temporary buffer"); - return(NULL); - } - pDatas=(unsigned short*)pic->pDatas; - for(i=0 ; iWidth*pic->Height ; i++) - { - r=(pDatas[i] & 0x7C00)>>(10-3); - g=(pDatas[i] & 0x03E0)>>(5-3); - b=(pDatas[i] & 0x001F)<<3; - buf[i*3+0]=(unsigned char)r; - buf[i*3+1]=(unsigned char)g; - buf[i*3+2]=(unsigned char)b; - } - return(buf); -} - -/* ---------------------------------------- */ - -static char* Conv24To16(unsigned long id) -{ - PIC_PICTURE *pic; - unsigned short *buf; - unsigned long i; - unsigned short r,g,b; - unsigned short pix16; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Conv24To16, picture internal structure not found"); - return(NULL); - } - buf=(unsigned short*)Pic_malloc(pic->Width*pic->Height*2); - if (!buf) - { - Pic_SetError("Conv24To16, not enough memory for temporary buffer"); - return(NULL); - } - for(i=0 ; iWidth*pic->Height ; i++) - { - r=pic->pDatas[i*3+0]; - g=pic->pDatas[i*3+1]; - b=pic->pDatas[i*3+2]; - /* r : 5 bits forts (0x7C) */ - /* g : 5 bits (6e zapped) (0x3E) */ - /* b : 5 bits faibles (0x1F) */ - r>>=3; - g>>=3; g&=0x3E; - b>>=3; - pix16=(r<<10)+(g<<5)+b; - buf[i]=pix16; - } - return((unsigned char*)buf); -} - -/* ---------------------------------------- */ - -static char* ConvPic(PIC_PICTURE *pic, unsigned long type, char* pErr) -{ - unsigned char *buf; - unsigned long src,dst; - - *pErr=0; - buf=NULL; - src=pic->Depth; - if (type==PIC_TYPE_TGA8 || type==PIC_TYPE_BMP8) - { - dst=8; - } - if (type==PIC_TYPE_TGA16) - { - dst=16; - } - if (type==PIC_TYPE_JPG || type==PIC_TYPE_TGA24 || type==PIC_TYPE_BMP24) - { - dst=24; - } - /* --- */ - if (src==dst) - { - return(NULL); - } - /* --- */ - if (src==8 && dst==24) - { - buf=Conv8To24(pic->ID); - if (!buf) - { - *pErr=1; - } - return(buf); - } - if (src==8 && dst==16) - { - buf=Conv8To16(pic->ID); - if (!buf) - { - *pErr=1; - } - return(buf); - } - /* --- */ - if (src==16 && dst==24) - { - buf=Conv16To24(pic->ID); - if (!buf) - { - *pErr=1; - } - return(buf); - } - /* --- */ - if (src==24 && dst==16) - { - buf=Conv24To16(pic->ID); - if (!buf) - { - *pErr=1; - } - return(buf); - } - /* --- */ - if (src==24 && dst==8) - { - Pic_SetError("ConvPic, downsampling 24 to 8 bits unsupported"); - *pErr=1; - return(NULL); - } - Pic_SetError("ConvPic, conversion %d to %d unsupported",src,dst); - *pErr=1; - return(NULL); -} - -/* ---------------------------------------- */ - -unsigned long PIC_Save(unsigned long id, const char* FileName, unsigned long type, unsigned long qual) -{ - PIC_PICTURE *pic; - unsigned char err; - unsigned char *buf; - unsigned char *freeit; - unsigned long depth; - - freeit=NULL; - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Save %s, picture internal structure not found",FileName); - return(0); - } - freeit=ConvPic(pic,type,&err); - if (err) - { - Pic_SetError("Save %s, error while converting picture",FileName); - return(0); - } - if (!freeit) - { - buf=pic->pDatas; - } - else - { - buf=freeit; - } - err=0; - switch(type) - { - /* --- */ - case PIC_TYPE_JPG: - if ( !Pic_JPG_Write(FileName,qual,buf,pic->Width,pic->Height) ) - { - if (freeit) - { - Pic_free(buf); - } - Pic_SetError("Save %s, error while saving JPG file",FileName); - err=1; - } - break; - /* --- */ - case PIC_TYPE_TGA8: - case PIC_TYPE_TGA16: - case PIC_TYPE_TGA24: - if (type==PIC_TYPE_TGA8) - { - depth=8; - } - if (type==PIC_TYPE_TGA16) - { - depth=16; - } - if (type==PIC_TYPE_TGA24) - { - depth=24; - } - if ( !Pic_TGA_Write(FileName,pic->pPal,buf,pic->Width,pic->Height,depth) ) - { - if (freeit) - { - Pic_free(freeit); - } - Pic_SetError("Save %s, error while saving TGA file",FileName); - err=1; - } - break; - /* --- */ - case PIC_TYPE_BMP8: - case PIC_TYPE_BMP24: - if (type==PIC_TYPE_BMP8) - { - depth=8; - } - if (type==PIC_TYPE_BMP24) - { - depth=24; - } - if ( !Pic_BMP_Write(FileName,pic->pPal,buf,pic->Width,pic->Height,depth) ) - { - if (freeit) - { - Pic_free(freeit); - } - Pic_SetError("Save %s, error while saving BMP file",FileName); - err=1; - } - break; - /* --- */ - default: - Pic_SetError("Save %s, unknow save format/type",FileName); - err=1; - break; - } - if (freeit) - { - Pic_free(freeit); - } - return(err-1); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -unsigned long PIC_Destroy(unsigned long id) -{ - PIC_PICTURE *prevpic,*pic; - unsigned long found; - - prevpic=NULL; - found=0; - for(pic=HeadPic ; pic ; pic=pic->Next) - { - if (pic->ID==id) - { - found=1; - break; - } - prevpic=pic; - } - if (!found) - { - Pic_SetError("Destroy, picture internal structure not found"); - return(0); - } - if (prevpic) - { - prevpic->Next=pic->Next; - } - if (pic->pDatas) - { - Pic_free(pic->pDatas); - } - if (pic->pPal) - { - Pic_free(pic->pPal); - } - if (pic==HeadPic) - { - HeadPic=pic->Next; - } - Pic_free(pic); - return(1); -} - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ diff --git a/code/nel/tools/3d/tile_edit_qt/pic/Pic_TGA.c b/code/nel/tools/3d/tile_edit_qt/pic/Pic_TGA.c deleted file mode 100644 index 4c458dc83..000000000 --- a/code/nel/tools/3d/tile_edit_qt/pic/Pic_TGA.c +++ /dev/null @@ -1,215 +0,0 @@ -#include -#include -#include - -#include "pic_private.h" -#include "pic.h" - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -#pragma pack(1) -typedef struct TGA_HEADER -{ - unsigned char LengthID; - unsigned char CMapType; - unsigned char ImageType; - unsigned short Origin; - unsigned short Length; - unsigned char Depth; - unsigned short XOrg; - unsigned short YOrg; - unsigned short Width; - unsigned short Height; - unsigned char ImageDepth; - unsigned char Desc; -} TGA_HEADER; -#pragma pack() - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -unsigned long Pic_TGA_Read( const char *FileName, - unsigned char **ppPal, unsigned char **ppDatas, - unsigned long *pWidth, unsigned long *pHeight, - unsigned long *pDepth) -{ - FILE *file; - TGA_HEADER tgah; - long w,h,d; - unsigned long size; - unsigned char *pDatas; - unsigned char *pPal; - long x,y; - long slsize; - unsigned char *scanline; - unsigned char r,g,b; - long i; - int upSideDown; - - pDatas=NULL; - pPal=NULL; - file=fopen(FileName,"rb"); - if (!file) - { - Pic_SetError("TGA_Read, unable to open %s",FileName); - return(0); - } - fread(&tgah,1,sizeof(TGA_HEADER),file); - if (tgah.ImageType>3) - { - Pic_SetError("TGA_Read, unsupported TGA format"); - return(0); - } - *pWidth=w=tgah.Width; - *pHeight=h=tgah.Height; - *pDepth=d=tgah.ImageDepth; - upSideDown = ((tgah.Desc & (1 << 5))==0); - - size=tgah.Width*tgah.Height*(tgah.ImageDepth/8); - pDatas=Pic_malloc(size); - if (!pDatas) - { - Pic_SetError("TGA_Read, not enough memory"); - return(0); - } - if (*pDepth==8) - { - if (!ppPal) - { - Pic_free(pDatas); - Pic_SetError("TGA_Read, need a pointer to palette"); - return(0); - } - pPal=Pic_calloc(1,256*3); - if (!pPal) - { - Pic_SetError("TGA_Read, not enough memory for palette"); - return(0); - } - if (tgah.ImageType==1) - { - for(i=0 ; i<256*3 ; i+=3) - { - fread(&pPal[i+2],1,1,file); - fread(&pPal[i+1],1,1,file); - fread(&pPal[i+0],1,1,file); - } - } - *ppPal=pPal; - } - - slsize=w*d/8; - scanline=Pic_calloc(1,slsize); - if (!scanline) - { - if (pPal) - { - Pic_free(pPal); - } - Pic_free(pDatas); - Pic_SetError("TGA_Read, not enough memory for scanline"); - return(0); - } - for(y=0 ; y8) - { - tgah.CMapType=0; - tgah.ImageType=2; - tgah.Length=0; - tgah.Depth=0; - } - else - { - tgah.CMapType=1; - tgah.ImageType=1; - tgah.Length=256; - tgah.Depth=24; - } - tgah.Origin=0; - tgah.XOrg=0; - tgah.YOrg=0; - tgah.Width=(unsigned short)w; - tgah.Height=(unsigned short)h; - tgah.ImageDepth=(unsigned char)d; - tgah.Desc=0; - fwrite(&tgah,1,sizeof(TGA_HEADER),file); - if (d==8) - { - fwrite(pPal,1,256*3,file); - } - slsize=w*d/8; - scanline=Pic_calloc(1,slsize); - if (!scanline) - { - Pic_SetError("TGA_Write, not enough memory for scanline"); - return(0); - } - for(y=0 ; y<(long)h ; y++) - { - memcpy(scanline,&pDatas[(h-y-1)*slsize],slsize); - if (d==24) - { - for(x=0 ; x<(long)w ; x++) - { - r=scanline[x*3+0]; - g=scanline[x*3+1]; - b=scanline[x*3+2]; - scanline[x*3+0]=b; - scanline[x*3+1]=g; - scanline[x*3+2]=r; - } - } - fwrite(scanline,1,slsize,file); - } - Pic_free(scanline); - fclose(file); - return(1); -} diff --git a/code/nel/tools/3d/tile_edit_qt/pic/pic.h b/code/nel/tools/3d/tile_edit_qt/pic/pic.h deleted file mode 100644 index cec5a0ff0..000000000 --- a/code/nel/tools/3d/tile_edit_qt/pic/pic.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _PIC_H_ -#define _PIC_H_ -#ifdef __cplusplus -extern "C" { -#endif - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -#define PIC_TYPE_JPG 1 -#define PIC_TYPE_TGA8 2 -#define PIC_TYPE_TGA16 3 -#define PIC_TYPE_TGA24 4 -#define PIC_TYPE_BMP8 5 -#define PIC_TYPE_BMP24 6 - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -/* - * Basic API - */ -extern unsigned long PIC_Load(char* FileName, unsigned char Quantize); - -extern unsigned long PIC_Create(unsigned char* pPal, unsigned char* pDatas, unsigned long w, unsigned long h, unsigned long d); - -extern unsigned long PIC_Save(unsigned long id, const char* FileName, unsigned long type, unsigned long qual); - -extern unsigned long PIC_GetInfos( unsigned long id, - unsigned char* *ppPal, unsigned char* *ppDatas, - unsigned long *pW, unsigned long *pH, unsigned long *pD); - - -extern unsigned long PIC_Destroy(unsigned long id); -/* - * System - */ -extern unsigned long PIC_GetMemNbAllocs(void); -extern unsigned long PIC_GetMemAllocated(void); -extern char* PIC_GetError(void); -extern unsigned char PIC_Error(void); -extern void PIC_ResetError(void); -extern unsigned char PIC_OnErrorCall( void pFnct(void) ); - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -#ifdef __cplusplus -} -#endif -#endif diff --git a/code/nel/tools/3d/tile_edit_qt/pic/pic_private.h b/code/nel/tools/3d/tile_edit_qt/pic/pic_private.h deleted file mode 100644 index 96b7a0e94..000000000 --- a/code/nel/tools/3d/tile_edit_qt/pic/pic_private.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _PIC_PRIVATE_H_ -#define _PIC_PRIVATE_H_ -#ifdef __cplusplus -extern "C" { -#endif - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -typedef struct PIC_PICTURE -{ - unsigned long ID; - unsigned long Width; - unsigned long Height; - unsigned long Depth; - unsigned char *pDatas; - unsigned char *pPal; - struct PIC_PICTURE *Next; -} PIC_PICTURE; - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - - -/* - * JPG - */ - - -extern unsigned long Pic_JPG_Read( const char *FileName, - unsigned char **ppPal, unsigned char **ppDatas, - unsigned long *w, unsigned long *h); - -extern unsigned long Pic_JPG_Write( const char *FileName, - unsigned long Qual, - unsigned char *pDatas, - unsigned long w, unsigned long h); -/* - * TGA - */ -extern unsigned long Pic_TGA_Read( const char *FileName, - unsigned char **ppPal, unsigned char **ppDatas, - unsigned long *pWidth, unsigned long *pHeight, - unsigned long *pDepth); -extern unsigned long Pic_TGA_Write( const char *FileName, - unsigned char *pPal,unsigned char *pDatas, - unsigned long w, unsigned long h, unsigned long d); -/* - * BMP - */ -extern unsigned long Pic_BMP_Read( const char *FileName, - unsigned char **ppPal, unsigned char **ppDatas, - unsigned long *pWidth, unsigned long *pHeight, - unsigned long *pDepth); - -extern unsigned long Pic_BMP_Write( const char *FileName, - unsigned char *pPal,unsigned char *pDatas, - unsigned long w, unsigned long h, unsigned long d); -/* - * System - */ -extern void* Pic_malloc(size_t size); -extern void* Pic_calloc(size_t count, size_t size); -extern void Pic_free(void *memblock); -extern size_t Pic__msize(void *memblock); -extern void Pic_SetError(const char *msg, ...); - -/* ---------------------------------------------------------------------------------------------------------------------------------- */ - -#ifdef __cplusplus -} -#endif -#endif diff --git a/code/nel/tools/3d/tile_edit_qt/pic/readpic.cpp b/code/nel/tools/3d/tile_edit_qt/pic/readpic.cpp deleted file mode 100644 index 078a8fa4b..000000000 --- a/code/nel/tools/3d/tile_edit_qt/pic/readpic.cpp +++ /dev/null @@ -1,68 +0,0 @@ - - -#include -#include -#include "readpic.h" -#include "pic.h" -#include - - -//============================================================ -// Image API. -//============================================================ - - -bool PIC_LoadPic(const std::string &path, std::vector &tampon, uint &Width, uint &Height) -{ - uint32 id; - unsigned char *pal, *data; - unsigned long w,h,depth; - uint i; - - - // Loadons l'image. - id= PIC_Load((char*)path.c_str(), 0); - if(id==0) - return false; - PIC_GetInfos( id, &pal, &data, &w, &h, &depth); - Width=w; - Height=h; - - // On traduit en RGBA. - tampon.resize(w*h); - switch(depth) - { - case 8: - for(i=0;i -#include -using namespace std; -#include -#include - -//============================================================ -// API. -//============================================================ - - -bool PIC_LoadPic(const std::string &Path, std::vector &tampon, uint &Width, uint &Height); - - - -#endif diff --git a/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp b/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp index 037ac65e8..063b4cf47 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.cpp @@ -14,18 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include -#include -#include -#include -#include -#include -#include -#include "nel/3d/tile_bank.h" -#include "nel/misc/bitmap.h" -#include "nel/misc/file.h" -#include "pic/readpic.h" -#include "pic/pic.h" +#include "common.h" + #include "tile_browser_dlg.h" #include "tile_rotation_dlg.h" @@ -109,10 +99,10 @@ void CTile_browser_dlg::initDialog(const int& tileSetIndex) tileZoomButtonGroup->button(settings.value("browser/TileZoom").toInt())->setChecked(true); //GroupBox checkedIdChanged subscription - connect(tileTypeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(on_tileTypeButtonGroup_clicked(int))); + connect(tileTypeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(on_tileTypeButtonGroup_clicked(int))); connect(tileTextureButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(on_tileTextureButtonGroup_clicked(int))); - connect(tileLabelButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(on_tileLabelButtonGroup_clicked(int))); - connect(tileZoomButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(on_tileZoomButtonGroup_clicked(int))); + connect(tileLabelButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(on_tileLabelButtonGroup_clicked(int))); + connect(tileZoomButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(on_tileZoomButtonGroup_clicked(int))); //Tile View Model tileViewModel = new tiles_model(this); @@ -220,7 +210,7 @@ void CTile_browser_dlg::on_actionAddTile_triggered(bool checked) { QFileDialog::Options options; QString selectedFilter; - QStringList fileNames = QFileDialog::getOpenFileNames(this, "Choose Bitmap", QString(tileBankBrowser.getAbsPath().c_str()) , "Targa Bitmap(*.tga);;All Files (*.*);;", &selectedFilter, options); + QStringList fileNames = QFileDialog::getOpenFileNames(this, "Choose Bitmap", QString(tileBankBrowser.getAbsPath().c_str()) , "All supported files (*.png;*.tga);;PNG Bitmap (*.png);;Targa Bitmap(*.tga);;All Files (*.*);;", &selectedFilter, options); qSort(fileNames.begin(), fileNames.end()); @@ -294,7 +284,7 @@ void CTile_browser_dlg::on_actionReplaceImage_triggered(bool checked) { QFileDialog::Options options; QString selectedFilter; - QString fileName = QFileDialog::getOpenFileName(this, "Choose Bitmap", QString(tileBankBrowser.getAbsPath().c_str()) , "Targa Bitmap(*.tga);;All Files (*.*);;", &selectedFilter, options); + QString fileName = QFileDialog::getOpenFileName(this, "Choose Bitmap", QString(tileBankBrowser.getAbsPath().c_str()) , "All supported files (*.png;*.tga);;PNG Bitmap (*.png);;Targa Bitmap(*.tga);;All Files (*.*);;", &selectedFilter, options); if (!fileName.isEmpty()) { @@ -406,7 +396,7 @@ void CTile_browser_dlg::on_batchLoadPushButton_clicked() { QFileDialog::Options options; QString selectedFilter; - QString fileName = QFileDialog::getOpenFileName(this, tr("Choose Bitmap"), QString(tileBankBrowser.getAbsPath().c_str()) , tr("Targa Bitmap (*.tga);;PNG Image (*.png);;All Files (*.*);;"), &selectedFilter, options); + QString fileName = QFileDialog::getOpenFileName(this, tr("Choose Bitmap"), QString(tileBankBrowser.getAbsPath().c_str()) , tr("All supported files (*.png;*.tga);;PNG Bitmap (*.png);;Targa Bitmap (*.tga);;All Files (*.*);;"), &selectedFilter, options); QFileInfo fi(fileName); QString baseName = fi.baseName() ; @@ -507,7 +497,7 @@ void CTile_browser_dlg::on_exportBorderPushButton_clicked() // Select a file QFileDialog::Options options; QString selectedFilter; - QString fileName = QFileDialog::getSaveFileName(this, tr("Choose Bitmap"), QString(tileBankBrowser.getAbsPath().c_str()) , "Targa Bitmap(*.tga);;All Files (*.*);;", &selectedFilter, options); + QString fileName = QFileDialog::getSaveFileName(this, tr("Choose Bitmap"), QString(tileBankBrowser.getAbsPath().c_str()) , "All supported files (*.png;*.tga);;PNG Bitmap (*.png);;Targa Bitmap(*.tga);;All Files (*.*);;", &selectedFilter, options); if (!fileName.isEmpty()) { @@ -578,7 +568,7 @@ void CTile_browser_dlg::on_importBorderPushButton_clicked() { QFileDialog::Options options; QString selectedFilter; - QString fileName = QFileDialog::getOpenFileName(this, tr("Choose Bitmap"), QString(tileBankBrowser.getAbsPath().c_str()) , "Targa Bitmap(*.tga);;All Files (*.*);;", &selectedFilter, options); + QString fileName = QFileDialog::getOpenFileName(this, tr("Choose Bitmap"), QString(tileBankBrowser.getAbsPath().c_str()) , "All supported files (*.png;*.tga);;PNG Bitmap (*.png);;Targa Bitmap(*.tga);;All Files (*.*);;", &selectedFilter, options); if (!fileName.isEmpty()) { diff --git a/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.h b/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.h index bfb45722c..b25bc4279 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.h +++ b/code/nel/tools/3d/tile_edit_qt/tile_browser_dlg.h @@ -17,14 +17,10 @@ #ifndef TILE_BROWSERDLG_H #define TILE_BROWSERDLG_H -#include -#include -#include #include "ui_tile_browser_qt.h" #include "tiles_model.h" #include "browser_model.h" - class CTile_browser_dlg : public QDialog { Q_OBJECT diff --git a/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp b/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp index 595067cd2..2b6612e9c 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp @@ -14,14 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include -#include -#include -#include -#include -#include -#include -#include +#include "common.h" #include "tile_edit_dlg.h" #include "items_edit_dlg.h" #include "tile_browser_dlg.h" diff --git a/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.h b/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.h index 97d0dd760..88c32bd05 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.h +++ b/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.h @@ -17,8 +17,6 @@ #ifndef TILE_EDITDLG_H #define TILE_EDITDLG_H -#include -#include #include "ui_tile_edit_qt.h" class QCheckBox; diff --git a/code/nel/tools/3d/tile_edit_qt/tile_listwidgetitem.cpp b/code/nel/tools/3d/tile_edit_qt/tile_listwidgetitem.cpp index 475b9da73..9b70e4c24 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_listwidgetitem.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tile_listwidgetitem.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "common.h" #include "tile_listwidgetitem.h" //tile_listwidgetitem::tile_listwidgetitem(void) diff --git a/code/nel/tools/3d/tile_edit_qt/tile_rotation_dlg.cpp b/code/nel/tools/3d/tile_edit_qt/tile_rotation_dlg.cpp index c053bab8e..a1d4a2786 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_rotation_dlg.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tile_rotation_dlg.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "common.h" #include "tile_rotation_dlg.h" CTile_rotation_dlg::CTile_rotation_dlg(QWidget *parent, Qt::WindowFlags flags) diff --git a/code/nel/tools/3d/tile_edit_qt/tile_rotation_dlg.h b/code/nel/tools/3d/tile_edit_qt/tile_rotation_dlg.h index 1891873a5..852aa17ad 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_rotation_dlg.h +++ b/code/nel/tools/3d/tile_edit_qt/tile_rotation_dlg.h @@ -17,10 +17,6 @@ #ifndef TILE_ROTATIONDLG_H #define TILE_ROTATIONDLG_H - -#include -#include -#include #include "ui_tile_rotation_qt.h" class CTile_rotation_dlg : public QDialog diff --git a/code/nel/tools/3d/tile_edit_qt/tile_widget.cpp b/code/nel/tools/3d/tile_edit_qt/tile_widget.cpp index bd4a58b8c..d789e45c2 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_widget.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tile_widget.cpp @@ -1,3 +1,4 @@ +#include "common.h" #include #include "tile_widget.h" diff --git a/code/nel/tools/3d/tile_edit_qt/tile_widget.h b/code/nel/tools/3d/tile_edit_qt/tile_widget.h index e0ca41d10..994c4b8f4 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_widget.h +++ b/code/nel/tools/3d/tile_edit_qt/tile_widget.h @@ -1,7 +1,6 @@ #ifndef TILE_WIDGET_H #define TILE_WIDGET_H -#include #include "tiles_model.h" #include "ui_tile_widget_qt.h" diff --git a/code/nel/tools/3d/tile_edit_qt/tiles_model.cpp b/code/nel/tools/3d/tile_edit_qt/tiles_model.cpp index 252b39298..cabd810d7 100644 --- a/code/nel/tools/3d/tile_edit_qt/tiles_model.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tiles_model.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "common.h" #include #include "tiles_model.h" #include "tile_widget.h" @@ -52,29 +53,31 @@ tiles_model::tiles_model(QObject *parent) QVariant tiles_model::data(const QModelIndex &index, int role) const { - if (!index.isValid()) - return QVariant(); + if (!index.isValid()) + return QVariant(); - if (role == Qt::DecorationRole || role == Qt::UserRole) + if (role == Qt::DecorationRole || role == Qt::UserRole) { - CTile_Widget* wiwi = new CTile_Widget; - wiwi->initWidget( tiles.value(index.row()).getPixmap(), tiles.value(index.row()).getPixmapSide(), tiles.value(index.row()).getTileLabel() ); - QPixmap pixpix = QPixmap::grabWidget(wiwi, wiwi->contentsRect()); - delete wiwi; + CTile_Widget wiwi; + wiwi.initWidget(tiles.value(index.row()).getPixmap(), tiles.value(index.row()).getPixmapSide(), tiles.value(index.row()).getTileLabel()); +#ifdef USE_QT5 + QPixmap pixpix = wiwi.grab(wiwi.contentsRect()); +#else + QPixmap pixpix = QPixmap::grabWidget(&wiwi, wiwi.contentsRect()); +#endif return pixpix; } - else if (role == Qt::UserRole + 1) + else if (role == Qt::UserRole + 1) { - return tiles.value(index.row()).getIndex(); + return tiles.value(index.row()).getIndex(); } - return QVariant(); + return QVariant(); } void tiles_model::sort ( int column, Qt::SortOrder order) { qSort(tiles.begin(), tiles.end(), caseInsensitiveLessThan); - } diff --git a/code/nel/tools/3d/tile_edit_qt/tiles_model.h b/code/nel/tools/3d/tile_edit_qt/tiles_model.h index b224adf3b..57aee8687 100644 --- a/code/nel/tools/3d/tile_edit_qt/tiles_model.h +++ b/code/nel/tools/3d/tile_edit_qt/tiles_model.h @@ -1,15 +1,6 @@ #ifndef TILESMODEL_H #define TILESMODEL_H -#include -#include -#include -#include -#include -#include -#include -#include - class TileModel { diff --git a/code/nel/tools/3d/zviewer/CMakeLists.txt b/code/nel/tools/3d/zviewer/CMakeLists.txt index a7a5150b7..35472f39c 100644 --- a/code/nel/tools/3d/zviewer/CMakeLists.txt +++ b/code/nel/tools/3d/zviewer/CMakeLists.txt @@ -14,4 +14,9 @@ NL_ADD_RUNTIME_FLAGS(zviewer) INSTALL(TARGETS zviewer RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) INSTALL(FILES zviewer.cfg DESTINATION ${NL_ETC_PREFIX} COMPONENT tools3d) -INSTALL(FILES readme.txt DESTINATION ${NL_SHARE_PREFIX}/zviewer COMPONENT tools3d) + +IF(WITH_UNIX_STRUCTURE) + INSTALL(FILES readme.txt DESTINATION ${NL_SHARE_PREFIX}/zviewer COMPONENT tools3d) +ELSE() + INSTALL(FILES readme.txt DESTINATION ${NL_SHARE_PREFIX} COMPONENT tools3d RENAME zviewer.txt) +ENDIF() diff --git a/code/nel/tools/CMakeLists.txt b/code/nel/tools/CMakeLists.txt index 0e1c5709d..8734bf103 100644 --- a/code/nel/tools/CMakeLists.txt +++ b/code/nel/tools/CMakeLists.txt @@ -1,31 +1,35 @@ # Don't add other subdirectories if only max plugins are selected. +ADD_SUBDIRECTORY(misc) + IF(WITH_NEL_TOOLS) - ADD_SUBDIRECTORY(misc) ADD_SUBDIRECTORY(memory) -ENDIF(WITH_NEL_TOOLS) +ENDIF() # Max plugins are under the 3d directory as well. -ADD_SUBDIRECTORY(3d) +# Allow to compile only max plugins without other tools. +IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) + ADD_SUBDIRECTORY(3d) +ENDIF() # Don't add other subdirectories if only max plugins are selected. IF(WITH_NEL_TOOLS) IF(WITH_PACS) ADD_SUBDIRECTORY(pacs) - ENDIF(WITH_PACS) + ENDIF() IF(WITH_LOGIC) ADD_SUBDIRECTORY(logic) - ENDIF(WITH_LOGIC) + ENDIF() IF(WITH_GEORGES) ADD_SUBDIRECTORY(georges) - ENDIF(WITH_GEORGES) + ENDIF() IF(WITH_SOUND) ADD_SUBDIRECTORY(sound) - ENDIF(WITH_SOUND) - - IF(WITH_NEL_TESTS) - ADD_SUBDIRECTORY(nel_unit_test) - ENDIF(WITH_NEL_TESTS) -ENDIF(WITH_NEL_TOOLS) + ENDIF() +ENDIF() + +IF(WITH_NEL_TESTS) + ADD_SUBDIRECTORY(nel_unit_test) +ENDIF() diff --git a/code/nel/tools/build_gamedata/d1_client_patch.py b/code/nel/tools/build_gamedata/d1_client_patch.py index 600347d0b..449d6e0b7 100755 --- a/code/nel/tools/build_gamedata/d1_client_patch.py +++ b/code/nel/tools/build_gamedata/d1_client_patch.py @@ -136,7 +136,7 @@ else: needUpdateBnp = needUpdateDirNoSubdirFile(log, sourcePath, targetBnp) if (needUpdateBnp): printLog(log, "BNP " + targetBnp) - subprocess.call([ BnpMake, "/p", sourcePath, targetPath ] + package[1]) + subprocess.call([ BnpMake, "-p", sourcePath, "-o", targetBnp ] + package[1][1:]) else: printLog(log, "SKIP " + targetBnp) printLog(log, "") diff --git a/code/nel/tools/georges/georges2csv/CMakeLists.txt b/code/nel/tools/georges/georges2csv/CMakeLists.txt index b52de14ea..efb489f82 100644 --- a/code/nel/tools/georges/georges2csv/CMakeLists.txt +++ b/code/nel/tools/georges/georges2csv/CMakeLists.txt @@ -2,12 +2,8 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(georges2csv ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(georges2csv nelmisc nelgeorges) NL_DEFAULT_PROPS(georges2csv "NeL, Tools, Georges: georges2csv") NL_ADD_RUNTIME_FLAGS(georges2csv) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) - INSTALL(TARGETS georges2csv RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT toolsgeorges) diff --git a/code/nel/tools/georges/georges2csv/georges2csv.cpp b/code/nel/tools/georges/georges2csv/georges2csv.cpp index f400a2976..018a6abff 100644 --- a/code/nel/tools/georges/georges2csv/georges2csv.cpp +++ b/code/nel/tools/georges/georges2csv/georges2csv.cpp @@ -44,10 +44,6 @@ #include "nel/georges/u_form_loader.h" #include "nel/georges/load_form.h" -// Include from libxml2 -#include -#include - // Georges, bypassing interface #include "nel/georges/form.h" diff --git a/code/nel/tools/logic/logic_editor_dll/StdAfx.h b/code/nel/tools/logic/logic_editor_dll/StdAfx.h index 5b5e991ce..7aec1acb4 100644 --- a/code/nel/tools/logic/logic_editor_dll/StdAfx.h +++ b/code/nel/tools/logic/logic_editor_dll/StdAfx.h @@ -11,8 +11,8 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - #define NOMINMAX +#define _WIN32_WINNT 0x0501 #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/misc/CMakeLists.txt b/code/nel/tools/misc/CMakeLists.txt index c9bbcd058..8f962d1f2 100644 --- a/code/nel/tools/misc/CMakeLists.txt +++ b/code/nel/tools/misc/CMakeLists.txt @@ -1,23 +1,29 @@ -SUBDIRS(bnp_make disp_sheet_id extract_filename lock make_sheet_id xml_packer) - -IF(WITH_QT) - ADD_SUBDIRECTORY(words_dic_qt) - ADD_SUBDIRECTORY(message_box_qt) +# always compile crash report +IF(WITH_QT OR WITH_QT5) ADD_SUBDIRECTORY(crash_report) -ENDIF(WITH_QT) +ENDIF() + +IF(WITH_NEL_TOOLS) + SUBDIRS(bnp_make disp_sheet_id extract_filename lock make_sheet_id xml_packer) + + IF(WITH_QT OR WITH_QT5) + ADD_SUBDIRECTORY(words_dic_qt) + ADD_SUBDIRECTORY(message_box_qt) + ENDIF() -IF(WIN32) - ADD_SUBDIRECTORY(exec_timeout) - ADD_SUBDIRECTORY(message_box) - ADD_SUBDIRECTORY(multi_cd_setup_fix) + IF(WIN32) + ADD_SUBDIRECTORY(exec_timeout) + ADD_SUBDIRECTORY(message_box) + ADD_SUBDIRECTORY(multi_cd_setup_fix) - IF(MFC_FOUND) - ADD_SUBDIRECTORY(branch_patcher) - ADD_SUBDIRECTORY(data_mirror) - ADD_SUBDIRECTORY(log_analyser) - ADD_SUBDIRECTORY(log_analyser_plug_ins) - ADD_SUBDIRECTORY(words_dic) - ENDIF(MFC_FOUND) -ENDIF(WIN32) + IF(MFC_FOUND) + ADD_SUBDIRECTORY(branch_patcher) + ADD_SUBDIRECTORY(data_mirror) + ADD_SUBDIRECTORY(log_analyser) + ADD_SUBDIRECTORY(log_analyser_plug_ins) + ADD_SUBDIRECTORY(words_dic) + ENDIF() + ENDIF() -ADD_SUBDIRECTORY(probe_timers) + ADD_SUBDIRECTORY(probe_timers) +ENDIF() diff --git a/code/nel/tools/misc/bnp_make/main.cpp b/code/nel/tools/misc/bnp_make/main.cpp index a3f34a6a4..868f36f62 100644 --- a/code/nel/tools/misc/bnp_make/main.cpp +++ b/code/nel/tools/misc/bnp_make/main.cpp @@ -32,6 +32,8 @@ #include "nel/misc/path.h" #include "nel/misc/algo.h" #include "nel/misc/common.h" +#include "nel/misc/big_file.h" +#include "nel/misc/cmd_args.h" using namespace std; @@ -49,7 +51,7 @@ std::vector WildCards; // --------------------------------------------------------------------------- -bool keepFile (const char *fileName) +bool keepFile (const std::string &fileName) { uint i; bool ifPresent = false; @@ -60,13 +62,13 @@ bool keepFile (const char *fileName) if (WildCards[i].Not) { // One ifnot condition met and the file is not added - if (testWildCard(file.c_str(), WildCards[i].Expression.c_str())) + if (testWildCard(file, WildCards[i].Expression)) return false; } else { ifPresent = true; - ifTrue |= testWildCard(file.c_str(), WildCards[i].Expression.c_str()); + ifTrue |= testWildCard(file, WildCards[i].Expression); } } @@ -75,199 +77,7 @@ bool keepFile (const char *fileName) // --------------------------------------------------------------------------- -struct BNPFile -{ - string Name; - uint32 Size; - uint32 Pos; -}; - -struct BNPHeader -{ - vector Files; - uint32 OffsetFromBeginning; - - // Append the header to the big file - bool append (const string &filename) - { - FILE *f = fopen (filename.c_str(), "ab"); - if (f == NULL) return false; - - uint32 nNbFile = (uint32)Files.size(); - - // value to be serialized - uint32 nNbFile2 = nNbFile; - -#ifdef NL_BIG_ENDIAN - NLMISC_BSWAP32(nNbFile2); -#endif - - if (fwrite (&nNbFile2, sizeof(uint32), 1, f) != 1) - { - fclose(f); - return false; - } - - for (uint32 i = 0; i < nNbFile; ++i) - { - uint8 nStringSize = (uint8)Files[i].Name.size(); - if (fwrite (&nStringSize, 1, 1, f) != 1) - { - fclose(f); - return false; - } - - if (fwrite (Files[i].Name.c_str(), 1, nStringSize, f) != nStringSize) - { - fclose(f); - return false; - } - - uint32 nFileSize = Files[i].Size; - -#ifdef NL_BIG_ENDIAN - NLMISC_BSWAP32(nFileSize); -#endif - - if (fwrite (&nFileSize, sizeof(uint32), 1, f) != 1) - { - fclose(f); - return false; - } - - uint32 nFilePos = Files[i].Pos; - -#ifdef NL_BIG_ENDIAN - NLMISC_BSWAP32(nFilePos); -#endif - - if (fwrite (&nFilePos, sizeof(uint32), 1, f) != 1) - { - fclose(f); - return false; - } - } - - uint32 nOffsetFromBeginning = OffsetFromBeginning; - -#ifdef NL_BIG_ENDIAN - NLMISC_BSWAP32(nOffsetFromBeginning); -#endif - - if (fwrite (&nOffsetFromBeginning, sizeof(uint32), 1, f) != 1) - { - fclose(f); - return false; - } - - fclose (f); - return true; - } - - // Read the header from a big file - bool read (const string &filename) - { - FILE *f = fopen (filename.c_str(), "rb"); - if (f == NULL) return false; - - nlfseek64 (f, 0, SEEK_END); - uint32 nFileSize=CFile::getFileSize (filename); - nlfseek64 (f, nFileSize-sizeof(uint32), SEEK_SET); - - uint32 nOffsetFromBeginning; - if (fread (&nOffsetFromBeginning, sizeof(uint32), 1, f) != 1) - { - fclose (f); - return false; - } - -#ifdef NL_BIG_ENDIAN - NLMISC_BSWAP32(nOffsetFromBeginning); -#endif - - if (nlfseek64 (f, nOffsetFromBeginning, SEEK_SET) != 0) - { - fclose (f); - return false; - } - - uint32 nNbFile; - if (fread (&nNbFile, sizeof(uint32), 1, f) != 1) - { - fclose (f); - return false; - } - -#ifdef NL_BIG_ENDIAN - NLMISC_BSWAP32(nNbFile); -#endif - - for (uint32 i = 0; i < nNbFile; ++i) - { - uint8 nStringSize; - char sName[256]; - if (fread (&nStringSize, 1, 1, f) != 1) - { - fclose (f); - return false; - } - if (fread (sName, 1, nStringSize, f) != nStringSize) - { - fclose (f); - return false; - } - sName[nStringSize] = 0; - BNPFile tmpBNPFile; - tmpBNPFile.Name = sName; - if (fread (&tmpBNPFile.Size, sizeof(uint32), 1, f) != 1) - { - fclose (f); - return false; - } - -#ifdef NL_BIG_ENDIAN - NLMISC_BSWAP32(tmpBNPFile.Size); -#endif - - if (fread (&tmpBNPFile.Pos, sizeof(uint32), 1, f) != 1) - { - fclose (f); - return false; - } - -#ifdef NL_BIG_ENDIAN - NLMISC_BSWAP32(tmpBNPFile.Pos); -#endif - - Files.push_back (tmpBNPFile); - } - - fclose (f); - return true; - } -}; - -string gDestBNPFile; -BNPHeader gBNPHeader; - -// --------------------------------------------------------------------------- -void append(const string &filename1, const string &filename2, uint32 sizeToRead) -{ - FILE *f1 = fopen(filename1.c_str(), "ab"); - FILE *f2 = fopen(filename2.c_str(), "rb"); - if (f1 == NULL) return; - if (f2 == NULL) { fclose(f1); return; } - - uint8 *ptr = new uint8[sizeToRead]; - if (fread (ptr, sizeToRead, 1, f2) != 1) - nlwarning("%s read error", filename2.c_str()); - if (fwrite (ptr, sizeToRead, 1, f1) != 1) - nlwarning("%s write error", filename1.c_str()); - delete [] ptr; - - fclose(f2); - fclose(f1); -} +NLMISC::CBigFile::BNP gBNPHeader; // --------------------------------------------------------------------------- bool i_comp(const string &s0, const string &s1) @@ -275,301 +85,154 @@ bool i_comp(const string &s0, const string &s1) return nlstricmp (CFile::getFilename(s0).c_str(), CFile::getFilename(s1).c_str()) < 0; } -void packSubRecurse () +void packSubRecurse(const std::string &srcDirectory) { vector pathContent; - string cp = CPath::getCurrentPath(); - printf ("Treating directory : %s\n", cp.c_str()); - CPath::getPathContent(cp, true, false, true, pathContent); + printf ("Treating directory: %s\n", srcDirectory.c_str()); + CPath::getPathContent(srcDirectory, true, false, true, pathContent); + + if (pathContent.empty()) return; // Sort filename sort (pathContent.begin(), pathContent.end(), i_comp); - uint i; - for (i=0; i [] [] [option] ... [option]\n"); - printf (" option : \n"); - printf (" -if wildcard : add the file if it matches the wilcard (at least one 'if' conditions must be met for a file to be adding)\n"); - printf (" -ifnot wildcard : add the file if it doesn't match the wilcard (all the 'ifnot' conditions must be met for a file to be adding)\n"); - printf (" Pack the directory to a bnp file\n"); - printf (" bnp_make /u \n"); - printf (" Unpack the bnp file to a directory\n"); - printf (" bnp_make /l \n"); - printf (" List the files contained in the bnp file\n"); -} + args.addArg("p", "pack", "", "Pack the directory to a BNP file"); + args.addArg("u", "unpack", "", "Unpack the BNP file to a directory"); + args.addArg("l", "list", "", "List the files contained in the BNP file"); + args.addArg("o", "output", "destination", "Output directory or file"); + args.addArg("i", "if", "wildcard", "Add the file if it matches the wilcard (at least one 'if' conditions must be met for a file to be adding)", false); + args.addArg("n", "ifnot", "wildcard", "Add the file if it doesn't match the wilcard (all the 'ifnot' conditions must be met for a file to be adding)", false); + args.addAdditionalArg("input", "Input directory or BNP file depending on command"); -// --------------------------------------------------------------------------- + if (!args.parse(argc, argv)) return 1; -uint readOptions (int nNbArg, char **ppArgs) -{ - uint i; - uint optionCount = 0; - for (i=0; i<(uint)nNbArg; i++) + if (args.haveArg("p")) { + std::vector filters; + // If ? - if ((strcmp (ppArgs[i], "-if") == 0) && ((i+1)<(uint)nNbArg)) + filters = args.getLongArg("if"); + + for (uint i = 0; i < filters.size(); ++i) { CWildCard card; - card.Expression = toLower(string(ppArgs[i+1])); + card.Expression = toLower(filters[i]); card.Not = false; - WildCards.push_back (card); - optionCount += 2; + WildCards.push_back(card); } + // If not ? - if ((strcmp (ppArgs[i], "-ifnot") == 0) && ((i+1)<(uint)nNbArg)) + filters = args.getLongArg("ifnot"); + + for (uint i = 0; i < filters.size(); ++i) { CWildCard card; - card.Expression = toLower(string(ppArgs[i+1])); + card.Expression = toLower(filters[i]); card.Not = true; - WildCards.push_back (card); - optionCount += 2; + WildCards.push_back(card); } - } - return optionCount; -} - -// --------------------------------------------------------------------------- -int main (int nNbArg, char **ppArgs) -{ - NLMISC::CApplicationContext myApplicationContext; - - if (nNbArg < 3) - { - usage(); - return -1; - } - if ((strcmp(ppArgs[1], "/p") == 0) || (strcmp(ppArgs[1], "/P") == 0) || - (strcmp(ppArgs[1], "-p") == 0) || (strcmp(ppArgs[1], "-P") == 0)) - { // Pack a directory - uint count = readOptions (nNbArg, ppArgs); - nNbArg -= count; - - // Read options - - string sCurDir; - - if (nNbArg >= 4) - { - // store current path - sCurDir = CPath::getCurrentPath(); + std::string srcDirectory = args.getAdditionalArg("input").front(); - // go to the dest path - string sDestDir; - if (CPath::setCurrentPath(ppArgs[3])) - { - sDestDir = CPath::getCurrentPath(); - - bool tmp = CPath::setCurrentPath(sCurDir.c_str()); - // restore current path, should not failed - nlassert (tmp); // removed in release - - // go to the source dir - if (CPath::setCurrentPath(ppArgs[2])) - { - sCurDir = CPath::getCurrentPath(); - - gDestBNPFile = CPath::standardizePath(sDestDir); - - if(nNbArg == 5) - { - gDestBNPFile += ppArgs[4]; - // add ext if necessary - if (string(ppArgs[4]).find(".") == string::npos) - gDestBNPFile += string(".bnp"); - } - else - { - const char *pos = strrchr (sCurDir.c_str(), '/'); - if (pos != NULL) - { - gDestBNPFile += string(pos+1); - } - // get the dest file name - gDestBNPFile += string(".bnp"); - } - } - else - { - nlwarning ("ERROR (bnp_make) : can't set current directory to %s", ppArgs[2]); - return -1; - } - } - else - { - nlwarning ("ERROR (bnp_make) : can't set current directory to %s", ppArgs[3]); - return -1; - } - } - else + if (!CFile::isDirectory(srcDirectory) || !CFile::isExists(srcDirectory)) { - if (chdir (ppArgs[2]) == -1) - { - nlwarning ("ERROR (bnp_make) : can't set current directory to %s", ppArgs[2]); - return -1; - } - //getcwd (sCurDir, MAX_PATH); - gDestBNPFile = CPath::getCurrentPath() + string(".bnp"); + nlwarning("Error: %s doesn't exist or is not a directory!", srcDirectory.c_str()); } - - remove (gDestBNPFile.c_str()); - gBNPHeader.OffsetFromBeginning = 0; - packSubRecurse(); - gBNPHeader.append (gDestBNPFile); - return 0; - } - if ((strcmp(ppArgs[1], "/u") == 0) || (strcmp(ppArgs[1], "/U") == 0) || - (strcmp(ppArgs[1], "-u") == 0) || (strcmp(ppArgs[1], "-U") == 0)) - { - string::size_type i; - string path; - gDestBNPFile = ppArgs[2]; - if ((gDestBNPFile.rfind('/') != string::npos) || (gDestBNPFile.rfind('/') != string::npos)) + // Output directory or filename + if (args.haveArg("o")) { - string::size_type pos = gDestBNPFile.rfind('/'); - if (pos == string::npos) - pos = gDestBNPFile.rfind('/'); - for (i = 0; i <= pos; ++i) - path += gDestBNPFile[i]; - string wholeName = gDestBNPFile; - gDestBNPFile = ""; - for (; i < wholeName.size(); ++i) - gDestBNPFile += wholeName[i]; - if (CPath::setCurrentPath(path.c_str())) - { - path = CPath::getCurrentPath(); - } - else + gBNPHeader.BigFileName = args.getArg("o").front(); + + if (CFile::isDirectory(gBNPHeader.BigFileName)) { - nlwarning ("ERROR (bnp_make) : can't set current directory to %s", path.c_str()); - return -1; + gBNPHeader.BigFileName = CPath::standardizePath(gBNPHeader.BigFileName) + CFile::getFilename(srcDirectory); } } - if (stricmp (gDestBNPFile.c_str()+gDestBNPFile.size()-4, ".bnp") != 0) + else { - gDestBNPFile += ".bnp"; + gBNPHeader.BigFileName = CFile::getFilename(srcDirectory); } - string dirName; - for (i = 0; i < gDestBNPFile.size()-4; ++i) - dirName += gDestBNPFile[i]; - // Unpack a bnp file - if (!gBNPHeader.read (gDestBNPFile)) - return -1; - //mkdir (dirName.c_str()); - CFile::createDirectory(dirName); + if (CFile::getExtension(gBNPHeader.BigFileName) != "bnp") + gBNPHeader.BigFileName += ".bnp"; - unpack (dirName); + CFile::deleteFile(gBNPHeader.BigFileName); - return 0; + packSubRecurse(srcDirectory); + return gBNPHeader.appendHeader() ? 0:-1; } - if ((strcmp(ppArgs[1], "/l") == 0) || (strcmp(ppArgs[1], "/L") == 0) || - (strcmp(ppArgs[1], "-l") == 0) || (strcmp(ppArgs[1], "-L") == 0)) + if (args.haveArg("u")) { - string::size_type i; - string path; - gDestBNPFile = ppArgs[2]; - if ((gDestBNPFile.rfind('/') != string::npos) || (gDestBNPFile.rfind('/') != string::npos)) + gBNPHeader.BigFileName = args.getAdditionalArg("input").front(); + + std::string dirName; + + // Output directory or filename + if (args.haveArg("o")) { - string::size_type pos = gDestBNPFile.rfind('/'); - if (pos == string::npos) - pos = gDestBNPFile.rfind('/'); - for (i = 0; i <= pos; ++i) - path += gDestBNPFile[i]; - string wholeName = gDestBNPFile; - gDestBNPFile = ""; - for (; i < wholeName.size(); ++i) - gDestBNPFile += wholeName[i]; - if (CPath::setCurrentPath(path.c_str())) - { - path = CPath::getCurrentPath(); - } - else - { - nlwarning ("ERROR (bnp_make) : can't set current directory to %s", path.c_str()); - return -1; - } + dirName = args.getArg("o").front(); } - if (stricmp (gDestBNPFile.c_str()+gDestBNPFile.size()-4, ".bnp") != 0) + else { - gDestBNPFile += ".bnp"; + dirName = CFile::getFilenameWithoutExtension(gBNPHeader.BigFileName); } - string dirName; - for (i = 0; i < gDestBNPFile.size()-4; ++i) - dirName += gDestBNPFile[i]; // Unpack a bnp file - if (!gBNPHeader.read (gDestBNPFile)) - return -1; + return gBNPHeader.unpack(dirName) ? 0:-1; + } - for (i = 0; i < gBNPHeader.Files.size(); ++i) - printf ("%s\n", gBNPHeader.Files[i].Name.c_str()); + if (args.haveArg("l")) + { + gBNPHeader.BigFileName = args.getAdditionalArg("input").front(); + + // Read header of BNP file + if (!gBNPHeader.readHeader()) return -1; + + for (uint i = 0; i < gBNPHeader.SFiles.size(); ++i) + { + printf("%s\n", gBNPHeader.SFiles[i].Name.c_str()); + } return 0; } - usage (); + args.displayHelp(); return -1; } diff --git a/code/nel/tools/misc/branch_patcher/StdAfx.h b/code/nel/tools/misc/branch_patcher/StdAfx.h index d9bd15ce4..b85f337a0 100644 --- a/code/nel/tools/misc/branch_patcher/StdAfx.h +++ b/code/nel/tools/misc/branch_patcher/StdAfx.h @@ -22,6 +22,8 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define NOMINMAX +#define _WIN32_WINNT 0x0501 #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/misc/crash_report/CMakeLists.txt b/code/nel/tools/misc/crash_report/CMakeLists.txt index 0e2d2a9bc..1169aab8d 100644 --- a/code/nel/tools/misc/crash_report/CMakeLists.txt +++ b/code/nel/tools/misc/crash_report/CMakeLists.txt @@ -1,6 +1,8 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR} ${QT_INCLUDES}) -FILE(GLOB CRASHREPORT_SRC *.cpp) -FILE(GLOB CRASHREPORT_HDR *h) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR}) +FILE(GLOB CRASHREPORT_SRC *.cpp *.rc) +FILE(GLOB CRASHREPORT_HDR *.h) + +SET(CRASHREPORT_QRC resources.qrc) SET(CRASHREPORT_MOC_HDR crash_report_socket.h @@ -11,29 +13,38 @@ SET(CRASHREPORT_UI crash_report_widget.ui ) -SET(QT_USE_QTGUI TRUE) -SET(QT_USE_QTNETWORK TRUE) -SET(QT_USE_QTMAIN TRUE) -SET(QT_USE_QTOPENGL FALSE) -SET(QT_USE_QTXML FALSE) - -INCLUDE(${QT_USE_FILE}) -ADD_DEFINITIONS(${QT_DEFINITIONS}) - -QT4_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR}) -QT4_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI}) - -SOURCE_GROUP(QtResources FILES ${CRASHREPORT_UI}) +IF(WITH_QT) + SET(QT_USE_QTGUI TRUE) + SET(QT_USE_QTNETWORK TRUE) + SET(QT_USE_QTMAIN TRUE) + SET(QT_USE_QTOPENGL FALSE) + SET(QT_USE_QTXML FALSE) + + INCLUDE_DIRECTORIES(${QT_INCLUDES}) + INCLUDE(${QT_USE_FILE}) + ADD_DEFINITIONS(${QT_DEFINITIONS}) + + QT4_ADD_RESOURCES(CRASHREPORT_QRC_SRCS ${CRASHREPORT_QRC}) + QT4_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR}) + QT4_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI}) + + SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) +ELSE() + QT5_ADD_RESOURCES(CRASHREPORT_QRC_SRCS ${CRASHREPORT_QRC}) + QT5_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR}) + QT5_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI}) +ENDIF() + +SOURCE_GROUP(QtResources FILES ${CRASHREPORT_UI} ${CRASHREPORT_QRC_SRCS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${CRASHREPORT_UI_HDR}) -SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${CRASHREPORT_MOC_SRC}) +SOURCE_GROUP(QtGeneratedMocSrc FILES ${CRASHREPORT_MOC_SRC}) SOURCE_GROUP("source files" FILES ${CRASHREPORT_SRC}) SOURCE_GROUP("header files" FILES ${CRASHREPORT_HDR}) -ADD_EXECUTABLE(crash_report WIN32 MACOSX_BUNDLE ${CRASHREPORT_SRC} ${CRASHREPORT_MOC_HDR} ${CRASHREPORT_MOC_SRC} ${CRASHREPORT_UI_HDR}) -TARGET_LINK_LIBRARIES(crash_report ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) +ADD_EXECUTABLE(crash_report WIN32 ${CRASHREPORT_SRC} ${CRASHREPORT_HDR} ${CRASHREPORT_MOC_SRC} ${CRASHREPORT_UI_HDR} ${CRASHREPORT_QRC_SRCS}) +TARGET_LINK_LIBRARIES(crash_report ${QT_LIBRARIES}) NL_DEFAULT_PROPS(crash_report "NeL, Tools, Misc: Crash Report") NL_ADD_RUNTIME_FLAGS(crash_report) INSTALL(TARGETS crash_report RUNTIME DESTINATION ${NL_BIN_PREFIX}) - diff --git a/code/nel/tools/misc/crash_report/crash_report.cpp b/code/nel/tools/misc/crash_report/crash_report.cpp index c42f1ae6f..56aa5c87a 100644 --- a/code/nel/tools/misc/crash_report/crash_report.cpp +++ b/code/nel/tools/misc/crash_report/crash_report.cpp @@ -25,13 +25,15 @@ #include #include +#include "../../3d/shared_widgets/common.h" + class CCmdLineParser { public: static void parse( int argc, char **argv, std::vector< std::pair< std::string, std::string > > &v ) { std::stack< std::string > stack; - std::string key; + std::string key; std::string value; for( int i = argc - 1 ; i >= 0; i-- ) @@ -76,9 +78,25 @@ public: } }; -int main( int argc, char **argv ) +#ifdef QT_STATICPLUGIN + +#include + +#if defined(Q_OS_WIN32) + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) +#elif defined(Q_OS_MAC) + Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) +#elif defined(Q_OS_UNIX) + Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) +#endif + + Q_IMPORT_PLUGIN(QICOPlugin) + +#endif + +int main(int argc, char **argv) { -#ifndef WIN32 +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) // Workaround to default -style=gtk+ on recent Cinnamon versions char *currentDesktop = getenv("XDG_CURRENT_DESKTOP"); if (currentDesktop) @@ -91,21 +109,23 @@ int main( int argc, char **argv ) } #endif - QApplication app( argc, argv ); + NLQT::preApplication(); + QApplication app(argc, argv); + + QApplication::setWindowIcon(QIcon(":/icons/nevraxpill.ico")); std::vector< std::pair< std::string, std::string > > params; CCmdLineParser::parse( argc, argv, params ); CCrashReportWidget w; - w.setup( params ); + w.setup(params); w.show(); int ret = app.exec(); - if( ret != EXIT_SUCCESS ) + if(ret != EXIT_SUCCESS) return ret; else return w.getReturnValue(); - -} \ No newline at end of file +} diff --git a/code/nel/tools/misc/crash_report/crash_report.rc b/code/nel/tools/misc/crash_report/crash_report.rc new file mode 100644 index 000000000..e4949fd8f --- /dev/null +++ b/code/nel/tools/misc/crash_report/crash_report.rc @@ -0,0 +1,35 @@ +#include +#include "config.h" + +IDI_MAIN_ICON ICON DISCARDABLE "nevraxpill.ico" + +VS_VERSION_INFO VERSIONINFO +FILEVERSION NL_VERSION_RC +PRODUCTVERSION NL_VERSION_RC +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG +FILEFLAGS VS_FF_DEBUG +#else +FILEFLAGS 0x0L +#endif +FILEOS VOS__WINDOWS32 +FILETYPE VFT_APP +FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "Crash Report" + VALUE "FileVersion", NL_VERSION + VALUE "LegalCopyright", COPYRIGHT + VALUE "OriginalFilename", "crash_report.exe" + VALUE "ProductName", "Ryzom Core" + VALUE "ProductVersion", NL_VERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END diff --git a/code/nel/tools/misc/crash_report/crash_report_data.h b/code/nel/tools/misc/crash_report/crash_report_data.h index 5884e7eb4..8a7f2ffcb 100644 --- a/code/nel/tools/misc/crash_report/crash_report_data.h +++ b/code/nel/tools/misc/crash_report/crash_report_data.h @@ -20,8 +20,13 @@ #ifndef RCERROR_DATA #define RCERROR_DATA -#include +#include + +#ifdef Q_COMPILER_RVALUE_REFS +#undef Q_COMPILER_RVALUE_REFS +#endif +#include struct SCrashReportData { diff --git a/code/nel/tools/misc/crash_report/crash_report_socket.h b/code/nel/tools/misc/crash_report/crash_report_socket.h index 32ccc5da0..23965bf5d 100644 --- a/code/nel/tools/misc/crash_report/crash_report_socket.h +++ b/code/nel/tools/misc/crash_report/crash_report_socket.h @@ -20,9 +20,10 @@ #ifndef RCERROR_SOCKET #define RCERROR_SOCKET -#include #include "crash_report_data.h" +#include + class CCrashReportSocketPvt; class QNetworkReply; diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.cpp b/code/nel/tools/misc/crash_report/crash_report_widget.cpp index 218b3545c..80ad0df3d 100644 --- a/code/nel/tools/misc/crash_report/crash_report_widget.cpp +++ b/code/nel/tools/misc/crash_report/crash_report_widget.cpp @@ -56,9 +56,9 @@ CCrashReportWidget::~CCrashReportWidget() void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::string > > ¶ms ) { - for( int i = 0; i < params.size(); i++ ) + for(uint i = 0; i < params.size(); ++i) { - const std::pair< std::string, std::string > &p = params[ i ]; + const std::pair< std::string, std::string > &p = params[i]; const std::string &k = p.first; const std::string &v = p.second; diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.h b/code/nel/tools/misc/crash_report/crash_report_widget.h index f40e40854..fc5eae070 100644 --- a/code/nel/tools/misc/crash_report/crash_report_widget.h +++ b/code/nel/tools/misc/crash_report/crash_report_widget.h @@ -20,6 +20,7 @@ #ifndef RCERROR_WIDGET #define RCERROR_WIDGET +#include "crash_report_data.h" #include "ui_crash_report_widget.h" #include diff --git a/code/nel/tools/misc/crash_report/nevraxpill.ico b/code/nel/tools/misc/crash_report/nevraxpill.ico new file mode 100644 index 000000000..c5f250583 Binary files /dev/null and b/code/nel/tools/misc/crash_report/nevraxpill.ico differ diff --git a/code/nel/tools/misc/crash_report/resources.qrc b/code/nel/tools/misc/crash_report/resources.qrc new file mode 100644 index 000000000..8f7785aa4 --- /dev/null +++ b/code/nel/tools/misc/crash_report/resources.qrc @@ -0,0 +1,5 @@ + + + nevraxpill.ico + + diff --git a/code/nel/tools/misc/data_mirror/StdAfx.h b/code/nel/tools/misc/data_mirror/StdAfx.h index a065be4ed..697fe2127 100644 --- a/code/nel/tools/misc/data_mirror/StdAfx.h +++ b/code/nel/tools/misc/data_mirror/StdAfx.h @@ -11,6 +11,8 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define NOMINMAX +#define _WIN32_WINNT 0x0501 #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/misc/log_analyser/StdAfx.h b/code/nel/tools/misc/log_analyser/StdAfx.h index dc6dd46cf..7fdcd1587 100644 --- a/code/nel/tools/misc/log_analyser/StdAfx.h +++ b/code/nel/tools/misc/log_analyser/StdAfx.h @@ -27,6 +27,8 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define NOMINMAX +#define _WIN32_WINNT 0x0501 #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/misc/message_box_qt/CMakeLists.txt b/code/nel/tools/misc/message_box_qt/CMakeLists.txt index 408bf867e..be4dd2b63 100644 --- a/code/nel/tools/misc/message_box_qt/CMakeLists.txt +++ b/code/nel/tools/misc/message_box_qt/CMakeLists.txt @@ -1,13 +1,16 @@ -INCLUDE_DIRECTORIES(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE( ${QT_USE_FILE} ) +IF(WITH_QT) + INCLUDE_DIRECTORIES(${QT_INCLUDES}) + INCLUDE(${QT_USE_FILE}) +ENDIF() + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) FILE(GLOB MESSAGE_BOX_SRC *.cpp) SET( QT_USE_QT3SUPPORT TRUE) SET( QT_USE_QTXML TRUE) -ADD_EXECUTABLE(message_box_qt ${MESSAGE_BOX_SRC}) - +ADD_EXECUTABLE(message_box_qt WIN32 ${MESSAGE_BOX_SRC}) TARGET_LINK_LIBRARIES(message_box_qt ${QT_LIBRARIES} nelmisc) NL_DEFAULT_PROPS(message_box_qt "NeL, Tools, Misc: Qt Message Box") NL_ADD_RUNTIME_FLAGS(message_box_qt) diff --git a/code/nel/tools/misc/message_box_qt/main.cpp b/code/nel/tools/misc/message_box_qt/main.cpp index 5090bc951..22b72ea5a 100644 --- a/code/nel/tools/misc/message_box_qt/main.cpp +++ b/code/nel/tools/misc/message_box_qt/main.cpp @@ -1,7 +1,27 @@ +#include + +#ifdef Q_COMPILER_RVALUE_REFS +#undef Q_COMPILER_RVALUE_REFS +#endif + #include #include #include +#ifdef QT_STATICPLUGIN + +#include + +#if defined(Q_OS_WIN32) + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) +#elif defined(Q_OS_MAC) + Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) +#elif defined(Q_OS_UNIX) + Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) +#endif + +#endif + int main(int argc, char *argv[]) { QApplication app(argc, argv); diff --git a/code/nel/tools/misc/words_dic/StdAfx.h b/code/nel/tools/misc/words_dic/StdAfx.h index 5cc2d3e5b..9290bdfce 100644 --- a/code/nel/tools/misc/words_dic/StdAfx.h +++ b/code/nel/tools/misc/words_dic/StdAfx.h @@ -22,6 +22,8 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define NOMINMAX +#define _WIN32_WINNT 0x0501 #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/misc/words_dic_qt/CMakeLists.txt b/code/nel/tools/misc/words_dic_qt/CMakeLists.txt index 2f755dfc1..fc2ced95e 100644 --- a/code/nel/tools/misc/words_dic_qt/CMakeLists.txt +++ b/code/nel/tools/misc/words_dic_qt/CMakeLists.txt @@ -1,32 +1,39 @@ -INCLUDE_DIRECTORIES(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE( ${QT_USE_FILE} ) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -FILE(GLOB WORDS_DIC_SRC *.cpp) +FILE(GLOB WORDS_DIC_SRC *.cpp *.h) SET(WORDS_DIC_HDR words_dicDlg.h) SET(WORDS_DIC_UIS words_dic_Qt.ui) SET(WORDS_DIC_RCS words_dic_Qt.qrc) IF(WIN32) SET(WORDS_DIC_RC words_dic.rc) -ENDIF(WIN32) +ENDIF() ADD_DEFINITIONS(-DNL_WORDS_DIC_CFG="\\"${NL_ETC_PREFIX}/\\"") -SET( QT_USE_QT3SUPPORT TRUE) -SET( QT_USE_QTXML TRUE) +IF(WITH_QT) + INCLUDE_DIRECTORIES(${QT_INCLUDES}) + INCLUDE(${QT_USE_FILE}) -QT4_ADD_RESOURCES( WORDS_DIC_RC_SRCS ${WORDS_DIC_RCS} ) -QT4_WRAP_UI( WORDS_DIC_UI_HDRS ${WORDS_DIC_UIS} ) -QT4_WRAP_CPP( WORDS_DIC_MOC_SRCS ${WORDS_DIC_HDR}) + SET(QT_USE_QT3SUPPORT TRUE) + SET(QT_USE_QTXML TRUE) -ADD_EXECUTABLE(words_dic_qt ${WORDS_DIC_SRC} ${WORDS_DIC_MOC_SRCS} ${WORDS_DIC_RC_SRCS} ${WORDS_DIC_UI_HDRS} ${WORDS_DIC_RC}) + QT4_ADD_RESOURCES(WORDS_DIC_RC_SRCS ${WORDS_DIC_RCS}) + QT4_WRAP_UI(WORDS_DIC_UI_HDRS ${WORDS_DIC_UIS}) + QT4_WRAP_CPP(WORDS_DIC_MOC_SRCS ${WORDS_DIC_HDR}) + + ADD_DEFINITIONS(${QT_DEFINITIONS}) +ELSE() + QT5_ADD_RESOURCES(WORDS_DIC_RC_SRCS ${WORDS_DIC_RCS}) + QT5_WRAP_UI(WORDS_DIC_UI_HDRS ${WORDS_DIC_UIS}) + QT5_WRAP_CPP(WORDS_DIC_MOC_SRCS ${WORDS_DIC_HDR}) +ENDIF() + +ADD_EXECUTABLE(words_dic_qt WIN32 ${WORDS_DIC_SRC} ${WORDS_DIC_MOC_SRCS} ${WORDS_DIC_RC_SRCS} ${WORDS_DIC_UI_HDRS} ${WORDS_DIC_RC}) TARGET_LINK_LIBRARIES(words_dic_qt ${QT_LIBRARIES} nelmisc) NL_DEFAULT_PROPS(words_dic_qt "NeL, Tools, Misc: Qt Words Dic") NL_ADD_RUNTIME_FLAGS(words_dic_qt) -ADD_DEFINITIONS(${QT_DEFINITIONS}) - INSTALL(TARGETS words_dic_qt RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT toolsmisc) INSTALL(FILES words_dic.cfg DESTINATION ${NL_ETC_PREFIX} COMPONENT toolsmisc) - diff --git a/code/nel/tools/misc/words_dic_qt/main.cpp b/code/nel/tools/misc/words_dic_qt/main.cpp index 6799511bb..ae348c7aa 100644 --- a/code/nel/tools/misc/words_dic_qt/main.cpp +++ b/code/nel/tools/misc/words_dic_qt/main.cpp @@ -1,7 +1,8 @@ +#include "words_dicDlg.h" + #include #include "nel/misc/app_context.h" #include "nel/misc/path.h" -#include "words_dicDlg.h" #ifdef NL_OS_UNIX #include @@ -11,6 +12,20 @@ #define NL_WORDS_DIC_CFG "." #endif +#ifdef QT_STATICPLUGIN + +#include + +#if defined(Q_OS_WIN32) + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) +#elif defined(Q_OS_MAC) + Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) +#elif defined(Q_OS_UNIX) + Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) +#endif + +#endif + int main(int argc, char *argv[]) { diff --git a/code/nel/tools/misc/words_dic_qt/words_dicDlg.cpp b/code/nel/tools/misc/words_dic_qt/words_dicDlg.cpp index 683755ae6..8fd4a432b 100644 --- a/code/nel/tools/misc/words_dic_qt/words_dicDlg.cpp +++ b/code/nel/tools/misc/words_dic_qt/words_dicDlg.cpp @@ -1,10 +1,12 @@ +#include "words_dicDlg.h" + #include #include #include #include #include +#include #include -#include "words_dicDlg.h" using namespace std; using namespace NLMISC; diff --git a/code/nel/tools/misc/words_dic_qt/words_dicDlg.h b/code/nel/tools/misc/words_dic_qt/words_dicDlg.h index 22e8dbdd0..707eaaa44 100644 --- a/code/nel/tools/misc/words_dic_qt/words_dicDlg.h +++ b/code/nel/tools/misc/words_dic_qt/words_dicDlg.h @@ -1,7 +1,12 @@ - #ifndef WORDS_DICDLG_H #define WORDS_DICDLG_H +#include + +#ifdef Q_COMPILER_RVALUE_REFS +#undef Q_COMPILER_RVALUE_REFS +#endif + #include #include "ui_words_dic_Qt.h" diff --git a/code/nel/tools/nel_unit_test/CMakeLists.txt b/code/nel/tools/nel_unit_test/CMakeLists.txt index 8c53ff1c6..7e26a2498 100644 --- a/code/nel/tools/nel_unit_test/CMakeLists.txt +++ b/code/nel/tools/nel_unit_test/CMakeLists.txt @@ -2,12 +2,12 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(nel_unit_test ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CPPTEST_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${CPPTEST_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nel_unit_test ${CPPTEST_LIBRARIES} nelmisc nelnet nelligo) NL_DEFAULT_PROPS(nel_unit_test "Unit Tests") NL_ADD_RUNTIME_FLAGS(nel_unit_test) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DNEL_UNIT_BASE="${PROJECT_SOURCE_DIR}/tools/nel_unit_test/") +ADD_DEFINITIONS(-DNEL_UNIT_BASE="${PROJECT_SOURCE_DIR}/tools/nel_unit_test/") INSTALL(TARGETS nel_unit_test RUNTIME DESTINATION ${NL_BIN_PREFIX}) diff --git a/code/nel/tools/nel_unit_test/nel_unit_test.cpp b/code/nel/tools/nel_unit_test/nel_unit_test.cpp index da11922cb..753dfd46a 100644 --- a/code/nel/tools/nel_unit_test/nel_unit_test.cpp +++ b/code/nel/tools/nel_unit_test/nel_unit_test.cpp @@ -114,6 +114,20 @@ int main(int argc, char *argv[]) // init Nel context new NLMISC::CApplicationContext; + // disable nldebug messages in logs in Release +#ifdef NL_RELEASE + NLMISC::DisableNLDebug = true; +#endif + + NLMISC::createDebug(NULL); + +#ifndef NL_DEBUG + NLMISC::INelContext::getInstance().getDebugLog()->removeDisplayer("DEFAULT_SD"); + NLMISC::INelContext::getInstance().getInfoLog()->removeDisplayer("DEFAULT_SD"); + NLMISC::INelContext::getInstance().getWarningLog()->removeDisplayer("DEFAULT_SD"); + NLMISC::INelContext::getInstance().getErrorLog()->removeDisplayer("DEFAULT_SD"); +#endif // NL_DEBUG + bool noerrors = false; try @@ -132,7 +146,7 @@ int main(int argc, char *argv[]) if (html) { std::ofstream fout(outputFileName); - html->generate(fout, true, "NeLTest"); + html->generate(fout, true, "NeL"); } } catch (...) diff --git a/code/nel/tools/nel_unit_test/nel_unit_test.exp b/code/nel/tools/nel_unit_test/nel_unit_test.exp deleted file mode 100644 index f3dcfd7a9..000000000 Binary files a/code/nel/tools/nel_unit_test/nel_unit_test.exp and /dev/null differ diff --git a/code/nel/tools/nel_unit_test/ut_ligo_primitive.h b/code/nel/tools/nel_unit_test/ut_ligo_primitive.h index 8df4db877..d4ba5df5a 100644 --- a/code/nel/tools/nel_unit_test/ut_ligo_primitive.h +++ b/code/nel/tools/nel_unit_test/ut_ligo_primitive.h @@ -72,7 +72,7 @@ private: + " \n" + ""; - FILE *fp = fopen(CLASS_FILE_NAME, "wt"); + FILE *fp = NLMISC::nlfopen(CLASS_FILE_NAME, "wt"); nlassert(fp != NULL); size_t s = fwrite(classfile.data(), 1, classfile.size(), fp); nlassert(s == classfile.size()); diff --git a/code/nel/tools/nel_unit_test/ut_misc.h b/code/nel/tools/nel_unit_test/ut_misc.h index 8538d3f53..e7a3cc8c6 100644 --- a/code/nel/tools/nel_unit_test/ut_misc.h +++ b/code/nel/tools/nel_unit_test/ut_misc.h @@ -19,6 +19,7 @@ #include "ut_misc_co_task.h" #include "ut_misc_command.h" +#include "ut_misc_common.h" #include "ut_misc_config_file.h" #include "ut_misc_debug.h" #include "ut_misc_dynlibload.h" @@ -38,6 +39,7 @@ struct CUTMisc : public Test::Suite { add(auto_ptr(new CUTMiscCoTask)); add(auto_ptr(new CUTMiscCommand)); + add(auto_ptr(new CUTMiscCommon)); add(auto_ptr(new CUTMiscConfigFile)); add(auto_ptr(new CUTMiscDebug)); add(auto_ptr(new CUTMiscDynLibLoad)); diff --git a/code/nel/tools/nel_unit_test/ut_misc_common.h b/code/nel/tools/nel_unit_test/ut_misc_common.h new file mode 100644 index 000000000..d33d65064 --- /dev/null +++ b/code/nel/tools/nel_unit_test/ut_misc_common.h @@ -0,0 +1,171 @@ +// NeL - MMORPG Framework +// 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 . + +#ifndef UT_MISC_COMMON +#define UT_MISC_COMMON + +#include +#include + +struct CUTMiscCommon : public Test::Suite +{ + CUTMiscCommon() + { + TEST_ADD(CUTMiscCommon::bytesToHumanReadableUnits); + TEST_ADD(CUTMiscCommon::humanReadableToBytes); + + // Add a line here when adding a new test METHOD + } + + void bytesToHumanReadableUnits() + { + std::vector units; + + std::string res; + + // no unit, returns an empty string + res = NLMISC::bytesToHumanReadableUnits(0, units); + TEST_ASSERT(res.empty()); + + // support bytes + units.push_back("B"); + + // 0 bytes + res = NLMISC::bytesToHumanReadableUnits(0, units); + TEST_ASSERT(res == "0 B"); + + // 1000 bytes in B + res = NLMISC::bytesToHumanReadableUnits(1000, units); + TEST_ASSERT(res == "1000 B"); + + // 1024 bytes in B + res = NLMISC::bytesToHumanReadableUnits(1024, units); + TEST_ASSERT(res == "1024 B"); + + // support kibibytes + units.push_back("KiB"); + + // 1000 bytes in B or KiB + res = NLMISC::bytesToHumanReadableUnits(1000, units); + TEST_ASSERT(res == "1000 B"); + + // 1024 bytes in B or KiB + res = NLMISC::bytesToHumanReadableUnits(1024, units); + TEST_ASSERT(res == "1024 B"); + + // 1 MB in B or KiB + res = NLMISC::bytesToHumanReadableUnits(1000 * 1000, units); + TEST_ASSERT(res == "976 KiB"); + + // 1 MiB in B or KiB + res = NLMISC::bytesToHumanReadableUnits(1024 * 1024, units); + TEST_ASSERT(res == "1024 KiB"); + + // 1 GB in B or KiB + res = NLMISC::bytesToHumanReadableUnits(1000 * 1000 * 1000, units); + TEST_ASSERT(res == "976562 KiB"); + + // 1 GiB in B or KiB + res = NLMISC::bytesToHumanReadableUnits(1024 * 1024 * 1024, units); + TEST_ASSERT(res == "1048576 KiB"); + + // support mebibytes + units.push_back("MiB"); + + // 1 GB in B, KiB or MiB + res = NLMISC::bytesToHumanReadableUnits(1000 * 1000 * 1000, units); + TEST_ASSERT(res == "953 MiB"); + + // 1 GiB in B, KiB or MiB + res = NLMISC::bytesToHumanReadableUnits(1024 * 1024 * 1024, units); + TEST_ASSERT(res == "1024 MiB"); + } + + void humanReadableToBytes() + { + uint64 bytes = 0; + + // kiB is a wrong unit + bytes = NLMISC::humanReadableToBytes("1kiB"); + TEST_ASSERT(bytes == 1); + + // 1 kibibyte + bytes = NLMISC::humanReadableToBytes("1KiB"); + TEST_ASSERT(bytes == 1024); + + // 1 mebibyte + bytes = NLMISC::humanReadableToBytes("1MiB"); + TEST_ASSERT(bytes == 1024*1024); + + // 1 kilobyte + bytes = NLMISC::humanReadableToBytes("1KB"); + TEST_ASSERT(bytes == 1000); + + // 1 kilobyte + bytes = NLMISC::humanReadableToBytes("1kB"); + TEST_ASSERT(bytes == 1000); + + // 1 megabyte + bytes = NLMISC::humanReadableToBytes("1MB"); + TEST_ASSERT(bytes == 1000*1000); + + // 1 byte + bytes = NLMISC::humanReadableToBytes("1B"); + TEST_ASSERT(bytes == 1); + + // 1 byte + bytes = NLMISC::humanReadableToBytes("1"); + TEST_ASSERT(bytes == 1); + + // kiB is a wrong unit + bytes = NLMISC::humanReadableToBytes("1 kiB"); + TEST_ASSERT(bytes == 1); + + // 1 kibibyte + bytes = NLMISC::humanReadableToBytes("1 KiB"); + TEST_ASSERT(bytes == 1024); + + // 1 mebibyte + bytes = NLMISC::humanReadableToBytes("1 MiB"); + TEST_ASSERT(bytes == 1024*1024); + + // 1 kilobyte + bytes = NLMISC::humanReadableToBytes("1 KB"); + TEST_ASSERT(bytes == 1000); + + // 1 kilobyte + bytes = NLMISC::humanReadableToBytes("1 kB"); + TEST_ASSERT(bytes == 1000); + + // 1 megabyte + bytes = NLMISC::humanReadableToBytes("1 MB"); + TEST_ASSERT(bytes == 1000*1000); + + // 1 byte + bytes = NLMISC::humanReadableToBytes("1 B"); + TEST_ASSERT(bytes == 1); + + // not a number + bytes = NLMISC::humanReadableToBytes("AB"); + TEST_ASSERT(bytes == 0); + + // not a positive number + bytes = NLMISC::humanReadableToBytes("-1 B"); + TEST_ASSERT(bytes == 0); + } +}; + +#endif diff --git a/code/nel/tools/nel_unit_test/ut_misc_file.h b/code/nel/tools/nel_unit_test/ut_misc_file.h index bf15267f0..486320269 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_file.h +++ b/code/nel/tools/nel_unit_test/ut_misc_file.h @@ -19,6 +19,7 @@ #include #include +#include // Test suite for NLMISC::CFile behavior struct CUTMiscFile : public Test::Suite @@ -49,7 +50,7 @@ private: void copyFileSize(uint fileSize) { // create a source file (using standard c code) - FILE *fp = fopen(_SrcFile.c_str(), "wb"); + FILE *fp = NLMISC::nlfopen(_SrcFile, "wb"); nlverify(fp != NULL); for (uint i=0; i #include struct CUTMiscStringCommon : public Test::Suite @@ -29,6 +30,12 @@ struct CUTMiscStringCommon : public Test::Suite TEST_ADD(CUTMiscStringCommon::fromStringUint16); TEST_ADD(CUTMiscStringCommon::fromStringSint32); TEST_ADD(CUTMiscStringCommon::fromStringUint32); + TEST_ADD(CUTMiscStringCommon::fromStringSint64); + TEST_ADD(CUTMiscStringCommon::fromStringUint64); + TEST_ADD(CUTMiscStringCommon::fromStringFloat); + TEST_ADD(CUTMiscStringCommon::fromStringDouble); + TEST_ADD(CUTMiscStringCommon::fromStringBool); + // Add a line here when adding a new test METHOD } @@ -57,11 +64,11 @@ struct CUTMiscStringCommon : public Test::Suite // min limit ret = NLMISC::fromString("-128", val); - TEST_ASSERT(ret && val == -128); + TEST_ASSERT(ret && val == std::numeric_limits::min()); // max limit ret = NLMISC::fromString("127", val); - TEST_ASSERT(ret && val == 127); + TEST_ASSERT(ret && val == std::numeric_limits::max()); // min limit -1 ret = NLMISC::fromString("-129", val); @@ -117,11 +124,11 @@ struct CUTMiscStringCommon : public Test::Suite // min limit ret = NLMISC::fromString("0", val); - TEST_ASSERT(ret && val == 0); + TEST_ASSERT(ret && val == std::numeric_limits::min()); // max limit ret = NLMISC::fromString("255", val); - TEST_ASSERT(ret && val == 255); + TEST_ASSERT(ret && val == std::numeric_limits::max()); // min limit -1 ret = NLMISC::fromString("-1", val); @@ -181,11 +188,11 @@ struct CUTMiscStringCommon : public Test::Suite // min limit ret = NLMISC::fromString("-32768", val); - TEST_ASSERT(ret && val == -32768); + TEST_ASSERT(ret && val == std::numeric_limits::min()); // max limit ret = NLMISC::fromString("32767", val); - TEST_ASSERT(ret && val == 32767); + TEST_ASSERT(ret && val == std::numeric_limits::max()); // min limit -1 ret = NLMISC::fromString("-32769", val); @@ -241,11 +248,11 @@ struct CUTMiscStringCommon : public Test::Suite // min limit ret = NLMISC::fromString("0", val); - TEST_ASSERT(ret && val == 0); + TEST_ASSERT(ret && val == std::numeric_limits::min()); // max limit ret = NLMISC::fromString("65535", val); - TEST_ASSERT(ret && val == 65535); + TEST_ASSERT(ret && val == std::numeric_limits::max()); // min limit -1 ret = NLMISC::fromString("-1", val); @@ -305,11 +312,11 @@ struct CUTMiscStringCommon : public Test::Suite // min limit ret = NLMISC::fromString("-2147483648", val); - TEST_ASSERT(ret && val == INT_MIN); + TEST_ASSERT(ret && val == std::numeric_limits::min()); // max limit ret = NLMISC::fromString("2147483647", val); - TEST_ASSERT(ret && val == INT_MAX); + TEST_ASSERT(ret && val == std::numeric_limits::max()); // min limit -1 ret = NLMISC::fromString("-2147483649", val); @@ -365,11 +372,11 @@ struct CUTMiscStringCommon : public Test::Suite // min limit ret = NLMISC::fromString("0", val); - TEST_ASSERT(ret && val == 0); + TEST_ASSERT(ret && val == std::numeric_limits::min()); // max limit ret = NLMISC::fromString("4294967295", val); - TEST_ASSERT(ret && val == 4294967295); + TEST_ASSERT(ret && val == std::numeric_limits::max()); // min limit -1 ret = NLMISC::fromString("-1", val); @@ -403,6 +410,335 @@ struct CUTMiscStringCommon : public Test::Suite ret = NLMISC::fromString("+1", val); TEST_ASSERT(ret && val == 1); } + + void fromStringSint64() + { + bool ret; + + // tests for sint64 + sint64 val; + + // positive value + ret = NLMISC::fromString("1", val); + TEST_ASSERT(ret && val == 1); + + // negative value + ret = NLMISC::fromString("-1", val); + TEST_ASSERT(ret && val == -1); + + // bad character + ret = NLMISC::fromString("a", val); + TEST_ASSERT(!ret && val == 0); + + // right character and bad character + ret = NLMISC::fromString("1a", val); + TEST_ASSERT(ret && val == 1); + + // min limit + ret = NLMISC::fromString("-9223372036854775808", val); + TEST_ASSERT(ret && val == std::numeric_limits::min()); + + // max limit + ret = NLMISC::fromString("9223372036854775807", val); + TEST_ASSERT(ret && val == std::numeric_limits::max()); + + // min limit -1, unable to compare with minimum value because no lower type + ret = NLMISC::fromString("-9223372036854775809", val); + // with GCC, it returns min, with VC++ it returns max + TEST_ASSERT(ret && (val == std::numeric_limits::max() || std::numeric_limits::min())); + + // max limit +1, unable to compare with maximum value because no higher type + ret = NLMISC::fromString("9223372036854775808", val); + // with GCC, it returns max with VC++ it returns min + TEST_ASSERT(ret && (val == std::numeric_limits::min() || std::numeric_limits::max())); + + // with period + ret = NLMISC::fromString("1.2", val); + TEST_ASSERT(ret && val == 1); + + // with coma + ret = NLMISC::fromString("1,2", val); + TEST_ASSERT(ret && val == 1); + + // with spaces before + ret = NLMISC::fromString(" 10", val); + TEST_ASSERT(ret && val == 10); + + // with spaces after + ret = NLMISC::fromString("10 ", val); + TEST_ASSERT(ret && val == 10); + + // with 0s before + ret = NLMISC::fromString("001", val); + TEST_ASSERT(ret && val == 1); + + // with + before + ret = NLMISC::fromString("+1", val); + TEST_ASSERT(ret && val == 1); + } + + void fromStringUint64() + { + bool ret; + + // tests for uint64 + uint64 val; + + // positive value + ret = NLMISC::fromString("1", val); + TEST_ASSERT(ret && val == 1); + + // bad character + ret = NLMISC::fromString("a", val); + TEST_ASSERT(!ret && val == 0); + + // right character and bad character + ret = NLMISC::fromString("1a", val); + TEST_ASSERT(ret && val == 1); + + // min limit + ret = NLMISC::fromString("0", val); + TEST_ASSERT(ret && val == std::numeric_limits::min()); + + // max limit + ret = NLMISC::fromString("18446744073709551615", val); + TEST_ASSERT(ret && val == std::numeric_limits::max()); + + // min limit -1, unable to compare with minimum value because no lower type + ret = NLMISC::fromString("-1", val); + TEST_ASSERT(ret && val == std::numeric_limits::max()); + + // max limit +1, unable to compare with maximum value because no higher type + ret = NLMISC::fromString("18446744073709551616", val); + // with GCC, it returns max with VC++ it returns min + TEST_ASSERT(ret && (val == std::numeric_limits::min() || val == std::numeric_limits::max())); + + // with period + ret = NLMISC::fromString("1.2", val); + TEST_ASSERT(ret && val == 1); + + // with coma + ret = NLMISC::fromString("1,2", val); + TEST_ASSERT(ret && val == 1); + + // with spaces before + ret = NLMISC::fromString(" 10", val); + TEST_ASSERT(ret && val == 10); + + // with spaces after + ret = NLMISC::fromString("10 ", val); + TEST_ASSERT(ret && val == 10); + + // with 0s before + ret = NLMISC::fromString("001", val); + TEST_ASSERT(ret && val == 1); + + // with + before + ret = NLMISC::fromString("+1", val); + TEST_ASSERT(ret && val == 1); + } + + void fromStringFloat() + { + bool ret; + + // tests for float + float val; + + // positive value + ret = NLMISC::fromString("1", val); + TEST_ASSERT(ret && val == 1.f); + + // negative value + ret = NLMISC::fromString("-1", val); + TEST_ASSERT(ret && val == -1.f); + + // bad character + ret = NLMISC::fromString("a", val); + TEST_ASSERT(!ret && val == 0.f); + + // right character and bad character + ret = NLMISC::fromString("1a", val); + TEST_ASSERT(ret && val == 1.f); + + // min limit + ret = NLMISC::fromString("-3.4028235e+038", val); + TEST_ASSERT(ret && val == -std::numeric_limits::max()); + + // min limit towards 0 + ret = NLMISC::fromString("1.1754944e-038", val); + TEST_ASSERT(ret && val == std::numeric_limits::min()); + + // max limit + ret = NLMISC::fromString("3.4028235e+038", val); + TEST_ASSERT(ret && val == std::numeric_limits::max()); + + // min limit -1 + ret = NLMISC::fromString("-3.4028235e+048", val); + TEST_ASSERT(ret && val == -std::numeric_limits::infinity()); + + // min limit towards 0 -1 + ret = NLMISC::fromString("1.1754944e-048", val); + TEST_ASSERT(ret && val == 0.f); + + // max limit +1 + ret = NLMISC::fromString("3.4028235e+048", val); + TEST_ASSERT(ret && val == std::numeric_limits::infinity()); + + // with period + ret = NLMISC::fromString("1.2", val); + TEST_ASSERT(ret && val == 1.2f); + + // with coma + ret = NLMISC::fromString("1,2", val); + TEST_ASSERT(ret && val == 1.f); + + // with spaces before + ret = NLMISC::fromString(" 10", val); + TEST_ASSERT(ret && val == 10.f); + + // with spaces after + ret = NLMISC::fromString("10 ", val); + TEST_ASSERT(ret && val == 10.f); + + // with 0s before + ret = NLMISC::fromString("001", val); + TEST_ASSERT(ret && val == 1.f); + + // with + before + ret = NLMISC::fromString("+1", val); + TEST_ASSERT(ret && val == 1.f); + } + + void fromStringDouble() + { + bool ret; + + // tests for double + double val; + + // positive value + ret = NLMISC::fromString("1", val); + TEST_ASSERT(ret && val == 1.0); + + // negative value + ret = NLMISC::fromString("-1", val); + TEST_ASSERT(ret && val == -1.0); + + // bad character + ret = NLMISC::fromString("a", val); + TEST_ASSERT(!ret && val == 0); + + // right character and bad character + ret = NLMISC::fromString("1a", val); + TEST_ASSERT(ret && val == 1.0); + + // min limit + ret = NLMISC::fromString("-1.7976931348623158e+308", val); + TEST_ASSERT(ret && val == -std::numeric_limits::max()); + + // min limit towards 0 + ret = NLMISC::fromString("2.2250738585072014e-308", val); + TEST_ASSERT(ret && val == std::numeric_limits::min()); + + // max limit + ret = NLMISC::fromString("1.7976931348623158e+308", val); + TEST_ASSERT(ret && val == std::numeric_limits::max()); + + // min limit -1 + ret = NLMISC::fromString("3e-408", val); + TEST_ASSERT(ret && val == 0.0); + + // max limit +1 + ret = NLMISC::fromString("2e+308", val); + TEST_ASSERT(ret && val == std::numeric_limits::infinity()); + + // with period + ret = NLMISC::fromString("1.2", val); + TEST_ASSERT(ret && val == 1.2); + + // with coma + ret = NLMISC::fromString("1,2", val); + TEST_ASSERT(ret && val == 1.0); + + // with spaces before + ret = NLMISC::fromString(" 10", val); + TEST_ASSERT(ret && val == 10.0); + + // with spaces after + ret = NLMISC::fromString("10 ", val); + TEST_ASSERT(ret && val == 10.0); + + // with 0s before + ret = NLMISC::fromString("001", val); + TEST_ASSERT(ret && val == 1.0); + + // with + before + ret = NLMISC::fromString("+1", val); + TEST_ASSERT(ret && val == 1.0); + } + + void fromStringBool() + { + bool ret; + + // tests for bool + bool val; + + // true values + ret = NLMISC::fromString("1", val); + TEST_ASSERT(ret && val); + + ret = NLMISC::fromString("t", val); + TEST_ASSERT(ret && val); + + ret = NLMISC::fromString("y", val); + TEST_ASSERT(ret && val); + + ret = NLMISC::fromString("T", val); + TEST_ASSERT(ret && val); + + ret = NLMISC::fromString("Y", val); + TEST_ASSERT(ret && val); + + ret = NLMISC::fromString("true", val); + TEST_ASSERT(ret && val); + + ret = NLMISC::fromString("yes", val); + TEST_ASSERT(ret && val); + + // false values + ret = NLMISC::fromString("0", val); + TEST_ASSERT(ret && !val); + + ret = NLMISC::fromString("f", val); + TEST_ASSERT(ret && !val); + + ret = NLMISC::fromString("n", val); + TEST_ASSERT(ret && !val); + + ret = NLMISC::fromString("F", val); + TEST_ASSERT(ret && !val); + + ret = NLMISC::fromString("N", val); + TEST_ASSERT(ret && !val); + + ret = NLMISC::fromString("false", val); + TEST_ASSERT(ret && !val); + + ret = NLMISC::fromString("no", val); + TEST_ASSERT(ret && !val); + + // wrong values + ret = NLMISC::fromString("YES", val); + TEST_ASSERT(!ret && !val); + + ret = NLMISC::fromString("foo", val); + TEST_ASSERT(!ret && !val); + + ret = NLMISC::fromString("a", val); + TEST_ASSERT(!ret && !val); + } }; #endif diff --git a/code/nel/tools/pacs/build_rbank/CMakeLists.txt b/code/nel/tools/pacs/build_rbank/CMakeLists.txt index b35cb808c..65e86394d 100644 --- a/code/nel/tools/pacs/build_rbank/CMakeLists.txt +++ b/code/nel/tools/pacs/build_rbank/CMakeLists.txt @@ -4,13 +4,9 @@ ADD_EXECUTABLE(build_rbank ${SRC}) ADD_DEFINITIONS(-DNL_BRB_CFG="\\"${NL_ETC_PREFIX}/\\"") -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(build_rbank nelpacs nel3d nelligo nelmisc) NL_DEFAULT_PROPS(build_rbank "NeL, Tools, PACS: build_rbank") NL_ADD_RUNTIME_FLAGS(build_rbank) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) - INSTALL(TARGETS build_rbank RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT toolspacs) INSTALL(FILES build_rbank.cfg DESTINATION ${NL_ETC_PREFIX} COMPONENT toolspacs) diff --git a/code/nel/tools/sound/build_samplebank/CMakeLists.txt b/code/nel/tools/sound/build_samplebank/CMakeLists.txt index ab427373c..b86e1e3e7 100644 --- a/code/nel/tools/sound/build_samplebank/CMakeLists.txt +++ b/code/nel/tools/sound/build_samplebank/CMakeLists.txt @@ -2,10 +2,6 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(build_samplebank ${SRC}) -ADD_DEFINITIONS( ${LIBXML2_DEFINITIONS}) - -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(build_samplebank nelmisc nelsound) NL_DEFAULT_PROPS(build_samplebank "NeL, Tools, Sound: build_samplebank") NL_ADD_RUNTIME_FLAGS(build_samplebank) diff --git a/code/nel/tools/sound/build_sound/CMakeLists.txt b/code/nel/tools/sound/build_sound/CMakeLists.txt index 7813e4e8f..5a5d81e81 100644 --- a/code/nel/tools/sound/build_sound/CMakeLists.txt +++ b/code/nel/tools/sound/build_sound/CMakeLists.txt @@ -2,10 +2,6 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(build_sound ${SRC}) -ADD_DEFINITIONS( ${LIBXML2_DEFINITIONS}) - -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(build_sound nelmisc nelsound) NL_DEFAULT_PROPS(build_sound "NeL, Tools, Sound: build_sound") NL_ADD_RUNTIME_FLAGS(build_sound) diff --git a/code/nel/tools/sound/build_soundbank/CMakeLists.txt b/code/nel/tools/sound/build_soundbank/CMakeLists.txt index 4431a47b8..310e6a2c5 100644 --- a/code/nel/tools/sound/build_soundbank/CMakeLists.txt +++ b/code/nel/tools/sound/build_soundbank/CMakeLists.txt @@ -2,10 +2,6 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(build_soundbank ${SRC}) -ADD_DEFINITIONS( ${LIBXML2_DEFINITIONS}) - -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(build_soundbank nelmisc nelsound) NL_DEFAULT_PROPS(build_soundbank "NeL, Tools, Sound: build_soundbank") NL_ADD_RUNTIME_FLAGS(build_soundbank) diff --git a/code/nelns/admin_executor_service/CMakeLists.txt b/code/nelns/admin_executor_service/CMakeLists.txt index 620c1a78a..24a9efa2f 100644 --- a/code/nelns/admin_executor_service/CMakeLists.txt +++ b/code/nelns/admin_executor_service/CMakeLists.txt @@ -2,8 +2,6 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(admin_executor_service WIN32 ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(admin_executor_service nelmisc nelnet) @@ -11,7 +9,5 @@ TARGET_LINK_LIBRARIES(admin_executor_service NL_DEFAULT_PROPS(admin_executor_service "NelNS, Services: Admin Executor Service") NL_ADD_RUNTIME_FLAGS(admin_executor_service) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) - INSTALL(TARGETS admin_executor_service RUNTIME DESTINATION sbin COMPONENT aes) INSTALL(FILES admin_executor_service.cfg common.cfg DESTINATION ${NL_ETC_PREFIX}/nelns COMPONENT aes) diff --git a/code/nelns/admin_service/CMakeLists.txt b/code/nelns/admin_service/CMakeLists.txt index a7eee50a1..22dd846c9 100644 --- a/code/nelns/admin_service/CMakeLists.txt +++ b/code/nelns/admin_service/CMakeLists.txt @@ -2,10 +2,9 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(admin_service WIN32 ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(admin_service - ${LIBXML2_LIBRARIES} ${MYSQL_LIBRARIES} ${ZLIB_LIBRARIES} nelmisc @@ -14,7 +13,5 @@ TARGET_LINK_LIBRARIES(admin_service NL_DEFAULT_PROPS(admin_service "NelNS, Services: Admin Service") NL_ADD_RUNTIME_FLAGS(admin_service) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) - INSTALL(TARGETS admin_service RUNTIME DESTINATION sbin COMPONENT as) INSTALL(FILES admin_service.cfg common.cfg DESTINATION ${NL_ETC_PREFIX}/nelns COMPONENT as) diff --git a/code/nelns/login_service/CMakeLists.txt b/code/nelns/login_service/CMakeLists.txt index 1ee7260fe..31ba82143 100644 --- a/code/nelns/login_service/CMakeLists.txt +++ b/code/nelns/login_service/CMakeLists.txt @@ -2,10 +2,9 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(login_service WIN32 ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(login_service - ${LIBXML2_LIBRARIES} ${MYSQL_LIBRARIES} ${ZLIB_LIBRARIES} nelmisc @@ -14,7 +13,5 @@ TARGET_LINK_LIBRARIES(login_service NL_DEFAULT_PROPS(login_service "NelNS, Services: Login Service") NL_ADD_RUNTIME_FLAGS(login_service) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) - INSTALL(TARGETS login_service RUNTIME DESTINATION sbin COMPONENT ls) INSTALL(FILES login_service.cfg common.cfg DESTINATION ${NL_ETC_PREFIX}/nelns COMPONENT ls) diff --git a/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt b/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt index 7e128f1b7..92dac70f1 100644 --- a/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt +++ b/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt @@ -1,6 +1,5 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} - ${LIBXML2_INCLUDE_DIR} ${QT_INCLUDES}) INCLUDE( ${QT_USE_FILE} ) @@ -19,10 +18,9 @@ QT4_WRAP_CPP( NEL_LAUNCHER_MOC_SRCS ${NEL_LAUNCHER_HDR}) ADD_EXECUTABLE(nel_launcher_qt WIN32 ${NEL_LAUNCHER_SRC} ${NEL_LAUNCHER_MOC_SRCS} ${NEL_LAUNCHER_RC_SRCS} ${NEL_LAUNCHER_UI_HDRS}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${QT_INCLUDES}) +INCLUDE_DIRECTORIES(${QT_INCLUDES}) TARGET_LINK_LIBRARIES(nel_launcher_qt - ${LIBXML2_LIBRARIES} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} nelmisc @@ -31,7 +29,7 @@ TARGET_LINK_LIBRARIES(nel_launcher_qt NL_DEFAULT_PROPS(nel_launcher_qt "NelNS, Launcher: NeL Launcher Qt") NL_ADD_RUNTIME_FLAGS(nel_launcher_qt) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS}) +ADD_DEFINITIONS(${QT_DEFINITIONS}) INSTALL(TARGETS nel_launcher_qt RUNTIME DESTINATION bin COMPONENT launcher) IF(WIN32) diff --git a/code/nelns/naming_service/CMakeLists.txt b/code/nelns/naming_service/CMakeLists.txt index 9616ca957..596bb5b48 100644 --- a/code/nelns/naming_service/CMakeLists.txt +++ b/code/nelns/naming_service/CMakeLists.txt @@ -2,17 +2,12 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(naming_service WIN32 ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(naming_service - ${LIBXML2_LIBRARIES} nelmisc nelnet) NL_DEFAULT_PROPS(naming_service "NeLNS, Services: Naming Service") NL_ADD_RUNTIME_FLAGS(naming_service) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) - INSTALL(TARGETS naming_service RUNTIME DESTINATION sbin COMPONENT ns) INSTALL(FILES naming_service.cfg common.cfg DESTINATION ${NL_ETC_PREFIX}/nelns COMPONENT ns) diff --git a/code/nelns/welcome_service/CMakeLists.txt b/code/nelns/welcome_service/CMakeLists.txt index c6819d97d..3817b2076 100644 --- a/code/nelns/welcome_service/CMakeLists.txt +++ b/code/nelns/welcome_service/CMakeLists.txt @@ -2,17 +2,14 @@ FILE(GLOB SRC *.cpp *.h) ADD_EXECUTABLE(welcome_service WIN32 ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NELMISC_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${NELMISC_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(welcome_service - ${LIBXML2_LIBRARIES} nelmisc nelnet) NL_DEFAULT_PROPS(welcome_service "NeLNS, Services: Welcome Service") NL_ADD_RUNTIME_FLAGS(welcome_service) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) - INSTALL(TARGETS welcome_service RUNTIME DESTINATION sbin COMPONENT ws) INSTALL(FILES welcome_service.cfg common.cfg DESTINATION ${NL_ETC_PREFIX}/nelns COMPONENT ws) diff --git a/code/revision.h.in b/code/revision.h.in deleted file mode 100644 index 6c5e9b8b1..000000000 --- a/code/revision.h.in +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef REVISION_H -#define REVISION_H - -#cmakedefine REVISION "${REVISION}" -#cmakedefine BUILD_DATE "${BUILD_DATE}" - -#endif diff --git a/code/ryzom/CMakeLists.txt b/code/ryzom/CMakeLists.txt index eda0375d2..3b955306f 100644 --- a/code/ryzom/CMakeLists.txt +++ b/code/ryzom/CMakeLists.txt @@ -1,32 +1,28 @@ #----------------------------------------------------------------------------- #Platform specifics -FIND_PACKAGE(ZLIB) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common/src) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common/src ) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common ) SET(RZ_SERVER_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/server/src) ADD_SUBDIRECTORY(common) +ADD_SUBDIRECTORY(tools) IF(WITH_RYZOM_CLIENT) IF(NOT WITH_GUI) MESSAGE( FATAL_ERROR "The client cannot be built without the NeL GUI Library (WITH_GUI)") - ENDIF(NOT WITH_GUI) + ENDIF() ADD_SUBDIRECTORY(client) ELSEIF(WITH_RYZOM_TOOLS) # Need clientsheets lib for sheets packer tool ADD_SUBDIRECTORY(client) -ENDIF(WITH_RYZOM_CLIENT) - -IF(WITH_RYZOM_TOOLS) - ADD_SUBDIRECTORY(tools) -ENDIF(WITH_RYZOM_TOOLS) +ENDIF() IF(WITH_RYZOM_SERVER OR WITH_RYZOM_TOOLS) # Need servershare for build packed collision tool # Need aishare for build wmap tool FIND_PACKAGE(MySQL REQUIRED) ADD_SUBDIRECTORY(server) -ENDIF(WITH_RYZOM_SERVER OR WITH_RYZOM_TOOLS) +ENDIF() diff --git a/code/ryzom/client/CMakeLists.txt b/code/ryzom/client/CMakeLists.txt index 78cbbbd04..106f553bd 100644 --- a/code/ryzom/client/CMakeLists.txt +++ b/code/ryzom/client/CMakeLists.txt @@ -1,21 +1,12 @@ - # Need clientsheets lib for sheets packer tool ADD_SUBDIRECTORY(src) IF(WITH_RYZOM_CLIENT) + #ADD_SUBDIRECTORY(data) -#ADD_SUBDIRECTORY(data) -#ADD_SUBDIRECTORY(patcher) - -IF(UNIX AND NOT APPLE) - ADD_SUBDIRECTORY(unix) -ENDIF(UNIX AND NOT APPLE) - -IF(RYZOM_ETC_PREFIX) - CONFIGURE_FILE(client_default.cfg.in "${CMAKE_CURRENT_BINARY_DIR}/client_default.cfg") - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/client_default.cfg" DESTINATION ${RYZOM_ETC_PREFIX}) -ELSE(RYZOM_ETC_PREFIX) - INSTALL(FILES client_default.cfg DESTINATION etc/ryzom) -ENDIF(RYZOM_ETC_PREFIX) + IF(UNIX AND NOT APPLE) + ADD_SUBDIRECTORY(unix) + ENDIF() -ENDIF(WITH_RYZOM_CLIENT) + INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX}) +ENDIF() diff --git a/code/ryzom/client/client_default.cfg b/code/ryzom/client/client_default.cfg index 55e56b012..cc0a1e02b 100644 --- a/code/ryzom/client/client_default.cfg +++ b/code/ryzom/client/client_default.cfg @@ -41,8 +41,6 @@ Gamma_max = 1.0; Application = { "ryzom_open", "./client_ryzom_r.exe", "./" }; BackgroundDownloader = 0; -PatchServer = ""; -PatchWanted = 0; SignUpURL = ""; StartupHost = "shard.ryzomcore.org:40916"; StartupPage = "/login/r2_login.php"; @@ -220,6 +218,8 @@ FXAA_ps1 = 1; FXAA_ps2 = 1; FXAA_ps3 = 1; +AnisotropicFilter = 0; + Bloom = 0; Bloom_ps0 = 0; Bloom_ps1 = 1; @@ -424,18 +424,18 @@ LoadingStringCount = 0; // Some R2 parameters ... -R2Mode = 1; +R2Mode = 1; R2EDEnabled = 1; R2EDExtendedDebug = 0; R2EDLightPalette = 0; R2ClientGw = "r2linux01"; -LoadLuaDebugger = 0; -CheckR2ScenarioMD5 = 1; -LevelDesignEnabled = 0; +LoadLuaDebugger = 0; +CheckR2ScenarioMD5 = 1; +LevelDesignEnabled = 0; -DmCameraDistMax = 25; -DmRun = 20; -DmWalk = 6; +DmCameraDistMax = 25; +DmRun = 20; +DmWalk = 6; R2EDReloadFiles = { "r2ed.xml", diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/actions.xml b/code/ryzom/client/data/gamedev/interfaces_v3/actions.xml index 3486e0298..8696de32a 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/actions.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/actions.xml @@ -205,6 +205,20 @@ + + + + + + + + + + + + + + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml b/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml index c2bd7a407..d04d7fba0 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/compass.xml @@ -265,7 +265,7 @@ fontsize="10" line_maxw="182" shadow="true" - hardtext="No File..." /> + hardtext="uiNoFiles" /> @@ -567,7 +567,7 @@ diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/config.xml b/code/ryzom/client/data/gamedev/interfaces_v3/config.xml index 4114143e5..7b73429c4 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/config.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/config.xml @@ -2765,6 +2765,9 @@ This MUST follow the Enum MISSION_DESC::TIconId + @@ -3318,9 +3321,6 @@ This MUST follow the Enum MISSION_DESC::TIconId - @@ -3339,9 +3339,6 @@ This MUST follow the Enum MISSION_DESC::TIconId - - - - - - - - @@ -429,6 +429,9 @@ + @@ -916,7 +919,7 @@ - + + + + + + + + + @@ -3146,6 +3196,11 @@ realtime="true" link="FXAA" preset="UI:TEMP:PRESET_FX" /> + + + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/guild.xml b/code/ryzom/client/data/gamedev/interfaces_v3/guild.xml index d6b96fb30..78099815f 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/guild.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/guild.xml @@ -87,7 +87,7 @@ y="0" fontsize="12" shadow="true" - case_mode="%case_first_word_letter_up" /> + case_mode="%case_normal" /> @@ -1078,7 +1077,7 @@ tooltip_parent="win" /> - @@ -1136,7 +1124,7 @@ target="tab1:active" /> + target="tab6:active" /> @@ -1148,9 +1136,6 @@ target="tab4:active" /> - - - + case_mode="%case_normal" /> - --> - - - - - - diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/inventory.xml b/code/ryzom/client/data/gamedev/interfaces_v3/inventory.xml index 83a8dc089..9c4b259da 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/inventory.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/inventory.xml @@ -1314,6 +1314,188 @@ params="value=add(@UI:PHRASE:SELECT_MEMORY,-1)" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1501,9 +1683,66 @@ tooltip="uittHandSet" tooltip_parent="win" /> + + + + + + + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/login_main.xml b/code/ryzom/client/data/gamedev/interfaces_v3/login_main.xml index 041a47359..f74967f41 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/login_main.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/login_main.xml @@ -24,7 +24,7 @@ - @@ -32,35 +32,35 @@ - + - + - + - + - + - - - - + - @@ -73,23 +73,23 @@ - - - + - + @@ -120,7 +120,7 @@ - + - + - + - + - + - + - + - + - - + + - + @@ -224,12 +224,12 @@ on_enter="leave_modal" options="no_bordure" mouse_pos="false" exit_key_pushed="t - + - - + + - + - + @@ -285,28 +285,28 @@ on_enter="leave_modal" options="no_bordure" mouse_pos="false" exit_key_pushed="t - + - + - - + + - + - + - + + fontsize="12" shadow="true" multi_line="true" multi_line_space="0" case_mode="%case_normal"/> - + @@ -318,17 +318,17 @@ on_enter="leave_modal" options="no_bordure" mouse_pos="false" exit_key_pushed="t