CMakeLists.txt (9069B)
1 # For more information about using CMake with Android Studio, read the 2 # documentation: https://d.android.com/studio/projects/add-native-code.html. 3 # For more examples on how to use CMake, see https://github.com/android/ndk-samples. 4 5 # Sets the minimum CMake version required for this project. 6 cmake_minimum_required(VERSION 3.22.1) 7 8 # Declares the project name. The project name can be accessed via ${ PROJECT_NAME}, 9 # Since this is the top level CMakeLists.txt, the project name is also accessible 10 # with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level 11 # build script scope). 12 project("gnunet") 13 14 # configure import libs 15 set(distribution_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../distribution) 16 17 add_library(idn SHARED IMPORTED) 18 set_target_properties(idn PROPERTIES IMPORTED_LOCATION 19 ${distribution_DIR}/idn/lib/${ANDROID_ABI}/libidn.so) 20 add_library(sqliteX SHARED IMPORTED) 21 set_target_properties(sqliteX PROPERTIES IMPORTED_LOCATION 22 ${distribution_DIR}/sqlite/lib/${ANDROID_ABI}/libsqliteX.so) 23 add_library(gnunetutil SHARED IMPORTED) 24 set_target_properties(gnunetutil PROPERTIES IMPORTED_LOCATION 25 ${distribution_DIR}/gnunetutil/lib/${ANDROID_ABI}/libgnunetutil.so) 26 add_library(gnunetsq SHARED IMPORTED) 27 set_target_properties(gnunetsq PROPERTIES IMPORTED_LOCATION 28 ${distribution_DIR}/gnunetsq/lib/${ANDROID_ABI}/libgnunetsq.so) 29 add_library(gnunetjson SHARED IMPORTED) 30 set_target_properties(gnunetjson PROPERTIES IMPORTED_LOCATION 31 ${distribution_DIR}/gnunetjson/lib/${ANDROID_ABI}/libgnunetjson.so) 32 add_library(gnunetgnsrecord SHARED IMPORTED) 33 set_target_properties(gnunetgnsrecord PROPERTIES IMPORTED_LOCATION 34 ${distribution_DIR}/gnunetgnsrecord/lib/${ANDROID_ABI}/libgnunetgnsrecord.so) 35 add_library(gnunetblock SHARED IMPORTED) 36 set_target_properties(gnunetblock PROPERTIES IMPORTED_LOCATION 37 ${distribution_DIR}/gnunetblock/lib/${ANDROID_ABI}/libgnunetblock.so) 38 add_library(gnunetregexblock SHARED IMPORTED) 39 set_target_properties(gnunetregexblock PROPERTIES IMPORTED_LOCATION 40 ${distribution_DIR}/gnunetregexblock/lib/${ANDROID_ABI}/libgnunetregexblock.so) 41 add_library(gnunetblockgroup SHARED IMPORTED) 42 set_target_properties(gnunetblockgroup PROPERTIES IMPORTED_LOCATION 43 ${distribution_DIR}/gnunetblockgroup/lib/${ANDROID_ABI}/libgnunetblockgroup.so) 44 add_library(gnunethello SHARED IMPORTED) 45 set_target_properties(gnunethello PROPERTIES IMPORTED_LOCATION 46 ${distribution_DIR}/gnunethello/lib/${ANDROID_ABI}/libgnunethello.so) 47 #[[add_library(gnunet_plugin_peerstore_sqlite SHARED IMPORTED) 48 set_target_properties(gnunet_plugin_peerstore_sqlite PROPERTIES IMPORTED_LOCATION 49 ${distribution_DIR}/gnunet_plugin_peerstore_sqlite/lib/${ANDROID_ABI}/libgnunet_plugin_peerstore_sqlite.so)]] 50 add_library(gnunet SHARED IMPORTED) 51 set_target_properties(gnunet PROPERTIES IMPORTED_LOCATION 52 ${distribution_DIR}/gnunet/lib/${ANDROID_ABI}/libgnunet.so) 53 add_library(gnunetchat SHARED IMPORTED) 54 set_target_properties(gnunetchat PROPERTIES IMPORTED_LOCATION 55 ${distribution_DIR}/gnunetchat/lib/${ANDROID_ABI}/libgnunetchat.so) 56 add_library(libgpg-error SHARED IMPORTED) 57 set_target_properties(libgpg-error PROPERTIES IMPORTED_LOCATION 58 ${distribution_DIR}/libgpg-error/lib/${ANDROID_ABI}/libgpg-error.so) 59 add_library(libgcrypt SHARED IMPORTED) 60 set_target_properties(libgcrypt PROPERTIES IMPORTED_LOCATION 61 ${distribution_DIR}/libgcrypt/lib/${ANDROID_ABI}/libgcrypt.so) 62 add_library(libsodium SHARED IMPORTED) 63 set_target_properties(libsodium PROPERTIES IMPORTED_LOCATION 64 ${distribution_DIR}/libsodium/lib/${ANDROID_ABI}/libsodium.so) 65 add_library(libtool SHARED IMPORTED) 66 set_target_properties(libtool PROPERTIES IMPORTED_LOCATION 67 ${distribution_DIR}/libtool/lib/${ANDROID_ABI}/libltdl.so) 68 add_library(gmp SHARED IMPORTED) 69 set_target_properties(gmp PROPERTIES IMPORTED_LOCATION 70 ${distribution_DIR}/gmp/lib/${ANDROID_ABI}/libgmp.so) 71 add_library(libunistring SHARED IMPORTED) 72 set_target_properties(libunistring PROPERTIES IMPORTED_LOCATION 73 ${distribution_DIR}/libunistring/lib/${ANDROID_ABI}/libunistring.so) 74 add_library(libz SHARED IMPORTED) 75 set_target_properties(libz PROPERTIES IMPORTED_LOCATION 76 ${distribution_DIR}/libz/lib/${ANDROID_ABI}/libz.so) 77 add_library(libiconv SHARED IMPORTED) 78 set_target_properties(libiconv PROPERTIES IMPORTED_LOCATION 79 ${distribution_DIR}/libiconv/lib/${ANDROID_ABI}/libiconv.so) 80 add_library(libintl SHARED IMPORTED) 81 set_target_properties(libintl PROPERTIES IMPORTED_LOCATION 82 ${distribution_DIR}/libintl/lib/${ANDROID_ABI}/libintl.so) 83 add_library(libgettext SHARED IMPORTED) 84 set_target_properties(libgettext PROPERTIES IMPORTED_LOCATION 85 ${distribution_DIR}/gettext/lib/${ANDROID_ABI}/libgettextlib-0.22.5.so) 86 add_library(jansson SHARED IMPORTED) 87 set_target_properties(jansson PROPERTIES IMPORTED_LOCATION 88 ${distribution_DIR}/jansson/lib/${ANDROID_ABI}/libjansson.so) 89 add_library(wolfssl SHARED IMPORTED) 90 set_target_properties(wolfssl PROPERTIES IMPORTED_LOCATION 91 ${distribution_DIR}/wolfssl/lib/${ANDROID_ABI}/libwolfssl.so) 92 add_library(libcurl SHARED IMPORTED) 93 set_target_properties(libcurl PROPERTIES IMPORTED_LOCATION 94 ${distribution_DIR}/libcurl/lib/${ANDROID_ABI}/libcurl.so) 95 add_library(microhttpd SHARED IMPORTED) 96 set_target_properties(microhttpd PROPERTIES IMPORTED_LOCATION 97 ${distribution_DIR}/microhttpd/lib/${ANDROID_ABI}/libmicrohttpd.so) 98 99 # build application's shared lib 100 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 101 102 # Creates and names a library, sets it as either STATIC 103 # or SHARED, and provides the relative paths to its source code. 104 # You can define multiple libraries, and CMake builds them for you. 105 # Gradle automatically packages shared libraries with your APK. 106 # 107 # In this top level CMakeLists.txt, ${CMAKE_PROJECT_NAME} is used to define 108 # the target library name; in the sub-module's CMakeLists.txt, ${PROJECT_NAME} 109 # is preferred for the same purpose. 110 # 111 # In order to load a library into your app from Java/Kotlin, you must call 112 # System.loadLibrary() and pass the name of the library defined here; 113 # for GameActivity/NativeActivity derived applications, the same library name must be 114 # used in the AndroidManifest.xml file. 115 add_library(gnunetti SHARED 116 # List C/C++ source files with relative paths to this CMakeLists.txt. 117 native-lib.cpp 118 GnunetChatIpcBridge.cpp 119 ) 120 121 target_include_directories(gnunetti PRIVATE 122 ${distribution_DIR}/idn/lib/${ANDROID_ABI}/include 123 ${distribution_DIR}/sqlite/lib/${ANDROID_ABI}/include 124 ${distribution_DIR}/libsodium/lib/${ANDROID_ABI}/include 125 ${distribution_DIR}/libgcrypt/lib/${ANDROID_ABI}/include 126 ${distribution_DIR}/libgpg-error/lib/${ANDROID_ABI}/include 127 ${distribution_DIR}/gmp/lib/${ANDROID_ABI}/include 128 ${distribution_DIR}/libunistring/lib/${ANDROID_ABI}/include 129 ${distribution_DIR}/libz/lib/${ANDROID_ABI}/include 130 ${distribution_DIR}/libtool/lib/${ANDROID_ABI}/include 131 ${distribution_DIR}/libiconv/lib/${ANDROID_ABI}/include 132 ${distribution_DIR}/libintl/lib/${ANDROID_ABI}/include 133 ${distribution_DIR}/gettext/lib/${ANDROID_ABI}/include 134 ${distribution_DIR}/gnunetutil/lib/${ANDROID_ABI}/include 135 ${distribution_DIR}/gnunet/lib/${ANDROID_ABI}/include 136 ${distribution_DIR}/gnunethello/lib/${ANDROID_ABI}/include 137 ${distribution_DIR}/gnunet_plugin_peerstore_sqlite/lib/${ANDROID_ABI}/include 138 ${distribution_DIR}/gnunetsq/lib/${ANDROID_ABI}/include 139 ${distribution_DIR}/gnunetgnsrecord/lib/${ANDROID_ABI}/include 140 ${distribution_DIR}/gnunetblock/lib/${ANDROID_ABI}/include 141 ${distribution_DIR}/gnunetregexblock/lib/${ANDROID_ABI}/include 142 ${distribution_DIR}/gnunetblockgroup/lib/${ANDROID_ABI}/include 143 ${distribution_DIR}/gnunetchat/lib/${ANDROID_ABI}/include 144 ${distribution_DIR}/wolfssl/lib/${ANDROID_ABI}/include 145 ${distribution_DIR}/libcurl/lib/${ANDROID_ABI}/include 146 ${distribution_DIR}/jansson/lib/${ANDROID_ABI}/include 147 ${distribution_DIR}/microhttpd/lib/${ANDROID_ABI}/include) 148 149 # Specifies libraries CMake should link to your target library. You 150 # can link libraries from various origins, such as libraries defined in this 151 # build script, prebuilt third-party libraries, or Android system libraries. 152 target_link_libraries(gnunetti 153 # List libraries link to the target library 154 android 155 libgpg-error 156 libgcrypt 157 libsodium 158 libtool 159 idn 160 gmp 161 libunistring 162 libz 163 libiconv 164 libintl 165 libgettext 166 wolfssl 167 libcurl 168 jansson 169 microhttpd 170 gnunetsq 171 gnunetregexblock 172 gnunetblock 173 gnunetblockgroup 174 gnunetgnsrecord 175 gnunetjson 176 gnunethello 177 gnunetutil 178 gnunet 179 gnunetchat 180 sqliteX 181 log) 182 183 target_link_options(gnunetti PRIVATE "-Wl,-z,max-page-size=16384")