-
Notifications
You must be signed in to change notification settings - Fork 132
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
Android Support #157
Open
oliver-schick
wants to merge
1
commit into
encryptogroup:public
Choose a base branch
from
oliver-schick:public
base: public
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Android Support #157
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -15,6 +15,8 @@ docs/* | |
|
||
# build directory | ||
build*/ | ||
# extern directory | ||
extern/* | ||
|
||
# CMake | ||
CMakeCache.txt | ||
|
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
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,17 @@ | ||
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) | ||
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 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(DEPENDENCY_NAME "@DEPENDENCY_NAME@") | ||
if(ANDROID AND ANDROID_ARM_NEON) | ||
set(PREFIX "${DEPENDENCY_NAME}-${ANDROID_PLATFORM}-${ANDROID_SYSROOT_ABI}-NEON") | ||
elseif(ANDROID AND NOT ANDROID_ARM_NEON) | ||
set(PREFIX "${DEPENDENCY_NAME}-${ANDROID_PLATFORM}-${ANDROID_SYSROOT_ABI}") | ||
else() | ||
set(PREFIX "${DEPENDENCY_NAME}") | ||
endif() | ||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${PREFIX}/${PREFIX}Config.cmake") | ||
include("${CMAKE_CURRENT_LIST_DIR}/${PREFIX}/${PREFIX}Config.cmake") | ||
else() | ||
set(${DEPENDENCY_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,33 @@ | ||
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 | ||
) |
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,33 @@ | ||
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 | ||
) |
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,19 @@ | ||
|
||
set(TARGETS "@DEPENDENCY_TARGETS@") | ||
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,88 @@ | ||
option(ABY_BUILD_EXE "Build executables" OFF) | ||
set(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) | ||
|
||
#Cache Variables related to ENCRYPTO_utils dependency | ||
set(ENCRYPTO_utils_SOURCE | ||
CACHE PATH "Path to ENCRYPTO_utils source.") | ||
set(ENCRYPTO_utils_REPOSITORY https://github.com/oliver-schick/ENCRYPTO_utils.git | ||
CACHE STRING "Git repository of ENCRYPTO_utils project.") | ||
set(ENCRYPTO_utils_TAG origin/master | ||
CACHE STRING "Git tag of downloaded ENCRYPTO_utils project.") | ||
|
||
#Cache Variables related to OTExtension dependency | ||
set(OTExtension_SOURCE | ||
CACHE PATH "Path to OTExtension source.") | ||
set(OTExtension_REPOSITORY https://github.com/oliver-schick/OTExtension.git | ||
CACHE STRING "Git repository of OTExtension project.") | ||
set(OTExtension_TAG origin/master | ||
CACHE STRING "Git tag of downloaded OTExtension project.") | ||
|
||
#Cache Variables related to BOOST dependency | ||
option(DOWNLOAD_BOOST "Set to download boost libraries." OFF) | ||
set(BOOST_SOURCE | ||
CACHE PATH "Path to boost source location.") | ||
set(BOOST_URL https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.bz2 | ||
CACHE STRING "Boost download URL.") | ||
set(BOOST_URL_HASH SHA256=8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406 | ||
CACHE STRING "Boost download URL SHA256 checksum.") | ||
|
||
#Cache Variables related to BOOST_CMAKE dependency | ||
set(BOOST_CMAKE_SOURCE | ||
CACHE PATH "Path to boost-cmake source.") | ||
set(BOOST_CMAKE_REPOSITORY https://github.com/Orphis/boost-cmake.git | ||
CACHE STRING "Repository to boost-cmake project.") | ||
set(BOOST_CMAKE_TAG 70b12f62da331dd402b78102ec8f6a15d59a7af9 | ||
CACHE STRING "Git tag of boost-cmake") | ||
|
||
#Cache Variables related to GMP dependency | ||
option(BUILD_GMP "Build GMP library if none is found." OFF) | ||
option(FORCE_GMP_BUILD "Force building of GMP library (use if installed GMP library is not compatible with build)." OFF) | ||
set(GMP_LIBRARY_DIR | ||
CACHE PATH "Path to GMP library.") | ||
set(GMP_INCLUDES | ||
CACHE PATH "Path to GMP include directories.") | ||
set(GMP_SOURCE | ||
CACHE PATH "Path to GMP source (If building GMP).") | ||
set(GMP_URL https://gmplib.org/download/gmp/gmp-6.2.0.tar.lz | ||
CACHE STRING "URL of GMP source.") | ||
set(GMP_URL_HASH SHA512=9975e8766e62a1d48c0b6d7bbdd2fccb5b22243819102ca6c8d91f0edd2d3a1cef21c526d647c2159bb29dd2a7dcbd0d621391b2e4b48662cf63a8e6749561cd | ||
CACHE STRING "Hash of GMP source archive.") | ||
set(GMP_LIBRARY_TYPE | ||
CACHE STRING "[SHARED | STATIC]: Type of GMP library linked to project.") | ||
set_property(CACHE GMP_LIBRARY_TYPE PROPERTY STRINGS STATIC SHARED) | ||
mark_as_advanced(FORCE_GMP_BUILD) | ||
|
||
include(AndroidCacheVariables) |
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,13 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
|
||
set(BOOST_INSTALL_INCLUDE "${${PROJECT_NAME}_INSTALL_INCLUDE}") | ||
set(USE_ANDROID ANDROID) | ||
file(GLOB BOOST_CMAKE_FILE_LIST "${PROJECT_SOURCE_DIR}/extern/boost-cmake/*") | ||
list(LENGTH BOOST_CMAKE_FILE_LIST BOOST_CMAKE_NUM_FILES) | ||
#if boost-cmake directory is empty | ||
if(BOOST_CMAKE_NUM_FILES EQUAL 0) | ||
include(FetchBOOST_CMAKE) | ||
else() | ||
set(BOOST_CMAKE_SOURCE "${PROJECT_SOURCE_DIR}/extern/BOOST_CMAKE" CACHE PATH "Path to boost-cmake source." FORCE) | ||
include(FetchBOOST_CMAKE) | ||
endif() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this?