forked from encryptogroup/ABY
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add CMake build for the ABY library and examples
* Defines libaby target in src/abycore. This allows to make clean only abycore (without the dependencies). * Build artifacts are put into bin/, lib/ inside the build directory. * Use Release as default build type.
- Loading branch information
Showing
36 changed files
with
263 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(ABY LANGUAGES CXX) | ||
|
||
option(ABY_BUILD_EXE "Build executables" OFF) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") | ||
|
||
# Set build type to `Release` if non was specified: | ||
# (cf. https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-can-i-change-the-default-build-mode-and-see-it-reflected-in-the-gui) | ||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release CACHE STRING | ||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." | ||
FORCE) | ||
endif(NOT CMAKE_BUILD_TYPE) | ||
|
||
# Write built executables and libraries to bin/ and lib/, respectively. | ||
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") | ||
endif() | ||
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") | ||
endif() | ||
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") | ||
endif() | ||
|
||
find_package(ENCRYPTO_utils QUIET) | ||
if(ENCRYPTO_utils_FOUND) | ||
message(STATUS "Found ENCRYPTO_utils") | ||
elseif(NOT ENCRYPTO_utils_FOUND AND NOT TARGET ENCRYPTO_utils::encrypto_utils) | ||
message("ENCRYPTO_utils was not found: add ENCRYPTO_utils subdirectory") | ||
find_package(Git REQUIRED) | ||
execute_process(COMMAND git submodule update --init extern/ENCRYPTO_utils | ||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") | ||
add_subdirectory(extern/ENCRYPTO_utils) | ||
endif() | ||
|
||
find_package(OTExtension QUIET) | ||
if(OTExtension_FOUND) | ||
message(STATUS "Found OTExtension") | ||
elseif (NOT OTExtension_FOUND AND NOT TARGET OTExtension::otextension) | ||
message("OTExtension was not found: add OTExtension subdirectory") | ||
find_package(Git REQUIRED) | ||
execute_process(COMMAND git submodule update --init extern/OTExtension | ||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") | ||
add_subdirectory(extern/OTExtension) | ||
endif() | ||
|
||
find_package(GMP REQUIRED) | ||
find_package(Threads REQUIRED) | ||
|
||
add_subdirectory(src/abycore) | ||
|
||
|
||
if(ABY_BUILD_EXE) | ||
add_subdirectory(src/test) | ||
add_subdirectory(src/examples) | ||
endif(ABY_BUILD_EXE) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
get_filename_component(ABY_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${ABY_CMAKE_DIR}") | ||
|
||
include(CMakeFindDependencyMacro) | ||
|
||
find_dependency(OTExtension) | ||
find_dependency(ENCRYPTO_utils) | ||
find_dependency(MIRACL) | ||
find_dependency(GMP) | ||
find_dependency(Threads) | ||
|
||
if(NOT TARGET ABY::aby) | ||
include("${ABY_CMAKE_DIR}/ABYTargets.cmake") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
find_path(GMP_INCLUDE_DIR gmp.h) | ||
|
||
# TODO: get version | ||
|
||
find_library(GMP_LIBRARY NAMES gmp) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(GMP | ||
FOUND_VAR GMP_FOUND | ||
REQUIRED_VARS | ||
GMP_LIBRARY | ||
GMP_INCLUDE_DIR | ||
) | ||
|
||
if(GMP_FOUND AND NOT TARGET GMP::GMP) | ||
add_library(GMP::GMP UNKNOWN IMPORTED) | ||
set_target_properties(GMP::GMP PROPERTIES | ||
IMPORTED_LOCATION "${GMP_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${GMP_INCLUDE_DIR}" | ||
) | ||
endif() | ||
|
||
mark_as_advanced( | ||
GMP_INCLUDE_DIR | ||
GMP_LIBRARY | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
find_path(GMPXX_INCLUDE_DIR gmpxx.h) | ||
|
||
# TODO: get version | ||
|
||
find_library(GMPXX_LIBRARY NAMES gmpxx) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(GMPXX | ||
FOUND_VAR GMPXX_FOUND | ||
REQUIRED_VARS | ||
GMPXX_LIBRARY | ||
GMPXX_INCLUDE_DIR | ||
) | ||
|
||
if(GMPXX_FOUND AND NOT TARGET GMP::GMPXX) | ||
add_library(GMP::GMPXX UNKNOWN IMPORTED) | ||
set_target_properties(GMP::GMPXX PROPERTIES | ||
IMPORTED_LOCATION "${GMPXX_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${GMPXX_INCLUDE_DIR}" | ||
) | ||
endif() | ||
|
||
mark_as_advanced( | ||
GMPXX_INCLUDE_DIR | ||
GMPXX_LIBRARY | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
add_library(aby | ||
aby/abyparty.cpp | ||
aby/abysetup.cpp | ||
circuit/abycircuit.cpp | ||
circuit/arithmeticcircuits.cpp | ||
circuit/booleancircuits.cpp | ||
circuit/circuit.cpp | ||
circuit/share.cpp | ||
DGK/dgkparty.cpp | ||
DJN/djnparty.cpp | ||
sharing/arithsharing.cpp | ||
sharing/boolsharing.cpp | ||
sharing/sharing.cpp | ||
sharing/splut.cpp | ||
sharing/yaoclientsharing.cpp | ||
sharing/yaoserversharing.cpp | ||
sharing/yaosharing.cpp | ||
) | ||
add_library(ABY::aby ALIAS aby) | ||
|
||
target_compile_features(aby PUBLIC cxx_std_17) | ||
target_compile_options(aby PRIVATE "-Wall" "-Wextra" "-Weffc++") | ||
|
||
target_include_directories(aby | ||
PUBLIC | ||
$<INSTALL_INTERFACE:include> | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> | ||
) | ||
|
||
|
||
target_link_libraries(aby | ||
PUBLIC OTExtension::otextension | ||
PUBLIC ENCRYPTO_utils::encrypto_utils | ||
PUBLIC GMP::GMP | ||
PUBLIC Threads::Threads | ||
) | ||
|
||
|
||
install(TARGETS aby | ||
EXPORT "${PROJECT_NAME}Targets" | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib | ||
INCLUDES DESTINATION lib | ||
) | ||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" | ||
DESTINATION include | ||
FILES_MATCHING PATTERN "*.h" | ||
) | ||
|
||
export(TARGETS aby NAMESPACE "${PROJECT_NAME}::" FILE "${PROJECT_NAME}Targets.cmake") | ||
install(EXPORT "${PROJECT_NAME}Targets" | ||
NAMESPACE "${PROJECT_NAME}::" | ||
DESTINATION "lib/cmake/${PROJECT_NAME}" | ||
) | ||
|
||
include(CMakePackageConfigHelpers) | ||
|
||
configure_package_config_file("${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" | ||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake | ||
INSTALL_DESTINATION "lib/cmake/${PROJECT_NAME}" | ||
) | ||
|
||
install(FILES | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" | ||
DESTINATION "lib/cmake/${PROJECT_NAME}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.