diff options
-rw-r--r-- | CMakeLists.txt | 77 | ||||
-rw-r--r-- | README.md | 28 | ||||
-rw-r--r-- | android/AndroidManifest.xml | 87 | ||||
-rw-r--r-- | kelakon.pro | 80 |
4 files changed, 190 insertions, 82 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 diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 0000000..58a9d20 --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,87 @@ +<?xml version="1.0"?> +<manifest package="io.saiki.kelakon" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.0.0" android:versionCode="0" android:installLocation="auto"> + <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="24"/> + + <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. + Remove the comment if you do not require these default permissions. --> + <!-- %%INSERT_PERMISSIONS --> + + <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. + Remove the comment if you do not require these default features. --> + <!-- %%INSERT_FEATURES --> + + <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> + + <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="ꦑꦼ ꦭ ꦏꦺꦴ ꦤ꧀" android:extractNativeLibs="true"> + <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="ꦑꦼ ꦭ ꦏꦺꦴ ꦤ꧀" android:screenOrientation="unspecified" android:launchMode="singleTop"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + + <!-- Application arguments --> + <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> + <!-- Application arguments --> + + <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> + <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> + <meta-data android:name="android.app.repository" android:value="default"/> + <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> + <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> + <!-- Deploy Qt libs as part of package --> + <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> + + <!-- Run with local libs --> + <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> + <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> + <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> + <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> + <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> + <!-- Used to specify custom system library path to run with local system libs --> + <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> + <!-- Messages maps --> + <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> + <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> + <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> + <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> + <!-- Messages maps --> + + <!-- Splash screen --> + <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, + then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and + use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you + are done populating your window with content. --> + <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> + <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> + <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> + <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> + <!-- Splash screen --> + + <!-- Background running --> + <!-- Warning: changing this value to true may cause unexpected crashes if the + application still try to draw after + "applicationStateChanged(Qt::ApplicationSuspended)" + signal is sent! --> + <meta-data android:name="android.app.background_running" android:value="false"/> + <!-- Background running --> + + <!-- auto screen scale factor --> + <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> + <!-- auto screen scale factor --> + + <!-- extract android style --> + <!-- available android:values : + * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons + * full - useful QWidget & Quick Controls 1 apps + * minimal - useful for Quick Controls 2 apps, it is much faster than "full" + * none - useful for apps that don't use any of the above Qt modules + --> + <meta-data android:name="android.app.extract_android_style" android:value="default"/> + <!-- extract android style --> + </activity> + + <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices --> + + </application> + +</manifest> diff --git a/kelakon.pro b/kelakon.pro deleted file mode 100644 index 9f3734a..0000000 --- a/kelakon.pro +++ /dev/null @@ -1,80 +0,0 @@ -QT += quick - -HEADERS += controller.hxx - -SOURCES += \ - controller.cxx \ - main.cxx - -RESOURCES += \ - kelakon.qrc \ - larva.qrc \ - larva/material-design-icons.qrc - -LIBS += \ - -lcurl \ - -lrtclient - -!android { - LIBS += -lqrtclient -} - -android { - LIBS += \ - -L/opt/Qt5.14.2/5.14.2/android/lib \ - -lc++ - QT += svg - certs.path = /assets/certs - certs.files = /usr/local/share/certs/ca-root-nss.crt - INSTALLS += certs -} - -contains(ANDROID_TARGET_ARCH,arm64-v8a) { - LIBS += \ - -L/opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/21 \ - -lqrtclient_arm64-v8a - ANDROID_EXTRA_LIBS += \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libcrypto_1_1.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libssl_1_1.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libcurl.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/21/librtclient.so \ - /opt/Qt5.14.2/5.14.2/android/lib/libqrtclient_arm64-v8a.so -} - -contains(ANDROID_TARGET_ARCH,armeabi-v7a) { - LIBS += \ - -L/opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21 \ - -lqrtclient_armeabi-v7a - ANDROID_EXTRA_LIBS += \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21/libcrypto_1_1.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21/libssl_1_1.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21/libcurl.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21/librtclient.so \ - /opt/Qt5.14.2/5.14.2/android/lib/libqrtclient_armeabi-v7a.so -} - -contains(ANDROID_TARGET_ARCH,x86) { - LIBS += \ - -L/opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/21 \ - -lqrtclient_x86 - ANDROID_EXTRA_LIBS += \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/21/libcrypto_1_1.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/21/libssl_1_1.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/21/libcurl.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/21/librtclient.so \ - /opt/Qt5.14.2/5.14.2/android/lib/libqrtclient_x86.so -} - -contains(ANDROID_TARGET_ARCH,x86_64) { - LIBS += \ - -L/opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/21 \ - -lqrtclient_x86_64 - ANDROID_EXTRA_LIBS += \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/21/libcrypto_1_1.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/21/libssl_1_1.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/21/libcurl.so \ - /opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/21/librtclient.so \ - /opt/Qt5.14.2/5.14.2/android/lib/libqrtclient_x86_64.so -} - -debug: DEFINES += DEBUG |