Add subsurface-mobile app to cmake

Add a subsurface-mobile entry to the CMakeLists.txt file. When cmake
is run with -DSUBSURFACE_MOBILE=True, the compiled app will be named
subsurface-mobile, and the initial page (main.qml) will automatically
be loaded.

This will
ensure that the mobile app will be linked to QtQuick.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Grace Karanja 2015-05-27 15:33:23 +03:00 committed by Dirk Hohndel
parent e2c1d24d02
commit 48a54d0348

View file

@ -135,8 +135,14 @@ if(NOT (insource OR insourcedir))
endif() endif()
# configure Qt. # configure Qt.
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network WebKitWidgets PrintSupport Svg Test LinguistTools) if(SUBSURFACE_MOBILE)
set(QT_QUICK Quick)
endif()
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network WebKitWidgets PrintSupport Svg Test LinguistTools ${QT_QUICK})
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::WebKitWidgets Qt5::PrintSupport Qt5::Svg) set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::WebKitWidgets Qt5::PrintSupport Qt5::Svg)
if(SUBSURFACE_MOBILE)
set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Quick)
endif()
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test) set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
# Generate the ssrf-config.h every 'make' # Generate the ssrf-config.h every 'make'
@ -416,8 +422,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
endif() endif()
# create the executables # create the executables
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES}) if(SUBSURFACE_MOBILE)
target_link_libraries( add_definitions(-DSUBSURFACE_MOBILE)
qt5_add_resources(MOBILE_RESOURCES qt-mobile/mobile-resources.qrc)
add_executable(subsurface-mobile ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
target_link_libraries(
subsurface-mobile
subsurface_generated_ui
subsurface_interface
subsurface_profile
subsurface_statistics
subsurface_models
subsurface_corelib
${SUBSURFACE_LINK_LIBRARIES})
else()
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
target_link_libraries(
${SUBSURFACE_TARGET} ${SUBSURFACE_TARGET}
subsurface_generated_ui subsurface_generated_ui
subsurface_interface subsurface_interface
@ -427,6 +447,7 @@ target_link_libraries(
subsurface_corelib subsurface_corelib
${SUBSURFACE_LINK_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES}
) )
endif()
add_dependencies(subsurface_statistics subsurface_generated_ui) add_dependencies(subsurface_statistics subsurface_generated_ui)
add_dependencies(subsurface_profile subsurface_generated_ui) add_dependencies(subsurface_profile subsurface_generated_ui)
@ -661,7 +682,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
install(DIRECTORY theme DESTINATION share/subsurface) install(DIRECTORY theme DESTINATION share/subsurface)
install(DIRECTORY printing_templates DESTINATION share/subsurface) install(DIRECTORY printing_templates DESTINATION share/subsurface)
install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations) install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations)
if(SUBSURFACE_MOBILE)
install(TARGETS subsurface-mobile DESTINATION bin)
else()
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin) install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
endif()
if(DEFINED LIBMARBLEDEVEL) if(DEFINED LIBMARBLEDEVEL)
install( install(
CODE "file(GLOB SSRFMARBLE_SHLIBS \"${LIBMARBLEDEVEL}/lib/libssrfmarblewidget.so*\")" CODE "file(GLOB SSRFMARBLE_SHLIBS \"${LIBMARBLEDEVEL}/lib/libssrfmarblewidget.so*\")"