Skip to content

Commit bb2b2c7

Browse files
committed
Fixed problem with install on non-android devices. Fixed issue with ABY downloading old OTExtension and Encrypto_utils projects (now downloading master by default). Fixed issue with redownloading OTExtension and Encrypto_utils dependencies when cloning with git --recursive.
1 parent 2a51d22 commit bb2b2c7

File tree

10 files changed

+77
-65
lines changed

10 files changed

+77
-65
lines changed

cmake/Modules/FetchHelper.cmake

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ macro(fetch_helper content_name)
77
set(${content_name}_DOWNLOAD_DIR_COMMAND "")
88
endif()
99
if(NOT ${${content_name}_SOURCE} STREQUAL "")
10-
set(${content_name}_URL_COMMAND URL ${${content_name}_SOURCE})
11-
set(${content_name}_URL_HASH_COMMAND "")
10+
set(${content_name}_DOWNLOAD_COMMAND1 URL ${${content_name}_SOURCE})
11+
set(${content_name}_DOWNLOAD_COMMAND2 "")
12+
elseif(DOWNLOAD_${content_name})
13+
set(${content_name}_DOWNLOAD_COMMAND1 URL ${${content_name}_URL})
14+
set(${content_name}_DOWNLOAD_COMMAND2 URL_HASH ${${content_name}_URL_HASH})
1215
else()
13-
set(${content_name}_URL_COMMAND URL ${${content_name}_URL})
14-
set(${content_name}_URL_HASH_COMMAND URL_HASH ${${content_name}_URL_HASH})
16+
set(${content_name}_DOWNLOAD_COMMAND1 GIT_REPOSITORY ${${content_name}_REPOSITORY})
17+
set(${content_name}_DOWNLOAD_COMMAND2 GIT_TAG ${${content_name}_TAG})
1518
endif()
1619
include(FetchContent)
1720
FetchContent_Declare(${content_name}
18-
${${content_name}_URL_COMMAND}
19-
${${content_name}_URL_HASH_COMMAND}
21+
${${content_name}_DOWNLOAD_COMMAND1}
22+
${${content_name}_DOWNLOAD_COMMAND2}
2023
${${content_name}_DOWNLOAD_DIR_COMMAND}
2124
)
2225
FetchContent_GetProperties(${content_name})

src/abycore/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules")
55
set(INSTALL_NAME ${PROJECT_NAME})
66

