diff --git a/assetimport/CMakeLists.txt b/assetimport/CMakeLists.txt index 60ded0dd..653cecf9 100644 --- a/assetimport/CMakeLists.txt +++ b/assetimport/CMakeLists.txt @@ -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} $<$:-DZ_PREFIX=ON> $<$:-DZ_PREFIX_STR=${Z_PREFIX_STR}> + -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON -DZLIB_ROOT=$<$:${CMAKE_BUNDLE_INSTALL_PREFIX}> -Dpugixml_ROOT=$<$:${CMAKE_BUNDLE_INSTALL_PREFIX}> -DBIN_DIR=${BIN_DIR} diff --git a/assetimport/assetimport.patch b/assetimport/assetimport.patch deleted file mode 100644 index 9ca4b839..00000000 --- a/assetimport/assetimport.patch +++ /dev/null @@ -1,270 +0,0 @@ -diff -Naur assimp/CMakeLists.txt ASSETIMPORT_BLD/CMakeLists.txt ---- assimp/CMakeLists.txt 2024-08-22 16:04:35.540387715 -0400 -+++ ASSETIMPORT_BLD/CMakeLists.txt 2024-08-22 16:05:12.765176737 -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 ASSETIMPORT/cmake-modules/FindZLIB.cmake ASSETIMPORT_BLD/cmake-modules/FindZLIB.cmake ---- ASSETIMPORT/cmake-modules/FindZLIB.cmake 2024-06-25 10:10:10.163683303 -0400 -+++ ASSETIMPORT_BLD/cmake-modules/FindZLIB.cmake 2024-06-25 10:08:14.147412121 -0400 -@@ -1,48 +1,123 @@ --#------------------------------------------------------------------- --# This file is part of the CMake build system for OGRE --# (Object-oriented Graphics Rendering Engine) --# For the latest info, see http://www.ogre3d.org/ -+#.rst: -+# FindZLIB -+# -------- - # --# The contents of this file are placed in the public domain. Feel --# free to make use of it in any way you like. --#------------------------------------------------------------------- -- --# - Try to find ZLIB --# Once done, this will define -+# Find the native ZLIB includes and library. - # --# ZLIB_FOUND - system has ZLIB --# ZLIB_INCLUDE_DIRS - the ZLIB include directories --# ZLIB_LIBRARIES - link these to use ZLIB -- --include(FindPkgMacros) --findpkg_begin(ZLIB) -- --# Get path, convert backslashes as ${ENV_${var}} --getenv_path(ZLIB_HOME) -- --# construct search paths --set(ZLIB_PREFIX_PATH ${ZLIB_HOME} ${ENV_ZLIB_HOME}) --create_search_paths(ZLIB) --# redo search if prefix path changed --clear_if_changed(ZLIB_PREFIX_PATH -- ZLIB_LIBRARY_FWK -- ZLIB_LIBRARY_REL -- ZLIB_LIBRARY_DBG -- ZLIB_INCLUDE_DIR --) -- --set(ZLIB_LIBRARY_NAMES z zlib zdll) --get_debug_names(ZLIB_LIBRARY_NAMES) -- --use_pkgconfig(ZLIB_PKGC zzip-zlib-config) -- --findpkg_framework(ZLIB) -- --find_path(ZLIB_INCLUDE_DIR NAMES zlib.h HINTS ${ZLIB_INC_SEARCH_PATH} ${ZLIB_PKGC_INCLUDE_DIRS}) --find_library(ZLIB_LIBRARY_REL NAMES ${ZLIB_LIBRARY_NAMES} HINTS ${ZLIB_LIB_SEARCH_PATH} ${ZLIB_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel) --find_library(ZLIB_LIBRARY_DBG NAMES ${ZLIB_LIBRARY_NAMES_DBG} HINTS ${ZLIB_LIB_SEARCH_PATH} ${ZLIB_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug) -- --make_library_set(ZLIB_LIBRARY) -- --findpkg_finish(ZLIB) -+# IMPORTED Targets -+# ^^^^^^^^^^^^^^^^ -+# -+# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if -+# ZLIB has been found. -+# -+# Result Variables -+# ^^^^^^^^^^^^^^^^ -+# -+# This module defines the following variables: -+# -+# :: -+# -+# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. -+# ZLIB_LIBRARIES - List of libraries when using zlib. -+# ZLIB_FOUND - True if zlib found. -+# -+# :: -+# -+# ZLIB_VERSION_STRING - The version of zlib found (x.y.z) -+# ZLIB_VERSION_MAJOR - The major version of zlib -+# ZLIB_VERSION_MINOR - The minor version of zlib -+# ZLIB_VERSION_PATCH - The patch version of zlib -+# ZLIB_VERSION_TWEAK - The tweak version of zlib -+# -+# Backward Compatibility -+# ^^^^^^^^^^^^^^^^^^^^^^ -+# -+# The following variable are provided for backward compatibility -+# -+# :: -+# -+# ZLIB_MAJOR_VERSION - The major version of zlib -+# ZLIB_MINOR_VERSION - The minor version of zlib -+# ZLIB_PATCH_VERSION - The patch version of zlib -+# -+# Hints -+# ^^^^^ -+# -+# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this -+# module where to look. - -+#============================================================================= -+# Copyright 2001-2011 Kitware, Inc. -+# -+# Distributed under the OSI-approved BSD License (the "License"); -+# see accompanying file Copyright.txt for details. -+# -+# This software is distributed WITHOUT ANY WARRANTY; without even the -+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -+# See the License for more information. -+#============================================================================= -+# (To distribute this file outside of CMake, substitute the full -+# License text for the above reference.) -+ -+set(_ZLIB_SEARCHES) -+ -+# Search ZLIB_ROOT first if it is set. -+if(ZLIB_ROOT) -+ set(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH) -+ list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT) -+endif() -+ -+# Normal search. -+set(_ZLIB_SEARCH_NORMAL -+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]" -+ "$ENV{PROGRAMFILES}/zlib" -+ ) -+list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL) -+ -+set(ZLIB_NAMES z_brl z zlib zdll zlib1 zlibd zlibd1) -+ -+# Try each search configuration. -+foreach(search ${_ZLIB_SEARCHES}) -+ find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include) -+ find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib) -+endforeach() -+ -+mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -+ -+if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") -+ file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$") -+ -+ string(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}") -+ string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}") -+ string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}") -+ set(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}") -+ -+ # only append a TWEAK version if it exists: -+ set(ZLIB_VERSION_TWEAK "") -+ if( "${ZLIB_H}" MATCHES "ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)") -+ set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") -+ set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") -+ endif() -+ -+ set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") -+ set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}") -+ set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}") -+endif() -+ -+# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if -+# all listed variables are TRUE -+include(FindPackageHandleStandardArgs) -+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR -+ VERSION_VAR ZLIB_VERSION_STRING) -+ -+if(ZLIB_FOUND) -+ set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) -+ set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) -+ -+ if(NOT TARGET ZLIB::ZLIB) -+ add_library(ZLIB::ZLIB UNKNOWN IMPORTED) -+ set_target_properties(ZLIB::ZLIB PROPERTIES -+ IMPORTED_LOCATION "${ZLIB_LIBRARY}" -+ INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") -+ endif() -+endif() -diff -Naur ASSETIMPORT/code/AssetLib/MDL/MDLFileData.h ASSETIMPORT_BLD/code/AssetLib/MDL/MDLFileData.h ---- ASSETIMPORT/code/AssetLib/MDL/MDLFileData.h 2024-06-25 10:10:10.171683183 -0400 -+++ ASSETIMPORT_BLD/code/AssetLib/MDL/MDLFileData.h 2024-06-25 10:08:14.148412106 -0400 -@@ -876,7 +876,7 @@ - : apcOutBones(), - iNum() - { -- abNeedMaterials.reserve(10); -+ //abNeedMaterials.reserve(10); - } - - //! Destruction: properly delete all allocated resources -diff -Naur ASSETIMPORT/code/CMakeLists.txt ASSETIMPORT_BLD/code/CMakeLists.txt ---- ASSETIMPORT/code/CMakeLists.txt 2024-06-25 10:10:10.175683123 -0400 -+++ ASSETIMPORT_BLD/code/CMakeLists.txt 2024-06-25 10:08:14.149412091 -0400 -@@ -906,17 +906,18 @@ - SOURCE_GROUP( Extra FILES ${Extra_SRCS}) - - # 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) -@@ -1268,6 +1269,10 @@ - $ - ) - -+if (TARGET pugixml) -+ set(PUGIXML_LIBRARIES pugixml) -+endif (TARGET pugixml) -+ - IF(ASSIMP_HUNTER_ENABLED) - TARGET_LINK_LIBRARIES(assimp - PUBLIC -@@ -1289,7 +1294,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() -@@ -1307,6 +1312,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 -@@ -1353,11 +1359,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) diff --git a/assetimport/assetimport_cmake.patch b/assetimport/assetimport_cmake.patch new file mode 100644 index 00000000..744ed868 --- /dev/null +++ b/assetimport/assetimport_cmake.patch @@ -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 @@ + $ + ) + ++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) diff --git a/assetimport/assetimport_code.patch b/assetimport/assetimport_code.patch new file mode 100644 index 00000000..6f4f7972 --- /dev/null +++ b/assetimport/assetimport_code.patch @@ -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