зеркало из https://github.com/microsoft/SEAL.git
Fixed SEAL's dependencies on GSL/ZLIB/ZSTD in both static and shared builds. Also edited SEALConfig.cmake.in to look for static-only ZSTD.
This commit is contained in:
Родитель
6790119f96
Коммит
366005f5a8
|
@ -156,11 +156,13 @@ if(SEAL_USE_ZLIB)
|
|||
if(SEAL_BUILD_DEPS)
|
||||
message(STATUS "Download ZLIB ...")
|
||||
include(ExternalZLIB)
|
||||
set(zlib "zlibstatic")
|
||||
else()
|
||||
find_package(ZLIB 1.2.11)
|
||||
if(NOT ZLIB_FOUND)
|
||||
message(FATAL_ERROR "Failed to find ZLIB")
|
||||
endif()
|
||||
set(zlib "ZLIB::ZLIB")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -171,11 +173,22 @@ if(SEAL_USE_ZSTD)
|
|||
if(SEAL_BUILD_DEPS)
|
||||
message(STATUS "Download ZSTD ...")
|
||||
include(ExternalZSTD)
|
||||
set(zstd_static "libzstd_static")
|
||||
else()
|
||||
find_package(zstd CONFIG)
|
||||
if(NOT zstd_FOUND)
|
||||
message(FATAL_ERROR "Failed to find ZSTD")
|
||||
endif()
|
||||
if(TARGET zstd::libzstd_static)
|
||||
set(zstd_static "zstd::libzstd_static")
|
||||
elseif(TARGET libzstd)
|
||||
get_target_property(libzstd_type libzstd TYPE)
|
||||
if(libzstd_type STREQUAL "STATIC")
|
||||
set(zstd_static "libzstd")
|
||||
else()
|
||||
message(FATAL_ERROR "ZSTD must be static")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -337,21 +350,19 @@ if(NOT BUILD_SHARED_LIBS)
|
|||
|
||||
if(SEAL_USE_ZLIB AND NOT MSVC)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
add_dependencies(seal zlibstatic)
|
||||
#target_include_directories(seal PRIVATE $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>)
|
||||
seal_combine_archives(seal zlibstatic)
|
||||
add_dependencies(seal ${zlib})
|
||||
seal_combine_archives(seal ${zlib})
|
||||
else()
|
||||
target_link_libraries(seal PRIVATE ZLIB::ZLIB)
|
||||
target_link_libraries(seal PRIVATE ${zlib})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SEAL_USE_ZSTD AND NOT MSVC)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
add_dependencies(seal libzstd_static)
|
||||
target_include_directories(seal PRIVATE $<BUILD_INTERFACE:${zstd_SOURCE_DIR}/lib>)
|
||||
seal_combine_archives(seal libzstd_static)
|
||||
add_dependencies(seal ${zstd_static})
|
||||
seal_combine_archives(seal ${zstd_static})
|
||||
else()
|
||||
target_link_libraries(seal PRIVATE libzstd)
|
||||
target_link_libraries(seal PRIVATE ${zstd_static})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -367,25 +378,26 @@ else()
|
|||
seal_install_target(seal_shared SEALTargets)
|
||||
|
||||
if(SEAL_USE_MSGSL AND NOT MSVC)
|
||||
target_link_libraries(seal_shared PUBLIC Microsoft.GSL::GSL)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
target_include_directories(seal_shared PUBLIC $<BUILD_INTERFACE:${msgsl_SOURCE_DIR}/include>)
|
||||
else()
|
||||
target_link_libraries(seal_shared PUBLIC Microsoft.GSL::GSL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SEAL_USE_ZLIB AND NOT MSVC)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
add_dependencies(seal_shared zlibstatic)
|
||||
#target_include_directories(seal_shared PRIVATE $<BUILD_INTERFACE:${zlib_SOURCE_DIR}>)
|
||||
target_link_libraries(seal_shared PRIVATE ${zlib})
|
||||
else()
|
||||
target_link_libraries(seal_shared PRIVATE ZLIB::ZLIB)
|
||||
target_link_libraries(seal_shared PRIVATE ${zlib})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SEAL_USE_ZSTD AND NOT MSVC)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
add_dependencies(seal_shared libzstd_static)
|
||||
target_include_directories(seal_shared PRIVATE $<BUILD_INTERFACE:${zstd_SOURCE_DIR}/lib>)
|
||||
#target_include_directories(seal_shared PRIVATE $<BUILD_INTERFACE:${zstd_SOURCE_DIR}/lib/common>)
|
||||
target_link_libraries(seal_shared PRIVATE ${zstd_static})
|
||||
else()
|
||||
target_link_libraries(seal_shared PRIVATE libzstd)
|
||||
target_link_libraries(seal_shared PRIVATE ${zstd_static})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -12,7 +12,7 @@ if(NOT zstd_POPULATED)
|
|||
endif()
|
||||
|
||||
set(ZSTD_BUILD_PROGRAMS OFF CACHE BOOL "" FORCE)
|
||||
set(ZSTD_BUILD_SHARED ON CACHE BOOL "" FORCE)
|
||||
set(ZSTD_BUILD_SHARED OFF CACHE BOOL "" FORCE)
|
||||
set(ZLIB_BUILD_STATIC ON CACHE BOOL "" FORCE)
|
||||
set(ZSTD_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(ZSTD_MULTITHREAD_SUPPORT OFF CACHE BOOL "" FORCE)
|
||||
|
|
|
@ -63,6 +63,16 @@ endif()
|
|||
|
||||
if(SEAL_USE_ZSTD AND NOT SEAL_BUILD_DEPS)
|
||||
seal_find_dependency(zstd)
|
||||
if(NOT TARGET zstd::libzstd_static)
|
||||
if(TARGET libzstd)
|
||||
get_target_property(libzstd_type libzstd TYPE)
|
||||
if(libzstd_type STREQUAL "SHARED")
|
||||
set(zstd_static "libzstd")
|
||||
else()
|
||||
message(FATAL_ERROR "ZSTD must be static")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add the current directory to the module search path
|
||||
|
|
|
@ -436,7 +436,7 @@ namespace seal
|
|||
#endif
|
||||
#define ZSTD_STATIC_LINKING_ONLY
|
||||
#include "zstd.h"
|
||||
#include "common/zstd_errors.h"
|
||||
#include "zstd_errors.h"
|
||||
#if (SEAL_COMPILER == SEAL_COMPILER_GCC)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif (SEAL_COMPILER == SEAL_COMPILER_CLANG)
|
||||
|
|
Загрузка…
Ссылка в новой задаче