77
if(ANDROID)
8-
set(INSTALL_BOOST_DEPENDENCIES TRUE)
98
if(ANDROID_ARM_NEON)
109
set(ABY_INSTALL_PREFIX "platforms/${ANDROID_PLATFORM}/arch-${ANDROID_SYSROOT_ABI}/NEON")
1110
else(ANDROID_ARM_NEON)
@@ -16,12 +15,11 @@ if(ANDROID)
1615
set(ABY_INSTALL_ARCHIVE "${ABY_INSTALL_PREFIX}/lib")
1716
set(ABY_INSTALL_CONFIG "usr/local")
1817
else(ANDROID)
19-
set(INSTALL_BOOST_DEPENDENCIES FALSE)
20-
set(ABY_INSTALL_PREFIX "")
18+
set(ABY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
2119
set(ABY_INSTALL_INCLUDE "include")
2220
set(ABY_INSTALL_LIB "lib")
2321
set(ABY_INSTALL_ARCHIVE "lib")
24-
set(ABY_INSTALL_CONFIG "usr/local")
22+
set(ABY_INSTALL_CONFIG "${CMAKE_INSTALL_PREFIX}")
2523
endif(ANDROID)
2624

2725

src/abycore/cmake/Modules/AddBoost.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ if(NOT TARGET Boost::boost OR NOT TARGET Boost::filesystem)
1313
message(STATUS "Fetching Boost sources. This might take several minutes. "
1414
"No progress is shown, please wait...")
1515
include(AddBOOST_CMAKE)
16+
set(INSTALL_BOOST_DEPENDENCIES TRUE)
1617
elseif(ANDROID AND NOT DOWNLOAD_BOOST AND EXISTS BOOST_SOURCE)
1718
include(AddBOOST_CMAKE)
19+
set(INSTALL_BOOST_DEPENDENCIES TRUE)
1820
elseif(ANDROID)
1921
message(FATAL_ERROR "Please provide a valid directory for BOOST_SOURCE (recommended) or automatically download boost libraries by setting DOWNLOAD_BOOST.")
2022
else()

src/abycore/cmake/Modules/AddENCRYPTO_utils.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
cmake_minimum_required(VERSION 3.13)
22

3-
find_package(ENCRYPTO_utils QUIET)
4-
if(ENCRYPTO_utils_FOUND)
5-
message(STATUS "Found ENCRYPTO_utils.")
6-
elseif(NOT ENCRYPTO_utils_FOUND AND NOT TARGET ENCRYPTO_utils::encrypto_utils)
3+
if(NOT TARGET ENCRYPTO_utils::encrypto_utils)
74
if(NOT ENCRYPTO_utils_LIBRARY_TYPE)
85
set(ENCRYPTO_utils_LIBRARY_TYPE ${ABY_LIBRARY_TYPE})
96
endif()

src/abycore/cmake/Modules/AddGMP.cmake

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
cmake_minimum_required(VERSION 3.13)
22

3-
option(BUILD_GMP "Compile GMP library if none is found." OFF)
4-
option(FORCE_GMP_BUILD "Force Build of GMP library (use if installed GMP library is incompatible with build)." OFF)
3+
option(BUILD_GMP "Build GMP library if none is found." OFF)
4+
option(FORCE_GMP_BUILD "Force building of GMP library (use if installed GMP library is incompatible with build)." OFF)
55
set(GMP_LIB_DIR "" CACHE PATH "Path to GMP library.")
6-
set(GMP_INCLUDE_DIR "" CACHE PATH "Path to GMP include directories.")
6+
set(GMP_INCLUDES "" CACHE PATH "Path to GMP include directories.")
77
set(GMP_SOURCE CACHE PATH "Path to GMP source (If building GMP).")
88
set(GMP_URL https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz CACHE STRING "URL of GMP source.")
99
set(GMP_URL_HASH SHA256=12fed0532d440d2dc902e64f016aa89a33af6044b90bd1f7bca7396635105dbb CACHE STRING "Hash of GMP source archive.")
@@ -42,13 +42,17 @@ if(NOT GMP_FOUND OR NOT GMPXX_FOUND)
4242
message(STATUS "Adding GMP and GMPXX library to build.")
4343
set(GMP_ONLY OFF)
4444
include(BuildGMP)
45+
set(GMP_INCLUDES ${GMP_INCLUDE_DIR})
4546
elseif(NOT EXISTS "${GMP_LIB_DIR}/${GMP_LIBRARY_NAME}" OR
4647
NOT EXISTS "${GMP_LIB_DIR}/${GMPXX_LIBRARY_NAME}" OR
47-
NOT EXISTS "${GMP_INCLUDE_DIR}/gmp.h" OR
48-
NOT EXISTS "${GMP_INCLUDE_DIR}/gmpxx.h")
49-
message(FATAL_ERROR " Did not find gmp in standard location."
50-
" Either set GMP_LIB_DIR and GMP_INCLUDE_DIR to valid locations"
48+
NOT EXISTS "${GMP_INCLUDES}/gmp.h" OR
49+
NOT EXISTS "${GMP_INCLUDES}/gmpxx.h")
50+
message(FATAL_ERROR "Did not find gmp in standard location."
51+
" Either set GMP_LIB_DIR and GMP_INCLUDES to valid locations"
5152
" or enable GMP build by setting BUILD_GMP. ")
53+
else()
54+
set(GMP_LIB_DIR ${GMP_LIBRARY_DIR})
55+
set(GMP_INCLUDE_DIR ${GMP_INCLUDES})
5256
endif()
5357
include(InstallConfig)
5458
install_config(IGNORED "GMP" "${ABY_INSTALL_CONFIG}")

src/abycore/cmake/Modules/AddOTExtension.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
cmake_minimum_required(VERSION 3.13)
22

3-
find_package(OTExtension QUIET)
4-
if(OTExtension_FOUND)
5-
message(STATUS "Found OTExtension.")
6-
elseif(NOT OTExtension_FOUND AND NOT TARGET OTExtension::otextension)
3+
if(NOT TARGET OTExtension::otextension)
74
if(NOT OTExtension_LIBRARY_TYPE)
85
set(OTExtension_LIBRARY_TYPE ${ABY_LIBRARY_TYPE})
96
endif()

src/abycore/cmake/Modules/BuildGMP.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.13)
22

