Skip to content

Commit

Permalink
[assimp] update to 5.4.3 and fix build error (#40894)
Browse files Browse the repository at this point in the history
Co-authored-by: Jon <v-zhli17@microsoft.com>
  • Loading branch information
JonLiu1993 and Jon authored Sep 24, 2024
1 parent 2f9712e commit 9612cfe
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 55 deletions.
107 changes: 55 additions & 52 deletions ports/assimp/build_fixes.patch
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 718a251..21d253f 100644
index d45eb22..0b5da28 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -291,9 +291,9 @@ ELSEIF(MSVC)
@@ -307,7 +307,6 @@ ELSEIF(MSVC)
ENDIF()
# supress warning for double to float conversion if Double precision is activated
ADD_COMPILE_OPTIONS(/wd4244)
ADD_COMPILE_OPTIONS(/wd4244)
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
- SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
- SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")
+ #SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
+ #SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+ #SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")
# Allow user to disable PDBs
if(ASSIMP_INSTALL_PDB)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
@@ -315,8 +314,7 @@ ELSEIF(MSVC)
elseif((GENERATOR_IS_MULTI_CONFIG) OR (CMAKE_BUILD_TYPE MATCHES Release))
message("-- MSVC PDB generation disabled. Release binary will not be debuggable.")
endif()
- # Source code is encoded in UTF-8
- ADD_COMPILE_OPTIONS(/source-charset:utf-8)
+
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
IF(NOT ASSIMP_HUNTER_ENABLED)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -421,7 +421,7 @@ ENDIF()
@@ -444,7 +442,7 @@ ENDIF()

set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")

Expand All @@ -24,7 +29,7 @@ index 718a251..21d253f 100644
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-hunter-config.cmake.in")
set(NAMESPACE "${PROJECT_NAME}::")
@@ -429,7 +429,7 @@ IF(ASSIMP_HUNTER_ENABLED)
@@ -452,7 +450,7 @@ IF(ASSIMP_HUNTER_ENABLED)
set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
ELSE()
Expand All @@ -33,15 +38,14 @@ index 718a251..21d253f 100644
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-plain-config.cmake.in")
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
set(NAMESPACE "${PROJECT_NAME_LOWERCASE}::")
@@ -473,14 +473,14 @@ ENDIF()
@@ -496,14 +494,13 @@ ENDIF()

# Search for external dependencies, and build them from source if not found
# Search for zlib
-IF(ASSIMP_HUNTER_ENABLED)
- hunter_add_package(ZLIB)
- find_package(ZLIB CONFIG REQUIRED)
+IF(1)
+ # hunter_add_package(ZLIB)
+ find_package(ZLIB REQUIRED)

add_definitions(-DASSIMP_BUILD_NO_OWN_ZLIB)
Expand All @@ -53,12 +57,13 @@ index 718a251..21d253f 100644
ELSE()
# If the zlib is already found outside, add an export in case assimpTargets can't find it.
IF( ZLIB_FOUND AND ASSIMP_INSTALL)
@@ -525,12 +525,12 @@ ELSE()
@@ -547,13 +544,13 @@ ELSE()
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ENDIF()

IF( NOT IOS )
- IF( NOT ASSIMP_BUILD_MINIZIP )
+ IF( 0 )
-IF( NOT IOS )
+IF( 0 )
IF( NOT ASSIMP_BUILD_MINIZIP )
use_pkgconfig(UNZIP minizip)
ENDIF()
ELSE ()
Expand All @@ -69,19 +74,18 @@ index 718a251..21d253f 100644
ENDIF()
ENDIF ()
diff --git a/cmake-modules/assimp-plain-config.cmake.in b/cmake-modules/assimp-plain-config.cmake.in
index 6551dcb..457fcd7 100644
index 6551dcb..3064f70 100644
--- a/cmake-modules/assimp-plain-config.cmake.in
+++ b/cmake-modules/assimp-plain-config.cmake.in
@@ -1,5 +1,20 @@
@@ -1,5 +1,19 @@
@PACKAGE_INIT@

+include(CMakeFindDependencyMacro)
+
+find_dependency(pugixml CONFIG)
+if(NOT @BUILD_SHARED_LIBS@)
+ find_dependency(kubazip CONFIG)
+ find_dependency(unofficial-minizip CONFIG)
+ #find_dependency(openddlparser CONFIG)
+ find_dependency(pugixml CONFIG)
+ find_dependency(poly2tri CONFIG)
+ find_dependency(polyclipping CONFIG)
+ find_dependency(RapidJSON CONFIG)
Expand All @@ -94,7 +98,7 @@ index 6551dcb..457fcd7 100644

set(ASSIMP_ROOT_DIR ${PACKAGE_PREFIX_DIR})
diff --git a/code/AssetLib/3MF/D3MFExporter.cpp b/code/AssetLib/3MF/D3MFExporter.cpp
index 6caa4c8..c130fcc 100644
index 6c09f09..7b3410a 100644
--- a/code/AssetLib/3MF/D3MFExporter.cpp
+++ b/code/AssetLib/3MF/D3MFExporter.cpp
@@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Expand Down Expand Up @@ -135,7 +139,7 @@ index d488b23..1a6c0c7 100644
#include <iterator>
#include <memory>
diff --git a/code/AssetLib/IFC/IFCLoader.cpp b/code/AssetLib/IFC/IFCLoader.cpp
index 9414697..48ad145 100644
index 13ea2d4..aeeb311 100644
--- a/code/AssetLib/IFC/IFCLoader.cpp
+++ b/code/AssetLib/IFC/IFCLoader.cpp
@@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Expand Down Expand Up @@ -202,11 +206,11 @@ index d7f512c..94275f1 100644
#include <memory>

diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
index f4c2936..979e688 100644
index 9b27086..b7c2ccb 100644
--- a/code/CMakeLists.txt
+++ b/code/CMakeLists.txt
@@ -922,8 +922,8 @@ SET( Extra_SRCS
SOURCE_GROUP( Extra FILES ${Extra_SRCS})
@@ -1050,8 +1050,8 @@ ELSE() # IF (ASSIMP_BUILD_USD_IMPORTER)
ENDIF() # IF (ASSIMP_BUILD_USD_IMPORTER)

# pugixml
-IF(ASSIMP_HUNTER_ENABLED)
Expand All @@ -216,7 +220,7 @@ index f4c2936..979e688 100644
find_package(pugixml CONFIG REQUIRED)
ELSE()
SET( Pugixml_SRCS
@@ -935,30 +935,30 @@ ELSE()
@@ -1063,30 +1063,30 @@ ELSE()
ENDIF()

# utf8
Expand Down Expand Up @@ -256,7 +260,7 @@ index f4c2936..979e688 100644
SET( Poly2Tri_SRCS
../contrib/poly2tri/poly2tri/common/shapes.cc
../contrib/poly2tri/poly2tri/common/shapes.h
@@ -973,12 +973,12 @@ ENDIF()
@@ -1101,12 +1101,12 @@ ENDIF()
../contrib/poly2tri/poly2tri/sweep/sweep_context.h
)
SOURCE_GROUP( Contrib\\Poly2Tri FILES ${Poly2Tri_SRCS})
Expand All @@ -273,7 +277,7 @@ index f4c2936..979e688 100644
ELSE()
SET( unzip_SRCS
../contrib/unzip/crypt.h
@@ -993,9 +993,9 @@ ENDIF()
@@ -1121,9 +1121,9 @@ ENDIF()
# zip (https://github.com/kuba--/zip)
separate_arguments(ASSIMP_EXPORTERS_LIST UNIX_COMMAND ${ASSIMP_EXPORTERS_ENABLED})
IF(3MF IN_LIST ASSIMP_EXPORTERS_LIST)
Expand All @@ -286,7 +290,7 @@ index f4c2936..979e688 100644
ELSE()
SET( ziplib_SRCS
../contrib/zip/src/miniz.h
@@ -1015,7 +1015,7 @@ IF(3MF IN_LIST ASSIMP_EXPORTERS_LIST)
@@ -1143,7 +1143,7 @@ IF(3MF IN_LIST ASSIMP_EXPORTERS_LIST)
ENDIF()

# openddlparser
Expand All @@ -295,7 +299,7 @@ index f4c2936..979e688 100644
hunter_add_package(openddlparser)
find_package(openddlparser CONFIG REQUIRED)
ELSE()
@@ -1038,7 +1038,7 @@ ELSE()
@@ -1166,7 +1166,7 @@ ELSE()
ENDIF()

# Open3DGC
Expand All @@ -304,15 +308,15 @@ index f4c2936..979e688 100644
# Nothing to do, not available in Hunter yet.
ELSE()
SET ( open3dgc_SRCS
@@ -1073,6 +1073,7 @@ ELSE()
@@ -1201,6 +1201,7 @@ ELSE()
../contrib/Open3DGC/o3dgcVector.inl
)
SOURCE_GROUP( Contrib\\open3dgc FILES ${open3dgc_SRCS})
+ INCLUDE_DIRECTORIES("../contrib")
ENDIF()

# Check dependencies for glTF importer with Open3DGC-compression.
@@ -1081,7 +1082,7 @@ ENDIF()
@@ -1209,7 +1210,7 @@ ENDIF()
IF (NOT WIN32)
FIND_PACKAGE(RT QUIET)
ENDIF ()
Expand All @@ -321,7 +325,7 @@ index f4c2936..979e688 100644
SET( ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC 1 )
ADD_DEFINITIONS( -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 )
ELSE ()
@@ -1091,9 +1092,10 @@ ELSE ()
@@ -1219,9 +1220,10 @@ ELSE ()
ENDIF ()

# RapidJSON
Expand All @@ -334,20 +338,19 @@ index f4c2936..979e688 100644
ELSE()
INCLUDE_DIRECTORIES("../contrib/rapidjson/include")
ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1)
@@ -1104,9 +1106,9 @@ ELSE()
@@ -1232,9 +1234,8 @@ ELSE()
ENDIF()

# stb
-IF(ASSIMP_HUNTER_ENABLED)
- hunter_add_package(stb)
- find_package(stb CONFIG REQUIRED)
+IF(1)
+ #hunter_add_package(stb)
+ find_package(Stb REQUIRED)
ELSE()
SET( stb_SRCS
../contrib/stb/stb_image.h
@@ -1128,7 +1130,7 @@ IF( MSVC OR "${CMAKE_CXX_SIMULATE_ID}" MATCHES "MSVC") # clang with MSVC ABI
@@ -1256,7 +1257,7 @@ IF( MSVC OR "${CMAKE_CXX_SIMULATE_ID}" MATCHES "MSVC") # clang with MSVC ABI
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
endif ()

Expand All @@ -356,7 +359,7 @@ index f4c2936..979e688 100644
if (UNZIP_FOUND)
SET (unzip_compile_SRCS "")
else ()
@@ -1180,7 +1182,7 @@ SET( assimp_src
@@ -1310,7 +1311,7 @@ SET( assimp_src
)
ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD )

Expand All @@ -365,7 +368,7 @@ index f4c2936..979e688 100644
INCLUDE_DIRECTORIES(
${IRRXML_INCLUDE_DIR}
../contrib/openddlparser/include
@@ -1282,45 +1284,48 @@ TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
@@ -1412,45 +1413,47 @@ TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>
$<INSTALL_INTERFACE:${ASSIMP_INCLUDE_INSTALL_DIR}>
Expand All @@ -376,6 +379,14 @@ index f4c2936..979e688 100644
-IF(ASSIMP_HUNTER_ENABLED)
+IF(1)
TARGET_LINK_LIBRARIES(assimp
- PUBLIC
- #polyclipping::polyclipping
- openddlparser::openddl_parser
- #poly2tri::poly2tri
- minizip::minizip
- ZLIB::zlib
- RapidJSON::rapidjson
- utf8cpp
+ PRIVATE
+ polyclipping::polyclipping
+ #openddlparser::openddl_parser
Expand All @@ -385,14 +396,6 @@ index f4c2936..979e688 100644
+ ZLIB::ZLIB
+ rapidjson
+ utf8cpp::utf8cpp
PUBLIC
- #polyclipping::polyclipping
- openddlparser::openddl_parser
- #poly2tri::poly2tri
- minizip::minizip
- ZLIB::zlib
- RapidJSON::rapidjson
- utf8cpp
pugixml
- stb::stb
)
Expand Down Expand Up @@ -431,7 +434,7 @@ index f4c2936..979e688 100644
ENDIF ()

if( MSVC )
@@ -1361,13 +1366,13 @@ if (MINGW)
@@ -1491,13 +1494,13 @@ if (MINGW)
ARCHIVE_OUTPUT_NAME assimp
)
if (NOT BUILD_SHARED_LIBS)
Expand All @@ -447,7 +450,7 @@ index f4c2936..979e688 100644
endif()

SET_TARGET_PROPERTIES( assimp PROPERTIES
@@ -1397,14 +1402,14 @@ ENDIF()
@@ -1527,14 +1530,14 @@ ENDIF()

# Build against external unzip, or add ../contrib/unzip so
# assimp can #include "unzip.h"
Expand All @@ -465,7 +468,7 @@ index f4c2936..979e688 100644
endif()
else ()
INCLUDE_DIRECTORIES("../")
@@ -1413,7 +1418,7 @@ ENDIF()
@@ -1543,7 +1546,7 @@ ENDIF()

# Add RT-extension library for glTF importer with Open3DGC-compression.
IF (RT_FOUND AND ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC)
Expand All @@ -475,10 +478,10 @@ index f4c2936..979e688 100644

IF(ASSIMP_INSTALL)
diff --git a/code/Common/BaseImporter.cpp b/code/Common/BaseImporter.cpp
index 3a4c7c3..f247927 100644
index 5c70cc2..bbbaae0 100644
--- a/code/Common/BaseImporter.cpp
+++ b/code/Common/BaseImporter.cpp
@@ -353,7 +353,7 @@ std::string BaseImporter::GetExtension(const std::string &pFile) {
@@ -354,7 +354,7 @@ std::string BaseImporter::GetExtension(const std::string &pFile) {
return false;
}

Expand All @@ -488,7 +491,7 @@ index 3a4c7c3..f247927 100644
// ------------------------------------------------------------------------------------------------
// Convert to UTF8 data
diff --git a/code/Common/StbCommon.h b/code/Common/StbCommon.h
index aef23ce..3977fde 100644
index aef23ce..1b059ec 100644
--- a/code/Common/StbCommon.h
+++ b/code/Common/StbCommon.h
@@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Expand Down
2 changes: 1 addition & 1 deletion ports/assimp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO assimp/assimp
REF "v${VERSION}"
SHA512 4bfcc3a1b5a0cf3f382560564cac67088e13c62500c3c77dcef03811e67debe72ff318f5ed145b204d5017b56cb4293f3fe14b4060ca193813cef42b12eebe9d
SHA512 4738db84068d36face8caf61c0789178fdfc1310fa8e81ffb9b025e14183bde546b784d691c92438ab310a79ab7b75ab62ee0247d5f01e81ddf04fb94b7a9c0b
HEAD_REF master
PATCHES
build_fixes.patch
Expand Down
2 changes: 1 addition & 1 deletion ports/assimp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "assimp",
"version": "5.4.2",
"version": "5.4.3",
"description": "The Open Asset import library",
"homepage": "https://github.com/assimp/assimp",
"license": "BSD-3-Clause",
Expand Down
5 changes: 5 additions & 0 deletions versions/a-/assimp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3356e9c8083aae3cfcd24dd3269b45e2cae3173f",
"version": "5.4.3",
"port-version": 0
},
{
"git-tree": "205e4ca24e9ba331c232e326707c7b84e78c0720",
"version": "5.4.2",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
"port-version": 1
},
"assimp": {
"baseline": "5.4.2",
"baseline": "5.4.3",
"port-version": 0
},
"astr": {
Expand Down

0 comments on commit 9612cfe

Please sign in to comment.