Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fetch deps during build; use submodules #533

Open
wants to merge 1 commit into
base: contrib
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ lib/
build/
*.build
env
thirdparty/

########################################################################################
#### The following are based on templates from https://github.com/github/gitignore. ####
Expand Down
18 changes: 18 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[submodule "thirdparty/benchmark"]
path = thirdparty/benchmark
url = https://github.com/google/benchmark.git
[submodule "thirdparty/googletest"]
path = thirdparty/googletest
url = https://github.com/google/googletest.git
[submodule "thirdparty/hexl"]
path = thirdparty/hexl
url = https://github.com/intel/hexl
[submodule "thirdparty/zlib"]
path = thirdparty/zlib
url = https://github.com/madler/zlib.git
[submodule "thirdparty/zstd"]
path = thirdparty/zstd
url = https://github.com/facebook/zstd.git
[submodule "thirdparty/msgsl"]
path = thirdparty/msgsl
url = https://github.com/microsoft/GSL.git
14 changes: 5 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ set(SEAL_TARGETS_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/cmake/SEALTargets.cmake)
set(SEAL_CONFIG_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/cmake/SEALConfig.cmake)
set(SEAL_CONFIG_VERSION_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/cmake/SEALConfigVersion.cmake)
set(SEAL_CONFIG_H_FILENAME ${CMAKE_CURRENT_BINARY_DIR}/native/src/seal/util/config.h)
set(SEAL_THIRDPARTY_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty)
set(SEAL_THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/thirdparty)

# Install
set(SEAL_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/SEAL-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR})
Expand Down Expand Up @@ -146,8 +146,7 @@ message(STATUS "SEAL_USE_MSGSL: ${SEAL_USE_MSGSL}")

if(SEAL_USE_MSGSL)
if(SEAL_BUILD_DEPS)
message(STATUS "Microsoft GSL: download ...")
seal_fetch_thirdparty_content(ExternalMSGSL)
include(ExternalMSGSL)
else()
find_package(Microsoft.GSL 3 CONFIG)
if(NOT Microsoft.GSL_FOUND)
Expand All @@ -165,8 +164,7 @@ message(STATUS "SEAL_USE_ZLIB: ${SEAL_USE_ZLIB}")

if(SEAL_USE_ZLIB)
if(SEAL_BUILD_DEPS)
message(STATUS "ZLIB: download ...")
seal_fetch_thirdparty_content(ExternalZLIB)
include(ExternalZLIB)
set(zlib "zlibstatic")
else()
find_package(ZLIB 1.2.11)
Expand All @@ -186,8 +184,7 @@ message(STATUS "SEAL_USE_ZSTD: ${SEAL_USE_ZSTD}")

if(SEAL_USE_ZSTD)
if(SEAL_BUILD_DEPS)
message(STATUS "Zstandard: download ...")
seal_fetch_thirdparty_content(ExternalZSTD)
include(ExternalZSTD)
set(zstd_static "libzstd_static")
else()
find_package(zstd CONFIG)
Expand Down Expand Up @@ -220,8 +217,7 @@ message(STATUS "SEAL_USE_INTEL_HEXL: ${SEAL_USE_INTEL_HEXL}")

if(SEAL_USE_INTEL_HEXL)
if(SEAL_BUILD_DEPS)
message(STATUS "Intel HEXL: download ...")
seal_fetch_thirdparty_content(ExternalIntelHEXL)
include(ExternalIntelHEXL)
else()
find_package(HEXL 1.2.3)
if (NOT TARGET HEXL::hexl)
Expand Down
75 changes: 32 additions & 43 deletions cmake/ExternalBenchmark.cmake
Original file line number Diff line number Diff line change
@@ -1,50 +1,39 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

FetchContent_Declare(
benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG f91b6b42b1b9854772a90ae9501464a161707d1e # 1.6.0
)
FetchContent_GetProperties(benchmark)
set(LLVMAR_EXECUTABLE ${CMAKE_AR})
set(LLVMNM_EXECUTABLE ${CMAKE_NM})
set(LLVMRANLIB_EXECUTABLE ${CMAKE_RANLIB})
set(LLVM_FILECHECK_EXE ${CMAKE_CXX_COMPILER_AR}/../FileCheck)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_LTO OFF CACHE BOOL "" FORCE)
mark_as_advanced(LIBRT)
mark_as_advanced(LLVM_FILECHECK_EXE)
mark_as_advanced(BENCHMARK_BUILD_32_BITS)
mark_as_advanced(BENCHMARK_DOWNLOAD_DEPENDENCIES)
mark_as_advanced(BENCHMARK_ENABLE_ASSEMBLY_TESTS)
mark_as_advanced(BENCHMARK_ENABLE_EXCEPTIONS)
mark_as_advanced(BENCHMARK_ENABLE_GTEST_TESTS)
mark_as_advanced(BENCHMARK_ENABLE_INSTALL)
mark_as_advanced(BENCHMARK_ENABLE_LTO)
mark_as_advanced(BENCHMARK_ENABLE_TESTING)
mark_as_advanced(BENCHMARK_USE_LIBCXX)
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_BENCHMARK)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_BENCHMARK)