3-
if(NOT ${GMP_SOURCE} STREQUAL "")
3+
if(NOT "${GMP_SOURCE}" STREQUAL "")
44
set(GMP_LOCATION ${GMP_SOURCE})
55
set(GMP_URL_HASH_COMMAND)
66
else()
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
cmake_minimum_required(VERSION 3.13)
22

3-
set(ENCRYPTO_utils_SOURCE
4-
CACHE PATH
5-
"Path to ENCRYPTO_utils source."
6-
)
7-
set(ENCRYPTO_utils_URL
8-
https://github.com/oliver-schick/ENCRYPTO_utils/archive/23639b335f64532abdf64cdd131473599799ad62.zip
9-
CACHE STRING
10-
"URL of ENCRYPTO_utils project."
11-
)
12-
set(ENCRYPTO_utils_URL_HASH
13-
SHA256=37a4de5c943cd98592e1af2f8cd3b6f76337ccdbdba80dbf777a2f7c951dae15
14-
CACHE STRING
15-
"Hash of ENCRYPTO_utils archive."
16-
)
3+
set(ENCRYPTO_utils_SOURCE CACHE PATH "Path to ENCRYPTO_utils source.")
4+
set(ENCRYPTO_utils_REPOSITORY
5+
https://github.com/oliver-schick/ENCRYPTO_utils.git
6+
CACHE STRING "Git repository of ENCRYPTO_utils project.")
7+
set(ENCRYPTO_utils_TAG master CACHE STRING "Git tag of downloaded ENCRYPTO_utils project.")
8+
#Specific commit hash. Please regularly update to maintain compatibility with ABY.
9+
set(ENCRYPTO_utils_URL
10+
https://github.com/oliver-schick/ENCRYPTO_utils/archive/0380d7f82bc871ab9b1c593265e92482a070d8cf.zip
11+
CACHE STRING "URL of ENCRYPTO_utils project.")
12+
#sha256sum of downloaded file. To get it on linux simply type following command line:
13+
#$ wget -O out [URL] && sha256sum out
14+
set(ENCRYPTO_utils_URL_HASH SHA256=e50fe0667a313a3209492bac20516750b4fa6b8bb19fd94f84043ac1fbbdbd68 CACHE STRING "Hash of ENCRYPTO_utils archive.")
15+
option(DOWNLOAD_ENCRYPTO_utils "Set this option to download a specific commit of ENCRYPTO_utils." OFF)
16+
mark_as_advanced(ENCRYPTO_utils_REPOSITORY ENCRYPTO_utils_TAG ENCRYPTO_utils_URL ENCRYPTO_utils_URL_HASH DOWNLOAD_ENCRYPTO_utils)
1717

1818
include(FetchHelper)
1919
fetch_helper(ENCRYPTO_utils)

