diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b553ef9e..405ff538c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -446,46 +446,46 @@ 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(ASSIMP_HUNTER_ENABLED) +# hunter_add_package(ZLIB) +# find_package(ZLIB CONFIG REQUIRED)# - add_definitions(-DASSIMP_BUILD_NO_OWN_ZLIB) - set(ZLIB_FOUND TRUE) - set(ZLIB_LIBRARIES ZLIB::zlib) - set(ASSIMP_BUILD_MINIZIP TRUE) -ELSE() - IF ( NOT ASSIMP_BUILD_ZLIB ) - FIND_PACKAGE(ZLIB) - ENDIF() +# add_definitions(-DASSIMP_BUILD_NO_OWN_ZLIB) +# set(ZLIB_FOUND TRUE) +# set(ZLIB_LIBRARIES ZLIB::zlib) +# set(ASSIMP_BUILD_MINIZIP TRUE) +#ELSE() +# IF ( NOT ASSIMP_BUILD_ZLIB ) +# FIND_PACKAGE(ZLIB) +# ENDIF() - IF( NOT ZLIB_FOUND ) - MESSAGE(STATUS "compiling zlib from sources") - INCLUDE(CheckIncludeFile) - INCLUDE(CheckTypeSize) - INCLUDE(CheckFunctionExists) +# IF( NOT ZLIB_FOUND ) +# MESSAGE(STATUS "compiling zlib from sources") +# INCLUDE(CheckIncludeFile) +# INCLUDE(CheckTypeSize) +# INCLUDE(CheckFunctionExists) # Explicitly turn off ASM686 and AMD64 cmake options. # The AMD64 option causes a build failure on MSVC and the ASM builds seem to have problems: # https://github.com/madler/zlib/issues/41#issuecomment-125848075 # Also prevents these options from "polluting" the cmake options if assimp is being # included as a submodule. - set( ASM686 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE ) - set( AMD64 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE ) +# set( ASM686 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE ) +# set( AMD64 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE ) # compile from sources - ADD_SUBDIRECTORY(contrib/zlib) - SET(ZLIB_FOUND 1) - SET(ZLIB_LIBRARIES zlibstatic) - SET(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zlib ${CMAKE_CURRENT_BINARY_DIR}/contrib/zlib) + # ADD_SUBDIRECTORY(contrib/zlib) + # SET(ZLIB_FOUND 1) + # SET(ZLIB_LIBRARIES zlibstatic) + # SET(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zlib ${CMAKE_CURRENT_BINARY_DIR}/contrib/zlib) # need to ensure we don't link with system zlib or minizip as well. - SET(ASSIMP_BUILD_MINIZIP 1) - ELSE() - ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB) - SET(ZLIB_LIBRARIES_LINKED -lz) - ENDIF() - INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) -ENDIF() + # SET(ASSIMP_BUILD_MINIZIP 1) + #ELSE() +# ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB) +# SET(ZLIB_LIBRARIES_LINKED -lz) +# ENDIF() +# INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +#ENDIF() IF( NOT IOS ) IF( NOT ASSIMP_BUILD_MINIZIP ) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index bbcad86e5..0dbf712c1 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -951,6 +951,53 @@ ELSE() SOURCE_GROUP( ziplib FILES ${ziplib_SRCS} ) ENDIF() +IF(ASSIMP_HUNTER_ENABLED) + hunter_add_package(ZLIB) + find_package(ZLIB CONFIG REQUIRED) + + add_definitions(-DASSIMP_BUILD_NO_OWN_ZLIB) + set(ZLIB_FOUND TRUE) + set(ZLIB_LIBRARIES ZLIB::zlib) + set(ASSIMP_BUILD_MINIZIP TRUE) + SET(ZLIB_LIBRARIES_LINKED -lz) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +ELSE() + IF ( NOT ASSIMP_BUILD_ZLIB ) + FIND_PACKAGE(ZLIB) + ELSE() + SET( zlib_SRCS + ../contrib/zlib/crc32.h + ../contrib/zlib/deflate.h + ../contrib/zlib/gzguts.h + ../contrib/zlib/inffast.h + ../contrib/zlib/inffixed.h + ../contrib/zlib/inflate.h + ../contrib/zlib/inftrees.h + ../contrib/zlib/trees.h + ../contrib/zlib/zutil.h + ../contrib/zlib/adler32.c + ../contrib/zlib/compress.c + ../contrib/zlib/crc32.c + ../contrib/zlib/deflate.c + ../contrib/zlib/gzclose.c + ../contrib/zlib/gzlib.c + ../contrib/zlib/gzread.c + ../contrib/zlib/gzwrite.c + ../contrib/zlib/inflate.c + ../contrib/zlib/infback.c + ../contrib/zlib/inftrees.c + ../contrib/zlib/inffast.c + ../contrib/zlib/trees.c + ../contrib/zlib/uncompr.c + ../contrib/zlib/zutil.c + ) + INCLUDE_DIRECTORIES(../contrib/zlib/) + set( ASM686 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE ) + set( AMD64 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE ) + SOURCE_GROUP( zlib FILES ${zlib_SRCS} ) + ENDIF() + +ENDIF() # openddlparser IF(ASSIMP_HUNTER_ENABLED) hunter_add_package(openddlparser) @@ -1098,6 +1145,7 @@ SET( assimp_src ${open3dgc_SRCS} ${ziplib_SRCS} ${Pugixml_SRCS} + ${zlib_SRCS} # Necessary to show the headers in the project when using the VC++ generator: ${PUBLIC_HEADERS}