if(NOT benchmark)
FetchContent_Populate(benchmark)

set(LLVMAR_EXECUTABLE ${CMAKE_AR})
set(LLVMNM_EXECUTABLE ${CMAKE_NM})
set(LLVMRANLIB_EXECUTABLE ${CMAKE_RANLIB})
set(LLVM_FILECHECK_EXE ${CMAKE_CXX_COMPILER_AR}/../FileCheck)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_LTO OFF CACHE BOOL "" FORCE)
mark_as_advanced(LIBRT)
mark_as_advanced(LLVM_FILECHECK_EXE)
mark_as_advanced(BENCHMARK_BUILD_32_BITS)
mark_as_advanced(BENCHMARK_DOWNLOAD_DEPENDENCIES)
mark_as_advanced(BENCHMARK_ENABLE_ASSEMBLY_TESTS)
mark_as_advanced(BENCHMARK_ENABLE_EXCEPTIONS)
mark_as_advanced(BENCHMARK_ENABLE_GTEST_TESTS)
mark_as_advanced(BENCHMARK_ENABLE_INSTALL)
mark_as_advanced(BENCHMARK_ENABLE_LTO)
mark_as_advanced(BENCHMARK_ENABLE_TESTING)
mark_as_advanced(BENCHMARK_USE_LIBCXX)
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_BENCHMARK)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_BENCHMARK)

if(NOT WIN32)
# Google Benchmark contains unsafe conversions so force -Wno-conversion temporarily
set(OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS "${OLD_CMAKE_CXX_FLAGS} -Wno-conversion")
endif()
if(NOT WIN32)
# Google Benchmark contains unsafe conversions so force -Wno-conversion temporarily
set(OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS "${OLD_CMAKE_CXX_FLAGS} -Wno-conversion")
endif()

add_subdirectory(
${benchmark_SOURCE_DIR}
${THIRDPARTY_BINARY_DIR}/benchmark-src
EXCLUDE_FROM_ALL)
add_subdirectory(
${CMAKE_SOURCE_DIR}/thirdparty/benchmark
${CMAKE_BINARY_DIR}/thirdparty/benchmark
EXCLUDE_FROM_ALL)

if(NOT WIN32)
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
endif()
if(NOT WIN32)
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
endif()
35 changes: 12 additions & 23 deletions cmake/ExternalGTest.cmake
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG e2239ee6043f73722e7aa812a459f54a28552929 # 1.11.0
)
FetchContent_GetProperties(googletest)

if(NOT googletest_POPULATED)
FetchContent_Populate(googletest)

set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
mark_as_advanced(BUILD_GMOCK)
mark_as_advanced(INSTALL_GTEST)
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_GOOGLETEST)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_GOOGLETEST)

add_subdirectory(
${googletest_SOURCE_DIR}
${THIRDPARTY_BINARY_DIR}/googletest-src
EXCLUDE_FROM_ALL)
endif()
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
mark_as_advanced(BUILD_GMOCK)
mark_as_advanced(INSTALL_GTEST)
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_GOOGLETEST)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_GOOGLETEST)

add_subdirectory(
${CMAKE_SOURCE_DIR}/thirdparty/googletest
${CMAKE_BINARY_DIR}/thirdparty/googletest
EXCLUDE_FROM_ALL)
45 changes: 17 additions & 28 deletions cmake/ExternalIntelHEXL.cmake
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

FetchContent_Declare(
hexl
PREFIX hexl
GIT_REPOSITORY https://github.com/intel/hexl
GIT_TAG 0858760 # 1.2.3
)
FetchContent_GetProperties(hexl)

if(NOT hexl_POPULATED)
FetchContent_Populate(hexl)
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "" FORCE)
set(HEXL_BENCHMARK OFF CACHE BOOL "" FORCE)
set(HEXL_COVERAGE OFF CACHE BOOL "" FORCE)
set(HEXL_TESTING OFF CACHE BOOL "" FORCE)
set(HEXL_SHARED_LIB ${BUILD_SHARED_LIBS} CACHE BOOL "" FORCE)
set(EXCLUDE_FROM_ALL TRUE)
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "" FORCE)
set(HEXL_BENCHMARK OFF CACHE BOOL "" FORCE)
set(HEXL_COVERAGE OFF CACHE BOOL "" FORCE)
set(HEXL_TESTING OFF CACHE BOOL "" FORCE)
set(HEXL_SHARED_LIB ${BUILD_SHARED_LIBS} CACHE BOOL "" FORCE)
set(EXCLUDE_FROM_ALL TRUE)

mark_as_advanced(BUILD_HEXL)
mark_as_advanced(INSTALL_HEXL)
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_HEXL)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_HEXL)
mark_as_advanced(BUILD_HEXL)
mark_as_advanced(INSTALL_HEXL)
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_HEXL)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_HEXL)

