[seal] Fixed and updated ports/seal to 3.5.9. (#13598)

* Fixed and updated ports/seal to 3.5.9.

* Update ports/seal/portfile.cmake

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Update ports/seal/portfile.cmake

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* [seal] Disable vendored dependencies. Fix writes to source dir.

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
This commit is contained in:
Wei Dai 2020-09-26 05:09:15 -07:00 коммит произвёл GitHub
Родитель 57b37381c3
Коммит 95638456fa
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 104 добавлений и 35 удалений

Просмотреть файл

@ -1,9 +1,7 @@
Source: seal
Version: 3.4.5-1
Version: 3.5.9
Homepage: https://github.com/microsoft/SEAL
Description: Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
Default-Features: zlib
Feature: zlib
Build-Depends: zlib
Description: Use zlib for compressed serialization
Description: (Not currently implemented) Use zlib for compressed serialization

Просмотреть файл

@ -0,0 +1,79 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 92404c5..9867974 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,20 +108,20 @@ endif()
# Required files and directories
include(GNUInstallDirs)
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SEAL_SOURCE_DIR}/${OUTLIB_PATH})
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SEAL_SOURCE_DIR}/${OUTLIB_PATH})
-set(CMAKE_LIBRARY_RUNTIME_DIRECTORY ${SEAL_SOURCE_DIR}/bin)
-set(SEAL_TARGETS_FILENAME ${SEAL_SOURCE_DIR}/cmake/SEALTargets.cmake)
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${OUTLIB_PATH})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${OUTLIB_PATH})
+set(CMAKE_LIBRARY_RUNTIME_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
+set(SEAL_TARGETS_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/cmake/SEALTargets.cmake)
set(SEAL_CONFIG_IN_FILENAME ${SEAL_SOURCE_DIR}/cmake/SEALConfig.cmake.in)
-set(SEAL_CONFIG_FILENAME ${SEAL_SOURCE_DIR}/cmake/SEALConfig.cmake)
+set(SEAL_CONFIG_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/cmake/SEALConfig.cmake)
set(SEAL_PKGCONFIG_IN_FILENAME ${SEAL_SOURCE_DIR}/seal.pc.in)
-set(SEAL_PKGCONFIG_FILENAME ${SEAL_SOURCE_DIR}/seal-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR}.pc)
-set(SEAL_CONFIG_VERSION_FILENAME ${SEAL_SOURCE_DIR}/cmake/SEALConfigVersion.cmake)
+set(SEAL_PKGCONFIG_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/seal-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR}.pc)
+set(SEAL_CONFIG_VERSION_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/cmake/SEALConfigVersion.cmake)
set(SEAL_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/SEAL-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR})
set(SEAL_PKGCONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
set(SEAL_INCLUDES_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/SEAL-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR})
set(SEAL_INCLUDES_BUILD_DIR ${SEAL_SOURCE_DIR}/native/src)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SEAL_SOURCE_DIR}/bin)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(SEAL_THIRDPARTY_DIR ${SEAL_SOURCE_DIR}/thirdparty)
# For extra modules we might have
@@ -830,7 +830,7 @@ unset(SEAL_MACOS_SEAL_C_PATH)
# Create SEALNet-multi.nuspec for a multi-platform NuGet package
configure_file(
${SEAL_SOURCE_DIR}/dotnet/nuget/SEALNet-multi.nuspec.in
- ${SEAL_SOURCE_DIR}/dotnet/nuget/SEALNet-multi.nuspec
+ ${CMAKE_CURRENT_BINARY_DIR}/dotnet/nuget/SEALNet-multi.nuspec
@ONLY)
set(SEAL_WINDOWS_SEAL_C_PATH "")
@@ -855,11 +855,11 @@ endif()
# Create SEALNet.nuspec for a local NuGet pack from SEALNet.nuspec.in
configure_file(
${SEAL_SOURCE_DIR}/dotnet/nuget/SEALNet.nuspec.in
- ${SEAL_SOURCE_DIR}/dotnet/nuget/SEALNet.nuspec
+ ${CMAKE_CURRENT_BINARY_DIR}/dotnet/nuget/SEALNet.nuspec
@ONLY)
# Create SEALNet.targets from SEALNet.targets.in
configure_file(
${SEAL_SOURCE_DIR}/dotnet/nuget/SEALNet.targets.in
- ${SEAL_SOURCE_DIR}/dotnet/nuget/SEALNet.targets
+ ${CMAKE_CURRENT_BINARY_DIR}/dotnet/nuget/SEALNet.targets
@ONLY)
diff --git a/native/src/seal/util/CMakeLists.txt b/native/src/seal/util/CMakeLists.txt
index 3f2c7ba..a15e634 100644
--- a/native/src/seal/util/CMakeLists.txt
+++ b/native/src/seal/util/CMakeLists.txt
@@ -28,7 +28,8 @@ target_sources(seal_obj PRIVATE
)
# Create the config file
-configure_file(${CMAKE_CURRENT_LIST_DIR}/config.h.in ${CMAKE_CURRENT_LIST_DIR}/config.h)
+configure_file(${CMAKE_CURRENT_LIST_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/seal/util/config.h)
+target_include_directories(seal_obj PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# Add header files for installation
install(
@@ -38,7 +39,7 @@ install(
${CMAKE_CURRENT_LIST_DIR}/clang.h
${CMAKE_CURRENT_LIST_DIR}/clipnormal.h
${CMAKE_CURRENT_LIST_DIR}/common.h
- ${CMAKE_CURRENT_LIST_DIR}/config.h
+ ${CMAKE_CURRENT_BINARY_DIR}/seal/util/config.h
${CMAKE_CURRENT_LIST_DIR}/croots.h
${CMAKE_CURRENT_LIST_DIR}/defines.h
${CMAKE_CURRENT_LIST_DIR}/galois.h

Просмотреть файл

@ -1,51 +1,43 @@
set(SEAL_VERSION_MAJOR 3)
set(SEAL_VERSION_MINOR 4)
set(SEAL_VERSION_MICRO 5)
vcpkg_fail_port_install(ON_TARGET "uwp")
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SEAL_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SEAL_BUILD_STATIC)
if (SEAL_BUILD_STATIC)
set(SEAL_LIB_BUILD_TYPE "Static_PIC")
endif ()
if (SEAL_BUILD_DYNAMIC)
set(SEAL_LIB_BUILD_TYPE "Shared")
endif ()
string(TOUPPER ${PORT} PORT_UPPER)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO microsoft/SEAL
REF 9fc376c19488be2bfd213780ee06789754f4b2c2
SHA512 198f75371c7b0b88066495a40c687c32725a033fd1b3e3dadde3165da8546d44e9eaa9355366dd5527058ae2171175f757f69189cf7f5255f51eba14c6f38b78
REF e3ad13edf7e5b4dc8a59fd2cd6235ad9d7428cab
SHA512 9d52a51bd1d3141e45fd1f92134433a9eb7458e125140501952535c67ea49e0c66ccd4a80f7473c31db1963afcd7e690c716ea32d195cb07ba6fa60847168a91
HEAD_REF master
PATCHES no-source-writes.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
zlib SEAL_USE_ZLIB
)
if("zlib" IN_LIST FEATURES)
message("SEAL currently does not support non-vendored zlib -- ignoring feature 'zlib'")
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/native/src
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
OPTIONS
-DALLOW_COMMAND_LINE_BUILD=ON
-DSEAL_LIB_BUILD_TYPE=${SEAL_LIB_BUILD_TYPE}
-DSEAL_USE_MSGSL=OFF # issue https://github.com/microsoft/SEAL/issues/159
-DSEAL_BUILD_EXAMPLES=OFF
-DSEAL_BUILD_TESTS=OFF
-DSEAL_BUILD_SEAL_C=OFF
-DSEAL_USE_MSGSL=OFF
-DSEAL_USE_ZLIB=OFF
)
vcpkg_build_cmake(TARGET seal LOGFILE_ROOT build)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT_UPPER}-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR})
file(GLOB CONFIG_PATH RELATIVE "${CURRENT_PACKAGES_DIR}" "${CURRENT_PACKAGES_DIR}/lib/cmake/SEAL-*")
if(NOT CONFIG_PATH)
message(FATAL_ERROR "Could not find installed cmake config files.")
endif()
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share)
vcpkg_fixup_cmake_targets(CONFIG_PATH "${CONFIG_PATH}")
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)