Skip to content

Commit

Permalink
Add SEAL_PURE_SOURCETREE option
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick Weber committed Dec 6, 2021
1 parent 88bbc51 commit 6095379
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Source Tree
set(SEAL_INCLUDES_DIR ${CMAKE_CURRENT_LIST_DIR}/native/src)
set(SEAL_THIRDPARTY_DIR ${CMAKE_CURRENT_LIST_DIR}/thirdparty)
set(SEAL_CONFIG_IN_FILENAME ${CMAKE_CURRENT_LIST_DIR}/cmake/SEALConfig.cmake.in)
set(SEAL_CONFIG_H_IN_FILENAME ${SEAL_INCLUDES_DIR}/seal/util/config.h.in)

Expand All @@ -103,6 +102,19 @@ 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)

# [option] SEAL_PURE_SOURCETREE (default: OFF)
set(SEAL_PURE_SOURCETREE_OPTION_STR "When set, the SEAL build will not write any files outside the build directory, including thirdparty dependencies sources.")
option(SEAL_PURE_SOURCETREE ${SEAL_PURE_SOURCETREE_OPTION_STR} OFF)
message(STATUS "SEAL_PURE_SOURCETREE: ${SEAL_PURE_SOURCETREE}")

# Build or source tree depending on configuration
if(${SEAL_PURE_SOURCETREE} )
set(SEAL_THIRDPARTY_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty)
else()
set(SEAL_THIRDPARTY_DIR ${CMAKE_CURRENT_LIST_DIR}/thirdparty)
endif()


# Install
set(SEAL_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/SEAL-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR})
set(SEAL_INCLUDES_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/SEAL-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR})
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ The following options can be used with CMake to configure the build. The default
| SEAL_USE_CXX17 | **ON** / OFF | Set to `ON` to build Microsoft SEAL as C++17 for a positive performance impact. |
| SEAL_USE_INTRIN | **ON** / OFF | Set to `ON` to use compiler intrinsics for improved performance. CMake will automatically detect which intrinsics are available and enable them accordingly. |

| SEAL_PURE_SOURCETREE | ON / **OFF**
| When enabled, the SEAL build will only emit files into the cmake build directory. This includes third-party dependencies (both sources and binaries). This flag can improve compatibility with other build systems and enables concurrently building multiple instances of the SEAL library with different `cmake -B` options.

As usual, these options can be passed to CMake with the `-D` flag.
For example, one could run

Expand Down
1 change: 1 addition & 0 deletions cmake/ExternalIntelHEXL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if(NOT hexl_POPULATED)

add_subdirectory(
${hexl_SOURCE_DIR}
${hexl_SOURCE_DIR}/../hexl-build
EXCLUDE_FROM_ALL
)
endif()
1 change: 1 addition & 0 deletions cmake/ExternalMSGSL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ if(NOT msgsl_POPULATED)

add_subdirectory(
${msgsl_SOURCE_DIR}
${msgsl_SOURCE_DIR}/../msgsl-build
EXCLUDE_FROM_ALL)
endif()
1 change: 1 addition & 0 deletions cmake/ExternalZLIB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ if(NOT zlib_POPULATED)
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()
1 change: 1 addition & 0 deletions cmake/ExternalZSTD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ if(NOT zstd_POPULATED)

add_subdirectory(
${zstd_SOURCE_DIR}/build/cmake
${zstd_SOURCE_DIR}/../zstd-build
EXCLUDE_FROM_ALL)
endif()

0 comments on commit 6095379

Please sign in to comment.