src/abycore/cmake/Modules/FetchHelper.cmake

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,40 @@ macro(fetch_helper content_name)
66
else()
77
set(${content_name}_DOWNLOAD_DIR_COMMAND "")
88
endif()
9-
if(NOT ${${content_name}_SOURCE} STREQUAL "")
10-
set(${content_name}_URL_COMMAND URL ${${content_name}_SOURCE})
11-
set(${content_name}_URL_HASH_COMMAND "")
9+
if(NOT "${${content_name}_SOURCE}" STREQUAL "")
10+
set(${content_name}_DOWNLOAD_COMMAND1 URL ${${content_name}_SOURCE})
11+
set(${content_name}_DOWNLOAD_COMMAND2 "")
12+
elseif(DOWNLOAD_${content_name} OR "${${content_name}_REPOSITORY}" STREQUAL "")
13+
set(${content_name}_DOWNLOAD_COMMAND1 URL ${${content_name}_URL})
14+
set(${content_name}_DOWNLOAD_COMMAND2 URL_HASH ${${content_name}_URL_HASH})
1215
else()
13-
set(${content_name}_URL_COMMAND URL ${${content_name}_URL})
14-
set(${content_name}_URL_HASH_COMMAND URL_HASH ${${content_name}_URL_HASH})
16+
set(${content_name}_DOWNLOAD_COMMAND1 GIT_REPOSITORY ${${content_name}_REPOSITORY})
17+
set(${content_name}_DOWNLOAD_COMMAND2 GIT_TAG ${${content_name}_TAG})
1518
endif()
1619
include(FetchContent)
1720
FetchContent_Declare(${content_name}
18-
${${content_name}_URL_COMMAND}
19-
${${content_name}_URL_HASH_COMMAND}
21+
${${content_name}_DOWNLOAD_COMMAND1}
22+
${${content_name}_DOWNLOAD_COMMAND2}
2023
${${content_name}_DOWNLOAD_DIR_COMMAND}
2124
)
2225
FetchContent_GetProperties(${content_name})
2326
if(NOT ${LOWER_CASE_${content_name}}_POPULATED)
2427
FetchContent_Populate(${content_name})
25-
if(${ARGV1})
28+
if(NOT "${ARGV1}" STREQUAL "")
2629
message(STATUS "Applying patches to ${content_name}...")
2730
include("Patch${content_name}")
2831
endif()
29-
add_subdirectory(
30-
${${LOWER_CASE_${content_name}}_SOURCE_DIR}
31-
${${LOWER_CASE_${content_name}}_BINARY_DIR}
32-
)
32+
if(NOT "${ARGV2}" STREQUAL "")
33+
add_subdirectory(
34+
${${LOWER_CASE_${content_name}}_SOURCE_DIR}
35+
${${LOWER_CASE_${content_name}}_BINARY_DIR}
36+
EXCLUDE_FROM_ALL
37+
)
38+
else()
39+
add_subdirectory(
40+
${${LOWER_CASE_${content_name}}_SOURCE_DIR}
41+
${${LOWER_CASE_${content_name}}_BINARY_DIR}
42+
)
43+
endif()
3344
endif()
3445
endmacro()
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
cmake_minimum_required(VERSION 3.13)
22

3-
set(OTExtension_SOURCE
4-
CACHE PATH
5-
"Path to OTExtension source."
6-
)
3+
set(OTExtension_SOURCE CACHE PATH "Path to OTExtension source.")
4+
set(OTExtension_REPOSITORY
5+
https://github.com/oliver-schick/OTExtension.git
6+
CACHE STRING "Git repository of OTExtension project.")
7+
set(OTExtension_TAG master CACHE STRING "Git tag of downloaded OTExtension project.")
8+
#Specific commit hash. Please regularly update to maintain compatibility with ABY.
79
set(OTExtension_URL
8-
https://github.com/oliver-schick/OTExtension/archive/a923a0b72faf5203a99233e696c163af1e5c17d2.zip
9-
CACHE STRING
10-
"URL of OTExtension project."
11-
)
12-
set(OTExtension_URL_HASH
13-
SHA256=58e8ff999ee2fddd985072c8f629b402609f8dbb6ec5c41b3c2f0e1c452a88a8
14-
CACHE STRING
15-
"Hash of OTExtension archive."
16-
)
10+
https://github.com/oliver-schick/OTExtension/archive/5948eb026ac94f88c55b2d198ccc89234a79858f.zip
11+
CACHE STRING "URL of OTExtension project.")
12+
#sha256sum of downloaded file. To get it on linux simply type following command line:
13+
#$ wget -O out [URL] && sha256sum out
14+
set(OTExtension_URL_HASH SHA256=c64bc174706ddd7def18dcd8974b55ee8036d371a7d85fea0a48bfe290ca0b23 CACHE STRING "Hash of OTExtension archive.")
15+
option(DOWNLOAD_OTExtension "Set this option to download a specific commit of OTExtension." OFF)
16+
mark_as_advanced(OTExtension_REPOSITORY OTExtension_TAG OTExtension_URL OTExtension_URL_HASH DOWNLOAD_OTExtension)
1717

1818
include(FetchHelper)
1919
fetch_helper(OTExtension)

0 commit comments

Comments
 (0)