add_subdirectory(
${hexl_SOURCE_DIR}
${hexl_SOURCE_DIR}/../hexl-build
EXCLUDE_FROM_ALL
)
endif()
add_subdirectory(
${CMAKE_SOURCE_DIR}/thirdparty/hexl
${CMAKE_BINARY_DIR}/thirdparty/hexl
EXCLUDE_FROM_ALL
)
30 changes: 11 additions & 19 deletions cmake/ExternalMSGSL.cmake
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

FetchContent_Declare(
msgsl
GIT_REPOSITORY https://github.com/microsoft/GSL.git
GIT_TAG 0f6dbc9e2915ef5c16830f3fa3565738de2a9230 # 3.1.0
)
FetchContent_GetProperties(msgsl)
set(GSL_CXX_STANDARD "14" CACHE STRING "" FORCE)
set(GSL_TEST OFF CACHE BOOL "" FORCE)
mark_as_advanced(GSL_CXX_STANDARD )
mark_as_advanced(GSL_TEST)
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_MSGSL)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_MSGSL)

if(NOT msgsl_POPULATED)
FetchContent_Populate(msgsl)
add_subdirectory(
${CMAKE_SOURCE_DIR}/thirdparty/msgsl
${CMAKE_BINARY_DIR}/thirdparty/msgsl
EXCLUDE_FROM_ALL)

set(GSL_CXX_STANDARD "14" CACHE STRING "" FORCE)
set(GSL_TEST OFF CACHE BOOL "" FORCE)
mark_as_advanced(GSL_CXX_STANDARD )
mark_as_advanced(GSL_TEST)
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_MSGSL)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_MSGSL)
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/msgsl/include)

add_subdirectory(
${msgsl_SOURCE_DIR}
${msgsl_SOURCE_DIR}/../msgsl-build
EXCLUDE_FROM_ALL)
endif()
61 changes: 30 additions & 31 deletions cmake/ExternalZLIB.cmake
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.

FetchContent_Declare(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG cacf7f1d4e3d44d871b605da3b647f07d718623f # 1.2.11
)
FetchContent_GetProperties(zlib)
if(NOT zlib_POPULATED)
FetchContent_Populate(zlib)
set(SKIP_INSTALL_ALL ON CACHE BOOL "" FORCE)
mark_as_advanced(AMD64)
mark_as_advanced(ASM686)
mark_as_advanced(EXECUTABLE_OUTPUT_PATH)
mark_as_advanced(CMAKE_INSTALL_PREFIX)
mark_as_advanced(INSTALL_BIN_DIR)
mark_as_advanced(INSTALL_INC_DIR)
mark_as_advanced(INSTALL_LIB_DIR)
mark_as_advanced(INSTALL_MAN_DIR)
mark_as_advanced(INSTALL_PKGCONFIG_DIR)
mark_as_advanced(LIBRARY_OUTPUT_PATH)
mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY)
mark_as_advanced(ZLIB_BUILD_STATIC)
mark_as_advanced(SKIP_INSTALL_ALL)

set(SKIP_INSTALL_ALL ON CACHE BOOL "" FORCE)
mark_as_advanced(AMD64)
mark_as_advanced(ASM686)
mark_as_advanced(EXECUTABLE_OUTPUT_PATH)
mark_as_advanced(CMAKE_INSTALL_PREFIX)
mark_as_advanced(INSTALL_BIN_DIR)
mark_as_advanced(INSTALL_INC_DIR)
mark_as_advanced(INSTALL_LIB_DIR)
mark_as_advanced(INSTALL_MAN_DIR)
mark_as_advanced(INSTALL_PKGCONFIG_DIR)
mark_as_advanced(LIBRARY_OUTPUT_PATH)
mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY)
mark_as_advanced(ZLIB_BUILD_STATIC)
mark_as_advanced(SKIP_INSTALL_ALL)
mark_as_advanced(FETCHCONTENT_SOURCE_DIR_ZLIB)
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED_ZLIB)
# ZLIB has no VERSION given to project(), needs to suppress CMP0048 warning
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS TRUE CACHE INTERNAL "Suppress CMP0048 warning" FORCE)

# ZLIB has no VERSION given to project(), needs to suppress CMP0048 warning
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS TRUE CACHE INTERNAL "Suppress CMP0048 warning" FORCE)
add_subdirectory(
${zlib_SOURCE_DIR}
${zlib_SOURCE_DIR}/../zlib-build
EXCLUDE_FROM_ALL)
endif()
# ZLIB pollutes the source directory, so copy the source code under
# {CMAKE_BINARY_DIR} and build it from there. This keeps *our* source
# directory clean.
file(
COPY
${CMAKE_SOURCE_DIR}/thirdparty/zlib/
DESTINATION
${CMAKE_BINARY_DIR}/thirdparty/zlib/)


add_subdirectory(
${CMAKE_BINARY_DIR}/thirdparty/zlib/
${CMAKE_BINARY_DIR}/thirdparty/zlib-build/
EXCLUDE_FROM_ALL)
Loading