diff --git a/.gitignore b/.gitignore index 357c0503d..6d75a91f5 100644 --- a/.gitignore +++ b/.gitignore @@ -160,15 +160,8 @@ code/build/* code/build-2010/* build/* install/* -build_* +build_vc* code/nel/tools/build_gamedata/configuration/buildsite.py -code/build_mac -code/build_linux32 -code/build_linux64 -code/build_windows32 -code/build_windows64 -code/build_server -code/build_nel_tools # Linux nel compile code/nel/build/nel-config @@ -223,7 +216,6 @@ 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 @@ -244,14 +236,13 @@ code/ryzom/tools/server/ryzom_ams/old -# Tools and external directories +#tools and external dir's external -external_vc14 external_stlport nel_tools* ryzom_tools* -# Dumps +#Dumps *.dmp code/nel/tools/build_gamedata/processes/ai_wmap/ai_build_wmap.cfg diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 9417c1f17..000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,1203 +0,0 @@ -# Configuration for Continous Integration -# -# Copyright (C) 2017 Khanat -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# Example to execute locally: -# gitlab-runner exec docker --timeout=3600 'Linux client build' -# gitlab-runner exec docker --timeout=3600 'Linux server debian_amd64_strech build' -# gitlab-runner exec docker --timeout=3600 'Linux server_static debian_amd64_strech build' -# gitlab-runner exec docker --timeout=3600 'Linux client debian_amd64_strech build' -# gitlab-runner exec docker --timeout=3600 'Linux client_static debian_amd64_strech build' -# gitlab-runner exec docker --kubernetes-memory-limit='10g' --timeout=3600 'Linux client build' -# gitlab-runner exec docker --kubernetes-memory-limit='10g' --timeout=3600 'Linux client archlinux build' -# gitlab-runner exec docker --kubernetes-memory-limit='10g' --timeout=3600 'Linux client fedora_amd64_27 build' -# gitlab-runner exec docker --kubernetes-memory-limit='10g' --timeout=3600 'Linux client ubuntu_amd64_17_10 build' -# gitlab-runner exec docker --kubernetes-memory-limit='10g' --timeout=3600 'Windows client build' - -stages: -- build -- test -#- staging -#- production - -## BUILDS - -# Job de compilation pour Linux -Linux client build: - stage: build - except: - - ryzomcore - - mac-ci-build - tags: - - Docker - image: debian:jessie - script: - # Calcul le nombre de cpu désactivé (on ne laisse que 4 au maximum) - - disableproc=$(( $(nproc) - 4 )) - - if [[ $disableproc -le 0 ]] ; then disableproc=0; fi - - optionproc="-j$(nproc --ignore=$disableproc)" - - echo "disableproc:$disableproc, nb core compile:$(nproc --ignore=$disableproc) optionproc:$optionproc" - # Installation des dépendances - #- echo "deb http://ftp.debian.org/debian/ jessie-backports non-free contrib main" >> /etc/apt/sources.list - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get upgrade -y - - DEBIAN_FRONTEND=noninteractive apt-get install libxml2 -y g++ gcc cmake libcurl4-openssl-dev libgl1-mesa-dev libjpeg-dev libpng-dev libopenal-dev libfreetype6-dev libxxf86vm-dev libxrandr-dev libxrender-dev libvorbis-dev libluabind-dev libboost-dev libmysqlclient-dev libssl-dev liblzma-dev libxml2-dev makeself libgif-dev patch - # Installation des dépendances des dépendances statiques (à commenter si construction de Khanat en mode dynamique) - # libxml2 : python-pyicu (support d'unicode), python-dev (support de... python) - - apt-get install -y wget python-pyicu python-dev - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Création de l'environnement de compilation - - mkdir -p BUILD/x86_64 - - cd BUILD/x86_64 - ## Le curl des dépots a trop de dépendances en statique. On le recompile donc, afin d'aléger l'executable - # Téléchargement et décompression des dépendances à recompiller - - wget -c http://curl.haxx.se/download/curl-7.50.0.tar.gz - - tar xzf curl-7.50.0.tar.gz - # Compilation de curl - - cd curl-7.50.0 - - ./configure --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-ipv6 --disable-crypto-auth --disable-sspi --disable-tls-srp --without-gnutls --without-librtmp --without-libidn --disable-versioned-symbols --disable-pop3 --without-libssh2 --with-ssl - - make install $optionproc - - cd .. - # Build luabind - - mkdir -p luabind - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O luabind.tar.gz - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O luabind-debian.tar.xz - - tar xvf luabind.tar.gz -C luabind --strip 1 || exit 2 - - tar xvf luabind-debian.tar.xz -C luabind || exit 2 - - cd luabind - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - cd .. - # Build libogg - - mkdir -p libogg/build - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz -O libogg.tar.gz - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2-1.diff.gz -O libogg.diff.gz - - tar xvf libogg.tar.gz -C libogg --strip 1 || exit 2 - - gunzip libogg.diff.gz - - cd libogg - - patch -p1 < ../libogg.diff - - cd build - - ../configure --disable-maintainer-mode --host=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-static --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-Wformat=2 -g -fPIC" CXXFLAGS="-Wformat=2 -g -fPIC" LDFLAGS="-Wl,-z,now" - - make - - make install - - cd ../.. - # Build libvorbis - - mkdir -p libvorbis - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/libvorbis_1.3.5.orig.tar.gz -O libvorbis.tar.gz - - tar xvf libvorbis.tar.gz -C libvorbis --strip 1 || exit 2 - # Get list package - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis -O list_libvorbis - # get last patch for our release - - line=$(egrep '(libvorbis_1.3.5)(.*)(tar[.]xz)' list_libvorbis | tail -n 1) - # get only name of the patch - - tmp=${line#*href} ; tmp2=${tmp%%>*} ; tmp3=${tmp2#*\"} ; namepatch=${tmp3%\"*} - # download this patch - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/$namepatch -O libvorbis.debian.tar.xz - - tar xvf libvorbis.debian.tar.xz -C libvorbis || exit 2 - - cd libvorbis - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - ./configure --enable-static --with-pic - - make - - make install - - cd .. - ## Compilation de Khanat - # Configuration - - cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/ -DCMAKE_BUILD_TYPE=Release -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_NEL_TESTS=OFF -DWITH_NEL_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_UNIX_STRUCTURE=OFF -DWITH_INSTALL_LIBRARIES=OFF -DWITH_LUA52=ON ../../code - # Compilation et installation - - make $optionproc khanat_client_patcher khanat_client - #- make $optionproc install DESTDIR=../../Linux/x86_64 - - mkdir -p ../../Linux/x86_64 - - cp bin/* ../../Linux/x86_64 - # Packaging - - cd ../../ - - cp ./dist/khanat/autoextract_script.sh ./Linux/x86_64/ - - chmod +x ./Linux/x86_64/autoextract_script.sh - - makeself --nox11 --target /tmp/khanat_installer ./Linux/x86_64/ khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-Linux-x86_64.run "Khanat installer" ./autoextract_script.sh - artifacts: - name: "khanat-$(echo $CI_BUILD_REF | head -c 7)-$CI_PIPELINE_ID-Linux-x86_64" - paths: - - khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-Linux-x86_64.run - - -Linux server debian_amd64_strech build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: amd64/debian:9 - script: - # Prepare environment - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server - git - libcurl4-openssl-dev - libfreetype6-dev - libx11-dev - libgl1-mesa-dev - libxxf86vm-dev - libxrandr-dev - libxrender-dev - libopenal-dev - libxml2-dev - cmake - build-essential - libpng-dev - libjpeg62-turbo-dev - rrdtool - bison - libxmu-dev - autoconf - automake - default-libmysqlclient-dev - libgif-dev - cpputest - libssl-dev - liblzma-dev - unzip - zlib1g-dev - libssh2-1-dev - libboost-all-dev - libopenal-dev - libgl1-mesa-dev - mercurial - wget - autogen - libtool - libtool-bin - fakeroot - libxml2-dev - patch - - apt-get install -y liblua5.2-0 liblua5.2-dev libluabind-dev libluabind0.9.1v5 - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # install squish - - mkdir -p squish - - (cd squish; wget -c https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/libsquish/squish-1.11.zip) - - (cd squish; unzip squish-1.11.zip) - - (cd squish/squish-1.11; patch -i ../../patch/squish-limit.patch) - - (cd squish/squish-1.11; make) - - (cd squish/squish-1.11; make install) - # Action - - mkdir -p code/build - - (cd code/build ; cmake -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=OFF -DWITH_DRIVER_OPENGL=OFF -DWITH_DRIVER_OPENAL=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=OFF ..) - - (cd code/build; make ryzom_admin_service ryzom_ai_service ryzom_backup_service ryzom_dynamic_scenario_service ryzom_entities_game_service ryzom_frontend_service ryzom_general_utilities_service ryzom_gpm_service ryzom_ios_service ryzom_log_analyser_service ryzom_logger_service ryzom_mail_forum_service ryzom_mirror_service ryzom_mission_compiler ryzom_monitor_service ryzom_naming_service ryzom_patchman_service ryzom_pd_support_service ryzom_persistant_data_service ryzom_reference_builder_service ryzom_session_browser_service ryzom_shard_unifier_service ryzom_tick_service ryzom_welcome_service sheets_packer bnp_make make_sheet_id patch_gen) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-server-debian_strech-$CI_COMMIT_REF_NAME" - paths: - - code/build/bin - - code/build/lib - - code/ryzom/server/shard.screen.rc - - code/web - - code/ryzom/server/*.cfg - - code/ryzom/server/data_shard - - code/ryzom/common/data_common - - code/ryzom/common/data_leveldesign - - code/ryzom/client/*.cfg - - code/ryzom/client/cfg - - code/ryzom/client/data - - code/ryzom/client/macosx - - code/ryzom/client/unix - - code/ryzom/client/windows - - code/ryzom/tools/scripts/linux -# expire_in: 2 week - when: manual - - -Linux client debian_amd64_strech build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: amd64/debian:9 - script: - # Prepare environment - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - apt-get install -y autoconf - autogen - automake - bison - build-essential - cmake - cpputest - fakeroot - libboost-all-dev - libfreetype6-dev - libgif-dev - libgl1-mesa-dev - libjpeg62-turbo-dev - liblzma-dev - libopenal-dev - libpng-dev - libssh2-1-dev - libssl-dev - libtool - libtool-bin - libx11-dev - libxml2-dev - libxmu-dev - libxrandr-dev - libxrender-dev - libxxf86vm-dev - mercurial - rrdtool - unzip - wget - zlib1g-dev - patch - - apt-get install -y liblua5.2-0 liblua5.2-dev libluabind-dev libluabind0.9.1v5 libogg-dev libvorbis-dev - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Build Curl - - wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O curl.tar.gz - - mkdir -p curl/build - - tar xvf curl.tar.gz -C curl --strip 1 - - (cd curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/x86_64-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/x86_64-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' ..) - - (cd curl/build; make) - - (cd curl/build; make install) - # Action - - mkdir -p code/build - - (cd code/build ; cmake -DWITH_NEL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=OFF -DWITH_RYZOM_CUSTOM_PATCH_SERVER=OFF -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_DRIVER_OPENGL=ON -DWITH_DRIVER_OPENAL=ON -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=ON -DWITH_STATIC_CURL=ON ..) - - (cd code/build; make khanat_client) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-client-debian_strech-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID" - paths: - - code/build/bin -# expire_in: 2 week - when: manual - - -Linux client_static debian_amd64_strech build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: amd64/debian:9 - script: - # Prepare environment - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - apt-get install -y - autoconf - autogen - automake - bison - build-essential - cmake - cpputest - fakeroot - libboost-all-dev - libfreetype6-dev - libgif-dev - libgl1-mesa-dev - libjpeg62-turbo-dev - liblzma-dev - libopenal-dev - libpng-dev - libssh2-1-dev - libssl-dev - libtool - libtool-bin - libx11-dev - libxml2-dev - libxmu-dev - libxrandr-dev - libxrender-dev - libxxf86vm-dev - mercurial - rrdtool - unzip - wget - zlib1g-dev - patch - - apt-get install -y liblua5.2-0 liblua5.2-dev - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Build Curl - - wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O curl.tar.gz - - mkdir -p curl/build - - tar xvf curl.tar.gz -C curl --strip 1 - - (cd curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CURL_TESTS=OFF -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/x86_64-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/x86_64-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' ..) - - (cd curl/build; make) - - (cd curl/build; make install) - # Build luabind - - mkdir -p luabind - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O luabind.tar.gz - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O luabind-debian.tar.xz - - ls - - tar xvf luabind.tar.gz -C luabind --strip 1 || exit 2 - - tar xvf luabind-debian.tar.xz -C luabind || exit 2 - - cd luabind - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - cd .. - # Build libogg - - mkdir -p libogg/build - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz -O libogg.tar.gz - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2-1.diff.gz -O libogg.diff.gz - - tar xvf libogg.tar.gz -C libogg --strip 1 || exit 2 - - gunzip libogg.diff.gz - - cd libogg - - patch -p1 < ../libogg.diff - - cd build - - ../configure --disable-maintainer-mode --host=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-static --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-Wformat=2 -g -fPIC" CXXFLAGS="-Wformat=2 -g -fPIC" LDFLAGS="-Wl,-z,now" - - make - - make install - - cd ../.. - # Build libvorbis - - mkdir -p libvorbis - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/libvorbis_1.3.5.orig.tar.gz -O libvorbis.tar.gz - - tar xvf libvorbis.tar.gz -C libvorbis --strip 1 || exit 2 - # Get list package - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis -O list_libvorbis - # get last patch for our release - - line=$(egrep '(libvorbis_1.3.5)(.*)(tar[.]xz)' list_libvorbis | tail -n 1) - # get only name of the patch - - tmp=${line#*href} ; tmp2=${tmp%%>*} ; tmp3=${tmp2#*\"} ; namepatch=${tmp3%\"*} - # download this patch - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/$namepatch -O libvorbis.debian.tar.xz - - tar xvf libvorbis.debian.tar.xz -C libvorbis || exit 2 - - cd libvorbis - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - ./configure --enable-static --with-pic - - make - - make install - - cd .. - # Action - - mkdir -p code/build - - (cd code/build ; cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_DRIVER_OPENGL=ON -DWITH_DRIVER_OPENAL=ON -DWITH_NEL_SAMPLES=ON -DWITH_SOUND=ON -DWITH_STATIC_CURL=ON ..) - - (cd code/build; make khanat_client) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-client_static-debian_amd64_strech-$CI_COMMIT_REF_NAME" - paths: - - code/build/bin -# expire_in: 2 week - - -Linux client_static_debug debian_amd64_strech build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: amd64/debian:9 - script: - # Prepare environment - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - apt-get install -y - autoconf - autogen - automake - bison - build-essential - cmake - cpputest - fakeroot - libboost-all-dev - libfreetype6-dev - libgif-dev - libgl1-mesa-dev - libjpeg62-turbo-dev - liblzma-dev - libopenal-dev - libpng-dev - libssh2-1-dev - libssl-dev - libtool - libtool-bin - libx11-dev - libxml2-dev - libxmu-dev - libxrandr-dev - libxrender-dev - libxxf86vm-dev - mercurial - rrdtool - unzip - wget - zlib1g-dev - patch - - apt-get install -y liblua5.2-0 liblua5.2-dev - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Build Curl - - wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O curl.tar.gz - - mkdir -p curl/build - - tar xvf curl.tar.gz -C curl --strip 1 - - (cd curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CURL_TESTS=OFF -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/x86_64-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/x86_64-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' ..) - - (cd curl/build; make) - - (cd curl/build; make install) - # Build luabind - - mkdir -p luabind - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O luabind.tar.gz - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O luabind-debian.tar.xz - - tar xvf luabind.tar.gz -C luabind --strip 1 || exit 2 - - tar xvf luabind-debian.tar.xz -C luabind || exit 2 - - cd luabind - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - cd .. - # Build libogg - - mkdir -p libogg/build - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz -O libogg.tar.gz - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2-1.diff.gz -O libogg.diff.gz - - tar xvf libogg.tar.gz -C libogg --strip 1 || exit 2 - - gunzip libogg.diff.gz - - cd libogg - - patch -p1 < ../libogg.diff - - cd build - - ../configure --disable-maintainer-mode --host=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-static --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-Wformat=2 -g -fPIC" CXXFLAGS="-Wformat=2 -g -fPIC" LDFLAGS="-Wl,-z,now" - - make - - make install - - cd ../.. - # Build libvorbis - - mkdir -p libvorbis - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/libvorbis_1.3.5.orig.tar.gz -O libvorbis.tar.gz - - tar xvf libvorbis.tar.gz -C libvorbis --strip 1 || exit 2 - # Get list package - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis -O list_libvorbis - # get last patch for our release - - line=$(egrep '(libvorbis_1.3.5)(.*)(tar[.]xz)' list_libvorbis | tail -n 1) - # get only name of the patch - - tmp=${line#*href} ; tmp2=${tmp%%>*} ; tmp3=${tmp2#*\"} ; namepatch=${tmp3%\"*} - # download this patch - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/$namepatch -O libvorbis.debian.tar.xz - - tar xvf libvorbis.debian.tar.xz -C libvorbis || exit 2 - - cd libvorbis - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - ./configure --enable-static --with-pic - - make - - make install - - cd .. - # Action - - mkdir -p code/build - - (cd code/build ; cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_DRIVER_OPENGL=ON -DWITH_DRIVER_OPENAL=ON -DWITH_NEL_SAMPLES=ON -DWITH_SOUND=ON -DWITH_STATIC_CURL=ON -DWITH_SYMBOLS=ON ..) - - (cd code/build; make khanat_client) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-client_static_debug-debian_amd64_strech-$CI_COMMIT_REF_NAME" - paths: - - code/build/bin -# expire_in: 2 week - - -Linux server_static debian_amd64_strech build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: amd64/debian:9 - script: - # Prepare environment - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 apache2-utils autoconf autogen automake bison build-essential cmake cpputest default-libmysqlclient-dev fakeroot git libapache2-mod-php libboost-all-dev libfreetype6-dev libgif-dev libgl1-mesa-dev libjpeg62-turbo-dev liblua5.2-0 liblua5.2-dev liblzma-dev libogg-dev libopenal-dev libpng-dev libssh2-1-dev libssl-dev libtool libtool-bin libvorbis-dev libx11-dev libxml2-dev libxmu-dev libxrandr-dev libxrender-dev libxxf86vm-dev mercurial mysql-server php php-gd php-imagick php-mysql python3 python3-pip python3-bcrypt python3-venv rrdtool unzip wget zlib1g-dev - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Build Curl - - wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O curl.tar.gz - - mkdir -p curl/build - - tar xvf curl.tar.gz -C curl --strip 1 - - (cd curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CURL_TESTS=OFF -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/x86_64-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/x86_64-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' ..) - - (cd curl/build; make) - - (cd curl/build; make install) - # Build luabind - - mkdir -p luabind - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O luabind.tar.gz - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O luabind-debian.tar.xz - - tar xvf luabind.tar.gz -C luabind --strip 1 || exit 2 - - tar xvf luabind-debian.tar.xz -C luabind || exit 2 - - cd luabind - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - cd .. - # Build libogg - - mkdir -p libogg/build - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz -O libogg.tar.gz - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2-1.diff.gz -O libogg.diff.gz - - tar xvf libogg.tar.gz -C libogg --strip 1 || exit 2 - - gunzip libogg.diff.gz - - cd libogg - - patch -p1 < ../libogg.diff - - cd build - - ../configure --disable-maintainer-mode --host=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-static --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-Wformat=2 -g -fPIC" CXXFLAGS="-Wformat=2 -g -fPIC" LDFLAGS="-Wl,-z,now" - - make - - make install - - cd ../.. - # Build libvorbis - - mkdir -p libvorbis - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/libvorbis_1.3.5.orig.tar.gz -O libvorbis.tar.gz - - tar xvf libvorbis.tar.gz -C libvorbis --strip 1 || exit 2 - # Get list package - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis -O list_libvorbis - # get last patch for our release - - line=$(egrep '(libvorbis_1.3.5)(.*)(tar[.]xz)' list_libvorbis | tail -n 1) - # get only name of the patch - - tmp=${line#*href} ; tmp2=${tmp%%>*} ; tmp3=${tmp2#*\"} ; namepatch=${tmp3%\"*} - # download this patch - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/$namepatch -O libvorbis.debian.tar.xz - - tar xvf libvorbis.debian.tar.xz -C libvorbis || exit 2 - - cd libvorbis - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - ./configure --enable-static --with-pic - - make - - make install - - cd .. - # Action - - mkdir -p code/build - - (cd code/build ; cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_NEL_TESTS=OFF ..) - - ls -l code - - ls -l code/build - - (cd code/build; make ryzom_admin_service ryzom_ai_service ryzom_backup_service ryzom_dynamic_scenario_service ryzom_entities_game_service ryzom_frontend_service ryzom_general_utilities_service ryzom_gpm_service ryzom_ios_service ryzom_log_analyser_service ryzom_logger_service ryzom_mail_forum_service ryzom_mirror_service ryzom_mission_compiler ryzom_monitor_service ryzom_naming_service ryzom_patchman_service ryzom_pd_support_service ryzom_persistant_data_service ryzom_reference_builder_service ryzom_session_browser_service ryzom_shard_unifier_service ryzom_tick_service ryzom_welcome_service sheets_packer bnp_make make_sheet_id patch_gen) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-server_static-debian_amd64_strech-$CI_COMMIT_REF_NAME" - paths: - - code/build/bin - - code/ryzom/server/shard.screen.rc - - code/web - - code/ryzom/server/*.cfg - - code/ryzom/server/data_shard - - code/ryzom/common/data_common - - code/ryzom/common/data_leveldesign - - code/ryzom/client/*.cfg - - code/ryzom/client/cfg - - code/ryzom/client/data - - code/ryzom/client/macosx - - code/ryzom/client/unix - - code/ryzom/client/windows - - code/ryzom/tools/scripts/linux -# expire_in: 2 week - - -Linux server_static_debug debian_amd64_strech build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: amd64/debian:9 - script: - # Prepare environment - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 apache2-utils autoconf autogen automake bison build-essential cmake cpputest default-libmysqlclient-dev fakeroot git libapache2-mod-php libboost-all-dev libfreetype6-dev libgif-dev libgl1-mesa-dev libjpeg62-turbo-dev liblua5.2-0 liblua5.2-dev liblzma-dev libogg-dev libopenal-dev libpng-dev libssh2-1-dev libssl-dev libtool libtool-bin libvorbis-dev libx11-dev libxml2-dev libxmu-dev libxrandr-dev libxrender-dev libxxf86vm-dev mercurial mysql-server php php-gd php-imagick php-mysql python3 python3-pip python3-bcrypt python3-venv rrdtool unzip wget zlib1g-dev - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Build Curl - - wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O curl.tar.gz - - mkdir -p curl/build - - tar xvf curl.tar.gz -C curl --strip 1 - - (cd curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CURL_TESTS=OFF -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/x86_64-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/x86_64-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/x86_64-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' ..) - - (cd curl/build; make) - - (cd curl/build; make install) - # Build luabind - - mkdir -p luabind - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O luabind.tar.gz - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O luabind-debian.tar.xz - - tar xvf luabind.tar.gz -C luabind --strip 1 || exit 2 - - tar xvf luabind-debian.tar.xz -C luabind || exit 2 - - cd luabind - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - cd .. - # Build libogg - - mkdir -p libogg/build - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz -O libogg.tar.gz - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2-1.diff.gz -O libogg.diff.gz - - tar xvf libogg.tar.gz -C libogg --strip 1 || exit 2 - - gunzip libogg.diff.gz - - cd libogg - - patch -p1 < ../libogg.diff - - cd build - - ../configure --disable-maintainer-mode --host=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-static --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-Wformat=2 -g -fPIC" CXXFLAGS="-Wformat=2 -g -fPIC" LDFLAGS="-Wl,-z,now" - - make - - make install - - cd ../.. - # Build libvorbis - - mkdir -p libvorbis - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/libvorbis_1.3.5.orig.tar.gz -O libvorbis.tar.gz - - tar xvf libvorbis.tar.gz -C libvorbis --strip 1 || exit 2 - # Get list package - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis -O list_libvorbis - # get last patch for our release - - line=$(egrep '(libvorbis_1.3.5)(.*)(tar[.]xz)' list_libvorbis | tail -n 1) - # get only name of the patch - - tmp=${line#*href} ; tmp2=${tmp%%>*} ; tmp3=${tmp2#*\"} ; namepatch=${tmp3%\"*} - # download this patch - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/$namepatch -O libvorbis.debian.tar.xz - - tar xvf libvorbis.debian.tar.xz -C libvorbis || exit 2 - - cd libvorbis - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - ./configure --enable-static --with-pic - - make - - make install - - cd .. - # Action - - mkdir -p code/build - - (cd code/build ; cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_NEL_TESTS=OFF -DWITH_SYMBOLS=ON ..) - - ls -l code - - ls -l code/build - - (cd code/build; make ryzom_admin_service ryzom_ai_service ryzom_backup_service ryzom_dynamic_scenario_service ryzom_entities_game_service ryzom_frontend_service ryzom_general_utilities_service ryzom_gpm_service ryzom_ios_service ryzom_log_analyser_service ryzom_logger_service ryzom_mail_forum_service ryzom_mirror_service ryzom_mission_compiler ryzom_monitor_service ryzom_naming_service ryzom_patchman_service ryzom_pd_support_service ryzom_persistant_data_service ryzom_reference_builder_service ryzom_session_browser_service ryzom_shard_unifier_service ryzom_tick_service ryzom_welcome_service sheets_packer bnp_make make_sheet_id patch_gen) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-server_static_debug-debian_amd64_strech-$CI_COMMIT_REF_NAME" - paths: - - code/build/bin - - code/ryzom/server/shard.screen.rc - - code/web - - code/ryzom/server/*.cfg - - code/ryzom/server/data_shard - - code/ryzom/common/data_common - - code/ryzom/common/data_leveldesign - - code/ryzom/client/*.cfg - - code/ryzom/client/cfg - - code/ryzom/client/data - - code/ryzom/client/macosx - - code/ryzom/client/unix - - code/ryzom/client/windows - - code/ryzom/tools/scripts/linux -# expire_in: 2 week - - -Linux client_static debian_i386_strech build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: i386/debian:9 - script: - # Prepare environment - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - apt-get install -y autoconf autogen automake bison build-essential cmake cpputest fakeroot libboost-all-dev libfreetype6-dev libgif-dev libgl1-mesa-dev libjpeg62-turbo-dev liblzma-dev libopenal-dev libpng-dev libssh2-1-dev libssl-dev libtool libtool-bin libx11-dev libxml2-dev libxmu-dev libxrandr-dev libxrender-dev libxxf86vm-dev mercurial rrdtool unzip wget zlib1g-dev patch - - apt-get install -y liblua5.2-0 liblua5.2-dev - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Build Curl - - wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O curl.tar.gz - - mkdir -p curl/build - - tar xvf curl.tar.gz -C curl --strip 1 - - (cd curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CURL_TESTS=OFF -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/i386-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/i386-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/i386-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' ..) - - (cd curl/build; make) - - (cd curl/build; make install) - # Build luabind - - mkdir -p luabind - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O luabind.tar.gz - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O luabind-debian.tar.xz - - tar xvf luabind.tar.gz -C luabind --strip 1 || exit 2 - - tar xvf luabind-debian.tar.xz -C luabind || exit 2 - - cd luabind - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - cd .. - # Build libogg - - mkdir -p libogg/build - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz -O libogg.tar.gz - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2-1.diff.gz -O libogg.diff.gz - - tar xvf libogg.tar.gz -C libogg --strip 1 || exit 2 - - gunzip libogg.diff.gz - - cd libogg - - patch -p1 < ../libogg.diff - - cd build - - ../configure --disable-maintainer-mode --host=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-static --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-Wformat=2 -g -fPIC" CXXFLAGS="-Wformat=2 -g -fPIC" LDFLAGS="-Wl,-z,now" - - make - - make install - - cd ../.. - # Build libvorbis - - mkdir -p libvorbis - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/libvorbis_1.3.5.orig.tar.gz -O libvorbis.tar.gz - - tar xvf libvorbis.tar.gz -C libvorbis --strip 1 || exit 2 - # Get list package - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis -O list_libvorbis - # get last patch for our release - - line=$(egrep '(libvorbis_1.3.5)(.*)(tar[.]xz)' list_libvorbis | tail -n 1) - # get only name of the patch - - tmp=${line#*href} ; tmp2=${tmp%%>*} ; tmp3=${tmp2#*\"} ; namepatch=${tmp3%\"*} - # download this patch - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/$namepatch -O libvorbis.debian.tar.xz - - tar xvf libvorbis.debian.tar.xz -C libvorbis || exit 2 - - cd libvorbis - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - ./configure --enable-static --with-pic - - make - - make install - - cd .. - # Action - - mkdir -p code/build - - (cd code/build ; cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_NEL_TESTS=OFF ..) - - (cd code/build; make khanat_client) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-client_static-debian_i386_strech-$CI_COMMIT_REF_NAME" - paths: - - code/build/bin -# expire_in: 2 week - - - -Linux client_static_debug debian_i386_strech build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: i386/debian:9 - script: - # Prepare environment - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - DEBIAN_FRONTEND=noninteractive apt-get install -y autoconf autogen automake bison build-essential cmake cpputest fakeroot libboost-all-dev libfreetype6-dev libgif-dev libgl1-mesa-dev libjpeg62-turbo-dev liblzma-dev libopenal-dev libpng-dev libssh2-1-dev libssl-dev libtool libtool-bin libx11-dev libxml2-dev libxmu-dev libxrandr-dev libxrender-dev libxxf86vm-dev mercurial rrdtool unzip wget zlib1g-dev patch - - apt-get install -y liblua5.2-0 liblua5.2-dev - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Build Curl - - wget -q https://curl.haxx.se/download/curl-7.58.0.tar.gz -O curl.tar.gz - - mkdir -p curl/build - - tar xvf curl.tar.gz -C curl --strip 1 - - (cd curl/build; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CURL_TESTS=OFF -DCURL_ZLIB=ON -DBUILD_CURL_EXE=OFF -DCURL_STATICLIB=ON -DHTTP_ONLY=ON -DENABLE_IPV6=ON -DCMAKE_USE_OPENSSL=ON -DOPENSSL_SSL_LIBRARIES=/usr/lib/i386-linux-gnu/libssl.a -DOPENSSL_CRYPTO_LIBRARIES=/usr/lib/i386-linux-gnu/libcrypto.a -DCMAKE_USE_LIBSSH2=OFF -DZLIB_LIBRARY=/usr/lib/i386-linux-gnu/libz.a -DCMAKE_C_FLAGS='-fPIC' ..) - - (cd curl/build; make) - - (cd curl/build; make install) - # Build luabind - - mkdir -p luabind - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O luabind.tar.gz - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O luabind-debian.tar.xz - - tar xvf luabind.tar.gz -C luabind --strip 1 || exit 2 - - tar xvf luabind-debian.tar.xz -C luabind || exit 2 - - cd luabind - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - export -p DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH); bjam -d2 release debug install link=static cflags="-fPIC $(dpkg-buildflags --get CFLAGS)" cxxflags="-fPIC $(dpkg-buildflags --get CXXFLAGS) -Wno-deprecated-declarations" linkflags=" $(dpkg-buildflags --get LDFLAGS)" - - cd .. - # Build libogg - - mkdir -p libogg/build - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz -O libogg.tar.gz - - wget -q http://http.debian.net/debian/pool/main/libo/libogg/libogg_1.3.2-1.diff.gz -O libogg.diff.gz - - tar xvf libogg.tar.gz -C libogg --strip 1 || exit 2 - - gunzip libogg.diff.gz - - cd libogg - - patch -p1 < ../libogg.diff - - cd build - - ../configure --disable-maintainer-mode --host=$(dpkg-architecture -qDEB_HOST_GNU_TYPE) --build=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) --libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-static --prefix=/usr CPPFLAGS="-D_FORTIFY_SOURCE=2" CFLAGS="-Wformat=2 -g -fPIC" CXXFLAGS="-Wformat=2 -g -fPIC" LDFLAGS="-Wl,-z,now" - - make - - make install - - cd ../.. - # Build libvorbis - - mkdir -p libvorbis - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/libvorbis_1.3.5.orig.tar.gz -O libvorbis.tar.gz - - tar xvf libvorbis.tar.gz -C libvorbis --strip 1 || exit 2 - # Get list package - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis -O list_libvorbis - # get last patch for our release - - line=$(egrep '(libvorbis_1.3.5)(.*)(tar[.]xz)' list_libvorbis | tail -n 1) - # get only name of the patch - - tmp=${line#*href} ; tmp2=${tmp%%>*} ; tmp3=${tmp2#*\"} ; namepatch=${tmp3%\"*} - # download this patch - - wget -q http://security.debian.org/debian-security/pool/updates/main/libv/libvorbis/$namepatch -O libvorbis.debian.tar.xz - - tar xvf libvorbis.debian.tar.xz -C libvorbis || exit 2 - - cd libvorbis - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - ./configure --enable-static --with-pic - - make - - make install - - cd .. - # Action - - mkdir -p code/build - - (cd code/build ; cmake -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_SYMBOLS=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_NEL_TESTS=OFF ..) - - (cd code/build; make khanat_client) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-client_static_debug-debian_i386_strech-$CI_COMMIT_REF_NAME" - paths: - - code/build/bin -# expire_in: 2 week - - -# Fedora Client -Linux client fedora_amd64_27 build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: amd64/fedora:27 - script: - # Prepare environment - - yum update -y - - yum install -y - autoconf - autogen - automake - bison - boost-devel - cmake - fakeroot - freetype-devel - gcc - gcc-c++ - giflib-devel - libcurl-devel - libjpeg-turbo-devel - libogg-devel - libpng-devel - libssh2-devel - libtool - libvorbis-devel - libX11-devel - libxml2-devel - libXmu - libXrandr-devel - libXrender-devel - libXxf86vm-devel - luabind-devel - lua-devel - lzma-devel - make - mercurial - mesa-libGL-devel - openal-soft-devel - openssl-devel - patch - rrdtool - unzip - wget - xz - zlib-devel - patch - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Action - - mkdir -p code/build - - (cd code/build ; export -p CPPFLAGS="-Wno-deprecated -Wno-deprecated-declarations"; cmake -G "Unix Makefiles" -DWITH_NEL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=OFF -DWITH_RYZOM_CUSTOM_PATCH_SERVER=OFF -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_DRIVER_OPENGL=ON -DWITH_DRIVER_OPENAL=ON -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=ON -DWITH_STATIC_CURL=OFF ..) - - (cd code/build; make khanat_client) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-client-fedora_27-$CI_COMMIT_REF_NAME" - paths: - - code/build/bin -# expire_in: 2 week - when: manual - - -# Ubuntu Client -Linux client ubuntu_amd64_17_10 build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: amd64/ubuntu:17.10 - script: - # Prepare environment - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - DEBIAN_FRONTEND=noninteractive apt-get install -y autoconf - autogen - automake - bison - build-essential - cmake - cpputest - fakeroot - libboost-all-dev - libcurl4-openssl-dev - libfreetype6-dev - libgif-dev - libgl1-mesa-dev - libjpeg62-dev - liblzma-dev - libopenal-dev - libpng-dev - libssh2-1-dev - libssl-dev - libtool - libtool-bin - libx11-dev - libxml2-dev - libxmu-dev - libxrandr-dev - libxrender-dev - libxxf86vm-dev - mercurial - rrdtool - unzip - wget - zlib1g-dev - - apt-get install -y liblua5.2-0 liblua5.2-dev libluabind-dev libluabind0.9.1v5 libogg-dev libvorbis-dev - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - # Action - - mkdir -p code/build - - (cd code/build ; export -p CPPFLAGS="-Wno-deprecated -Wno-deprecated-declarations"; cmake -G "Unix Makefiles" -DWITH_NEL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=OFF -DWITH_RYZOM_CUSTOM_PATCH_SERVER=OFF -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_DRIVER_OPENGL=ON -DWITH_DRIVER_OPENAL=ON -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=ON -DWITH_STATIC_CURL=OFF ..) - - (cd code/build; make khanat_client) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-client-ubuntu_17_10-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID" - paths: - - code/build/bin -# expire_in: 2 week - when: manual - - -# Archlinux Client -Linux client archlinux build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: base/archlinux - script: - # Prepare environment - - pacman -Syyu --noconfirm pacman-contrib - - cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup - - curl -o /etc/pacman.d/mirrorlist.new https://www.archlinux.org/mirrorlist/all/ - - sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist.new - - rankmirrors -n 6 /etc/pacman.d/mirrorlist.new > /etc/pacman.d/mirrorlist - - pacman -Syyu - - pacman -S --noconfirm - autoconf - autogen - automake - binutils - boost - boost-libs - cmake - fakeroot - gcc - giflib - git - glu - libjpeg-turbo - libogg - libpng - libssh - libtool - libvorbis - libx11 - libxml2 - libxmu - libxrandr - libxrender - libxxf86vm - lua - make - mesa - openal - openssl - patch - pkg-config - sed - unzip - wget - xorg-xfd - xz - zlib - > pacman.log - # Install Yaourt - # Disable check root (never do that on real server) - - sed -i 's/EUID == 0/EUID == 12345/g' /usr/sbin/makepkg - - mkdir -p build - - cd build - - git clone https://aur.archlinux.org/package-query.git - - cd package-query - - yes | makepkg -si || echo $? - - cd .. - - git clone https://aur.archlinux.org/yaourt.git - - cd yaourt - - yes | makepkg -si || echo $? - - cd ../.. - - yaourt -Syyu --noconfirm --aur boost-build - # Apply patch - - (for patchfile in $(cat patch/series); do echo "patch patch/$patchfile"; patch -f -Z -t -p 1 -i patch/$patchfile || exit 2; done) - - patch -f -Z -t -p 1 -i patch/02_archlinux_allocator_static_assert_error.patch - # Build - - mkdir -p luabind - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg.orig.tar.gz -O luabind.tar.gz - - wget -q http://http.debian.net/debian/pool/main/l/luabind/luabind_0.9.1+dfsg-11.debian.tar.xz -O luabind-debian.tar.xz - - tar xvf luabind.tar.gz -C luabind --strip 1 || exit 2 - - tar xvf luabind-debian.tar.xz -C luabind || exit 2 - - cd luabind - - for file in $(cat debian/patches/series); do patch -p1 < debian/patches/$file; done - - export -p DEB_HOST_MULTIARCH="/"; bjam -d2 release debug install cxxflags="-fPIC -Wno-deprecated -Wno-deprecated-declarations" - - export -p DEB_HOST_MULTIARCH="/"; bjam -d2 release debug install link=static cxxflags="-fPIC -Wno-deprecated -Wno-deprecated-declarations" - - cd .. - # Action - - mkdir -p code/build - - (cd code/build ; export -p CPPFLAGS="-Wno-deprecated -Wno-deprecated-declarations"; cmake -G "Unix Makefiles" -DWITH_NEL=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_LUA52=ON -DWITH_RYZOM_PATCH=OFF -DWITH_RYZOM_CUSTOM_PATCH_SERVER=OFF -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_DRIVER_OPENGL=ON -DWITH_DRIVER_OPENAL=ON -DWITH_NEL_SAMPLES=OFF -DWITH_SOUND=ON -DWITH_STATIC_CURL=ON /opt/code ..) - - (cd code/build; make khanat_client) - - (cd code/build/bin; ls -lh) - artifacts: - name: "khanat-client-archlinux-$CI_COMMIT_REF_NAME" - paths: - - code/build/bin -# expire_in: 2 week - when: manual - - -# Windows Client -Windows client build: - stage: build - except: - - mac-ci-build - tags: - - Docker - image: amd64/debian:9 - script: - # Prepare environment - - dpkg --add-architecture i386 - - DEBIAN_FRONTEND=noninteractive apt-get update - - DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y - - DEBIAN_FRONTEND=noninteractive apt-get install -y - p7zip-full - binfmt-support - libc6-i386 - libncurses5:i386 - libfreetype6:i386 - bzip2 - wget - dos2unix - # Action - - mkdir -p wincross - - source builder/cross_win32.sh - - mkdir -p codebis - - cp -r code/* codebis/. - - find codebis -type f -name "*.h*" -exec unix2dos {} \; - - find codebis -type f -name "*.c*" -exec unix2dos {} \; - - find codebis -type f -name "*.txt" -exec unix2dos {} \; - - find codebis -type f -name "*.rc" -exec unix2dos {} \; - - mkdir -p build - - cd build - - wine cmake.exe -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_RYZOM_CLIENT=ON -DWITH_RYZOM_PATCH=ON -DWITH_NEL_TESTS=OFF -DWITH_NEL_TOOLS=OFF -DWITH_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_LUA53=ON -DWITH_LUA51=OFF -DWITH_STLPORT=OFF -DWITH_DRIVER_DSOUND=ON -G "NMake Makefiles JOM" -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_DRIVER_OPENAL=OFF -DWITH_DRIVER_DSOUND=ON -DWITH_DRIVER_XAUDIO2=ON -DWITH_DRIVER_FMOD=ON -DWITH_DRIVER_DIRECT3D=ON ../codebis - - wine jom.exe - artifacts: - name: "khanat-client-windows-$CI_COMMIT_REF_NAME" - paths: - - build/bin -# expire_in: 2 week - - -# Job de compilation pour OSX -OSX client build: - stage: build - only: - - tags - - mac-ci-build - tags: - - OSX - variables: - # Éviter de cloner tout le dépot à chaque fois, à la place juste récuperer les changements - GIT_STRATEGY: fetch - script: - # Création de l'environnement de compilation - - mkdir -p BUILD/x86_64 - - cd BUILD/x86_64 - # Configuration - - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFINAL_VERSION=ON -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_NEL_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_STATIC_EXTERNAL=OFF -DWITH_RYZOM_PATCH=ON -DWITH_RYZOM_CUSTOM_PATCH_SERVER=ON -DWITH_LUA52=ON ../../code - # Compilation et installation - - make -j$(($(sysctl -n hw.ncpu)/2)) install DESTDIR=../../OSX/x86_64 - artifacts: - name: "khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-OSX-x86_64" - paths: - - OSX/x86_64/* - when: manual - - -## TESTS -Linux client test: - stage: test - except: - - ryzomcore - - mac-ci-build - tags: - - Docker - image: ubuntu:18.04 - script: - # Test de l'installation initiale - - ./khanat-$(echo $CI_BUILD_REF | head -c 7 )-$CI_PIPELINE_ID-Linux-x86_64.run - dependencies: - - Linux client build - -.OSX client test: - stage: test - only: - - tags - - mac-ci-build - tags: - - OSX - script: - - echo "pas encore de test pour le client OSX" - dependencies: - - OSX client build - when: manual - -##DEPLOYEMENT TO STAGING (TEST SERVER) - -# Job de déploiment vers le staging. Inutilisé pour le moment, il pourrait servir à l'avenir pour déployer automatiquement les nouvelles versions du client/serveur vers l'environnement de staging (zone de test) -.Deploy to Staging: - stage: staging - environment: Staging - except: - - ryzomcore - tags: - - Docker - image: ubuntu:18.04 - script: - - echo "pas encore de deployment" - dependencies: - - Linux client build - - Linux client test - - OSX client build - - OSX client test - when: manual - -##DEPLOYEMENT TO PRODUCTION - -# Job de déploiment vers la production. Inutilisé pour le moment, il pourrait servir à l'avenir pour déployer automatiquement les nouvelles versions du client/serveur vers l'environnement de production -.Release to Production: - stage: production - environment: Production - only: - - tags - tags: - - Docker - image: ubuntu:18.04 - script: - - echo "pas encore de tag" - dependencies: - - Linux client build - - Linux client test - - OSX client build - - OSX client test - - Deploy to Staging - when: manual diff --git a/.hgeol b/.hgeol new file mode 100644 index 000000000..a9766f577 --- /dev/null +++ b/.hgeol @@ -0,0 +1,28 @@ +[patterns] +**.h = native +**.cpp = native + +**/database.xml = BIN +**/msg.xml = BIN + +**.txt = native +**.xml = native + +**.layout = native +**.looknfeel = native +**.imageset = native +**.font = native +**.scheme = native + +**.tpl = native + +**.xsd = native +**.dox = native + +**.py = native +**.lua = native + +**.pkg = native + +[repository] +native = LF diff --git a/.hgignore b/.hgignore index 990487a2a..41a0e58cf 100644 --- a/.hgignore +++ b/.hgignore @@ -242,9 +242,6 @@ external_stlport nel_tools* ryzom_tools* -#personal projects -personal/ - #Dumps *.dmp 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/LICENSE b/LICENSE deleted file mode 100644 index 0c2a91a54..000000000 --- a/LICENSE +++ /dev/null @@ -1,661 +0,0 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - Khanat - Copyright (C) 2016 Khaganat - - 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 . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. diff --git a/README.md b/README.md index 1fa4cc8ef..c60d1bc0b 100644 --- a/README.md +++ b/README.md @@ -1,9 +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. - -Modification par la Team Khaganat +# 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. diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index cfb8b4696..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,40 +0,0 @@ -jobs: - - job: ubuntu16 - pool: - vmImage: 'Ubuntu-16.04' - steps: - - script: | - sudo apt-get update - sudo apt-get install -y software-properties-common - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install cmake build-essential -y - sudo apt-get install gcc-8 g++-8 -y - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 60 - sudo apt-get install bison autoconf automake -y - sudo apt-get install libpng12-dev -y - sudo apt-get install libjpeg-dev -y - sudo apt-get install libgif-dev libfreetype6-dev -y - sudo apt-get install freeglut3-dev -y - sudo apt-get install liblua5.1-dev libluabind-dev libcpptest-dev -y - sudo apt-get install libogg-dev libvorbis-dev libopenal-dev -y - sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev libswscale-dev libpostproc-dev -y - sudo apt-get install libmysqlclient-dev -y - sudo apt-get install libxml2-dev -y - sudo apt-get install libcurl4-openssl-dev libssl-dev -y - sudo apt-get install libsquish-dev -y - sudo apt-get install liblzma-dev -y - sudo apt-get install libgsf-1-dev -y - displayName: 'Dependencies' - - script: | - mkdir build - cmake --version - cd build - cmake -DWITH_STATIC=ON -DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=ON -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=ON -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TOOLS=ON -DWITH_LIBGSF=ON ../code - cat CMakeCache.txt - displayName: 'CMake' - - script: | - cd build - make -j`nproc` - displayName: 'Make' \ No newline at end of file diff --git a/builder/cross_win32.sh b/builder/cross_win32.sh deleted file mode 100755 index 3f116f723..000000000 --- a/builder/cross_win32.sh +++ /dev/null @@ -1,242 +0,0 @@ -## Début script windows ## -#!/bin/sh -# variables à changer : -export BASEDIR=$PWD/wincross - -COMPILER=vc12 -ARCH=amd64 -WINEVERSION=1.9.1 - -URL="http://kervala.net/download/" -URLPREFIX="win32_cross_" -URLSUFFIX=".7z" - -download() -{ - PACK=$1 - - if [ ! -e $URLPREFIX$PACK$URLSUFFIX ] - then - echo "Downloading $PACK... [$URL$URLPREFIX$PACK$URLSUFFIX]" - wget -q $URL$URLPREFIX$PACK$URLSUFFIX || exit 2 - fi - - echo "Extracting $PACK..." - 7z -y -o$BASEDIR x $URLPREFIX$PACK$URLSUFFIX 1> /dev/null || exit 2 - - RET=$? - - if [ -d $BASEDIR/$PACK/bin ] - then - chmod +x $BASEDIR/$PACK/bin/*.exe - fi - - return $RET -} - - - - - -if [ "$COMPILER" = "vc8" ] -then - echo "Using VC++ 2005 compilers" -elif [ "$COMPILER" = "vc9" ] -then - echo "Using VC++ 2008 compilers" -elif [ "$COMPILER" = "vc10" ] -then - echo "Using VC++ 2010 compilers" -elif [ "$COMPILER" = "vc11" ] -then - echo "Using VC++ 2012 compilers" -elif [ "$COMPILER" = "vc12" ] -then - echo "Using VC++ 2013 compilers" -elif [ "$COMPILER" = "vc14" ] -then - echo "Using VC++ 2015 compilers" -else - echo "Bad compiler $COMPILER" - return 1 -fi - -if [ ! -d "tools" ] -then - download tools -fi - -if [ ! -d $COMPILER ] -then - download $COMPILER - - ARCHS="amd64 ia64 x86 x86_amd64 x86_ia64" - - for TARCH in $ARCHS - do - CDIR=$COMPILER/bin/$TARCH - - if [ -d "$CDIR" ] - then - chmod +x $CDIR/*.exe - fi - done -fi - -if [ ! -d "winsdk" ] -then - download winsdk -fi - -if [ ! -d "dxsdk" ] -then - download dxsdk -fi - -if [ ! -d "$COMPILER/external" ] -then - download $COMPILER"_external" -fi - -export BASEDIRDOS=Z:$(echo "$BASEDIR" | sed 's/\//\\/g') - -export TOOLSDIR=$BASEDIR/tools -export TOOLSBINDIR=$TOOLSDIR/bin - -export VCDIR=$BASEDIR/$COMPILER -export VCBINDIR=$VCDIR/bin - -export WINSDKDIR=$BASEDIR/winsdk -export WINSDKBINDIR=$WINSDKDIR/bin - -# wine -if [ ! -z $WINEVERSION ] -then - export BASEWINEDIR=$BASEDIR/wineversion - export WINEDIR=$BASEWINEDIR/$WINEVERSION/bin - if [ ! -d $WINEDIR ] - then - echo "Downloading WINE $WINEVERSION... [http://www.playonlinux.com/wine/binaries/linux-amd64/PlayOnLinux-wine-$WINEVERSION-linux-amd64.pol]" - wget -q http://www.playonlinux.com/wine/binaries/linux-amd64/PlayOnLinux-wine-$WINEVERSION-linux-amd64.pol - echo "Extracting WINE $WINEVERSION... ($BASEDIR)" - tar xjf PlayOnLinux-wine-$WINEVERSION-linux-amd64.pol --directory=$BASEDIR - fi -fi - -# remove previous win32 pathes af any -export PATH=$(echo $PATH | sed 's|:'$BASEDIR'/[a-z0-9./_-]*||g') - - -export PATH=$PATH:$WINEDIR - - -# add wine to path -export CURRENT_CPU=x86 -export Configuration=Release -export TARGET_PLATFORM=WIN7 -export APPVER=6.1 -export DEBUGMSG=Release -export INCLUDE=$BASEDIRDOS"\\"$COMPILER"\\include;"$BASEDIRDOS"\\winsdk\\include" -export LIB= -export LIBPATH=$BASEDIRDOS"\\"$COMPILER"\\lib" - -export PATH=$PATH:$TOOLSBINDIR:$WINSDKBINDIR - -if [ $ARCH = "x86" ] -then - export PATH=$PATH:$VCBINDIR/x86 - export WINEPATH=$BASEDIRDOS"\\"$COMPILER"\\bin\\x86;" - export TARGET_CPU=x86 - export LIB=$BASEDIRDOS"\\"$COMPILER"\\lib;"$BASEDIRDOS"\\winsdk\\lib;"$BASEDIRDOS"\\dxsdk\\lib" -elif [ $ARCH = "amd64" ] -then - export PATH=$PATH:$VCBINDIR/x86_amd64 - export WINEPATH=$BASEDIRDOS"\\"$COMPILER"\\bin\\x86_amd64;" - export TARGET_CPU=x64 - export LIB=$BASEDIRDOS"\\"$COMPILER"\\lib\\amd64;"$BASEDIRDOS"\\winsdk\\lib\\amd64;"$BASEDIRDOS"\\dxsdk\\lib\\amd64" -elif [ $ARCH = "ia64" ] -then - export PATH=$PATH:$VCBINDIR/x86_ia64 - export WINEPATH=$BASEDIRDOS"\\"$COMPILER"\\bin\\x86_ia64;" - export TARGET_CPU=IA64 - export LIB=$BASEDIRDOS"\\"$COMPILER"\\lib\\ia64;"$BASEDIRDOS"\\winsdk\\lib\\ia64" -else - echo "Bad arch $ARCH" - return 1 -fi - -export LIBPATH=$LIB -export PATH=$PATH:$VCBINDIR - -# PATH environment variable for Wine -export WINEPATH=".;"$WINEPATH$BASEDIRDOS"\\"$COMPILER"\\bin;"$BASEDIRDOS"\\winsdk\\bin;"$BASEDIRDOS"\\bin;"$BASEDIRDOS"\\tools\\bin;"$BASEDIRDOS"\\perl\\perl\\bin" - -export WINEPREFIX=$BASEDIR/wine/$WINEVERSION - -mkdir -p $WINEPREFIX - -# launch WINE for the first time -wine ping - -# Copy winemenubuilder.exe to wine to avoid missing X11 warnings -#if [ -f $TOOLSBINDIR/winemenubuilder.exe ] && [ -d $WINEPREFIX/drive_c/windows/system32 ] -#then -# rm -f $WINEPREFIX/drive_c/windows/system32/winemenubuilder.exe -# rm -f $WINEPREFIX/drive_c/windows/syswow64/winemenubuilder.exe -# export WINEDLLOVERRIDES=winemenubuilder.exe=n -#fi - -# delete fake manifests for VC++ 2008 runtimes -#rm -rf $WINEPREFIX/drive_c/windows/winsxs/x86_microsoft.vc80* -#rm -rf $WINEPREFIX/drive_c/windows/winsxs/manifests/x86_microsoft.vc80* -#rm -f $WINEPREFIX/drive_c/windows/system32/msvcr80.dll -#rm -rf $WINEPREFIX/drive_c/windows/winsxs/x86_microsoft.vc90* -#rm -rf $WINEPREFIX/drive_c/windows/winsxs/manifests/x86_microsoft.vc90* -#rm -f $WINEPREFIX/drive_c/windows/system32/msvcr90.dll -#rm -f $WINEPREFIX/drive_c/windows/system32/msvcr100.dll -#rm -f $WINEPREFIX/drive_c/windows/system32/msvcp100.dll - -# Remove all WINE warnings -export WINEDEBUG=-all - -# Setting misc environment variables -export QTDIR=Z:$BASEDIR/$COMPILER/qt -export DXSDK_DIR=Z:$BASEDIR/dxsdk -export VC_DIR=Z:$BASEDIR/$COMPILER -#export MT_OPTIONS="-log /tmp/mt/log -verbose" - -echo "TARGET_CPU=$TARGET_CPU" -echo "PATH=$PATH" -echo "WINEPATH=$WINEPATH" -echo "LIB=$LIB" -echo "INCLUDE=$INCLUDE" - -export EXTERNAL_MSVC80_PATH=Z:$BASEDIR/vc8/external -export EXTERNAL_MSVC90_PATH=Z:$BASEDIR/vc9/external -export EXTERNAL_MSVC10_PATH=Z:$BASEDIR/vc10/external -export EXTERNAL_MSVC11_PATH=Z:$BASEDIR/vc11/external -export EXTERNAL_MSVC12_PATH=Z:$BASEDIR/vc12/external -export EXTERNAL_MSVC14_PATH=Z:$BASEDIR/vc14/external - -if [ "$COMPILER" = "vc8" ] -then - export EXTERNAL_PATH=$EXTERNAL_MSVC80_PATH -elif [ "$COMPILER" = "vc9" ] -then - export EXTERNAL_PATH=$EXTERNAL_MSVC90_PATH -elif [ "$COMPILER" = "vc10" ] -then - export EXTERNAL_PATH=$EXTERNAL_MSVC10_PATH -elif [ "$COMPILER" = "vc11" ] -then - export EXTERNAL_PATH=$EXTERNAL_MSVC11_PATH -elif [ "$COMPILER" = "vc12" ] -then - export EXTERNAL_PATH=$EXTERNAL_MSVC12_PATH - export WINEDLLOVERRIDES="msvcr120.dll=n" -elif [ "$COMPILER" = "vc14" ] -then - export EXTERNAL_PATH=$EXTERNAL_MSVC14_PATH -fi - -## Fin script windows ## diff --git a/code/.clang-format b/code/.clang-format deleted file mode 100644 index 90f4ab553..000000000 --- a/code/.clang-format +++ /dev/null @@ -1,24 +0,0 @@ ---- -BasedOnStyle: WebKit -AllowShortFunctionsOnASingleLine: All -BraceWrapping: - AfterClass: true - AfterControlStatement: true - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: true - AfterStruct: true - AfterUnion: true - BeforeCatch: true - BeforeElse: true - IndentBraces: false -BreakBeforeBraces: Custom -BreakConstructorInitializersBeforeComma: 'false' -NamespaceIndentation: None -PointerAlignment: Right -SortIncludes: 'false' -TabWidth: '4' -UseTab: ForIndentation - -... diff --git a/code/.editorconfig b/code/.editorconfig deleted file mode 100644 index e4aef2c53..000000000 --- a/code/.editorconfig +++ /dev/null @@ -1,23 +0,0 @@ -; Top-most EditorConfig file -root = true - -; 4-column tab indentation -[*.cpp] -indent_style = tab -indent_size = 4 - -[*.c] -indent_style = tab -indent_size = 4 - -[*.h] -indent_style = tab -indent_size = 4 - -[*.py] -indent_style = tab -indent_size = 4 - -[*.config] -indent_style = space -indent_size = 2 diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4e5292f2a..67076ffa8 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -28,11 +28,15 @@ IF(COMMAND cmake_policy) # have absolute paths (e.g. -lpthread) cmake_policy(SET CMP0003 NEW) + # Works around warnings about escaped quotes in ADD_DEFINITIONS + # statements + cmake_policy(SET CMP0005 OLD) + # allow to link to qtmain automatically under Windows IF(POLICY CMP0020) CMAKE_POLICY(SET CMP0020 NEW) ENDIF() -ENDIF() +ENDIF(COMMAND cmake_policy) INCLUDE(nel) INCLUDE(ConfigureChecks) @@ -53,17 +57,12 @@ ENDIF() CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(RyzomCore CXX C) -SET(NL_VERSION_MAJOR 1) -SET(NL_VERSION_MINOR 0) +SET(NL_VERSION_MAJOR 0) +SET(NL_VERSION_MINOR 12) SET(NL_VERSION_PATCH 0) SET(YEAR "2004-${CURRENT_YEAR}") SET(AUTHOR "Winch Gate and The Ryzom Core Community") -SET(RYZOM_VERSION_MAJOR 3) -SET(RYZOM_VERSION_MINOR 2) -SET(RYZOM_VERSION_PATCH 1) -SET(REVISION 0) - #----------------------------------------------------------------------------- # Redirect output files SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -72,15 +71,15 @@ SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # DLL should be in the same directory as EXE under Windows IF(WIN32) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ELSE() +ELSE(WIN32) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -ENDIF() +ENDIF(WIN32) IF(WIN32) IF(WITH_MFC) FIND_PACKAGE(MFC QUIET) - ENDIF() -ENDIF() + ENDIF(WITH_MFC) +ENDIF(WIN32) #----------------------------------------------------------------------------- # Set default config options @@ -91,12 +90,14 @@ NL_SETUP_NELNS_DEFAULT_OPTIONS() NL_SETUP_RYZOM_DEFAULT_OPTIONS() NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS() -NL_SETUP_BUILD() -NL_SETUP_BUILD_FLAGS() - NL_SETUP_PREFIX_PATHS() RYZOM_SETUP_PREFIX_PATHS() +NL_CONFIGURE_CHECKS() + +NL_SETUP_BUILD() +NL_SETUP_BUILD_FLAGS() + #----------------------------------------------------------------------------- #Platform specifics @@ -107,8 +108,8 @@ IF(WIN32) IF(WITH_MFC) FIND_PACKAGE(CustomMFC REQUIRED) - ENDIF() -ENDIF() + ENDIF(WITH_MFC) +ENDIF(WIN32) FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(LibXml2 REQUIRED) @@ -117,29 +118,15 @@ FIND_PACKAGE(OpenSSL REQUIRED) FIND_PACKAGE(GIF) FIND_PACKAGE(Jpeg) -IF(WIN32) - SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib) -ENDIF() - -IF(WITH_LIBOVR) - FIND_PACKAGE(LibOVR) -ENDIF() - -IF(WITH_LIBVR) - FIND_PACKAGE(LibVR) -ENDIF() - -NL_CONFIGURE_CHECKS() - IF(WITH_STATIC_LIBXML2) SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC) -ENDIF() +ENDIF(WITH_STATIC_LIBXML2) IF(WITH_LIBXML2_ICONV) FIND_PACKAGE(Iconv REQUIRED) INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES}) -ENDIF() +ENDIF(WITH_LIBXML2_ICONV) IF(WITH_STATIC) # libxml2 could need winsock2 library @@ -154,53 +141,253 @@ IF(WITH_STATIC) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES}) ENDIF() ENDIF() -ENDIF() +ENDIF(WITH_STATIC) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake) IF(FINAL_VERSION) ADD_DEFINITIONS(-DFINAL_VERSION=1) -ENDIF() +ENDIF(FINAL_VERSION) IF(WITH_SSE2) ADD_DEFINITIONS(-DNL_HAS_SSE2) IF(WITH_SSE3) ADD_DEFINITIONS(-DNL_HAS_SSE3) + ENDIF(WITH_SSE3) +ENDIF(WITH_SSE2) + +IF(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() -IF(APPLE) - FIND_LIBRARY(CARBON_FRAMEWORK Carbon) - FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation) - FIND_LIBRARY(SECURITY_FRAMEWORK Security) - - IF(APPLE_CERTIFICATE) - # Find codesign_allocate - - # Xcode 7.0 and later versions - SET(CODESIGN_ALLOCATE ${OSX_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate) - - IF(NOT EXISTS "${CODESIGN_ALLOCATE}") - # Xcode 6.4 and previous versions - SET(CODESIGN_ALLOCATE ${CMAKE_OSX_SYSROOT}/usr/bin/codesign_allocate) - ENDIF() - - IF(NOT EXISTS "${CODESIGN_ALLOCATE}") - # System path - SET(CODESIGN_ALLOCATE /usr/bin/codesign_allocate) - ENDIF() - - IF(NOT EXISTS "${CODESIGN_ALLOCATE}") - MESSAGE(WARNING "Unable to find codesign_allocate in standard directories") - SET(CODESIGN_ALLOCATE) - ENDIF() +MACRO(ADD_QT_LIBRARY _NAME) + IF(WIN32) + SET(_PREFIX "Qt5") + SET(_EXT "lib") + ELSE() + SET(_PREFIX "libQt5") + SET(_EXT "a") ENDIF() -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() -INCLUDE(FindHelpers) +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) - FIND_QT5() + CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR) + + SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR}) + + FIND_PACKAGE(Qt5Core QUIET) + + IF(Qt5Core_FOUND) + # Check if we are using Qt static or shared libraries + GET_TARGET_PROPERTY(_FILE Qt5::Core IMPORTED_LOCATION_RELEASE) + + SET(QT_VERSION "${Qt5Core_VERSION_STRING}") + SET(_VERSION "${QT_VERSION}") + + IF(_FILE MATCHES "\\.(lib|a)$") + SET(QT_STATIC ON) + SET(_VERSION "${_VERSION} static version") + ELSE() + SET(QT_STATIC OFF) + SET(_VERSION "${_VERSION} shared version") + ENDIF() + + MESSAGE(STATUS "Found Qt ${_VERSION}") + + # These variables are not defined with Qt5 CMake modules + SET(QT_BINARY_DIR "${_qt5Core_install_prefix}/bin") + SET(QT_LIBRARY_DIR "${_qt5Core_install_prefix}/lib") + SET(QT_PLUGINS_DIR "${_qt5Core_install_prefix}/plugins") + SET(QT_TRANSLATIONS_DIR "${_qt5Core_install_prefix}/translations") + + # Fix wrong include directories with Qt 5 under Mac OS X + INCLUDE_DIRECTORIES("${_qt5Core_install_prefix}/include") + + FIND_PACKAGE(Qt5Gui) + FIND_PACKAGE(Qt5Widgets) + FIND_PACKAGE(Qt5OpenGL) + FIND_PACKAGE(Qt5Xml) + FIND_PACKAGE(Qt5LinguistTools) + FIND_PACKAGE(Qt5Network) + + IF(QT_STATIC) + 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 + FIND_PACKAGE(FreeType) + + IF(FREETYPE_FOUND) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIBRARIES}) + ELSE() + IF(UNIX) + SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a") + ELSEIF(WIN32) + SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib") + ENDIF() + IF(EXISTS ${FREETYPE_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB}) + ENDIF() + 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 + ${WINSDK_LIBRARY_DIR}/IPHlpApi.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) @@ -208,16 +395,16 @@ IF(WITH_QT) # Use Qt 4 FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED) -ENDIF() +ENDIF(WITH_QT) IF(WITH_ASSIMP) FIND_PACKAGE(assimp REQUIRED) -ENDIF() +ENDIF(WITH_ASSIMP) IF(WITH_NEL) IF(WITH_NEL_TESTS) FIND_PACKAGE(CppTest) - ENDIF() + ENDIF(WITH_NEL_TESTS) IF(WITH_GUI) FIND_PACKAGE(Luabind REQUIRED) @@ -232,41 +419,22 @@ IF(WITH_NEL) IF(CURL_STATIC) SET(CURL_DEFINITIONS -DCURL_STATICLIB) - LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) - LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES}) + SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) - IF(WIN32) - LIST(APPEND CURL_LIBRARIES Crypt32 Cryptui) - ELSE() + IF(UNIX) # CURL depends on libidn FIND_LIBRARY(IDN_LIBRARY idn) IF(IDN_LIBRARY) - LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY}) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY}) ENDIF() - # CURL Macports version can depend on libidn, libidn2, libintl, libpsl and libiconv too + # CURL Macports version depends on libidn, libintl and libiconv too IF(APPLE) FIND_LIBRARY(INTL_LIBRARY intl) IF(INTL_LIBRARY) - LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY}) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY}) ENDIF() - - FIND_LIBRARY(IDN2_LIBRARY idn2) - IF(IDN2_LIBRARY) - LIST(APPEND CURL_LIBRARIES ${IDN2_LIBRARY}) - ENDIF() - - FIND_LIBRARY(PSL_LIBRARY psl) - IF(PSL_LIBRARY) - LIST(APPEND CURL_LIBRARIES ${PSL_LIBRARY}) - ENDIF() - - FIND_LIBRARY(UNISTRING_LIBRARY unistring) - IF(UNISTRING_LIBRARY) - LIST(APPEND CURL_LIBRARIES ${UNISTRING_LIBRARY}) - ENDIF() - - LIST(APPEND CURL_LIBRARIES ${SECURITY_FRAMEWORK}) ENDIF() ENDIF() ENDIF() @@ -274,32 +442,19 @@ IF(WITH_NEL) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include) ADD_SUBDIRECTORY(nel) - - # Aliases for targets - SET(NELMISC_LIBRARIES nelmisc) - SET(NELNET_LIBRARIES nelnet) - SET(NELLIGO_LIBRARIES nelligo) - SET(NELGEORGES_LIBRARIES nelgeorges) - SET(NEL3D_LIBRARIES nel3d) - SET(NELGUI_LIBRARIES nelgui) - SET(NELSOUND_LIBRARIES nelsound) -ELSE() -# FIND_PACKAGE(NeL COMPONENTS 3d misc pacs sound nimp REQUIRED) - FIND_PACKAGE(NeL REQUIRED) - INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIRS}) -ENDIF() +ENDIF(WITH_NEL) IF(WITH_RYZOM) ADD_SUBDIRECTORY(ryzom) -ENDIF() +ENDIF(WITH_RYZOM) IF(WITH_NELNS) ADD_SUBDIRECTORY(nelns) -ENDIF() +ENDIF(WITH_NELNS) IF(WITH_SNOWBALLS) ADD_SUBDIRECTORY(snowballs2) -ENDIF() +ENDIF(WITH_SNOWBALLS) IF(WITH_TOOLS) ADD_SUBDIRECTORY(tool) @@ -307,26 +462,22 @@ ENDIF() IF(WITH_STUDIO) ADD_SUBDIRECTORY(studio) -ENDIF() - -IF(WITH_PERSONAL) - ADD_SUBDIRECTORY(personal) -ENDIF() +ENDIF(WITH_STUDIO) # To build the documention, you will have to enable it # and then do the equivalent of "make DoxygenDoc". IF(BUILD_DOCUMENTATION) IF(DOT) SET(HAVE_DOT YES) - ELSE() + ELSE(DOT) SET(HAVE_DOT NO) - ENDIF() + ENDIF(DOT) # This processes our Doxyfile.in and substitutes paths to generate # a final Doxyfile CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/Doxyfile.cmake.in ${CMAKE_BINARY_DIR}/doc/Doxyfile) ADD_CUSTOM_TARGET(DoxygenDoc ${DOXYGEN} ${CMAKE_BINARY_DIR}/doc/Doxyfile) -ENDIF() +ENDIF(BUILD_DOCUMENTATION) IF(WITH_NEL_TESTS) ENABLE_TESTING() @@ -336,8 +487,8 @@ IF(WITH_NEL_TESTS) SET(SVNCOMMAND svn) SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel) SET(GENERATELOGS svn2cl) - ENDIF() -ENDIF() + ENDIF(BUILD_DASHBOARD) +ENDIF(WITH_NEL_TESTS) # packaging information SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework") @@ -369,10 +520,10 @@ IF(WIN32) #SET(CPACK_GENERATOR "NSIS") SET(CPACK_GENERATOR "NSIS;ZIP") SET(CPACK_SOURCE_GENERATOR "ZIP") -ELSE() +ELSE(WIN32) SET(CPACK_GENERATOR "TGZ") SET(CPACK_SOURCE_GENERATOR "TGZ") -ENDIF() +ENDIF(WIN32) set(CPACK_SOURCE_IGNORE_FILES "~$" "\\\\.cvsignore$" @@ -390,8 +541,8 @@ IF(WIN32) "${QT_LIBRARY_DIR}/../bin/QtXmld4.dll" "${QT_LIBRARY_DIR}/../bin/QtCored4.dll" DESTINATION ${NL_BIN_PREFIX}) - ENDIF() - ELSE() + ENDIF(WITH_QT) + ELSE(NOT CMAKE_BUILD_TYPE STREQUAL "Release") IF(WITH_QT) INCLUDE(${QT_USE_FILE}) INSTALL(FILES @@ -399,8 +550,8 @@ IF(WIN32) "${QT_LIBRARY_DIR}/../bin/QtXml4.dll" "${QT_LIBRARY_DIR}/../bin/QtCore4.dll" DESTINATION ${NL_BIN_PREFIX}) - ENDIF() - ENDIF() + ENDIF(WITH_QT) + ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Release") # Install CEGUI and its dependencies. IF(WITH_NEL_CEGUI) @@ -410,14 +561,14 @@ IF(WIN32) INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIFalagardWRBase.dll" DESTINATION ${NL_BIN_PREFIX}) INSTALL(FILES "${CEGUI_LIB_DIR}/Devil.dll" DESTINATION ${NL_BIN_PREFIX}) INSTALL(FILES "${CEGUI_LIB_DIR}/ILU.dll" DESTINATION ${NL_BIN_PREFIX}) - ENDIF() + ENDIF(WITH_NEL_CEGUI) # Only the tools require MFC. IF(WITH_TOOLS) SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE) - ENDIF() + ENDIF(WITH_TOOLS) #INCLUDE(InstallRequiredSystemLibraries) -ENDIF() +ENDIF(WIN32) INCLUDE(CPack) @@ -427,4 +578,4 @@ INCLUDE(CMakePackaging.txt) #INCLUDE(UseDebian) #IF(DEBIAN_FOUND) # ADD_DEBIAN_TARGETS(nel) -#ENDIF() +#ENDIF(DEBIAN_FOUND) diff --git a/code/CMakeModules/AndroidToolChain.cmake b/code/CMakeModules/AndroidToolChain.cmake index 4ca702295..7135400e2 100644 --- a/code/CMakeModules/AndroidToolChain.cmake +++ b/code/CMakeModules/AndroidToolChain.cmake @@ -28,14 +28,14 @@ IF(TARGET_CPU STREQUAL "armv7") SET(TOOLCHAIN_ARCH "arm") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi") SET(TOOLCHAIN_BIN_PREFIX "arm-linux-androideabi") - SET(MINIMUM_NDK_TARGET 9) + 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-linux-androideabi") - SET(MINIMUM_NDK_TARGET 9) + SET(MINIMUM_NDK_TARGET 4) ELSEIF(TARGET_CPU STREQUAL "arm64") SET(LIBRARY_ARCHITECTURE "arm64-v8a") SET(CMAKE_SYSTEM_PROCESSOR "arm64") @@ -76,9 +76,14 @@ ELSE() ENDIF() SET(CLANG_TOOLCHAIN_PREFIX "llvm") -SET(ANDROID_COMPILER "clang") -SET(ANDROID_COMPILER "clang") -SET(CLANG ON) +SET(ANDROID_COMPILER "GCC") + +IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang") + SET(ANDROID_COMPILER "clang") + SET(CLANG ON) +ELSE() + SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION}) +ENDIF() IF(NOT NDK_TARGET) SET(NDK_TARGET ${MINIMUM_NDK_TARGET}) @@ -89,71 +94,88 @@ ELSE() ENDIF() IF(CMAKE_HOST_WIN32) - SET(TOOLCHAIN_HOST "windows-x86_64") + SET(TOOLCHAIN_HOST "windows") SET(TOOLCHAIN_BIN_SUFFIX ".exe") ELSEIF(CMAKE_HOST_APPLE) SET(TOOLCHAIN_HOST "apple") SET(TOOLCHAIN_BIN_SUFFIX "") ELSEIF(CMAKE_HOST_UNIX) - SET(TOOLCHAIN_HOST "linux-x86_64") + SET(TOOLCHAIN_HOST "linux") SET(TOOLCHAIN_BIN_SUFFIX "") ENDIF() -# clang -SET(CLANG_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${CLANG_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}") +MACRO(SEARCH_TOOLCHAIN _COMPILER) + SET(${_COMPILER}_TOOLCHAIN_VERSIONS) + FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-*") + IF(_TOOLCHAIN_VERSIONS) + LIST(SORT _TOOLCHAIN_VERSIONS) + LIST(REVERSE _TOOLCHAIN_VERSIONS) + FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS}) + STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}") + IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$") + LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION}) + ENDIF() + ENDFOREACH() + ENDIF() -IF(EXISTS ${CLANG_TOOLCHAIN_ROOT}) - MESSAGE(STATUS "Found LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}") -ELSE() - MESSAGE(FATAL_ERROR "No LLVM toolchain found in default search path ${CLANG_TOOLCHAIN_ROOT}") -ENDIF() + # try prefixes without version + SET(_TOOLCHAIN_WITHOUT_VERSION "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}") + IF(EXISTS ${_TOOLCHAIN_WITHOUT_VERSION}) + LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS "default") + ENDIF() -# gcc -SET(GCC_TOOLCHAIN_VERSIONS) -FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-*") -IF(_TOOLCHAIN_VERSIONS) - LIST(SORT _TOOLCHAIN_VERSIONS) - LIST(REVERSE _TOOLCHAIN_VERSIONS) - FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS}) - STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}") - IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$") - LIST(APPEND GCC_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION}) + IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS) + MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains") + ENDIF() + + IF(${_COMPILER}_TOOLCHAIN_VERSIONS) + LIST(FIND ${_COMPILER}_TOOLCHAIN_VERSIONS "${${_COMPILER}_TOOLCHAIN_VERSION}" _INDEX) + IF(_INDEX EQUAL -1) + LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION) ENDIF() - ENDFOREACH() -ENDIF() - -IF(NOT GCC_TOOLCHAIN_VERSIONS) - MESSAGE(FATAL_ERROR "No GCC version found in default search path ${NDK_ROOT}/toolchains") -ENDIF() - -IF(GCC_TOOLCHAIN_VERSIONS) - LIST(FIND GCC_TOOLCHAIN_VERSIONS "${GCC_TOOLCHAIN_VERSION}" _INDEX) - IF(_INDEX EQUAL -1) - LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION) + ELSE() + LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION) ENDIF() -ELSE() - LIST(GET GCC_TOOLCHAIN_VERSIONS 0 GCC_TOOLCHAIN_VERSION) -ENDIF() -SET(GCC_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${GCC_TOOLCHAIN_PREFIX}-${GCC_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}") + MESSAGE(STATUS "TOOLCHAIN_PREFIX = ${${_COMPILER}_TOOLCHAIN_VERSION}") -IF(NOT EXISTS "${GCC_TOOLCHAIN_ROOT}") - FILE(GLOB _TOOLCHAIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}*") - IF(_TOOLCHAIN_PREFIXES) - LIST(GET _TOOLCHAIN_PREFIXES 0 GCC_TOOLCHAIN_ROOT) + IF("${${_COMPILER}_TOOLCHAIN_VERSION}" STREQUAL "default") + MESSAGE(STATUS "default") + SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}") + ELSE() + MESSAGE(STATUS "not default") + SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}") ENDIF() + + IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}") + FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*") + IF(_TOOLCHAIN_PREFIXES) + LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT) + ENDIF() + ENDIF() +ENDMACRO() + +IF(CLANG) + SEARCH_TOOLCHAIN(CLANG) + + MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use clang ${CLANG_TOOLCHAIN_VERSION}") ENDIF() -IF(EXISTS "${GCC_TOOLCHAIN_ROOT}") - MESSAGE(STATUS "Found GCC toolchain in ${GCC_TOOLCHAIN_ROOT}") -ELSE() - MESSAGE(FATAL_ERROR "No GCC toolchain found in default search path ${GCC_TOOLCHAIN_ROOT}") +SEARCH_TOOLCHAIN(GCC) + +MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}") + +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() -# NDK SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}") -MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} found in ${PLATFORM_ROOT}") +MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}") # include dirs SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include") @@ -186,29 +208,41 @@ MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY) SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE) ENDMACRO() -SET(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +# Force the compilers to GCC for Android +include (CMakeForceCompiler) -SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang) -SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++) +IF(CLANG) + MESSAGE(STATUS "Using clang compiler") -SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER}) -SET(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX}) -SET(CMAKE_C_COMPILER_FORCED TRUE) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_C_COMPILER clang) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_CXX_COMPILER clang++) -SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}) -SET(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_BIN_PREFIX}) -SET(CMAKE_CXX_COMPILER_FORCED TRUE) + CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang) + CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang) -SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as) -SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar) -SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar) + SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++) + + IF(NOT EXISTS "${CMAKE_ASM_COMPILER}") + SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as) + ENDIF() + + IF(NOT EXISTS "${CMAKE_AR}") + SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar) + ENDIF() +ELSE() + 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) -IF(NOT EXISTS "${CMAKE_ASM_COMPILER}") SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as) -ENDIF() - -IF(NOT EXISTS "${CMAKE_AR}") SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar) + SET_TOOLCHAIN_BINARY_GCC(CMAKE_LINKER ld) ENDIF() SET_TOOLCHAIN_BINARY_GCC(CMAKE_STRIP strip) diff --git a/code/CMakeModules/CheckDepends.cmake b/code/CMakeModules/CheckDepends.cmake index 701dcd48b..d2fbe06e1 100644 --- a/code/CMakeModules/CheckDepends.cmake +++ b/code/CMakeModules/CheckDepends.cmake @@ -24,8 +24,8 @@ MACRO(CHECK_UNDEFINED_SYMBOL MYLIBRARY SYMBOL SYMBOL_FOUND) IF(NOT NM_SYMBOL MATCHES ${SYMBOL}) SET(${SYMBOL_FOUND} FALSE) # MESSAGE(STATUS "Defined symbol ${SYMBOL} detected in ${${MYLIBRARY}}") - ENDIF() - ENDIF() + ENDIF(NOT NM_SYMBOL MATCHES ${SYMBOL}) + ENDIF(CMAKE_NM) ELSEIF(UNIX) SET(CMAKE_OBJDUMP objdump) IF(CMAKE_OBJDUMP) @@ -35,11 +35,11 @@ MACRO(CHECK_UNDEFINED_SYMBOL MYLIBRARY SYMBOL SYMBOL_FOUND) IF(NOT OBJDUMP_SYMBOL MATCHES "UND") #MESSAGE(STATUS "${${MYLIBRARY}} does not use symbol ${SYMBOL}") SET(${SYMBOL_FOUND} FALSE) - ELSE() + ELSE(NOT OBJDUMP_SYMBOL MATCHES "UND") #MESSAGE(STATUS "${${MYLIBRARY}} uses symbol ${SYMBOL}") - ENDIF() - ENDIF() - ENDIF() + ENDIF(NOT OBJDUMP_SYMBOL MATCHES "UND") + ENDIF(CMAKE_OBJDUMP) + ENDIF(WIN32) ENDMACRO(CHECK_UNDEFINED_SYMBOL) # CHECK_LINKED_LIBRARY @@ -66,8 +66,8 @@ MACRO(CHECK_LINKED_LIBRARY MYLIBRARY OTHERLIBRARY LIBRARY_FOUND) IF(OTOOL_LIBRARY MATCHES "${LIBNAME}") SET(${LIBRARY_FOUND} TRUE) # MESSAGE(STATUS "Library ${LIBNAME} already linked to ${${MYLIBRARY}}") - ENDIF() - ENDIF() + ENDIF(OTOOL_LIBRARY MATCHES "${LIBNAME}") + ENDIF(CMAKE_OTOOL) ELSEIF(UNIX) SET(CMAKE_OBJDUMP objdump) IF(CMAKE_OBJDUMP) @@ -79,11 +79,11 @@ MACRO(CHECK_LINKED_LIBRARY MYLIBRARY OTHERLIBRARY LIBRARY_FOUND) IF(OBJDUMP_LIBRARY MATCHES "NEEDED") #MESSAGE(STATUS "${${MYLIBRARY}} references to ${LIBNAME}.") SET(${LIBRARY_FOUND} TRUE) - ELSE() + ELSE(OBJDUMP_LIBRARY MATCHES "NEEDED") #MESSAGE(STATUS "${${MYLIBRARY}} does not reference to ${LIBNAME}!") - ENDIF() - ENDIF() - ENDIF() + ENDIF(OBJDUMP_LIBRARY MATCHES "NEEDED") + ENDIF(CMAKE_OBJDUMP) + ENDIF(WIN32) ENDMACRO(CHECK_LINKED_LIBRARY) MACRO(CHECK_DEPENDS MYLIBRARY OTHERLIBRARY SYMBOL MUSTLINK) @@ -91,13 +91,13 @@ MACRO(CHECK_DEPENDS MYLIBRARY OTHERLIBRARY SYMBOL MUSTLINK) IF(SYMBOL_FOUND) CHECK_LINKED_LIBRARY(MYLIBRARY OTHERLIBRARY LIBRARY_FOUND) - ENDIF() + ENDIF(SYMBOL_FOUND) IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND) SET(${MUSTLINK} YES) - ELSE() + ELSE(SYMBOL_FOUND AND NOT LIBRARY_FOUND) SET(${MUSTLINK} NO) - ENDIF() + ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND) ENDMACRO(CHECK_DEPENDS) # LINK_DEPENDS @@ -116,23 +116,23 @@ MACRO(LINK_DEPENDS LIBRARIES MYLIBRARY OTHERLIBRARY SYMBOL) IF(WIN32 OR WITH_STATIC) # In static, we link all libraries because it will keep only used symbols SET(MUST_LINK TRUE) - ELSE() + ELSE(WIN32 OR WITH_STATIC) CHECK_UNDEFINED_SYMBOL(${MYLIBRARY} ${SYMBOL} SYMBOL_FOUND) IF(SYMBOL_FOUND) CHECK_LINKED_LIBRARY(${MYLIBRARY} ${OTHERLIBRARY} LIBRARY_FOUND) - ENDIF() + ENDIF(SYMBOL_FOUND) IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND) MESSAGE(STATUS "Underlinking found: ${${MYLIBRARY}} needs ${${OTHERLIBRARY}} but is not linked to, manually linking...") SET(MUST_LINK TRUE) - ENDIF() - ENDIF() - ENDIF() + ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND) + ENDIF(WIN32 OR WITH_STATIC) + ENDIF(${MYLIBRARY} AND ${OTHERLIBRARY} AND NOT ${OTHERLIBRARY}_LINKED) IF(MUST_LINK) MESSAGE(STATUS "Linking with ${${OTHERLIBRARY}}") SET(${LIBRARIES} ${${LIBRARIES}} ${${OTHERLIBRARY}}) SET(${OTHERLIBRARY}_LINKED TRUE) - ENDIF() + ENDIF(MUST_LINK) ENDMACRO(LINK_DEPENDS) diff --git a/code/CMakeModules/ConfigureChecks.cmake b/code/CMakeModules/ConfigureChecks.cmake index cab7a08c1..3929d65c9 100644 --- a/code/CMakeModules/ConfigureChecks.cmake +++ b/code/CMakeModules/ConfigureChecks.cmake @@ -40,15 +40,14 @@ MACRO(NL_CONFIGURE_CHECKS) SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}.${REVISION}") SET(NL_VERSION_RC "${NL_VERSION_MAJOR},${NL_VERSION_MINOR},${NL_VERSION_PATCH},${REVISION}") - SET(RYZOM_VERSION_SHORT "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}") - SET(RYZOM_VERSION "${RYZOM_VERSION_SHORT}.${REVISION}") + SET(RYZOM_VERSION "${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 "khanat_client") + SET(RYZOM_CLIENT_ICON "ryzom_client") ENDIF() CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h) diff --git a/code/CMakeModules/Find3dsMaxSDK.cmake b/code/CMakeModules/Find3dsMaxSDK.cmake index cb00df78e..bde126208 100644 --- a/code/CMakeModules/Find3dsMaxSDK.cmake +++ b/code/CMakeModules/Find3dsMaxSDK.cmake @@ -11,56 +11,17 @@ if(MAXSDK_INCLUDE_DIR) SET(MAXSDK_FIND_QUIETLY TRUE) endif() -set(_pf_x86 "PROGRAMFILES(x86)") - FIND_PATH(MAXSDK_DIR "include/maxversion.h" HINTS "$ENV{MAXSDK_DIR}" PATHS - "$ENV{ADSK_3DSMAX_SDK_2021}/maxsdk" - "$ENV{ADSK_3DSMAX_SDK_2020}/maxsdk" - "$ENV{ADSK_3DSMAX_SDK_2019}/maxsdk" - "$ENV{ADSK_3DSMAX_SDK_2018}/maxsdk" - "$ENV{ADSK_3DSMAX_SDK_2017}/maxsdk" - "$ENV{ADSK_3DSMAX_SDK_2016}/maxsdk" - "$ENV{ADSK_3DSMAX_SDK_2015}/maxsdk" - "$ENV{ADSK_3DSMAX_SDK_2014}/maxsdk" - "$ENV{ADSK_3DSMAX_SDK_2013}/maxsdk" "$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk" "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2021 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2020 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2019 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2018 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2017 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2016 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2015 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2014 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2013 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2012 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2011 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2010 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2009 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 2008 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3ds Max 9 SDK/maxsdk" - "$ENV{${_pf_x86}}/Autodesk/3dsMax8/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2021 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2020 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2019 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2018 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2016 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2015 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2014 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2013 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2012 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2011 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk" - "$ENV{PROGRAMFILES}/Autodesk/3dsMax8/maxsdk" ) FIND_PATH(MAXSDK_INCLUDE_DIR @@ -75,12 +36,12 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h ) IF(TARGET_X64) - SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib ${MAXSDK_DIR}/lib/x64/Release) + SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib) ELSE() SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib) ENDIF() -MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) +MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) FIND_LIBRARY(${MYLIBRARY} NAMES ${MYLIBRARYNAME} HINTS @@ -112,28 +73,10 @@ if(MAXSDK_FOUND) ${MAXSDK_MAXUTIL_LIBRARY} ${MAXSDK_MAXSCRIPT_LIBRARY} ${MAXSDK_PARAMBLK2_LIBRARY} - ${MAXSDK_BMM_LIBRARY}) + ${MAXSDK_BMM_LIBRARY} ) - # parse maxversion.h to determine SDK version - IF(EXISTS "${MAXSDK_DIR}/include/maxversion.h") - FILE(STRINGS "${MAXSDK_DIR}/include/maxversion.h" LINES REGEX "#define MAX_PRODUCT_YEAR_NUMBER ([0-9]+)") - - STRING(REGEX REPLACE ".+MAX_PRODUCT_YEAR_NUMBER ([0-9]+)" "\\1" MAXSDK_VERSION "${LINES}") - UNSET(LINES) - ELSE() - SET(MAXSDK_VERSION "Unknown") - ENDIF() - - MESSAGE(STATUS "Found 3dsmax version ${MAXSDK_VERSION} in ${MAXSDK_DIR}") - - # 3ds Max 2013 and later are always Unicode - IF(MAXSDK_VERSION VERSION_GREATER 2012) - SET(MAXSDK_DEFINITIONS -DUNICODE -D_UNICODE) - ELSE() - SET(MAXSDK_DEFINITIONS) - ENDIF() -ELSE() +else(MAXSDK_FOUND) set(MAXSDK_LIBRARIES) -ENDIF() +endif(MAXSDK_FOUND) mark_as_advanced(MAXSDK_INCLUDE_DIR MAXSDK_LIBRARY) diff --git a/code/CMakeModules/FindCEGUI.cmake b/code/CMakeModules/FindCEGUI.cmake index 3259574fc..a939ebfb7 100644 --- a/code/CMakeModules/FindCEGUI.cmake +++ b/code/CMakeModules/FindCEGUI.cmake @@ -7,7 +7,7 @@ IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS) # in cache already SET(CEGUI_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS) FIND_PATH(CEGUI_INCLUDE_DIRS @@ -45,9 +45,9 @@ IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS) SET(CEGUI_INCLUDE_DIRS "${CEGUI_INCLUDE_DIRS}/CEGUI") IF(NOT CEGUI_FIND_QUIETLY) MESSAGE(STATUS "Found CEGUI: ${CEGUI_LIBRARY}") - ENDIF() -ELSE() + ENDIF(NOT CEGUI_FIND_QUIETLY) +ELSE(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS) IF(NOT CEGUI_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find CEGUI!") - ENDIF() -ENDIF() + ENDIF(NOT CEGUI_FIND_QUIETLY) +ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS) diff --git a/code/CMakeModules/FindCppTest.cmake b/code/CMakeModules/FindCppTest.cmake index 7dc2aa35d..f5f823f69 100644 --- a/code/CMakeModules/FindCppTest.cmake +++ b/code/CMakeModules/FindCppTest.cmake @@ -10,7 +10,7 @@ IF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR) # in cache already SET(CPPTEST_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR) FIND_PATH(CPPTEST_INCLUDE_DIR cpptest.h @@ -30,7 +30,7 @@ SET(LIBRARY_NAME_DEBUG cpptestd) IF(WITH_STLPORT) SET(LIBRARY_NAME_RELEASE cpptest_stlport ${LIBRARY_NAME_RELEASE}) SET(LIBRARY_NAME_DEBUG cpptest_stlportd ${LIBRARY_NAME_DEBUG}) -ENDIF() +ENDIF(WITH_STLPORT) FIND_LIBRARY(CPPTEST_LIBRARY_RELEASE ${LIBRARY_NAME_RELEASE} @@ -67,18 +67,18 @@ IF(CPPTEST_INCLUDE_DIR) SET(CPPTEST_LIBRARIES "optimized;${CPPTEST_LIBRARY_RELEASE}") IF(CPPTEST_LIBRARY_DEBUG) SET(CPPTEST_LIBRARIES "${CPPTEST_LIBRARIES};debug;${CPPTEST_LIBRARY_DEBUG}") - ENDIF() - ENDIF() -ENDIF() + ENDIF(CPPTEST_LIBRARY_DEBUG) + ENDIF(CPPTEST_LIBRARY_RELEASE) +ENDIF(CPPTEST_INCLUDE_DIR) IF(CPPTEST_FOUND) IF(NOT CPPTEST_FIND_QUIETLY) MESSAGE(STATUS "Found CppTest: ${CPPTEST_LIBRARIES}") - ENDIF() -ELSE() + ENDIF(NOT CPPTEST_FIND_QUIETLY) +ELSE(CPPTEST_FOUND) IF(NOT CPPTEST_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find CppTest!") - ENDIF() -ENDIF() + ENDIF(NOT CPPTEST_FIND_QUIETLY) +ENDIF(CPPTEST_FOUND) MARK_AS_ADVANCED(CPPTEST_LIBRARY_RELEASE CPPTEST_LIBRARY_DEBUG) diff --git a/code/CMakeModules/FindCustomMFC.cmake b/code/CMakeModules/FindCustomMFC.cmake index b71e4a8d8..45d5b8cce 100644 --- a/code/CMakeModules/FindCustomMFC.cmake +++ b/code/CMakeModules/FindCustomMFC.cmake @@ -6,20 +6,20 @@ IF(CustomMFC_FIND_REQUIRED) SET(MFC_FIND_REQUIRED TRUE) -ENDIF() +ENDIF(CustomMFC_FIND_REQUIRED) IF(NOT MFC_DIR) # If MFC have been found, remember their directory IF(VC_DIR) SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc") - ENDIF() + ENDIF(VC_DIR) FIND_PATH(MFC_DIR include/afxwin.h HINTS ${MFC_STANDARD_DIR} ) -ENDIF() +ENDIF(NOT MFC_DIR) # Display an error message if MFC are not found, MFC_FOUND is updated # User will be able to update MFC_DIR to the correct directory @@ -33,15 +33,15 @@ IF(MFC_FOUND) # Using 32 or 64 bits libraries IF(TARGET_X64) SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64") - ELSE() + ELSE(TARGET_X64) SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib") - ENDIF() + ENDIF(TARGET_X64) # Add MFC libraries directory to default library path LINK_DIRECTORIES(${MFC_LIBRARY_DIR}) # Set definitions for using MFC in DLL - SET(MFC_DEFINITIONS -D_AFXDLL -DUNICODE -D_UNICODE) + SET(MFC_DEFINITIONS -D_AFXDLL) # Set CMake flag to use MFC DLL SET(CMAKE_MFC_FLAG 2) diff --git a/code/CMakeModules/FindDSound.cmake b/code/CMakeModules/FindDSound.cmake index dde5212ab..beddf7f99 100644 --- a/code/CMakeModules/FindDSound.cmake +++ b/code/CMakeModules/FindDSound.cmake @@ -8,7 +8,7 @@ if(DSOUND_INCLUDE_DIR) # Already in cache, be silent set(DSOUND_FIND_QUIETLY TRUE) -ENDIF() +endif(DSOUND_INCLUDE_DIR) find_path(DSOUND_INCLUDE_DIR dsound.h "$ENV{DXSDK_DIR}" @@ -29,8 +29,8 @@ find_package_handle_standard_args(DSOUND DEFAULT_MSG if(DSOUND_FOUND) set(DSOUND_LIBRARIES ${DSOUND_LIBRARY}) -ELSE() +else(DSOUND_FOUND) set(DSOUND_LIBRARIES) -ENDIF() +endif(DSOUND_FOUND) mark_as_advanced(DSOUND_INCLUDE_DIR DSOUND_LIBRARY) diff --git a/code/CMakeModules/FindDirectXSDK.cmake b/code/CMakeModules/FindDirectXSDK.cmake index 4519ef16d..847a6d596 100644 --- a/code/CMakeModules/FindDirectXSDK.cmake +++ b/code/CMakeModules/FindDirectXSDK.cmake @@ -8,7 +8,7 @@ IF(DXSDK_DIR) # Already in cache, be silent SET(DXSDK_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(DXSDK_DIR) FIND_PATH(DXSDK_DIR "Include/dxsdkver.h" diff --git a/code/CMakeModules/FindEFXUtil.cmake b/code/CMakeModules/FindEFXUtil.cmake index 628a0eba5..5e2f410b0 100644 --- a/code/CMakeModules/FindEFXUtil.cmake +++ b/code/CMakeModules/FindEFXUtil.cmake @@ -7,7 +7,7 @@ IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) # in cache already SET(EFXUTIL_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) FIND_PATH(EFXUTIL_INCLUDE_DIR @@ -42,9 +42,9 @@ IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) SET(EFXUTIL_FOUND "YES") IF(NOT EFXUTIL_FIND_QUIETLY) MESSAGE(STATUS "Found EFX-Util: ${EFXUTIL_LIBRARY}") - ENDIF() -ELSE() + ENDIF(NOT EFXUTIL_FIND_QUIETLY) +ELSE(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) IF(NOT EFXUTIL_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find EFX-Util!") - ENDIF() -ENDIF() + ENDIF(NOT EFXUTIL_FIND_QUIETLY) +ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) diff --git a/code/CMakeModules/FindExternal.cmake b/code/CMakeModules/FindExternal.cmake index 8364026cd..80b3eda0c 100644 --- a/code/CMakeModules/FindExternal.cmake +++ b/code/CMakeModules/FindExternal.cmake @@ -16,7 +16,7 @@ IF(WITH_STLPORT) SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external_stlport ${CMAKE_CURRENT_SOURCE_DIR}/../external_stlport ${EXTERNAL_TEMP_PATH}) SET(EXTERNAL_TEMP_FILE "include/stlport/string") SET(EXTERNAL_NAME "external with STLport") -ENDIF() +ENDIF(WITH_STLPORT) FIND_PATH(EXTERNAL_PATH ${EXTERNAL_TEMP_FILE} diff --git a/code/CMakeModules/FindFFmpeg.cmake b/code/CMakeModules/FindFFmpeg.cmake deleted file mode 100644 index 96cbb6ed0..000000000 --- a/code/CMakeModules/FindFFmpeg.cmake +++ /dev/null @@ -1,173 +0,0 @@ -# vim: ts=2 sw=2 -# - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC) -# -# Once done this will define -# FFMPEG_FOUND - System has the all required components. -# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers. -# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components. -# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components. -# -# For each of the components it will additionaly set. -# - AVCODEC -# - AVDEVICE -# - AVFORMAT -# - AVUTIL -# - POSTPROC -# - SWSCALE -# - SWRESAMPLE -# the following variables will be defined -# _FOUND - System has -# _INCLUDE_DIRS - Include directory necessary for using the headers -# _LIBRARIES - Link these to use -# _DEFINITIONS - Compiler switches required for using -# _VERSION - The components version -# -# Copyright (c) 2006, Matthias Kretz, -# Copyright (c) 2008, Alexander Neundorf, -# Copyright (c) 2011, Michael Jansen, -# -# Redistribution and use is allowed according to the terms of the BSD license. - -include(FindPackageHandleStandardArgs) - -if(NOT FFmpeg_FIND_COMPONENTS) - set(FFmpeg_FIND_COMPONENTS AVFORMAT AVCODEC AVUTIL) -endif() - -# -### Macro: set_component_found -# -# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present. -# -macro(set_component_found _component) - if(${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS) - # message(STATUS " - ${_component} found.") - set(${_component}_FOUND TRUE) - else() - # message(STATUS " - ${_component} not found.") - endif() -endmacro() - -# -### Macro: find_component -# -# Checks for the given component by invoking pkgconfig and then looking up the libraries and -# include directories. -# -macro(find_component _component _pkgconfig _library _header) - if(NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - find_package(PkgConfig) - if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_${_component} ${_pkgconfig}) - endif() - endif() - - find_path(${_component}_INCLUDE_DIRS ${_header} - HINTS - ${FFMPEGSDK_INC} - ${PC_LIB${_component}_INCLUDEDIR} - ${PC_LIB${_component}_INCLUDE_DIRS} - PATH_SUFFIXES - ffmpeg - ) - - find_library(${_component}_LIBRARIES NAMES ${_library} - HINTS - ${FFMPEGSDK_LIB} - ${PC_LIB${_component}_LIBDIR} - ${PC_LIB${_component}_LIBRARY_DIRS} - ) - - STRING(REGEX REPLACE "/.*" "/version.h" _ver_header ${_header}) - if(EXISTS "${${_component}_INCLUDE_DIRS}/${_ver_header}") - file(STRINGS "${${_component}_INCLUDE_DIRS}/${_ver_header}" version_str REGEX "^#define[\t ]+LIB${_component}_VERSION_M.*") - - foreach(_str "${version_str}") - if(NOT version_maj) - string(REGEX REPLACE "^.*LIB${_component}_VERSION_MAJOR[\t ]+([0-9]*).*$" "\\1" version_maj "${_str}") - endif() - if(NOT version_min) - string(REGEX REPLACE "^.*LIB${_component}_VERSION_MINOR[\t ]+([0-9]*).*$" "\\1" version_min "${_str}") - endif() - if(NOT version_mic) - string(REGEX REPLACE "^.*LIB${_component}_VERSION_MICRO[\t ]+([0-9]*).*$" "\\1" version_mic "${_str}") - endif() - endforeach() - unset(version_str) - - set(${_component}_VERSION "${version_maj}.${version_min}.${version_mic}" CACHE STRING "The ${_component} version number.") - unset(version_maj) - unset(version_min) - unset(version_mic) - endif(EXISTS "${${_component}_INCLUDE_DIRS}/${_ver_header}") - set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.") - set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.") - - set_component_found(${_component}) - - mark_as_advanced( - ${_component}_INCLUDE_DIRS - ${_component}_LIBRARIES - ${_component}_DEFINITIONS - ${_component}_VERSION) -endmacro() - - -set(FFMPEGSDK $ENV{FFMPEG_HOME}) -if(FFMPEGSDK) - set(FFMPEGSDK_INC "${FFMPEGSDK}/include") - set(FFMPEGSDK_LIB "${FFMPEGSDK}/lib") -endif() - -# Check for all possible components. -find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h) -find_component(AVFORMAT libavformat avformat libavformat/avformat.h) -find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) -find_component(AVUTIL libavutil avutil libavutil/avutil.h) -find_component(SWSCALE libswscale swscale libswscale/swscale.h) -find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) -find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) - -# Check if the required components were found and add their stuff to the FFMPEG_* vars. -foreach(_component ${FFmpeg_FIND_COMPONENTS}) - if(${_component}_FOUND) - # message(STATUS "Required component ${_component} present.") - set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES}) - set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS}) - list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS}) - else() - # message(STATUS "Required component ${_component} missing.") - endif() -endforeach() - -# Build the include path and library list with duplicates removed. -if(FFMPEG_INCLUDE_DIRS) - list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) -endif() - -if(FFMPEG_LIBRARIES) - list(REMOVE_DUPLICATES FFMPEG_LIBRARIES) -endif() - -# cache the vars. -set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE) -set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE) -set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE) - -mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS) - -# Now set the noncached _FOUND vars for the components. -foreach(_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWRESAMPLE SWSCALE) - set_component_found(${_component}) -endforeach () - -# Compile the list of required vars -set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) -foreach(_component ${FFmpeg_FIND_COMPONENTS}) - list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS) -endforeach() - -# Give a nice error message if some of the required vars are missing. -find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS}) diff --git a/code/CMakeModules/FindFMOD.cmake b/code/CMakeModules/FindFMOD.cmake index b28f77b1e..f85795142 100644 --- a/code/CMakeModules/FindFMOD.cmake +++ b/code/CMakeModules/FindFMOD.cmake @@ -7,7 +7,7 @@ IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR) # in cache already SET(FMOD_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR) FIND_PATH(FMOD_INCLUDE_DIR @@ -25,9 +25,9 @@ FIND_PATH(FMOD_INCLUDE_DIR IF(TARGET_X64) SET(FMOD_LIBRARY_NAMES fmod64 fmod) -ELSE() +ELSE(TARGET_X64) SET(FMOD_LIBRARY_NAMES fmodvc fmod) -ENDIF() +ENDIF(TARGET_X64) FIND_LIBRARY(FMOD_LIBRARY NAMES @@ -49,9 +49,9 @@ IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR) SET(FMOD_FOUND "YES") IF(NOT FMOD_FIND_QUIETLY) MESSAGE(STATUS "Found FMOD: ${FMOD_LIBRARY}") - ENDIF() -ELSE() + ENDIF(NOT FMOD_FIND_QUIETLY) +ELSE(FMOD_LIBRARY AND FMOD_INCLUDE_DIR) IF(NOT FMOD_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find FMOD!") - ENDIF() -ENDIF() + ENDIF(NOT FMOD_FIND_QUIETLY) +ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR) diff --git a/code/CMakeModules/FindFreeType.cmake b/code/CMakeModules/FindFreeType.cmake index d101607b4..f6b827899 100644 --- a/code/CMakeModules/FindFreeType.cmake +++ b/code/CMakeModules/FindFreeType.cmake @@ -7,7 +7,7 @@ IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS) # in cache already SET(Freetype_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS) FIND_PATH(FREETYPE_INCLUDE_DIRS freetype @@ -24,7 +24,7 @@ FIND_PATH(FREETYPE_INCLUDE_DIRS IF(NOT FREETYPE_INCLUDE_DIRS) SET(FREETYPE_INCLUDE_DIRS "") -ENDIF() +ENDIF(NOT FREETYPE_INCLUDE_DIRS) # ft2build.h does not reside in the freetype include dir FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR @@ -42,7 +42,7 @@ FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR # combine both include directories into one variable IF(FREETYPE_ADDITIONAL_INCLUDE_DIR) SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR}) -ENDIF() +ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR) FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE NAMES freetype libfreetype freetype219 freetype246 @@ -89,8 +89,8 @@ IF(FREETYPE_INCLUDE_DIRS) # Case where Freetype is compiled from sources (debug version is compiled by default) SET(FREETYPE_FOUND ON) SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG}) - ENDIF() -ENDIF() + ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG) +ENDIF(FREETYPE_INCLUDE_DIRS) IF(FREETYPE_FOUND) IF(WITH_STATIC_EXTERNAL AND APPLE) @@ -98,13 +98,13 @@ IF(FREETYPE_FOUND) IF(BZIP2_FOUND) SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR}) SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES}) - ENDIF() - ENDIF() + ENDIF(BZIP2_FOUND) + ENDIF(WITH_STATIC_EXTERNAL AND APPLE) IF(NOT Freetype_FIND_QUIETLY) MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}") - ENDIF() -ELSE() + ENDIF(NOT Freetype_FIND_QUIETLY) +ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) IF(NOT Freetype_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find FreeType!") - ENDIF() -ENDIF() + ENDIF(NOT Freetype_FIND_QUIETLY) +ENDIF(FREETYPE_FOUND) diff --git a/code/CMakeModules/FindGLIB2.cmake b/code/CMakeModules/FindGLIB2.cmake deleted file mode 100644 index 942b04530..000000000 --- a/code/CMakeModules/FindGLIB2.cmake +++ /dev/null @@ -1,217 +0,0 @@ -# - Try to find GLib2 -# Once done this will define -# -# GLIB2_FOUND - system has GLib2 -# GLIB2_INCLUDE_DIRS - the GLib2 include directory -# GLIB2_LIBRARIES - Link these to use GLib2 -# -# HAVE_GLIB_GREGEX_H glib has gregex.h header and -# supports g_regex_match_simple -# -# Copyright (c) 2006 Andreas Schneider -# Copyright (c) 2006 Philippe Bernery -# Copyright (c) 2007 Daniel Gollub -# Copyright (c) 2007 Alban Browaeys -# Copyright (c) 2008 Michael Bell -# Copyright (c) 2008 Bjoern Ricks -# -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - - -IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) - # in cache already - SET(GLIB2_FOUND TRUE) -ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) - - INCLUDE(FindPkgConfig) - - ## Glib - IF ( GLIB2_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "REQUIRED" ) - ELSE ( GLIB2_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "" ) - ENDIF ( GLIB2_FIND_REQUIRED ) - - IF ( GLIB2_MIN_VERSION ) - PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} ) - ELSE ( GLIB2_MIN_VERSION ) - PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 ) - ENDIF ( GLIB2_MIN_VERSION ) - IF ( PKG_CONFIG_FOUND ) - IF ( GLIB2_FOUND ) - SET ( GLIB2_CORE_FOUND TRUE ) - ELSE ( GLIB2_FOUND ) - SET ( GLIB2_CORE_FOUND FALSE ) - ENDIF ( GLIB2_FOUND ) - ENDIF ( PKG_CONFIG_FOUND ) - - # Look for glib2 include dir and libraries w/o pkgconfig - IF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) - FIND_PATH( - _glibconfig_include_DIR - NAMES - glibconfig.h - PATHS - /opt/gnome/lib64 - /opt/gnome/lib - /opt/lib/ - /opt/local/lib - /sw/lib/ - /usr/lib64 - /usr/lib - /usr/local/include - ${CMAKE_LIBRARY_PATH} - PATH_SUFFIXES - glib-2.0/include - ) - - FIND_PATH( - _glib2_include_DIR - NAMES - glib.h - PATHS - /opt/gnome/include - /opt/local/include - /sw/include - /usr/include - /usr/local/include - PATH_SUFFIXES - glib-2.0 - ) - - #MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}") - - FIND_LIBRARY( - _glib2_link_DIR - NAMES - glib-2.0 - glib - PATHS - /opt/gnome/lib - /opt/local/lib - /sw/lib - /usr/lib - /usr/local/lib - ) - IF ( _glib2_include_DIR AND _glib2_link_DIR ) - SET ( _glib2_FOUND TRUE ) - ENDIF ( _glib2_include_DIR AND _glib2_link_DIR ) - - - IF ( _glib2_FOUND ) - SET ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} ) - SET ( GLIB2_LIBRARIES ${_glib2_link_DIR} ) - SET ( GLIB2_CORE_FOUND TRUE ) - ELSE ( _glib2_FOUND ) - SET ( GLIB2_CORE_FOUND FALSE ) - ENDIF ( _glib2_FOUND ) - - # Handle dependencies - # libintl - IF ( NOT LIBINTL_FOUND ) - FIND_PATH(LIBINTL_INCLUDE_DIR - NAMES - libintl.h - PATHS - /opt/gnome/include - /opt/local/include - /sw/include - /usr/include - /usr/local/include - ) - - FIND_LIBRARY(LIBINTL_LIBRARY - NAMES - intl - PATHS - /opt/gnome/lib - /opt/local/lib - /sw/lib - /usr/local/lib - /usr/lib - ) - - IF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) - SET (LIBINTL_FOUND TRUE) - ENDIF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) - ENDIF ( NOT LIBINTL_FOUND ) - - # libiconv - IF ( NOT LIBICONV_FOUND ) - FIND_PATH(LIBICONV_INCLUDE_DIR - NAMES - iconv.h - PATHS - /opt/gnome/include - /opt/local/include - /opt/local/include - /sw/include - /sw/include - /usr/local/include - /usr/include - PATH_SUFFIXES - glib-2.0 - ) - - FIND_LIBRARY(LIBICONV_LIBRARY - NAMES - iconv - PATHS - /opt/gnome/lib - /opt/local/lib - /sw/lib - /usr/lib - /usr/local/lib - ) - - IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) - SET (LIBICONV_FOUND TRUE) - ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) - ENDIF ( NOT LIBICONV_FOUND ) - - IF (LIBINTL_FOUND) - SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY}) - SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR}) - ENDIF (LIBINTL_FOUND) - - IF (LIBICONV_FOUND) - SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY}) - SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR}) - ENDIF (LIBICONV_FOUND) - - ENDIF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) - ## - - IF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) - SET (GLIB2_FOUND TRUE) - ENDIF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) - - IF (GLIB2_FOUND) - IF (NOT GLIB2_FIND_QUIETLY) - MESSAGE (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}") - ENDIF (NOT GLIB2_FIND_QUIETLY) - ELSE (GLIB2_FOUND) - IF (GLIB2_FIND_REQUIRED) - MESSAGE (SEND_ERROR "Could not find GLib2") - ENDIF (GLIB2_FIND_REQUIRED) - ENDIF (GLIB2_FOUND) - - # show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view - MARK_AS_ADVANCED(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES) - MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY) - MARK_AS_ADVANCED(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY) - -ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS) - -IF ( GLIB2_FOUND ) - # Check if system has a newer version of glib - # which supports g_regex_match_simple - INCLUDE( CheckIncludeFiles ) - SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} ) - CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H ) - # Reset CMAKE_REQUIRED_INCLUDES - SET( CMAKE_REQUIRED_INCLUDES "" ) -ENDIF( GLIB2_FOUND ) diff --git a/code/CMakeModules/FindGOBJECT2.cmake b/code/CMakeModules/FindGOBJECT2.cmake deleted file mode 100644 index d0d4cda0d..000000000 --- a/code/CMakeModules/FindGOBJECT2.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# - Try to find GObject2 -# Find GObject2 headers, libraries and the answer to all questions. -# -# GOBJECT2_FOUND True if GOBJECT2 got found -# GOBJECT2_INCLUDE_DIRS Location of GOBJECT2 headers -# GOBJECT2_LIBRARIES List of libraries to use GOBJECT2 -# -# Copyright (c) 2008 Bjoern Ricks -# -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -INCLUDE( FindPkgConfig ) - -IF ( GOBJECT2_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "REQUIRED" ) -ELSE( GOBJECT2_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "" ) -ENDIF ( GOBJECT2_FIND_REQUIRED ) - -IF ( GOBJECT2_MIN_VERSION ) - PKG_SEARCH_MODULE( GOBJECT2 ${_pkgconfig_REQUIRED} gobject-2.0>=${GOBJECT2_MIN_VERSION} ) -ELSE ( GOBJECT2_MIN_VERSION ) - PKG_SEARCH_MODULE( GOBJECT2 ${_pkgconfig_REQUIRED} gobject-2.0 ) -ENDIF ( GOBJECT2_MIN_VERSION ) - - -IF( NOT GOBJECT2_FOUND AND NOT PKG_CONFIG_FOUND ) - FIND_PATH( GOBJECT2_INCLUDE_DIRS gobject/gobject.h PATH_SUFFIXES glib-2.0) - FIND_LIBRARY( GOBJECT2_LIBRARIES gobject-2.0 ) - - # Report results - IF ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS ) - SET( GOBJECT2_FOUND 1 ) - IF ( NOT GOBJECT2_FIND_QUIETLY ) - MESSAGE( STATUS "Found GOBJECT2: ${GOBJECT2_LIBRARIES}" ) - ENDIF ( NOT GOBJECT2_FIND_QUIETLY ) - ELSE ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS ) - IF ( GOBJECT2_FIND_REQUIRED ) - MESSAGE( SEND_ERROR "Could NOT find GOBJECT2" ) - ELSE ( GOBJECT2_FIND_REQUIRED ) - IF ( NOT GOBJECT2_FIND_QUIETLY ) - MESSAGE( STATUS "Could NOT find GOBJECT2" ) - ENDIF ( NOT GOBJECT2_FIND_QUIETLY ) - ENDIF ( GOBJECT2_FIND_REQUIRED ) - ENDIF ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS ) -ENDIF( NOT GOBJECT2_FOUND AND NOT PKG_CONFIG_FOUND ) - -MARK_AS_ADVANCED( GOBJECT2_LIBRARIES GOBJECT2_INCLUDE_DIRS ) diff --git a/code/CMakeModules/FindGit.cmake b/code/CMakeModules/FindGit.cmake deleted file mode 100644 index 883357d79..000000000 --- a/code/CMakeModules/FindGit.cmake +++ /dev/null @@ -1,106 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindGit -# ------- -# -# The module defines the following variables: -# -# ``GIT_EXECUTABLE`` -# Path to Git command-line client. -# ``Git_FOUND``, ``GIT_FOUND`` -# True if the Git command-line client was found. -# ``GIT_VERSION_STRING`` -# The version of Git found. -# -# Example usage: -# -# .. code-block:: cmake -# -# find_package(Git) -# if(Git_FOUND) -# message("Git found: ${GIT_EXECUTABLE}") -# endif() - -# Look for 'git' or 'eg' (easy git) -# -set(git_names git eg) - -# Prefer .cmd variants on Windows unless running in a Makefile -# in the MSYS shell. -# -if(CMAKE_HOST_WIN32) - if(NOT CMAKE_GENERATOR MATCHES "MSYS") - set(git_names git.cmd git eg.cmd eg) - # GitHub search path for Windows - file(GLOB github_path - "$ENV{LOCALAPPDATA}/Github/PortableGit*/cmd" - "$ENV{LOCALAPPDATA}/Github/PortableGit*/bin" - ) - # SourceTree search path for Windows - set(_git_sourcetree_path "$ENV{LOCALAPPDATA}/Atlassian/SourceTree/git_local/bin") - endif() -endif() - -# First search the PATH and specific locations. -find_program(GIT_EXECUTABLE - NAMES ${git_names} - PATHS ${github_path} ${_git_sourcetree_path} - DOC "Git command line client" - ) - -if(CMAKE_HOST_WIN32) - # Now look for installations in Git/ directories under typical installation - # prefixes on Windows. Exclude PATH from this search because VS 2017's - # command prompt happens to have a PATH entry with a Git/ subdirectory - # containing a minimal git not meant for general use. - find_program(GIT_EXECUTABLE - NAMES ${git_names} - PATH_SUFFIXES Git/cmd Git/bin - NO_SYSTEM_ENVIRONMENT_PATH - DOC "Git command line client" - ) -endif() - -mark_as_advanced(GIT_EXECUTABLE) - -MACRO(Git_WC_INFO dir prefix) - EXECUTE_PROCESS(COMMAND ${Git_EXECUTABLE} log -r --pretty=format:"%d;%H;%an" . - WORKING_DIRECTORY ${dir} - OUTPUT_VARIABLE ${prefix}_WC_INFO - ERROR_VARIABLE Git_info_error - RESULT_VARIABLE Git_info_result - OUTPUT_STRIP_TRAILING_WHITESPACE) - - IF(NOT ${Git_info_result} EQUAL 0) - MESSAGE(SEND_ERROR "Command \"${GIT_EXECUTABLE} log\" failed with output:\n${Git_info_error}") - ELSE() - LIST(LENGTH ${prefix}_WC_INFO _COUNT) - IF(_COUNT EQUAL 4) - LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION) - LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET) - LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR) - ELSE() - MESSAGE(STATUS "Bad output from HG") - SET(${prefix}_WC_REVISION "unknown") - SET(${prefix}_WC_CHANGESET "unknown") - SET(${prefix}_WC_BRANCH "unknown") - ENDIF() - ENDIF() - - ENDMACRO() - -unset(git_names) -unset(_git_sourcetree_path) - -if(GIT_EXECUTABLE) - execute_process(COMMAND ${GIT_EXECUTABLE} --version - OUTPUT_VARIABLE git_version - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if (git_version MATCHES "^git version [0-9]") - string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}") - endif() - unset(git_version) -endif() diff --git a/code/CMakeModules/FindHelpers.cmake b/code/CMakeModules/FindHelpers.cmake deleted file mode 100644 index bc38354f4..000000000 --- a/code/CMakeModules/FindHelpers.cmake +++ /dev/null @@ -1,959 +0,0 @@ -MACRO(CONVERT_NUMBER_VERSION _VERSION_NUMBER _BASE _OUT) - SET(${_OUT}) - SET(_NUMBER ${_VERSION_NUMBER}) - WHILE(_NUMBER GREATER 0) - MATH(EXPR _TEMP "${_NUMBER} % ${_BASE}") - LIST(APPEND ${_OUT} ${_TEMP}) - MATH(EXPR _NUMBER "${_NUMBER} / ${_BASE}") - ENDWHILE() -ENDMACRO(CONVERT_NUMBER_VERSION) - -FUNCTION(JOIN VALUES GLUE OUTPUT) - STRING(REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}") - STRING(REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping - SET(${OUTPUT} "${_TMP_STR}" PARENT_SCOPE) -ENDFUNCTION() - -MACRO(PARSE_VERSION_OTHER FILENAME) - IF(EXISTS ${FILENAME}) - SET(_FILTER_ARRAY ${ARGN}) - JOIN("${_FILTER_ARRAY}" "|" _FILTER_REGEX) - FILE(STRINGS ${FILENAME} _FILE REGEX "(${_FILTER_REGEX})[: \t=\(\)\"]+([0-9.]+)") - - IF(_FILE) - FOREACH(_LINE ${_FILE}) - FOREACH(_VAR ${_FILTER_ARRAY}) - IF("${${_VAR}}" STREQUAL "") - STRING(REGEX REPLACE "^.*${_VAR}[: \t=\(\)\"]+([0-9.]+).*$" "\\1" ${_VAR} "${_LINE}") - IF(${_VAR} STREQUAL "${_LINE}") - SET(${_VAR}) - ENDIF() - IF(NOT ${_VAR} AND NOT STREQUAL "0") - SET(${_VAR} 0) - ENDIF() - ENDIF() - ENDFOREACH() - ENDFOREACH() - ENDIF() - ENDIF() -ENDMACRO() - -# macro to define FIND_PACKAGE options with a different package name -MACRO(FIX_PACKAGE_OPTIONS OLDNAME NEWNAME) - # append other options if needed - SET(_OPTIONS COMPONENTS REQUIRED QUIETLY) - - # process each options - FOREACH(_OPTION ${_OPTIONS}) - SET(OLD_OPTION ${OLDNAME}_FIND_${_OPTION}) - IF(DEFINED ) - SET(NEW_OPTION ${NEWNAME}_FIND_${_OPTION}) - SET(${NEW_OPTION} ${OLD_OPTION}) - ENDIF() - ENDFOREACH() -ENDMACRO() - -MACRO(FIND_PACKAGE_HELPER NAME INCLUDE) - # Looks for a directory containing NAME. - # - # NAME is the name of the library, lowercase and uppercase can be mixed - # It should be EXACTLY (same case) the same part as XXXX in FindXXXX.cmake - # - # INCLUDE is the file to check for includes - # - # Following parameters are optional variables and must be prefixed by: - # - # RELEASE is the list of libraries to check in release mode - # DEBUG is the list of libraries to check in debug mode - # SUFFIXES is the PATH_SUFFIXES to check for include file - # QUIET don't display anything - # VERBOSE display more details if not found - # REQUIRED throw an error if not found - # DIR is the base directory where to look for - # - # The first match will be used in the specified order and next matches will be ignored - # - # The following values are defined - # NAME_INCLUDE_DIR - where to find NAME - # NAME_LIBRARIES - link against these to use NAME - # NAME_FOUND - True if NAME is available. - - SET(_PARAMS ${ARGN}) - - SET(_RELEASE_LIBRARIES) - SET(_DEBUG_LIBRARIES) - SET(_SUFFIXES) - SET(_BASE_DIRECTORIES) - - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_SUFFIXES OFF) - SET(_IS_VERBOSE OFF) - SET(_IS_DIR OFF) - - IF(_PARAMS) - FOREACH(_PARAM ${_PARAMS}) - IF(_PARAM STREQUAL "RELEASE") - SET(_IS_RELEASE ON) - SET(_IS_DEBUG OFF) - SET(_IS_SUFFIXES OFF) - SET(_IS_DIR OFF) - ELSEIF(_PARAM STREQUAL "DEBUG") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG ON) - SET(_IS_SUFFIXES OFF) - SET(_IS_DIR OFF) - ELSEIF(_PARAM STREQUAL "SUFFIXES") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_DIR OFF) - SET(_IS_SUFFIXES ON) - ELSEIF(_PARAM STREQUAL "QUIET") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_SUFFIXES OFF) - SET(_IS_DIR OFF) - SET(${NAME}_FIND_QUIETLY ON) - ELSEIF(_PARAM STREQUAL "VERBOSE") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_SUFFIXES OFF) - SET(_IS_DIR OFF) - SET(_IS_VERBOSE ON) - ELSEIF(_PARAM STREQUAL "REQUIRED") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_SUFFIXES OFF) - SET(_IS_DIR OFF) - SET(${NAME}_FIND_REQUIRED ON) - ELSEIF(_PARAM STREQUAL "DIR") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_SUFFIXES OFF) - SET(_IS_DIR ON) - ELSE() - IF(_IS_RELEASE) - LIST(APPEND _RELEASE_LIBRARIES ${_PARAM}) - ELSEIF(_IS_DEBUG) - LIST(APPEND _DEBUG_LIBRARIES ${_PARAM}) - ELSEIF(_IS_SUFFIXES) - LIST(APPEND _SUFFIXES ${_PARAM}) - ELSEIF(_IS_DIR) - LIST(APPEND _BASE_DIRECTORIES ${_PARAM}) - ELSE() - MESSAGE(STATUS "parameter ${_PARAM} with no prefix") - ENDIF() - ENDIF() - ENDFOREACH() - ENDIF() - - # Fixes names if invalid characters are found - IF("${NAME}" MATCHES "^[a-zA-Z0-9]+$") - SET(_NAME_FIXED ${NAME}) - ELSE() - # if invalid characters are detected, replace them by valid ones - STRING(REPLACE "+" "p" _NAME_FIXED ${NAME}) - ENDIF() - - # Create uppercase and lowercase versions of NAME - STRING(TOUPPER ${NAME} _UPNAME) - STRING(TOLOWER ${NAME} _LOWNAME) - - STRING(TOUPPER ${_NAME_FIXED} _UPNAME_FIXED) - STRING(TOLOWER ${_NAME_FIXED} _LOWNAME_FIXED) - - SET(_SUFFIXES ${_SUFFIXES} ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME}) - -# Don't use pkg-config -# IF(NOT WIN32 AND NOT IOS) -# FIND_PACKAGE(PkgConfig QUIET) -# SET(_MODULES ${_LOWNAME} ${_RELEASE_LIBRARIES}) -# LIST(REMOVE_DUPLICATES _MODULES) -# IF(PKG_CONFIG_EXECUTABLE) -# PKG_SEARCH_MODULE(PKG_${_NAME_FIXED} QUIET ${_MODULES}) -# ENDIF() -# ENDIF() - - SET(_INCLUDE_PATHS) - SET(_LIBRARY_PATHS) - - # Check for root directories passed to CMake with -DXXX_DIR=... - IF(DEFINED ${_UPNAME_FIXED}_DIR) - SET(_TMP ${${_UPNAME_FIXED}_DIR}) - GET_FILENAME_COMPONENT(_TMP ${_TMP} ABSOLUTE) - LIST(APPEND _INCLUDE_PATHS ${_TMP}/include ${_TMP}) - LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX}) - - IF(_IS_VERBOSE) - MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}") - ENDIF() - ENDIF() - - IF(DEFINED ${_UPNAME}_DIR) - SET(_TMP ${${_UPNAME}_DIR}) - LIST(APPEND _INCLUDE_PATHS ${_TMP}/include ${_TMP}) - LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX}) - - IF(_IS_VERBOSE) - MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}") - ENDIF() - ENDIF() - - IF(_BASE_DIRECTORIES) - FOREACH(_DIR ${_BASE_DIRECTORIES}) - IF(_DIR) - LIST(APPEND _INCLUDE_PATHS ${_DIR}/include ${_DIR}) - LIST(APPEND _LIBRARY_PATHS ${_DIR}/lib${LIB_SUFFIX}) - - IF(_IS_VERBOSE) - MESSAGE(STATUS "Using ${_DIR} as root directory") - ENDIF() - ENDIF() - ENDFOREACH() - ENDIF() - - IF(UNIX) - # Append UNIX standard include paths - SET(_UNIX_INCLUDE_PATHS) - - # Append multiarch include paths - IF(CMAKE_LIBRARY_ARCHITECTURE) - LIST(APPEND _UNIX_INCLUDE_PATHS - /usr/local/include/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/include/${CMAKE_LIBRARY_ARCHITECTURE}) - ENDIF() - - LIST(APPEND _UNIX_INCLUDE_PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include) - ENDIF() - - IF(_IS_VERBOSE) - MESSAGE(STATUS "Searching header ${INCLUDE} in: ${_INCLUDE_PATHS} with suffixes ${_SUFFIXES}") - ENDIF() - - # Search for include directory - FIND_PATH(${_UPNAME_FIXED}_INCLUDE_DIR - NAMES ${INCLUDE} - HINTS - ${PKG_${_NAME_FIXED}_INCLUDE_DIRS} - ${_INCLUDE_PATHS} - $ENV{${_UPNAME}_DIR}/include - $ENV{${_UPNAME_FIXED}_DIR}/include - $ENV{${_UPNAME}_DIR} - $ENV{${_UPNAME_FIXED}_DIR} - PATHS - ${_UNIX_INCLUDE_PATHS} - PATH_SUFFIXES - ${_SUFFIXES} - DOC "Include path for ${NAME}" - ) - - IF(_IS_VERBOSE) - IF(${_UPNAME_FIXED}_INCLUDE_DIR) - MESSAGE(STATUS "${INCLUDE} found in ${${_UPNAME_FIXED}_INCLUDE_DIR}") - ELSE() - MESSAGE(STATUS "${INCLUDE} not found") - ENDIF() - ENDIF() - - # Append environment variables XXX_DIR - LIST(APPEND _LIBRARY_PATHS - $ENV{${_UPNAME}_DIR}/lib${LIB_SUFFIX} - $ENV{${_UPNAME_FIXED}_DIR}/lib${LIB_SUFFIX}) - - IF(UNIX) - SET(_UNIX_LIBRARY_PATHS) - - # Append multiarch libraries paths - IF(CMAKE_LIBRARY_ARCHITECTURE) - LIST(APPEND _UNIX_LIBRARY_PATHS - /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} - /lib/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}) - ENDIF() - - # Append UNIX standard libraries paths - LIST(APPEND _UNIX_LIBRARY_PATHS - /usr/local/lib - /usr/lib - /lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib${LIB_SUFFIX}) - ENDIF() - - LIST(APPEND _RELEASE_LIBRARIES ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME} ${_NAME_FIXED}) - LIST(APPEND _DEBUG_LIBRARIES ${_LOWNAME}d ${_LOWNAME_FIXED}d ${NAME}d ${_NAME_FIXED}d) - - # Under Windows, some libs may need the lib prefix - IF(WIN32) - SET(_LIBS ${_RELEASE_LIBRARIES}) - FOREACH(_LIB ${_LIBS}) - LIST(APPEND _RELEASE_LIBRARIES lib${_LIB}) - ENDFOREACH() - - SET(_LIBS ${_DEBUG_LIBRARIES}) - FOREACH(_LIB ${_LIBS}) - LIST(APPEND _DEBUG_LIBRARIES lib${_LIB}) - ENDFOREACH() - ENDIF() - - LIST(REMOVE_DUPLICATES _RELEASE_LIBRARIES) - LIST(REMOVE_DUPLICATES _DEBUG_LIBRARIES) - - # Search for release library - FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_RELEASE - NAMES - ${_RELEASE_LIBRARIES} - HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS} - PATHS - ${_LIBRARY_PATHS} - ${_UNIX_LIBRARY_PATHS} - NO_CMAKE_SYSTEM_PATH - ) - - IF(_IS_VERBOSE) - IF(${_UPNAME_FIXED}_LIBRARY_RELEASE) - MESSAGE(STATUS "${NAME} release library found: ${${_UPNAME_FIXED}_LIBRARY_RELEASE}") - ELSE() - MESSAGE(STATUS "${NAME} release library not found in ${_LIBRARY_PATHS};${_UNIX_LIBRARY_PATHS}") - ENDIF() - ENDIF() - - # Search for debug library - FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_DEBUG - NAMES - ${_DEBUG_LIBRARIES} - HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS} - PATHS - ${_LIBRARY_PATHS} - ${_UNIX_LIBRARY_PATHS} - NO_CMAKE_SYSTEM_PATH - ) - - IF(_IS_VERBOSE) - IF(${_UPNAME_FIXED}_LIBRARY_DEBUG) - MESSAGE(STATUS "${NAME} debug library found: ${${_UPNAME_FIXED}_LIBRARY_DEBUG}") - ELSE() - MESSAGE(STATUS "${NAME} debug library not found") - ENDIF() - ENDIF() - - SET(${_UPNAME_FIXED}_FOUND OFF) - - IF(${_UPNAME_FIXED}_INCLUDE_DIR) - # Set also _INCLUDE_DIRS - SET(${_UPNAME_FIXED}_INCLUDE_DIRS ${${_UPNAME_FIXED}_INCLUDE_DIR}) - ENDIF() - - # Library has been found if at least only one library and include are found - IF(${_UPNAME_FIXED}_LIBRARY_RELEASE AND ${_UPNAME_FIXED}_LIBRARY_DEBUG) - # Release and debug libraries found - SET(${_UPNAME_FIXED}_FOUND ON) - SET(${_UPNAME_FIXED}_LIBRARIES optimized ${${_UPNAME_FIXED}_LIBRARY_RELEASE} debug ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) - SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) - ELSEIF(${_UPNAME_FIXED}_LIBRARY_RELEASE) - # Release library found - SET(${_UPNAME_FIXED}_FOUND ON) - SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) - SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) - ELSEIF(${_UPNAME_FIXED}_LIBRARY_DEBUG) - # Debug library found - SET(${_UPNAME_FIXED}_FOUND ON) - SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) - SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) - ENDIF() - - IF(${_UPNAME_FIXED}_FOUND) - IF(NOT ${NAME}_FIND_QUIETLY) - MESSAGE(STATUS "Found ${NAME}: ${${_UPNAME_FIXED}_LIBRARIES}") - ENDIF() - ELSE() - IF(${NAME}_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Error: Unable to find ${NAME}!") - ENDIF() - IF(NOT ${NAME}_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find ${NAME}!") - ENDIF() - ENDIF() - - MARK_AS_ADVANCED(${_UPNAME_FIXED}_LIBRARY_RELEASE ${_UPNAME_FIXED}_LIBRARY_DEBUG) -ENDMACRO() - -MACRO(MESSAGE_VERSION_PACKAGE_HELPER NAME VERSION) - MESSAGE(STATUS "Found ${NAME} ${VERSION}: ${ARGN}") -ENDMACRO() - -MACRO(FIND_LIBRARY_HELPER NAME) - # Looks for libraries. - # - # NAME is the name of the library, lowercase and uppercase can be mixed - # - # Following parameters are optional variables and must be prefixed by: - # - # RELEASE is the list of libraries to check in release mode - # DEBUG is the list of libraries to check in debug mode - # VERBOSE display more details if not found - # REQUIRED throw an error if not found - # DIR is the base directory where to look for - # - # The first match will be used in the specified order and next matches will be ignored - # - # The following values are defined - # NAME_LIBRARIES - link against these to use NAME - - SET(_PARAMS ${ARGN}) - - SET(_RELEASE_LIBRARIES) - SET(_DEBUG_LIBRARIES) - SET(_BASE_DIRECTORIES) - - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_VERBOSE OFF) - SET(_IS_DIR OFF) - - IF(_PARAMS) - FOREACH(_PARAM ${_PARAMS}) - IF(_PARAM STREQUAL "RELEASE") - SET(_IS_RELEASE ON) - SET(_IS_DEBUG OFF) - SET(_IS_DIR OFF) - ELSEIF(_PARAM STREQUAL "DEBUG") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG ON) - SET(_IS_DIR OFF) - ELSEIF(_PARAM STREQUAL "VERBOSE") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_DIR OFF) - SET(_IS_VERBOSE ON) - ELSEIF(_PARAM STREQUAL "REQUIRED") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_DIR OFF) - SET(${NAME}_FIND_REQUIRED ON) - ELSEIF(_PARAM STREQUAL "DIR") - SET(_IS_RELEASE OFF) - SET(_IS_DEBUG OFF) - SET(_IS_DIR ON) - ELSE() - IF(_IS_RELEASE) - LIST(APPEND _RELEASE_LIBRARIES ${_PARAM}) - ELSEIF(_IS_DEBUG) - LIST(APPEND _DEBUG_LIBRARIES ${_PARAM}) - ELSEIF(_IS_DIR) - LIST(APPEND _BASE_DIRECTORIES ${_PARAM}) - ELSE() - MESSAGE(STATUS "parameter ${_PARAM} with no prefix") - ENDIF() - ENDIF() - ENDFOREACH() - ENDIF() - - # Fixes names if invalid characters are found - IF("${NAME}" MATCHES "^[a-zA-Z0-9]+$") - SET(_NAME_FIXED ${NAME}) - ELSE() - # if invalid characters are detected, replace them by valid ones - STRING(REPLACE "+" "p" _NAME_FIXED ${NAME}) - ENDIF() - - # Create uppercase and lowercase versions of NAME - STRING(TOUPPER ${NAME} _UPNAME) - STRING(TOLOWER ${NAME} _LOWNAME) - - STRING(TOUPPER ${_NAME_FIXED} _UPNAME_FIXED) - STRING(TOLOWER ${_NAME_FIXED} _LOWNAME_FIXED) - - SET(_LIBRARY_PATHS) - - # Check for root directories passed to CMake with -DXXX_DIR=... - IF(DEFINED ${_UPNAME_FIXED}_DIR) - SET(_TMP ${${_UPNAME_FIXED}_DIR}) - GET_FILENAME_COMPONENT(_TMP ${_TMP} ABSOLUTE) - LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX}) - - IF(_IS_VERBOSE) - MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}") - ENDIF() - ENDIF() - - IF(DEFINED ${_UPNAME}_DIR) - SET(_TMP ${${_UPNAME}_DIR}) - LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX}) - - IF(_IS_VERBOSE) - MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}") - ENDIF() - ENDIF() - - IF(_BASE_DIRECTORIES) - FOREACH(_DIR ${_BASE_DIRECTORIES}) - IF(_DIR) - LIST(APPEND _LIBRARY_PATHS ${_DIR}/lib${LIB_SUFFIX}) - - IF(_IS_VERBOSE) - MESSAGE(STATUS "Using ${_DIR} as root directory") - ENDIF() - ENDIF() - ENDFOREACH() - ENDIF() - - # Append environment variables XXX_DIR - LIST(APPEND _LIBRARY_PATHS - $ENV{${_UPNAME}_DIR}/lib${LIB_SUFFIX} - $ENV{${_UPNAME_FIXED}_DIR}/lib${LIB_SUFFIX}) - - IF(UNIX) - SET(_UNIX_LIBRARY_PATHS) - - # Append multiarch libraries paths - IF(CMAKE_LIBRARY_ARCHITECTURE) - LIST(APPEND _UNIX_LIBRARY_PATHS - /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} - /lib/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}) - ENDIF() - - # Append UNIX standard libraries paths - LIST(APPEND _UNIX_LIBRARY_PATHS - /usr/local/lib - /usr/lib - /lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib${LIB_SUFFIX}) - ENDIF() - - LIST(APPEND _RELEASE_LIBRARIES ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME} ${_NAME_FIXED}) - LIST(APPEND _DEBUG_LIBRARIES ${_LOWNAME}d ${_LOWNAME_FIXED}d ${NAME}d ${_NAME_FIXED}d) - - # Under Windows, some libs may need the lib prefix - IF(WIN32) - SET(_LIBS ${_RELEASE_LIBRARIES}) - FOREACH(_LIB ${_LIBS}) - LIST(APPEND _RELEASE_LIBRARIES lib${_LIB}) - ENDFOREACH() - - SET(_LIBS ${_DEBUG_LIBRARIES}) - FOREACH(_LIB ${_LIBS}) - LIST(APPEND _DEBUG_LIBRARIES lib${_LIB}) - ENDFOREACH() - ENDIF() - - LIST(REMOVE_DUPLICATES _RELEASE_LIBRARIES) - LIST(REMOVE_DUPLICATES _DEBUG_LIBRARIES) - - # Search for release library - FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_RELEASE - NAMES - ${_RELEASE_LIBRARIES} - HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS} - PATHS - ${_LIBRARY_PATHS} - ${_UNIX_LIBRARY_PATHS} - NO_CMAKE_SYSTEM_PATH - ) - - IF(_IS_VERBOSE) - IF(${_UPNAME_FIXED}_LIBRARY_RELEASE) - MESSAGE(STATUS "${NAME} release library found: ${${_UPNAME_FIXED}_LIBRARY_RELEASE}") - ELSE() - MESSAGE(STATUS "${NAME} release library not found in ${_LIBRARY_PATHS};${_UNIX_LIBRARY_PATHS}") - ENDIF() - ENDIF() - - # Search for debug library - FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_DEBUG - NAMES - ${_DEBUG_LIBRARIES} - HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS} - PATHS - ${_LIBRARY_PATHS} - ${_UNIX_LIBRARY_PATHS} - NO_CMAKE_SYSTEM_PATH - ) - - IF(_IS_VERBOSE) - IF(${_UPNAME_FIXED}_LIBRARY_DEBUG) - MESSAGE(STATUS "${NAME} debug library found: ${${_UPNAME_FIXED}_LIBRARY_DEBUG}") - ELSE() - MESSAGE(STATUS "${NAME} debug library not found") - ENDIF() - ENDIF() - - # Library has been found if at least only one library and include are found - IF(${_UPNAME_FIXED}_LIBRARY_RELEASE AND ${_UPNAME_FIXED}_LIBRARY_DEBUG) - # Release and debug libraries found - SET(${_UPNAME_FIXED}_LIBRARIES optimized ${${_UPNAME_FIXED}_LIBRARY_RELEASE} debug ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) - SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) - ELSEIF(${_UPNAME_FIXED}_LIBRARY_RELEASE) - # Release library found - SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) - SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) - ELSEIF(${_UPNAME_FIXED}_LIBRARY_DEBUG) - # Debug library found - SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) - SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) - ENDIF() - - MARK_AS_ADVANCED(${_UPNAME_FIXED}_LIBRARY_RELEASE ${_UPNAME_FIXED}_LIBRARY_DEBUG) -ENDMACRO() - -MACRO(FIND_LIBCURL) - IF(NOT CURL_FOUND) - FIND_PACKAGE(CURL REQUIRED) - - IF(WIN32 OR CURL_LIBRARY MATCHES "\\.a" OR WITH_STATIC_CURL) - SET(CURL_STATIC ON) - ELSE() - SET(CURL_STATIC OFF) - ENDIF() - - IF(CURL_STATIC) - SET(CURL_DEFINITIONS -DCURL_STATICLIB) - - IF(UNIX) - # CURL can depend on libidn - FIND_LIBRARY(IDN_LIBRARY idn) - IF(IDN_LIBRARY) - LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY}) - ENDIF() - - # CURL Macports version can depend on libidn, libintl and libiconv too - IF(APPLE) - FIND_LIBRARY(INTL_LIBRARY intl) - IF(INTL_LIBRARY) - LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY}) - ENDIF() - ELSE() - # Only used by libcurl under Linux - FIND_PACKAGE(OpenSSL REQUIRED) - - #IF(WIN32) - # SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib) - #ENDIF() - - # Only Linux version of libcurl depends on OpenSSL - LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) - LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES}) - ENDIF() - ENDIF() - ENDIF() - ENDIF() -ENDMACRO() - -MACRO(FIND_LIBXML2) - IF(NOT LIBXML2_FOUND) - FIND_PACKAGE(LibXml2 REQUIRED) - - IF(WIN32 OR WITH_STATIC_LIBXML2) - LIST(APPEND LIBXML2_DEFINITIONS -DLIBXML_STATIC) - ENDIF() - - IF(WITH_LIBXML2_ICONV) - FIND_PACKAGE(Iconv REQUIRED) -# LIST(APPEND CURL_INCLUDE_DIRS ${ICONV_INCLUDE_DIR}) - LIST(APPEND LIBXML2_LIBRARIES ${ICONV_LIBRARIES}) - ENDIF() - - IF(WITH_STATIC) - # libxml2 could need winsock2 library - IF(WIN32) - FIND_LIBRARY(WINSOCK2_LIB ws2_32) - - IF(WINSOCK2_LIB) - LIST(APPEND LIBXML2_LIBRARIES ${WINSOCK2_LIB}) - ENDIF() - - FIND_LIBRARY(CRYPT32_LIB Crypt32) - - IF(CRYPT32_LIB) - LIST(APPEND LIBXML2_LIBRARIES ${CRYPT32_LIB}) - ENDIF() - ELSE() - # under Linux and OS X, recent libxml2 versions are linked against liblzma - FIND_PACKAGE(LibLZMA) - - IF(LIBLZMA_LIBRARIES) - LIST(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES}) - ENDIF() - ENDIF() - ENDIF() - ENDIF() -ENDMACRO() - -MACRO(ADD_QT_LIBRARY _NAME) - IF(WIN32) - SET(_PREFIX "Qt5") - SET(_EXT "lib") - ELSE() - SET(_PREFIX "libQt5") - SET(_EXT "a") - ENDIF() - SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}.${_EXT}") - IF(EXISTS ${_LIB}) - LIST(APPEND QT_LIBRARIES optimized ${_LIB}) - ENDIF() - SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}") - IF(EXISTS ${_LIB}) - LIST(APPEND QT_LIBRARIES debug ${_LIB}) - ENDIF() -ENDMACRO() - -MACRO(ADD_QT_PLUGIN _TYPE _NAME) - IF(WIN32) - SET(_PREFIX "") - SET(_EXT "lib") - ELSE() - SET(_PREFIX "lib") - SET(_EXT "a") - ENDIF() - SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}.${_EXT}") - IF(EXISTS ${_LIB}) - LIST(APPEND QT_LIBRARIES optimized ${_LIB}) - ENDIF() - SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}") - IF(EXISTS ${_LIB}) - LIST(APPEND QT_LIBRARIES debug ${_LIB}) - ENDIF() -ENDMACRO() - -MACRO(ADD_QT_SYSTEM_LIBRARY _NAME) - # Save default suffixes - SET(_OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - - # Define specific suffixes - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) - - # Find the library with specified suffixes - FIND_LIBRARY(${_NAME}_LIBRARY NAMES ${_NAME}) - - # Restore default suffixes - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_OLD_SUFFIXES}) - - IF(${_NAME}_LIBRARY) - MESSAGE(STATUS "Found ${${_NAME}_LIBRARY} ${_NAME}") - - LIST(APPEND QT_LIBRARIES ${${_NAME}_LIBRARY}) - ELSE() - MESSAGE(STATUS "Didn't find ${_NAME}") - ENDIF() -ENDMACRO() - -MACRO(FIND_QT5) - CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR) - - SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR}) - - FIND_PACKAGE(Qt5Core QUIET) - - IF(Qt5Core_FOUND) - # Check if we are using Qt static or shared libraries - GET_TARGET_PROPERTY(_FILE Qt5::Core IMPORTED_LOCATION_RELEASE) - - SET(QT_VERSION "${Qt5Core_VERSION_STRING}") - SET(_VERSION "${QT_VERSION}") - - IF(_FILE MATCHES "\\.(lib|a)$") - SET(QT_STATIC ON) - SET(_VERSION "${_VERSION} static version") - ELSE() - SET(QT_STATIC OFF) - SET(_VERSION "${_VERSION} shared version") - ENDIF() - - MESSAGE(STATUS "Found Qt ${_VERSION}") - - # These variables are not defined with Qt5 CMake modules - SET(QT_BINARY_DIR "${_qt5Core_install_prefix}/bin") - SET(QT_LIBRARY_DIR "${_qt5Core_install_prefix}/lib") - SET(QT_PLUGINS_DIR "${_qt5Core_install_prefix}/plugins") - SET(QT_TRANSLATIONS_DIR "${_qt5Core_install_prefix}/translations") - - # Fix wrong include directories with Qt 5 under Mac OS X - INCLUDE_DIRECTORIES("${_qt5Core_install_prefix}/include") - - FIND_PACKAGE(Qt5Gui) - FIND_PACKAGE(Qt5Widgets) - FIND_PACKAGE(Qt5OpenGL) - FIND_PACKAGE(Qt5Xml) - FIND_PACKAGE(Qt5LinguistTools) - FIND_PACKAGE(Qt5Network) - - IF(QT_STATIC) - FIND_PACKAGE(PNG REQUIRED) - FIND_PACKAGE(Jpeg REQUIRED) - - ADD_DEFINITIONS(-DQT_STATICPLUGIN) - - SET(QT_LIBRARIES Qt5::Widgets) - - # Gui - LIST(APPEND QT_LIBRARIES Qt5::Gui Qt5::OpenGL) - - ADD_QT_LIBRARY(PrintSupport) - - IF(WIN32) - LIST(APPEND QT_LIBRARIES - ${WINSDK_LIBRARY_DIR}/Imm32.lib - ${WINSDK_LIBRARY_DIR}/OpenGL32.lib - ${WINSDK_LIBRARY_DIR}/WinMM.Lib) - ADD_QT_PLUGIN(platforms qwindows) - ADD_QT_LIBRARY(PlatformSupport) - ELSEIF(APPLE) - # Cups needs .dylib - SET(OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib) - FIND_LIBRARY(CUPS_LIBRARY cups) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES}) - - FIND_LIBRARY(IOKIT_FRAMEWORK IOKit) - FIND_LIBRARY(COCOA_FRAMEWORK Cocoa) - FIND_LIBRARY(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration) - FIND_LIBRARY(OPENGL_FRAMEWORK NAMES OpenGL) - - LIST(APPEND QT_LIBRARIES - ${CUPS_LIBRARY} - ${COCOA_FRAMEWORK} - ${SYSTEMCONFIGURATION_FRAMEWORK} - ${IOKIT_FRAMEWORK} - ${OPENGL_FRAMEWORK}) - - ADD_QT_PLUGIN(printsupport cocoaprintersupport) - ADD_QT_PLUGIN(platforms qcocoa) - ADD_QT_LIBRARY(PlatformSupport) - ELSE() - # order is very important there - ADD_QT_PLUGIN(platforms qxcb) - ADD_QT_PLUGIN(xcbglintegrations qxcb-glx-integration) - - ADD_QT_LIBRARY(XcbQpa) - ADD_QT_LIBRARY(GlxSupport) - ADD_QT_LIBRARY(ServiceSupport) - ADD_QT_LIBRARY(EdidSupport) - ADD_QT_LIBRARY(FontDatabaseSupport) - ADD_QT_LIBRARY(ThemeSupport) - ADD_QT_LIBRARY(EventDispatcherSupport) - ADD_QT_LIBRARY(PlatformSupport) - - ADD_QT_LIBRARY(DBus) - - IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a") - LIST(APPEND QT_LIBRARIES "${QT_LIBRARY_DIR}/libxcb-static.a") - ENDIF() - - # always link these in dynamic, API never changes - ADD_QT_SYSTEM_LIBRARY(X11) - ADD_QT_SYSTEM_LIBRARY(Xmu) - ADD_QT_SYSTEM_LIBRARY(X11-xcb) - ADD_QT_SYSTEM_LIBRARY(Xi) - ADD_QT_SYSTEM_LIBRARY(SM) - ADD_QT_SYSTEM_LIBRARY(ICE) - ADD_QT_SYSTEM_LIBRARY(xcb) - ADD_QT_SYSTEM_LIBRARY(GL) - ADD_QT_SYSTEM_LIBRARY(xcb-glx) - ADD_QT_SYSTEM_LIBRARY(fontconfig) - ADD_QT_SYSTEM_LIBRARY(Xrender) - ENDIF() - - ADD_QT_PLUGIN(imageformats qgif) - ADD_QT_PLUGIN(imageformats qicns) - ADD_QT_PLUGIN(imageformats qico) - ADD_QT_PLUGIN(imageformats qjpeg) - - # harfbuzz is needed since Qt 5.3 - IF(UNIX) - SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzzng.a") - IF(NOT EXISTS ${HB_LIB}) - SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzz.a") - ENDIF() - ELSEIF(WIN32) - SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib") - ENDIF() - IF(EXISTS ${HB_LIB}) - LIST(APPEND QT_LIBRARIES ${HB_LIB}) - ENDIF() - - # freetype is needed since Qt 5.5 - FIND_PACKAGE(Freetype) - - IF(FREETYPE_FOUND) - LIST(APPEND QT_LIBRARIES ${FREETYPE_LIBRARIES}) - ELSE() - IF(UNIX) - SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a") - ELSEIF(WIN32) - SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib") - ENDIF() - IF(EXISTS ${FREETYPE_LIB}) - LIST(APPEND QT_LIBRARIES ${FREETYPE_LIB}) - ENDIF() - ENDIF() - - ADD_QT_PLUGIN(accessible qtaccessiblewidgets) - - LIST(APPEND QT_LIBRARIES ${PNG_LIBRARIES} ${JPEG_LIBRARY}) - - # Network - LIST(APPEND QT_LIBRARIES Qt5::Network Qt5::Xml) - LIST(APPEND QT_LIBRARIES ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES}) - - IF(WIN32) - LIST(APPEND QT_LIBRARIES - ${WINSDK_LIBRARY_DIR}/Crypt32.lib - ${WINSDK_LIBRARY_DIR}/WS2_32.Lib - ${WINSDK_LIBRARY_DIR}/IPHlpApi.Lib) - ENDIF() - - # Core - LIST(APPEND QT_LIBRARIES Qt5::Core) - - # pcre is needed since Qt 5.5 - IF(UNIX) - SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a") - IF(NOT EXISTS ${PCRE_LIB}) - SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre2.a") - ENDIF() - ELSEIF(WIN32) - SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib") - ENDIF() - IF(EXISTS ${PCRE_LIB}) - LIST(APPEND QT_LIBRARIES ${PCRE_LIB}) - ENDIF() - - IF(APPLE) - FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre) - - FIND_LIBRARY(SECURITY_FRAMEWORK Security) - - LIST(APPEND QT_LIBRARIES - ${PCRE_LIBRARY} - ${FOUNDATION_FRAMEWORK} - ${CARBON_FRAMEWORK} - ${SECURITY_FRAMEWORK}) - ELSEIF(UNIX) - FIND_PACKAGE(Threads) - LIST(APPEND QT_LIBRARIES ${ZLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} -lrt) - ENDIF() - ELSE() - SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core) - ENDIF() - ELSE() - MESSAGE(WARNING "Unable to find Qt 5") - ENDIF() -ENDMACRO() diff --git a/code/CMakeModules/FindIconv.cmake b/code/CMakeModules/FindIconv.cmake index e96fe4054..092b35702 100644 --- a/code/CMakeModules/FindIconv.cmake +++ b/code/CMakeModules/FindIconv.cmake @@ -20,7 +20,7 @@ FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c PATHS /opt/local) IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) SET(ICONV_FOUND TRUE) -ENDIF() +ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) @@ -29,7 +29,7 @@ IF(ICONV_FOUND) set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}") if(ICONV_HAVE_WERROR) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") - ENDIF() + endif(ICONV_HAVE_WERROR) check_c_source_compiles(" #include int main(){ @@ -43,19 +43,19 @@ IF(ICONV_FOUND) } " ICONV_SECOND_ARGUMENT_IS_CONST ) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}") -ENDIF() +ENDIF(ICONV_FOUND) set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_LIBRARIES) IF(ICONV_FOUND) IF(NOT ICONV_FIND_QUIETLY) MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") - ENDIF() -ELSE() + ENDIF(NOT ICONV_FIND_QUIETLY) +ELSE(ICONV_FOUND) IF(Iconv_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find Iconv") - ENDIF() -ENDIF() + ENDIF(Iconv_FIND_REQUIRED) +ENDIF(ICONV_FOUND) MARK_AS_ADVANCED( ICONV_INCLUDE_DIR diff --git a/code/CMakeModules/FindJpeg.cmake b/code/CMakeModules/FindJpeg.cmake index b77eba41b..454f0fdc2 100644 --- a/code/CMakeModules/FindJpeg.cmake +++ b/code/CMakeModules/FindJpeg.cmake @@ -7,7 +7,7 @@ IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) # in cache already SET(JPEG_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) FIND_PATH(JPEG_INCLUDE_DIR @@ -42,9 +42,9 @@ IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) SET(JPEG_FOUND "YES") IF(NOT JPEG_FIND_QUIETLY) MESSAGE(STATUS "Found Jpeg: ${JPEG_LIBRARY}") - ENDIF() -ELSE() + ENDIF(NOT JPEG_FIND_QUIETLY) +ELSE(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) IF(NOT JPEG_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Jpeg!") - ENDIF() -ENDIF() + ENDIF(NOT JPEG_FIND_QUIETLY) +ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) diff --git a/code/CMakeModules/FindLIBGSF.cmake b/code/CMakeModules/FindLIBGSF.cmake deleted file mode 100644 index 8d749a87d..000000000 --- a/code/CMakeModules/FindLIBGSF.cmake +++ /dev/null @@ -1,57 +0,0 @@ -# - Try to find libGSF -# -# Once done this will define -# -# LIBGSF_FOUND - System has LibGSF -# LIBGSF_INCLUDE_DIR - The LibGSF include directory -# LIBGSF_LIBRARIES - The libraries needed to use LibGSF -# LIBGSF_DEFINITIONS - Compiler switches required for using LibGSF -# LIBGSF_GSF_EXECUTABLE - The archive utility -# LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE - The office files thumbnailer for the GNOME desktop -# LIBGSF_GSFVBADUMP_EXECUTABLE - The utility to extract Visual Basic for Applications macros - -# Copyright (c) 2009, Pau Garcia i Quiles -# Based off FindLibXml2.cmake from CMake 2.6.4 by Alexander Neundorf -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -IF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES) - # in cache already - SET(LIBGSF_FIND_QUIETLY TRUE) -ENDIF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES) - -IF (NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PC_LIBGSF libgsf-1) - SET(LIBGSF_DEFINITIONS ${PC_LIBGSF_CFLAGS_OTHER}) -ENDIF (NOT WIN32) - -FIND_PATH(LIBGSF_INCLUDE_DIR gsf/gsf.h - HINTS - ${PC_LIBGSF_INCLUDEDIR} - ${PC_LIBGSF_INCLUDE_DIRS} - PATH_SUFFIXES libgsf-1 - ) - -FIND_LIBRARY(LIBGSF_LIBRARIES NAMES gsf-1 libgsf-1 - HINTS - ${PC_LIBGSF_LIBDIR} - ${PC_LIBGSF_LIBRARY_DIRS} - ) - -FIND_PROGRAM(LIBGSF_GSF_EXECUTABLE gsf) -FIND_PROGRAM(LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE gsf-office-thumbnailer) -FIND_PROGRAM(LIBGSF_GSFVBADUMP_EXECUTABLE gsf-vba-dump) - -INCLUDE(FindPackageHandleStandardArgs) - -# handle the QUIETLY and REQUIRED arguments and set LIBGSF_FOUND to TRUE if -# all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGSF DEFAULT_MSG LIBGSF_LIBRARIES LIBGSF_INCLUDE_DIR) - -MARK_AS_ADVANCED(LIBGSF_INCLUDE_DIR LIBGSF_LIBRARIES LIBGSF_GSF_EXECUTABLE LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE LIBGSF_GSFVBADUMP_EXECUTABLE ) - diff --git a/code/CMakeModules/FindLibOVR.cmake b/code/CMakeModules/FindLibOVR.cmake index 081fa0bca..b182da00c 100644 --- a/code/CMakeModules/FindLibOVR.cmake +++ b/code/CMakeModules/FindLibOVR.cmake @@ -7,11 +7,10 @@ IF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR) # in cache already SET(LIBOVR_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR) FIND_PATH(LIBOVR_INCLUDE_DIR - NAMES - OVR.h OVR_CAPI.h + OVR.h PATHS $ENV{LIBOVR_DIR}/Include /usr/local/include @@ -25,18 +24,18 @@ FIND_PATH(LIBOVR_INCLUDE_DIR IF(UNIX) IF(TARGET_X64) SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/x86_64") - ELSE() + ELSE(TARGET_X64) SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/i386") - ENDIF() + ENDIF(TARGET_X64) ELSEIF(APPLE) SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/MacOS/Release") ELSEIF(WIN32) IF(TARGET_X64) SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/x64") - ELSE() + ELSE(TARGET_X64) SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Win32") - ENDIF() -ENDIF() + ENDIF(TARGET_X64) +ENDIF(UNIX) FIND_LIBRARY(LIBOVR_LIBRARY NAMES ovr libovr @@ -56,17 +55,17 @@ FIND_LIBRARY(LIBOVR_LIBRARY IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR) IF(NOT LIBOVR_FIND_QUIETLY) MESSAGE(STATUS "Found LibOVR: ${LIBOVR_LIBRARY}") - ENDIF() + 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() + ELSE(UNIX) SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY}) - ENDIF() -ELSE() + ENDIF(UNIX) +ELSE(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR) IF(NOT LIBOVR_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find LibOVR!") - ENDIF() -ENDIF() + ENDIF(NOT LIBOVR_FIND_QUIETLY) +ENDIF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR) diff --git a/code/CMakeModules/FindLibVR.cmake b/code/CMakeModules/FindLibVR.cmake index 5e9da0342..e8bcf2fde 100644 --- a/code/CMakeModules/FindLibVR.cmake +++ b/code/CMakeModules/FindLibVR.cmake @@ -7,7 +7,7 @@ IF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR) # in cache already SET(LIBVR_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR) FIND_PATH(LIBVR_INCLUDE_DIR hmd.h PATH_SUFFIXES include/LibVR @@ -22,12 +22,12 @@ FIND_LIBRARY(LIBVR_LIBRARY IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) IF(NOT LIBVR_FIND_QUIETLY) MESSAGE(STATUS "Found LibVR: ${LIBVR_LIBRARY}") - ENDIF() + ENDIF(NOT LIBVR_FIND_QUIETLY) SET(LIBVR_FOUND "YES") SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR") SET(NL_STEREO_AVAILABLE ON) -ELSE() +ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) IF(NOT LIBVR_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find LibVR!") - ENDIF() -ENDIF() + ENDIF(NOT LIBVR_FIND_QUIETLY) +ENDIF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index 5511379a3..c21d64e4f 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -143,7 +143,7 @@ ENDIF() IF(WITH_STLPORT) LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport) LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlportd) -ENDIF() +ENDIF(WITH_STLPORT) # generic libraries names LIST(APPEND LIBRARY_NAME_RELEASE luabind libluabind) @@ -194,7 +194,7 @@ IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR) # Case where Luabind is compiled from sources (debug version is compiled by default) SET(LUABIND_FOUND TRUE) SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG}) - ENDIF() + ENDIF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG) ENDIF() IF(LUABIND_FOUND) @@ -209,11 +209,11 @@ IF(LUABIND_FOUND) IF(NOT Luabind_FIND_QUIETLY) MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}") - ENDIF() + ENDIF(NOT Luabind_FIND_QUIETLY) ELSE() IF(NOT Luabind_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Luabind!") ENDIF() -ENDIF() +ENDIF(LUABIND_FOUND) MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS) diff --git a/code/CMakeModules/FindMSVC.cmake b/code/CMakeModules/FindMSVC.cmake index 9d5fc5cf7..6a8bdd33a 100644 --- a/code/CMakeModules/FindMSVC.cmake +++ b/code/CMakeModules/FindMSVC.cmake @@ -1,182 +1,106 @@ -# - Find MS Visual C++ -# -# VC_INCLUDE_DIR - where to find headers -# VC_INCLUDE_DIRS - where to find headers -# VC_LIBRARY_DIR - where to find libraries -# VC_FOUND - True if MSVC found. - -MACRO(ADD_TRAILING_SLASH _FILENAME_VAR) - # put content in a new variable - SET(_FILENAME ${${_FILENAME_VAR}}) - # get length of the string - STRING(LENGTH ${_FILENAME} _LEN) - # convert length to last pos - MATH(EXPR _POS "${_LEN}-1") - # get last character of the string - STRING(SUBSTRING ${_FILENAME} ${_POS} 1 _FILENAME_END) - # compare it with a slash - IF(NOT _FILENAME_END STREQUAL "/") - # not a slash, append it - SET(${_FILENAME_VAR} "${_FILENAME}/") - ELSE() - # already a slash - ENDIF() -ENDMACRO() - -MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) - # Software/Wow6432Node/... - GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE) - - IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry") - SET(VC${_VERSION}_DIR) - GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE) - - IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") - # be sure it's finishing by a / - ADD_TRAILING_SLASH(VC${_VERSION}_DIR) - - SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/") - ENDIF() - ENDIF() - - IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") - SET(VC${_VERSION}_FOUND ON) - DETECT_EXPRESS_VERSION(${_VERSION}) - IF(NOT MSVC_FIND_QUIETLY) - SET(_VERSION_STR ${_VERSION}) - IF(MSVC_EXPRESS) - SET(_VERSION_STR "${_VERSION_STR} Express") - ENDIF() - MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}") - ENDIF() - ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") - SET(VC${_VERSION}_FOUND OFF) - SET(VC${_VERSION}_DIR "") - ENDIF() -ENDMACRO() - -MACRO(DETECT_VC_VERSION _VERSION) - IF(NOT VC_FOUND) - SET(VC${_VERSION}_FOUND OFF) - DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION}) - - IF(NOT VC${_VERSION}_FOUND) - DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) - ENDIF() - - IF(VC${_VERSION}_FOUND) - SET(VC_FOUND ON) - SET(VC_DIR "${VC${_VERSION}_DIR}") - ENDIF() - ENDIF() -ENDMACRO() - -MACRO(DETECT_EXPRESS_VERSION _VERSION) - GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE) - - IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") - SET(MSVC_EXPRESS ON) - ENDIF() -ENDMACRO() - -IF(MSVC_VERSION GREATER 1909) - DETECT_VC_VERSION("15.0") - SET(MSVC_TOOLSET "140") - - SET(VC_DIR "${VC_DIR}Tools/MSVC") - - FILE(GLOB MSVC_TOOLCHAIN_VERSIONS RELATIVE ${VC_DIR} "${VC_DIR}/*") - - IF(MSVC_TOOLCHAIN_VERSIONS) - LIST(SORT MSVC_TOOLCHAIN_VERSIONS) - LIST(REVERSE MSVC_TOOLCHAIN_VERSIONS) - ENDIF() - - IF(NOT MSVC_TOOLCHAIN_VERSIONS) - MESSAGE(FATAL_ERROR "No MSVC version found in default search path ${VC_DIR}") - ENDIF() - - LIST(GET MSVC_TOOLCHAIN_VERSIONS 0 MSVC_TOOLCHAIN_VERSION) - - SET(VC_DIR "${VC_DIR}/${MSVC_TOOLCHAIN_VERSION}") - SET(VC_INCLUDE_DIR "${VC_DIR}/include") -ELSEIF(MSVC14) - DETECT_VC_VERSION("14.0") - SET(MSVC_TOOLSET "140") -ELSEIF(MSVC12) - DETECT_VC_VERSION("12.0") - SET(MSVC_TOOLSET "120") -ELSEIF(MSVC11) - DETECT_VC_VERSION("11.0") - SET(MSVC_TOOLSET "110") -ELSEIF(MSVC10) - DETECT_VC_VERSION("10.0") - SET(MSVC_TOOLSET "100") -ELSEIF(MSVC90) - DETECT_VC_VERSION("9.0") - SET(MSVC_TOOLSET "90") -ELSEIF(MSVC80) - DETECT_VC_VERSION("8.0") - SET(MSVC_TOOLSET "80") -ENDIF() - -# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable -IF(NOT VC_DIR) - SET(VC_DIR $ENV{VC_DIR}) - # Fix path - FILE(TO_CMAKE_PATH ${VC_DIR} VC_DIR) -ENDIF() - -IF(NOT VC_DIR) - IF(CMAKE_CXX_COMPILER) - SET(_COMPILER ${CMAKE_CXX_COMPILER}) - ELSE() - SET(_COMPILER ${CMAKE_C_COMPILER}) - ENDIF() - STRING(REGEX REPLACE "/(bin|BIN|Bin)/.+" "" VC_DIR ${_COMPILER}) -ENDIF() - -IF(NOT VC_INCLUDE_DIR AND VC_DIR AND EXISTS "${VC_DIR}") - SET(VC_INCLUDE_DIR "${VC_DIR}/include") - IF(EXISTS "${VC_INCLUDE_DIR}") - SET(VC_FOUND ON) - ENDIF() -ENDIF() - -SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist") - -IF(NOT EXISTS "${MSVC_REDIST_DIR}") - SET(MSVC_REDIST_DIR "${VC_DIR}/redist") - - IF(NOT EXISTS "${MSVC_REDIST_DIR}") - SET(MSVC_REDIST_DIR) - ENDIF() -ENDIF() - -IF(MSVC_REDIST_DIR) - IF(MSVC1411 OR MSVC1410) - # If you have VC++ 2017 Express, put x64/Microsoft.VC141.CRT/*.dll in ${EXTERNAL_PATH}/redist - # original files whould be in ${VC_DIR}/Redist/MSVC/14.11.25325/x64/Microsoft.VC141.CRT - SET(MSVC14_REDIST_DIR "${MSVC_REDIST_DIR}") - ELSEIF(MSVC14) - SET(MSVC14_REDIST_DIR "${MSVC_REDIST_DIR}") - ELSEIF(MSVC12) - # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC12_REDIST_DIR "${MSVC_REDIST_DIR}") - ELSEIF(MSVC11) - # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC11_REDIST_DIR "${MSVC_REDIST_DIR}") - ELSEIF(MSVC10) - # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC10_REDIST_DIR "${MSVC_REDIST_DIR}") - ELSEIF(MSVC90) - SET(MSVC90_REDIST_DIR "${MSVC_REDIST_DIR}") - ELSEIF(MSVC80) - SET(MSVC80_REDIST_DIR "${MSVC_REDIST_DIR}") - ENDIF() -ENDIF() - -MESSAGE(STATUS "Using headers from ${VC_INCLUDE_DIR}") - -SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR}) -INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR}) +# - Find MS Visual C++ +# +# VC_INCLUDE_DIR - where to find headers +# VC_INCLUDE_DIRS - where to find headers +# VC_LIBRARY_DIR - where to find libraries +# VC_FOUND - True if MSVC found. + +MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) + # Software/Wow6432Node/... + GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE) + + IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry") + SET(VC${_VERSION}_DIR) + GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE) + IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") + SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/") + ENDIF() + ENDIF() + + IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") + SET(VC${_VERSION}_FOUND ON) + DETECT_EXPRESS_VERSION(${_VERSION}) + IF(NOT MSVC_FIND_QUIETLY) + SET(_VERSION_STR ${_VERSION}) + IF(MSVC_EXPRESS) + SET(_VERSION_STR "${_VERSION_STR} Express") + ENDIF() + MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}") + ENDIF() + ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") + SET(VC${_VERSION}_FOUND OFF) + SET(VC${_VERSION}_DIR "") + ENDIF() +ENDMACRO() + +MACRO(DETECT_VC_VERSION _VERSION) + SET(VC${_VERSION}_FOUND OFF) + DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION}) + + IF(NOT VC${_VERSION}_FOUND) + DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) + ENDIF() + + IF(VC${_VERSION}_FOUND) + SET(VC_FOUND ON) + SET(VC_DIR "${VC${_VERSION}_DIR}") + 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() +ENDMACRO() + +IF(MSVC12) + DETECT_VC_VERSION("12.0") + SET(MSVC_TOOLSET "120") + + IF(NOT MSVC12_REDIST_DIR) + # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF() +ELSEIF(MSVC11) + DETECT_VC_VERSION("11.0") + SET(MSVC_TOOLSET "110") + + IF(NOT MSVC11_REDIST_DIR) + # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF() +ELSEIF(MSVC10) + DETECT_VC_VERSION("10.0") + SET(MSVC_TOOLSET "100") + + IF(NOT MSVC10_REDIST_DIR) + # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF() +ELSEIF(MSVC90) + DETECT_VC_VERSION("9.0") + SET(MSVC_TOOLSET "90") +ELSEIF(MSVC80) + DETECT_VC_VERSION("8.0") + SET(MSVC_TOOLSET "80") +ENDIF() + +# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable +IF(NOT VC_DIR) + SET(VC_DIR $ENV{VC_DIR}) +ENDIF() + +IF(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}) +INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR}) diff --git a/code/CMakeModules/FindMercurial.cmake b/code/CMakeModules/FindMercurial.cmake index 4e6429357..f85952557 100644 --- a/code/CMakeModules/FindMercurial.cmake +++ b/code/CMakeModules/FindMercurial.cmake @@ -60,12 +60,12 @@ IF(Mercurial_HG_EXECUTABLE) EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} --version OUTPUT_VARIABLE Mercurial_VERSION_HG OUTPUT_STRIP_TRAILING_WHITESPACE) - + STRING(REGEX REPLACE ".*version ([\\.0-9]+).*" "\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}") MACRO(Mercurial_WC_INFO dir prefix) - EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} log -r . --template "{rev};{node};{tags};{author}" + EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}" WORKING_DIRECTORY ${dir} OUTPUT_VARIABLE ${prefix}_WC_INFO ERROR_VARIABLE Mercurial_hg_info_error @@ -73,7 +73,7 @@ IF(Mercurial_HG_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE) IF(NOT ${Mercurial_hg_info_result} EQUAL 0) - MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} log\" failed with output:\n${Mercurial_hg_info_error}") + MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}") ELSE() LIST(LENGTH ${prefix}_WC_INFO _COUNT) IF(_COUNT EQUAL 4) diff --git a/code/CMakeModules/FindMySQL.cmake b/code/CMakeModules/FindMySQL.cmake index 631a96224..f2b62fc59 100644 --- a/code/CMakeModules/FindMySQL.cmake +++ b/code/CMakeModules/FindMySQL.cmake @@ -16,12 +16,10 @@ IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) ELSE() FIND_PATH(MYSQL_INCLUDE_DIR mysql.h - PATH_SUFFIXES mysql mariadb + PATH_SUFFIXES mysql PATHS /usr/include/mysql - /usr/include/mariadb /usr/local/include/mysql - /usr/local/include/mariadb /opt/local/include/mysql5/mysql /opt/local/include/mysql55/mysql /opt/local/include/mysql51/mysql @@ -29,29 +27,28 @@ ELSE() $ENV{SystemDrive}/MySQL/*/include) IF(WIN32 AND MSVC) - FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient libmariadb mariadbclient + FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient PATHS $ENV{ProgramFiles}/MySQL/*/lib/opt $ENV{SystemDrive}/MySQL/*/lib/opt) - FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd libmariadb mariadbclient + + FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd PATHS $ENV{ProgramFiles}/MySQL/*/lib/opt $ENV{SystemDrive}/MySQL/*/lib/opt) ELSE() - FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient mariadbclient + FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient PATHS /usr/lib /usr/local/lib - /usr/lib/mariadb /usr/lib/mysql /usr/local/lib/mysql - /usr/local/lib/mariadb /opt/local/lib/mysql5/mysql /opt/local/lib/mysql55/mysql /opt/local/lib/mysql51/mysql ) - FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd mariadbclientd + FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd PATHS /usr/lib /usr/local/lib @@ -72,9 +69,6 @@ ELSE() ENDIF() FIND_PACKAGE(OpenSSL) IF(OPENSSL_FOUND) - IF(WIN32) - SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib) - ENDIF() SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES}) ENDIF() ENDIF() @@ -83,10 +77,6 @@ ELSE() IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) SET(MYSQL_FOUND TRUE) MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}") - IF (MYSQL_LIBRARIES MATCHES "libmariadb" OR MYSQL_LIBRARIES MATCHES "mariadbclient") - SET(MARIADB_FOUND TRUE) - MESSAGE(STATUS "Found MariaDB.") - ENDIF() ELSE() SET(MYSQL_FOUND FALSE) MESSAGE(STATUS "MySQL not found.") diff --git a/code/CMakeModules/FindNeL.cmake b/code/CMakeModules/FindNeL.cmake deleted file mode 100644 index e75163cce..000000000 --- a/code/CMakeModules/FindNeL.cmake +++ /dev/null @@ -1,398 +0,0 @@ -# NEL_DIR can be specified as root directory - -# Returned variables -# NELDRIVER_XXX_BINARY_DEBUG -# NELDRIVER_XXX_BINARY_RELEASE -# NELDRIVER_XXX_LIBRARY_DEBUG -# NELDRIVER_XXX_LIBRARY_RELEASE -# NELDRIVER_XXX_FOUND -# NEL_DEFINITIONS -# NEL_INCLUDE_DIR -# NEL_INCLUDE_DIRS -# NEL_LIBRARIES -# NELXXX_FOUND -# NELXXX_LIBRARIES - - -INCLUDE(FindHelpers) - -# Init all variables we'll set -SET(NEL_LIBRARIES) -SET(NEL_INCLUDE_DIR) -SET(NEL_INCLUDE_DIRS) -SET(NEL_VERSION) -SET(NEL_STATIC) -SET(NEL_STATIC_DRIVERS) -SET(NEL_VERSION_MAJOR) -SET(NEL_VERSION_MINOR) -SET(NEL_VERSION_PATCH) -SET(NEL_REVISION) -SET(NEL_VERSION) - -SET(NEL_MODULES_FOUND) -SET(NEL_MODULES_AVAILABLE 3d georges gui ligo logic net pacs sound) # cegui pipeline - -SET(NEL_DRIVERS_FOUND) -SET(NEL_DRIVERS_AVAILABLE opengl opengles direct3d dsound fmod openal xaudio2) - -SET(NELMISC_FIND_REQUIRED ${NeL_FIND_REQUIRED}) - -# Force search of NELMISC -FIND_PACKAGE_HELPER(nelmisc nel/misc/types_nl.h RELEASE nelmisc_r nelmisc DEBUG nelmisc_d DIR ${NEL_DIR} VERBOSE QUIET) - -IF(NELMISC_FOUND) - # define NEL_DIR if not specified - IF(NOT NEL_DIR) - GET_FILENAME_COMPONENT(NEL_DIR ${NELMISC_INCLUDE_DIR}/.. ABSOLUTE) - ENDIF() - - # Aliases for include directory - SET(NEL_INCLUDE_DIR ${NELMISC_INCLUDE_DIR}) - SET(NEL_INCLUDE_DIRS ${NEL_INCLUDE_DIR}) - - MESSAGE(STATUS "Found NeL headers in ${NEL_INCLUDE_DIR}") - - GET_FILENAME_COMPONENT(NEL_LIBRARY_DIR ${NELMISC_LIBRARY} DIRECTORY) - - MESSAGE(STATUS "Found NeL library in ${NEL_LIBRARY_DIR}") - - # TODO: implement static version checks for Windows - - # static libraries - IF(UNIX) - GET_FILENAME_COMPONENT(_LIBEXT ${NELMISC_LIBRARY} EXT) - - IF(_LIBEXT STREQUAL ".a") - SET(NEL_STATIC ON) - MESSAGE(STATUS "NeL is using static libraries") - ENDIF() - ENDIF() - - IF(WIN32) - SET(NELDRIVER_DIRS_TO_CHECK - ${NEL_DIR}/bin${LIB_SUFFIX} - ${NEL_DIR} - ) - ELSE() - SET(NELDRIVER_DIRS_TO_CHECK - /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel - /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel - /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/lib/nel - /usr/lib - ) - ENDIF() - - # check for static drivers - FOREACH(_DRIVER ${NEL_DRIVERS_AVAILABLE}) - IF(WIN32) - SET(_DRIVER_RELASE_FILE "nel_drv_${_DRIVER}_win_r") - SET(_DRIVER_DEBUG_FILE "nel_drv_${_DRIVER}_win_d") - SET(_DRIVER_SHARED_EXT dll) - SET(_DRIVER_STATIC_EXT lib) - ELSE() - SET(_DRIVER_RELEASE_FILE "nel_drv_${_DRIVER}") - SET(_DRIVER_DEBUG_FILE) - SET(_DRIVER_SHARED_EXT so) - SET(_DRIVER_STATIC_EXT a) - ENDIF() - - STRING(TOUPPER ${_DRIVER} _UPDRIVER) - - FOREACH(_DIR ${NELDRIVER_DIRS_TO_CHECK}) - SET(_FOUND OFF) - - IF(_DRIVER_RELASE_FILE) - SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_SHARED_EXT}") - IF(EXISTS ${_FILE}) - SET(NELDRIVER_${_UPDRIVER}_BINARY_RELEASE ${_FILE}) - - MESSAGE(STATUS "Found NeL release shared driver ${_DRIVER}: ${_FILE}") - - SET(NEL_STATIC_DRIVERS OFF) - - IF(NOT NEL_DRIVER_DIR) - SET(NEL_DRIVER_DIR ${_DIR}) - ENDIF() - ENDIF() - - SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_STATIC_EXT}") - IF(EXISTS ${_FILE}) - SET(NELDRIVER_${_UPDRIVER}_LIBRARY_RELEASE ${_FILE}) - - MESSAGE(STATUS "Found NeL release static driver ${_DRIVER}: ${_FILE}") - - SET(NEL_STATIC_DRIVERS ON) - - IF(NOT NEL_DRIVER_DIR) - SET(NEL_DRIVER_DIR ${_DIR}) - ENDIF() - ENDIF() - ENDIF() - - IF(_DRIVER_DEBUG_FILE) - SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_SHARED_EXT}") - IF(EXISTS ${_FILE}) - SET(NELDRIVER_${_UPDRIVER}_BINARY_DEBUG ${_FILE}) - - MESSAGE(STATUS "Found NeL debug shared driver ${_DRIVER}: ${_FILE}") - - SET(NEL_STATIC_DRIVERS OFF) - - IF(NOT NEL_DRIVER_DIR) - SET(NEL_DRIVER_DIR ${_DIR}) - ENDIF() - ENDIF() - - SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_STATIC_EXT}") - IF(EXISTS ${_FILE}) - SET(NELDRIVER_${_UPDRIVER}_LIBRARY_DEBUG ${_FILE}) - - MESSAGE(STATUS "Found NeL debug static driver ${_DRIVER}: ${_FILE}") - - SET(NEL_STATIC_DRIVERS ON) - - IF(NOT NEL_DRIVER_DIR) - SET(NEL_DRIVER_DIR ${_DIR}) - ENDIF() - ENDIF() - - IF(_FOUND) - SET(NELDRIVER_${_UPDRIVER}_FOUND ON) - LIST(APPEND NEL_DRIVERS_FOUND ${_DRIVER}) - ENDIF() - ENDIF() - ENDFOREACH() - ENDFOREACH() - - MESSAGE(STATUS "Found NeL driver in ${NEL_DRIVER_DIR}") - - PARSE_VERSION_OTHER(${NEL_INCLUDE_DIR}/nel/misc/version_nl.h NL_VERSION_MAJOR NL_VERSION_MINOR NL_VERSION_PATCH NL_REVISION) - - SET(NEL_VERSION_MAJOR ${NL_VERSION_MAJOR}) - SET(NEL_VERSION_MINOR ${NL_VERSION_MINOR}) - SET(NEL_VERSION_PATCH ${NL_VERSION_PATCH}) - SET(NEL_REVISION ${NL_REVISION}) - - IF(NOT NEL_VERSION) - IF(NEL_VERSION_MAJOR OR NEL_VERSION_MINOR} OR NEL_VERSION_PATCH) - SET(NEL_VERSION "${NEL_VERSION_MAJOR}.${NEL_VERSION_MINOR}.${NEL_VERSION_PATCH}") - ELSE() - SET(NEL_VERSION "0.5.0") - ENDIF() - - IF(NEL_REVISION) - SET(NEL_VERSION "${NEL_VERSION}.${NEL_REVISION}") - ENDIF() - ENDIF() - - FIND_PACKAGE(PNG REQUIRED) - IF(PNG_FOUND) - LIST(APPEND NELMISC_LIBRARIES ${PNG_LIBRARIES}) - ENDIF() - - FIND_PACKAGE(Jpeg REQUIRED) - IF(JPEG_FOUND) - LIST(APPEND NELMISC_LIBRARIES ${JPEG_LIBRARY}) - ENDIF() - - FIND_PACKAGE(GIF) - - IF(GIF_FOUND) - LIST(APPEND NELMISC_LIBRARIES ${GIF_LIBRARY}) - ENDIF() - - FIND_LIBXML2() - - IF(LIBXML2_FOUND) - LIST(APPEND NELMISC_LIBRARIES ${LIBXML2_LIBRARIES}) - ENDIF() - - LIST(REMOVE_ITEM NeL_FIND_COMPONENTS misc) - - LIST(APPEND NEL_MODULES_FOUND misc) - LIST(APPEND NEL_LIBRARIES ${NELMISC_LIBRARIES}) -ENDIF() - -IF(NOT NeL_FIND_COMPONENTS) - SET(NeL_FIND_COMPONENTS ${NEL_MODULES_AVAILABLE}) - - # We can skip not installed modules - SET(NeL_FIND_REQUIRED OFF) -ENDIF() - -FOREACH(COMPONENT ${NeL_FIND_COMPONENTS}) - SET(_NAME NeL${COMPONENT}) - STRING(TOUPPER ${_NAME} _UPNAME) - - # module is required - SET(${_NAME}_FIND_REQUIRED ${NeL_FIND_REQUIRED}) - - IF(COMPONENT STREQUAL "3d") - SET(HEADER_FILE shape.h) -# ELSEIF(COMPONENT STREQUAL "cegui") -# SET(HEADER_FILE shape.h) - ELSEIF(COMPONENT STREQUAL "georges") - SET(HEADER_FILE form.h) - ELSEIF(COMPONENT STREQUAL "gui") - SET(HEADER_FILE reflect.h) - ELSEIF(COMPONENT STREQUAL "ligo") - SET(HEADER_FILE primitive.h) - ELSEIF(COMPONENT STREQUAL "logic") - SET(HEADER_FILE logic_state.h) - ELSEIF(COMPONENT STREQUAL "net") - SET(HEADER_FILE sock.h) - ELSEIF(COMPONENT STREQUAL "pacs") - SET(HEADER_FILE primitive_block.h) -# ELSEIF(COMPONENT STREQUAL "pipeline") -# SET(HEADER_FILE shape.h) - ELSEIF(COMPONENT STREQUAL "sound") - SET(HEADER_FILE shape.h) - ELSE() - SET(HEADER_FILE) - ENDIF() - - # display if a component has a wrong name - IF(NOT HEADER_FILE) - MESSAGE(STATUS "NeL module ${COMPONENT} not supported, ignoring it...") - CONTINUE() - ENDIF() - - FIND_PACKAGE_HELPER(${_NAME} nel/${COMPONENT}/${HEADER_FILE} - RELEASE nel${COMPONENT}_r nel${COMPONENT} - DEBUG nel${COMPONENT}_d - QUIET) - - IF(${_UPNAME}_FOUND) - LIST(APPEND NEL_MODULES_FOUND ${COMPONENT}) - - IF(COMPONENT STREQUAL "3d") - IF(NEL_STATIC) - # 3rd party dependencies - FIND_PACKAGE(Freetype REQUIRED) - IF(FREETYPE_FOUND) - LIST(APPEND ${_UPNAME}_LIBRARIES ${FREETYPE_LIBRARIES}) - ENDIF() - - # Append static 3D drivers - IF(NEL_STATIC_DRIVERS) - # Direct3D driver (only under Windows) - IF(WIN32) - IF(NELDRIVER_DIRECT3D_LIBRARY_DEBUG) - LIST(APPEND ${_UPNAME}_LIBRARIES debug ${NELDRIVER_DIRECT3D_LIBRARY_DEBUG}) - ENDIF() - - IF(NELDRIVER_DIRECT3D_LIBRARY_RELEASE) - LIST(APPEND ${_UPNAME}_LIBRARIES optimized ${NELDRIVER_DIRECT3D_LIBRARY_RELEASE}) - ENDIF() - ENDIF() - - # OpenGL driver - IF(NELDRIVER_OPENGL_LIBRARY_DEBUG) - LIST(APPEND ${_UPNAME}_LIBRARIES debug ${NELDRIVER_OPENGL_LIBRARY_DEBUG}) - ENDIF() - - IF(NELDRIVER_OPENGL_LIBRARY_RELEASE) - LIST(APPEND ${_UPNAME}_LIBRARIES optimized ${NELDRIVER_OPENGL_LIBRARY_RELEASE}) - ENDIF() - ENDIF() - ENDIF() - ELSEIF(COMPONENT STREQUAL "gui") - FIND_PACKAGE(Luabind REQUIRED) - - LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES}) - - FIND_LIBCURL() - - IF(CURL_FOUND) - LIST(APPEND ${_UPNAME}_LIBRARIES ${CURL_LIBRARIES}) - LIST(APPEND ${_UPNAME}_DEFINITIONS ${CURL_DEFINITIONS}) - ENDIF() - - # TODO: remove complately OpenSSL requirement on Windows - - # Only used by libcurl under Linux - FIND_PACKAGE(OpenSSL REQUIRED) - - IF(WIN32) - LIST(APPEND OPENSSL_LIBRARIES Crypt32.lib) - ENDIF() - - # Only Linux version of libcurl depends on OpenSSL - LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) - LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES}) - - LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES} ${CURL_LIBRARIES}) - LIST(APPEND NEL_DEFINITIONS ${${_UPNAME}_DEFINITIONS}) - ELSEIF(COMPONENT STREQUAL "sound") - FIND_PACKAGE(Ogg REQUIRED) - - IF(OGG_FOUND) - LIST(APPEND ${_UPNAME}_LIBRARIES ${OGG_LIBRARY}) - ENDIF() - - FIND_PACKAGE(Vorbis REQUIRED) - - IF(VORBIS_FOUND) - LIST(APPEND ${_UPNAME}_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY}) - ENDIF() - - IF(NEL_STATIC) - # Link to snd_lowlevel - FIND_LIBRARY_HELPER(nelsnd_lowlevel RELEASE nelsnd_lowlevel_r DEBUG nelsnd_lowlevel_d DIR ${NEL_DIR} REQUIRED) - - IF(NELSND_LOWLEVEL_LIBRARIES) - MESSAGE(STATUS "Found NeL sound lowlevel ${NELSND_LOWLEVEL_LIBRARIES}") - - LIST(APPEND NELSOUND_LIBRARIES ${NELSND_LOWLEVEL_LIBRARIES}) - - IF(NEL_STATIC_DRIVERS) - # DirectSound, XAudio2 and FMod drivers (only under Windows) - IF(WIN32) - # DirectSound - IF(NELDRIVER_DIRECTSOUND_LIBRARY_DEBUG) - LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_DIRECTSOUND_LIBRARY_DEBUG}) - ENDIF() - - IF(NELDRIVER_DIRECTSOUND_LIBRARY_RELEASE) - LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_DIRECTSOUND_LIBRARY_RELEASE}) - ENDIF() - - # FMod - IF(NELDRIVER_FMOD_LIBRARY_DEBUG) - LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_FMOD_LIBRARY_DEBUG}) - ENDIF() - - IF(NELDRIVER_FMOD_LIBRARY_RELEASE) - LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_FMOD_LIBRARY_RELEASE}) - ENDIF() - - # XAudio2 - IF(NELDRIVER_XAUDIO2_LIBRARY_DEBUG) - LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_XAUDIO2_LIBRARY_DEBUG}) - ENDIF() - - IF(NELDRIVER_XAUDIO2_LIBRARY_RELEASE) - LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_XAUDIO2_LIBRARY_RELEASE}) - ENDIF() - ENDIF() - - # OpenAL driver - IF(NELDRIVER_OPENAL_LIBRARY_DEBUG) - LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_OPENAL_LIBRARY_DEBUG}) - ENDIF() - - IF(NELDRIVER_OPENAL_LIBRARY_RELEASE) - LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_OPENAL_LIBRARY_RELEASE}) - ENDIF() - ENDIF() - ENDIF() - ENDIF() - ENDIF() - - LIST(APPEND NEL_LIBRARIES ${${_UPNAME}_LIBRARIES}) - ENDIF() -ENDFOREACH() - -MESSAGE_VERSION_PACKAGE_HELPER(NeL ${NEL_VERSION} ${NEL_MODULES_FOUND}) diff --git a/code/CMakeModules/FindOgg.cmake b/code/CMakeModules/FindOgg.cmake index c1f4492e1..8762afc5d 100644 --- a/code/CMakeModules/FindOgg.cmake +++ b/code/CMakeModules/FindOgg.cmake @@ -7,7 +7,7 @@ IF(OGG_LIBRARY AND OGG_INCLUDE_DIR) # in cache already SET(OGG_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR) FIND_PATH(OGG_INCLUDE_DIR @@ -41,9 +41,9 @@ IF(OGG_LIBRARY AND OGG_INCLUDE_DIR) SET(OGG_FOUND "YES") IF(NOT OGG_FIND_QUIETLY) MESSAGE(STATUS "Found Ogg: ${OGG_LIBRARY}") - ENDIF() -ELSE() + ENDIF(NOT OGG_FIND_QUIETLY) +ELSE(OGG_LIBRARY AND OGG_INCLUDE_DIR) IF(NOT OGG_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Ogg!") - ENDIF() -ENDIF() + ENDIF(NOT OGG_FIND_QUIETLY) +ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR) diff --git a/code/CMakeModules/FindOpenGLES.cmake b/code/CMakeModules/FindOpenGLES.cmake index 74a5b4021..35157b95b 100644 --- a/code/CMakeModules/FindOpenGLES.cmake +++ b/code/CMakeModules/FindOpenGLES.cmake @@ -43,7 +43,7 @@ IF(OPENGLES_GLES_LIBRARY) IF(OPENGLES_EGL_LIBRARY) SET(OPENGLES_EGL_FOUND "YES") SET(OPENGLES_LIBRARIES ${OPENGLES_EGL_LIBRARY} ${OPENGLES_LIBRARIES}) - ELSE() + ELSE(OPENGLES_EGL_LIBRARY) SET(OPENGLES_EGL_FOUND "NO") - ENDIF() -ENDIF() + ENDIF(OPENGLES_EGL_LIBRARY) +ENDIF(OPENGLES_GLES_LIBRARY) diff --git a/code/CMakeModules/FindRyzomGameShare.cmake b/code/CMakeModules/FindRyzomGameShare.cmake deleted file mode 100644 index f76e4dd93..000000000 --- a/code/CMakeModules/FindRyzomGameShare.cmake +++ /dev/null @@ -1,14 +0,0 @@ -INCLUDE(FindHelpers) - -FIND_PACKAGE_HELPER(RyzomGameShare game_share/continent.h RELEASE ryzom_gameshare_r ryzom_gameshare DEBUG ryzom_gameshare_d DIR ${NEL_DIR} ${RYZOM_DIR} SUFFIXES ryzom) - -IF(RYZOMGAMESHARE_FOUND) - FIND_PACKAGE(NeL REQUIRED) - LIST(APPEND RYZOMGAMESHARE_INCLUDE_DIRS ${NEL_INCLUDE_DIRS}) - LIST(APPEND RYZOMGAMESHARE_LIBRARIES ${NELMISC_LIBRARIES} ${NELLIGO_LIBRARIES} ${NELNET_LIBRARIES} ${NELGEORGES_LIBRARIES}) - - SET(RYZOM_GAMESHARE_LIBRARIES ${RYZOMGAMESHARE_LIBRARIES}) - SET(RYZOM_GAMESHARE_FOUND ${RYZOMGAMESHARE_FOUND}) - SET(RYZOM_GAMESHARE_INCLUDE_DIR ${RYZOMGAMESHARE_INCLUDE_DIR}) - SET(RYZOM_GAMESHARE_INCLUDE_DIRS ${RYZOMGAMESHARE_INCLUDE_DIRS}) -ENDIF() diff --git a/code/CMakeModules/FindSTLport.cmake b/code/CMakeModules/FindSTLport.cmake index 68e542ea5..22e0745ba 100644 --- a/code/CMakeModules/FindSTLport.cmake +++ b/code/CMakeModules/FindSTLport.cmake @@ -9,7 +9,7 @@ IF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR) # in cache already SET(STLPORT_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR) FIND_PATH(STLPORT_INCLUDE_DIR iostream @@ -74,18 +74,18 @@ IF(STLPORT_INCLUDE_DIR) SET(STLPORT_LIBRARIES ${STLPORT_LIBRARY_RELEASE}) IF(STLPORT_LIBRARY_DEBUG) SET(STLPORT_LIBRARIES optimized ${STLPORT_LIBRARIES} debug ${STLPORT_LIBRARY_DEBUG}) - ENDIF() - ENDIF() -ENDIF() + ENDIF(STLPORT_LIBRARY_DEBUG) + ENDIF(STLPORT_LIBRARY_RELEASE) +ENDIF(STLPORT_INCLUDE_DIR) IF(STLPORT_FOUND) IF(NOT STLPORT_FIND_QUIETLY) MESSAGE(STATUS "Found STLport: ${STLPORT_LIBRARIES}") - ENDIF() -ELSE() + ENDIF(NOT STLPORT_FIND_QUIETLY) +ELSE(STLPORT_FOUND) IF(NOT STLPORT_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find STLport!") - ENDIF() -ENDIF() + ENDIF(NOT STLPORT_FIND_QUIETLY) +ENDIF(STLPORT_FOUND) MARK_AS_ADVANCED(STLPORT_LIBRARY_RELEASE STLPORT_LIBRARY_DEBUG) diff --git a/code/CMakeModules/FindSquish.cmake b/code/CMakeModules/FindSquish.cmake index 4242f4055..61250fec1 100644 --- a/code/CMakeModules/FindSquish.cmake +++ b/code/CMakeModules/FindSquish.cmake @@ -10,7 +10,7 @@ IF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR) # in cache already SET(SQUISH_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR) FIND_PATH(SQUISH_INCLUDE_DIR squish.h @@ -58,26 +58,26 @@ IF(SQUISH_INCLUDE_DIR) SET(SQUISH_LIBRARIES "optimized;${SQUISH_LIBRARY_RELEASE}") IF(SQUISH_LIBRARY_DEBUG) SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_DEBUG}") - ELSE() + ELSE(SQUISH_LIBRARY_DEBUG) SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_RELEASE}") MESSAGE("Debug Squish NOT found, using the release version!") - ENDIF() - ENDIF() -ENDIF() + ENDIF(SQUISH_LIBRARY_DEBUG) + ENDIF(SQUISH_LIBRARY_RELEASE) +ENDIF(SQUISH_INCLUDE_DIR) IF(SQUISH_FOUND) IF(NOT SQUISH_FIND_QUIETLY) MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARIES}") - ENDIF() + ENDIF(NOT SQUISH_FIND_QUIETLY) FILE(STRINGS ${SQUISH_INCLUDE_DIR}/squish.h METRIC REGEX "metric = 0") IF(METRIC) SET(SQUISH_COMPRESS_HAS_METRIC ON) SET(SQUISH_DEFINITIONS -DSQUISH_COMPRESS_HAS_METRIC) - ENDIF() -ELSE() + ENDIF(METRIC) +ELSE(SQUISH_FOUND) IF(NOT SQUISH_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Squish!") - ENDIF() -ENDIF() + ENDIF(NOT SQUISH_FIND_QUIETLY) +ENDIF(SQUISH_FOUND) MARK_AS_ADVANCED(SQUISH_LIBRARY_RELEASE SQUISH_LIBRARY_DEBUG) diff --git a/code/CMakeModules/FindSteam.cmake b/code/CMakeModules/FindSteam.cmake deleted file mode 100644 index 8d9b12372..000000000 --- a/code/CMakeModules/FindSteam.cmake +++ /dev/null @@ -1,74 +0,0 @@ -# - Locate Steam API -# This module defines -# STEAM_LIBRARY, the library to link against -# STEAM_FOUND, if false, do not try to link to STEAM -# STEAM_INCLUDE_DIR, where to find headers. - -IF(STEAM_LIBRARY AND STEAM_INCLUDE_DIR) - # in cache already - SET(Steam_FIND_QUIETLY TRUE) -ENDIF() - - -FIND_PATH(STEAM_INCLUDE_DIR - steam_api.h - PATH_SUFFIXES steam - PATHS - $ENV{STEAM_DIR}/public -) - -IF(WIN32) - IF(TARGET_X64) - SET(STEAM_LIBNAME steam_api64) - SET(STEAM_RUNTIMENAME steam_api64.dll) - SET(STEAM_PATHNAME redistributable_bin/win64) - ELSE() - SET(STEAM_LIBNAME steam_api) - SET(STEAM_RUNTIMENAME steam_api.dll) - SET(STEAM_PATHNAME redistributable_bin) - ENDIF() -ELSEIF(APPLE) - # universal binary - SET(STEAM_LIBNAME steam_api) - SET(STEAM_RUNTIMENAME libsteam_api.dylib) - SET(STEAM_PATHNAME redistributable_bin/osx32) -ELSE() - SET(STEAM_LIBNAME steam_api) - SET(STEAM_RUNTIMENAME libsteam_api.so) - IF(TARGET_X64) - SET(STEAM_PATHNAME redistributable_bin/linux64) - ELSE() - SET(STEAM_PATHNAME redistributable_bin/linux32) - ENDIF() -ENDIF() - -FIND_LIBRARY(STEAM_LIBRARY - NAMES ${STEAM_LIBNAME} - HINTS - $ENV{STEAM_DIR}/${STEAM_PATHNAME} -) - -FIND_FILE(STEAM_RUNTIME - NAMES ${STEAM_RUNTIMENAME} - HINTS - $ENV{STEAM_DIR}/${STEAM_PATHNAME} - PATHS - ${EXTERNAL_BINARY_PATH} - ${CMAKE_LIBRARY_PATH} - /usr/local/lib - /usr/lib -) - -# Don't need to check STEAM_LIBRARY because we're dynamically loading Steam DLL -IF(STEAM_INCLUDE_DIR) - SET(STEAM_FOUND ON) - SET(STEAM_LIBRARIES ${STEAM_LIBRARY}) - SET(STEAM_INCLUDE_DIRS ${STEAM_INCLUDE_DIR}) - IF(NOT Steam_FIND_QUIETLY) - MESSAGE(STATUS "Found Steam: ${STEAM_INCLUDE_DIR} and ${STEAM_RUNTIME}") - ENDIF() -ELSE() - IF(NOT Steam_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find Steam!") - ENDIF() -ENDIF() diff --git a/code/CMakeModules/FindVorbis.cmake b/code/CMakeModules/FindVorbis.cmake index 234d2d31a..95883fa59 100644 --- a/code/CMakeModules/FindVorbis.cmake +++ b/code/CMakeModules/FindVorbis.cmake @@ -7,7 +7,7 @@ IF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR) # in cache already SET(VORBIS_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR) FIND_PATH(VORBIS_INCLUDE_DIR @@ -57,9 +57,9 @@ IF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR) SET(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY}) IF(NOT VORBIS_FIND_QUIETLY) MESSAGE(STATUS "Found Vorbis: ${VORBIS_LIBRARY}") - ENDIF() -ELSE() + ENDIF(NOT VORBIS_FIND_QUIETLY) +ELSE(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR) IF(NOT VORBIS_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Vorbis!") - ENDIF() -ENDIF() + ENDIF(NOT VORBIS_FIND_QUIETLY) +ENDIF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 3d9c43bd9..43864c6a6 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -35,7 +35,7 @@ MACRO(DETECT_WINKIT_VERSION _VERSION _SUFFIX) SET(WINSDK${_VERSION}_FOUND ON) SET(WINSDK${_VERSION}_VERSION_FULL "${_VERSION}") IF(NOT WindowsSDK_FIND_QUIETLY) - MESSAGE(STATUS "Found Windows Kit ${_VERSION} in ${WINSDK${_VERSION}_DIR}") + MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}") ENDIF() LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION}) ELSE() @@ -240,11 +240,7 @@ MACRO(USE_CURRENT_WINSDK) IF(NOT WINSDK_DIR) # Use Windows SDK versions installed with VC++ when possible - IF(MSVC_VERSION GREATER 1909) - # Special case, use Kits for SDK - SET(WINSDK_VERSION "10.0") - SET(WINSDK_DIR ${WINSDK_UCRT_DIR}) - ELSEIF(MSVC14) + IF(MSVC14) SET(WINSDK_VERSION "8.1") ELSEIF(MSVC12) SET(WINSDK_VERSION "8.1") @@ -259,19 +255,8 @@ MACRO(USE_CURRENT_WINSDK) SET(WINSDK_VERSION "6.0A") ENDIF() ELSEIF(MSVC80) - SET(WINSDK_MSVC80_COMPATIBLES "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A" "5.2A") - - # look for each Windows SDK supported by VC++ 2005 (7.1 is the latest) - FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS}) - # look if this version of Windows SDK is installed - LIST(FIND WINSDK_MSVC80_COMPATIBLES ${_VERSION} _FOUND) - IF(NOT _FOUND EQUAL -1) - SET(WINSDK_VERSION "${_VERSION}") - BREAK() - ENDIF() - ENDFOREACH() - - IF(NOT MSVC_EXPRESS AND NOT WINSDK_VERSION) + IF(NOT MSVC_EXPRESS) + # TODO: fix this version SET(WINSDK_VERSION "5.2A") ENDIF() ELSE() @@ -309,7 +294,7 @@ MACRO(USE_CURRENT_WINSDK) ENDMACRO() IF(MSVC14) - # Under VC++ 2015 and 2017, stdio.h, stdlib.h, etc... are part of UCRT + # Under VC++ 2015, stdio.h, stdlib.h, etc... are part of UCRT SET(WINSDK_UCRT_VERSION "10.0") ENDIF() @@ -318,40 +303,6 @@ IF(WINSDK_UCRT_VERSION AND WINSDK${WINSDK_UCRT_VERSION}_FOUND) SET(WINSDK_UCRT_DIR "${WINSDK${WINSDK_UCRT_VERSION}_DIR}") ENDIF() -IF(WINSDK_UCRT_DIR) - # determine exact UCRT version - SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include) - SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib) - - FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*) - SET(UCRT_VERSION) - - FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS}) - IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION) - SET(UCRT_VERSION ${UCRT_SUBDIR}) - ENDIF() - ENDFOREACH() - - IF(UCRT_VERSION) - MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}") - - SET(WINSDK10_INCLUDE_DIR ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION}) - SET(WINSDK10_LIBRARY_DIR ${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION}) - - # directory where UCRT headers are found - FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h - HINTS - ${WINSDK10_INCLUDE_DIR}/ucrt - ) - - # directory where UCRT libraries are found - FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib - HINTS - ${WINSDK10_LIBRARY_DIR}/ucrt/${WINSDK8_SUFFIX} - ) - ENDIF() -ENDIF() - IF(WINSDK_VERSION STREQUAL "CURRENT") USE_CURRENT_WINSDK() ELSE() @@ -372,87 +323,93 @@ ENDIF() # directory where Win32 headers are found FIND_PATH(WINSDK_INCLUDE_DIR Windows.h HINTS - ${WINSDK_DIR}/Include/${UCRT_VERSION}/um ${WINSDK_DIR}/Include/um ${WINSDK_DIR}/Include - NO_DEFAULT_PATH ) -MESSAGE(STATUS "Found Windows.h in ${WINSDK_INCLUDE_DIR}") - # directory where WinRT headers are found FIND_PATH(WINSDK_WINRT_INCLUDE_DIR winstring.h HINTS - ${WINSDK_DIR}/Include/${UCRT_VERSION}/winrt ${WINSDK_DIR}/Include/winrt - NO_DEFAULT_PATH ) -MESSAGE(STATUS "Found winstring.h in ${WINSDK_WINRT_INCLUDE_DIR}") - # directory where DirectX headers are found FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h HINTS - ${WINSDK_DIR}/Include/${UCRT_VERSION}/shared ${WINSDK_DIR}/Include/shared - NO_DEFAULT_PATH ) -MESSAGE(STATUS "Found d3d9.h in ${WINSDK_SHARED_INCLUDE_DIR}") - # directory where OpenGL headers are found FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h HINTS - ${WINSDK_INCLUDE_DIR}/gl ${WINSDK_DIR}/Include/um/gl ${WINSDK_DIR}/Include/gl - NO_DEFAULT_PATH ) -MESSAGE(STATUS "Found GL.h in ${WINSDK_OPENGL_INCLUDE_DIR}") - SET(WINSDK_LIBRARY_DIRS - ${WINSDK_DIR}/Lib/${UCRT_VERSION}/um/${WINSDK8_SUFFIX} ${WINSDK_DIR}/Lib/winv6.3/um/${WINSDK8_SUFFIX} ${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX} ) IF(WINSDK_SUFFIXES) FOREACH(_SUFFIX ${WINSDK_SUFFIXES}) - LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib/${_SUFFIX}) + SET(WINSDK_LIBRARY_DIRS ${WINSDK_LIBRARY_DIRS} ${WINSDK_DIR}/Lib/${_SUFFIX}) ENDFOREACH() ELSE() - LIST(APPEND WINSDK_LIBRARY_DIRS ${WINSDK_DIR}/Lib) + 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_LIBRARY_DIRS} - NO_DEFAULT_PATH ) -MESSAGE(STATUS "Found ComCtl32.lib in ${WINSDK_LIBRARY_DIR}") +IF(WINSDK_UCRT_DIR) + # determine exact UCRT version + SET(WINSDK_UCRT_INCLUDE_ROOT_DIR ${WINSDK_UCRT_DIR}/Include) + SET(WINSDK_UCRT_LIB_ROOT_DIR ${WINSDK_UCRT_DIR}/Lib) -SET(WINSDK_BINARY_DIRS - ${WINSDK_DIR}/Bin/${UCRT_VERSION}/${WINSDK8_SUFFIX} + FILE(GLOB UCRT_SUBDIRS RELATIVE ${WINSDK_UCRT_INCLUDE_ROOT_DIR} ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/*) + SET(UCRT_VERSION) + + FOREACH(UCRT_SUBDIR ${UCRT_SUBDIRS}) + IF(NOT UCRT_VERSION OR UCRT_SUBDIR VERSION_GREATER UCRT_VERSION) + SET(UCRT_VERSION ${UCRT_SUBDIR}) + ENDIF() + ENDFOREACH() + + IF(UCRT_VERSION) + MESSAGE(STATUS "Using Windows UCRT ${UCRT_VERSION}") + + # directory where UCRT headers are found + FIND_PATH(WINSDK_UCRT_INCLUDE_DIR corecrt.h + HINTS + ${WINSDK_UCRT_INCLUDE_ROOT_DIR}/${UCRT_VERSION}/ucrt + ) + + # directory where UCRT libraries are found + FIND_PATH(WINSDK_UCRT_LIBRARY_DIR ucrt.lib + HINTS + ${WINSDK_UCRT_LIB_ROOT_DIR}/${UCRT_VERSION}/ucrt/${WINSDK8_SUFFIX} + ) + ENDIF() +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 ) -# signtool is used to sign executables -FIND_PROGRAM(WINSDK_SIGNTOOL signtool - HINTS - ${WINSDK_BINARY_DIRS} - NO_DEFAULT_PATH -) - # midl is used to generate IDL interfaces FIND_PROGRAM(WINSDK_MIDL midl HINTS - ${WINSDK_BINARY_DIRS} - NO_DEFAULT_PATH + ${WINSDK_DIR}/Bin/${WINSDK8_SUFFIX} + ${WINSDK_DIR}/Bin/x86 + ${WINSDK_DIR}/Bin ) IF(WINSDK_INCLUDE_DIR) @@ -476,7 +433,7 @@ IF(WINSDK_INCLUDE_DIR) SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIRS} ${WINSDK_WINRT_INCLUDE_DIR}) ENDIF() - INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) + 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}) @@ -484,8 +441,8 @@ IF(WINSDK_INCLUDE_DIR) SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) - # Fix for using Windows SDK 7.1 with Visual C++ 2012, 2013, 2015 and 2017 - IF(WINSDK_VERSION STREQUAL "7.1" AND (MSVC11 OR MSVC12 OR MSVC14)) + # 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() ELSE() diff --git a/code/CMakeModules/FindXF86VidMode.cmake b/code/CMakeModules/FindXF86VidMode.cmake index 15dae03de..88fa40ad7 100644 --- a/code/CMakeModules/FindXF86VidMode.cmake +++ b/code/CMakeModules/FindXF86VidMode.cmake @@ -7,7 +7,7 @@ IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR) # in cache already SET(XF86VidMode_FIND_QUIETLY TRUE) -ENDIF() +ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR) FIND_PATH(XF86VidMode_INCLUDE_DIR @@ -37,10 +37,10 @@ IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR) SET(XF86VidMode_DEFINITIONS -DXF86VIDMODE) IF(NOT XF86VidMode_FIND_QUIETLY) MESSAGE(STATUS "Found XF86VidMode: ${XF86VidMode_LIBRARY}") - ENDIF() -ELSE() + ENDIF(NOT XF86VidMode_FIND_QUIETLY) +ELSE(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR) IF(NOT XF86VidMode_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find XF86VidMode!") - ENDIF() -ENDIF() + ENDIF(NOT XF86VidMode_FIND_QUIETLY) +ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR) diff --git a/code/CMakeModules/Findassimp.cmake b/code/CMakeModules/Findassimp.cmake index b4bf0da99..41e53cf94 100644 --- a/code/CMakeModules/Findassimp.cmake +++ b/code/CMakeModules/Findassimp.cmake @@ -1,63 +1,29 @@ -IF(assimp_FIND_REQUIRED) - SET(ASSIMP_FIND_REQUIRED ON) -ENDIF() - FIND_PATH( - ASSIMP_INCLUDE_DIRS + assimp_INCLUDE_DIRS NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h assimp/cimport.h PATHS /usr/local/include/ ) FIND_LIBRARY( - ASSIMP_LIBRARY_RELEASE + assimp_LIBRARIES NAMES assimp PATHS /usr/local/lib/ ) -FIND_LIBRARY( - IRRXML_LIBRARY_RELEASE - NAMES IrrXML - PATHS /usr/local/lib/ -) - -FIND_LIBRARY( - ASSIMP_LIBRARY_DEBUG - NAMES assimpd - PATHS /usr/local/lib/ -) - -FIND_LIBRARY( - IRRXML_LIBRARY_DEBUG - NAMES IrrXMLd - PATHS /usr/local/lib/ -) - -IF (ASSIMP_INCLUDE_DIRS) - SET(ASSIMP_FOUND TRUE) - IF(ASSIMP_LIBRARY_RELEASE) - SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} optimized ${ASSIMP_LIBRARY_RELEASE}) - ENDIF() - IF(ASSIMP_LIBRARY_DEBUG) - SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} debug ${ASSIMP_LIBRARY_DEBUG}) - ENDIF() +IF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES) + SET(assimp_FOUND TRUE) FIND_PACKAGE(ZLIB) IF(ZLIB_FOUND) - SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} ${ZLIB_LIBRARIES}) + SET(assimp_LIBRARIES ${assimp_LIBRARIES} ${ZLIB_LIBRARIES}) ENDIF() - IF(IRRXML_LIBRARY_RELEASE) - SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} optimized ${IRRXML_LIBRARY_RELEASE}) - ENDIF() - IF(IRRXML_LIBRARY_DEBUG) - SET(ASSIMP_LIBRARIES ${ASSIMP_LIBRARIES} debug ${IRRXML_LIBRARY_DEBUG}) - ENDIF() -ENDIF() +ENDIF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES) -IF (ASSIMP_FOUND) - IF (NOT ASSIMP_FIND_QUIETLY) - MESSAGE(STATUS "Found asset importer library: ${ASSIMP_LIBRARIES}") - ENDIF () -ELSE (ASSIMP_FOUND) - IF (ASSIMP_FIND_REQUIRED) +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 () -ENDIF () + ENDIF (assimp_FIND_REQUIRED) +ENDIF (assimp_FOUND) diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake index 17a617ba3..b29a8763e 100644 --- a/code/CMakeModules/GetRevision.cmake +++ b/code/CMakeModules/GetRevision.cmake @@ -1,103 +1,86 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) - -# ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory) -# SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt) -# BINARY_DIR should be set to root of your build directory - -IF(SOURCE_DIR) - # Replace spaces by semi-columns - IF(CMAKE_MODULE_PATH) - STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) - ENDIF() - - SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH}) - - IF(NOT ROOT_DIR AND SOURCE_DIR) - SET(ROOT_DIR ${SOURCE_DIR}) - ENDIF() - - IF(NOT SOURCE_DIR AND ROOT_DIR) - SET(SOURCE_DIR ${ROOT_DIR}) - ENDIF() -ELSE() - SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}) - SET(ROOT_DIR ${CMAKE_SOURCE_DIR}/..) - - # convert ROOT_DIR to absolute path - GET_FILENAME_COMPONENT(ROOT_DIR ${ROOT_DIR} ABSOLUTE) -ENDIF() - -MACRO(NOW RESULT) - IF(CMAKE_VERSION VERSION_GREATER "2.8.10") - STRING(TIMESTAMP ${RESULT} "%Y-%m-%d %H:%M:%S") - ELSE() - IF(WIN32) - EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME) - IF(NOT DATETIME MATCHES "ERROR") - STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}") - ENDIF() - ELSEIF(UNIX) - EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME) - STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}") - ELSE() - MESSAGE(SEND_ERROR "date not implemented") - SET(${RESULT} "0000-00-00 00:00:00") - ENDIF() - ENDIF() -ENDMACRO() - -IF(EXISTS "${ROOT_DIR}/.svn/") - FIND_PACKAGE(Subversion QUIET) - - IF(SUBVERSION_FOUND) - Subversion_WC_INFO(${ROOT_DIR} ER) - SET(REVISION ${ER_WC_REVISION}) - ENDIF() - - FIND_PACKAGE(TortoiseSVN QUIET) - - IF(TORTOISESVN_FOUND) - TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION) - ENDIF() -ENDIF() - -IF(EXISTS "${ROOT_DIR}/.hg/") - FIND_PACKAGE(Mercurial) - - IF(MERCURIAL_FOUND) - Mercurial_WC_INFO(${ROOT_DIR} ER) - SET(REVISION ${ER_WC_REVISION}) - SET(CHANGESET ${ER_WC_CHANGESET}) - SET(BRANCH ${ER_WC_BRANCH}) - ENDIF() -ENDIF() - -IF(EXISTS "${ROOT_DIR}/.git/") - FIND_PACKAGE(Git) - - IF(GIT_FOUND) - Git_WC_INFO(${ROOT_DIR} ER) - SET(REVISION ${ER_WC_REVISION}) - SET(CHANGESET ${ER_WC_CHANGESET}) - ENDIF() -ENDIF() - -# if processing exported sources, use "revision" file if exists -IF(SOURCE_DIR AND NOT DEFINED REVISION) - SET(REVISION_FILE ${SOURCE_DIR}/revision) - IF(EXISTS ${REVISION_FILE}) - FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1) - MESSAGE(STATUS "Read revision ${REVISION} from file") - ENDIF() -ENDIF() - -# Prevent crash if no revision from git or mercurial found -IF(NOT DEFINED REVISION) - SET(REVISION 0) -ENDIF() - -IF(DEFINED REVISION) - MESSAGE(STATUS "Found revision ${REVISION}") -ELSE() - SET(REVISION 0) -ENDIF() +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) + +# ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory) +# SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt) +# BINARY_DIR should be set to root of your build directory + +IF(SOURCE_DIR) + # Replace spaces by semi-columns + IF(CMAKE_MODULE_PATH) + STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) + ENDIF() + + SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH}) + + IF(NOT ROOT_DIR AND SOURCE_DIR) + SET(ROOT_DIR ${SOURCE_DIR}) + ENDIF() + + IF(NOT SOURCE_DIR AND ROOT_DIR) + SET(SOURCE_DIR ${ROOT_DIR}) + ENDIF() +ELSE() + SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}) + SET(ROOT_DIR ${CMAKE_SOURCE_DIR}/..) + + # convert ROOT_DIR to absolute path + GET_FILENAME_COMPONENT(ROOT_DIR ${ROOT_DIR} ABSOLUTE) +ENDIF() + +MACRO(NOW RESULT) + IF(CMAKE_VERSION VERSION_GREATER "2.8.10") + STRING(TIMESTAMP ${RESULT} "%Y-%m-%d %H:%M:%S") + ELSE() + IF(WIN32) + EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME) + IF(NOT DATETIME MATCHES "ERROR") + STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}") + ENDIF() + ELSEIF(UNIX) + EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME) + STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}") + ELSE() + MESSAGE(SEND_ERROR "date not implemented") + SET(${RESULT} "0000-00-00 00:00:00") + ENDIF() + ENDIF() +ENDMACRO() + +IF(EXISTS "${ROOT_DIR}/.svn/") + FIND_PACKAGE(Subversion QUIET) + + IF(SUBVERSION_FOUND) + Subversion_WC_INFO(${ROOT_DIR} ER) + SET(REVISION ${ER_WC_REVISION}) + ENDIF() + + FIND_PACKAGE(TortoiseSVN QUIET) + + IF(TORTOISESVN_FOUND) + TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION) + ENDIF() +ENDIF() + +IF(EXISTS "${ROOT_DIR}/.hg/") + FIND_PACKAGE(Mercurial) + + IF(MERCURIAL_FOUND) + Mercurial_WC_INFO(${ROOT_DIR} ER) + SET(REVISION ${ER_WC_REVISION}) + SET(CHANGESET ${ER_WC_CHANGESET}) + SET(BRANCH ${ER_WC_BRANCH}) + ENDIF() +ENDIF() + +# if processing exported sources, use "revision" file if exists +IF(SOURCE_DIR AND NOT DEFINED REVISION) + SET(REVISION_FILE ${SOURCE_DIR}/revision) + IF(EXISTS ${REVISION_FILE}) + FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1) + MESSAGE(STATUS "Read revision ${REVISION} from file") + ENDIF() +ENDIF() + +IF(DEFINED REVISION) + MESSAGE(STATUS "Found revision ${REVISION}") +ENDIF() diff --git a/code/CMakeModules/OSXToolChain.cmake b/code/CMakeModules/OSXToolChain.cmake deleted file mode 100644 index 3169aec78..000000000 --- a/code/CMakeModules/OSXToolChain.cmake +++ /dev/null @@ -1,131 +0,0 @@ -# Define OSX_SDK to force a specific version such as : -DOSX_SDK=10.11 -# -# Example: -# cmake ../code -DCMAKE_TOOLCHAIN_FILE=../code/CMakeModules/OSXToolChain.cmake -DWITH_NEL_TESTS=OFF -DWITH_RYZOM_SERVER=OFF -DWITH_NEL_TOOLS=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_LUA51=OFF -DWITH_LUA53=ON -DCMAKE_BUILD_TYPE=Release -DWITH_RYZOM_INSTALLER=OFF -DWITH_RYZOM_PATCH=ON -DWITH_NEL_TESTS=OFF -DWITH_NEL_TOOLS=OFF -DWITH_TOOLS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_WARNINGS=OFF -DWITH_QT5=OFF -DWITH_STATIC=ON -DWITH_STATIC_DRIVERS=ON -DWITH_STATIC_EXTERNAL=ON -DWITH_UNIX_STRUCTURE=OFF -DWITH_INSTALL_LIBRARIES=OFF -DWITH_RYZOM_SANDBOX=OFF -DOSX_SDK=10.11 - -# Don't forget to define environment variables: -# -# export MACOSX_DEPLOYMENT_TARGET=10.7 -# export OSXCROSS_GCC_NO_STATIC_RUNTIME=1 -# export PATH=$PATH:/home/src/osxcross/target/bin -# -# ln -s /usr/bin/hg /home/src/osxcross/target/bin/hg -# -# To install all dependencies: -# ./osxcross-macports install libxml2 jpeg curl libogg libvorbis freetype boost openssl zlib lua-5.3 giflib - -# to compile Luabind -# export CMAKE_MODULE_PATH=$HOME/shard/tools/external/cmake/modules -# cmake .. -DCMAKE_TOOLCHAIN_FILE=$HOME/ryzomcore/code/CMakeModules/OSXToolChain.cmake -DWITH_SHARED=OFF -DWITH_STATIC=ON -DWITH_LUA51=OFF -DWITH_LUA53=ON -DCMAKE_INSTALL_PREFIX=$HOME/osxcross/target/external - -IF(DEFINED CMAKE_CROSSCOMPILING) - # subsequent toolchain loading is not really needed - RETURN() -ENDIF() - -# Force the compilers to Clang for OS X - -# C -SET(CMAKE_C_COMPILER x86_64-apple-darwin15-clang) -SET(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11") -SET(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") -SET(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") -SET(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") -SET(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") - -# C++ -SET(CMAKE_CXX_COMPILER x86_64-apple-darwin15-clang++) -SET(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17") -SET(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") -SET(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") -SET(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") -SET(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") - -# make -SET(CMAKE_MAKE_PROGRAM make) - -# Skip the platform compiler checks for cross compiling. -SET(CMAKE_CXX_COMPILER_FORCED TRUE) -SET(CMAKE_C_COMPILER_FORCED TRUE) - -# Check if osxcross is installed -EXECUTE_PROCESS(COMMAND which ${CMAKE_CXX_COMPILER} OUTPUT_VARIABLE COMPILER_FULLPATH OUTPUT_STRIP_TRAILING_WHITESPACE) - -IF(NOT COMPILER_FULLPATH) - MESSAGE(FATAL_ERROR "Unable to find ${CMAKE_CXX_COMPILER}, are you sure osxcross is installed and is in PATH?") -ENDIF() - -# Default paths -GET_FILENAME_COMPONENT(CMAKE_OSX_TOOLCHAIN_ROOT ${COMPILER_FULLPATH} DIRECTORY) - -# Parent directory -GET_FILENAME_COMPONENT(CMAKE_OSX_TOOLCHAIN_ROOT ${CMAKE_OSX_TOOLCHAIN_ROOT} DIRECTORY) - -SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_TOOLCHAIN_ROOT}/SDK) -SET(MACPORTS_ROOT_DIR ${CMAKE_OSX_TOOLCHAIN_ROOT}/macports/pkgs/opt/local) -SET(EXTERNAL_OSX_PATH ${CMAKE_OSX_TOOLCHAIN_ROOT}/external) - -# List of all SDKs that have been found -SET(OSX_SDKS) - -FILE(GLOB _CMAKE_OSX_SDKS "${CMAKE_OSX_SYSROOT}/MacOSX*") -IF(_CMAKE_OSX_SDKS) - LIST(SORT _CMAKE_OSX_SDKS) - LIST(REVERSE _CMAKE_OSX_SDKS) - FOREACH(_CMAKE_OSX_SDK ${_CMAKE_OSX_SDKS}) - STRING(REGEX REPLACE ".+MacOSX([0-9.]+)\\.sdk" "\\1" _OSX_SDK "${_CMAKE_OSX_SDK}") - LIST(APPEND OSX_SDKS ${_OSX_SDK}) - ENDFOREACH() -ENDIF() - -# Find and use the most recent OS X sdk -IF(NOT OSX_SDKS) - MESSAGE(FATAL_ERROR "No OS X SDK's found in default search path ${CMAKE_OSX_SYSROOT}.") -ENDIF() - -# if a specific SDK is defined, try to use it -IF(OSX_SDK) - LIST(FIND OSX_SDKS "${OSX_SDK}" _INDEX) - IF(_INDEX EQUAL -1) - # if specified SDK doesn't exist, use the last one - LIST(GET OSX_SDKS 0 OSX_SDK) - ENDIF() -ELSE() - # use the last SDK - LIST(GET OSX_SDKS 0 OSX_SDK) -ENDIF() - -MESSAGE(STATUS "Using OS X SDK ${OSX_SDK}") - -# Define final OS X sysroot -SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT}/MacOSX${OSX_SDK}.sdk) - -# Standard settings -SET(CMAKE_SYSTEM_NAME Darwin) -SET(CMAKE_SYSTEM "Darwin-15.0.0") -SET(CMAKE_SYSTEM_VERSION "15.0.0") -SET(CMAKE_SYSTEM_PROCESSOR "x86_64") - -SET(UNIX ON) -SET(APPLE ON) - -# Set the find root to the OS X developer roots and to user defined paths -SET(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_TOOLCHAIN_ROOT} ${CMAKE_OSX_SYSROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} ${MACPORTS_ROOT_DIR} ${EXTERNAL_OSX_PATH} $ENV{EXTERNAL_OSX_PATH} CACHE STRING "OS X find search path root") - -# default to searching for frameworks first -SET(CMAKE_FIND_FRAMEWORK FIRST) - -# set up the default search directories for frameworks -SET(CMAKE_SYSTEM_FRAMEWORK_PATH - ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks - ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks - ${CMAKE_OSX_SYSROOT}/Developer/Library/Frameworks -) - -# only search the OS X sdks, not the remainder of the host filesystem -SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) -SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - -# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH -INCLUDE(CMakeFindBinUtils) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 5069ec40f..20539e87f 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -27,63 +27,23 @@ ELSE() ENDIF() ENDIF() -MACRO(APPEND_DEFINITION _NAME _VAL) - IF(CMAKE_VERSION VERSION_LESS "2.8.12") - # don't support logical expressions, append definition - LIST(APPEND ${_NAME} "-D${_VAL}") - ELSE() - # support logical expressions, use them - LIST(APPEND ${_NAME} "$<$:-D$>") - ENDIF() -ENDMACRO() - # Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs MACRO(PCH_SET_COMPILE_FLAGS _target) SET(PCH_FLAGS) SET(PCH_ARCHS) - SET(PCH_INCLUDES) - # Append target for clang if defined - IF(CMAKE_CXX_COMPILER_TARGET) - LIST(APPEND PCH_FLAGS "--target=${CMAKE_CXX_COMPILER_TARGET}") - ENDIF() + SET(_FLAGS) + LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS}) - IF(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) - LIST(APPEND PCH_FLAGS "--gcc-toolchain=${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") - ENDIF() - - IF(CMAKE_SYSROOT) - LIST(APPEND PCH_FLAGS "--sysroot=${CMAKE_SYSROOT}") - ENDIF() - - IF(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES) - FOREACH(item ${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES}) - LIST(APPEND PCH_FLAGS "-isystem ${item}") - ENDFOREACH() - ENDIF() - - # C++ flags - SET(_FLAGS ${CMAKE_CXX_FLAGS}) - SEPARATE_ARGUMENTS(_FLAGS) - - LIST(APPEND PCH_FLAGS ${_FLAGS}) - - # C++ config flags STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD) - - SET(_FLAGS ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}) - SEPARATE_ARGUMENTS(_FLAGS) - - LIST(APPEND PCH_FLAGS ${_FLAGS}) + LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}") GET_TARGET_PROPERTY(_targetType ${_target} TYPE) SET(_USE_PIC OFF) IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY") - SET(_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) - SEPARATE_ARGUMENTS(_FLAGS) - LIST(APPEND PCH_FLAGS ${_FLAGS}) + LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") ELSE() GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE) IF(_pic) @@ -93,90 +53,70 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES) FOREACH(item ${DIRINC}) - LIST(APPEND PCH_INCLUDES "${item}") + LIST(APPEND _FLAGS " -I\"${item}\"") ENDFOREACH() - # NOTE: As cmake files (eg FindQT4) may now use generator expressions around their defines that evaluate - # to an empty string, wrap all "items" in an expression that outputs a -D IFF the generated - # expression is not empty. - # Required for CMake 2.6 SET(GLOBAL_DEFINITIONS) GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") ENDFOREACH() ENDIF() GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") ENDFOREACH() ENDIF() - GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS) + GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") ENDFOREACH() ENDIF() - GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD}) + GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") ENDFOREACH() ENDIF() GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS) IF(oldProps) - SET(_FLAGS ${oldProps}) - SEPARATE_ARGUMENTS(_FLAGS) - LIST(APPEND PCH_FLAGS ${_FLAGS}) + LIST(APPEND _FLAGS " ${oldProps}") ENDIF() GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD}) IF(oldPropsBuild) - SET(_FLAGS ${oldPropsBuild}) - SEPARATE_ARGUMENTS(_FLAGS) - LIST(APPEND PCH_FLAGS ${_FLAGS}) + LIST(APPEND _FLAGS " ${oldPropsBuild}") ENDIF() GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES) IF(DIRINC) FOREACH(item ${DIRINC}) - LIST(APPEND PCH_INCLUDES "${item}") + LIST(APPEND _FLAGS " -I\"${item}\"") ENDFOREACH() ENDIF() GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") ENDFOREACH() ENDIF() GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") ENDFOREACH() ENDIF() - GET_TARGET_PROPERTY(OPTIONS ${_target} COMPILE_OPTIONS) - IF(OPTIONS) - SEPARATE_ARGUMENTS(OPTIONS) - LIST(APPEND PCH_FLAGS ${OPTIONS}) - ENDIF() - - GET_TARGET_PROPERTY(OPTIONS ${_target} COMPILE_OPTIONS_${_UPPER_BUILD}) - IF(OPTIONS) - SEPARATE_ARGUMENTS(OPTIONS) - LIST(APPEND PCH_FLAGS ${OPTIONS}) - ENDIF() - GET_TARGET_PROPERTY(_LIBS ${_target} INTERFACE_LINK_LIBRARIES) IF(_LIBS) FOREACH(_LIB ${_LIBS}) @@ -186,7 +126,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) IF(_DIRS) FOREACH(item ${_DIRS}) - LIST(APPEND PCH_INCLUDES "${item}") + LIST(APPEND GLOBAL_DEFINITIONS " -I\"${item}\"") ENDFOREACH() ENDIF() @@ -195,7 +135,10 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) IF(_DEFINITIONS) FOREACH(item ${_DEFINITIONS}) - APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item}) + # don't use dynamic expressions + IF(NOT item MATCHES "\\$<") + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDIF() ENDFOREACH() ENDIF() ENDIF() @@ -206,7 +149,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) 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") + LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG") ENDIF() # Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIC @@ -215,88 +158,86 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) ENDIF() IF(_USE_PIC) - LIST(APPEND PCH_FLAGS ${CMAKE_CXX_COMPILE_OPTIONS_PIC}) + LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}") ENDIF() ENDIF() + LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}") + IF(CMAKE_VERSION VERSION_LESS "3.3.0") - GET_DIRECTORY_PROPERTY(_DIRECTORY_FLAGS DEFINITIONS) - - IF(_DIRECTORY_FLAGS) - SEPARATE_ARGUMENTS(_DIRECTORY_FLAGS) - FOREACH(item ${_DIRECTORY_FLAGS}) - LIST(APPEND PCH_FLAGS "${item}") - ENDFOREACH() - ENDIF() - - GET_DIRECTORY_PROPERTY(_DIRECTORY_DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEFINITIONS) - - IF(_DIRECTORY_DEFINITIONS) - SEPARATE_ARGUMENTS(_DIRECTORY_DEFINITIONS) - FOREACH(item ${_DIRECTORY_DEFINITIONS}) - LIST(APPEND PCH_FLAGS "${item}") - ENDFOREACH() - ENDIF() + 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() - IF(CMAKE_CXX11_EXTENSION_COMPILE_OPTION) - LIST(APPEND PCH_FLAGS "${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}") - ENDIF() - - # Already in list form and items may contain non-leading spaces that should not be split on - LIST(APPEND PCH_FLAGS "${GLOBAL_DEFINITIONS}") - - IF(WIN32) - SET(SYSTEM_FLAG "[-/$]") + # Format definitions + IF(MSVC) + # Fix path with space + SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}") ELSE() - SET(SYSTEM_FLAG "[-$]") + STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS}) + SEPARATE_ARGUMENTS(_FLAGS) ENDIF() - SET(_FINAL_FLAGS) - SET(_PREVIOUS_FLAG) - - FOREACH(_FLAG ${PCH_FLAGS}) - # If parameter is really a flag (starts with -) - IF(_FLAG MATCHES "^${SYSTEM_FLAG}") - IF(_PREVIOUS_FLAG) - # Append previous flag - LIST(APPEND _FINAL_FLAGS ${_PREVIOUS_FLAG}) - ENDIF() - - SET(_PREVIOUS_FLAG ${_FLAG}) - ELSE() - IF(_PREVIOUS_FLAG) - # Append previous flag and its parameter - # TODO: escape them only if there is an space - LIST(APPEND _FINAL_FLAGS "${_PREVIOUS_FLAG} \"${_FLAG}\"") - SET(_PREVIOUS_FLAG) + IF(CLANG) + # Determining all architectures and get common flags + SET(_ARCH_NEXT) + SET(_XARCH_NEXT) + FOREACH(item ${_FLAGS}) + IF(_ARCH_NEXT) + LIST(FIND PCH_ARCHS ${item} ITEM_FOUND) + IF(ITEM_FOUND EQUAL -1) + LIST(APPEND PCH_ARCHS ${item}) + STRING(TOUPPER "${item}" _UPPER_ARCH) + SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item}) + ENDIF() + SET(_ARCH_NEXT OFF) + ELSEIF(_XARCH_NEXT) + SET(_XARCH_NEXT OFF) ELSE() - # Shouldn't happen - MESSAGE(FATAL_ERROR "No previous flag before ${_FLAG}") + IF(item MATCHES "^-arch") + SET(_ARCH_NEXT ON) + ELSEIF(item MATCHES "^-Xarch_") + STRING(REGEX REPLACE "-Xarch_([a-z0-9_]+)" "\\1" item ${item}) + LIST(FIND PCH_ARCHS ${item} ITEM_FOUND) + IF(ITEM_FOUND EQUAL -1) + LIST(APPEND PCH_ARCHS ${item}) + STRING(TOUPPER "${item}" _UPPER_ARCH) + SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item}) + ENDIF() + SET(_XARCH_NEXT ON) + ELSE() + LIST(APPEND PCH_FLAGS ${item}) + ENDIF() ENDIF() - ENDIF() - ENDFOREACH() + ENDFOREACH() - IF(_PREVIOUS_FLAG) - LIST(APPEND _FINAL_FLAGS ${_PREVIOUS_FLAG}) + # Get architcture specific flags + SET(_XARCH_NEXT) + FOREACH(item ${_FLAGS}) + IF(_XARCH_NEXT) + STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH) + LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item}) + SET(_XARCH_NEXT OFF) + ELSE() + IF(item MATCHES "^-Xarch_") + STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT) + ENDIF() + ENDIF() + ENDFOREACH() + + # Remove duplicated architectures + IF(_ARCHS AND PCH_ARCHS) + LIST(REMOVE_DUPLICATES PCH_ARCHS) + ENDIF() + ELSE() + SET(PCH_FLAGS ${_FLAGS}) ENDIF() - SET(PCH_FLAGS ${_FINAL_FLAGS}) - - # Remove flags that don't work with PCH - LIST(REMOVE_ITEM PCH_FLAGS "-Wa,--noexecstack") - - # Remove all empty parameters - LIST(REMOVE_ITEM PCH_FLAGS "") - - # Remove duplicate parameters - LIST(REMOVE_DUPLICATES PCH_FLAGS) - - # create a command-line string - STRING(REGEX REPLACE ";" " " PCH_FLAGS "${PCH_FLAGS}") - - # and separate arguments - SEPARATE_ARGUMENTS(PCH_FLAGS) + IF(PCH_FLAGS) + LIST(REMOVE_DUPLICATES PCH_FLAGS) + ENDIF() ENDMACRO() MACRO(GET_PDB_FILENAME _out_filename _target) @@ -306,21 +247,21 @@ MACRO(GET_PDB_FILENAME _out_filename _target) SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY) SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) - ELSE() + ELSE(${_targetType} STREQUAL EXECUTABLE) SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - ENDIF() + ENDIF(${_targetType} STREQUAL EXECUTABLE) # determine target postfix STRING(TOUPPER "${CMAKE_BUILD_TYPE}_POSTFIX" _postfix_var_name) GET_TARGET_PROPERTY(_targetPostfix ${_target} ${_postfix_var_name}) IF(${_targetPostfix} MATCHES NOTFOUND) SET(_targetPostfix "") - ENDIF() + ENDIF(${_targetPostfix} MATCHES NOTFOUND) SET(${_out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb") ENDMACRO(GET_PDB_FILENAME) -MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS _includes) +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}) @@ -329,34 +270,18 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS _includes) ENDIF() IF(MSVC) - GET_PDB_FILENAME(_PDB_FILE ${_PCH_current_target}) - - SET(PCH_TEMP_CONTENT) - - FOREACH(_include ${_includes}) - SET(PCH_TEMP_CONTENT "${PCH_TEMP_CONTENT} -I \"${_include}\"") - ENDFOREACH() - - SET(PCH_TEMP_FILE ${CMAKE_CURRENT_BINARY_DIR}/pch_command.txt) - FILE(WRITE ${PCH_TEMP_FILE} "${PCH_TEMP_CONTENT}") - - SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} /nologo @${PCH_TEMP_FILE} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${_PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj") - + GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target}) + SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj") # Ninja PCH Support # http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj") ELSE() SET(HEADER_FORMAT "c++-header") - SET(_FLAGS) + SET(_FLAGS "") IF(APPLE) SET(HEADER_FORMAT "objective-${HEADER_FORMAT}") - LIST(APPEND _FLAGS ${OBJC_FLAGS}) + SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch) ENDIF() - - FOREACH(_include ${_includes}) - LIST(APPEND _FLAGS -I "${_include}") - ENDFOREACH() - SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT}) ENDIF() ENDMACRO() @@ -441,8 +366,7 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) ENDIF() IF(APPLE) - STRING(REPLACE ";" " " OBJC_FLAGS_STR "${OBJC_FLAGS}") - SET(PCH_ADDITIONAL_COMPILER_FLAGS "${OBJC_FLAGS_STR} -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}") + SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}") ENDIF() IF(WITH_PCH_DEBUG) @@ -498,7 +422,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} ${_ARCH} "") LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT}) - PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_ARCH_${_UPPER_ARCH}_FLAGS};${PCH_FLAGS}" "${PCH_INCLUDES}") + PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_ARCH_${_UPPER_ARCH}_FLAGS};${PCH_FLAGS}") PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH}) ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH}) @@ -507,7 +431,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "") LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT}) - PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}" "${PCH_INCLUDES}") + PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}") PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch) ENDIF() @@ -556,13 +480,7 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") ELSE() #Fallback to the "old" precompiled suppport - IF(CMAKE_OSX_ARCHITECTURES AND TARGETS_COUNT GREATER 1) - FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES}) - ADD_PRECOMPILED_HEADER(${_targetName}_${_ARCH} ${_inputh} ${_inputcpp}) - ENDFOREACH() - ELSE() - ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) - ENDIF() + ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) ENDIF() IF(TARGET ${_targetName}_static) diff --git a/code/CMakeModules/iOSToolChain.cmake b/code/CMakeModules/iOSToolChain.cmake index 7bcb57227..610045e33 100644 --- a/code/CMakeModules/iOSToolChain.cmake +++ b/code/CMakeModules/iOSToolChain.cmake @@ -35,6 +35,23 @@ SET(UNIX ON) SET(APPLE ON) SET(IOS ON) +# Force the compilers to Clang for iOS +include (CMakeForceCompiler) +CMAKE_FORCE_C_COMPILER (clang Clang) +CMAKE_FORCE_CXX_COMPILER (clang++ Clang) + +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") @@ -145,14 +162,14 @@ IF(CMAKE_GENERATOR MATCHES Xcode) ENDIF() ELSE() IF(${IOS_PLATFORM} STREQUAL "OS") - SET(ARCHS armv7 arm64) + 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 arm64 i386 x86_64) + SET(ARCHS "armv7;arm64;i386;x86_64") SET(CMAKE_SYSTEM_PROCESSOR "armv7") ENDIF() ENDIF() @@ -181,13 +198,5 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -# Force the compilers to Clang for iOS -SET(CMAKE_C_COMPILER clang) -SET(CMAKE_CXX_COMPILER clang++) - -# Skip the platform compiler checks for cross compiling. -SET(CMAKE_CXX_COMPILER_FORCED TRUE) -SET(CMAKE_C_COMPILER_FORCED TRUE) - # determinate location for bin utils based on CMAKE_FIND_ROOT_PATH -INCLUDE(CMakeFindBinUtils) +include(CMakeFindBinUtils) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index bd70dd2ff..5c2d99d30 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -4,7 +4,7 @@ SET(CMAKE_TRY_COMPILE_CONFIGURATION "Release") # Force Release configuration by default IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) -ENDIF() +ENDIF(NOT CMAKE_BUILD_TYPE) # Declare CMAKE_CONFIGURATION_TYPES before PROJECT SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) @@ -17,7 +17,7 @@ MACRO(NL_GEN_PC name) IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}") INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION ${NL_LIB_PREFIX}/pkgconfig) - ENDIF() + ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) ENDMACRO(NL_GEN_PC) ### @@ -26,9 +26,9 @@ ENDMACRO(NL_GEN_PC) MACRO(NL_TARGET_LIB name) IF(WITH_STATIC) ADD_LIBRARY(${name} STATIC ${ARGN}) - ELSE() + ELSE(WITH_STATIC) ADD_LIBRARY(${name} SHARED ${ARGN}) - ENDIF() + ENDIF(WITH_STATIC) ENDMACRO(NL_TARGET_LIB) ### @@ -37,9 +37,9 @@ ENDMACRO(NL_TARGET_LIB) MACRO(NL_TARGET_DRIVER name) IF(WITH_STATIC_DRIVERS) ADD_LIBRARY(${name} STATIC ${ARGN}) - ELSE() + ELSE(WITH_STATIC_DRIVERS) ADD_LIBRARY(${name} MODULE ${ARGN}) - ENDIF() + ENDIF(WITH_STATIC_DRIVERS) ENDMACRO(NL_TARGET_DRIVER) ### @@ -64,35 +64,16 @@ MACRO(NL_DEFAULT_PROPS name label) VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR}) IF(NL_LIB_PREFIX) SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX}) - ENDIF() - ENDIF() + ENDIF(NL_LIB_PREFIX) + ENDIF(${type} STREQUAL SHARED_LIBRARY) IF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW) - # check if using a GUI - GET_TARGET_PROPERTY(_VALUE ${name} WIN32_EXECUTABLE) - - IF(TARGET_X64) - # Target Windows XP 64 bits - SET(_SUBSYSTEM_VERSION "5.02") - ELSE() - # Target Windows XP - SET(_SUBSYSTEM_VERSION "5.01") - ENDIF() - - IF(_VALUE) - # GUI - SET(_SUBSYSTEM "WINDOWS") - ELSE() - # Console - SET(_SUBSYSTEM "CONSOLE") - ENDIF() - SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR} COMPILE_FLAGS "/GA" - LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR} /SUBSYSTEM:${_SUBSYSTEM},${_SUBSYSTEM_VERSION}") - ENDIF() + LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}") + ENDIF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW) ENDMACRO(NL_DEFAULT_PROPS) ### @@ -102,7 +83,7 @@ ENDMACRO(NL_DEFAULT_PROPS) MACRO(NL_ADD_LIB_SUFFIX name) IF(WIN32) SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r") - ENDIF() + ENDIF(WIN32) ENDMACRO(NL_ADD_LIB_SUFFIX) ### @@ -114,10 +95,10 @@ MACRO(NL_ADD_RUNTIME_FLAGS name) # SET_TARGET_PROPERTIES(${name} PROPERTIES # LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" # LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}") - ENDIF() + ENDIF(WIN32) IF(WITH_STLPORT) TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) - ENDIF() + ENDIF(WITH_STLPORT) ENDMACRO(NL_ADD_RUNTIME_FLAGS) MACRO(NL_ADD_STATIC_VID_DRIVERS name) @@ -125,25 +106,25 @@ MACRO(NL_ADD_STATIC_VID_DRIVERS name) IF(WIN32) IF(WITH_DRIVER_DIRECT3D) TARGET_LINK_LIBRARIES(${name} nel_drv_direct3d_win) - ENDIF() - ENDIF() + ENDIF(WITH_DRIVER_DIRECT3D) + ENDIF(WIN32) IF(WITH_DRIVER_OPENGL) IF(WIN32) TARGET_LINK_LIBRARIES(${name} nel_drv_opengl_win) - ELSE() + ELSE(WIN32) TARGET_LINK_LIBRARIES(${name} nel_drv_opengl) - ENDIF() - ENDIF() + ENDIF(WIN32) + ENDIF(WITH_DRIVER_OPENGL) IF(WITH_DRIVER_OPENGLES) IF(WIN32) TARGET_LINK_LIBRARIES(${name} nel_drv_opengles_win) - ELSE() + ELSE(WIN32) TARGET_LINK_LIBRARIES(${name} nel_drv_opengles) - ENDIF() - ENDIF() - ENDIF() + ENDIF(WIN32) + ENDIF(WITH_DRIVER_OPENGLES) + ENDIF(WITH_STATIC_DRIVERS) ENDMACRO(NL_ADD_STATIC_VID_DRIVERS) MACRO(NL_ADD_STATIC_SND_DRIVERS name) @@ -151,30 +132,30 @@ MACRO(NL_ADD_STATIC_SND_DRIVERS name) IF(WIN32) IF(WITH_DRIVER_DSOUND) TARGET_LINK_LIBRARIES(${name} nel_drv_dsound_win) - ENDIF() + ENDIF(WITH_DRIVER_DSOUND) IF(WITH_DRIVER_XAUDIO2) TARGET_LINK_LIBRARIES(${name} nel_drv_xaudio2_win) - ENDIF() + ENDIF(WITH_DRIVER_XAUDIO2) IF(WITH_DRIVER_OPENAL) TARGET_LINK_LIBRARIES(${name} nel_drv_openal_win) - ENDIF() + ENDIF(WITH_DRIVER_OPENAL) IF(WITH_DRIVER_FMOD) TARGET_LINK_LIBRARIES(${name} nel_drv_fmod_win) - ENDIF() - ELSE() + ENDIF(WITH_DRIVER_FMOD) + ELSE(WIN32) IF(WITH_DRIVER_OPENAL) TARGET_LINK_LIBRARIES(${name} nel_drv_openal) - ENDIF() + ENDIF(WITH_DRIVER_OPENAL) IF(WITH_DRIVER_FMOD) TARGET_LINK_LIBRARIES(${name} nel_drv_fmod) - ENDIF() - ENDIF() + ENDIF(WITH_DRIVER_FMOD) + ENDIF(WIN32) - ENDIF() + ENDIF(WITH_STATIC_DRIVERS) ENDMACRO(NL_ADD_STATIC_SND_DRIVERS) ### @@ -192,14 +173,14 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.: cd cmake cmake .. ") - ENDIF() + ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) ENDMACRO(CHECK_OUT_OF_SOURCE) MACRO(NL_SETUP_DEFAULT_OPTIONS) IF(WITH_QT) OPTION(WITH_STUDIO "Build Core Studio" OFF ) - ENDIF() + ENDIF(WITH_QT) ### # Features @@ -213,32 +194,31 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) # Default to static building on Windows. IF(WIN32) OPTION(WITH_STATIC "With static libraries." ON ) - ELSE() + ELSE(WIN32) OPTION(WITH_STATIC "With static libraries." OFF) - ENDIF() + ENDIF(WIN32) IF (WITH_STATIC) OPTION(WITH_STATIC_LIBXML2 "With static libxml2" ON ) - ELSE() + ELSE(WITH_STATIC) OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF) - ENDIF() + ENDIF(WITH_STATIC) IF (WITH_STATIC) OPTION(WITH_STATIC_CURL "With static curl" ON ) - ELSE() + ELSE(WITH_STATIC) OPTION(WITH_STATIC_CURL "With static curl" OFF) - ENDIF() + ENDIF(WITH_STATIC) IF(APPLE) OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" ON ) - ELSE() + ELSE(APPLE) OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" OFF) - ENDIF() + ENDIF(APPLE) OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF) IF(WIN32) OPTION(WITH_EXTERNAL "With provided external." ON ) - ELSE() + ELSE(WIN32) OPTION(WITH_EXTERNAL "With provided external." OFF) - ENDIF() + ENDIF(WIN32) OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF) - OPTION(WITH_STATIC_RUNTIMES "Use only static C++ runtimes" OFF) IF(UNIX AND NOT APPLE) OPTION(WITH_UNIX_STRUCTURE "Use UNIX structure (bin, include, lib)" ON ) ELSE() @@ -247,7 +227,6 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) OPTION(WITH_INSTALL_LIBRARIES "Install development files." ON ) OPTION(WITH_ASSIMP "Use assimp exporter" OFF) - OPTION(WITH_LIBGSF "Use libgsf for max file library" OFF) ### # GUI toolkits @@ -258,9 +237,9 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) IF(WIN32 AND MFC_FOUND) OPTION(WITH_MFC "With MFC Support" ON ) - ELSE() + ELSE(WIN32 AND MFC_FOUND) OPTION(WITH_MFC "With MFC Support" OFF) - ENDIF() + ENDIF(WIN32 AND MFC_FOUND) ### # Optional support @@ -325,7 +304,7 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) IF(NOT MSVC) OPTION(WITH_GCC_FPMATH_BOTH "With GCC -mfpmath=both" OFF) - ENDIF() + ENDIF(NOT MSVC) ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS) @@ -354,8 +333,6 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) 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) - OPTION(WITH_RYZOM_STEAM "Enable Steam features" OFF) - OPTION(WITH_RYZOM_SANDBOX "Enable Sandbox under OS X" OFF) ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) @@ -369,20 +346,10 @@ ENDMACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) MACRO(ADD_PLATFORM_FLAGS _FLAGS) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} ${_FLAGS}") SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${_FLAGS}") -ENDMACRO() - -MACRO(ADD_PLATFORM_LINKFLAGS _FLAGS) - SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${_FLAGS}") -ENDMACRO() - -MACRO(CONVERT_VERSION_NUMBER _VERSION_NUMBER _BASE) - SET(${_VERSION_NUMBER} 0) - FOREACH(_ARG ${ARGN}) - MATH(EXPR ${_VERSION_NUMBER} "${${_VERSION_NUMBER}} * ${_BASE} + ${_ARG}") - ENDFOREACH() -ENDMACRO() +ENDMACRO(ADD_PLATFORM_FLAGS) MACRO(NL_SETUP_BUILD) + #----------------------------------------------------------------------------- # Setup the buildmode variables. # @@ -392,60 +359,51 @@ MACRO(NL_SETUP_BUILD) IF(CMAKE_BUILD_TYPE MATCHES "Debug") SET(NL_BUILD_MODE "NL_DEBUG") - ELSE() + ELSE(CMAKE_BUILD_TYPE MATCHES "Debug") IF(CMAKE_BUILD_TYPE MATCHES "Release") SET(NL_BUILD_MODE "NL_RELEASE") - ELSE() + ELSE(CMAKE_BUILD_TYPE MATCHES "Release") SET(NL_BUILD_MODE "NL_RELEASE") # enforce release mode if it's neither Debug nor Release SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) - ENDIF() - ENDIF() + ENDIF(CMAKE_BUILD_TYPE MATCHES "Release") + ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") - IF(CMAKE_CXX_LIBRARY_ARCHITECTURE) - SET(HOST_CPU ${CMAKE_CXX_LIBRARY_ARCHITECTURE}) - ELSE() - SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR}) - ENDIF() + SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR}) - IF(HOST_CPU MATCHES "(amd|AMD|x86_)64") + IF(HOST_CPU MATCHES "(amd|AMD)64") SET(HOST_CPU "x86_64") ELSEIF(HOST_CPU MATCHES "i.86") SET(HOST_CPU "x86") - ENDIF() + ENDIF(HOST_CPU MATCHES "(amd|AMD)64") # Determine target CPU # If not specified, use the same CPU as host IF(NOT TARGET_CPU) - SET(TARGET_CPU ${HOST_CPU}) - ENDIF() + SET(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR}) + ENDIF(NOT TARGET_CPU) - IF(TARGET_CPU MATCHES "(amd|AMD|x86_)64") + IF(TARGET_CPU MATCHES "(amd|AMD)64") SET(TARGET_CPU "x86_64") ELSEIF(TARGET_CPU MATCHES "i.86") SET(TARGET_CPU "x86") - ENDIF() + ENDIF(TARGET_CPU MATCHES "(amd|AMD)64") IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") SET(CLANG ON) - MESSAGE(STATUS "Using Clang ${CMAKE_CXX_COMPILER_VERSION} compiler") - ENDIF() + MESSAGE(STATUS "Using Clang compiler") + ENDIF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") IF(CMAKE_GENERATOR MATCHES "Xcode") SET(XCODE ON) MESSAGE(STATUS "Generating Xcode project") - ENDIF() + ENDIF(CMAKE_GENERATOR MATCHES "Xcode") IF(CMAKE_GENERATOR MATCHES "NMake") SET(NMAKE ON) MESSAGE(STATUS "Generating NMake project") - ENDIF() - - IF(CMAKE_GENERATOR MATCHES "Ninja") - SET(NINJA ON) - MESSAGE(STATUS "Generating Ninja project") - ENDIF() + ENDIF(CMAKE_GENERATOR MATCHES "NMake") # If target and host CPU are the same IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING) @@ -454,24 +412,24 @@ MACRO(NL_SETUP_BUILD) IF(NOT CMAKE_SIZEOF_VOID_P) INCLUDE (CheckTypeSize) CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) - ENDIF() + ENDIF(NOT CMAKE_SIZEOF_VOID_P) # Using 32 or 64 bits libraries IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(TARGET_CPU "x86_64") - ELSE() + ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(TARGET_CPU "x86") - ENDIF() + ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) ELSEIF(HOST_CPU MATCHES "arm") SET(TARGET_CPU "arm") - ELSE() + ELSE(HOST_CPU MATCHES "x86") SET(TARGET_CPU "unknown") MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}") - ENDIF() + ENDIF(HOST_CPU MATCHES "x86") # TODO: add checks for PPC - ELSE() + ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING) MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}") - ENDIF() + ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING) # Use values from environment variables SET(PLATFORM_CFLAGS "$ENV{CFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CFLAGS}") @@ -495,9 +453,6 @@ MACRO(NL_SETUP_BUILD) SET(TARGET_X86 1) ELSEIF(TARGET_CPU STREQUAL "x86") SET(TARGET_X86 1) - ELSEIF(TARGET_CPU STREQUAL "arm64") - SET(TARGET_ARM 1) - SET(TARGET_ARM64 1) ELSEIF(TARGET_CPU STREQUAL "armv7s") SET(TARGET_ARM 1) SET(TARGET_ARMV7S 1) @@ -514,40 +469,36 @@ MACRO(NL_SETUP_BUILD) SET(TARGET_ARM 1) ELSEIF(TARGET_CPU STREQUAL "mips") SET(TARGET_MIPS 1) - ENDIF() + ENDIF(TARGET_CPU STREQUAL "x86_64") IF(TARGET_ARM) - IF(TARGET_ARM64) - ADD_PLATFORM_FLAGS("-DHAVE_ARM64") - ENDIF() - IF(TARGET_ARMV7S) ADD_PLATFORM_FLAGS("-DHAVE_ARMV7S") - ENDIF() + ENDIF(TARGET_ARMV7S) IF(TARGET_ARMV7) ADD_PLATFORM_FLAGS("-DHAVE_ARMV7") - ENDIF() + ENDIF(TARGET_ARMV7) IF(TARGET_ARMV6) ADD_PLATFORM_FLAGS("-HAVE_ARMV6") - ENDIF() + ENDIF(TARGET_ARMV6) ADD_PLATFORM_FLAGS("-DHAVE_ARM") - ENDIF() + ENDIF(TARGET_ARM) IF(TARGET_X86) ADD_PLATFORM_FLAGS("-DHAVE_X86") - ENDIF() + ENDIF(TARGET_X86) IF(TARGET_X64) ADD_PLATFORM_FLAGS("-DHAVE_X64 -DHAVE_X86_64") - ENDIF() + ENDIF(TARGET_X64) IF(TARGET_MIPS) ADD_PLATFORM_FLAGS("-DHAVE_MIPS") - ENDIF() - ENDIF() + ENDIF(TARGET_MIPS) + ENDIF(NOT CMAKE_OSX_ARCHITECTURES) # Fix library paths suffixes for Debian MultiArch IF(LIBRARY_ARCHITECTURE) @@ -556,88 +507,77 @@ MACRO(NL_SETUP_BUILD) SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64) ELSEIF(TARGET_X86) SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32) - ENDIF() - ENDIF() + ENDIF(TARGET_X64) + ENDIF(LIBRARY_ARCHITECTURE) IF(APPLE AND NOT IOS) SET(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH}) SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH}) - ENDIF() + ENDIF(APPLE AND NOT IOS) IF(WITH_LOGGING) ADD_PLATFORM_FLAGS("-DENABLE_LOGS") - ENDIF() - - SET(CUSTOM_FLAGS "" CACHE STRING "Custom compile flags (useful for /MPn)") - IF(NOT ${CUSTOM_FLAGS} STREQUAL "") - ADD_PLATFORM_FLAGS(${CUSTOM_FLAGS}) - ENDIF() + ENDIF(WITH_LOGGING) IF(MSVC) + IF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11) + SET(MSVC11 ON) + ENDIF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11) + # Ignore default include paths ADD_PLATFORM_FLAGS("/X") IF(MSVC14) - ADD_PLATFORM_FLAGS("/Gy-") - # /Ox is working with VC++ 2015 and 2017, but custom optimizations don't exist + 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}") - - # Special cases for VC++ 2017 - IF(MSVC_VERSION EQUAL "1911") - SET(MSVC1411 ON) - ELSEIF(MSVC_VERSION EQUAL "1910") - SET(MSVC1410 ON) - ENDIF() ELSEIF(MSVC12) - ADD_PLATFORM_FLAGS("/Gy-") + ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") # /Ox is working with VC++ 2013, 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(MSVC11) - ADD_PLATFORM_FLAGS("/Gy-") + ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") # /Ox is working with VC++ 2012, 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(MSVC10) - ADD_PLATFORM_FLAGS("/Gy-") + ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") # /Ox is working with VC++ 2010, 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(MSVC90) - ADD_PLATFORM_FLAGS("/Gy-") + ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000") # don't use a /O[012x] flag if you want custom optimizations SET(RELEASE_CFLAGS "/Ob2 /Oi /Ot /Oy /GT /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS}") ELSEIF(MSVC80) - ADD_PLATFORM_FLAGS("/Gy- /Wp64") + ADD_PLATFORM_FLAGS("/Gy- /Wp64 /Zm1000") # don't use a /O[012x] flag if you want custom optimizations SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}") - ELSE() + ELSE(MSVC12) MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") - ENDIF() + ENDIF(MSVC14) - ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /D_WIN32 /DWIN32 /D_WINDOWS /wd4250") - - # huge PCH - ADD_PLATFORM_FLAGS("/Zm1000") + ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /wd4250") IF(TARGET_X64) # Fix a bug with Intellisense ADD_PLATFORM_FLAGS("/D_WIN64") # Fix a compilation error for some big C++ files - ADD_PLATFORM_FLAGS("/bigobj") - ELSE() + SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} /bigobj") + ELSE(TARGET_X64) # Allows 32 bits applications to use 3 GB of RAM - ADD_PLATFORM_LINKFLAGS("/LARGEADDRESSAWARE") - ENDIF() + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE") + ENDIF(TARGET_X64) # Exceptions are only set for C++ SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /EHa") @@ -645,46 +585,38 @@ MACRO(NL_SETUP_BUILD) IF(WITH_SYMBOLS) SET(NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}") SET(NL_RELEASE_LINKFLAGS "/DEBUG ${NL_RELEASE_LINKFLAGS}") - ELSE() + ELSE(WITH_SYMBOLS) SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}") - ENDIF() + ENDIF(WITH_SYMBOLS) - IF(WITH_STATIC_RUNTIMES) - SET(RUNTIME_FLAG "/MT") - ELSE() - SET(RUNTIME_FLAG "/MD") - ENDIF() - - SET(NL_DEBUG_CFLAGS "/Zi ${RUNTIME_FLAG}d /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}") - SET(NL_RELEASE_CFLAGS "${RUNTIME_FLAG} /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}") + SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}") + SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}") SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt ${MSVC_INCREMENTAL_YES_FLAG} ${NL_DEBUG_LINKFLAGS}") SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}") IF(WITH_WARNINGS) SET(DEBUG_CFLAGS "/W4 ${DEBUG_CFLAGS}") - ELSE() + ELSE(WITH_WARNINGS) SET(DEBUG_CFLAGS "/W3 ${DEBUG_CFLAGS}") - ENDIF() - ELSE() + ENDIF(WITH_WARNINGS) + ELSE(MSVC) IF(WIN32) ADD_PLATFORM_FLAGS("-DWIN32 -D_WIN32") IF(CLANG) ADD_PLATFORM_FLAGS("-nobuiltininc") - ENDIF() - ENDIF() + ENDIF(CLANG) + ENDIF(WIN32) IF(WITH_SSE3) ADD_PLATFORM_FLAGS("-msse3") - ENDIF() + ENDIF(WITH_SSE3) IF(WITH_GCC_FPMATH_BOTH) ADD_PLATFORM_FLAGS("-mfpmath=both") - ENDIF() + ENDIF(WITH_GCC_FPMATH_BOTH) IF(APPLE) - SET(OBJC_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch -fobjc-weak) - IF(NOT XCODE) IF(CMAKE_OSX_ARCHITECTURES) SET(TARGETS_COUNT 0) @@ -717,97 +649,97 @@ MACRO(NL_SETUP_BUILD) SET(_ARCHS "${_ARCHS} mips") SET(TARGET_MIPS 1) MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1") - ELSE() + ELSE(_ARCH STREQUAL "i386") SET(_ARCHS "${_ARCHS} unknwon(${_ARCH})") - ENDIF() + ENDIF(_ARCH STREQUAL "i386") ENDFOREACH(_ARCH) MESSAGE(STATUS "Compiling under Mac OS X for ${TARGETS_COUNT} architectures: ${_ARCHS}") - ELSE() + ELSE(CMAKE_OSX_ARCHITECTURES) SET(TARGETS_COUNT 0) - ENDIF() + ENDIF(CMAKE_OSX_ARCHITECTURES) IF(TARGETS_COUNT EQUAL 1) IF(TARGET_ARM) IF(TARGET_ARMV7S) ADD_PLATFORM_FLAGS("-arch armv7s -DHAVE_ARMV7S") - ENDIF() + ENDIF(TARGET_ARMV7S) IF(TARGET_ARMV7) ADD_PLATFORM_FLAGS("-arch armv7 -DHAVE_ARMV7") - ENDIF() + ENDIF(TARGET_ARMV7) IF(TARGET_ARMV6) ADD_PLATFORM_FLAGS("-arch armv6 -DHAVE_ARMV6") - ENDIF() + ENDIF(TARGET_ARMV6) IF(TARGET_ARMV5) ADD_PLATFORM_FLAGS("-arch armv5 -DHAVE_ARMV5") - ENDIF() + ENDIF(TARGET_ARMV5) ADD_PLATFORM_FLAGS("-mthumb -DHAVE_ARM") - ENDIF() + ENDIF(TARGET_ARM) IF(TARGET_X64) ADD_PLATFORM_FLAGS("-arch x86_64 -DHAVE_X64 -DHAVE_X86_64 -DHAVE_X86") ELSEIF(TARGET_X86) ADD_PLATFORM_FLAGS("-arch i386 -DHAVE_X86") - ENDIF() + ENDIF(TARGET_X64) IF(TARGET_MIPS) ADD_PLATFORM_FLAGS("-arch mips -DHAVE_MIPS") - ENDIF() + ENDIF(TARGET_MIPS) ELSEIF(TARGETS_COUNT EQUAL 0) # Not using CMAKE_OSX_ARCHITECTURES, HAVE_XXX already defined before IF(TARGET_ARM) IF(TARGET_ARMV7S) ADD_PLATFORM_FLAGS("-arch armv7s") - ENDIF() + ENDIF(TARGET_ARMV7S) IF(TARGET_ARMV7) ADD_PLATFORM_FLAGS("-arch armv7") - ENDIF() + ENDIF(TARGET_ARMV7) IF(TARGET_ARMV6) ADD_PLATFORM_FLAGS("-arch armv6") - ENDIF() + ENDIF(TARGET_ARMV6) IF(TARGET_ARMV5) ADD_PLATFORM_FLAGS("-arch armv5") - ENDIF() + ENDIF(TARGET_ARMV5) ADD_PLATFORM_FLAGS("-mthumb") - ENDIF() + ENDIF(TARGET_ARM) IF(TARGET_X64) ADD_PLATFORM_FLAGS("-arch x86_64") ELSEIF(TARGET_X86) ADD_PLATFORM_FLAGS("-arch i386") - ENDIF() + ENDIF(TARGET_X64) IF(TARGET_MIPS) ADD_PLATFORM_FLAGS("-arch mips") - ENDIF() - ELSE() + ENDIF(TARGET_MIPS) + ELSE(TARGETS_COUNT EQUAL 1) IF(TARGET_ARMV6) ADD_PLATFORM_FLAGS("-Xarch_armv6 -mthumb -Xarch_armv6 -DHAVE_ARM -Xarch_armv6 -DHAVE_ARMV6") - ENDIF() + ENDIF(TARGET_ARMV6) IF(TARGET_ARMV7) ADD_PLATFORM_FLAGS("-Xarch_armv7 -mthumb -Xarch_armv7 -DHAVE_ARM -Xarch_armv7 -DHAVE_ARMV7") - ENDIF() + ENDIF(TARGET_ARMV7) IF(TARGET_X86) ADD_PLATFORM_FLAGS("-Xarch_i386 -DHAVE_X86") - ENDIF() + ENDIF(TARGET_X86) IF(TARGET_X64) ADD_PLATFORM_FLAGS("-Xarch_x86_64 -DHAVE_X64 -Xarch_x86_64 -DHAVE_X86_64") - ENDIF() + ENDIF(TARGET_X64) IF(TARGET_MIPS) ADD_PLATFORM_FLAGS("-Xarch_mips -DHAVE_MIPS") - ENDIF() - ENDIF() + ENDIF(TARGET_MIPS) + ENDIF(TARGETS_COUNT EQUAL 1) IF(IOS) SET(CMAKE_OSX_SYSROOT "" CACHE PATH "" FORCE) @@ -817,90 +749,75 @@ MACRO(NL_SETUP_BUILD) CONVERT_VERSION_NUMBER(${IOS_VERSION_MAJOR} ${IOS_VERSION_MINOR} ${IOS_VERSION_PATCH} IOS_VERSION_NUMBER) ADD_PLATFORM_FLAGS("-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IOS_VERSION_NUMBER}") - ENDIF() + ENDIF(IOS_VERSION) IF(CMAKE_IOS_SYSROOT) IF(TARGET_ARMV7S) IF(TARGETS_COUNT GREATER 1) SET(XARCH "-Xarch_armv7s ") - ENDIF() + ENDIF(TARGETS_COUNT GREATER 1) ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}") ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}") - ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") - ENDIF() + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") + ENDIF(TARGET_ARMV7S) IF(TARGET_ARMV7) IF(TARGETS_COUNT GREATER 1) SET(XARCH "-Xarch_armv7 ") - ENDIF() + ENDIF(TARGETS_COUNT GREATER 1) ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}") ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}") - ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") - ENDIF() + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") + ENDIF(TARGET_ARMV7) IF(TARGET_ARMV6) IF(TARGETS_COUNT GREATER 1) SET(XARCH "-Xarch_armv6 ") - ENDIF() + ENDIF(TARGETS_COUNT GREATER 1) ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}") ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}") - ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") - ENDIF() - ENDIF() + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") + ENDIF(TARGET_ARMV6) + ENDIF(CMAKE_IOS_SYSROOT) IF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86) IF(TARGETS_COUNT GREATER 1) SET(XARCH "-Xarch_i386 ") - ENDIF() + ENDIF(TARGETS_COUNT GREATER 1) ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SIMULATOR_SYSROOT}") ADD_PLATFORM_FLAGS("${XARCH}-mios-simulator-version-min=${IOS_VERSION}") IF(CMAKE_OSX_DEPLOYMENT_TARGET) - ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") - ENDIF() - ENDIF() - ELSE() + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") + ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET) + ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86) + ELSE(IOS) # Always force -mmacosx-version-min to override environement variable IF(CMAKE_OSX_DEPLOYMENT_TARGET) - IF(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.7") - MESSAGE(FATAL_ERROR "Minimum target for OS X is 10.7 but you're using ${CMAKE_OSX_DEPLOYMENT_TARGET}") - ENDIF() - ADD_PLATFORM_LINKFLAGS("-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") - ENDIF() - ENDIF() + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") + ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET) + ENDIF(IOS) - # use libc++ under OX X to be able to use new C++ features (and else it'll use GCC 4.2.1 STL) - # minimum target is now OS X 10.7 - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -stdlib=libc++") - - ADD_PLATFORM_LINKFLAGS("-Wl,-headerpad_max_install_names") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names") IF(HAVE_FLAG_SEARCH_PATHS_FIRST) - ADD_PLATFORM_LINKFLAGS("-Wl,-search_paths_first") - ENDIF() - ENDIF() - ELSE() + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-search_paths_first") + ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST) + ENDIF(NOT XCODE) + ELSE(APPLE) IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") ADD_PLATFORM_FLAGS("-m32 -march=i686") - ENDIF() + ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") ADD_PLATFORM_FLAGS("-m64") - ENDIF() - ENDIF() + ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") + ENDIF(APPLE) - # use c++0x standard to use std::unique_ptr and std::shared_ptr - IF(CMAKE_CXX11_EXTENSION_COMPILE_OPTION) - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}") - ENDIF() - - ADD_PLATFORM_FLAGS("-D_REENTRANT") - - # hardening - ADD_PLATFORM_FLAGS("-D_FORTIFY_SOURCE=2") + ADD_PLATFORM_FLAGS("-D_REENTRANT -fno-strict-aliasing") IF(NOT WITH_LOW_MEMORY) ADD_PLATFORM_FLAGS("-pipe") @@ -908,23 +825,11 @@ MACRO(NL_SETUP_BUILD) IF(WITH_COVERAGE) ADD_PLATFORM_FLAGS("-fprofile-arcs -ftest-coverage") - ENDIF() + ENDIF(WITH_COVERAGE) IF(WITH_WARNINGS) - ADD_PLATFORM_FLAGS("-Wall") - ELSE() - # Check wrong formats in printf-like functions - ADD_PLATFORM_FLAGS("-Wformat -Werror=format-security") - ENDIF() - - # never display these warnings because they are minor - ADD_PLATFORM_FLAGS("-Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-value") - - IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "6.0.0") - ADD_PLATFORM_FLAGS("-Wno-unused-local-typedefs") - ELSEIF(CLANG) - ADD_PLATFORM_FLAGS("-Wno-unused-private-field -Wno-unused-local-typedef") - ENDIF() + ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused") + ENDIF(WITH_WARNINGS) IF(ANDROID) ADD_PLATFORM_FLAGS("--sysroot=${PLATFORM_ROOT}") @@ -933,82 +838,68 @@ MACRO(NL_SETUP_BUILD) ADD_PLATFORM_FLAGS("-Wa,--noexecstack") IF(TARGET_ARM) - ADD_PLATFORM_FLAGS("-fpic") + ADD_PLATFORM_FLAGS("-fpic -fstack-protector") ADD_PLATFORM_FLAGS("-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__") IF(TARGET_ARMV7) ADD_PLATFORM_FLAGS("-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16") - ADD_PLATFORM_LINKFLAGS("-march=armv7-a -Wl,--fix-cortex-a8") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -march=armv7-a -Wl,--fix-cortex-a8") ELSEIF(TARGET_ARMV5) ADD_PLATFORM_FLAGS("-march=armv5te -mtune=xscale -msoft-float") - ENDIF() + ENDIF(TARGET_ARMV7) SET(TARGET_THUMB ON) IF(TARGET_THUMB) - ADD_PLATFORM_FLAGS("-mthumb -finline-limit=64") + ADD_PLATFORM_FLAGS("-mthumb -fno-strict-aliasing -finline-limit=64") SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -marm") - ELSE() + ELSE(TARGET_THUMB) ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300") - ENDIF() + SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing") + SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing") + ENDIF(TARGET_THUMB) ELSEIF(TARGET_X86) # Optimizations for Intel Atom ADD_PLATFORM_FLAGS("-march=i686 -mtune=atom -mstackrealign -msse3 -mfpmath=sse -m32 -flto -ffast-math -funroll-loops") - ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300") + ADD_PLATFORM_FLAGS("-fstack-protector -funswitch-loops -finline-limit=300") + SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing") + SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing") ELSEIF(TARGET_MIPS) - ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers") + ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fno-strict-aliasing") SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -funswitch-loops -finline-limit=300") - ENDIF() - ADD_PLATFORM_LINKFLAGS("-Wl,-z,noexecstack") - ADD_PLATFORM_LINKFLAGS("-L${PLATFORM_ROOT}/usr/lib") - ENDIF() + ENDIF(TARGET_ARM) + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -L${PLATFORM_ROOT}/usr/lib") + ENDIF(ANDROID) IF(APPLE) ADD_PLATFORM_FLAGS("-gdwarf-2 -D_DARWIN_UNLIMITED_STREAMS") - ENDIF() + ENDIF(APPLE) # Fix "relocation R_X86_64_32 against.." error on x64 platforms - IF(NOT MINGW) + IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW) ADD_PLATFORM_FLAGS("-fPIC") - ENDIF() + ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW) - # hardening - ADD_PLATFORM_FLAGS("-fstack-protector --param=ssp-buffer-size=4") - - # If -fstack-protector or -fstack-protector-all enabled, enable too new warnings and fix possible link problems - IF(WITH_WARNINGS) - ADD_PLATFORM_FLAGS("-Wstack-protector") - ENDIF() - - # Fix undefined reference to `__stack_chk_fail' error - ADD_PLATFORM_LINKFLAGS("-lc") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48") IF(NOT APPLE) - ADD_PLATFORM_LINKFLAGS("-Wl,--no-undefined -Wl,--as-needed") - - IF(WITH_STATIC_RUNTIMES) - ADD_PLATFORM_LINKFLAGS("-static-libstdc++") - ENDIF() - ENDIF() - - IF(NOT APPLE) - # hardening - ADD_PLATFORM_LINKFLAGS("-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now") - ENDIF() + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed") + ENDIF(NOT APPLE) IF(WITH_SYMBOLS) SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g") - ELSE() + ELSE(WITH_SYMBOLS) IF(APPLE) SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip ${NL_RELEASE_LINKFLAGS}") - ELSE() + ELSE(APPLE) SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}") - ENDIF() - ENDIF() + ENDIF(APPLE) + ENDIF(WITH_SYMBOLS) SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}") - ENDIF() -ENDMACRO() + ENDIF(MSVC) +ENDMACRO(NL_SETUP_BUILD) MACRO(NL_SETUP_BUILD_FLAGS) SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE) @@ -1042,16 +933,10 @@ MACRO(NL_MAKE_ABSOLUTE_PREFIX NAME_RELATIVE NAME_ABSOLUTE) ELSE() SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}}) ENDIF() - ENDIF() + ENDIF(IS_ABSOLUTE "${${NAME_RELATIVE}}") ENDMACRO(NL_MAKE_ABSOLUTE_PREFIX) MACRO(NL_SETUP_PREFIX_PATHS) - IF(TARGET_X64 AND WIN32) - SET(LIB_SUFFIX "64") - ELSE() - SET(LIB_SUFFIX "") - ENDIF() - ## Allow override of install_prefix/etc path. IF(NOT NL_ETC_PREFIX) IF(WITH_UNIX_STRUCTURE) @@ -1075,7 +960,7 @@ MACRO(NL_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/sbin path. IF(NOT NL_SBIN_PREFIX) IF(WITH_UNIX_STRUCTURE) - SET(NL_SBIN_PREFIX "sbin${LIB_SUFFIX}" CACHE PATH "Installation path for admin tools and services.") + SET(NL_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.") ELSE() SET(NL_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") ENDIF() @@ -1085,7 +970,7 @@ MACRO(NL_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/bin path. IF(NOT NL_BIN_PREFIX) IF(WITH_UNIX_STRUCTURE) - SET(NL_BIN_PREFIX "bin${LIB_SUFFIX}" CACHE PATH "Installation path for tools and applications.") + SET(NL_BIN_PREFIX "bin" CACHE PATH "Installation path for tools and applications.") ELSE() SET(NL_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") ENDIF() @@ -1097,7 +982,7 @@ MACRO(NL_SETUP_PREFIX_PATHS) IF(LIBRARY_ARCHITECTURE) SET(NL_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") ELSE() - SET(NL_LIB_PREFIX "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries.") + SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") ENDIF() ENDIF() NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX) @@ -1108,11 +993,7 @@ MACRO(NL_SETUP_PREFIX_PATHS) IF(LIBRARY_ARCHITECTURE) SET(NL_DRIVER_PREFIX "lib/${LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.") ELSE() - IF(WIN32) - SET(NL_DRIVER_PREFIX "bin${LIB_SUFFIX}" CACHE PATH "Installation path for drivers.") - ELSE() - SET(NL_DRIVER_PREFIX "lib${LIB_SUFFIX}/nel" CACHE PATH "Installation path for drivers.") - ENDIF() + SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.") ENDIF() ELSE() SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.") @@ -1129,7 +1010,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) ELSE() SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations") ENDIF() - ENDIF() + ENDIF(NOT RYZOM_ETC_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(RYZOM_ETC_PREFIX RYZOM_ETC_ABSOLUTE_PREFIX) ## Allow override of install_prefix/share path. @@ -1145,7 +1026,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/sbin path. IF(NOT RYZOM_SBIN_PREFIX) IF(WITH_UNIX_STRUCTURE) - SET(RYZOM_SBIN_PREFIX "sbin${LIB_SUFFIX}" CACHE PATH "Installation path for admin tools and services.") + SET(RYZOM_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.") ELSE() SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") ENDIF() @@ -1155,7 +1036,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/bin path. IF(NOT RYZOM_BIN_PREFIX) IF(WITH_UNIX_STRUCTURE) - SET(RYZOM_BIN_PREFIX "bin${LIB_SUFFIX}" CACHE PATH "Installation path for tools.") + SET(RYZOM_BIN_PREFIX "bin" CACHE PATH "Installation path for tools.") ELSE() SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") ENDIF() @@ -1167,9 +1048,9 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) IF(LIBRARY_ARCHITECTURE) SET(RYZOM_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") ELSE() - SET(RYZOM_LIB_PREFIX "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries.") + SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") ENDIF() - ENDIF() + ENDIF(NOT RYZOM_LIB_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX) ## Allow override of install_prefix/games path. @@ -1187,7 +1068,7 @@ ENDMACRO(RYZOM_SETUP_PREFIX_PATHS) MACRO(SETUP_EXTERNAL) IF(WITH_EXTERNAL) FIND_PACKAGE(External REQUIRED) - ENDIF() + ENDIF(WITH_EXTERNAL) IF(WIN32) FIND_PACKAGE(External REQUIRED) @@ -1196,40 +1077,38 @@ MACRO(SETUP_EXTERNAL) IF(DEFINED BOOST_DIR) SET(BOOST_INCLUDEDIR ${BOOST_DIR}/include) SET(BOOST_LIBRARYDIR ${BOOST_DIR}/lib) - ENDIF() - ELSE() + ENDIF(DEFINED BOOST_DIR) + ELSE(WIN32) FIND_PACKAGE(External QUIET) IF(APPLE) IF(WITH_STATIC_EXTERNAL) - # Look only for static libraries because systems libraries are using Frameworks SET(CMAKE_FIND_LIBRARY_SUFFIXES .a) ELSE() SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a) ENDIF() - ELSE() + ELSE(APPLE) IF(WITH_STATIC_EXTERNAL) SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .so) ELSE() SET(CMAKE_FIND_LIBRARY_SUFFIXES .so .a) ENDIF() - ENDIF() - ENDIF() + ENDIF(APPLE) + ENDIF(WIN32) - # Android, iOS and Mac OS X have pthread, but no need to link to libpthread - IF(ANDROID OR APPLE) + # Android and iOS have pthread + IF(ANDROID OR IOS) SET(CMAKE_USE_PTHREADS_INIT 1) SET(Threads_FOUND TRUE) - ELSE() - SET(THREADS_HAVE_PTHREAD_ARG ON) - FIND_PACKAGE(Threads) + ELSE(ANDROID OR IOS) + FIND_PACKAGE(Threads REQUIRED) # TODO: replace all -l by absolute path to in CMAKE_THREAD_LIBS_INIT - ENDIF() + ENDIF(ANDROID OR IOS) IF(WITH_STLPORT) FIND_PACKAGE(STLport REQUIRED) INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) - ENDIF() + ENDIF(WITH_STLPORT) IF(WIN32) # Must include DXSDK before WINSDK @@ -1237,10 +1116,10 @@ MACRO(SETUP_EXTERNAL) # IF(DXSDK_INCLUDE_DIR) # INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) # ENDIF() - ENDIF() + ENDIF(WIN32) IF(MSVC) FIND_PACKAGE(MSVC REQUIRED) FIND_PACKAGE(WindowsSDK REQUIRED) - ENDIF() -ENDMACRO() + ENDIF(MSVC) +ENDMACRO(SETUP_EXTERNAL) diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index 3470fcebb..b538feb4d 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -1,39 +1,49 @@ +PROJECT(NeL CXX C) + IF(WITH_STATIC_DRIVERS) ADD_DEFINITIONS(-DNL_STATIC) -ENDIF() +ENDIF(WITH_STATIC_DRIVERS) IF(WIN32) # On Win32 we can also build the MAX plugins. IF(WITH_NEL_MAXPLUGIN) FIND_PACKAGE(3dsMaxSDK) - ENDIF() -ENDIF() + ENDIF(WITH_NEL_MAXPLUGIN) +ENDIF(WIN32) IF(WITH_3D) FIND_PACKAGE(FreeType) IF(WITH_NEL_CEGUI) FIND_PACKAGE(CEGUI) - ENDIF() -ENDIF() + ENDIF(WITH_NEL_CEGUI) + +ENDIF(WITH_3D) IF(WITH_SOUND) FIND_PACKAGE(Ogg) FIND_PACKAGE(Vorbis) - FIND_PACKAGE(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWRESAMPLE) IF(WITH_DRIVER_OPENAL) FIND_PACKAGE(OpenAL) - ENDIF() + ENDIF(WITH_DRIVER_OPENAL) IF(WITH_DRIVER_FMOD) FIND_PACKAGE(FMOD) - ENDIF() -ENDIF() + ENDIF(WITH_DRIVER_FMOD) +ENDIF(WITH_SOUND) IF(WITH_GTK) FIND_PACKAGE(GTK2) -ENDIF() +ENDIF(WITH_GTK) + +IF(WITH_LIBOVR) + FIND_PACKAGE(LibOVR) +ENDIF(WITH_LIBOVR) + +IF(WITH_LIBVR) + FIND_PACKAGE(LibVR) +ENDIF(WITH_LIBVR) IF(WITH_INSTALL_LIBRARIES) IF(UNIX) @@ -51,7 +61,7 @@ IF(WITH_INSTALL_LIBRARIES) CONFIGURE_FILE(nel-config.in ${CMAKE_CURRENT_BINARY_DIR}/nel-config) INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nel-config DESTINATION ${NL_BIN_PREFIX}) - ENDIF() + ENDIF(UNIX) ADD_SUBDIRECTORY(include) ENDIF() diff --git a/code/nel/include/nel/3d/animatable.h b/code/nel/include/nel/3d/animatable.h index 6e4a7b39f..09297ab2b 100644 --- a/code/nel/include/nel/3d/animatable.h +++ b/code/nel/include/nel/3d/animatable.h @@ -19,8 +19,6 @@ #include "nel/misc/types_nl.h" #include "nel/misc/bit_set.h" -#include "nel/misc/smart_ptr.h" - #include #include #include diff --git a/code/nel/include/nel/3d/animated_lightmap.h b/code/nel/include/nel/3d/animated_lightmap.h index b8b887d7a..51f1c909e 100644 --- a/code/nel/include/nel/3d/animated_lightmap.h +++ b/code/nel/include/nel/3d/animated_lightmap.h @@ -21,17 +21,13 @@ #include "nel/misc/types_nl.h" #include "nel/misc/smart_ptr.h" #include "nel/3d/animatable.h" - #include "nel/3d/track.h" - #include namespace NL3D { -class CScene; - // *************************************************************************** /** * An animated lightmap diff --git a/code/nel/include/nel/3d/animation_set_user.h b/code/nel/include/nel/3d/animation_set_user.h index 39477891e..b0e863297 100644 --- a/code/nel/include/nel/3d/animation_set_user.h +++ b/code/nel/include/nel/3d/animation_set_user.h @@ -93,7 +93,7 @@ public: uint addAnimation (const char* fileName, const char* animName, bool displayMissingFileWarning = true) { // Allocate an animation - CUniquePtr anim (new CAnimation); + std::auto_ptr anim (new CAnimation); // Read it NLMISC::CIFile file; @@ -130,7 +130,7 @@ public: virtual uint addSkeletonWeight (const char* fileName, const char* skelName) { // Allocate an animation - CUniquePtr skeletonWeight (new CSkeletonWeight); + std::auto_ptr skeletonWeight (new CSkeletonWeight); // Read it NLMISC::CIFile file; diff --git a/code/nel/include/nel/3d/async_file_manager_3d.h b/code/nel/include/nel/3d/async_file_manager_3d.h index 4e86f10b1..dede1b419 100644 --- a/code/nel/include/nel/3d/async_file_manager_3d.h +++ b/code/nel/include/nel/3d/async_file_manager_3d.h @@ -88,7 +88,7 @@ private: public: std::string MeshName; public: - CMeshLoad (const std::string &meshName, IShape **ppShp, IDriver *pDriver, const NLMISC::CVector &position, uint selectedTexture); + CMeshLoad (const std::string &meshName, IShape **ppShp, IDriver *pDriver, const CVector &position, uint selectedTexture); void run (void); void getName (std::string &result) const; }; @@ -122,7 +122,7 @@ private: CTextureFile *TextureFile; bool *Signal; public: - CTextureLoad(CTextureFile *textureFile, bool *psgn, const NLMISC::CVector &position) + CTextureLoad(CTextureFile *textureFile, bool *psgn, const CVector &position) : TextureFile(textureFile), Signal(psgn) { Position = position; diff --git a/code/nel/include/nel/3d/async_texture_manager.h b/code/nel/include/nel/3d/async_texture_manager.h index af27c3fde..8a848cb52 100644 --- a/code/nel/include/nel/3d/async_texture_manager.h +++ b/code/nel/include/nel/3d/async_texture_manager.h @@ -152,7 +152,7 @@ private: struct CTextureLodToSort { CTextureLod *Lod; - NLMISC::CVector Position; + CVector Position; bool operator<(const CTextureLodToSort &other) const { return Lod->WeightWeight; diff --git a/code/nel/include/nel/3d/camera_col.h b/code/nel/include/nel/3d/camera_col.h index 6b5a30517..9151b0a22 100644 --- a/code/nel/include/nel/3d/camera_col.h +++ b/code/nel/include/nel/3d/camera_col.h @@ -20,7 +20,6 @@ #include "nel/misc/types_nl.h" #include "nel/misc/vector.h" #include "nel/misc/plane.h" -#include "nel/misc/aabbox.h" namespace NL3D { @@ -40,16 +39,16 @@ public: /** build the camera collision as a cone or a cylinder */ - void build(const NLMISC::CVector &start, const NLMISC::CVector &end, float radius, bool cone); + void build(const CVector &start, const CVector &end, float radius, bool cone); /** build the camera collision as a simple ray */ - void buildRay(const NLMISC::CVector &start, const NLMISC::CVector &end); + void buildRay(const CVector &start, const CVector &end); /** compute the intersection of the Camera Volume against the triangle, and minimize * minDist (actual square of distance) with min sqr distance of the poly. */ - void minimizeDistanceAgainstTri(const NLMISC::CVector &p0, const NLMISC::CVector &p1, const NLMISC::CVector &p2, float &sqrMinDist); + void minimizeDistanceAgainstTri(const CVector &p0, const CVector &p1, const CVector &p2, float &sqrMinDist); /** Compute into this the camera collision 'other' mul by 'matrix' * NB: for cone Radius, suppose uniform scale, else will have strange result (a uniform scale is deduced) @@ -70,9 +69,9 @@ private: enum {MaxNPlanes=6}; // The start of the camera raycast - NLMISC::CVector _Start; + CVector _Start; // The end of the camera raycast - NLMISC::CVector _End; + CVector _End; // The radius (at end only if cone) float _Radius; // cone or cylinder? @@ -84,8 +83,8 @@ private: NLMISC::CAABBox _BBox; // Temp Data for minimizeDistanceAgainstTri - NLMISC::CVector _ArrayIn[3+MaxNPlanes]; - NLMISC::CVector _ArrayOut[3+MaxNPlanes]; + CVector _ArrayIn[3+MaxNPlanes]; + CVector _ArrayOut[3+MaxNPlanes]; // The pyramid representing the camera collision volume. Nb: local to start for precision problems NLMISC::CPlane _Pyramid[MaxNPlanes]; @@ -98,10 +97,10 @@ private: float _MaxRadiusProj; float _OODeltaRadiusProj; float _RayLen; - NLMISC::CVector _RayNorm; + CVector _RayNorm; // simpler method for simple ray - void intersectRay(const NLMISC::CVector &p0, const NLMISC::CVector &p1, const NLMISC::CVector &p2, float &sqrMinDist); + void intersectRay(const CVector &p0, const CVector &p1, const CVector &p2, float &sqrMinDist); }; diff --git a/code/nel/include/nel/3d/cloud_scape_user.h b/code/nel/include/nel/3d/cloud_scape_user.h index 9e2a88376..15c926927 100644 --- a/code/nel/include/nel/3d/cloud_scape_user.h +++ b/code/nel/include/nel/3d/cloud_scape_user.h @@ -22,7 +22,6 @@ namespace NL3D class UDriver; class UCamera; class CCloudScape; -class CScene; /// implementation of UWaterInstance methods class CCloudScapeUser : public UCloudScape diff --git a/code/nel/include/nel/3d/cluster.h b/code/nel/include/nel/3d/cluster.h index b038a34c4..552d7474a 100644 --- a/code/nel/include/nel/3d/cluster.h +++ b/code/nel/include/nel/3d/cluster.h @@ -120,7 +120,7 @@ public: void setWorldMatrix (const NLMISC::CMatrix &WM); - bool isRoot() { return _LocalVolume.empty(); } + bool isRoot() { return _LocalVolume.size() == 0; } //\name Sound related. //@{ diff --git a/code/nel/include/nel/3d/coarse_mesh_manager.h b/code/nel/include/nel/3d/coarse_mesh_manager.h index feaad9e05..ce571cbd1 100644 --- a/code/nel/include/nel/3d/coarse_mesh_manager.h +++ b/code/nel/include/nel/3d/coarse_mesh_manager.h @@ -84,7 +84,7 @@ public: void setTextureFile (const char* file); /** - * Add a coarse mesh in the manager. If an error occurred, it returns CantAddCoarseMesh. + * Add a coarse mesh in the manager. If an error occured, it returns CantAddCoarseMesh. * \param vBuffer the VertexBuffer pre-transformed / Colored. Size MUST be numVertices*NL3D_COARSEMESH_VERTEX_FORMAT_MGR * \param indexBuffer containing triangles that will be inserted. * \return false if the mesh can't be added to this pass BECAUSE OF TOO MANY VERTICES or TOO MANY PRIMITIVES reason diff --git a/code/nel/include/nel/3d/computed_string.h b/code/nel/include/nel/3d/computed_string.h index 25d12a3ac..517200383 100644 --- a/code/nel/include/nel/3d/computed_string.h +++ b/code/nel/include/nel/3d/computed_string.h @@ -178,10 +178,6 @@ public: CVertexBuffer Vertices; CMaterial *Material; CRGBA Color; - ucstring Text; - - uint32 CacheVersion; - /// The width of the string, in pixels (eg: 30) float StringWidth; /// The height of the string, in pixels (eg: 10) @@ -227,7 +223,6 @@ public: */ CComputedString (bool bSetupVB=true) { - CacheVersion = 0; StringWidth = 0; StringHeight = 0; if (bSetupVB) diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 85140b3da..52bda8576 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -224,7 +224,7 @@ public: // @{ // first param is the associated window. // Must be a HWND for Windows (WIN32). - virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show = true, bool resizeable = true) = 0; + virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show = true, bool resizeable = true) throw(EBadDisplay) = 0; // Must be called after a setDisplay that initialize the mode virtual bool setMode(const GfxMode &mode) = 0; virtual bool getModes(std::vector &modes) = 0; diff --git a/code/nel/include/nel/3d/dru.h b/code/nel/include/nel/3d/dru.h index c23d41382..fda543ecd 100644 --- a/code/nel/include/nel/3d/dru.h +++ b/code/nel/include/nel/3d/dru.h @@ -134,14 +134,14 @@ class CDRU public: /// Portable Function which create a GL Driver (using gl dll...). - static IDriver *createGlDriver(); + static IDriver *createGlDriver() throw(EDru); /// Portable Function which create a GL ES Driver (using gl dll...). - static IDriver *createGlEsDriver(); + static IDriver *createGlEsDriver() throw(EDru); #ifdef NL_OS_WINDOWS /// Windows Function which create a Direct3d Driver. - static IDriver *createD3DDriver(); + static IDriver *createD3DDriver() throw(EDru); #endif // NL_OS_WINDOWS /// \name 2D render. diff --git a/code/nel/include/nel/3d/fasthls_modifier.h b/code/nel/include/nel/3d/fasthls_modifier.h index de8f22a3d..b5ec7ad82 100644 --- a/code/nel/include/nel/3d/fasthls_modifier.h +++ b/code/nel/include/nel/3d/fasthls_modifier.h @@ -48,7 +48,7 @@ public: static void releaseInstance(); /// convert a HLS (0..255) to a RGBA. - NLMISC::CRGBA convert(uint H, uint L, uint S); + CRGBA convert(uint H, uint L, uint S); /// convert a RGBA bitmap into another RGBA, with HLS decal (0..255, -255..+255, -255..+255). void convertRGBABitmap(NLMISC::CBitmap &dst, const NLMISC::CBitmap &src, uint8 dh, sint dl, sint ds); @@ -75,7 +75,7 @@ private: uint8 H,L,S,A; }; - NLMISC::CRGBA _HueTable[HueTableSize]; + CRGBA _HueTable[HueTableSize]; CHLSA _Color16ToHLS[65536]; /// Constructor diff --git a/code/nel/include/nel/3d/flare_shape.h b/code/nel/include/nel/3d/flare_shape.h index b0c35257b..044c53c11 100644 --- a/code/nel/include/nel/3d/flare_shape.h +++ b/code/nel/include/nel/3d/flare_shape.h @@ -55,7 +55,7 @@ public: CFlareShape(); /// serial this shape - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); //@} diff --git a/code/nel/include/nel/3d/font_generator.h b/code/nel/include/nel/3d/font_generator.h index b69249d58..5a07733a0 100644 --- a/code/nel/include/nel/3d/font_generator.h +++ b/code/nel/include/nel/3d/font_generator.h @@ -21,12 +21,8 @@ #undef NL_DONT_USE_EXTERNAL_CODE #ifndef NL_DONT_USE_EXTERNAL_CODE - -// forward declarations to avoid including freetype.h in headers -typedef int FT_Error; -typedef struct FT_LibraryRec_ *FT_Library; -typedef struct FT_FaceRec_* FT_Face; - +#include +#include FT_FREETYPE_H #else // NL_DONT_USE_EXTERNAL_CODE #endif // NL_DONT_USE_EXTERNAL_CODE @@ -78,8 +74,6 @@ public: uint32 getUID() { return _UID; } - std::string getFontFileName() const; - private: static uint32 _FontGeneratorCounterUID; diff --git a/code/nel/include/nel/3d/font_manager.h b/code/nel/include/nel/3d/font_manager.h index 663e9d23a..26ea02ce0 100644 --- a/code/nel/include/nel/3d/font_manager.h +++ b/code/nel/include/nel/3d/font_manager.h @@ -59,9 +59,6 @@ class CFontManager CSmartPtr _MatFont; CSmartPtr _TexFont; - // Keep track number of textures created to properly report cache version - uint32 _TexCacheNr; - public: /** @@ -74,7 +71,6 @@ public: _NbChar = 0; _MatFont = NULL; _TexFont = NULL; - _TexCacheNr = 0; } @@ -98,6 +94,7 @@ public: */ CMaterial* getFontMaterial(); + /** * Compute primitive blocks and materials of each character of * the string. @@ -155,8 +152,7 @@ public: void dumpCache (const char *filename) { - if (_TexFont) - _TexFont->dumpTextureFont (filename); + _TexFont->dumpTextureFont (filename); } /** @@ -164,15 +160,6 @@ public: */ void invalidate(); - // get font atlas rebuild count - uint32 getCacheVersion() const - { - if (_TexFont) - return (_TexFont->getCacheVersion() << 16) + _TexCacheNr; - - return 0; - } - }; diff --git a/code/nel/include/nel/3d/gpu_program_params.h b/code/nel/include/nel/3d/gpu_program_params.h index 4615c58d9..ce6b8b2f0 100644 --- a/code/nel/include/nel/3d/gpu_program_params.h +++ b/code/nel/include/nel/3d/gpu_program_params.h @@ -27,8 +27,7 @@ #ifndef NL3D_GPU_PROGRAM_PARAMS_H #define NL3D_GPU_PROGRAM_PARAMS_H - -#include "nel/misc/types_nl.h" +#include // STL includes #include @@ -168,7 +167,7 @@ private: std::map m_MapName; // map from name to offset size_t m_First; size_t m_Last; - static const size_t s_End; + static const size_t s_End = -1; }; /* class CGPUProgramParams */ diff --git a/code/nel/include/nel/3d/ig_surface_light_build.h b/code/nel/include/nel/3d/ig_surface_light_build.h index 77046dabb..e6b37b25c 100644 --- a/code/nel/include/nel/3d/ig_surface_light_build.h +++ b/code/nel/include/nel/3d/ig_surface_light_build.h @@ -26,7 +26,6 @@ namespace NL3D { - class CInstanceGroup; // *************************************************************************** /** @@ -107,14 +106,14 @@ public: public: /// Debug: build a colored Grid mesh of SunContribution. - void buildSunDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const NLMISC::CVector &deltaPos= NLMISC::CVector::Null); + void buildSunDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const CVector &deltaPos=CVector::Null); /// Debug: build a colored Grid mesh of PointLight. R= pointLight1 id. G= PointLight2 id. B= The multiplier used to show Ids. - void buildPLDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const NLMISC::CVector &deltaPos, const CInstanceGroup &igOut); + void buildPLDebugMesh(CMesh::CMeshBuild &meshBuild, CMeshBase::CMeshBaseBuild &meshBaseBuild, const CVector &deltaPos, const CInstanceGroup &igOut); private: void addDebugMeshFaces(CMesh::CMeshBuild &meshBuild, CSurface &surface, uint vId0, - const std::vector &colors); + const std::vector &colors); }; diff --git a/code/nel/include/nel/3d/key.h b/code/nel/include/nel/3d/key.h index 6982dc98b..d30bfcd6e 100644 --- a/code/nel/include/nel/3d/key.h +++ b/code/nel/include/nel/3d/key.h @@ -47,7 +47,7 @@ public: public: /// Serial - void serial (NLMISC::IStream& f) + void serial (NLMISC::IStream& f) throw (NLMISC::EStream) { // Version number (void)f.serialVersion (0); @@ -83,7 +83,7 @@ class CKeyTCB : public CKey public: /// Serial - void serial (NLMISC::IStream& f) + void serial (NLMISC::IStream& f) throw (NLMISC::EStream) { // Version number (void)f.serialVersion (0); @@ -130,7 +130,7 @@ class CKeyBezier : public CKey public: /// Serial - void serial (NLMISC::IStream& f) + void serial (NLMISC::IStream& f) throw (NLMISC::EStream) { // Version number (void)f.serialVersion (0); @@ -180,7 +180,7 @@ template<> class CKeyTCB : public CKey public: /// Serial - void serial (NLMISC::IStream& f) + void serial (NLMISC::IStream& f) throw (NLMISC::EStream) { // Version number (void)f.serialVersion (0); @@ -228,7 +228,7 @@ template<> class CKeyBezier : public CKey public: /// Serial - void serial (NLMISC::IStream& f) + void serial (NLMISC::IStream& f) throw (NLMISC::EStream) { // Version number (void)f.serialVersion (0); diff --git a/code/nel/include/nel/3d/landscape.h b/code/nel/include/nel/3d/landscape.h index a7383963d..66dec0f64 100644 --- a/code/nel/include/nel/3d/landscape.h +++ b/code/nel/include/nel/3d/landscape.h @@ -168,9 +168,9 @@ public: void clear(); /// Verify the binding of patchs of all zones. throw EBadBind if error. - void checkBinds(); + void checkBinds() throw(EBadBind); /// Verify the binding of patchs of one zone. throw EBadBind if error. nop if zone not loaded. - void checkBinds(uint16 zoneId); + void checkBinds(uint16 zoneId) throw(EBadBind); /** * Build tileBank. Call this after loading the near and far tile banks. @@ -716,7 +716,7 @@ private: bool _RefineMode; float _FarTransition; uint _TileMaxSubdivision; - // For VertexProgram. true if change has occurred in threshold since the last render(). + // For VertexProgram. true if change has occured in threshold since the last render(). float _VPThresholdChange; /// \name VertexBuffer mgt. diff --git a/code/nel/include/nel/3d/material.h b/code/nel/include/nel/3d/material.h index 7a300da45..671f3339a 100644 --- a/code/nel/include/nel/3d/material.h +++ b/code/nel/include/nel/3d/material.h @@ -692,7 +692,7 @@ private: { NLMISC::CMatrix TexMat[IDRV_MAT_MAXTEXTURES]; }; - CUniquePtr _TexUserMat; // user texture matrix + std::auto_ptr _TexUserMat; // user texture matrix public: // Private. For Driver only. diff --git a/code/nel/include/nel/3d/matrix_3x4.h b/code/nel/include/nel/3d/matrix_3x4.h index 7b8d6dcf6..45901c20e 100644 --- a/code/nel/include/nel/3d/matrix_3x4.h +++ b/code/nel/include/nel/3d/matrix_3x4.h @@ -47,7 +47,7 @@ public: float a31, a32, a33, a34; // Copy from a matrix. - void set(const NLMISC::CMatrix &mat) + void set(const CMatrix &mat) { const float *m =mat.get(); a11= m[0]; a12= m[4]; a13= m[8] ; a14= m[12]; @@ -57,14 +57,14 @@ public: // mulSetvector. NB: in should be different as v!! (else don't work). - void mulSetVector(const NLMISC::CVector &in, NLMISC::CVector &out) + void mulSetVector(const CVector &in, CVector &out) { out.x= (a11*in.x + a12*in.y + a13*in.z); out.y= (a21*in.x + a22*in.y + a23*in.z); out.z= (a31*in.x + a32*in.y + a33*in.z); } // mulSetpoint. NB: in should be different as v!! (else don't work). - void mulSetPoint(const NLMISC::CVector &in, NLMISC::CVector &out) + void mulSetPoint(const CVector &in, CVector &out) { out.x= (a11*in.x + a12*in.y + a13*in.z + a14); out.y= (a21*in.x + a22*in.y + a23*in.z + a24); @@ -73,14 +73,14 @@ public: // mulSetvector. NB: in should be different as v!! (else don't work). - void mulSetVector(const NLMISC::CVector &in, float scale, NLMISC::CVector &out) + void mulSetVector(const CVector &in, float scale, CVector &out) { out.x= (a11*in.x + a12*in.y + a13*in.z) * scale; out.y= (a21*in.x + a22*in.y + a23*in.z) * scale; out.z= (a31*in.x + a32*in.y + a33*in.z) * scale; } // mulSetpoint. NB: in should be different as v!! (else don't work). - void mulSetPoint(const NLMISC::CVector &in, float scale, NLMISC::CVector &out) + void mulSetPoint(const CVector &in, float scale, CVector &out) { out.x= (a11*in.x + a12*in.y + a13*in.z + a14) * scale; out.y= (a21*in.x + a22*in.y + a23*in.z + a24) * scale; @@ -89,14 +89,14 @@ public: // mulAddvector. NB: in should be different as v!! (else don't work). - void mulAddVector(const NLMISC::CVector &in, float scale, NLMISC::CVector &out) + void mulAddVector(const CVector &in, float scale, CVector &out) { out.x+= (a11*in.x + a12*in.y + a13*in.z) * scale; out.y+= (a21*in.x + a22*in.y + a23*in.z) * scale; out.z+= (a31*in.x + a32*in.y + a33*in.z) * scale; } // mulAddpoint. NB: in should be different as v!! (else don't work). - void mulAddPoint(const NLMISC::CVector &in, float scale, NLMISC::CVector &out) + void mulAddPoint(const CVector &in, float scale, CVector &out) { out.x+= (a11*in.x + a12*in.y + a13*in.z + a14) * scale; out.y+= (a21*in.x + a22*in.y + a23*in.z + a24) * scale; diff --git a/code/nel/include/nel/3d/mesh.h b/code/nel/include/nel/3d/mesh.h index 25872a063..780a455aa 100644 --- a/code/nel/include/nel/3d/mesh.h +++ b/code/nel/include/nel/3d/mesh.h @@ -85,7 +85,7 @@ public: // This is slow but doesn't matter since used at mesh building.... CCorner(); - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); }; /// A Triangle face. @@ -94,7 +94,7 @@ public: CCorner Corner[3]; sint32 MaterialId; sint32 SmoothGroup; - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); }; @@ -118,7 +118,7 @@ public: } } - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); }; struct CVertLink @@ -203,7 +203,7 @@ public: CMeshBuild(); // Serialization - //void serial(NLMISC::IStream &f); + //void serial(NLMISC::IStream &f) throw(NLMISC::EStream); }; //@} @@ -257,7 +257,7 @@ public: virtual void render(IDriver *drv, CTransformShape *trans, bool opaquePass); /// serial this mesh. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CMesh); /// get trinagle count. @@ -370,7 +370,7 @@ public: virtual float getNumTriangles (float distance); /// serial this mesh. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CMeshGeom); // profile diff --git a/code/nel/include/nel/3d/mesh_base.h b/code/nel/include/nel/3d/mesh_base.h index 9fb4f9029..816d8b7a4 100644 --- a/code/nel/include/nel/3d/mesh_base.h +++ b/code/nel/include/nel/3d/mesh_base.h @@ -146,7 +146,7 @@ public: CMeshBaseBuild(); // Serialization is not used - //void serial(NLMISC::IStream &f); + //void serial(NLMISC::IStream &f) throw(NLMISC::EStream); }; //@} @@ -201,7 +201,7 @@ public: // @} /// serial the base Part of this mesh. - void serialMeshBase(NLMISC::IStream &f); + void serialMeshBase(NLMISC::IStream &f) throw(NLMISC::EStream); /// Flush textures void flushTextures (IDriver &driver, uint selectedTexture); diff --git a/code/nel/include/nel/3d/mesh_morpher.h b/code/nel/include/nel/3d/mesh_morpher.h index 909d60586..b9d8879e2 100644 --- a/code/nel/include/nel/3d/mesh_morpher.h +++ b/code/nel/include/nel/3d/mesh_morpher.h @@ -43,7 +43,7 @@ public: std::vector VertRefs; // Array of vertices reference - void serial (NLMISC::IStream &f); + void serial (NLMISC::IStream &f) throw(NLMISC::EStream); }; // *************************************************************************** @@ -90,7 +90,7 @@ public: NLMISC::CObjectVector &vertexRemap, std::vector *pBSFactor); - void serial (NLMISC::IStream &f); + void serial (NLMISC::IStream &f) throw(NLMISC::EStream); private: diff --git a/code/nel/include/nel/3d/mesh_mrm.h b/code/nel/include/nel/3d/mesh_mrm.h index 619908499..d0ce7d952 100644 --- a/code/nel/include/nel/3d/mesh_mrm.h +++ b/code/nel/include/nel/3d/mesh_mrm.h @@ -115,7 +115,7 @@ public: virtual float getNumTriangles (float distance); /// serial this meshGeom. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CMeshMRMGeom); /// Scene profile @@ -579,11 +579,11 @@ private: /// load the header of this mesh. return the version of the header. - sint loadHeader(NLMISC::IStream &f); + sint loadHeader(NLMISC::IStream &f) throw(NLMISC::EStream); /// load this mesh. - void load(NLMISC::IStream &f); + void load(NLMISC::IStream &f) throw(NLMISC::EStream); /// save the entire mesh. - void save(NLMISC::IStream &f); + void save(NLMISC::IStream &f) throw(NLMISC::EStream); // Build bone Usage information for serialized mesh <= version 2. void buildBoneUsageVer2 (); @@ -702,7 +702,7 @@ public: virtual float getNumTriangles (float distance); /// serial this mesh. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CMeshMRM); /// Get bbox. diff --git a/code/nel/include/nel/3d/mesh_multi_lod.h b/code/nel/include/nel/3d/mesh_multi_lod.h index a79d5a63e..445941ed6 100644 --- a/code/nel/include/nel/3d/mesh_multi_lod.h +++ b/code/nel/include/nel/3d/mesh_multi_lod.h @@ -125,7 +125,7 @@ public: virtual void getAABBox(NLMISC::CAABBox &bbox) const; /// serial this mesh. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// Declare name of the shape NLMISC_DECLARE_CLASS(CMeshMultiLod); @@ -238,7 +238,7 @@ private: std::vector CoarseTriangles; /// Serial - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// Is Opaque ? bool isOpaque() { return (Flags&IsOpaque)!=0; } diff --git a/code/nel/include/nel/3d/meshvp_per_pixel_light.h b/code/nel/include/nel/3d/meshvp_per_pixel_light.h index 4533464a9..a234feddd 100644 --- a/code/nel/include/nel/3d/meshvp_per_pixel_light.h +++ b/code/nel/include/nel/3d/meshvp_per_pixel_light.h @@ -65,7 +65,7 @@ public: const NLMISC::CMatrix &invertedModelMat, const NLMISC::CVector &viewerPos); virtual void end(IDriver *drv); - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual void setupForMaterial(const CMaterial &mat, IDriver *drv, CScene *scene, diff --git a/code/nel/include/nel/3d/meshvp_wind_tree.h b/code/nel/include/nel/3d/meshvp_wind_tree.h index 790a2f774..e2c790d6d 100644 --- a/code/nel/include/nel/3d/meshvp_wind_tree.h +++ b/code/nel/include/nel/3d/meshvp_wind_tree.h @@ -90,7 +90,7 @@ public: virtual float getMaxVertexMove(); // Serial. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CMeshVPWindTree); // @} @@ -124,7 +124,7 @@ private: double _LastSceneTime; // maximum amplitude vector for each level. Stored in mesh because same for all instances. - NLMISC::CVector _MaxDeltaPos[HrcDepth]; + CVector _MaxDeltaPos[HrcDepth]; float _MaxVertexMove; // MBR Cache diff --git a/code/nel/include/nel/3d/nelu.h b/code/nel/include/nel/3d/nelu.h index b64e83672..fb30a5012 100644 --- a/code/nel/include/nel/3d/nelu.h +++ b/code/nel/include/nel/3d/nelu.h @@ -64,7 +64,7 @@ public: * * You can access the driver with CNELU::Driver. */ - static bool initDriver(uint w, uint h, uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen=false, bool direct3d=false); + static bool initDriver(uint w, uint h, uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen=false, bool direct3d=false) throw(EDru); /** Init all that we need for a Scene. * - register scene basics models, @@ -108,7 +108,7 @@ public: * - initScene(); * - initEventServer(); */ - static bool init(uint w, uint h, CViewport viewport=CViewport(), uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen = false, bool direct3d = false); + static bool init(uint w, uint h, CViewport viewport=CViewport(), uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen = false, bool direct3d = false) throw(EDru); /** Delete all: * - releaseEventServer(); diff --git a/code/nel/include/nel/3d/packed_world.h b/code/nel/include/nel/3d/packed_world.h index a091c61fb..d76c180ba 100644 --- a/code/nel/include/nel/3d/packed_world.h +++ b/code/nel/include/nel/3d/packed_world.h @@ -54,9 +54,9 @@ public: void build(std::vector &packesZones); bool raytrace(const NLMISC::CVector &start, const NLMISC::CVector &end, NLMISC::CVector &inter, std::vector *testedTriangles = NULL, NLMISC::CVector *normal = NULL); void getZones(std::vector &zones); - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); // just serialize the header, containing name of the zones this CPackedWorld was built from - void serialZoneNames(NLMISC::IStream &f); + void serialZoneNames(NLMISC::IStream &f) throw(NLMISC::EStream); /** Roughly select triangles that are within a convex 2D polygon (world coordinates) * Selection is not exact, because limited to the resolution of the grid into which is packed each zone. * Triangle that are within are guaranteed to be selected, however. @@ -68,7 +68,7 @@ private: public: TPackedZoneBaseSPtr Zone; uint32 RaytraceCounter; - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); CPackedZoneBase *pz = Zone; @@ -81,7 +81,7 @@ private: { public: std::vector IDs; // make a class from this vector just for serialization - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialCont(IDs); } diff --git a/code/nel/include/nel/3d/packed_zone.h b/code/nel/include/nel/3d/packed_zone.h index 52f76097a..2beb5f5ed 100644 --- a/code/nel/include/nel/3d/packed_zone.h +++ b/code/nel/include/nel/3d/packed_zone.h @@ -52,7 +52,7 @@ class CPackedVertex public: uint16 X, Y, Z; public: - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(X, Y, Z); } @@ -68,7 +68,7 @@ class CPackedTri public: uint32 V0, V1, V2; public: - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(V0, V1, V2); } @@ -79,7 +79,7 @@ class CPackedTri16 public: uint16 V0, V1, V2; public: - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(V0, V1, V2); } @@ -101,7 +101,7 @@ public: sint32 ZoneY; public: virtual ~CPackedZoneBase() {} - virtual void serial(NLMISC::IStream &f) = 0; + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) = 0; // TMP For debug : render position covered by a frustum virtual void render(CVertexBuffer &vb, IDriver &drv, CMaterial &mat, CMaterial &wiredMaterial, const NLMISC::CMatrix &camMat, uint batchSize, const NLMISC::CVector localFrustCorners[8]) = 0; // raytracing test @@ -138,7 +138,7 @@ public: sint32 zoneX, sint32 zoneY ); - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); // TMP For debug : render porition covered by a frustum void render(CVertexBuffer &vb, IDriver &drv, CMaterial &mat, CMaterial &wiredMaterial, const NLMISC::CMatrix &camMat, uint batchSize, const NLMISC::CVector localFrustCorners[8]); // try to build a 16 bit version of this packed zone to save some more place @@ -183,7 +183,7 @@ public: NLMISC_DECLARE_CLASS(CPackedZone16) CPackedZone16(); // - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); // TMP For debug : render position covered by a frustum void render(CVertexBuffer &vb, IDriver &drv, CMaterial &mat, CMaterial &wiredMaterial, const NLMISC::CMatrix &camMat, uint batchSize, const NLMISC::CVector localFrustCorners[8]); // raytracing test diff --git a/code/nel/include/nel/3d/particle_system.h b/code/nel/include/nel/3d/particle_system.h index bd50514fc..7255cfec9 100644 --- a/code/nel/include/nel/3d/particle_system.h +++ b/code/nel/include/nel/3d/particle_system.h @@ -84,7 +84,7 @@ public: /// dtor virtual ~CParticleSystem(); /// serialize this particle system - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /** Merge this system with a system instanciated from the given shape * NB : This is for edition purpose, this is slow * \return true if the operation could be performed. It can fail when this cause the system the system to last forever, @@ -841,7 +841,7 @@ public: /// return true when there are still emitters in the system - bool hasEmitters() const; + bool hasEmitters(void) const; /// return true when there are still particles bool hasParticles() const; diff --git a/code/nel/include/nel/3d/particle_system_manager.h b/code/nel/include/nel/3d/particle_system_manager.h index 1e02963bb..f48b17f1b 100644 --- a/code/nel/include/nel/3d/particle_system_manager.h +++ b/code/nel/include/nel/3d/particle_system_manager.h @@ -87,7 +87,7 @@ private: { public: CParticleSystemModel *Model; - NLMISC::CMatrix OldAncestorMatOrRelPos; // last matrix of ancestor skeleton or relative matrix of ps to its ancestor (see flag below) + CMatrix OldAncestorMatOrRelPos; // last matrix of ancestor skeleton or relative matrix of ps to its ancestor (see flag below) bool IsRelMatrix; // gives usage of the field OldAncestorMatOrRelPos bool HasAncestorSkeleton; // has the system an ancestor skeleton ? public: diff --git a/code/nel/include/nel/3d/particle_system_process.h b/code/nel/include/nel/3d/particle_system_process.h index 0e52228ee..1ff031a5a 100644 --- a/code/nel/include/nel/3d/particle_system_process.h +++ b/code/nel/include/nel/3d/particle_system_process.h @@ -102,7 +102,7 @@ class CParticleSystemProcess : public NLMISC::IStreamable * Everything is saved, except for the fontManager and the fontGenerator. * They must be set again if the PSToolRender pass is used. */ - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) ; /// @} @@ -163,10 +163,10 @@ class CParticleSystemProcess : public NLMISC::IStreamable virtual void setMatrixMode(TPSMatrixMode matrixMode); /// tells whether there are alive entities / particles in the system - virtual bool hasParticles() const { return false ; } + virtual bool hasParticles(void) const { return false ; } /// tells whether there are alive emitters / particles in the system - virtual bool hasEmitters() const { return false ; } + virtual bool hasEmitters(void) const { return false ; } /// max number of faces wanted by this process (for load balancing) diff --git a/code/nel/include/nel/3d/particle_system_shape.h b/code/nel/include/nel/3d/particle_system_shape.h index c8fbc8a17..a1c397975 100644 --- a/code/nel/include/nel/3d/particle_system_shape.h +++ b/code/nel/include/nel/3d/particle_system_shape.h @@ -90,7 +90,7 @@ public: // @} /// serial the shape - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CParticleSystemShape); diff --git a/code/nel/include/nel/3d/portal.h b/code/nel/include/nel/3d/portal.h index 51fd99913..0531f9eb5 100644 --- a/code/nel/include/nel/3d/portal.h +++ b/code/nel/include/nel/3d/portal.h @@ -92,9 +92,9 @@ public: void setWorldMatrix (const NLMISC::CMatrix &WM); - void setName (const std::string &name) { _Name = name; } + void setName (std::string &name) { _Name = name; } - std::string getName () const { return _Name; } + std::string getName () { return _Name; } void open (bool opened) { _Opened = opened; } bool isOpened () { return _Opened; } diff --git a/code/nel/include/nel/3d/ps_attrib.h b/code/nel/include/nel/3d/ps_attrib.h index 8a0dcdda6..cd691e719 100644 --- a/code/nel/include/nel/3d/ps_attrib.h +++ b/code/nel/include/nel/3d/ps_attrib.h @@ -202,7 +202,7 @@ public: uint size() const { return _Size; } /// serialization - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { if (f.isReading()) { @@ -262,7 +262,7 @@ public: CPSAttrib(); /// Serialization method - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); // swap with another vector void swap(CPSAttrib &other); @@ -429,7 +429,7 @@ void CPSAttrib::remove(uint32 index) } template -void CPSAttrib::serial(NLMISC::IStream &f) +void CPSAttrib::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { // version 4 to 5 => bug with size being > capacity sint ver = f.serialVersion(5); diff --git a/code/nel/include/nel/3d/ps_attrib_maker.h b/code/nel/include/nel/3d/ps_attrib_maker.h index fb96cb86e..56b393c2e 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker.h +++ b/code/nel/include/nel/3d/ps_attrib_maker.h @@ -60,7 +60,7 @@ struct CPSInputType uint32 UserParamNum; }; - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialEnum(InputType); switch(InputType) @@ -124,7 +124,7 @@ public: } /// serialisation of the object. Derivers MUST call this, (if they use the attribute of this class at least) - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); f.serial(_NbCycles); diff --git a/code/nel/include/nel/3d/ps_attrib_maker_bin_op.h b/code/nel/include/nel/3d/ps_attrib_maker_bin_op.h index 597b47457..f59d9c4e4 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_bin_op.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_bin_op.h @@ -103,7 +103,7 @@ public: uint32 srcStep = (1 << 16) ) const; - virtual void serial (NLMISC::IStream &f); + virtual void serial (NLMISC::IStream &f) throw(NLMISC::EStream); virtual void deleteElement (uint32 index); virtual void newElement (const CPSEmitterInfo &info); virtual void resize (uint32 capacity, uint32 nbPresentElements); diff --git a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h index 00d675e4e..2a9cbff45 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h @@ -282,7 +282,7 @@ inline float CPSAttribMakerBinOp::getMaxValue(void) const template inline CPSAttribMakerBinOp::CPSAttribMakerBinOp(const CPSAttribMakerBinOp &other) : CPSAttribMaker(other) // parent copy ctor { - CUniquePtr > a0(NLMISC::safe_cast *>(other._Arg[0]->clone())) + std::auto_ptr > a0(NLMISC::safe_cast *>(other._Arg[0]->clone())) , a1(NLMISC::safe_cast *>(other._Arg[1]->clone())); this->_Op = other._Op; this->_Size = other._Size; @@ -729,7 +729,7 @@ inline void CPSAttribMakerBinOp::makeN(CPSLocated *loc, //================================================================================================================= template -inline void CPSAttribMakerBinOp::serial (NLMISC::IStream &f) +inline void CPSAttribMakerBinOp::serial (NLMISC::IStream &f) throw(NLMISC::EStream) { if (f.isReading()) { diff --git a/code/nel/include/nel/3d/ps_attrib_maker_helper.h b/code/nel/include/nel/3d/ps_attrib_maker_helper.h index 2a4f243b6..10d29fe52 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_helper.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_helper.h @@ -96,7 +96,7 @@ template class CPSAttribMakerT : public CPSAttribMaker /// serialization of the object - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { sint ver = f.serialVersion(2); CPSAttribMaker::serial(f); @@ -1463,7 +1463,7 @@ public: CPSAttribMakerMemoryBase(const CPSAttribMakerMemoryBase &src) : CPSAttribMaker(src) // parent copy ctor { nlassert(src._Scheme); - CUniquePtr > s(NLMISC::safe_cast *>(src._Scheme->clone())); + std::auto_ptr > s(NLMISC::safe_cast *>(src._Scheme->clone())); this->_T = src._T; this->_DefaultValue = src._DefaultValue; this->_Scheme = s.release(); @@ -1624,7 +1624,7 @@ public: } /// serialisation of the object. Derivers MUST call this, (if they use the attribute of this class at least) - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); @@ -1744,7 +1744,7 @@ public: _MaxValue = other._MaxValue; } // serial. Should update min / max when reading - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual uint32 getMinValue(void) const { return _MinValue; } virtual uint32 getMaxValue(void) const { return _MaxValue; } virtual void newElement(const CPSEmitterInfo &info); @@ -1767,7 +1767,7 @@ public: _MaxValue = other._MaxValue; } // serial. Should update min / max when reading - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual sint32 getMinValue(void) const { return _MinValue; } virtual sint32 getMaxValue(void) const { return _MaxValue; } virtual void newElement(const CPSEmitterInfo &info); @@ -1790,7 +1790,7 @@ public: _MaxValue = other._MaxValue; } // serial. Should update min / max when reading - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual float getMinValue(void) const { return _MinValue; } virtual float getMaxValue(void) const { return _MaxValue; } virtual void newElement(const CPSEmitterInfo &info); diff --git a/code/nel/include/nel/3d/ps_attrib_maker_template.h b/code/nel/include/nel/3d/ps_attrib_maker_template.h index 86213880c..92953b86f 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_template.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_template.h @@ -24,8 +24,6 @@ #include "nel/misc/rgba.h" #include "nel/misc/traits_nl.h" -#include - namespace NL3D { /* @@ -93,7 +91,7 @@ public: CPSValueBlendFunc() {} /// serialization - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); f.serial(_StartValue, _EndValue); @@ -228,7 +226,7 @@ public: CPSValueBlendSampleFunc() {} /// serialization - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); if (f.isReading()) @@ -353,7 +351,7 @@ public: } /// serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); T getMaxValue(void) const @@ -482,18 +480,14 @@ void CPSValueGradientFunc::setValuesUnpacked(const T *valueTab, uint32 numVal _MaxValue = _MinValue = valueTab[0]; _NbValues = (numValues - 1) * nbStages; _Tab.resize(_NbValues + 1); -#ifdef NL_COMP_VC14 - std::copy(valueTab, valueTab + _NbValues + 1, stdext::make_checked_array_iterator(&_Tab[0], _Tab.size())); -#else std::copy(valueTab, valueTab + _NbValues + 1, &_Tab[0]); -#endif } template -void CPSValueGradientFunc::serial(NLMISC::IStream &f) +void CPSValueGradientFunc::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); f.serial(_NbStages); diff --git a/code/nel/include/nel/3d/ps_color.h b/code/nel/include/nel/3d/ps_color.h index 1be8fb329..d05d9cf11 100644 --- a/code/nel/include/nel/3d/ps_color.h +++ b/code/nel/include/nel/3d/ps_color.h @@ -66,7 +66,7 @@ public: { CPSValueBlendFunc::setValues(convertVBColor(startValue, _ColorType), convertVBColor(endValue, _ColorType)); } - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { setColorType(CVertexBuffer::TRGBA); CPSValueBlendFunc::serial(f); @@ -100,7 +100,7 @@ public: { CPSValueBlendSampleFunc::setValues(convertVBColor(startValue, _ColorType), convertVBColor(endValue, _ColorType)); } - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { setColorType(CVertexBuffer::TRGBA); CPSValueBlendSampleFunc::serial(f); @@ -124,7 +124,7 @@ public: NLMISC::CRGBA getValue(uint index) const; void setValues(const NLMISC::CRGBA *valueTab, uint32 numValues, uint32 nbStages); void setValuesUnpacked(const NLMISC::CRGBA *valueTab, uint32 numValues, uint32 nbStages); - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { setColorType(CVertexBuffer::TRGBA); CPSValueGradientFunc::serial(f); @@ -153,7 +153,7 @@ public: this->_F.setColorType(colorType); } // serialisation should always be done in RGBA mode, so enforce that - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { setColorType(CVertexBuffer::TRGBA); CPSAttribMakerT::serial(f); @@ -229,7 +229,7 @@ public: virtual void setColorType(CVertexBuffer::TVertexColorType colorType); virtual void setDefaultValue(NLMISC::CRGBA defaultValue); virtual NLMISC::CRGBA getDefaultValue(void) const; - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); protected: CVertexBuffer::TVertexColorType _ColorType; }; @@ -244,7 +244,7 @@ public: NLMISC_DECLARE_CLASS(CPSColorBinOp); CPSAttribMakerBase *clone() const { return new CPSColorBinOp(*this); } virtual void setColorType(CVertexBuffer::TVertexColorType colorType); - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); }; diff --git a/code/nel/include/nel/3d/ps_dot.h b/code/nel/include/nel/3d/ps_dot.h index 2bdb7603a..d5201ab3b 100644 --- a/code/nel/include/nel/3d/ps_dot.h +++ b/code/nel/include/nel/3d/ps_dot.h @@ -46,7 +46,7 @@ public: NLMISC_DECLARE_CLASS(CPSDot); ///serialisation - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// return true if there are transparent faces in the object virtual bool hasTransparentFaces(void); diff --git a/code/nel/include/nel/3d/ps_emitter.h b/code/nel/include/nel/3d/ps_emitter.h index b8d82bb45..00163c48e 100644 --- a/code/nel/include/nel/3d/ps_emitter.h +++ b/code/nel/include/nel/3d/ps_emitter.h @@ -51,14 +51,14 @@ public: //@} /// Return this bindable type - uint32 getType() const { return PSEmitter; } + uint32 getType(void) const { return PSEmitter; } /// Return priority for emitters - virtual uint32 getPriority() const { return 500; } + virtual uint32 getPriority(void) const { return 500; } /// Return true if this located bindable derived class holds alive emitters - virtual bool hasEmitters() const { nlassert(_Owner); return _Owner->getSize() != 0; } + virtual bool hasEmitters(void) { nlassert(_Owner); return _Owner->getSize() != 0; } virtual void step(TPSProcessPass pass); @@ -76,7 +76,7 @@ public: /// Display the emitter in edition mode - virtual void showTool(); + virtual void showTool(void); /** Set the type of located to be emitted. The default is NULL which mean that no emission will occur * \return true if the operation could be performed. It can fail when this cause the system the system to last forever, @@ -90,9 +90,9 @@ public: virtual void notifyTargetRemoved(CPSLocated *ptr); /// Get emitted type. - CPSLocated *getEmittedType() { return _EmittedType; } + CPSLocated *getEmittedType(void) { return _EmittedType; } /// Get const ptr on emitted type - const CPSLocated *getEmittedType() const { return _EmittedType; } + const CPSLocated *getEmittedType(void) const { return _EmittedType; } /** The type of emission. @@ -171,7 +171,7 @@ public: const CPSAttribMaker *getGenNbScheme(void) const { return _GenNbScheme; } /// Serialization - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); ///\name Speed vector options //@{ @@ -336,7 +336,7 @@ protected: * should not be called directly. Call CPSLocated::resize instead */ virtual void resize(uint32 size); - virtual void bounceOccurred(uint32 index, TAnimationTime timeToNextSimStep); + virtual void bounceOccured(uint32 index, TAnimationTime timeToNextSimStep); void updateMaxCountVect(); @@ -424,7 +424,7 @@ class CPSModulatedEmitter bool useEmitteeSpeedScheme(void) const { return _EmitteeSpeedScheme != NULL; } /// serialization - void serialEmitteeSpeedScheme(NLMISC::IStream &f); + void serialEmitteeSpeedScheme(NLMISC::IStream &f) throw(NLMISC::EStream); protected: @@ -470,7 +470,7 @@ public: } /// Serialisation - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSEmitterDirectionnal); @@ -506,7 +506,7 @@ class CPSRadialEmitter : public CPSEmitterDirectionnal if (CParticleSystem::getSerializeIdentifierFlag()) _Name = std::string("RadialEmitter"); } /// Serialisation - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSRadialEmitter); virtual void emit(const NLMISC::CVector &srcPos, uint32 index, NLMISC::CVector &pos, NLMISC::CVector &speed); }; @@ -527,7 +527,7 @@ public: } /// Serialisation - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSEmitterOmni); @@ -561,7 +561,7 @@ class CPSEmitterRectangle : public CPSEmitter, public CPSModulatedEmitter, publi } /// Serialisation - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSEmitterRectangle); @@ -636,7 +636,7 @@ public: } /// Serialisation - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSEmitterConic); @@ -675,7 +675,7 @@ public: } /// Serialisation - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSSphericalEmitter); diff --git a/code/nel/include/nel/3d/ps_face.h b/code/nel/include/nel/3d/ps_face.h index b62a9d50b..b46299eb1 100644 --- a/code/nel/include/nel/3d/ps_face.h +++ b/code/nel/include/nel/3d/ps_face.h @@ -69,7 +69,7 @@ public: */ CPSFace(CSmartPtr tex = NULL); - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSFace); /** Tells that all faces are turning in the same manner, and only have a rotationnal bias diff --git a/code/nel/include/nel/3d/ps_face_look_at.h b/code/nel/include/nel/3d/ps_face_look_at.h index 1d9b38a36..3ae6a59e3 100644 --- a/code/nel/include/nel/3d/ps_face_look_at.h +++ b/code/nel/include/nel/3d/ps_face_look_at.h @@ -40,7 +40,7 @@ public: */ CPSFaceLookAt(CSmartPtr tex = NULL); - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSFaceLookAt); diff --git a/code/nel/include/nel/3d/ps_fan_light.h b/code/nel/include/nel/3d/ps_fan_light.h index 1de8beaa9..19f5baaa5 100644 --- a/code/nel/include/nel/3d/ps_fan_light.h +++ b/code/nel/include/nel/3d/ps_fan_light.h @@ -47,7 +47,7 @@ public: CPSFanLight(uint32 nbFans = 7); /// Dtor ~CPSFanLight(); - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); //@} // Set the number of fans used for drawing (minimum is 3, maximum is 128) diff --git a/code/nel/include/nel/3d/ps_float.h b/code/nel/include/nel/3d/ps_float.h index be5044d2d..da8978af1 100644 --- a/code/nel/include/nel/3d/ps_float.h +++ b/code/nel/include/nel/3d/ps_float.h @@ -104,7 +104,7 @@ class CPSFloatCurveFunctor CCtrlPoint(float date, float value) : Date(date), Value(value) { nlassert(Date >= 0 && Date <= 1); } float Date; float Value; - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(Date, Value); } @@ -166,7 +166,7 @@ class CPSFloatCurveFunctor float getValue(float date) const; /// serialization - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); float getMinValue() const { return _MinValue; } float getMaxValue() const { return _MaxValue; } diff --git a/code/nel/include/nel/3d/ps_force.h b/code/nel/include/nel/3d/ps_force.h index 14be72150..e93c21361 100644 --- a/code/nel/include/nel/3d/ps_force.h +++ b/code/nel/include/nel/3d/ps_force.h @@ -70,7 +70,7 @@ public: virtual void show() = 0; /// Serial the force definition. MUST be called by deriver during their serialisation - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// check whether this force is integrable over time. The default is false virtual bool isIntegrable(void) const { return false; } @@ -175,7 +175,7 @@ public: /// get the attribute maker for a non constant intensity CPSAttribMaker *getIntensityScheme(void) { return _IntensityScheme; } const CPSAttribMaker *getIntensityScheme(void) const { return _IntensityScheme; } - void serialForceIntensity(NLMISC::IStream &f); + void serialForceIntensity(NLMISC::IStream &f) throw(NLMISC::EStream); protected: @@ -209,7 +209,7 @@ protected: class CPSForceIntensityHelper : public CPSForce, public CPSForceIntensity { public: - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) ; protected: virtual CPSLocated *getForceIntensityOwner(void) { return _Owner; } @@ -241,7 +241,7 @@ protected: * * // you can provide a serialization method. Note that that if the functor parameters are set before each use, * // it useless to serial something ... - * void serial(NLMISC::IStream &f) + * void serial(NLMISC::IStream &f) throw(NLMISC::EStream) * * protected: * ... @@ -275,7 +275,7 @@ public: /// serialization - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); CPSForce::serial(f); @@ -354,7 +354,7 @@ class CPSDirectionnalForce : public CPSForceIntensityHelper, public CPSDirection } /// serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSDirectionnalForce); @@ -397,7 +397,7 @@ public: } /// serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSGravity); @@ -443,7 +443,7 @@ public: } /// serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSCentralGravity); @@ -464,7 +464,7 @@ public: /// serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// Compute the force on the targets @@ -498,7 +498,7 @@ public: speed -= (CParticleSystem::EllapsedTime * _K * invMass * speed); } - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); // we don't save intensity info : it is saved by the owning object (and set before each use of this functor) @@ -539,7 +539,7 @@ public: NLMISC_DECLARE_CLASS(CPSFluidFriction) - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); CIsotropicForceT::serial(f); @@ -571,7 +571,7 @@ public: NLMISC_DECLARE_CLASS(CPSBrownianForce) - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// We provide a kind of integration on a predefined sequence virtual bool isIntegrable(void) const; @@ -648,7 +648,7 @@ struct CPSTurbulForceFunc */ } - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); f.serial(_Scale, _NumOctaves); @@ -686,7 +686,7 @@ public: NLMISC_DECLARE_CLASS(CPSTurbul) - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); CIsotropicForceT::serial(f); @@ -758,7 +758,7 @@ public: // serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); @@ -801,7 +801,7 @@ class CPSMagneticForce : public CPSDirectionnalForce } virtual void computeForces(CPSLocated &target); /// serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSMagneticForce); }; diff --git a/code/nel/include/nel/3d/ps_light.h b/code/nel/include/nel/3d/ps_light.h index 016dddaf9..31e159ae1 100644 --- a/code/nel/include/nel/3d/ps_light.h +++ b/code/nel/include/nel/3d/ps_light.h @@ -42,7 +42,7 @@ public: ~CPSLight(); NLMISC_DECLARE_CLASS(CPSLight); /// Serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); //@} virtual uint32 getType(void) const; virtual uint32 getPriority(void) const { return 600; } diff --git a/code/nel/include/nel/3d/ps_located.h b/code/nel/include/nel/3d/ps_located.h index e8bd62a20..30fa7defa 100644 --- a/code/nel/include/nel/3d/ps_located.h +++ b/code/nel/include/nel/3d/ps_located.h @@ -66,14 +66,14 @@ class CParticleSystem; /// This structure helps to perform the collision step, by telling which collisionner is the nearest if there are several candidate -/// a distance of -1 indicates that no collisions occurred +/// a distance of -1 indicates that no collisions occured struct CPSCollisionInfo { CPSCollisionInfo *Next; - float Dist; // Distance to the nearest collider, or -1 if not collision occurred + float Dist; // Distance to the nearest collider, or -1 if not collision occured NLMISC::CVector NewPos; - NLMISC::CVector NewSpeed; // The speed of particle after a collision occurred. After the updated of collision it is swapped with the post-collision speed - CPSZone *CollisionZone; // The zone on which the bounce occurred, can be useful to check the behaviour in case of collision + NLMISC::CVector NewSpeed; // The speed of particle after a collision occured. After the updated of collision it is swapped with the post-collision speed + CPSZone *CollisionZone; // The zone on which the bounce occured, can be useful to check the behaviour in case of collision uint32 Index; CPSCollisionInfo() { @@ -356,7 +356,7 @@ public: void resize(uint32 newSize); /// serialization - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// Shortcut to get an instance of the 3d driver IDriver *getDriver() const; @@ -449,14 +449,14 @@ public: void setName(const std::string &name) { _Name = name; } /// get the located bindable name (edition purpose) - std::string getName() const { return _Name; } + std::string getName(void) const { return _Name; } /// tells whether there are alive entities / particles in the system - virtual bool hasParticles() const; + virtual bool hasParticles(void) const; /// tells whether there are alive emitters / particles in the system - virtual bool hasEmitters() const; + virtual bool hasEmitters(void) const; /** Enable the to force LOD degradation. This will suppress instances immediately, (during the motion pass) so that * there won't be more than maxNbInstance * dist / maxDist instances. This may not be desirable @@ -468,7 +468,7 @@ public: /** Test whether LOD degradation was activated * \see forceLODDegradation() */ - bool hasLODDegradation() const { return _LODDegradation; } + bool hasLODDegradation(void) const { return _LODDegradation; } /// for the CPSLocated to reevaluate the max number of faces it may need @@ -730,7 +730,7 @@ public: /// ctor CPSLocatedBindable(); /// serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /** this should be called before to delete any bindable inserted in a system, but this is done * by the system, so you should never need calling it. This has been introduced because calls in dtor are not polymorphic * to derived class (which are already destroyed anyway), and some infos are needed in some dtor. The default behaviour does nothing @@ -853,11 +853,11 @@ public: */ void setLOD(TPSLod lod) { _LOD = lod; } /// get the valid lods for that object - TPSLod getLOD() const { return _LOD; } + TPSLod getLOD(void) const { return _LOD; } /// tells whether there are alive entities / particles - virtual bool hasParticles() const { return false; } + virtual bool hasParticles(void) const { return false; } /// tells whether there are alive emitters - virtual bool hasEmitters() const { return false; } + virtual bool hasEmitters(void) const { return false; } /** set the extern ID of this located bindable. 0 means no extern access. The map of ID-locatedBindable. Is in th * particle system, so this located bindable must have been attached to a particle system, otherwise an assertion is raised */ @@ -906,10 +906,10 @@ protected: */ virtual void resize(uint32 size) = 0; - /** a bounce occurred, so some action could be done. The default behaviour does nothing + /** a bounce occured, so some action could be done. The default behaviour does nothing * \param index the index of the element that bounced */ - virtual void bounceOccurred(uint32 /* index */, TAnimationTime /* timeToNextsimStep */) {} + virtual void bounceOccured(uint32 /* index */, TAnimationTime /* timeToNextsimStep */) {} /** show an drawing to represent the object, and in red if it is selected * \param tab : a table of 2 * nbSeg vector. only the x and y coordinates are used @@ -1010,7 +1010,7 @@ public: */ virtual void releaseTargetRsc(CPSLocated * /* target */) {} /// Seralization, must be called by derivers - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// Finalize this object : the default is to call releaseTargetRsc on targets virtual void finalize(void); virtual ~CPSTargetLocatedBindable(); diff --git a/code/nel/include/nel/3d/ps_mesh.h b/code/nel/include/nel/3d/ps_mesh.h index 7eef01012..72ba76f4d 100644 --- a/code/nel/include/nel/3d/ps_mesh.h +++ b/code/nel/include/nel/3d/ps_mesh.h @@ -82,7 +82,7 @@ public: std::string getShape(void) const { return _Shape; } /// serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual ~CPSMesh(); @@ -271,7 +271,7 @@ public: /// serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSConstraintMesh); @@ -334,7 +334,7 @@ public: float WRotSpeed; /* = 0 */ float WRotAccel; /* = 0 */ CGlobalTexAnim(); - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// Build a texture matrix from a date and this obj. void buildMatrix(TAnimationTime date, NLMISC::CMatrix &dest); }; @@ -587,10 +587,10 @@ protected: struct CGlobalTexAnims { CGlobalTexAnim Anims[IDRV_MAT_MAXTEXTURES]; - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); }; - typedef CUniquePtr PGlobalTexAnims; + typedef std::auto_ptr PGlobalTexAnims; PGlobalTexAnims _GlobalTexAnims; float _GlobalAnimDate; diff --git a/code/nel/include/nel/3d/ps_particle_basic.h b/code/nel/include/nel/3d/ps_particle_basic.h index c7bdc242a..3674e6d9c 100644 --- a/code/nel/include/nel/3d/ps_particle_basic.h +++ b/code/nel/include/nel/3d/ps_particle_basic.h @@ -107,7 +107,7 @@ public: virtual uint32 getNumWantedTris() const = 0; /// serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { /// version 3 : global color lighting /// version 2 : auto-lod saved @@ -210,7 +210,7 @@ class CPSColoredParticle virtual ~CPSColoredParticle(); /// serialization. - void serialColorScheme(NLMISC::IStream &f); + void serialColorScheme(NLMISC::IStream &f) throw(NLMISC::EStream); protected: @@ -273,7 +273,7 @@ class CPSSizedParticle virtual ~CPSSizedParticle(); /// serialization. We choose a different name because of multiple-inheritance - void serialSizeScheme(NLMISC::IStream &f); + void serialSizeScheme(NLMISC::IStream &f) throw(NLMISC::EStream); protected: @@ -335,7 +335,7 @@ class CPSRotated2DParticle virtual ~CPSRotated2DParticle(); /// serialization. We choose a different name because of multiple-inheritance - void serialAngle2DScheme(NLMISC::IStream &f); + void serialAngle2DScheme(NLMISC::IStream &f) throw(NLMISC::EStream); @@ -453,7 +453,7 @@ class CPSTexturedParticle virtual ~CPSTexturedParticle(); /// serialization. We choose a different name because of multiple-inheritance - void serialTextureScheme(NLMISC::IStream &f); + void serialTextureScheme(NLMISC::IStream &f) throw(NLMISC::EStream); void enumTexs(std::vector > &dest); @@ -576,7 +576,7 @@ public: } /// serial this object - void serialMultiTex(NLMISC::IStream &f); + void serialMultiTex(NLMISC::IStream &f) throw(NLMISC::EStream); /** setup a material from this object and a primary texture * drv is used to check the device caps. @@ -683,7 +683,7 @@ class CPSRotated3DPlaneParticle virtual ~CPSRotated3DPlaneParticle(); /// serialization. We choose a different name because of multiple-inheritance - void serialPlaneBasisScheme(NLMISC::IStream &f); + void serialPlaneBasisScheme(NLMISC::IStream &f) throw(NLMISC::EStream); protected: /// if this is false, constant size will be used instead of a scheme @@ -806,7 +806,7 @@ public: enum TBlendingMode { add, modulate, alphaBlend, alphaTest }; /// serialization (not named 'serial' because it will be used via multiple-inheritance) - void serialMaterial(NLMISC::IStream &f); + void serialMaterial(NLMISC::IStream &f) throw(NLMISC::EStream); /// set the blending mode. The default is ass void setBlendingMode(CPSMaterial::TBlendingMode mode); diff --git a/code/nel/include/nel/3d/ps_plane_basis.h b/code/nel/include/nel/3d/ps_plane_basis.h index 3a36876f7..41882e148 100644 --- a/code/nel/include/nel/3d/ps_plane_basis.h +++ b/code/nel/include/nel/3d/ps_plane_basis.h @@ -66,7 +66,7 @@ struct CPlaneBasis } - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(X, Y) ; } diff --git a/code/nel/include/nel/3d/ps_plane_basis_maker.h b/code/nel/include/nel/3d/ps_plane_basis_maker.h index e798c9885..54770c9c9 100644 --- a/code/nel/include/nel/3d/ps_plane_basis_maker.h +++ b/code/nel/include/nel/3d/ps_plane_basis_maker.h @@ -128,7 +128,7 @@ class CPSPlaneBasisFollowSpeed : public CPSAttribMaker NLMISC_DECLARE_CLASS(CPSPlaneBasisFollowSpeed); /// serialization - virtual void serial(NLMISC::IStream &f) + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { // version 2 : added projection plane // version 1 : nothing to save here @@ -192,7 +192,7 @@ public: /// get the number of samples for the rotation uint32 getNumSamples(void) const; /// serial this object - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); protected: CPSVector::V _PBTab; uint32 _NbSamples; diff --git a/code/nel/include/nel/3d/ps_quad.h b/code/nel/include/nel/3d/ps_quad.h index 76e9562e2..000ff32cc 100644 --- a/code/nel/include/nel/3d/ps_quad.h +++ b/code/nel/include/nel/3d/ps_quad.h @@ -114,7 +114,7 @@ protected: void updateVbColNUVForRender(CVertexBuffer &vb, uint32 startIndex, uint32 numQuad, uint32 srcStep, IDriver &drv); /// DERIVERS MUST CALL this - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual CPSLocated *getColorOwner(void) { return _Owner; } virtual CPSLocated *getSizeOwner(void) { return _Owner; } virtual CPSLocated *getTextureIndexOwner(void) { return _Owner; } diff --git a/code/nel/include/nel/3d/ps_ribbon.h b/code/nel/include/nel/3d/ps_ribbon.h index 5383a1b4b..ccda62021 100644 --- a/code/nel/include/nel/3d/ps_ribbon.h +++ b/code/nel/include/nel/3d/ps_ribbon.h @@ -55,7 +55,7 @@ public: /// dtor ~CPSRibbon(); /// serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); // NLMISC_DECLARE_CLASS(CPSRibbon); ///@} diff --git a/code/nel/include/nel/3d/ps_ribbon_base.h b/code/nel/include/nel/3d/ps_ribbon_base.h index 5670a2d31..ea3443060 100644 --- a/code/nel/include/nel/3d/ps_ribbon_base.h +++ b/code/nel/include/nel/3d/ps_ribbon_base.h @@ -52,7 +52,7 @@ public: ///@{ CPSRibbonBase(); /// serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); ///@} ///\name Behaviour diff --git a/code/nel/include/nel/3d/ps_ribbon_look_at.h b/code/nel/include/nel/3d/ps_ribbon_look_at.h index 6da38694b..2494fe04c 100644 --- a/code/nel/include/nel/3d/ps_ribbon_look_at.h +++ b/code/nel/include/nel/3d/ps_ribbon_look_at.h @@ -38,7 +38,7 @@ public: /// dtor ~CPSRibbonLookAt(); /// serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); // NLMISC_DECLARE_CLASS(CPSRibbonLookAt); ///@} diff --git a/code/nel/include/nel/3d/ps_shockwave.h b/code/nel/include/nel/3d/ps_shockwave.h index 54774c58f..b8329a239 100644 --- a/code/nel/include/nel/3d/ps_shockwave.h +++ b/code/nel/include/nel/3d/ps_shockwave.h @@ -54,7 +54,7 @@ public: float getRadiusCut(void) const { return _RadiusCut; } /// serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CPSShockWave); diff --git a/code/nel/include/nel/3d/ps_sound.h b/code/nel/include/nel/3d/ps_sound.h index d1c990770..af5a7cc94 100644 --- a/code/nel/include/nel/3d/ps_sound.h +++ b/code/nel/include/nel/3d/ps_sound.h @@ -50,7 +50,7 @@ public: /// dtor ~CPSSound(); /// serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); //@} /// return this bindable type diff --git a/code/nel/include/nel/3d/ps_tail_dot.h b/code/nel/include/nel/3d/ps_tail_dot.h index a2aae6e83..3caf5fa96 100644 --- a/code/nel/include/nel/3d/ps_tail_dot.h +++ b/code/nel/include/nel/3d/ps_tail_dot.h @@ -37,7 +37,7 @@ public: /// dtor ~CPSTailDot(); /// serialisation. Derivers must override this, and call their parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); // NLMISC_DECLARE_CLASS(CPSTailDot); ///@} diff --git a/code/nel/include/nel/3d/ps_zone.h b/code/nel/include/nel/3d/ps_zone.h index 032d5db62..7289e64e0 100644 --- a/code/nel/include/nel/3d/ps_zone.h +++ b/code/nel/include/nel/3d/ps_zone.h @@ -82,7 +82,7 @@ public: /// serialization, DERIVER must override this, and call the parent version - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /** Inherited from CPSTargetLocatedBindable. It's called when one of the targets has been detroyed or detached @@ -120,7 +120,7 @@ protected: /** * This set speed of a located so that it looks like bouncing on a surface * \param locatedIndex the index - * \param bouncePoint the position where the collision occurred + * \param bouncePoint the position where the collision occured * \param surfNormal the normal of the surface at the collision point (this must be a unit vector) * \elasticity 1 = full bounce, 0 = no bounce (contact) * \ellapsedTime the time ellapsed @@ -155,7 +155,7 @@ class CPSZonePlane : public CPSZone, public IPSMover virtual NLMISC::CVector getNormal(uint32 index); virtual void setNormal(uint32 index, NLMISC::CVector n); - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); protected: TPSAttribVector _Normal; @@ -176,7 +176,7 @@ struct CRadiusPair { // the adius, and the square radius float R, R2; - void serial(NLMISC::IStream &f) + void serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(R, R2); } @@ -205,7 +205,7 @@ class CPSZoneSphere : public CPSZone, public IPSMover - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); // inherited from IPSMover @@ -257,7 +257,7 @@ class CPSZoneDisc : public CPSZone, public IPSMover virtual NLMISC::CVector getNormal(uint32 index); virtual void setNormal(uint32 index, NLMISC::CVector n); - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); @@ -303,7 +303,7 @@ class CPSZoneCylinder : public CPSZone, public IPSMover virtual NLMISC::CVector getScale(uint32 k) const; // serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); @@ -350,7 +350,7 @@ class CPSZoneRectangle : public CPSZone, public IPSMover // serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); // inherited from IPSMover virtual bool supportUniformScaling(void) const { return true; } diff --git a/code/nel/include/nel/3d/quad_grid.h b/code/nel/include/nel/3d/quad_grid.h index b03164520..12160b540 100644 --- a/code/nel/include/nel/3d/quad_grid.h +++ b/code/nel/include/nel/3d/quad_grid.h @@ -654,7 +654,7 @@ template typename CQuadGrid::CIterator CQuadGrid::erase(typename if(!ptr->Selected) next= NULL; // delete the object. - _NodeBlockMemory.freeBlock(ptr); + _NodeBlockMemory.free(ptr); return CIterator((CNode*)next); diff --git a/code/nel/include/nel/3d/ray_mesh.h b/code/nel/include/nel/3d/ray_mesh.h index 70a25c2be..80671a49c 100644 --- a/code/nel/include/nel/3d/ray_mesh.h +++ b/code/nel/include/nel/3d/ray_mesh.h @@ -53,7 +53,7 @@ public: public: // Simple Definition of a mesh used to test against Ray - std::vector Vertices; + std::vector Vertices; std::vector Triangles; /// Empty? diff --git a/code/nel/include/nel/3d/render_trav.h b/code/nel/include/nel/3d/render_trav.h index 41570c2ca..6e41d8282 100644 --- a/code/nel/include/nel/3d/render_trav.h +++ b/code/nel/include/nel/3d/render_trav.h @@ -28,8 +28,6 @@ #include "nel/3d/shadow_map_manager.h" #include "nel/3d/u_scene.h" #include "nel/3d/vertex_program.h" -#include "nel/3d/transform.h" - #include diff --git a/code/nel/include/nel/3d/seg_remanence_shape.h b/code/nel/include/nel/3d/seg_remanence_shape.h index 2f8a159ff..6a1f2cb5e 100644 --- a/code/nel/include/nel/3d/seg_remanence_shape.h +++ b/code/nel/include/nel/3d/seg_remanence_shape.h @@ -22,7 +22,7 @@ #include "nel/misc/smart_ptr.h" #include "nel/misc/vector.h" #include "nel/misc/aabbox.h" -#include "nel/misc/class_id.h" + #include "nel/3d/texture.h" #include "nel/3d/shape.h" @@ -70,7 +70,7 @@ public: // assignement CSegRemanenceShape &operator = (const CSegRemanenceShape &other); - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CSegRemanenceShape); //@} diff --git a/code/nel/include/nel/3d/shadow_map.h b/code/nel/include/nel/3d/shadow_map.h index 84cc32af1..aa4921594 100644 --- a/code/nel/include/nel/3d/shadow_map.h +++ b/code/nel/include/nel/3d/shadow_map.h @@ -51,7 +51,7 @@ public: * The usage of this matrix is for UV projection: XYZ= WorldProjectionMatrix * UVW. * NB: Vj (ie for W) is mapped such that Vp means NearClip of the shadow and Vp+Vj means FarClip of the shadow */ - NLMISC::CMatrix LocalProjectionMatrix; + CMatrix LocalProjectionMatrix; /** Computed at shadow casting time. They are clipping planes used to clip receivers (mirror of the OBB). * Receivers may use them to clip sub received parts (as they which) @@ -63,7 +63,7 @@ public: /** Computed at shadow casting time. This is the LocalPos Bouding Box containing the shadow (AxisAligned). * \see generateClipInfoFromMatrix() */ - NLMISC::CAABBox LocalBoundingBox; + CAABBox LocalBoundingBox; // Filled by ShadowMapManager. This is the Last Frame Id we had update the texture. @@ -114,13 +114,13 @@ public: * driver->setupModelMatrix(localPosMatrix); * Then render his mesh. */ - void buildCasterCameraMatrix(const NLMISC::CVector &lightDir, const NLMISC::CMatrix &localPosMatrix, const NLMISC::CAABBox &bbShape, NLMISC::CMatrix &cameraMatrix); + void buildCasterCameraMatrix(const CVector &lightDir, const CMatrix &localPosMatrix, const CAABBox &bbShape, CMatrix &cameraMatrix); /** From the Camera matrix computed with buildCasterCameraMatrix, compute the LocalProjectionMatrix, which modify the * J axis according to backPoint and Shadow Depth. * NB: automatically calls the buildClipInfoFromMatrix() method */ - void buildProjectionInfos(const NLMISC::CMatrix &cameraMatrix, const NLMISC::CVector &backPoint, float shadowMaxDepth); + void buildProjectionInfos(const CMatrix &cameraMatrix, const CVector &backPoint, float shadowMaxDepth); /** The ShadowMap Caster can call this method after setting LocalProjectionMatrix. It computes auto the * LocalClipPlanes and LocalBoundingBox from it. NB: don't use it if you use buildProjectionInfos(). @@ -158,13 +158,13 @@ class CShadowMapProjector { public: CShadowMapProjector(); - void setWorldSpaceTextMat(const NLMISC::CMatrix &ws); - void applyToMaterial(const NLMISC::CMatrix &receiverWorldMatrix, CMaterial &material); + void setWorldSpaceTextMat(const CMatrix &ws); + void applyToMaterial(const CMatrix &receiverWorldMatrix, CMaterial &material); private: - NLMISC::CMatrix _WsTextMat; - NLMISC::CMatrix _XYZToUWVMatrix; - NLMISC::CMatrix _XYZToWUVMatrix; + CMatrix _WsTextMat; + CMatrix _XYZToUWVMatrix; + CMatrix _XYZToWUVMatrix; }; diff --git a/code/nel/include/nel/3d/shadow_map_manager.h b/code/nel/include/nel/3d/shadow_map_manager.h index 8f8267492..d52c0fb03 100644 --- a/code/nel/include/nel/3d/shadow_map_manager.h +++ b/code/nel/include/nel/3d/shadow_map_manager.h @@ -29,8 +29,7 @@ namespace NL3D { -class CTransform; -class CScene; +class CTransform; // *************************************************************************** diff --git a/code/nel/include/nel/3d/shadow_skin.h b/code/nel/include/nel/3d/shadow_skin.h index 7560e0c50..2b63a635d 100644 --- a/code/nel/include/nel/3d/shadow_skin.h +++ b/code/nel/include/nel/3d/shadow_skin.h @@ -33,9 +33,9 @@ namespace NL3D class CShadowVertex { public: - NLMISC::CVector Vertex; - uint32 MatrixId; - void serial(NLMISC::IStream &f) + CVector Vertex; + uint32 MatrixId; + void serial(NLMISC::IStream &f) { (void)f.serialVersion(0); @@ -82,7 +82,7 @@ public: * if don't intersect, dist2D="nearest distance to the ray", and distZ=0 * \param computeDist2D if false and don't intersect, then return dist2D=FLT_MAX, and distZ=0 */ - bool getRayIntersection(const NLMISC::CMatrix &toRaySpace, class CSkeletonModel &skeleton, + bool getRayIntersection(const CMatrix &toRaySpace, class CSkeletonModel &skeleton, const std::vector &matrixInfluences, float &dist2D, float &distZ, bool computeDist2D); private: diff --git a/code/nel/include/nel/3d/shape.h b/code/nel/include/nel/3d/shape.h index ec359aa7f..a8038e593 100644 --- a/code/nel/include/nel/3d/shape.h +++ b/code/nel/include/nel/3d/shape.h @@ -201,7 +201,7 @@ public: IShape* getShapePointer () const; /// serial the shape. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); private: IShape* _Shape; }; diff --git a/code/nel/include/nel/3d/skeleton_shape.h b/code/nel/include/nel/3d/skeleton_shape.h index 359a51fd3..a47be7f17 100644 --- a/code/nel/include/nel/3d/skeleton_shape.h +++ b/code/nel/include/nel/3d/skeleton_shape.h @@ -49,7 +49,7 @@ public: std::vector ActiveBones; public: - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); }; public: @@ -94,7 +94,7 @@ public: virtual float getNumTriangles (float distance); /// serial this skeletonshape. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CSkeletonShape); /// flush textures used by this shape. diff --git a/code/nel/include/nel/3d/stereo_hmd.h b/code/nel/include/nel/3d/stereo_hmd.h index 69f8e60dd..3276e78fe 100644 --- a/code/nel/include/nel/3d/stereo_hmd.h +++ b/code/nel/include/nel/3d/stereo_hmd.h @@ -54,7 +54,7 @@ public: virtual NLMISC::CQuat getOrientation() const = 0; /// Set the GUI reference - virtual void setInterfaceMatrix(const NLMISC::CMatrix &matrix) = 0; + virtual void setInterfaceMatrix(const NL3D::CMatrix &matrix) = 0; /// Get GUI center (1 = width, 1 = height, 0 = center) virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const = 0; diff --git a/code/nel/include/nel/3d/target_anim_ctrl.h b/code/nel/include/nel/3d/target_anim_ctrl.h index 19aae3c20..b2edf9f84 100644 --- a/code/nel/include/nel/3d/target_anim_ctrl.h +++ b/code/nel/include/nel/3d/target_anim_ctrl.h @@ -44,16 +44,16 @@ public: public: /// Target controled or direction controled. Default to DirectionMode - TMode Mode; + TMode Mode; /// \name Target and Direction specific // @{ /// For TargetMode, the world Position of the target. - NLMISC::CVector WorldTarget; + CVector WorldTarget; /// For TargetMode only, the Pos of eyes relative to the bone controlled. Default to (0,0,0) - NLMISC::CVector EyePos; + CVector EyePos; /// For DirectionMode, the WorldRotation to apply to the bone. NB: modified in execute() if TargetMode - NLMISC::CQuat CurrentWorldDirection; + CQuat CurrentWorldDirection; // @} /// \name Common @@ -61,13 +61,13 @@ public: /** This enable or disable the ctrl. When disabled or enabled, the ctrl ensure * that the movement does not "pop", respecting MaxAngularVelocity. Default to true. */ - bool Enabled; + bool Enabled; /// This give The World Orientation when the Mesh is in bind Pos (default to "LookBack"). - NLMISC::CQuat DefaultWorldDirection; + CQuat DefaultWorldDirection; /// The Maximum angle of rotation that can be performed between the Default Direction and Current Direction. Default to Pi/3 - float MaxAngle; + float MaxAngle; /// The Maximum Angular Velocity the ctrl can perform. Default to 2*Pi per second. - float MaxAngularVelocity; + float MaxAngularVelocity; // @} @@ -77,19 +77,19 @@ public: virtual ~CTargetAnimCtrl(); /// Called at compute() time. - virtual void execute(CSkeletonModel *model, CBone *bone); + virtual void execute(CSkeletonModel *model, CBone *bone); private: /// The last rotation computed (in LocalSkeleton Space). Used to smooth transition - NLMISC::CQuat _LastLSRotation; + CQuat _LastLSRotation; /// This tells that a Enable/Disable transition is in progress. - bool _LastEnabled; - bool _EnableToDisableTransition; + bool _LastEnabled; + bool _EnableToDisableTransition; - NLMISC::CQuat getCurrentLSRotationFromBone(CSkeletonModel *model, CBone *bone); + CQuat getCurrentLSRotationFromBone(CSkeletonModel *model, CBone *bone); }; diff --git a/code/nel/include/nel/3d/text_context.h b/code/nel/include/nel/3d/text_context.h index 1f75e1184..156ea9f79 100644 --- a/code/nel/include/nel/3d/text_context.h +++ b/code/nel/include/nel/3d/text_context.h @@ -88,7 +88,7 @@ public: void setShadeOutline (bool b) { _ShadeOutline = b; } - void setShadeExtent (float x, float y) { _ShadeExtentX = x; _ShadeExtentY = y; } + void setShadeExtent (float shext) { _ShadeExtent = shext; } /// The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255) void setShadeColor (NLMISC::CRGBA color) { _ShadeColor = color; } @@ -150,10 +150,6 @@ public: { nlassert (index < _CacheStrings.size()); CComputedString &rCS = _CacheStrings[index]; - if (rCS.CacheVersion != _FontManager->getCacheVersion()) - { - computeString(rCS.Text, rCS); - } if (_Shaded) { CRGBA bkup = rCS.Color; @@ -161,20 +157,19 @@ public: rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rextX = _ShadeExtentX * 0.7071f; - float rextY = _ShadeExtentY * 0.7071f; - rCS.render2D(*_Driver, x+rextX, z-rextY, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x-rextX, z-rextY, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x-rextX, z+rextY, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x+rextX, z+rextY, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x+_ShadeExtentX, z, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x-_ShadeExtentX, z, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); + float rext = _ShadeExtent * 0.7071f; + rCS.render2D(*_Driver, x+rext, z-rext, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x-rext, z-rext, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x-rext, z+rext, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x+rext, z+rext, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x+_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x-_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); } else { - rCS.render2D(*_Driver, x+_ShadeExtentX, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x+_ShadeExtent, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); } rCS.Color= bkup; } @@ -188,10 +183,6 @@ public: { nlassert (index < _CacheStrings.size()); CComputedString &rCS = _CacheStrings[index]; - if (rCS.CacheVersion != _FontManager->getCacheVersion()) - { - computeString(rCS.Text, rCS); - } if(_Shaded) { CRGBA bkup = rCS.Color; @@ -199,20 +190,19 @@ public: rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rextX = _ShadeExtentX * 0.7071f; - float rextY = _ShadeExtentY * 0.7071f; - rCS.render2DClip(*_Driver, rdrBuffer, x+rextX, z-rextY, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x-rextX, z-rextY, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x-rextX, z+rextY, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x+rextX, z+rextY, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtentX, z, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtentX, z, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x, z+_ShadeExtentY, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x, z-_ShadeExtentY, xmin, ymin, xmax, ymax); + float rext = _ShadeExtent * 0.7071f; + rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z-rext, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z-rext, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z+rext, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z+rext, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtent, z, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x, z+_ShadeExtent, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x, z-_ShadeExtent, xmin, ymin, xmax, ymax); } else { - rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtentX, z-_ShadeExtentY, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z-_ShadeExtent, xmin, ymin, xmax, ymax); } rCS.Color= bkup; } @@ -226,11 +216,6 @@ public: { nlassert (index < _CacheStrings.size()); CComputedString &rCS = _CacheStrings[index]; - if (rCS.CacheVersion != _FontManager->getCacheVersion()) - { - computeString(rCS.Text, rCS); - } - if (_Shaded) { CRGBA bkup = rCS.Color; @@ -238,20 +223,19 @@ public: rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rextX = _ShadeExtentX * 0.7071f; - float rextY = _ShadeExtentY * 0.7071f; - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rextX, y-rextY, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rextX, y-rextY, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rextX, y+rextY, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rextX, y+rextY, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtentX, y, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtentX, y, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y+_ShadeExtentY, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y-_ShadeExtentY, depth, xmin, ymin, xmax, ymax); + float rext = _ShadeExtent * 0.7071f; + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y-rext, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y-rext, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y+rext, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y+rext, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtent, y, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y+_ShadeExtent, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax); } else { - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtentX, y-_ShadeExtentY, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax); } rCS.Color= bkup; } @@ -274,20 +258,19 @@ public: _TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rextX = _ShadeExtentX * 0.7071f; - float rextY = _ShadeExtentY * 0.7071f; - _TempString.render2D(*_Driver,x+rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x+rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x+_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x,z+_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x,z-_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ); + float rext = _ShadeExtent * 0.7071f; + _TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); } else { - _TempString.render2D(*_Driver, x+_ShadeExtentX, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); + _TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); } _TempString.Color = bkup; } @@ -314,20 +297,19 @@ public: _TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rextX = _ShadeExtentX * 0.7071f; - float rextY = _ShadeExtentY * 0.7071f; - _TempString.render2D(*_Driver,x+rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x+rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x+_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x,z+_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x,z-_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ); + float rext = _ShadeExtent * 0.7071f; + _TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); } else { - _TempString.render2D(*_Driver, x+_ShadeExtentX, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); + _TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); } _TempString.Color = bkup; } @@ -430,8 +412,7 @@ private: bool _ShadeOutline; /// shade's extent (shadow size) - float _ShadeExtentX; - float _ShadeExtentY; + float _ShadeExtent; /// Shade color (default is black) NLMISC::CRGBA _ShadeColor; diff --git a/code/nel/include/nel/3d/text_context_user.h b/code/nel/include/nel/3d/text_context_user.h index 15e93c3f2..b05238dbf 100644 --- a/code/nel/include/nel/3d/text_context_user.h +++ b/code/nel/include/nel/3d/text_context_user.h @@ -80,7 +80,7 @@ public: bool getShaded() const; void setShadeOutline(bool b); bool getShadeOutline() const; - void setShadeExtent(float x, float y); + void setShadeExtent(float shext) ; void setShadeColor (NLMISC::CRGBA sc); NLMISC::CRGBA getShadeColor () const; void setKeep800x600Ratio(bool keep); diff --git a/code/nel/include/nel/3d/texture.h b/code/nel/include/nel/3d/texture.h index bd71a00fd..bb9b9165a 100644 --- a/code/nel/include/nel/3d/texture.h +++ b/code/nel/include/nel/3d/texture.h @@ -106,7 +106,7 @@ public: class ITexture : public CBitmap, public NLMISC::CRefCount, public NLMISC::IStreamable { public: -// NL_USES_DEFAULT_ARENA_OBJECT_ALLOCATOR // for fast alloc + NL_USES_DEFAULT_ARENA_OBJECT_ALLOCATOR // for fast alloc // Those enums MUST be the same than in UTexture!! enum TWrapMode { @@ -359,7 +359,7 @@ public: virtual bool allowDegradation() const { return false; } /// serial ITexture basic infos (clamp ...). - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /** Select a texture among several other (if this texture is a set of texture such as CTextureMultiFile) * The default does nothing diff --git a/code/nel/include/nel/3d/texture_blend.h b/code/nel/include/nel/3d/texture_blend.h index 5dcc7c6ea..7a910d91e 100644 --- a/code/nel/include/nel/3d/texture_blend.h +++ b/code/nel/include/nel/3d/texture_blend.h @@ -74,7 +74,7 @@ public: virtual void release(); // serial this texture datas - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); private: uint16 _BlendFactor; diff --git a/code/nel/include/nel/3d/texture_bump.h b/code/nel/include/nel/3d/texture_bump.h index 1fb6152de..7e4a099c9 100644 --- a/code/nel/include/nel/3d/texture_bump.h +++ b/code/nel/include/nel/3d/texture_bump.h @@ -47,7 +47,7 @@ public: const ITexture *getHeightMap() const { return _HeightMap; }; // serial this texture datas - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual bool supportSharing() const; diff --git a/code/nel/include/nel/3d/texture_cube.h b/code/nel/include/nel/3d/texture_cube.h index 4958f6628..979defa1c 100644 --- a/code/nel/include/nel/3d/texture_cube.h +++ b/code/nel/include/nel/3d/texture_cube.h @@ -77,7 +77,7 @@ public: virtual bool isTextureCube() const { return true; } /// Save the texture file name. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CTextureCube); /// If the face support multiple texture (such has CTextureMultiFile), this allow to select the active set diff --git a/code/nel/include/nel/3d/texture_dlm.h b/code/nel/include/nel/3d/texture_dlm.h index 0c16d95f6..18cf125a0 100644 --- a/code/nel/include/nel/3d/texture_dlm.h +++ b/code/nel/include/nel/3d/texture_dlm.h @@ -81,7 +81,7 @@ public: /// TextureDLM are system. Do not need to serialize them... // default ctor is required for compilation with NLMISC_DECLARE_CLASS, but never called... CTextureDLM() {nlstop;} - virtual void serial(NLMISC::IStream &/* f */) {nlstop;} + virtual void serial(NLMISC::IStream &/* f */) throw(NLMISC::EStream) {nlstop;} NLMISC_DECLARE_CLASS(CTextureDLM); diff --git a/code/nel/include/nel/3d/texture_emboss.h b/code/nel/include/nel/3d/texture_emboss.h index fed99f52a..a4c469a5c 100644 --- a/code/nel/include/nel/3d/texture_emboss.h +++ b/code/nel/include/nel/3d/texture_emboss.h @@ -46,7 +46,7 @@ public: const ITexture *getHeightMap() const { return _HeightMap; }; // serial this texture datas - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual bool supportSharing() const; virtual std::string getShareName() const; // @@ -54,16 +54,16 @@ public: bool isSharingEnabled() const { return !_DisableSharing; } // set the ambiant/ diffuse color to be added to the embossed texture - void setAmbient(NLMISC::CRGBA ambient) { _Ambient = ambient; touch(); } - void setDiffuse(NLMISC::CRGBA diffuse) { _Diffuse = diffuse; touch(); } + void setAmbient(CRGBA ambient) { _Ambient = ambient; touch(); } + void setDiffuse(CRGBA diffuse) { _Diffuse = diffuse; touch(); } // Set the direction of light (usually should be normalized). The bitmap is in the x,y plane void setLightDir(const NLMISC::CVector &lightDir) { _LightDir = lightDir; touch(); } // set a factor for the slope void setSlopeFactor(float factor) { _SlopeFactor = factor; touch(); } // - NLMISC::CRGBA getAmbient() const { return _Ambient; } - NLMISC::CRGBA getDiffuse() const { return _Diffuse; } - const NLMISC::CVector &getLightDir() const { return _LightDir; } + CRGBA getAmbient() const { return _Ambient; } + CRGBA getDiffuse() const { return _Diffuse; } + const CVector &getLightDir() const { return _LightDir; } float getSlopeFactor() const { return _SlopeFactor; } @@ -75,8 +75,8 @@ protected: // inherited from ITexture. Generate this bumpmap pixels virtual void doGenerate(bool async = false); NLMISC::CSmartPtr _HeightMap; - NLMISC::CRGBA _Ambient; - NLMISC::CRGBA _Diffuse; + CRGBA _Ambient; + CRGBA _Diffuse; NLMISC::CVector _LightDir; bool _DisableSharing; float _SlopeFactor; diff --git a/code/nel/include/nel/3d/texture_far.h b/code/nel/include/nel/3d/texture_far.h index 6fdb59f30..a55308b19 100644 --- a/code/nel/include/nel/3d/texture_far.h +++ b/code/nel/include/nel/3d/texture_far.h @@ -185,7 +185,7 @@ private: void rebuildPatch (const CVector2s texturePos, const CPatchIdent &pid); /// From IStreamable - virtual void serial(NLMISC::IStream &/* f */) {} + virtual void serial(NLMISC::IStream &/* f */) throw(NLMISC::EStream) {} // Some static buffers static NLMISC::CRGBA _LightmapExpanded[]; diff --git a/code/nel/include/nel/3d/texture_file.h b/code/nel/include/nel/3d/texture_file.h index 6f3620f47..c758b1d6c 100644 --- a/code/nel/include/nel/3d/texture_file.h +++ b/code/nel/include/nel/3d/texture_file.h @@ -122,7 +122,7 @@ public: void doGenerate(bool async = false); /// Save the texture file name. - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CTextureFile); diff --git a/code/nel/include/nel/3d/texture_font.h b/code/nel/include/nel/3d/texture_font.h index 865615b63..3aeb77b65 100644 --- a/code/nel/include/nel/3d/texture_font.h +++ b/code/nel/include/nel/3d/texture_font.h @@ -18,7 +18,6 @@ #define NL_TEXTURE_FONT_H #include "nel/misc/types_nl.h" -#include "nel/misc/rect.h" #include "nel/3d/texture.h" namespace NL3D @@ -26,6 +25,9 @@ namespace NL3D class CFontGenerator; +#define TEXTUREFONT_NBCATEGORY 5 // Config 1 +//#define TEXTUREFONT_NBCATEGORY 4 + // **************************************************************************** /** * CTextureFont @@ -35,77 +37,43 @@ class CTextureFont : public ITexture public: - // Holds info for glyphs rendered on atlas - struct SGlyphInfo - { - // font atlas info - uint32 CacheVersion; - - // atlas region with padding - uint32 X, Y, W, H; - - // rendered glyph size without padding - uint32 CharWidth; - uint32 CharHeight; - - // UV coords for rendered glyph without padding - float U0, V0, U1, V1; - - uint32 GlyphIndex; - sint Size; - bool Embolden; - bool Oblique; - CFontGenerator *FontGenerator; - - SGlyphInfo() - : CacheVersion(0), - U0(0.f), V0(0.f), U1(0.f), V1(0.f), - X(0), Y(0), W(0), H(0), CharWidth(0), CharHeight(0), - GlyphIndex(0), Size(0), Embolden(false), Oblique(false), FontGenerator(NULL) - { - } - }; - - // Holds info for glyphs displayed on screen struct SLetterInfo { + // To generate the letter ucchar Char; + CFontGenerator *FontGenerator; sint Size; bool Embolden; bool Oblique; - CFontGenerator *FontGenerator; - uint32 GlyphIndex; - uint32 CharWidth; // Displayed glyph height - uint32 CharHeight; // Displayed glyph height + + // The less recently used infos + SLetterInfo *Next, *Prev; + + uint Cat; // 8x8, 16x16, 24x24, 32x32 + + ////////////////////////////////////////////////////////////////////// + + float U ,V; + uint32 CharWidth; + uint32 CharHeight; + uint32 GlyphIndex; // number of the character in the this font sint32 Top; // Distance between origin and top of the texture sint32 Left; // Distance between origin and left of the texture sint32 AdvX; // Advance to the next caracter - - SGlyphInfo* glyph; - - SLetterInfo() - : Char(0), Size(0), Embolden(false), Oblique(false), FontGenerator(NULL), - GlyphIndex(0), CharWidth(0), CharHeight(0), Top(0), Left(0), AdvX(0), - glyph(NULL) - { - } }; struct SLetterKey { ucchar Char; + CFontGenerator *FontGenerator; sint Size; bool Embolden; bool Oblique; - CFontGenerator *FontGenerator; - // Does not use FontGenerator in return value uint32 getVal(); - - SLetterKey():Char(0), FontGenerator(NULL), Size(0), Embolden(false), Oblique(false) - { - } + //bool operator < (const SLetterKey&k) const; + //bool operator == (const SLetterKey&k) const; }; public: @@ -120,80 +88,23 @@ public: void doGenerate (bool async = false); // This function manage the cache if the letter wanted does not exist - // \param render Set to true if letter is currently visible on screen - SLetterInfo* getLetterInfo (SLetterKey& k, bool render); + SLetterInfo* getLetterInfo (SLetterKey& k); void dumpTextureFont (const char *filename); - // Version is increased with each rebuild of font atlas - uint32 getCacheVersion() const { return _CacheVersion; } - private: - uint32 _CacheVersion; - - // current texture size - uint32 _TextureSizeX; - uint32 _TextureSizeY; - - // maximum texture size allowed - uint32 _TextureMaxW; - uint32 _TextureMaxH; - - // padding around glyphs - uint8 _PaddingL, _PaddingT; - uint8 _PaddingR, _PaddingB; // To find a letter in the texture + std::map Accel; - // Keep track of available space in main texture - std::vector _AtlasNodes; + std::vector Letters[TEXTUREFONT_NBCATEGORY]; + SLetterInfo *Front[TEXTUREFONT_NBCATEGORY], *Back[TEXTUREFONT_NBCATEGORY]; - std::vector _Letters; - - // lookup letter from letter cache or create new - SLetterInfo* findLetter(SLetterKey& k, bool insert); - - // lower/upper bound of glyphs to render, sizes outside are scaled bitmaps - uint _MinGlyphSize; - uint _MaxGlyphSize; - // start using size stem from this font size - uint _GlyphSizeStepMin; - // every n'th font size is rendered, intermediates are using bitmap scaling - uint _GlyphSizeStep; - - // rendered glyph cache - std::list _GlyphCache; - SGlyphInfo* findLetterGlyph(SLetterInfo *letter, bool insert); - - // render letter glyph into glyph cache - SGlyphInfo* renderLetterGlyph(SLetterInfo *letter, uint32 bitmapFontSize); - - // copy glyph bitmap into texture and invalidate that region - void copyGlyphBitmap(uint8* bitmap, uint32 bitmapW, uint32 bitmapH, uint32 atlasX, uint32 atlasY); - - // Find best fit for WxH rect in atlas - uint fitRegion(uint index, uint width, uint height); - - // Return top/left from font texture or false if there is no more room - bool reserveAtlas(const uint32 width, const uint32 height, uint32 &x, uint32 &y); - - // repack glyphs, resize texture, and invalidate unused glyphs. - void repackAtlas(); - void repackAtlas(uint32 width, uint32 height); - - // resize texture, - bool resizeAtlas(); - - // remove all glyphs from atlas, clear glyph cache, letter info is kept - void clearAtlas(); - - // if return true: newW, newH contains next size font atlas should be resized - // if return false: _TextureMaxW and _TextureMaxH is reached - bool getNextTextureSize(uint32 &newW, uint32 &newH) const; + void rebuildLetter (sint cat, sint x, sint y); /// Todo: serialize a font texture. public: - virtual void serial(NLMISC::IStream &/* f */) {nlstop;} + virtual void serial(NLMISC::IStream &/* f */) throw(NLMISC::EStream) {nlstop;} NLMISC_DECLARE_CLASS(CTextureFont); }; diff --git a/code/nel/include/nel/3d/texture_grouped.h b/code/nel/include/nel/3d/texture_grouped.h index f6f9515a0..247dd455a 100644 --- a/code/nel/include/nel/3d/texture_grouped.h +++ b/code/nel/include/nel/3d/texture_grouped.h @@ -111,7 +111,7 @@ public: void doGenerate(bool async = false); /// serialization - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// a group of 4 uvs diff --git a/code/nel/include/nel/3d/texture_mem.h b/code/nel/include/nel/3d/texture_mem.h index d28218151..01ea393f1 100644 --- a/code/nel/include/nel/3d/texture_mem.h +++ b/code/nel/include/nel/3d/texture_mem.h @@ -160,7 +160,7 @@ public: void setAllowDegradation(bool allow); /// Todo: serialize a mem texture. - virtual void serial(NLMISC::IStream &/* f */) {nlstop;} + virtual void serial(NLMISC::IStream &/* f */) throw(NLMISC::EStream) {nlstop;} NLMISC_DECLARE_CLASS(CTextureMem); /** This create a white square texture of 1x1 diff --git a/code/nel/include/nel/3d/texture_multi_file.h b/code/nel/include/nel/3d/texture_multi_file.h index a32207995..37549b997 100644 --- a/code/nel/include/nel/3d/texture_multi_file.h +++ b/code/nel/include/nel/3d/texture_multi_file.h @@ -70,7 +70,7 @@ public: /// Generate the current selected texture, looking in CPath if necessary. virtual void doGenerate(bool async = false); /// Serial this object - virtual void serial(NLMISC::IStream &f); + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); NLMISC_DECLARE_CLASS(CTextureMultiFile); private: diff --git a/code/nel/include/nel/3d/texture_near.h b/code/nel/include/nel/3d/texture_near.h index 0c47ecec7..5a124b53b 100644 --- a/code/nel/include/nel/3d/texture_near.h +++ b/code/nel/include/nel/3d/texture_near.h @@ -77,7 +77,7 @@ public: /// TextureNear are system. Do not need to serialize them... // default ctor is required for compilation with NLMISC_DECLARE_CLASS, but never called... CTextureNear() {nlstop;} - virtual void serial(NLMISC::IStream &/* f */) {nlstop;} + virtual void serial(NLMISC::IStream &/* f */) throw(NLMISC::EStream) {nlstop;} NLMISC_DECLARE_CLASS(CTextureNear); private: diff --git a/code/nel/include/nel/3d/tile_bank.h b/code/nel/include/nel/3d/tile_bank.h index 7d4eda3a7..32a205e6d 100644 --- a/code/nel/include/nel/3d/tile_bank.h +++ b/code/nel/include/nel/3d/tile_bank.h @@ -77,7 +77,7 @@ public: { return (_Flags&NL3D_CTILE_FREE_FLAG)!=0; } - void serial(NLMISC::IStream &f); + void serial(class NLMISC::IStream &f) throw(NLMISC::EStream); void setFileName (TBitmap bitmapType, const std::string& name) { // not free @@ -140,7 +140,7 @@ public: private: void clearTile (CTile::TBitmap type); - void freeBlock () + void free () { nlassert ((_Flags&=NL3D_CTILE_FREE_FLAG)==0); _Flags|=NL3D_CTILE_FREE_FLAG; @@ -180,7 +180,7 @@ public: void clear(){ _TileSet.clear(); } - void serial(NLMISC::IStream &f); + void serial(class NLMISC::IStream &f) throw(NLMISC::EStream); private: // internal use @@ -210,7 +210,7 @@ public: { return _Tile; } - void serial(NLMISC::IStream &f); + void serial(class NLMISC::IStream &f) throw(NLMISC::EStream); private: sint32 _Tile; @@ -236,7 +236,7 @@ public: void doubleSize (); bool operator== (const CTileBorder& border) const; void operator= (const CTileBorder& border); - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); bool isSet() const { return _Set; @@ -320,7 +320,7 @@ public: // For edition: change the tileVegetableDesc. NB: only the TileVegetableDescFileName is serialised. void setTileVegetableDesc (const CTileVegetableDesc &tvd); /** try to load the vegetable tile desc associated with the fileName (nlinfo() if can't) - * lookup into CPath. no-op if string empty + * lookup into CPath. no-op if string=="". */ void loadTileVegetableDesc(); @@ -416,7 +416,7 @@ public: { return _ChildName.find(name)!=_ChildName.end(); } - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); private: static TFlagBorder getComplementaryBorder (TFlagBorder border); @@ -629,7 +629,7 @@ public: /// Postfix tile vegetable desc void postfixTileVegetableDesc (const char *filename); - void serial(NLMISC::IStream &f); + void serial(class NLMISC::IStream &f) throw(NLMISC::EStream); private: sint createTile (); void freeTile (int tileIndex); diff --git a/code/nel/include/nel/3d/tile_far_bank.h b/code/nel/include/nel/3d/tile_far_bank.h index 52f380439..35c04be8b 100644 --- a/code/nel/include/nel/3d/tile_far_bank.h +++ b/code/nel/include/nel/3d/tile_far_bank.h @@ -94,7 +94,7 @@ public: } /// Serial this tile - void serial (NLMISC::IStream &f); + void serial (class NLMISC::IStream &f) throw(NLMISC::EStream); private: /// RGBA Pixels vector @@ -141,7 +141,7 @@ public: } /// Serial this bank - void serial(NLMISC::IStream &f); + void serial(class NLMISC::IStream &f) throw(NLMISC::EStream); /// The far tile vector std::vector _TileVector; diff --git a/code/nel/include/nel/3d/track.h b/code/nel/include/nel/3d/track.h index 1ef8a4f1e..e3c88f800 100644 --- a/code/nel/include/nel/3d/track.h +++ b/code/nel/include/nel/3d/track.h @@ -166,7 +166,7 @@ public: /// Serial the template - virtual void serial (NLMISC::IStream& f) + virtual void serial (NLMISC::IStream& f) throw (NLMISC::EStream) { // Serial version (void)f.serialVersion (0); @@ -217,7 +217,7 @@ public: /// Serial the template - virtual void serial (NLMISC::IStream& f) + virtual void serial (NLMISC::IStream& f) throw (NLMISC::EStream) { // Serial version (void)f.serialVersion (0); diff --git a/code/nel/include/nel/3d/track_keyframer.h b/code/nel/include/nel/3d/track_keyframer.h index c49e63404..6cfb6736a 100644 --- a/code/nel/include/nel/3d/track_keyframer.h +++ b/code/nel/include/nel/3d/track_keyframer.h @@ -237,7 +237,7 @@ public: /// Serial the template - virtual void serial (NLMISC::IStream& f) + virtual void serial (NLMISC::IStream& f) throw (NLMISC::EStream) { // Serial version (void)f.serialVersion (0); diff --git a/code/nel/include/nel/3d/u_text_context.h b/code/nel/include/nel/3d/u_text_context.h index 4c1dfea47..0aa9ea2f9 100644 --- a/code/nel/include/nel/3d/u_text_context.h +++ b/code/nel/include/nel/3d/u_text_context.h @@ -205,7 +205,7 @@ public: * set the shadow's size * \param the shade extent */ - virtual void setShadeExtent (float x, float y) = 0; + virtual void setShadeExtent (float shext) = 0; /** * set the shadow's color * The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255) diff --git a/code/nel/include/nel/3d/u_transform.h b/code/nel/include/nel/3d/u_transform.h index 66315fa40..556be7908 100644 --- a/code/nel/include/nel/3d/u_transform.h +++ b/code/nel/include/nel/3d/u_transform.h @@ -32,7 +32,6 @@ using NLMISC::CQuat; class ILogicInfo; class CCluster; -class ITransformable; // *************************************************************************** /** diff --git a/code/nel/include/nel/3d/vegetable_light_ex.h b/code/nel/include/nel/3d/vegetable_light_ex.h index d9c1f2f0b..a513dbeab 100644 --- a/code/nel/include/nel/3d/vegetable_light_ex.h +++ b/code/nel/include/nel/3d/vegetable_light_ex.h @@ -48,7 +48,7 @@ public: /// PointLights. Used at CVegetableManager::updateLighting() to get current colors of pointLights. CPointLightNamed *PointLight[MaxNumLight]; /// Direction of the light. the direction to the instance should be precomputed. - NLMISC::CVector Direction[MaxNumLight]; + CVector Direction[MaxNumLight]; /// Factor to be multiplied by color of the light. Actually it is the attenuation factor. uint PointLightFactor[MaxNumLight]; diff --git a/code/nel/include/nel/3d/vertex_buffer_heap.h b/code/nel/include/nel/3d/vertex_buffer_heap.h index 009d72489..c87426f7b 100644 --- a/code/nel/include/nel/3d/vertex_buffer_heap.h +++ b/code/nel/include/nel/3d/vertex_buffer_heap.h @@ -69,7 +69,7 @@ public: bool allocate(uint numVertices, uint &indexStart); /// free a subset of the VB. nlstop if subset not found... - void freeBlock(uint indexStart); + void free(uint indexStart); // @} diff --git a/code/nel/include/nel/3d/water_env_map.h b/code/nel/include/nel/3d/water_env_map.h index 2282610d7..50fca18ec 100644 --- a/code/nel/include/nel/3d/water_env_map.h +++ b/code/nel/include/nel/3d/water_env_map.h @@ -21,7 +21,6 @@ // #include "nel/3d/texture_cube.h" #include "nel/3d/texture_blank.h" -#include "nel/3d/animation_time.h" namespace NL3D diff --git a/code/nel/include/nel/3d/water_height_map.h b/code/nel/include/nel/3d/water_height_map.h index 003aaac53..f705c0368 100644 --- a/code/nel/include/nel/3d/water_height_map.h +++ b/code/nel/include/nel/3d/water_height_map.h @@ -79,7 +79,7 @@ public: /** Set the userPos (relative to the height map coordinates). This is needed because a height map can't be used with large surface (such as a sea). * As a consequence, the height map is only valid below the user (e.g from user.x - 0.5 * size to user.x + 0.5 *size). - * When setPos is called, and if a move has occurred, new area of the height field are set to 0 + * When setPos is called, and if a move has occured, new area of the height field are set to 0 * The pos set will be taken in account when buffers have been swapped (e.g when the propagation time as ellapsed) */ void setUserPos(sint x, sint y); @@ -168,7 +168,7 @@ public: sint64 Date; /// serial the pools data's - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); /// Set this pool name. void setName(const std::string &name) { _Name = name; } diff --git a/code/nel/include/nel/3d/water_pool_manager.h b/code/nel/include/nel/3d/water_pool_manager.h index c8a0885c9..569b5d59a 100644 --- a/code/nel/include/nel/3d/water_pool_manager.h +++ b/code/nel/include/nel/3d/water_pool_manager.h @@ -97,7 +97,7 @@ public: /// serial the pools data's - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); private: friend class CWaterShape; diff --git a/code/nel/include/nel/3d/water_shape.h b/code/nel/include/nel/3d/water_shape.h index 633da8611..dc7f20426 100644 --- a/code/nel/include/nel/3d/water_shape.h +++ b/code/nel/include/nel/3d/water_shape.h @@ -108,7 +108,7 @@ public: /// serial this shape - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); //@} @@ -299,7 +299,7 @@ public: /// serial this shape - void serial(NLMISC::IStream &f); + void serial(NLMISC::IStream &f) throw(NLMISC::EStream); //@} diff --git a/code/nel/include/nel/CMakeLists.txt b/code/nel/include/nel/CMakeLists.txt index 4df9413b5..b695104ae 100644 --- a/code/nel/include/nel/CMakeLists.txt +++ b/code/nel/include/nel/CMakeLists.txt @@ -2,36 +2,36 @@ SUBDIRS(misc) IF(WITH_3D) SUBDIRS(3d) -ENDIF() +ENDIF(WITH_3D) IF(WITH_GUI) ADD_SUBDIRECTORY(gui) -ENDIF() +ENDIF(WITH_GUI) IF(WITH_GEORGES) SUBDIRS(georges) -ENDIF() +ENDIF(WITH_GEORGES) IF(WITH_LIGO) SUBDIRS(ligo) -ENDIF() +ENDIF(WITH_LIGO) IF(WITH_LOGIC) SUBDIRS(logic) -ENDIF() +ENDIF(WITH_LOGIC) IF(WITH_NET) SUBDIRS(net) -ENDIF() +ENDIF(WITH_NET) IF(WITH_SOUND) SUBDIRS(sound) -ENDIF() +ENDIF(WITH_SOUND) IF(WITH_PACS) SUBDIRS(pacs) -ENDIF() +ENDIF(WITH_PACS) IF(WITH_NEL_CEGUI) SUBDIRS(cegui) -ENDIF() +ENDIF(WITH_NEL_CEGUI) diff --git a/code/nel/include/nel/georges/form.h b/code/nel/include/nel/georges/form.h index da5c0ea88..d2b6a2f2d 100644 --- a/code/nel/include/nel/georges/form.h +++ b/code/nel/include/nel/georges/form.h @@ -22,7 +22,7 @@ #include "form_elm.h" #include "header.h" -extern bool convertFormFile (const std::string &oldFileName, const std::string &newFileName); +extern bool convertFormFile (const char *oldFileName, const char *newFileName); namespace NLGEORGES { @@ -35,7 +35,7 @@ class UFormElm; class CForm : public UForm { friend class CFormLoader; - friend bool convertFormFile (const std::string &oldFileName, const std::string &newFileName); + friend bool convertFormFile (const char *oldFileName, const char *newFileName); public: enum { HeldElementCount = 4 }; @@ -73,12 +73,12 @@ public: // ** IO functions // Set the filename before saving the form - void write (xmlDocPtr doc, const std::string &filename); + void write (xmlDocPtr doc, const char *filename); // ** Parent access // Insert parent before parent indexed "before". - bool insertParent (uint before, const std::string &filename, CForm *parent); + bool insertParent (uint before, const char *filename, CForm *parent); // Remove a parent from parent list void removeParent (uint parent); @@ -97,7 +97,7 @@ public: const std::string &getFilename () const; // Error handling - void warning (bool exception, const std::string &function, const char *format, ... ) const; + void warning (bool exception, const char *function, const char *format, ... ) const; private: @@ -114,7 +114,7 @@ private: // CFormLoader call it // Set the filename before reading the form - void read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const std::string &filename); + void read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const char *filename); // Called by read void readParent (const char *parent, CFormLoader &loader); diff --git a/code/nel/include/nel/georges/form_dfn.h b/code/nel/include/nel/georges/form_dfn.h index 4e9870043..a93dcbe48 100644 --- a/code/nel/include/nel/georges/form_dfn.h +++ b/code/nel/include/nel/georges/form_dfn.h @@ -24,7 +24,7 @@ #include "header.h" #include "type.h" -bool convertDfnFile (const std::string &oldFileName, const std::string &newFileName); +bool convertDfnFile (const char *oldFileName, const char *newFileName); namespace NLGEORGES { @@ -41,7 +41,7 @@ class CFormDfn : public UFormDfn friend class CFormElm; friend class CFormLoader; friend class CFormElmStruct; - friend bool convertDfnFile (const std::string &oldFileName, const std::string &newFileName); + friend bool convertDfnFile (const char *oldFileName, const char *newFileName); public: // Default cstr @@ -60,7 +60,7 @@ public: friend class CFormElm; friend class CFormDfn; friend class CFormElmStruct; - friend bool convertDfnFile (const std::string &oldFileName, const std::string &newFileName); + friend bool convertDfnFile (const char *oldFileName, const char *newFileName); public: CEntry () @@ -85,12 +85,12 @@ public: TEntryType getType () const; // Set as a type - void setType (CFormLoader &loader, const std::string &filename); + void setType (CFormLoader &loader, const char *filename); void setType (TEntryType type); // Set as a dfn - void setDfn (CFormLoader &loader, const std::string &filename); + void setDfn (CFormLoader &loader, const char *filename); // Set as a dfn pointer void setDfnPointer (); @@ -99,7 +99,7 @@ public: const std::string &getName () const; // Set element Name - void setName (const std::string &name); + void setName (const char *name); // Get the filename const std::string &getFilename() const; @@ -108,16 +108,16 @@ public: const std::string &getFilenameExt() const; // Set the filename - void setFilename (const std::string &def); + void setFilename (const char *def); // Set the filename extension - void setFilenameExt (const std::string &ext); + void setFilenameExt (const char *ext); // Get default value const std::string &getDefault () const; // Set default value - void setDefault (const std::string &def); + void setDefault (const char *def); // Set array flag void setArrayFlag (bool flag); @@ -167,7 +167,7 @@ public: void removeEntry( uint idx ); // ** IO functions - void write (xmlDocPtr root, const std::string &filename); + void write (xmlDocPtr root, const char *filename); // Count parent DFN uint countParentDfn (uint32 round=0) const; @@ -185,7 +185,7 @@ public: void setNumParent (uint size); // Set a parent - void setParent (uint parent, CFormLoader &loader, const std::string &filename); + void setParent (uint parent, CFormLoader &loader, const char *filename); // Get a parent CFormDfn *getParent (uint parent) const; @@ -232,7 +232,7 @@ public: CFileHeader Header; // Error handling - void warning (bool exception, const std::string &function, const char *format, ... ) const; + void warning (bool exception, const char *function, const char *format, ... ) const; private: // The parents array @@ -249,7 +249,7 @@ private: private: // Read method called by the form loader - void read (xmlNodePtr doc, CFormLoader &loader, bool forceLoad, const std::string &filename); + void read (xmlNodePtr doc, CFormLoader &loader, bool forceLoad, const char *filename); }; } // NLGEORGES diff --git a/code/nel/include/nel/georges/form_elm.h b/code/nel/include/nel/georges/form_elm.h index 738e6a55a..2d9e76630 100644 --- a/code/nel/include/nel/georges/form_elm.h +++ b/code/nel/include/nel/georges/form_elm.h @@ -62,30 +62,30 @@ public: virtual void getFormName (std::string &result, const CFormElm *child=NULL) const = 0; // From UFormElm - virtual bool getNodeByName (const UFormElm **result, const std::string &name, TWhereIsNode *where, bool verbose, uint32 round=0) const; - virtual bool getNodeByName (UFormElm **result, const std::string &name, TWhereIsNode *where, bool verbose, uint32 round=0); - virtual bool getValueByName (std::string &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (sint8 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (uint8 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (sint16 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (uint16 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (sint32 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (uint32 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (float &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (double &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (bool &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool getValueByName (NLMISC::CRGBA &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; - virtual bool setValueByName (const std::string &value, const std::string &name, bool *created); - virtual bool setValueByName (sint8 value, const std::string &name, bool *created); - virtual bool setValueByName (uint8 value, const std::string &name, bool *created); - virtual bool setValueByName (sint16 value, const std::string &name, bool *created); - virtual bool setValueByName (uint16 value, const std::string &name, bool *created); - virtual bool setValueByName (sint32 value, const std::string &name, bool *created); - virtual bool setValueByName (uint32 value, const std::string &name, bool *created); - virtual bool setValueByName (float value, const std::string &name, bool *created); - virtual bool setValueByName (double value, const std::string &name, bool *created); - virtual bool setValueByName (bool value, const std::string &name, bool *created); - virtual bool setValueByName (NLMISC::CRGBA value, const std::string &name, bool *created); + virtual bool getNodeByName (const UFormElm **result, const char *name, TWhereIsNode *where, bool verbose, uint32 round=0) const; + virtual bool getNodeByName (UFormElm **result, const char *name, TWhereIsNode *where, bool verbose, uint32 round=0); + virtual bool getValueByName (std::string &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (sint8 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (uint8 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (sint16 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (uint16 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (sint32 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (uint32 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (float &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (double &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (bool &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool getValueByName (NLMISC::CRGBA &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const; + virtual bool setValueByName (const char *value, const char *name, bool *created); + virtual bool setValueByName (sint8 value, const char *name, bool *created); + virtual bool setValueByName (uint8 value, const char *name, bool *created); + virtual bool setValueByName (sint16 value, const char *name, bool *created); + virtual bool setValueByName (uint16 value, const char *name, bool *created); + virtual bool setValueByName (sint32 value, const char *name, bool *created); + virtual bool setValueByName (uint32 value, const char *name, bool *created); + virtual bool setValueByName (float value, const char *name, bool *created); + virtual bool setValueByName (double value, const char *name, bool *created); + virtual bool setValueByName (bool value, const char *name, bool *created); + virtual bool setValueByName (NLMISC::CRGBA value, const char *name, bool *created); virtual UFormElm *getParent () const; virtual const CType *getType (); virtual bool isArray () const; @@ -127,16 +127,16 @@ public: // ** Convert functions - inline bool convertValue (sint8 &result, const std::string &value) const; - inline bool convertValue (uint8 &result, const std::string &value) const; - inline bool convertValue (sint16 &result, const std::string &value) const; - inline bool convertValue (uint16 &result, const std::string &value) const; - inline bool convertValue (sint32 &result, const std::string &value) const; - inline bool convertValue (uint32 &result, const std::string &value) const; - inline bool convertValue (float &result, const std::string &value) const; - inline bool convertValue (double &result, const std::string &value) const; - inline bool convertValue (bool &result, const std::string &value) const; - inline bool convertValue (NLMISC::CRGBA &result, const std::string &value) const; + inline bool convertValue (sint8 &result, const char *value) const; + inline bool convertValue (uint8 &result, const char *value) const; + inline bool convertValue (sint16 &result, const char *value) const; + inline bool convertValue (uint16 &result, const char *value) const; + inline bool convertValue (sint32 &result, const char *value) const; + inline bool convertValue (uint32 &result, const char *value) const; + inline bool convertValue (float &result, const char *value) const; + inline bool convertValue (double &result, const char *value) const; + inline bool convertValue (bool &result, const char *value) const; + inline bool convertValue (NLMISC::CRGBA &result, const char *value) const; // ** Get dependencies virtual void getDependencies (std::set &dependencies) const = 0; @@ -144,7 +144,7 @@ public: // ** Internal node access // Create a node by name. If the node already exists, return it - bool createNodeByName (const std::string &, const CFormDfn **parentDfn, uint &indexDfn, + bool createNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, bool &created); @@ -153,13 +153,13 @@ public: * Delete a node by name. If the node already exists, return it *Delete its parent if not used */ - bool deleteNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn, + bool deleteNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array); // Search for a node by name - bool getNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn, + bool getNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, bool &parentVDfnArray, bool verbose, uint32 round) const; @@ -168,7 +168,7 @@ public: * Insert an array node by name * The index asked must be < the size of the array. */ - bool arrayInsertNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn, + bool arrayInsertNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, bool verbose, uint arrayIndex) const; @@ -177,7 +177,7 @@ public: * Delete an array node by name * The index asked must be < the size of the array. */ - bool arrayDeleteNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn, + bool arrayDeleteNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, bool verbose, uint arrayIndex) const; @@ -199,7 +199,7 @@ protected: * Then, else (*parentDfn / indexDfn ) or *node must be defined. * Other values are for result only. */ - static bool getInternalNodeByName (CForm *form, const std::string &name, const CFormDfn **parentDfn, uint &indexDfn, + static bool getInternalNodeByName (CForm *form, const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, TNodeAction action, bool &created, bool &parentVDfnArray, bool verbose, uint32 round); @@ -215,7 +215,7 @@ public: static const char* tokenize (const char *name, std::string &str, uint &errorIndex, uint &code); // ** IO functions - virtual xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName = "", bool forceWrite = false) const = 0; + virtual xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName = NULL, bool forceWrite = false) const = 0; protected: @@ -235,8 +235,8 @@ protected: uint32 Round; // Error handling - static void warning (bool exception, const std::string &formName, const std::string &formFileName, const std::string &function, const char *format, ... ); - virtual void warning (bool exception, const std::string &function, const char *format, ... ) const; + static void warning (bool exception, const char *formName, const char *formFileName, const char *function, const char *format, ... ); + virtual void warning (bool exception, const char *function, const char *format, ... ) const; private: // Tokens @@ -298,7 +298,7 @@ public: // From CFormElm bool isUsed (const CForm *form) const; - xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName, bool forceWrite = false) const; + xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName, bool forceWrite = false) const; void unlink (CFormElm *child); void getFormName (std::string &result, const CFormElm *child) const; void getDependencies (std::set &dependencies) const; @@ -310,7 +310,7 @@ public: std::vector Elements; // Error handling - virtual void warning (bool exception, const std::string &function, const char *format, ... ) const; + virtual void warning (bool exception, const char *function, const char *format, ... ) const; }; /** @@ -332,13 +332,13 @@ public: // From CFormElm bool isUsed (const CForm *form) const; - xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName, bool forceWrite = false) const; + xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName, bool forceWrite = false) const; // Call by CFormLoader void read (xmlNodePtr node, CFormLoader &loader, CForm *form); // Error handling - virtual void warning (bool exception, const std::string &function, const char *format, ... ) const; + virtual void warning (bool exception, const char *function, const char *format, ... ) const; }; /** @@ -377,7 +377,7 @@ public: bool getArrayValue (NLMISC::CRGBA &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const; // From CFormElm - xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName, bool forceWrite = false) const; + xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName, bool forceWrite = false) const; bool setParent (CFormElm *parent); void unlink (CFormElm *child); bool isUsed (const CForm *form) const; @@ -406,7 +406,7 @@ public: std::vector Elements; // Error handling - virtual void warning (bool exception, const std::string &function, const char *format, ... ) const; + virtual void warning (bool exception, const char *function, const char *format, ... ) const; }; /** @@ -429,7 +429,7 @@ public: const CType *Type; // From CFormElm - xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName, bool forceWrite = false) const; + xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName, bool forceWrite = false) const; bool setParent (CFormElm *parent); void getFormName (std::string &result, const CFormElm *child) const; void getDependencies (std::set &dependencies) const; @@ -453,7 +453,7 @@ public: bool getValue (NLMISC::CRGBA &result, TEval evaluate) const; // Set the value, the elt been used - void setValue (const std::string &value); + void setValue (const char *value); // Get the raw value. Does not care about any parent or default values void getValue (std::string &result) const; @@ -463,14 +463,14 @@ private: std::string Value; // Error handling - virtual void warning (bool exception, const std::string &function, const char *format, ... ) const; + virtual void warning (bool exception, const char *function, const char *format, ... ) const; }; // *************************************************************************** // CFormElm inlines // *************************************************************************** -inline bool CFormElm::convertValue (sint8 &result, const std::string &value) const +inline bool CFormElm::convertValue (sint8 &result, const char *value) const { float tmp; if (NLMISC::fromString(value, tmp)) @@ -482,14 +482,14 @@ inline bool CFormElm::convertValue (sint8 &result, const std::string &value) con else { // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in sint8.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in sint8.", value); } return false; } // *************************************************************************** -inline bool CFormElm::convertValue (uint8 &result, const std::string &value) const +inline bool CFormElm::convertValue (uint8 &result, const char *value) const { float tmp; if (NLMISC::fromString(value, tmp)) @@ -501,14 +501,14 @@ inline bool CFormElm::convertValue (uint8 &result, const std::string &value) con else { // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in uint8.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in uint8.", value); } return false; } // *************************************************************************** -inline bool CFormElm::convertValue (sint16 &result, const std::string &value) const +inline bool CFormElm::convertValue (sint16 &result, const char *value) const { float tmp; if (NLMISC::fromString(value, tmp)) @@ -520,14 +520,14 @@ inline bool CFormElm::convertValue (sint16 &result, const std::string &value) co else { // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in sint16.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in sint16.", value); } return false; } // *************************************************************************** -inline bool CFormElm::convertValue (uint16 &result, const std::string &value) const +inline bool CFormElm::convertValue (uint16 &result, const char *value) const { float tmp; if (NLMISC::fromString(value, tmp)) @@ -539,14 +539,14 @@ inline bool CFormElm::convertValue (uint16 &result, const std::string &value) co else { // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in uint16.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in uint16.", value); } return false; } // *************************************************************************** -inline bool CFormElm::convertValue (sint32 &result, const std::string &value) const +inline bool CFormElm::convertValue (sint32 &result, const char *value) const { float tmp; if (NLMISC::fromString(value, tmp)) @@ -558,14 +558,14 @@ inline bool CFormElm::convertValue (sint32 &result, const std::string &value) co else { // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in sint32.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in sint32.", value); } return false; } // *************************************************************************** -inline bool CFormElm::convertValue (uint32 &result, const std::string &value) const +inline bool CFormElm::convertValue (uint32 &result, const char *value) const { float tmp; if (NLMISC::fromString(value, tmp)) @@ -577,14 +577,14 @@ inline bool CFormElm::convertValue (uint32 &result, const std::string &value) co else { // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in uint32.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in uint32.", value); } return false; } // *************************************************************************** -inline bool CFormElm::convertValue (float &result, const std::string &value) const +inline bool CFormElm::convertValue (float &result, const char *value) const { if (NLMISC::fromString(value, result)) { @@ -593,16 +593,16 @@ inline bool CFormElm::convertValue (float &result, const std::string &value) con else { // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in float.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in float.", value); } return false; } // *************************************************************************** -inline bool CFormElm::convertValue (double &result, const std::string &value) const +inline bool CFormElm::convertValue (double &result, const char *value) const { - double tmp; + float tmp; if (NLMISC::fromString(value, tmp)) { result = tmp; @@ -611,14 +611,14 @@ inline bool CFormElm::convertValue (double &result, const std::string &value) co else { // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in double.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in double.", value); } return false; } // *************************************************************************** -inline bool CFormElm::convertValue (bool &result, const std::string &value) const +inline bool CFormElm::convertValue (bool &result, const char *value) const { int tmp; if (NLMISC::fromString(value, tmp)) @@ -628,7 +628,7 @@ inline bool CFormElm::convertValue (bool &result, const std::string &value) cons } else { - std::string temp = NLMISC::toLower(value); + std::string temp = NLMISC::toLower(std::string(value)); if (strcmp (temp.c_str (), "true") == 0) { result = true; @@ -642,17 +642,17 @@ inline bool CFormElm::convertValue (bool &result, const std::string &value) cons } // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in boolean.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in boolean.", value); return false; } // *************************************************************************** -inline bool CFormElm::convertValue (NLMISC::CRGBA &result, const std::string &value) const +inline bool CFormElm::convertValue (NLMISC::CRGBA &result, const char *value) const { float r, g, b; - if (sscanf (value.c_str(), "%f,%f,%f", &r, &g, &b) == 3) + if (sscanf (value, "%f,%f,%f", &r, &g, &b) == 3) { NLMISC::clamp (r, 0.f, 255.f); NLMISC::clamp (g, 0.f, 255.f); @@ -664,7 +664,7 @@ inline bool CFormElm::convertValue (NLMISC::CRGBA &result, const std::string &va } // Error message - warning (false, "convertValue", "Can't convert the string \"%s\" in RGB color.", value.c_str()); + warning (false, "convertValue", "Can't convert the string \"%s\" in RGB color.", value); return false; } diff --git a/code/nel/include/nel/georges/form_loader.h b/code/nel/include/nel/georges/form_loader.h index c46d79f22..75d7152ec 100644 --- a/code/nel/include/nel/georges/form_loader.h +++ b/code/nel/include/nel/georges/form_loader.h @@ -42,18 +42,18 @@ class CFormLoader : public UFormLoader public: virtual ~CFormLoader(); // From UFormLoader - UForm *loadForm (const std::string &filename); - UFormDfn *loadFormDfn (const std::string &filename); - UType *loadFormType (const std::string &filename); + UForm *loadForm (const char *filename); + UFormDfn *loadFormDfn (const char *filename); + UType *loadFormType (const char *filename); // Load type and formDfn - CType *loadType (const std::string &filename); - CFormDfn *loadFormDfn (const std::string &filename, bool forceLoad); + CType *loadType (const char *filename); + CFormDfn *loadFormDfn (const char *filename, bool forceLoad); private: // Error handling - virtual void warning (bool exception, const std::string &function, const char *format, ... ) const; + virtual void warning (bool exception, const char *function, const char *format, ... ) const; typedef std::map > TTypeMap; typedef std::map > TFormDfnMap; diff --git a/code/nel/include/nel/georges/header.h b/code/nel/include/nel/georges/header.h index 82a094b3d..343b2baa1 100644 --- a/code/nel/include/nel/georges/header.h +++ b/code/nel/include/nel/georges/header.h @@ -44,10 +44,10 @@ public: }; /// Add a log - void addLog(const std::string &log); + void addLog (const char *log); /// Set the comment - void setComments (const std::string &comments); + void setComments (const char *comments); /// Major version number uint32 MajorVersion; @@ -72,7 +72,7 @@ public: static const char *getStateString (TState state); // Error handling - void warning (bool exception, const std::string &function, const char *format, ... ) const; + void warning (bool exception, const char *function, const char *format, ... ) const; }; } // NLGEORGES diff --git a/code/nel/include/nel/georges/load_form.h b/code/nel/include/nel/georges/load_form.h index a927d21e0..4aaab43d0 100644 --- a/code/nel/include/nel/georges/load_form.h +++ b/code/nel/include/nel/georges/load_form.h @@ -385,7 +385,7 @@ void loadForm (const std::vector &sheetFilters, const std::string & } } - if(!NeededToRecompute.empty()) + if(NeededToRecompute.size() > 0) nlinfo ("%d seconds to recompute %d sheets", (uint32)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size()); // free the georges loader if necessary @@ -748,7 +748,7 @@ void loadForm2(const std::vector &sheetFilters, const std::string & } } - if(!NeededToRecompute.empty()) + if(NeededToRecompute.size() > 0) nlinfo ("%d seconds to recompute %d sheets", (uint32)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size()); // free the georges loader if necessary @@ -1304,7 +1304,7 @@ void loadFormNoPackedSheet (const std::vector &sheetFilters, std::m } } - if(!NeededToRecompute.empty()) + if(NeededToRecompute.size() > 0) nlinfo ("%d seconds to recompute %d sheets", (uint32)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size()); // free the georges loader if necessary @@ -1393,7 +1393,7 @@ void loadFormNoPackedSheet2 (const std::vector &sheetFilters, std:: } } - if(!NeededToRecompute.empty()) + if(NeededToRecompute.size() > 0) nlinfo ("%d seconds to recompute %d sheets", (uint32)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size()); // free the georges loader if necessary diff --git a/code/nel/include/nel/georges/type.h b/code/nel/include/nel/georges/type.h index e1bad7934..936506c7c 100644 --- a/code/nel/include/nel/georges/type.h +++ b/code/nel/include/nel/georges/type.h @@ -80,7 +80,7 @@ public: // Evaluate a node bool getValue (std::string &result, const class CForm *form, const class CFormElmAtom *node, const class CFormDfn &parentDfn, - uint parentIndex, UFormElm::TEval evaluate, uint32 *where, uint32 round, const std::string &formName) const; + uint parentIndex, UFormElm::TEval evaluate, uint32 *where, uint32 round, const char *formName) const; // Definitions class CDefinition @@ -114,8 +114,8 @@ public: private: // Error handling - virtual void warning (bool exception, const std::string &formName, const std::string &formFilename, const std::string &function, const char *format, ... ) const; - virtual void warning2 (bool exception, const std::string &function, const char *format, ... ) const; + virtual void warning (bool exception, const char *formName, const char *formFilename, const char *function, const char *format, ... ) const; + virtual void warning2 (bool exception, const char *function, const char *format, ... ) const; // Type names static const char *TypeNames[]; diff --git a/code/nel/include/nel/georges/u_form_elm.h b/code/nel/include/nel/georges/u_form_elm.h index f50582a04..6ec80938f 100644 --- a/code/nel/include/nel/georges/u_form_elm.h +++ b/code/nel/include/nel/georges/u_form_elm.h @@ -78,8 +78,8 @@ public: * "position.x" : get the element named x in the struct named position * "entities[2].color" : get the node named color in the second element of the entities array */ - virtual bool getNodeByName (const UFormElm **result, const std::string &name, TWhereIsNode *where = NULL, bool reserved=true, uint32 round=0) const = 0; - virtual bool getNodeByName (UFormElm **result, const std::string &name, TWhereIsNode *where = NULL, bool reserved=true, uint32 round=0) = 0; + virtual bool getNodeByName (const UFormElm **result, const char *name, TWhereIsNode *where = NULL, bool reserved=true, uint32 round=0) const = 0; + virtual bool getNodeByName (UFormElm **result, const char *name, TWhereIsNode *where = NULL, bool reserved=true, uint32 round=0) = 0; /// Where a value has been found @@ -104,19 +104,19 @@ public: * \return true if the result has been filled, false if the value has not been found or the cast has failed or the evaluation has failed. * \see getNodeByName () */ - virtual bool getValueByName (std::string &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; - virtual bool getValueByName (sint8 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; - virtual bool getValueByName (uint8 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; - virtual bool getValueByName (sint16 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; - virtual bool getValueByName (uint16 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; - virtual bool getValueByName (sint32 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; - virtual bool getValueByName (uint32 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; - virtual bool getValueByName (float &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; - virtual bool getValueByName (double &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; - virtual bool getValueByName (bool &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (std::string &result, const char *namename, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (sint8 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (uint8 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (sint16 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (uint16 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (sint32 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (uint32 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (float &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (double &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (bool &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; /// Warning, only R, G and B members are filled, not A. - virtual bool getValueByName (NLMISC::CRGBA &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; + virtual bool getValueByName (NLMISC::CRGBA &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0; /** * Set a form value with its name. If the node doesn't exist, it is created. @@ -129,17 +129,17 @@ public: * true if the value has been created, false it the value has been filled. * \return true if the value has been set, false if the value has not been found or hasn't been created. */ - virtual bool setValueByName (const std::string &value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (sint8 value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (uint8 value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (sint16 value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (uint16 value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (sint32 value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (uint32 value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (float value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (double value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (bool value, const std::string &name, bool *created = NULL) = 0; - virtual bool setValueByName (NLMISC::CRGBA value, const std::string &name, bool *created = NULL) = 0; + virtual bool setValueByName (const char *value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (sint8 value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (uint8 value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (sint16 value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (uint16 value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (sint32 value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (uint32 value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (float value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (double value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (bool value, const char *name, bool *created = NULL) = 0; + virtual bool setValueByName (NLMISC::CRGBA value, const char *name, bool *created = NULL) = 0; // ** Array element methods diff --git a/code/nel/include/nel/georges/u_form_loader.h b/code/nel/include/nel/georges/u_form_loader.h index c1cb30cfb..b32f358e0 100644 --- a/code/nel/include/nel/georges/u_form_loader.h +++ b/code/nel/include/nel/georges/u_form_loader.h @@ -43,19 +43,19 @@ public: * * The pointer on the form must be held in a CSmartPtr. Returns NULL if the form can't be loaded. */ - virtual UForm *loadForm (const std::string &filename) = 0; + virtual UForm *loadForm (const char *filename) = 0; /** Load a DFN, use NMISC::CPath to find the file. * * The pointer on the form must be held in a CSmartPtr. Returns NULL if the DFN can't be loaded. */ - virtual UFormDfn *loadFormDfn (const std::string &filename) = 0; + virtual UFormDfn *loadFormDfn (const char *filename) = 0; /** Load a type, use NMISC::CPath to find the file. * * The pointer on the form must be held in a CSmartPtr. Returns NULL if the type can't be loaded. */ - virtual UType *loadFormType (const std::string &filename) = 0; + virtual UType *loadFormType (const char *filename) = 0; /// Create a form loader static UFormLoader *createLoader (); diff --git a/code/nel/include/nel/gui/css_parser.h b/code/nel/include/nel/gui/css_parser.h deleted file mode 100644 index cfaf03caa..000000000 --- a/code/nel/include/nel/gui/css_parser.h +++ /dev/null @@ -1,150 +0,0 @@ -// Ryzom - 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 CL_CSS_PARSER_H -#define CL_CSS_PARSER_H - -#include "nel/misc/types_nl.h" -#include "nel/gui/css_style.h" -#include "nel/gui/css_selector.h" - -namespace NLGUI -{ - /** - * \brief CSS style parsing - * \date 2019-03-15 10:50 GMT - * \author Meelis Mägi (Nimetu) - */ - class CCssParser { - public: - // parse style declaration, eg "color: red; font-size: 10px;" - static TStyle parseDecls(const std::string &styleString); - - // parse css stylesheet - void parseStylesheet(const std::string &cssString, std::vector &rules); - - private: - // stylesheet currently parsed - ucstring _Style; - // keep track of current position in _Style - size_t _Position; - - std::vector _Rules; - - private: - // @media ( .. ) { .. } - void readAtRule(); - - // a#id.class[attr=val] { .. } - void readRule(); - - // move past whitespace - void skipWhitespace(); - - // skip valid IDENT - bool skipIdentifier(); - - // skip over {}, (), or [] block - void skipBlock(); - - // skip over string quoted with ' or " - void skipString(); - - // backslash escape - void escape(); - - // normalize newline chars and remove comments - void preprocess(); - - // parse selectors + combinators - std::vector parse_selector(const ucstring &sel, std::string &pseudoElement) const; - - // parse selector and style - void parseRule(const ucstring &selectorString, const ucstring &styleString); - - inline bool is_eof() const - { - return _Position >= _Style.size(); - } - - inline bool is_whitespace(ucchar ch) const - { - return (ch == (ucchar)' ' || ch == (ucchar)'\t' || ch == (ucchar)'\n'); - } - - inline bool is_hex(ucchar ch) const - { - return ((ch >= (ucchar)'0' && ch <= (ucchar)'9') || - (ch >= (ucchar)'a' && ch <= (ucchar)'f') || - (ch >= (ucchar)'A' && ch <= (ucchar)'F')); - } - - inline bool maybe_escape() const - { - // escaping newline (\n) only allowed inside strings - return (_Style.size() - _Position) >= 1 && _Style[_Position] == (ucchar)'\\' && _Style[_Position+1] != '\n'; - } - - inline bool is_quote(ucchar ch) const - { - return ch== (ucchar)'"' || ch == (ucchar)'\''; - } - - inline bool is_block_open(ucchar ch) const - { - return ch == (ucchar)'{' || ch == (ucchar)'[' || ch == (ucchar)'('; - } - - inline bool is_block_close(ucchar ch, ucchar open) const - { - return ((open == '{' && ch == (ucchar)'}') || - (open == '[' && ch == (ucchar)']') || - (open == '(' && ch == (ucchar)')')); - } - - inline bool is_comment_open() const - { - if (_Position+1 > _Style.size()) - return false; - - return _Style[_Position] == (ucchar)'/' && _Style[_Position+1] == (ucchar)'*'; - } - - inline bool is_nonascii(ucchar ch) const - { - return ch >= 0x80 /*&& ch <= 255*/; - } - - inline bool is_alpha(ucchar ch) const - { - return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); - } - - inline bool is_digit(ucchar ch) const - { - return ch >= '0' && ch <= '9'; - } - - inline bool is_nmchar(ucchar ch) const - { - // checking escape here does not check if next char is '\n' or not - return ch == '_' || ch == '-' || is_alpha(ch) || is_digit(ch) || is_nonascii(ch) || ch == '\\'/*is_escape(ch)*/; - } - }; -}//namespace - -#endif // CL_CSS_PARSER_H - diff --git a/code/nel/include/nel/gui/css_selector.h b/code/nel/include/nel/gui/css_selector.h deleted file mode 100644 index 84b039089..000000000 --- a/code/nel/include/nel/gui/css_selector.h +++ /dev/null @@ -1,107 +0,0 @@ -// Ryzom - 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 CL_CSS_SELECTOR_H -#define CL_CSS_SELECTOR_H - -#include "nel/misc/types_nl.h" - -namespace NLGUI -{ - class CHtmlElement; - - /** - * \brief CSS selector - * \date 2019-03-15 10:50 GMT - * \author Meelis Mägi (Nimetu) - */ - class CCssSelector - { - public: - enum ECombinator { - NONE = 0, - GENERAL_CHILD, - ADJACENT_SIBLING, - GENERAL_SIBLING, - CHILD_OF - }; - - struct SAttribute { - std::string key; - std::string value; - char op; // =, ~, |, ^, $, * - SAttribute(const std::string &k, const std::string &v, char o) - :key(k),value(v),op(o) - {} - }; - - std::string Element; - std::string Id; - std::vector Class; - std::vector Attr; - std::vector PseudoClass; - - // css combinator or \0 missing (first element) - char Combinator; - - public: - // TODO: rewrite for ECombinator enum - CCssSelector(std::string elm="", std::string id="", std::string cls="", char comb = '\0'); - - // helper for sorting - uint32 specificity() const; - - // set classes used, eg 'class1 class2' - void setClass(const std::string &cls); - - // add attribute to selector - // ' ' op means 'key exists, ignore value' - void addAttribute(const std::string &key, const std::string &val = "", char op = ' '); - - // add pseudo class to selector, eg 'first-child' - void addPseudoClass(const std::string &key); - - // true if no rules have been defined - bool empty() const - { - return Element.empty() && Id.empty() && Class.empty() && Attr.empty() && PseudoClass.empty(); - } - - // Test current selector to html DOM element - // NOTE: Does not check combinator - bool match(const CHtmlElement &elm) const; - - private: - bool matchClass(const CHtmlElement &elm) const; - bool matchAttributes(const CHtmlElement &elm) const; - bool matchPseudoClass(const CHtmlElement &elm) const; - - // match An+B rule to child index (1 based) - bool matchNth(sint childNr, sint a, sint b) const; - - // parse nth-child string to 'a' and 'b' components - // :nth-child(odd) - // :nth-child(even) - // :nth-child(An+B) - // :nth-child(-An+b) - void parseNth(const std::string &pseudo, sint &a, sint &b) const; - - }; - -}//namespace - -#endif // CL_CSS_SELECTOR_H - diff --git a/code/nel/include/nel/gui/css_style.h b/code/nel/include/nel/gui/css_style.h deleted file mode 100644 index 74fcf240d..000000000 --- a/code/nel/include/nel/gui/css_style.h +++ /dev/null @@ -1,227 +0,0 @@ -// Ryzom - 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 CL_CSS_STYLE_H -#define CL_CSS_STYLE_H - -#include "nel/misc/types_nl.h" -#include "nel/misc/rgba.h" -#include "nel/gui/css_selector.h" - -namespace NLGUI -{ - class CHtmlElement; - - typedef std::map TStyle; - - /** - * \brief CSS style rules - * \date 2019-03-15 10:50 GMT - * \author Meelis Mägi (Nimetu) - */ - class CStyleParams - { - public: - struct STextShadow - { - public: - STextShadow(bool enabled = false, bool outline = false, sint32 x=1, sint32 y=1, NLMISC::CRGBA color=NLMISC::CRGBA::Black) - : Enabled(enabled), Outline(outline), X(x), Y(y), Color(color) - { } - - bool Enabled; - bool Outline; - sint32 X; - sint32 Y; - NLMISC::CRGBA Color; - }; - public: - CStyleParams () : FontFamily(""), TextColor(255,255,255,255), TextShadow() - { - FontSize=10; - FontWeight=400; - FontOblique=false; - Underlined=false; - StrikeThrough=false; - GlobalColor=false; - Width=-1; - Height=-1; - MaxWidth=-1; - MaxHeight=-1; - BorderWidth=1; - BackgroundColor=NLMISC::CRGBA::Black; - BackgroundColorOver=NLMISC::CRGBA::Black; - } - - bool hasStyle(const std::string &key) const - { - return StyleRules.find(key) != StyleRules.end(); - } - - std::string getStyle(const std::string &key) const - { - TStyle::const_iterator it = StyleRules.find(key); - return (it != StyleRules.end() ? it->second : ""); - } - - public: - uint FontSize; - uint FontWeight; - bool FontOblique; - std::string FontFamily; - NLMISC::CRGBA TextColor; - STextShadow TextShadow; - bool GlobalColor; - bool Underlined; - bool StrikeThrough; - sint32 Width; - sint32 Height; - sint32 MaxWidth; - sint32 MaxHeight; - sint32 BorderWidth; - NLMISC::CRGBA BackgroundColor; - NLMISC::CRGBA BackgroundColorOver; - - std::string WhiteSpace; - std::string TextAlign; - std::string VerticalAlign; - - TStyle StyleRules; - }; - - class CCssStyle { - public: - struct SStyleRule { - std::vector Selector; - TStyle Properties; - - // pseudo element like ':before' - std::string PseudoElement; - - // returns selector specificity - uint specificity() const; - }; - - // 'browser' style, overwriten with '' - CStyleParams Root; - - // current element style - CStyleParams Current; - - // known style rules sorted by specificity - std::vector _StyleRules; - - private: - std::vector _StyleStack; - - // test if str is one of "thin/medium/thick" and return its pixel value - bool scanCssLength(const std::string& str, uint32 &px) const; - - // read style attribute - void getStyleParams(const std::string &styleString, CStyleParams &style, const CStyleParams ¤t) const; - void getStyleParams(const TStyle &styleRules, CStyleParams &style, const CStyleParams ¤t) const; - - // extract from styleRules into style.StyleRules (expand shorthand, normalize, calculate current font-size) - void normalize(const TStyle &styleRules, CStyleParams &style, const CStyleParams ¤t) const; - - // apply style.StyleRyles - void apply(CStyleParams &style, const CStyleParams ¤t) const; - - // merge src into dest by overwriting key in dest - void merge(TStyle &dst, const TStyle &src) const; - - // match selector to dom path - bool match(const std::vector &selector, const CHtmlElement &elm) const; - - // parse 'background' into 'background-color', 'background-image', etc - void parseBackgroundShorthand(const std::string &value, CStyleParams &style) const; - - public: - void reset(); - - // parse tag or css file content - void parseStylesheet(const std::string &styleString); - - // set element style from matching css rules - void getStyleFor(CHtmlElement &elm) const; - - inline uint getFontSizeSmaller() const - { - if (Current.FontSize < 5) - return 3; - return Current.FontSize-2; - } - - sint styleStackIndex = 0; - - inline void pushStyle() - { - styleStackIndex++; - _StyleStack.push_back(Current); - - Current.Width=-1; - Current.Height=-1; - Current.MaxWidth=-1; - Current.MaxHeight=-1; - Current.BorderWidth=1; - - Current.StyleRules.clear(); - } - - inline void popStyle() - { - styleStackIndex--; - if (_StyleStack.empty()) - { - Current = Root; - } - else - { - Current = _StyleStack.back(); - _StyleStack.pop_back(); - } - } - - // apply style to this.Root - void applyRootStyle(const std::string &styleString); - void applyRootStyle(const TStyle &styleRules); - - // apply style to this.Current - void applyStyle(const std::string &styleString); - void applyStyle(const TStyle &styleRules); - - void applyCssMinMax(sint32 &width, sint32 &height, sint32 minw=0, sint32 minh=0, sint32 maxw=0, sint32 maxh=0) const; - - // check if current style property matches value - bool checkStyle(const std::string &key, const std::string &val) const - { - return Current.hasStyle(key) && Current.getStyle(key) == val; - } - - bool hasStyle(const std::string &key) const - { - return Current.hasStyle(key); - } - - std::string getStyle(const std::string &key) const - { - return Current.getStyle(key); - } - }; -}//namespace - -#endif // CL_CSS_STYLE_H - diff --git a/code/nel/include/nel/gui/ctrl_scroll.h b/code/nel/include/nel/gui/ctrl_scroll.h index a22da2cbd..cf01ada78 100644 --- a/code/nel/include/nel/gui/ctrl_scroll.h +++ b/code/nel/include/nel/gui/ctrl_scroll.h @@ -175,7 +175,6 @@ namespace NLGUI bool _CallingAH : 1; bool _Cancelable : 1; // true if the slider may be cancelled when pressed on the mouse right button bool _Frozen : 1; - bool _Scale : 1; // For Target Scroller only: the target offset step in pixel. sint32 _TargetStepX; diff --git a/code/nel/include/nel/gui/ctrl_text_button.h b/code/nel/include/nel/gui/ctrl_text_button.h index e88ec81e1..69898639d 100644 --- a/code/nel/include/nel/gui/ctrl_text_button.h +++ b/code/nel/include/nel/gui/ctrl_text_button.h @@ -111,19 +111,9 @@ namespace NLGUI sint32 getWMin() const { return _WMin; } void setWMin( sint32 wmin ) { _WMin = wmin; } - sint32 getHMin() const { return _HMin; } - void setHMin( sint32 hmin ) { _HMin = hmin; } - // Compute Size according to bitmap and Text (Ensure as big as possible button) sint32 getWMax() const; - // Set texture directly without _l.tga, _m.tga, _r.tga convention - // Texture size is only read from normal textures - // If updateHeight == false, then _BmpH will keep its value - void setTexture(const std::string &l, const std::string &m, const std::string &r, bool updateHeight = true); - void setTexturePushed(const std::string &l, const std::string &m, const std::string &r); - void setTextureOver(const std::string &l, const std::string &m, const std::string &r); - int luaGetViewText(CLuaState &ls); REFLECT_EXPORT_START(CCtrlTextButton, CCtrlBaseButton) @@ -132,7 +122,6 @@ namespace NLGUI REFLECT_SINT32("text_x", getTextX, setTextX) REFLECT_SINT32("wmargin", getWMargin, setWMargin) REFLECT_SINT32("wmin", getWMin, setWMin) - REFLECT_SINT32("hmin", getHMin, setHMin) REFLECT_LUA_METHOD("getViewText", luaGetViewText) REFLECT_EXPORT_END @@ -162,8 +151,8 @@ namespace NLGUI sint32 _BmpLeftW, _BmpMiddleW, _BmpRightW, _BmpH; // Value to add to TextW to get button W. sint32 _WMargin; - // Min W, H Value - sint32 _WMin, _HMin; + // Min W Value + sint32 _WMin; sint32 _TextY; sint32 _TextX; THotSpot _TextPosRef; diff --git a/code/nel/include/nel/gui/dbgroup_combo_box.h b/code/nel/include/nel/gui/dbgroup_combo_box.h index 723afbdc0..87e6d758a 100644 --- a/code/nel/include/nel/gui/dbgroup_combo_box.h +++ b/code/nel/include/nel/gui/dbgroup_combo_box.h @@ -85,7 +85,6 @@ namespace NLGUI // view text void setViewText(const ucstring & text); ucstring getViewText() const; - CViewText *getViewText(); void setTexture(uint i, const ucstring &texture); diff --git a/code/nel/include/nel/gui/group_editbox.h b/code/nel/include/nel/gui/group_editbox.h index 14d9d55a5..771bdc482 100644 --- a/code/nel/include/nel/gui/group_editbox.h +++ b/code/nel/include/nel/gui/group_editbox.h @@ -264,7 +264,6 @@ namespace NLGUI // because of multiline, thz parent container will be moved to top // The good position can be restored by a press on enter then bool _WantReturn : 1; // Want return char, don't call the enter action handler - bool _ClearOnEscape : 1; // clear content when ESC is pressed? bool _Savable : 1; // should content be saved ? bool _DefaultInputString : 1; // Is the current input string the default one (should not be edited) bool _Frozen : 1; // is the control frozen? (cannot edit in it) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index fc29c840d..a794f349b 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -17,22 +17,21 @@ #ifndef CL_GROUP_HTML_H #define CL_GROUP_HTML_H +#include + #include "nel/misc/types_nl.h" #include "nel/gui/interface_group.h" #include "nel/gui/group_scrolltext.h" #include "nel/gui/group_tree.h" #include "nel/gui/ctrl_button.h" #include "nel/gui/group_table.h" -#include "nel/gui/html_element.h" -#include "nel/gui/css_style.h" +#include "nel/gui/libwww_types.h" -// forward declaration -typedef void CURLM; +typedef std::map TStyle; namespace NLGUI { class CCtrlButton; - class CCtrlTextButton; class CCtrlScroll; class CGroupList; class CGroupMenu; @@ -68,17 +67,41 @@ namespace NLGUI /// Maximum concurrent MultiCurl connections per CGroupHTML instance sint32 curlMaxConnections; - SWebOptions(): curlMaxConnections(5) + SWebOptions(): curlMaxConnections(2) { } }; static SWebOptions options; - - // ImageDownload system - enum TDataType {ImgType= 0, BnpType, StylesheetType}; - enum TImageType {NormalImage=0, OverImage}; + class CStyleParams + { + public: + CStyleParams () : FontFamily(""), 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; + std::string FontFamily; + NLMISC::CRGBA TextColor; + bool Underlined; + bool StrikeThrough; + sint32 Width; + sint32 Height; + sint32 MaxWidth; + sint32 MaxHeight; + }; + // Constructor CGroupHTML(const TCtorParam ¶m); ~CGroupHTML(); @@ -97,11 +120,8 @@ namespace NLGUI // Browse virtual void browse (const char *url); - // load css from local file and insert into active stylesheet collection - void parseStylesheetFile(const std::string &fname); - // parse html string using libxml2 parser - bool parseHtml(const std::string &htmlString); + virtual bool parseHtml(std::string htmlString); // Refresh void refresh(); @@ -112,8 +132,13 @@ namespace NLGUI // Browse error void browseError (const char *msg); + // stop browse + void stopBrowse (); + bool isBrowsing(); + void clean() { stopBrowse(); updateRefreshButton(); removeContent(); } + // Update coords void updateCoords(); @@ -122,10 +147,6 @@ namespace NLGUI // End of the paragraph void endParagraph(); - - // add image download (used by view_bitmap.cpp to load web images) - void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams(), const TImageType type = NormalImage); - std::string localImageName(const std::string &url); // Timeout void setTimeout(float tm) {_TimeoutValue= std::max(0.f, tm);} @@ -214,8 +235,6 @@ namespace NLGUI void browseUndo (); // Redo browse: Browse the precedent url undoed. no op if none void browseRedo (); - // disable refresh button - void clearRefresh(); // clear undo/redo void clearUndoRedo(); @@ -224,14 +243,14 @@ namespace NLGUI void setURL(const std::string &url); - int luaClearRefresh(CLuaState &ls); - int luaClearUndoRedo(CLuaState &ls); int luaBrowse(CLuaState &ls); int luaRefresh(CLuaState &ls); int luaRemoveContent(CLuaState &ls); int luaInsertText(CLuaState &ls); int luaAddString(CLuaState &ls); int luaAddImage(CLuaState &ls); + int luaBeginElement(CLuaState &ls); + int luaEndElement(CLuaState &ls); int luaShowDiv(CLuaState &ls); int luaParseHtml(CLuaState &ls); int luaRenderHtml(CLuaState &ls); @@ -239,38 +258,43 @@ namespace NLGUI REFLECT_EXPORT_START(CGroupHTML, CGroupScrollText) REFLECT_LUA_METHOD("browse", luaBrowse) REFLECT_LUA_METHOD("refresh", luaRefresh) - REFLECT_LUA_METHOD("clearUndoRedo", luaClearUndoRedo) - REFLECT_LUA_METHOD("clearRefresh", luaClearRefresh) REFLECT_LUA_METHOD("removeContent", luaRemoveContent) REFLECT_LUA_METHOD("insertText", luaInsertText) REFLECT_LUA_METHOD("addString", luaAddString) REFLECT_LUA_METHOD("addImage", luaAddImage) + REFLECT_LUA_METHOD("beginElement", luaBeginElement) + REFLECT_LUA_METHOD("endElement", luaEndElement) REFLECT_LUA_METHOD("showDiv", luaShowDiv) REFLECT_LUA_METHOD("parseHtml", luaParseHtml) REFLECT_LUA_METHOD("renderHtml", luaRenderHtml) REFLECT_STRING("url", getURL, setURL) REFLECT_FLOAT("timeout", getTimeout, setTimeout) - REFLECT_STRING("title", getTitle, setTitle) REFLECT_EXPORT_END protected : // \name callback from libwww - // Begin of the rendering of a HTML document + // Begin of the parsing of a HTML document virtual void beginBuild (); - // End of the rendering of a HTML document + // End of the parsing of a HTML document virtual void endBuild (); // A new text block has been parsed virtual void addText (const char * buf, int len); // A new begin HTML element has been parsed ( for exemple) - virtual void beginElement(CHtmlElement &elm); + 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(CHtmlElement &elm); + virtual void endElement (uint element_number); + + // A new begin unparsed element has been found + virtual void beginUnparsedElement(const char *buffer, int length); + + // A new end unparsed element has been found + virtual void endUnparsedElement(const char *buffer, int length); // Add GET params to the url virtual void addHTTPGetParams (std::string &url, bool trustedDomain); @@ -278,15 +302,16 @@ namespace NLGUI // Add POST params to the libwww list virtual void addHTTPPostParams (SFormFields &formfields, bool trustedDomain); + // the current request is terminated + 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(); - // parse dom node and all child nodes recursively - void renderDOM(CHtmlElement &elm); - - // Clear style stack and restore default style - void resetCssStyle(); - // Parse style html tag TStyle parseStyle(const std::string &str_styles); @@ -296,7 +321,7 @@ namespace NLGUI // \name internal methods // Add a group in the current parent group - void addHtmlGroup (CInterfaceGroup *group, uint beginSpace); + void addGroup (CInterfaceGroup *group, uint beginSpace); // Get the current parent group CInterfaceGroup *getCurrentGroup(); @@ -314,7 +339,7 @@ namespace NLGUI void addString(const ucstring &str); // Add an image in the current paragraph - void addImage(const std::string &id, const std::string &img, bool reloadImg=false, const CStyleParams &style = CStyleParams()); + 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); @@ -325,7 +350,7 @@ namespace NLGUI // 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, 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 @@ -339,8 +364,6 @@ namespace NLGUI // Set the title void setTitle (const ucstring &title); - void setTitle (const std::string &title); - std::string getTitle() const; // Lookup a url in local file system bool lookupLocalFile (std::string &result, const char *url, bool isUrl); @@ -353,14 +376,6 @@ namespace NLGUI // Current URL std::string _DocumentUrl; std::string _DocumentDomain; - std::string _DocumentHtml; // not updated, only set by first render - // If true, then render _DocumentHtml on next update (replaces content) - bool _RenderNextTime; - // true if renderer is waiting for css files to finish downloading (link rel=stylesheet) - bool _WaitingForStylesheet; - // list of css file urls that are queued up for download - std::vector _StylesheetQueue; - // Valid base href was found bool _IgnoreBaseUrlTag; // Fragment from loading url @@ -393,6 +408,7 @@ namespace NLGUI // Browsing.. bool _Browsing; + bool _Connecting; double _TimeoutValue; // the timeout in seconds double _ConnectingTimeout; sint _RedirectsRemaining; @@ -477,13 +493,79 @@ namespace NLGUI // IL mode bool _LI; - // Keep track of current element style - CCssStyle _Style; - CHtmlElement _HtmlDOM; - CHtmlElement *_CurrentHTMLElement; - // Backup of CurrentHTMLElement->nextSibling before ::beginElement() is called - // for luaParseHtml() to insert nodes into right place in right order - CHtmlElement *_CurrentHTMLNextSibling; + // Current text color + std::vector _TextColor; + inline const NLMISC::CRGBA &getTextColor() const + { + if (_TextColor.empty()) + return TextColor; + return _TextColor.back(); + } + + // Current global color flag + std::vector _GlobalColor; + inline bool getGlobalColor() const + { + if (_GlobalColor.empty()) + return false; + return _GlobalColor.back(); + } + + // Current font name + std::vector _FontFamily; + inline const char* getFontFamily() const + { + if (_FontFamily.empty()) + return ""; + return _FontFamily.back().c_str(); + } + + // Current font size + std::vector _FontSize; + inline uint getFontSize() const + { + if (_FontSize.empty()) + 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; @@ -630,14 +712,7 @@ namespace NLGUI std::vector _CellParams; // Indentation - std::vector _Indent; - inline uint getIndent() const { - if (_Indent.empty()) - return 0; - return _Indent.back(); - } - - + uint _Indent; // Current node is a title bool _Title; @@ -708,11 +783,15 @@ namespace NLGUI typedef std::map > TGroupHtmlByUIDMap; static TGroupHtmlByUIDMap _GroupHtmlByUID; + // read style attribute + void getStyleParams(const std::string &styleString, CStyleParams &style, bool inherit = true); + void applyCssMinMax(sint32 &width, sint32 &height, sint32 minw=0, sint32 minh=0, sint32 maxw=0, sint32 maxh=0); + // load and render local html file (from bnp for example) void doBrowseLocalFile(const std::string &filename); // load remote content using either GET or POST - void doBrowseRemoteUrl(std::string url, const std::string &referer, bool doPost = false, const SFormFields &formfields = SFormFields()); + void doBrowseRemoteUrl(const std::string &url, const std::string &referer, bool doPost = false, const SFormFields &formfields = SFormFields()); // render html string as new browser page bool renderHtmlString(const std::string &html); @@ -721,171 +800,72 @@ namespace NLGUI void buildHTTPPostParams (SFormFields &formfields); private: - friend class CHtmlParser; - - // move src->Children into CurrentHtmlElement.parent.children element - void spliceFragment(std::list::iterator src); - // decode all HTML entities static ucstring decodeHTMLEntities(const ucstring &str); + + // ImageDownload system + enum TDataType {ImgType= 0, BnpType}; struct CDataImageDownload { public: - CDataImageDownload(CViewBase *img, CStyleParams style, TImageType type): Image(img), Style(style), Type(type) + CDataImageDownload(CViewBase *img, CStyleParams style): Image(img), Style(style) { } public: CViewBase * Image; CStyleParams Style; - TImageType Type; }; struct CDataDownload { public: - CDataDownload(const std::string &u, const std::string &d, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams(), const TImageType imagetype = NormalImage) - : data(NULL), fp(NULL), url(u), dest(d), type(t), luaScript(s), md5sum(m), redirects(0), ConnectionTimeout(60) + CDataDownload(CURL *c, const std::string &u, const std::string &d, FILE *f, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams()) : curl(c), url(u), dest(d), luaScript(s), md5sum(m), type(t), fp(f) { - if (t == ImgType) imgs.push_back(CDataImageDownload(i, style, imagetype)); + if (t == ImgType) imgs.push_back(CDataImageDownload(i, style)); } - ~CDataDownload(); public: - CCurlWWWData *data; + CURL *curl; std::string url; std::string dest; std::string luaScript; std::string md5sum; TDataType type; - uint32 redirects; FILE *fp; std::vector imgs; - uint32 ConnectionTimeout; }; - std::list Curls; + std::vector Curls; CURLM *MultiCurl; int RunningCurls; - bool startCurlDownload(CDataDownload &download); - void finishCurlDownload(const CDataDownload &download); - void pumpCurlQueue(); - void initImageDownload(); void checkImageDownload(); + void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams()); + std::string localImageName(const std::string &url); std::string getAbsoluteUrl(const std::string &url); bool isTrustedDomain(const std::string &domain); - void setImage(CViewBase *view, const std::string &file, const TImageType type); + void setImage(CViewBase *view, const std::string &file); void setImageSize(CViewBase *view, const CStyleParams &style = CStyleParams()); - void setTextButtonStyle(CCtrlTextButton *ctrlButton, const CStyleParams &style); - void setTextStyle(CViewText *pVT, const CStyleParams &style); - // BnpDownload system void initBnpDownload(); void checkBnpDownload(); - bool addBnpDownload(std::string url, const std::string &action, const std::string &script, const std::string &md5sum); + bool addBnpDownload(const std::string &url, const std::string &action, const std::string &script, const std::string &md5sum); std::string localBnpName(const std::string &url); - // add css file from to download queue - void addStylesheetDownload(std::vector links); - - // stop all curl downalods (html and data) void releaseDownloads(); void checkDownloads(); - // _CurlWWW download finished - void htmlDownloadFinished(bool success, const std::string &error); - // images, stylesheets, etc finished downloading - void dataDownloadFinished(bool success, const std::string &error, CDataDownload &data); - // HtmlType download finished void htmlDownloadFinished(const std::string &content, const std::string &type, long code); - // stylesheet finished downloading. if local file does not exist, then it failed (404) - void cssDownloadFinished(const std::string &url, const std::string &local); - - // read common table/tr/td parameters and push them to _CellParams - void getCellsParameters(const CHtmlElement &elm, bool inherit); - - // render _HtmlDOM - void renderDocument(); - - // :before, :after rendering - void renderPseudoElement(const std::string &pseudo, const CHtmlElement &elm); - - // apply background from current style (for html, body) - void applyBackground(const CHtmlElement &elm); - - // HTML elements - void htmlA(const CHtmlElement &elm); - void htmlAend(const CHtmlElement &elm); - void htmlBASE(const CHtmlElement &elm); - void htmlBODY(const CHtmlElement &elm); - void htmlBR(const CHtmlElement &elm); - void htmlDD(const CHtmlElement &elm); - void htmlDDend(const CHtmlElement &elm); - //void htmlDEL(const CHtmlElement &elm); - void htmlDIV(const CHtmlElement &elm); - void htmlDIVend(const CHtmlElement &elm); - void htmlDL(const CHtmlElement &elm); - void htmlDLend(const CHtmlElement &elm); - void htmlDT(const CHtmlElement &elm); - void htmlDTend(const CHtmlElement &elm); - //void htmlEM(const CHtmlElement &elm); - void htmlFONT(const CHtmlElement &elm); - void htmlFORM(const CHtmlElement &elm); - void htmlH(const CHtmlElement &elm); - void htmlHend(const CHtmlElement &elm); - void htmlHEAD(const CHtmlElement &elm); - void htmlHEADend(const CHtmlElement &elm); - void htmlHR(const CHtmlElement &elm); - void htmlHTML(const CHtmlElement &elm); - void htmlI(const CHtmlElement &elm); - void htmlIend(const CHtmlElement &elm); - void htmlIMG(const CHtmlElement &elm); - void htmlINPUT(const CHtmlElement &elm); - void htmlLI(const CHtmlElement &elm); - void htmlLIend(const CHtmlElement &elm); - void htmlLUA(const CHtmlElement &elm); - void htmlLUAend(const CHtmlElement &elm); - void htmlMETA(const CHtmlElement &elm); - void htmlOBJECT(const CHtmlElement &elm); - void htmlOBJECTend(const CHtmlElement &elm); - void htmlOL(const CHtmlElement &elm); - void htmlOLend(const CHtmlElement &elm); - void htmlOPTION(const CHtmlElement &elm); - void htmlOPTIONend(const CHtmlElement &elm); - void htmlP(const CHtmlElement &elm); - void htmlPend(const CHtmlElement &elm); - void htmlPRE(const CHtmlElement &elm); - void htmlPREend(const CHtmlElement &elm); - void htmlSCRIPT(const CHtmlElement &elm); - void htmlSCRIPTend(const CHtmlElement &elm); - void htmlSELECT(const CHtmlElement &elm); - void htmlSELECTend(const CHtmlElement &elm); - //void htmlSMALL(const CHtmlElement &elm); - //void htmlSPAN(const CHtmlElement &elm); - //void htmlSTRONG(const CHtmlElement &elm); - void htmlSTYLE(const CHtmlElement &elm); - void htmlSTYLEend(const CHtmlElement &elm); - void htmlTABLE(const CHtmlElement &elm); - void htmlTABLEend(const CHtmlElement &elm); - void htmlTD(const CHtmlElement &elm); - void htmlTDend(const CHtmlElement &elm); - void htmlTEXTAREA(const CHtmlElement &elm); - void htmlTEXTAREAend(const CHtmlElement &elm); - void htmlTH(const CHtmlElement &elm); - void htmlTHend(const CHtmlElement &elm); - void htmlTITLE(const CHtmlElement &elm); - void htmlTITLEend(const CHtmlElement &elm); - void htmlTR(const CHtmlElement &elm); - void htmlTRend(const CHtmlElement &elm); - //void htmlU(const CHtmlElement &elm); - void htmlUL(const CHtmlElement &elm); - void htmlULend(const CHtmlElement &elm); + // cURL transfer callbacks + static size_t curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData); + static size_t curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData); + static size_t curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow); }; // adapter group that store y offset for inputs inside an html form diff --git a/code/nel/include/nel/gui/group_menu.h b/code/nel/include/nel/gui/group_menu.h index cfe91f7f9..e55bed751 100644 --- a/code/nel/include/nel/gui/group_menu.h +++ b/code/nel/include/nel/gui/group_menu.h @@ -191,7 +191,6 @@ namespace NLGUI int luaGetLineFromId(CLuaState &ls); int luaIsSeparator(CLuaState &ls); int luaAddLine(CLuaState &ls); - int luaAddIconLine(CLuaState &ls); int luaAddLineAtIndex(CLuaState &ls); int luaAddSeparator(CLuaState &ls); int luaAddSeparatorAtIndex(CLuaState &ls); @@ -211,7 +210,6 @@ namespace NLGUI REFLECT_LUA_METHOD("addSubMenu", luaAddSubMenu); REFLECT_LUA_METHOD("isSeparator", luaIsSeparator); REFLECT_LUA_METHOD("addLine", luaAddLine); // name, ah, ah_params, id - REFLECT_LUA_METHOD("addIconLine", luaAddIconLine); // name, ah, ah_params, id, texture REFLECT_LUA_METHOD("addLineAtIndex", luaAddLineAtIndex); // index, name, ah, ah_params, id REFLECT_LUA_METHOD("addSeparator", luaAddSeparator); REFLECT_LUA_METHOD("addSeparatorAtIndex", luaAddSeparatorAtIndex); @@ -280,7 +278,6 @@ namespace NLGUI */ CGroupSubMenu *cloneMenu(CGroupSubMenu *appendToMenu, CGroupMenu *newFather, CInterfaceGroup *initGroup = NULL) const; void initOptions(CInterfaceGroup *parent); - CViewBitmap *createIcon(CInterfaceElement *parentPos, const std::string &texture); CViewBitmap *createCheckBox(bool checked); CViewBitmap *createRightArrow(CInterfaceElement *parentPos, bool center); }; @@ -351,9 +348,6 @@ namespace NLGUI void setMinW(sint32 minW); void setMinH(sint32 minH); - // change fontsize for new menu items - void setFontSize(uint32 fontSize); - // Gray a line on the RootMenu void setGrayedLine(uint line, bool g); diff --git a/code/nel/include/nel/gui/group_paragraph.h b/code/nel/include/nel/gui/group_paragraph.h index 02f948582..b8792ece1 100644 --- a/code/nel/include/nel/gui/group_paragraph.h +++ b/code/nel/include/nel/gui/group_paragraph.h @@ -206,10 +206,11 @@ namespace NLGUI invalidateContent(); } - /// temporarily enable mouse over effect - // will be automatically disabled when mouse leaves element - void enableTempOver() { _TempOver = true; } - void disableTempOver() { _TempOver = false; } + // Set the HTML group used for links + void setBrowseGroup (CInterfaceElement *group) + { + _BrowseGroup = group; + } /// \from CInterfaceElement void onInvalidateContent(); @@ -238,8 +239,6 @@ namespace NLGUI // Do we have a color under the element pointed by the mouse bool _Over; - // Temporarily force mouse over effect. Deactivated when mouse moves away - bool _TempOver; // If over is true so we have a color NLMISC::CRGBA _OverColor; @@ -294,6 +293,9 @@ namespace NLGUI // The links std::vector _Links; + // The HTML group used + CInterfaceElement *_BrowseGroup; + private: std::string _HardText; uint32 _TextId; diff --git a/code/nel/include/nel/gui/group_table.h b/code/nel/include/nel/gui/group_table.h index 2be9ef98c..746078908 100644 --- a/code/nel/include/nel/gui/group_table.h +++ b/code/nel/include/nel/gui/group_table.h @@ -64,7 +64,7 @@ namespace NLGUI xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; // to be called by CGroupTable - bool parseCell (xmlNodePtr cur, CInterfaceGroup * parentGroup, uint columnIndex, uint rowIndex); + bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup, uint columnIndex, uint rowIndex); // If the cell is a new line. This is the first after a bool NewLine; diff --git a/code/nel/include/nel/gui/group_tree.h b/code/nel/include/nel/gui/group_tree.h index ae4bcb3d0..1b64122f3 100644 --- a/code/nel/include/nel/gui/group_tree.h +++ b/code/nel/include/nel/gui/group_tree.h @@ -97,7 +97,6 @@ namespace NLGUI void addChildSortedByBitmap(SNode *pNode); void setParentTree(CGroupTree *parent); void setFather(SNode *father); - void openAll(); void closeAll(); void makeOrphan(); bool parse (xmlNodePtr cur, CGroupTree *parentGroup); diff --git a/code/nel/include/nel/gui/html_element.h b/code/nel/include/nel/gui/html_element.h deleted file mode 100644 index bac681c1c..000000000 --- a/code/nel/include/nel/gui/html_element.h +++ /dev/null @@ -1,86 +0,0 @@ -// Ryzom - 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 CL_HTML_ELEMENT_H -#define CL_HTML_ELEMENT_H - -#include "nel/misc/types_nl.h" -#include "nel/gui/css_style.h" - -namespace NLGUI -{ - /** - * \brief HTML element - * \date 2019-04-25 18:23 GMT - * \author Meelis Mägi (Nimetu) - */ - class CHtmlElement - { - public: - enum ENodeType { - NONE = 0, - ELEMENT_NODE = 1, - TEXT_NODE = 3, - }; - - uint ID; // libwww element enum - ENodeType Type; - std::string Value; // text node value or element node name - std::map Attributes; - std::list Children; - - // class names for css matching - std::set ClassNames; - - // defined style and :before/:after pseudo elements - TStyle Style; - TStyle StyleBefore; - TStyle StyleAfter; - - // hierarchy - CHtmlElement *parent; - CHtmlElement *previousSibling; - CHtmlElement *nextSibling; - - // n'th ELEMENT_NODE in parent.Children, for :nth-child() rules - uint childIndex; - - CHtmlElement(ENodeType type = NONE, std::string value = ""); - - // returns true if rhs is same pointer - friend bool operator==(const CHtmlElement &lhs, const CHtmlElement &rhs) - { - return &lhs == &rhs; - } - - bool hasAttribute(const std::string &key) const; - - bool hasNonEmptyAttribute(const std::string &key) const; - - std::string getAttribute(const std::string &key) const; - - bool hasClass(const std::string &key) const; - - // update Children index/parent/next/prevSibling pointers - void reindexChilds(); - - // debug - std::string toString(bool tree = false, uint depth = 0) const; - }; -} - -#endif - diff --git a/code/nel/include/nel/gui/html_parser.h b/code/nel/include/nel/gui/html_parser.h deleted file mode 100644 index 760640234..000000000 --- a/code/nel/include/nel/gui/html_parser.h +++ /dev/null @@ -1,52 +0,0 @@ -// Ryzom - 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 CL_HTML_PARSER_H -#define CL_HTML_PARSER_H - -#include "nel/misc/types_nl.h" - -namespace NLGUI -{ - class CHtmlElement; - - /** - * \brief HTML parsing - * \date 2019-03-15 10:50 GMT - * \author Meelis Mägi (Nimetu) - */ - class CHtmlParser - { - public: - bool parseHtml(std::string htmlString) const; - - // parse html string into DOM, extract - bool useStyle = true; - if (elm.hasAttribute("media")) - { - std::string media = trim(toLower(elm.Attributes["media"])); - useStyle = media.empty() || media.find("all") != std::string::npos || media.find("screen") != std::string::npos; - - //