diff options
-rw-r--r-- | CMakeLists.txt | 77 | ||||
-rw-r--r-- | README.md | 30 |
2 files changed, 104 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..247144d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,77 @@ +cmake_minimum_required(VERSION 3.5) + +project(kelakon) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +find_package(Qt5 COMPONENTS Core Quick REQUIRED) + +if (ANDROID) + set(ANDROID_BUILD_ABI_${ANDROID_ABI} 1) + add_library(${PROJECT_NAME} SHARED + controller.hxx + controller.cxx + main.cxx + kelakon.qrc + larva.qrc + larva/material-design-icons.qrc + ) + target_link_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_SYSROOT}/usr/lib/${ANDROID_TOOLCHAIN_NAME}/${ANDROID_NATIVE_API_LEVEL} + /opt/Qt5.14.2/5.14.2/android/lib) + target_link_libraries(${PROJECT_NAME} qrtclient_${ANDROID_ABI}) + set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") + if (ANDROID_ABI STREQUAL "arm64-v8a") + set(ANDROID_EXTRA_LIBS + ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-android/${ANDROID_NATIVE_API_LEVEL}/libcrypto_1_1.so + ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-android/${ANDROID_NATIVE_API_LEVEL}/libssl_1_1.so + ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-android/${ANDROID_NATIVE_API_LEVEL}/libcurl.so + ${CMAKE_SYSROOT}/usr/lib/aarch64-linux-android/${ANDROID_NATIVE_API_LEVEL}/librtclient.so + /opt/Qt5.14.2/5.14.2/android/lib/libqrtclient_${ANDROID_ABI}.so + CACHE INTERNAL "") + elseif (ANDROID_ABI STREQUAL "armeabi-v7a") + set(ANDROID_EXTRA_LIBS + ${CMAKE_SYSROOT}/usr/lib/arm-linux-androideabi/${ANDROID_NATIVE_API_LEVEL}/libcrypto_1_1.so + ${CMAKE_SYSROOT}/usr/lib/arm-linux-androideabi/${ANDROID_NATIVE_API_LEVEL}/libssl_1_1.so + ${CMAKE_SYSROOT}/usr/lib/arm-linux-androideabi/${ANDROID_NATIVE_API_LEVEL}/libcurl.so + ${CMAKE_SYSROOT}/usr/lib/arm-linux-androideabi/${ANDROID_NATIVE_API_LEVEL}/librtclient.so + /opt/Qt5.14.2/5.14.2/android/lib/libqrtclient_${ANDROID_ABI}.so + CACHE INTERNAL "") + elseif (ANDROID_ABI STREQUAL "x86") + set(ANDROID_EXTRA_LIBS + ${CMAKE_SYSROOT}/usr/lib/i686-linux-android/${ANDROID_NATIVE_API_LEVEL}/libcrypto_1_1.so + ${CMAKE_SYSROOT}/usr/lib/i686-linux-android/${ANDROID_NATIVE_API_LEVEL}/libssl_1_1.so + ${CMAKE_SYSROOT}/usr/lib/i686-linux-android/${ANDROID_NATIVE_API_LEVEL}/libcurl.so + ${CMAKE_SYSROOT}/usr/lib/i686-linux-android/${ANDROID_NATIVE_API_LEVEL}/librtclient.so + /opt/Qt5.14.2/5.14.2/android/lib/libqrtclient_${ANDROID_ABI}.so + CACHE INTERNAL "") + elseif (ANDROID_ABI STREQUAL "x86_64") + set(ANDROID_EXTRA_LIBS + ${CMAKE_SYSROOT}/usr/lib/x86_64-linux-android/${ANDROID_NATIVE_API_LEVEL}/libcrypto_1_1.so + ${CMAKE_SYSROOT}/usr/lib/x86_64-linux-android/${ANDROID_NATIVE_API_LEVEL}/libssl_1_1.so + ${CMAKE_SYSROOT}/usr/lib/x86_64-linux-android/${ANDROID_NATIVE_API_LEVEL}/libcurl.so + ${CMAKE_SYSROOT}/usr/lib/x86_64-linux-android/${ANDROID_NATIVE_API_LEVEL}/librtclient.so + /opt/Qt5.14.2/5.14.2/android/lib/libqrtclient_${ANDROID_ABI}.so + CACHE INTERNAL "") + endif() +else() + add_executable(${PROJECT_NAME} + controller.cxx + main.cxx + kelakon.qrc + larva.qrc + larva/material-design-icons.qrc + ) + target_link_libraries(${PROJECT_NAME} qrtclient) +endif() + +target_link_libraries(${PROJECT_NAME} + curl + Qt5::Core + Qt5::Quick + rtclient + ) + +target_compile_definitions(${PROJECT_NAME} + PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) @@ -13,7 +13,7 @@ $ git clone git://darapsa.org/kelakon.git ```sh $ mkdir build-kelakon-Desktop-Debug $ cd build-kelakon-Desktop-Debug -$ qmake ../kelakon/kelakon.pro -spec linux-g++ CONFIG+='debug qml_debug' +$ cmake -DCMAKE_BUILD_TYPE=Debug ../kelakon ``` or @@ -21,8 +21,32 @@ or ```sh $ mkdir build-kelakon-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_14_2_for_Android-Debug $ cd build-kelakon-Android_for_armeabi_v7a_arm64_v8a_x86_x86_64_Clang_Qt_5_14_2_for_Android-Debug -$ /opt/Qt5.14.2/5.14.2/android/bin/qmake ../kelakon/kelakon.pro -spec android-clang CONFIG+='debug qml_debug' ANDROID_ABIS="armeabi-v7a arm64-v8a x86 x86_64" ``` + +and then for any of these, do it twice (because of some bug that 3rd party libraries wouldn't get included) + +```sh +$ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk-r19c/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/opt/Qt5.14.2/5.14.2/android -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_ABI=arm64-v8a -DANDROID_SDK=/opt/android-sdk-update-manager -DCMAKE_PREFIX_PATH=/opt/Qt5.14.2/5.14.2/android -DCMAKE_BUILD_TYPE=Debug ../kelakon +``` + +or + +```sh +$ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk-r19c/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/opt/Qt5.14.2/5.14.2/android -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_ABI=armeabi-v7a -DANDROID_SDK=/opt/android-sdk-update-manager -DCMAKE_PREFIX_PATH=/opt/Qt5.14.2/5.14.2/android -DCMAKE_BUILD_TYPE=Debug ../kelakon +``` + +or + +```sh +$ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk-r19c/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/opt/Qt5.14.2/5.14.2/android -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_ABI=x86 -DANDROID_SDK=/opt/android-sdk-update-manager -DCMAKE_PREFIX_PATH=/opt/Qt5.14.2/5.14.2/android -DCMAKE_BUILD_TYPE=Debug ../kelakon +``` + +or + +```sh +$ cmake -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk-r19c/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/opt/Qt5.14.2/5.14.2/android -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_ABI=x86_64 -DANDROID_SDK=/opt/android-sdk-update-manager -DCMAKE_PREFIX_PATH=/opt/Qt5.14.2/5.14.2/android -DCMAKE_BUILD_TYPE=Debug ../kelakon +``` + or so on. ## Compiling, linking, and producing executable @@ -30,5 +54,5 @@ or so on. ```sh $ make # -jN (with N an integer number of parallel tasks you allow your computer to run for compiling this) $ make install INSTALL_ROOT=android-build -$ /opt/Qt5.14.2/5.14.2/android/bin/androiddeployqt --input android-kelakon-deployment-settings.json --output android-build --android-platform android-24 +$ /opt/Qt5.14.2/5.14.2/android/bin/androiddeployqt --input android_deployment_settings.json --output android-build --android-platform android-24 ``` |