diff --git a/Build.md b/Build.md index b4d1bdad0..d6abe7b67 100644 --- a/Build.md +++ b/Build.md @@ -84,23 +84,28 @@ Besides the toolchain, compilation should be the same as for Linux / Unix. ### CMake build options The cmake-build-environment provides options to configure the build. The following options can be used: -- **BUILD_SHARED_LIBS ( default ON )**: Generation of shared libs ( dll for windows, so for Linux ). Set this to OFF to get a static lib. -- **BUILD_FRAMEWORK ( default OFF, MacOnly)**: Build package as Mac OS X Framework bundle -- **ASSIMP_DOUBLE_PRECISION( default OFF )**: All data will be stored as double values. -- **ASSIMP_OPT_BUILD_PACKAGES ( default OFF)**: Set to ON to generate CPack configuration files and packaging targets -- **ASSIMP_ANDROID_JNIIOSYSTEM ( default OFF )**: Android JNI IOSystem support is active -- **ASSIMP_NO_EXPORT ( default OFF )**: Disable Assimp's export functionality -- **ASSIMP_BUILD_ZLIB ( default OFF )**: Build your own zlib -- **ASSIMP_BUILD_ASSIMP_TOOLS ( default ON )**: If the supplementary tools for Assimp are built in addition to the library. -- **ASSIMP_BUILD_SAMPLES ( default OFF )**: If the official samples are built as well (needs Glut). -- **ASSIMP_BUILD_TESTS ( default ON )**: If the test suite for Assimp is built in addition to the library. -- **ASSIMP_COVERALLS ( default OFF )**: Enable this to measure test coverage. -- **ASSIMP_ERROR_MAX( default OFF)**: Enable all warnings. -- **ASSIMP_WERROR( default OFF )**: Treat warnings as errors. -- **ASSIMP_ASAN ( default OFF )**: Enable AddressSanitizer. -- **ASSIMP_UBSAN ( default OFF )**: Enable Undefined Behavior sanitizer. -- **SYSTEM_IRRXML ( default OFF )**: Use system installed Irrlicht/IrrXML library. -- **BUILD_DOCS ( default OFF )**: Build documentation using Doxygen. -- **INJECT_DEBUG_POSTFIX( default ON )**: Inject debug postfix in .a/.so lib names -- **IGNORE_GIT_HASH ( default OFF )**: Don't call git to get the hash. -- **ASSIMP_INSTALL_PDB ( default ON )**: Install MSVC debug files. +- **ASSIMP_HUNTER_ENABLED (default OFF)**: Enable Hunter package manager support. +- **BUILD_SHARED_LIBS (default ON)**: Generation of shared libs (dll for windows, so for Linux). Set this to OFF to get a static lib. +- **ASSIMP_BUILD_FRAMEWORK (default OFF, MacOnly)**: Build package as Mac OS X Framework bundle. +- **ASSIMP_DOUBLE_PRECISION (default OFF)**: All data will be stored as double values. +- **ASSIMP_OPT_BUILD_PACKAGES (default OFF)**: Set to ON to generate CPack configuration files and packaging targets. +- **ASSIMP_ANDROID_JNIIOSYSTEM (default OFF)**: Android JNI IOSystem support is active. +- **ASSIMP_NO_EXPORT (default OFF)**: Disable Assimp's export functionality. +- **ASSIMP_BUILD_ZLIB (default OFF)**: Build our own zlib. +- **ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT (default ON)**: Build Assimp with all exporter senabled. +- **ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT (default ON)**: Build Assimp with all importer senabled. +- **ASSIMP_BUILD_ASSIMP_TOOLS (default ON)**: If the supplementary tools for Assimp are built in addition to the library. +- **ASSIMP_BUILD_SAMPLES (default OFF)**: If the official samples are built as well (needs Glut). +- **ASSIMP_BUILD_TESTS (default ON)**: If the test suite for Assimp is built in addition to the library. +- **ASSIMP_COVERALLS (default OFF)**: Enable this to measure test coverage. +- **ASSIMP_INSTALL (default ON)**: Install Assimp library. Disable this if you want to use Assimp as a submodule. +- **ASSIMP_WARNINGS_AS_ERRORS (default ON)**: Treat all warnings as errors. +- **ASSIMP_ASAN (default OFF)**: Enable AddressSanitizer. +- **ASSIMP_UBSAN (default OFF)**: Enable Undefined Behavior sanitizer. +- **ASSIMP_BUILD_DOCS (default OFF)**: Build documentation using Doxygen. OBSOLETE, see https://github.com/assimp/assimp-docs +- **ASSIMP_INJECT_DEBUG_POSTFIX (default ON)**: Inject debug postfix in .a/.so/.lib/.dll lib names +- **ASSIMP_IGNORE_GIT_HASH (default OFF)**: Don't call git to get the hash. +- **ASSIMP_INSTALL_PDB (default ON)**: Install MSVC debug files. +- **USE_STATIC_CRT (default OFF)**: Link against the static MSVC runtime libraries. +- **ASSIMP_BUILD_DRACO (default OFF)**: Build Draco libraries. Primarily for glTF. +- **ASSIMP_BUILD_ASSIMP_VIEW (default ON, if DirectX found, OFF otherwise)**: Build Assimp view tool (requires DirectX). diff --git a/CMakeLists.txt b/CMakeLists.txt index 072803fda..2aa66421c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,9 +108,9 @@ OPTION( ASSIMP_INSTALL "Disable this if you want to use assimp as a submodule." ON ) -OPTION ( ASSIMP_ERROR_MAX - "Enable all warnings." - OFF +OPTION ( ASSIMP_WARNINGS_AS_ERRORS + "Treat all warnings as errors." + ON ) OPTION ( ASSIMP_ASAN "Enable AddressSanitizer." @@ -324,16 +324,6 @@ IF (ASSIMP_COVERALLS) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") ENDIF() -IF (ASSIMP_ERROR_MAX) - MESSAGE(STATUS "Turning on all warnings") - IF (MSVC) - ADD_COMPILE_OPTIONS(/W4) # NB: there is a /Wall option, pedantic mode - ELSE() - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - ENDIF() -ENDIF() - IF (ASSIMP_ASAN) MESSAGE(STATUS "AddressSanitizer enabled") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") @@ -694,6 +684,7 @@ ENDIF() # Main assimp code ADD_SUBDIRECTORY( code/ ) + IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) # The viewer for windows only IF (WIN32) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 16b5ece4d..d2488d6f2 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1179,11 +1179,13 @@ ADD_LIBRARY(assimp::assimp ALIAS assimp) TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp) -# enable warnings as errors ######################################## -IF (MSVC) - TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX) -ELSE() - TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror) +IF (ASSIMP_WARNINGS_AS_ERRORS) + MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)") + IF (MSVC) + TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX) + ELSE() + TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror) + ENDIF() ENDIF() # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler diff --git a/contrib/pugixml/contrib/foreach.hpp b/contrib/pugixml/contrib/foreach.hpp deleted file mode 100644 index c42315194..000000000 --- a/contrib/pugixml/contrib/foreach.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Boost.Foreach support for pugixml classes. - * This file is provided to the public domain. - * Written by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) - */ - -#ifndef HEADER_PUGIXML_FOREACH_HPP -#define HEADER_PUGIXML_FOREACH_HPP - -#include - -#include "pugixml.hpp" - -/* - * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child iteration only). - * Example usage: - * BOOST_FOREACH(xml_node n, doc) {} - */ - -namespace boost -{ - template<> struct range_mutable_iterator - { - typedef pugi::xml_node::iterator type; - }; - - template<> struct range_const_iterator - { - typedef pugi::xml_node::iterator type; - }; - - template<> struct range_mutable_iterator - { - typedef pugi::xml_document::iterator type; - }; - - template<> struct range_const_iterator - { - typedef pugi::xml_document::iterator type; - }; -} - -/* - * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child/attribute iteration). - * Example usage: - * BOOST_FOREACH(xml_node n, children(doc)) {} - * BOOST_FOREACH(xml_node n, attributes(doc)) {} - */ - -namespace pugi -{ - inline xml_object_range children(const pugi::xml_node& node) - { - return node.children(); - } - - inline xml_object_range attributes(const pugi::xml_node& node) - { - return node.attributes(); - } -} - -#endif diff --git a/contrib/pugixml/readme.txt b/contrib/pugixml/readme.txt index bfb1875cb..747fc0b7e 100644 --- a/contrib/pugixml/readme.txt +++ b/contrib/pugixml/readme.txt @@ -1,6 +1,6 @@ -pugixml 1.11 - an XML processing library +pugixml 1.12 - an XML processing library -Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) +Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) Report bugs and download new versions at https://pugixml.org/ This is the distribution of pugixml, which is a C++ XML processing library, @@ -26,7 +26,7 @@ The distribution contains the following folders: This library is distributed under the MIT License: -Copyright (c) 2006-2019 Arseny Kapoulkine +Copyright (c) 2006-2022 Arseny Kapoulkine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/contrib/pugixml/src/pugiconfig.hpp b/contrib/pugixml/src/pugiconfig.hpp index 03f854bf1..e07060c4d 100644 --- a/contrib/pugixml/src/pugiconfig.hpp +++ b/contrib/pugixml/src/pugiconfig.hpp @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.11 + * pugixml parser - version 1.12 * -------------------------------------------------------- - * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -52,7 +52,7 @@ #endif /** - * Copyright (c) 2006-2020 Arseny Kapoulkine + * Copyright (c) 2006-2022 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/contrib/pugixml/src/pugixml.cpp b/contrib/pugixml/src/pugixml.cpp index efdcdf699..60b55da3a 100644 --- a/contrib/pugixml/src/pugixml.cpp +++ b/contrib/pugixml/src/pugixml.cpp @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.11 + * pugixml parser - version 1.12 * -------------------------------------------------------- - * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -132,8 +132,10 @@ using std::memset; #endif // In some environments MSVC is a compiler but the CRT lacks certain MSVC-specific features -#if defined(_MSC_VER) && !defined(__S3E__) +#if defined(_MSC_VER) && !defined(__S3E__) && !defined(_WIN32_WCE) # define PUGI__MSVC_CRT_VERSION _MSC_VER +#elif defined(_WIN32_WCE) +# define PUGI__MSVC_CRT_VERSION 1310 // MSVC7.1 #endif // Not all platforms have snprintf; we define a wrapper that uses snprintf if possible. This only works with buffers with a known size. @@ -526,7 +528,8 @@ PUGI__NS_BEGIN xml_memory_page* page = xml_memory_page::construct(memory); assert(page); - page->allocator = _root->allocator; + assert(this == _root->allocator); + page->allocator = this; return page; } @@ -4732,7 +4735,7 @@ PUGI__NS_BEGIN // we need to get length of entire file to load it in memory; the only (relatively) sane way to do it is via seek/tell trick PUGI__FN xml_parse_status get_file_size(FILE* file, size_t& out_result) { - #if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 && !defined(_WIN32_WCE) + #if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 // there are 64-bit versions of fseek/ftell, let's use them typedef __int64 length_type; @@ -6735,7 +6738,7 @@ namespace pugi return const_cast(&_wrap); // BCC5 workaround } - PUGI__FN const xml_node_iterator& xml_node_iterator::operator++() + PUGI__FN xml_node_iterator& xml_node_iterator::operator++() { assert(_wrap._root); _wrap._root = _wrap._root->next_sibling; @@ -6749,7 +6752,7 @@ namespace pugi return temp; } - PUGI__FN const xml_node_iterator& xml_node_iterator::operator--() + PUGI__FN xml_node_iterator& xml_node_iterator::operator--() { _wrap = _wrap._root ? _wrap.previous_sibling() : _parent.last_child(); return *this; @@ -6796,7 +6799,7 @@ namespace pugi return const_cast(&_wrap); // BCC5 workaround } - PUGI__FN const xml_attribute_iterator& xml_attribute_iterator::operator++() + PUGI__FN xml_attribute_iterator& xml_attribute_iterator::operator++() { assert(_wrap._attr); _wrap._attr = _wrap._attr->next_attribute; @@ -6810,7 +6813,7 @@ namespace pugi return temp; } - PUGI__FN const xml_attribute_iterator& xml_attribute_iterator::operator--() + PUGI__FN xml_attribute_iterator& xml_attribute_iterator::operator--() { _wrap = _wrap._attr ? _wrap.previous_attribute() : _parent.last_attribute(); return *this; @@ -6857,7 +6860,7 @@ namespace pugi return const_cast(&_wrap); // BCC5 workaround } - PUGI__FN const xml_named_node_iterator& xml_named_node_iterator::operator++() + PUGI__FN xml_named_node_iterator& xml_named_node_iterator::operator++() { assert(_wrap._root); _wrap = _wrap.next_sibling(_name); @@ -6871,7 +6874,7 @@ namespace pugi return temp; } - PUGI__FN const xml_named_node_iterator& xml_named_node_iterator::operator--() + PUGI__FN xml_named_node_iterator& xml_named_node_iterator::operator--() { if (_wrap._root) _wrap = _wrap.previous_sibling(_name); @@ -7091,8 +7094,12 @@ namespace pugi #endif // move allocation state - doc->_root = other->_root; - doc->_busy_size = other->_busy_size; + // note that other->_root may point to the embedded document page, in which case we should keep original (empty) state + if (other->_root != PUGI__GETPAGE(other)) + { + doc->_root = other->_root; + doc->_busy_size = other->_busy_size; + } // move buffer state doc->buffer = other->buffer; @@ -8265,7 +8272,7 @@ PUGI__NS_BEGIN } // gets mantissa digits in the form of 0.xxxxx with 0. implied and the exponent -#if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 && !defined(_WIN32_WCE) +#if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 PUGI__FN void convert_number_to_mantissa_exponent(double value, char (&buffer)[32], char** out_mantissa, int* out_exponent) { // get base values @@ -11822,15 +11829,17 @@ PUGI__NS_BEGIN lexeme_t l = _lexer.current(); _lexer.next(); - if (++_depth > xpath_ast_depth_limit) - return error_rec(); - if (l == lex_double_slash) { n = alloc_node(ast_step, n, axis_descendant_or_self, nodetest_type_node, 0); if (!n) return 0; + + ++_depth; } + if (++_depth > xpath_ast_depth_limit) + return error_rec(); + n = parse_step(n); if (!n) return 0; } @@ -12995,7 +13004,7 @@ namespace pugi #endif /** - * Copyright (c) 2006-2020 Arseny Kapoulkine + * Copyright (c) 2006-2022 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/contrib/pugixml/src/pugixml.hpp b/contrib/pugixml/src/pugixml.hpp index 7e2ce7776..579f14399 100644 --- a/contrib/pugixml/src/pugixml.hpp +++ b/contrib/pugixml/src/pugixml.hpp @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.11 + * pugixml parser - version 1.12 * -------------------------------------------------------- - * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://pugixml.org/ * * This library is distributed under the MIT License. See notice at the end @@ -11,10 +11,10 @@ * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) */ -#ifndef PUGIXML_VERSION // Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons // Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits -# define PUGIXML_VERSION 1110 +#ifndef PUGIXML_VERSION +# define PUGIXML_VERSION 1120 // 1.12 #endif // Include user configuration file (this can define various configuration macros) @@ -312,6 +312,8 @@ namespace pugi It begin() const { return _begin; } It end() const { return _end; } + bool empty() const { return _begin == _end; } + private: It _begin, _end; }; @@ -851,10 +853,10 @@ namespace pugi xml_node& operator*() const; xml_node* operator->() const; - const xml_node_iterator& operator++(); + xml_node_iterator& operator++(); xml_node_iterator operator++(int); - const xml_node_iterator& operator--(); + xml_node_iterator& operator--(); xml_node_iterator operator--(int); }; @@ -893,10 +895,10 @@ namespace pugi xml_attribute& operator*() const; xml_attribute* operator->() const; - const xml_attribute_iterator& operator++(); + xml_attribute_iterator& operator++(); xml_attribute_iterator operator++(int); - const xml_attribute_iterator& operator--(); + xml_attribute_iterator& operator--(); xml_attribute_iterator operator--(int); }; @@ -929,10 +931,10 @@ namespace pugi xml_node& operator*() const; xml_node* operator->() const; - const xml_named_node_iterator& operator++(); + xml_named_node_iterator& operator++(); xml_named_node_iterator operator++(int); - const xml_named_node_iterator& operator--(); + xml_named_node_iterator& operator--(); xml_named_node_iterator operator--(int); private: @@ -1474,7 +1476,7 @@ namespace std #endif /** - * Copyright (c) 2006-2020 Arseny Kapoulkine + * Copyright (c) 2006-2022 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation