Skip to content

Commit

Permalink
See if we can remove the FindZLIB.cmake customization patch from asse…
Browse files Browse the repository at this point in the history
…timport
  • Loading branch information
starseeker committed Oct 9, 2024
1 parent 690b4b0 commit 749a13c
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 271 deletions.
4 changes: 3 additions & 1 deletion assetimport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ if (ENABLE_ASSETIMPORT)
ExternalProject_Add(ASSETIMPORT_BLD
URL "${CMAKE_CURRENT_SOURCE_DIR}/assimp"
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/assetimport.patch
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/assetimport_code.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/assetimport_cmake.patch
CMAKE_ARGS
${BUILD_TYPE_SPECIFIER}
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX=ON>
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX_STR=${Z_PREFIX_STR}>
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON
-DZLIB_ROOT=$<$<BOOL:${ZLIB_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
-Dpugixml_ROOT=$<$<BOOL:${PUGIXML_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
-DBIN_DIR=${BIN_DIR}
Expand Down
270 changes: 0 additions & 270 deletions assetimport/assetimport.patch

This file was deleted.

86 changes: 86 additions & 0 deletions assetimport/assetimport_cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
diff -Naur assimp/CMakeLists.txt ASSETIMPORT_BLD/CMakeLists.txt
--- assimp/CMakeLists.txt 2024-10-09 16:05:51.701808399 -0400
+++ ASSETIMPORT_BLD/CMakeLists.txt 2024-10-09 16:05:06.412473372 -0400
@@ -37,6 +37,7 @@
SET(CMAKE_POLICY_DEFAULT_CMP0012 NEW)
SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
SET(CMAKE_POLICY_DEFAULT_CMP0092 NEW)
+SET(CMAKE_POLICY_DEFAULT_CMP0144 NEW)

CMAKE_MINIMUM_REQUIRED( VERSION 3.22 )

diff -Naur assimp/code/CMakeLists.txt ASSETIMPORT_BLD/code/CMakeLists.txt
--- assimp/code/CMakeLists.txt 2024-10-09 16:05:51.702808384 -0400
+++ ASSETIMPORT_BLD/code/CMakeLists.txt 2024-10-09 16:05:06.415473328 -0400
@@ -1050,17 +1050,18 @@
ENDIF() # IF (ASSIMP_BUILD_USD_IMPORTER)

# pugixml
-IF(ASSIMP_HUNTER_ENABLED)
- hunter_add_package(pugixml)
- find_package(pugixml CONFIG REQUIRED)
-ELSE()
- SET( Pugixml_SRCS
- ../contrib/pugixml/src/pugiconfig.hpp
- ../contrib/pugixml/src/pugixml.hpp
- )
- INCLUDE_DIRECTORIES("../contrib/pugixml/src")
- SOURCE_GROUP( Contrib\\Pugixml FILES ${Pugixml_SRCS})
-ENDIF()
+#IF(ASSIMP_HUNTER_ENABLED)
+# hunter_add_package(pugixml)
+# find_package(pugixml CONFIG REQUIRED)
+#ELSE()
+# SET( Pugixml_SRCS
+# ../contrib/pugixml/src/pugiconfig.hpp
+# ../contrib/pugixml/src/pugixml.hpp
+# )
+# INCLUDE_DIRECTORIES("../contrib/pugixml/src")
+# SOURCE_GROUP( Contrib\\Pugixml FILES ${Pugixml_SRCS})
+#ENDIF()
+find_package(pugixml REQUIRED)

# utf8
IF(ASSIMP_HUNTER_ENABLED)
@@ -1414,6 +1415,10 @@
$<INSTALL_INTERFACE:${ASSIMP_INCLUDE_INSTALL_DIR}>
)

+if (TARGET pugixml)
+ set(PUGIXML_LIBRARIES pugixml)
+endif (TARGET pugixml)
+
IF(ASSIMP_HUNTER_ENABLED)
TARGET_LINK_LIBRARIES(assimp
PUBLIC
@@ -1435,7 +1440,7 @@
target_link_libraries(assimp PRIVATE ${draco_LIBRARIES})
endif()
ELSE()
- TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES})
+ TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${PUGIXML_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES})
if (ASSIMP_BUILD_DRACO)
target_link_libraries(assimp ${draco_LIBRARIES})
endif()
@@ -1453,6 +1458,7 @@
TARGET_LINK_LIBRARIES(assimp ${C4D_EXTRA_LIBRARIES})
ENDIF ()

+if(0)
if( MSVC )
# in order to prevent DLL hell, each of the DLLs have to be suffixed with the major version and msvc prefix
# CMake 3.12 added a variable for this
@@ -1499,11 +1505,12 @@
target_compile_definitions(assimp PUBLIC WindowsStore)
TARGET_LINK_LIBRARIES(assimp advapi32)
endif()
+endif(0)

SET_TARGET_PROPERTIES( assimp PROPERTIES
VERSION ${ASSIMP_VERSION}
SOVERSION ${ASSIMP_SOVERSION} # use full version
- OUTPUT_NAME assimp${LIBRARY_SUFFIX}
+ #OUTPUT_NAME assimp${LIBRARY_SUFFIX}
)

if (APPLE)
11 changes: 11 additions & 0 deletions assetimport/assetimport_code.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- assimp/code/AssetLib/MDL/MDLFileData.h 2024-10-09 16:05:51.708808296 -0400
+++ ASSETIMPORT_BLD/code/AssetLib/MDL/MDLFileData.h 2024-10-09 16:05:06.413473357 -0400
@@ -876,7 +876,7 @@
: apcOutBones(),
iNum()
{
- abNeedMaterials.reserve(10);
+ //abNeedMaterials.reserve(10);
}

//! Destruction: properly delete all allocated resources

0 comments on commit 749a13c

Please sign in to comment.