-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cross-compilation support for Android.
- Loading branch information
1 parent
bae46a0
commit 36d7aef
Showing
34 changed files
with
1,105 additions
and
160 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
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
[submodule "extern/ENCRYPTO_utils"] | ||
path = extern/ENCRYPTO_utils | ||
url = https://github.com/encryptogroup/ENCRYPTO_utils.git | ||
[submodule "extern/OTExtension"] | ||
path = extern/OTExtension | ||
url = https://github.com/encryptogroup/OTExtension.git | ||
[submodule "extern/boost-cmake"] | ||
path = extern/boost-cmake | ||
url = https://github.com/Orphis/boost-cmake.git |
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
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 |
---|---|---|
@@ -1,15 +1,20 @@ | ||
get_filename_component(ABY_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${ABY_CMAKE_DIR}") | ||
|
||
include(CMakeFindDependencyMacro) | ||
|
||
find_dependency(Boost) | ||
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() | ||
|
||
if(TARGET ABY::aby) | ||
set(ABY_FOUND TRUE) | ||
set(TARGETS ABY::aby) | ||
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,5 @@ | ||
get_filename_component(Boost_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
|
||
if(NOT TARGET Boost::boost) | ||
include("${Boost_CMAKE_DIR}/BoostTargets.cmake") | ||
endif() |
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
include(CMakeFindDependencyMacro) | ||
set(INSTALL_NAME "@INSTALL_NAME@") | ||
if(ANDROID AND ANDROID_ARM_NEON) | ||
set(PREFIX "${INSTALL_NAME}-${ANDROID_PLATFORM}-${ANDROID_SYSROOT_ABI}-NEON") | ||
elseif(ANDROID AND NOT ANDROID_ARM_NEON) | ||
set(PREFIX "${INSTALL_NAME}-${ANDROID_PLATFORM}-${ANDROID_SYSROOT_ABI}") | ||
else() | ||
set(PREFIX "${INSTALL_NAME}") | ||
endif() | ||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${PREFIX}/${PREFIX}Config.cmake") | ||
include("${CMAKE_CURRENT_LIST_DIR}/${PREFIX}/${PREFIX}Config.cmake") | ||
else() | ||
set(${INSTALL_NAME}_FOUND FALSE) | ||
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,35 @@ | ||
if(NOT "${GMP_LIBRARY_TYPE}" STREQUAL "STATIC" AND NOT "${GMP_LIBRARY_TYPE}" STREQUAL "SHARED") | ||
set(GMP_LIBRARY_TYPE "@GMP_LIBRARY_TYPE@") | ||
endif() | ||
set(LIB_PREFIX "${CMAKE_${GMP_LIBRARY_TYPE}_LIBRARY_PREFIX}") | ||
set(LIB_SUFFIX "${CMAKE_${GMP_LIBRARY_TYPE}_LIBRARY_SUFFIX}") | ||
|
||
set(GMP_INCLUDE_PATHS "@INSTALL_CONFIG_INCLUDE_PATHS@") | ||
set(GMP_LIB_PATHS "@INSTALL_CONFIG_LIB_PATHS@") | ||
|
||
unset(GMP_INCLUDE_DIR CACHE) | ||
unset(GMP_LIBRARY CACHE) | ||
|
||
find_path(GMP_INCLUDE_DIR gmp.h PATHS ${GMP_INCLUDE_PATHS}) | ||
find_library(GMP_LIBRARY NAMES ${LIB_PREFIX}gmp${LIB_SUFFIX} PATHS ${GMP_LIB_PATHS}) | ||
|
||
if(EXISTS "${GMP_INCLUDE_DIR}" AND EXISTS "${GMP_LIBRARY}") | ||
set(GMP_FOUND TRUE) | ||
else() | ||
set(GMP_LIBRARY ) | ||
set(GMP_FOUND FALSE) | ||
endif() | ||
|
||
if(GMP_FOUND AND NOT TARGET GMP::GMP) | ||
add_library(GMP::GMP "${GMP_LIBRARY_TYPE}" 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 | ||
) | ||
|
||
set(TARGETS GMP::GMP) |
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,35 @@ | ||
if(NOT "${GMP_LIBRARY_TYPE}" STREQUAL "STATIC" AND NOT "${GMP_LIBRARY_TYPE}" STREQUAL "SHARED") | ||
set(GMP_LIBRARY_TYPE "@GMP_LIBRARY_TYPE@") | ||
endif() | ||
set(LIB_PREFIX "${CMAKE_${GMP_LIBRARY_TYPE}_LIBRARY_PREFIX}") | ||
set(LIB_SUFFIX "${CMAKE_${GMP_LIBRARY_TYPE}_LIBRARY_SUFFIX}") | ||
|
||
set(GMPXX_INCLUDE_PATHS "@INSTALL_CONFIG_INCLUDE_PATHS@") | ||
set(GMPXX_LIB_PATHS "@INSTALL_CONFIG_LIB_PATHS@") | ||
|
||
unset(GMPXX_INCLUDE_DIR CACHE) | ||
unset(GMPXX_LIBRARY CACHE) | ||
|
||
find_path(GMPXX_INCLUDE_DIR gmpxx.h PATHS ${GMPXX_INCLUDE_PATHS}) | ||
find_library(GMPXX_LIBRARY NAMES ${LIB_PREFIX}gmpxx${LIB_SUFFIX} PATHS ${GMPXX_LIB_PATHS}) | ||
|
||
if(EXISTS "${GMPXX_INCLUDE_DIR}" AND EXISTS "${GMPXX_LIBRARY}") | ||
set(GMPXX_FOUND TRUE) | ||
else() | ||
set(GMPXX_LIBRARY ) | ||
set(GMPXX_FOUND FALSE) | ||
endif() | ||
|
||
if(GMPXX_FOUND AND NOT TARGET GMP::GMPXX) | ||
add_library(GMP::GMPXX "${GMP_LIBRARY_TYPE}" 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 | ||
) | ||
|
||
set(TARGETS GMP::GMPXX) |
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,18 @@ | ||
|
||
function(import_into_android_studio IMPORT_LOCATION) | ||
if(ANDROID AND EXISTS "${IMPORT_LOCATION}") | ||
foreach(target ${TARGETS}) | ||
get_target_property(library_type ${target} TYPE) | ||
if("${library_type}" STREQUAL "SHARED_LIBRARY") | ||
get_target_property(lib_location ${target} LOCATION) | ||
file(COPY "${lib_location}" DESTINATION "${IMPORT_LOCATION}") | ||
endif() | ||
endforeach() | ||
endif() | ||
endfunction() | ||
|
||
if(NOT IMPORT_LOCATION) | ||
import_into_android_studio("${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}") | ||
else() | ||
import_into_android_studio("${IMPORT_LOCATION}") | ||
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,38 @@ | ||
option(ABY_BUILD_EXE "Build executables" OFF) | ||
set(ABY_LIBRARY_TYPE "${ABY_LIBRARY_TYPE}" CACHE STRING | ||
"[STATIC | SHARED | MODULE] The type of library in which ABY will be built. Default: STATIC" | ||
) | ||
set_property(CACHE ABY_LIBRARY_TYPE PROPERTY STRINGS "STATIC" "SHARED" "MODULE") | ||
string(TOUPPER "${ABY_LIBRARY_TYPE}" ABY_LIBRARY_TYPE) | ||
if("${ABY_LIBRARY_TYPE}" STREQUAL "") | ||
set(ABY_LIBRARY_TYPE "SHARED") | ||
elseif(NOT "${ABY_LIBRARY_TYPE}" STREQUAL "STATIC" AND | ||
NOT "${ABY_LIBRARY_TYPE}" STREQUAL "SHARED" AND | ||
NOT "${ABY_LIBRARY_TYPE}" STREQUAL "MODULE") | ||
message(WARNING | ||
"Unknown library type: ${ABY_LIBRARY_TYPE}. " | ||
"Setting ABY_LIBRARY_TYPE to default value." | ||
) | ||
set(ABY_LIBRARY_TYPE "SHARED") | ||
endif() | ||
|
||
set(DEPENDENCY_DIR "${DEPENDENCY_DIR}" CACHE PATH "Path to directory, where dependencies will be downloaded.") | ||
if(DEPENDENCY_DIR STREQUAL "") | ||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/extern/dependencies") | ||
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/extern/dependencies") | ||
endif() | ||
set(DEPENDENCY_DIR "${CMAKE_SOURCE_DIR}/extern/dependencies") | ||
endif() | ||
|
||
# Set build type to `Release` if none 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." | ||
FORCE) | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS | ||
"None" "Debug" "Release" "RelWithDebInfo" "MinSizeRel" | ||
) | ||
endif(NOT CMAKE_BUILD_TYPE) | ||
|
||
include(AndroidCacheVariables) |
Oops, something went wrong.