Commit 8ac96884 authored by Ayush Shah's avatar Ayush Shah

Revert "test2"

This reverts commit 08862447.
parent 08862447
......@@ -13,11 +13,6 @@ set(ECM_MIN_VERSION "5.15.0")
set(QT_MIN_VERSION "5.4.0")
set(KF5_MIN_VERSION "5.15.0")
if(CMAKE_SYSTEM_NAME STREQUAL Android)
add_definitions(-DANDROID )
set(ANDROID TRUE)
endif()
find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
......@@ -25,67 +20,62 @@ include(ECMSetupVersion)
include(ECMInstallIcons)
include(KDEInstallDirs)
include(KDECMakeSettings)
if(NOT ANDROID)
#We get error "could not find main method" with this module
include(KDECompilerSettings NO_POLICY_SCOPE)
endif()
include(KDECompilerSettings NO_POLICY_SCOPE)
include(FeatureSummary)
if(NOT ANDROID)
ecm_setup_version(${KDE_APPLICATIONS_VERSION} VARIABLE_PREFIX MINUET
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/src/minuet_version.h"
)
ecm_setup_version(${KDE_APPLICATIONS_VERSION} VARIABLE_PREFIX MINUET
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/src/minuet_version.h"
)
endif()
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets Qml Quick)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets Quick)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
I18n
XmlGui
KIO
Crash
DocTools
)
if(NOT ANDROID)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS XmlGui KIO Crash DocTools)
find_package(PkgConfig REQUIRED)
if(PKG_CONFIG_FOUND)
message(STATUS "Program pkg-config found (${PKG_CONFIG_EXECUTABLE})")
else()
find_package(PkgConfig REQUIRED)
if(PKG_CONFIG_FOUND)
message(STATUS "Program pkg-config found (${PKG_CONFIG_EXECUTABLE})")
else()
message(FATAL_ERROR "Program pkg-config not found")
endif()
endif()
pkg_check_modules(ALSA REQUIRED alsa>=1.0.0)
if(ALSA_FOUND)
link_directories(${ALSA_LIBDIR})
include_directories(${ALSA_INCLUDEDIR})
#link_libraries(${ALSA_LIBRARIES})
else()
message(FATAL_ERROR "Please install ALSA library and headers (libasound2)")
endif()
pkg_check_modules(ALSA REQUIRED alsa>=1.0.0)
if(ALSA_FOUND)
link_directories(${ALSA_LIBDIR})
include_directories(${ALSA_INCLUDEDIR})
#link_libraries(${ALSA_LIBRARIES})
else()
message(FATAL_ERROR "Please install ALSA library and headers (libasound2)")
endif()
pkg_check_modules(DRUMSTICK_ALSA REQUIRED drumstick-alsa>=1.0.1)
if(DRUMSTICK_ALSA_FOUND)
link_directories(${DRUMSTICK_ALSA_LIBDIR})
include_directories(${DRUMSTICK_ALSA_INCLUDEDIR})
#link_libraries(${DRUMSTICK_ALSA_LIBRARIES})
else()
message(FATAL_ERROR "Please install drumstick libraries and headers (package drumstick-devel)")
endif()
pkg_check_modules(DRUMSTICK_ALSA REQUIRED drumstick-alsa>=1.0.1)
if(DRUMSTICK_ALSA_FOUND)
link_directories(${DRUMSTICK_ALSA_LIBDIR})
include_directories(${DRUMSTICK_ALSA_INCLUDEDIR})
#link_libraries(${DRUMSTICK_ALSA_LIBRARIES})
else()
message(FATAL_ERROR "Please install drumstick libraries and headers (package drumstick-devel)")
endif()
pkg_check_modules(DRUMSTICK_FILE REQUIRED drumstick-file>=1.0.1)
if(DRUMSTICK_FILE_FOUND)
link_directories(${DRUMSTICK_FILE_LIBDIR})
include_directories(${DRUMSTICK_FILE_INCLUDEDIR})
#link_libraries(${DRUMSTICK_FILE_LIBRARIES})
else()
message(FATAL_ERROR "Please install drumstick libraries and headers (package drumstick-devel)")
endif()
add_subdirectory(doc)
add_subdirectory(src)
add_subdirectory(icons)
add_subdirectory(exercises)
pkg_check_modules(DRUMSTICK_FILE REQUIRED drumstick-file>=1.0.1)
if(DRUMSTICK_FILE_FOUND)
link_directories(${DRUMSTICK_FILE_LIBDIR})
include_directories(${DRUMSTICK_FILE_INCLUDEDIR})
#link_libraries(${DRUMSTICK_FILE_LIBRARIES})
else()
add_subdirectory(minuetandroid)
message(FATAL_ERROR "Please install drumstick libraries and headers (package drumstick-devel)")
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
add_subdirectory(doc)
add_subdirectory(src)
add_subdirectory(icons)
add_subdirectory(exercises)
install(FILES org.kde.minuet.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata/)
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export ANT=/usr/bin/ant
export Qt5_android=/home/ayush/Qt5.5.1/5.5/android_armv7
export ANDROID_SDK_ROOT=/home/ayush/android/android-sdk-linux/
export PATH=$ANDROID_SDK_ROOT/platform-tools/:$PATH
export ANDROID_NDK=/home/ayush/android/android-ndk-r11/
export minuetandroid_DIR=`pwd`
mkdir -p export
cd export/
export minuetandroid_PRODUCT_DIR=`pwd`
#mkdir -p ../../build/minuetandroid
#cd ../../build/minuetandroid
cmake "${minuetandroid_DIR}" -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${Qt5_android}" \
-DCMAKE_INSTALL_PREFIX="${minuetandroid_PRODUCT_DIR}" \
-DQTANDROID_EXPORTED_TARGET=minuetandroid \
-DANDROID_APK_DIR="${minuetandroid_DIR}"/minuetandroid/data \
-DKF5I18n_DIR=/opt/android/kde/install/lib/cmake/KF5I18n/
# -DKF5Config_DIR=/opt/android/kde/install/lib/cmake/KF5Config/ \
# -DKF5_HOST_TOOLING=/opt/android/kde/install/lib/cmake/KF5Config/
make install/strip
#mkdir "${minuetandroid_PRODUCT_DIR}"/share
mkdir -p "${minuetandroid_PRODUCT_DIR}"/lib/qml
make create-apk-minuetandroid
adb install -r minuetandroid_build_apk/bin/QtApp-debug.apk
#cmake_minimum_required(VERSION 3.3.2 FATAL_ERROR)#Currently I am using this version
project(minuetandroid)
#requirements
#find_package(ECM 1.7.0 REQUIRED NO_MODULE)
#set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
#set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
#find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED NO_MODULE COMPONENTS Qml Quick)
#find_package(KF5 REQUIRED COMPONENTS
# Config
# WidgetsAddons
# NewStuff
# I18n
# XmlGui
# KIO
# Crash
# DocTools
#)
#feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
add_subdirectory(src)
Hello KWorld
============
Small example "Hello world" app for creating a Qt-based app with CMake and ECM for Android.
Prerequisites
-------------
Setup of Android development environment, see https://community.kde.org/Android/Environment
ECM >= 5.17.0 installed
Instructions
------------
Prepare build dir and product dir, starting from toplevel dir of this project:
export minuetandroid_DIR=`pwd`
mkdir -p ../export/minuetandroid
cd ../export/minuetandroid
export minuetandroid_PRODUCT_DIR=`pwd`
mkdir -p ../../build/minuetandroid
cd ../../build/minuetandroid
Configure the build:
cmake -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${Qt5_android}" \
-DCMAKE_INSTALL_PREFIX="${minuetandroid_PRODUCT_DIR}" \
-DQTANDROID_EXPORTED_TARGET=minuetandroid \
-DANDROID_APK_DIR="${minuetandroid_DIR}"/data \
"${minuetandroid_DIR}"
CMAKE_TOOLCHAIN_FILE: see http://api.kde.org/ecm/toolchain/Android.html
CMAKE_INSTALL_PREFIX: needs to be absolute path currently
QTANDROID_EXPORTED_TARGET & ANDROID_APK_DIR: see http://api.kde.org/ecm/toolchain/Android.html, "Deploying Qt Applications"
Build and install the result in the product dir:
make install/strip
"install/strip" makes sure the binaries only have minimal stuff needed to run.
Workaround for ECM < 5.22:
ECM/toolchain/Android.cmake expects some dirs to exist. so manually create them now:
# mkdir "${minuetandroid_PRODUCT_DIR}"/share
mkdir -p "${minuetandroid_PRODUCT_DIR}"/lib/qml
Create the APK finally:
make create-apk-minuetandroid
Deploy it, e.g. via android debugger:
adb install -r minuetandroid_build_apk/bin/QtApp-debug.apk
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.0.3" package="org.kde.minuetandroid" android:installLocation="auto" android:versionCode="7">
<application android:name="org.qtproject.qt5.android.bindings.QtApplication"
android:label="Minuet Mobile"
android:icon="@drawable/minuet">
<activity android:name="org.qtproject.qt5.android.bindings.QtActivity"
android:label="Minuet Mobile"
android:screenOrientation="unspecified"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<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%% --"/>
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<!-- 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" android:value="-- %%INSERT_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%% --"/>
<!-- Messages maps -->
<meta-data android:name="android.app.ministro_not_found_msg" android:value="@string/ministro_not_found_msg"/>
<meta-data android:name="android.app.ministro_needed_msg" android:value="@string/ministro_needed_msg"/>
<meta-data android:name="android.app.fatal_error_msg" android:value="@string/fatal_error_msg"/>
</activity>
</application>
<supports-screens android:anyDensity="true" android:normalScreens="true" android:smallScreens="true" android:largeScreens="true"/>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19"/>
</manifest>
set(minuetandroid_SRCS
main.cpp
)
qt5_add_resources(minuetandroid_SRCS resources.qrc)
add_executable(minuetandroid ${minuetandroid_SRCS})
target_link_libraries (
minuetandroid
Qt5::Gui
Qt5::Qml
)
if (CMAKE_SYSTEM_NAME STREQUAL Android)
target_link_libraries (
minuetandroid
Qt5::Quick
KF5::I18n
)
endif()
install(TARGETS minuetandroid RUNTIME DESTINATION bin)
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
import QtQuick 2.3
import QtQuick.Controls 1.2
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello KWorld")
Label {
text: qsTr("Hello KWorld")
anchors.centerIn: parent
}
}
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Minuet
Name[ast]=Minuet
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment