CMake libs build
This commit is contained in:
parent
03fffc44a5
commit
e9f000353b
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[submodule "vendor/boost/Boost-for-Android"]
|
||||||
|
path = vendor/boost/Boost-for-Android
|
||||||
|
url = https://github.com/moritz-wundke/Boost-for-Android.git
|
||||||
|
[submodule "vendor/spdlog"]
|
||||||
|
path = vendor/spdlog
|
||||||
|
url = https://github.com/gabime/spdlog.git
|
@ -7,19 +7,19 @@ cmake_policy(SET CMP0065 OLD)
|
|||||||
# - try if setting CRYPTOPP_NATIVE_ARCH=ON and adding -march=native to the compile commands for cryfs source files makes a difference
|
# - try if setting CRYPTOPP_NATIVE_ARCH=ON and adding -march=native to the compile commands for cryfs source files makes a difference
|
||||||
# -> if yes, offer a cmake option to enable both of these
|
# -> if yes, offer a cmake option to enable both of these
|
||||||
|
|
||||||
#set(ANDROID_ABI arm64-v8a)
|
set(ANDROID_ABI arm64-v8a)
|
||||||
#set(ANDROID_NDK /sdk/ndk/24.0.8215888/)
|
set(ANDROID_NDK /ndk/23.1.7779620/)
|
||||||
#set(ANDROID_PLATFORM android-21)
|
set(ANDROID_PLATFORM android-21)
|
||||||
#set(ANDROID_TOOLCHAIN clang)
|
set(ANDROID_TOOLCHAIN clang)
|
||||||
#
|
|
||||||
#set(CMAKE_SYSTEM_NAME Android)
|
set(CMAKE_SYSTEM_NAME Android)
|
||||||
#set(CMAKE_SYSTEM_VERSION 21)
|
set(CMAKE_SYSTEM_VERSION 21)
|
||||||
#set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
|
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
|
||||||
#set(CMAKE_ANDROID_NDK ${ANDROID_NDK})
|
set(CMAKE_ANDROID_NDK ${ANDROID_NDK})
|
||||||
#set(CMAKE_ANDROID_STL_TYPE c++_static)
|
set(CMAKE_ANDROID_STL_TYPE c++_static)
|
||||||
#
|
|
||||||
#set(CMAKE_TOOLCHAIN_FILE ${CMAKE_ANDROID_NDK}/build/cmake/android.toolchain.cmake)
|
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_ANDROID_NDK}/build/cmake/android.toolchain.cmake)
|
||||||
#set(ANDROID TRUE) # Current toolchain file doesn't set this variable which is needed by spdlog
|
set(ANDROID TRUE) # Current toolchain file doesn't set this variable which is needed by spdlog
|
||||||
|
|
||||||
project(cryfs)
|
project(cryfs)
|
||||||
|
|
||||||
|
1
vendor/boost/Boost-for-Android
vendored
Submodule
1
vendor/boost/Boost-for-Android
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 0e12fbd30cb70b668a117c0913a303acfdaae04f
|
13
vendor/boost/CMakeLists.txt
vendored
13
vendor/boost/CMakeLists.txt
vendored
@ -1,7 +1,12 @@
|
|||||||
project(libboost)
|
project(libboost)
|
||||||
|
|
||||||
add_library(boost INTERFACE)
|
add_library(boost INTERFACE)
|
||||||
target_include_directories(boost SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_ANDROID_ARCH_ABI}/include/boost-1_76)
|
add_custom_target(
|
||||||
|
vendor_boost
|
||||||
file(GLOB BOOST_STATIC_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_ABI}/lib/libboost_*.a)
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/android-build.sh ${CMAKE_ANDROID_NDK} ${CMAKE_ANDROID_ARCH_ABI}
|
||||||
target_link_libraries(boost INTERFACE ${BOOST_STATIC_LIBS})
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
set(BOOST_OUTPUT "Boost-for-Android/build/out/${CMAKE_ANDROID_ARCH_ABI}")
|
||||||
|
file(GLOB BOOST_STATIC_LIBS ${BOOST_OUTPUT}/lib/libboost_*.a)
|
||||||
|
target_include_directories(boost SYSTEM INTERFACE ${BOOST_OUTPUT}/include/boost-1_76)
|
||||||
|
target_link_libraries(boost INTERFACE vendor_boost ${BOOST_STATIC_LIBS})
|
||||||
|
14
vendor/boost/android-build.sh
vendored
Executable file
14
vendor/boost/android-build.sh
vendored
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
BOOST_TAR=boost_1_76_0.tar.bz2
|
||||||
|
|
||||||
|
cd Boost-for-Android || exit 1
|
||||||
|
|
||||||
|
if [ ! -f $BOOST_TAR ]; then
|
||||||
|
wget -O $BOOST_TAR https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sha256sum -c ../checksum.txt && \
|
||||||
|
./build-android.sh --boost=1.76.0 --arch=$2 --target-version=21 \
|
||||||
|
--with-libraries=atomic,chrono,container,date_time,exception,filesystem,serialization,system,thread \
|
||||||
|
$1
|
1
vendor/boost/checksum.txt
vendored
Normal file
1
vendor/boost/checksum.txt
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41 boost_1_76_0.tar.bz2
|
6
vendor/cryptopp/CMakeLists.txt
vendored
6
vendor/cryptopp/CMakeLists.txt
vendored
@ -18,6 +18,6 @@ set(BUILD_STATIC ON CACHE BOOL "")
|
|||||||
set(USE_INTERMEDIATE_OBJECTS_TARGET OFF CACHE BOOL "")
|
set(USE_INTERMEDIATE_OBJECTS_TARGET OFF CACHE BOOL "")
|
||||||
set(cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING OFF CACHE BOOL "")
|
set(cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING OFF CACHE BOOL "")
|
||||||
|
|
||||||
add_library(vendor_cryptopp STATIC IMPORTED)
|
set(LIBCRYPTOPP_A "${CMAKE_CURRENT_SOURCE_DIR}/vendor_cryptopp/build/${CMAKE_ANDROID_ARCH_ABI}/libcryptopp.a")
|
||||||
set_target_properties(vendor_cryptopp PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/vendor_cryptopp/libcryptopp.a)
|
add_custom_command(OUTPUT ${LIBCRYPTOPP_A} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/android-build.sh ${CMAKE_ANDROID_ARCH_ABI})
|
||||||
target_link_libraries(cryptopp INTERFACE vendor_cryptopp)
|
target_link_libraries(cryptopp INTERFACE ${LIBCRYPTOPP_A})
|
||||||
|
7
vendor/cryptopp/android-build.sh
vendored
Executable file
7
vendor/cryptopp/android-build.sh
vendored
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd vendor_cryptopp && \
|
||||||
|
mkdir -p build/$1 && \
|
||||||
|
TestScripts/setenv-android.sh 21 $1 && \
|
||||||
|
make -f GNUmakefile-cross static && \
|
||||||
|
mv libcryptopp.a build/$1
|
@ -146,16 +146,8 @@ if [ ! -d "${ANDROID_NDK_ROOT}" ]; then
|
|||||||
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
|
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Error checking
|
|
||||||
if [ ! -d "${ANDROID_SDK_ROOT}" ]; then
|
|
||||||
echo "ERROR: ANDROID_SDK_ROOT is not a valid path for ${USER}. Please set it."
|
|
||||||
echo "ANDROID_SDK_ROOT is '${ANDROID_SDK_ROOT}'"
|
|
||||||
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# User feedback
|
# User feedback
|
||||||
#echo "ANDROID_NDK_ROOT is '${ANDROID_NDK_ROOT}'"
|
#echo "ANDROID_NDK_ROOT is '${ANDROID_NDK_ROOT}'"
|
||||||
#echo "ANDROID_SDK_ROOT is '${ANDROID_SDK_ROOT}'"
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
@ -200,10 +192,7 @@ case "$ANDROID_CPU" in
|
|||||||
armv7*|armeabi*)
|
armv7*|armeabi*)
|
||||||
CC="armv7a-linux-androideabi${ANDROID_API}-clang"
|
CC="armv7a-linux-androideabi${ANDROID_API}-clang"
|
||||||
CXX="armv7a-linux-androideabi${ANDROID_API}-clang++"
|
CXX="armv7a-linux-androideabi${ANDROID_API}-clang++"
|
||||||
LD="arm-linux-androideabi-ld"
|
|
||||||
AS="arm-linux-androideabi-as"
|
|
||||||
AR="arm-linux-androideabi-ar"
|
AR="arm-linux-androideabi-ar"
|
||||||
RANLIB="arm-linux-androideabi-ranlib"
|
|
||||||
STRIP="arm-linux-androideabi-strip"
|
STRIP="arm-linux-androideabi-strip"
|
||||||
OBJDUMP="arm-linux-androideabi-objdump"
|
OBJDUMP="arm-linux-androideabi-objdump"
|
||||||
|
|
||||||
@ -226,10 +215,7 @@ case "$ANDROID_CPU" in
|
|||||||
armv8*|aarch64|arm64*)
|
armv8*|aarch64|arm64*)
|
||||||
CC="aarch64-linux-android${ANDROID_API}-clang"
|
CC="aarch64-linux-android${ANDROID_API}-clang"
|
||||||
CXX="aarch64-linux-android${ANDROID_API}-clang++"
|
CXX="aarch64-linux-android${ANDROID_API}-clang++"
|
||||||
LD="aarch64-linux-android-ld"
|
|
||||||
AS="aarch64-linux-android-as"
|
|
||||||
AR="aarch64-linux-android-ar"
|
AR="aarch64-linux-android-ar"
|
||||||
RANLIB="aarch64-linux-android-ranlib"
|
|
||||||
STRIP="aarch64-linux-android-strip"
|
STRIP="aarch64-linux-android-strip"
|
||||||
OBJDUMP="aarch64-linux-android-objdump"
|
OBJDUMP="aarch64-linux-android-objdump"
|
||||||
|
|
||||||
@ -249,10 +235,7 @@ case "$ANDROID_CPU" in
|
|||||||
i686|x86)
|
i686|x86)
|
||||||
CC="i686-linux-android${ANDROID_API}-clang"
|
CC="i686-linux-android${ANDROID_API}-clang"
|
||||||
CXX="i686-linux-android${ANDROID_API}-clang++"
|
CXX="i686-linux-android${ANDROID_API}-clang++"
|
||||||
LD="i686-linux-android-ld"
|
|
||||||
AS="i686-linux-android-as"
|
|
||||||
AR="i686-linux-android-ar"
|
AR="i686-linux-android-ar"
|
||||||
RANLIB="i686-linux-android-ranlib"
|
|
||||||
STRIP="i686-linux-android-strip"
|
STRIP="i686-linux-android-strip"
|
||||||
OBJDUMP="i686-linux-android-objdump"
|
OBJDUMP="i686-linux-android-objdump"
|
||||||
|
|
||||||
@ -274,10 +257,7 @@ case "$ANDROID_CPU" in
|
|||||||
x86_64|x64)
|
x86_64|x64)
|
||||||
CC="x86_64-linux-android${ANDROID_API}-clang"
|
CC="x86_64-linux-android${ANDROID_API}-clang"
|
||||||
CXX="x86_64-linux-android${ANDROID_API}-clang++"
|
CXX="x86_64-linux-android${ANDROID_API}-clang++"
|
||||||
LD="x86_64-linux-android-ld"
|
|
||||||
AS="x86_64-linux-android-as"
|
|
||||||
AR="x86_64-linux-android-ar"
|
AR="x86_64-linux-android-ar"
|
||||||
RANLIB="x86_64-linux-android-ranlib"
|
|
||||||
STRIP="x86_64-linux-android-strip"
|
STRIP="x86_64-linux-android-strip"
|
||||||
OBJDUMP="x86_64-linux-android-objdump"
|
OBJDUMP="x86_64-linux-android-objdump"
|
||||||
|
|
||||||
@ -301,6 +281,10 @@ case "$ANDROID_CPU" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
LD=$CC
|
||||||
|
AS="llvm-as"
|
||||||
|
RANLIB="llvm-ranlib"
|
||||||
|
|
||||||
echo "Configuring for Android API ${ANDROID_API} ($ANDROID_CPU)"
|
echo "Configuring for Android API ${ANDROID_API} ($ANDROID_CPU)"
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
1
vendor/spdlog
vendored
Submodule
1
vendor/spdlog
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit a26e174b367a60a51f0be83a81d6d066330cdd8f
|
Loading…
Reference in New Issue
Block a user