summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-07-01 17:08:36 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-01 09:00:48 -0700
commitd880040d0a487a8da104a44d574db5c947a734f3 (patch)
treeb177fa66dd26c0f81612b6e19783a418ff19b765
parentc3f6fcb0bfd4e66f77dbc9daee442fbd5dc7e003 (diff)
downloadsubsurface-d880040d0a487a8da104a44d574db5c947a734f3.tar.gz
Introduce CMake support for building for Android
This is the first step to be able to build Subsurface with CMake for Android. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CMakeLists.txt22
-rw-r--r--android.cpp3
2 files changed, 22 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f92afeae5..8764d5aee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -155,8 +155,12 @@ if(SUBSURFACE_MOBILE)
set(QT_QUICK_PKG Quick)
set(QT_QUICK_LIB Qt5::Quick)
endif()
-find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG})
-set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_PKG})
+if(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ set(ANDROID_PKG AndroidExtras)
+ set(ANDROID_LIB Qt5::AndroidExtras)
+endif()
+find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG} ${ANDROID_PKG})
+set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_PKG} ${ANDROID_LIB})
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
# Generate the ssrf-config.h every 'make'
@@ -223,6 +227,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# in some builds we appear to be missing libz for some strange reason...
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lz)
endif()
+if(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ set(PLATFORM_SRC android.cpp)
+ # FIXME: Shouldn't cmake/Qt add this automatically somehow?
+ add_definitions(-DQ_OS_ANDROID)
+ set(SUBSURFACE_TARGET subsurface)
+endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(FBSUPPORT 1)
set(SUBSURFACE_TARGET Subsurface)
@@ -451,7 +461,13 @@ if(SUBSURFACE_MOBILE)
subsurface_corelib
${SUBSURFACE_LINK_LIBRARIES})
else()
- add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
+ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ # FIXME: is this the right way to link somehting which
+ # androiddeployqt can work with?
+ add_library(${SUBSURFACE_TARGET} SHARED ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
+ else()
+ add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
+ endif()
target_link_libraries(
${SUBSURFACE_TARGET}
subsurface_generated_ui
diff --git a/android.cpp b/android.cpp
index 0bb7db020..0b4aadb27 100644
--- a/android.cpp
+++ b/android.cpp
@@ -26,6 +26,9 @@ bool subsurface_ignore_font(const char *font)
return false;
}
+void subsurface_user_info(struct user_info *user)
+{ /* Encourage use of at least libgit2-0.20 */ }
+
const char *system_default_filename(void)
{
/* Replace this when QtCore/QStandardPaths getExternalStorageDirectory landed */