Commit 96d7218b authored by Johnny Jazeix's avatar Johnny Jazeix
Browse files

use default androiddeployqt for android compilation

parent 57ed89d9
......@@ -3,49 +3,45 @@
file(GLOB SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*/*/*/*")
find_program(ANDROID_LOCATION NAMES android android.bat)
find_program(ANT_LOCATION NAMES ant)
find_program(ANDROID_DEPLOY_QT NAMES androiddeployqt PATHS ${_qt5Core_install_prefix}/bin/ )
# Look for ant and android programs
if (NOT ANT_LOCATION)
message(FATAL_ERROR "Could not find ant. Please install ant and add it to the search path.")
endif(NOT ANT_LOCATION)
if (NOT ANDROID_LOCATION)
message(FATAL_ERROR "Could not find 'Android SDK and AVD Manager'. Please install the android sdk and add the <android-sdk>/tools directory to the search path.")
endif(NOT ANDROID_LOCATION)
# Look for androiddeployqt program
if (NOT ANDROID_DEPLOY_QT)
message(FATAL_ERROR "Could not find androiddeployqt. Make sure you set all the Qt5_* paths to the Qt for android compiled version.")
endif(NOT ANDROID_DEPLOY_QT)
# Set version
set(ANDROID_VERSION_NAME ${GCOMPRIS_VERSION})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake ${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml @ONLY)
### androiddeployqt modified version
# Find qmake version 5
if (NOT DEFINED ENV{Qt5_HOST_DIR})
message(FATAL_ERROR "Configure the env variable Qt5_HOST_DIR to point to your host Qt5 installation (like ~/Qt5.3.0/5.3/gcc_64)")
endif()
find_program(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{Qt5_HOST_DIR}/bin NO_DEFAULT_PATH)
# set android package source for androiddeployqt json file
set(PACKAGE_SOURCE_ANDROID ${CMAKE_BINARY_DIR}/tmpAndroid)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake ${PACKAGE_SOURCE_ANDROID}/AndroidManifest.xml @ONLY)
# create json file parsed by the androiddeployqt
set(ANDROID_SDK $ENV{ANDROID_SDK})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configAndroid.json.cmake ${CMAKE_CURRENT_BINARY_DIR}/configAndroid.json @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configAndroid.json.cmake ${PACKAGE_SOURCE_ANDROID}/configAndroid.json @ONLY)
add_custom_command (
OUTPUT createApkFromAndroidDeployQtDebug
DEPENDS ${PACKAGE_SOURCE_ANDROID}/AndroidManifest.xml
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${PACKAGE_SOURCE_ANDROID}
COMMAND ${ANDROID_DEPLOY_QT} --output ${CMAKE_CURRENT_BINARY_DIR}/ --input ${PACKAGE_SOURCE_ANDROID}/configAndroid.json --debug
COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/bin/QtApp-debug.apk ${CMAKE_CURRENT_BINARY_DIR}/bin/GCompris-debug.apk
)
add_custom_command (
OUTPUT createApkFromAndroidDeployQt
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${QT_QMAKE_EXECUTABLE} && make && ./androiddeployqt --output ${CMAKE_CURRENT_BINARY_DIR}/ --input ${CMAKE_CURRENT_BINARY_DIR}/configAndroid.json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tools/copyQtAndroidData
OUTPUT createApkFromAndroidDeployQtRelease
DEPENDS ${PACKAGE_SOURCE_ANDROID}/AndroidManifest.xml
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${PACKAGE_SOURCE_ANDROID}
COMMAND ${ANDROID_DEPLOY_QT} --output ${CMAKE_CURRENT_BINARY_DIR}/ --input ${PACKAGE_SOURCE_ANDROID}/configAndroid.json --release
)
# Command to create apk from Makefile
add_custom_target ( apk_debug
COMMAND ${ANT_LOCATION} debug
DEPENDS createApkFromAndroidDeployQt
add_custom_target (apk_debug
DEPENDS createApkFromAndroidDeployQtDebug
)
# Command to create apk from Makefile
add_custom_target ( apk_release
COMMAND ${ANT_LOCATION} release
DEPENDS createApkFromAndroidDeployQt
add_custom_target (apk_release
DEPENDS createApkFromAndroidDeployQtRelease
)
......@@ -9,5 +9,6 @@
"ndk-host": "@ANDROID_NDK_HOST_SYSTEM_NAME@",
"target-architecture": "@ARM_TARGET@",
"application-binary": "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@libGCompris.so",
"android-package-source-directory": "@PACKAGE_SOURCE_ANDROID@/",
"android-package": "net.gcompris"
}
\ No newline at end of file
Makefile
androiddeployqt
main.o
#***************************************************************************
#
# Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
# Contact: http://www.qt-project.org/legal
#
# This file is part of the tools applications of the Qt Toolkit.
#
# $QT_BEGIN_LICENSE:LGPL$
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the commercial license agreement provided with the
# Software or, alternatively, in accordance with the terms contained in
# a written agreement between you and Digia. For licensing terms and
# conditions see http://qt.digia.com/licensing. For further information
# use the contact form at http://qt.digia.com/contact-us.
#
# GNU Lesser General Public License Usage
# Alternatively, this file may be used under the terms of the GNU Lesser
# General Public License version 2.1 as published by the Free Software
# Foundation and appearing in the file LICENSE.LGPL included in the
# packaging of this file. Please review the following information to
# ensure the GNU Lesser General Public License version 2.1 requirements
# will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
#
# In addition, as a special exception, Digia gives you certain additional
# rights. These rights are described in the Digia Qt LGPL Exception
# version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
#
# GNU General Public License Usage
# Alternatively, this file may be used under the terms of the GNU
# General Public License version 3.0 as published by the Free Software
# Foundation and appearing in the file LICENSE.GPL included in the
# packaging of this file. Please review the following information to
# ensure the GNU General Public License version 3.0 requirements will be
# met: http://www.gnu.org/copyleft/gpl.html.
#
#
# $QT_END_LICENSE$
#
#***************************************************************************
CONFIG += console
CONFIG -= gui
SOURCES += \
main.cpp
# Required for declarations of popen/pclose on Windows
windows: QMAKE_CXXFLAGS += -U__STRICT_ANSI__
This diff is collapsed.
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