summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-07-10 00:02:35 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-09 15:10:48 -0700
commit9217a03ef3f6bd0e96b6ea4b5ae366c5b3f02379 (patch)
tree3bffcb5ee1ebbacf32a208cb4c821fb4c76e2d34
parente16b1162977ac1bf293f0c39a7a8e679935a5ce9 (diff)
downloadsubsurface-9217a03ef3f6bd0e96b6ea4b5ae366c5b3f02379.tar.gz
Teach android build about subsurface-mobile
This teaches android build.sh and cmake about how to build the qml ui of subsurface-mobile as a apk. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CMakeLists.txt18
-rw-r--r--packaging/android/build.sh15
2 files changed, 25 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d002a014..6e938a3e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -456,7 +456,11 @@ if(SUBSURFACE_MOBILE)
set(MOBILE_SRC qt-mobile/qmlmanager.cpp qt-models/divelistmodel.cpp)
add_definitions(-DSUBSURFACE_MOBILE)
qt5_add_resources(MOBILE_RESOURCES qt-mobile/mobile-resources.qrc)
- add_executable(subsurface-mobile ${MOBILE_SRC} ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
+ if(ANDROID)
+ add_library(subsurface-mobile SHARED ${MOBILE_SRC} ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
+ else()
+ add_executable(subsurface-mobile ${MOBILE_SRC} ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
+ endif()
target_link_libraries(
subsurface-mobile
subsurface_generated_ui
@@ -717,11 +721,15 @@ if(ANDROID)
# Android template directory
set(ANDROID_PACKAGE_SOURCE_DIR, ${CMAKE_BINARY_DIR}/android)
include(${QT_ANDROID_CMAKE})
- add_qt_android_apk(subsurface.apk ${SUBSURFACE_TARGET}
- NAME "Subsurface"
- PACKAGE_NAME "org.subsurfacedivelog"
- PACKAGE_SOURCES ${CMAKE_CURRENT_LIST_DIR}/android
+ if(SUBSURFACE_MOBILE)
+ add_qt_android_apk(subsurface-mobile.apk subsurface-mobile
+ PACKAGE_SOURCES ${CMAKE_CURRENT_LIST_DIR}/android
)
+ else()
+ add_qt_android_apk(subsurface.apk ${SUBSURFACE_TARGET}
+ PACKAGE_SOURCES ${CMAKE_CURRENT_LIST_DIR}/android
+ )
+ endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
diff --git a/packaging/android/build.sh b/packaging/android/build.sh
index c569c74f6..fe03db546 100644
--- a/packaging/android/build.sh
+++ b/packaging/android/build.sh
@@ -168,10 +168,19 @@ else
popd
fi
-mkdir -p subsurface-build-$ARCH
-cd subsurface-build-$ARCH
+# Should we build the mobile ui or the desktop ui?
+if [ ! -z "$SUBSURFACE_MOBILE" ] ; then
+ mkdir -p subsurface-mobile-build-$ARCH
+ cd subsurface-mobile-build-$ARCH
+ MOBILE_CMAKE="-DSUBSURFACE_MOBILE=ON"
+ # FIXME: We should install as a different package and name to.
+else
+ mkdir -p subsurface-build-$ARCH
+ cd subsurface-build-$ARCH
+fi
+
# somehting in the qt-android-cmake-thingies mangles your path, so thats why we need to hard-code ant and pkg-config here.
-cmake -DQT_ANDROID_ANT=/usr/bin/ant -DPKG_CONFIG_EXECUTABLE=/usr/bin/pkg-config -DQT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT -DQT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT -DCMAKE_TOOLCHAIN_FILE=$BUILDROOT/qt-android-cmake/toolchain/android.toolchain.cmake -DQT_ANDROID_CMAKE=$BUILDROOT/qt-android-cmake/AddQtAndroidApk.cmake -DFORCE_LIBSSH=OFF -DLIBDC_FROM_PKGCONFIG=ON -DLIBGIT2_FROM_PKGCONFIG=ON -DUSE_LIBGIT23_API=ON -DNO_MARBLE=ON -DNO_PRINTING=ON -DNO_USERMANUAL=ON -DCMAKE_PREFIX_PATH:UNINITIALIZED=${QT5_ANDROID}/android_${QT_ARCH}/lib/cmake $SUBSURFACE_SOURCE
+cmake $MOBILE_CMAKE -DQT_ANDROID_ANT=/usr/bin/ant -DPKG_CONFIG_EXECUTABLE=/usr/bin/pkg-config -DQT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT -DQT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT -DCMAKE_TOOLCHAIN_FILE=$BUILDROOT/qt-android-cmake/toolchain/android.toolchain.cmake -DQT_ANDROID_CMAKE=$BUILDROOT/qt-android-cmake/AddQtAndroidApk.cmake -DFORCE_LIBSSH=OFF -DLIBDC_FROM_PKGCONFIG=ON -DLIBGIT2_FROM_PKGCONFIG=ON -DUSE_LIBGIT23_API=ON -DNO_MARBLE=ON -DNO_PRINTING=ON -DNO_USERMANUAL=ON -DCMAKE_PREFIX_PATH:UNINITIALIZED=${QT5_ANDROID}/android_${QT_ARCH}/lib/cmake $SUBSURFACE_SOURCE
make
#make install INSTALL_ROOT=android_build
# bug in androiddeployqt? why is it looking for something with the builddir in it?