Changeset View
Changeset View
Standalone View
Standalone View
src/apps/marble-maps/CMakeLists.txt
1 | set(marble_SRCS main.cpp MarbleMaps.cpp TextToSpeechClient.cpp) | 1 | set(marble_SRCS main.cpp MarbleMaps.cpp TextToSpeechClient.cpp) | ||
---|---|---|---|---|---|
2 | qt5_add_resources(marble_QRCS MarbleMaps.qrc) | 2 | qt5_add_resources(marble_QRCS MarbleMaps.qrc) | ||
3 | 3 | | |||
4 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) | 4 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||
5 | 5 | | |||
6 | if (CMAKE_SYSTEM_NAME STREQUAL Android) | 6 | add_executable(marble-maps ${marble_SRCS} ${marble_QRCS}) | ||
7 | set(TARGET Marble) | | |||
8 | 7 | | |||
8 | if (ANDROID) | ||||
9 | find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED | 9 | find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED | ||
10 | COMPONENTS | 10 | COMPONENTS | ||
11 | AndroidExtras | 11 | AndroidExtras | ||
12 | QuickControls2 | 12 | QuickControls2 | ||
13 | ) | 13 | ) | ||
14 | 14 | | |||
15 | add_library (${TARGET} SHARED ${marble_SRCS} ${marble_QRCS}) | | |||
16 | | ||||
17 | # while not directly linked, need to be listed here to have deployqt pick up those libs | 15 | # while not directly linked, need to be listed here to have deployqt pick up those libs | ||
18 | target_link_libraries ( | 16 | target_link_libraries ( | ||
19 | ${TARGET} | 17 | marble-maps | ||
20 | marblewidget | 18 | marblewidget | ||
21 | astro | 19 | astro | ||
22 | Qt5::Concurrent | 20 | Qt5::Concurrent | ||
23 | Qt5::Xml | 21 | Qt5::Xml | ||
24 | Qt5::Widgets | 22 | Qt5::Widgets | ||
25 | Qt5::PrintSupport | 23 | Qt5::PrintSupport | ||
26 | Qt5::Network | 24 | Qt5::Network | ||
27 | Qt5::Sql | 25 | Qt5::Sql | ||
28 | Qt5::Svg | 26 | Qt5::Svg | ||
29 | Qt5::Positioning | 27 | Qt5::Positioning | ||
30 | Qt5::AndroidExtras | 28 | Qt5::AndroidExtras | ||
31 | Qt5::Multimedia | 29 | Qt5::Multimedia | ||
32 | Qt5::QuickControls2 | 30 | Qt5::QuickControls2 | ||
33 | ) | 31 | ) | ||
34 | 32 | | |||
35 | if (TARGET Qt5::WebEngineWidgets) | 33 | if (TARGET Qt5::WebEngineWidgets) | ||
36 | target_link_libraries(${TARGET} Qt5::WebEngineWidgets Qt5::WebEngine) | 34 | target_link_libraries(${TARGET} Qt5::WebEngineWidgets Qt5::WebEngine) | ||
37 | endif() | 35 | endif() | ||
38 | else() | | |||
39 | set(TARGET marble-maps) | | |||
40 | add_executable (${TARGET} ${marble_SRCS} ${marble_QRCS}) | | |||
41 | endif() | 36 | endif() | ||
42 | 37 | | |||
43 | target_link_libraries ( | 38 | target_link_libraries ( | ||
44 | ${TARGET} | 39 | marble-maps | ||
45 | marbledeclarative | 40 | marbledeclarative | ||
46 | ) | 41 | ) | ||
47 | 42 | | |||
48 | FILE(GLOB QML_FILES *.qml) | 43 | FILE(GLOB QML_FILES *.qml) | ||
49 | add_custom_target(marble-maps_resources ALL SOURCES ${QML_FILES} package/AndroidManifest.xml) | 44 | add_custom_target(marble-maps_resources ALL SOURCES ${QML_FILES} package/AndroidManifest.xml) | ||
50 | | ||||
51 | if (CMAKE_SYSTEM_NAME STREQUAL Android) | | |||
52 | install(DIRECTORY "../../../data/android/" DESTINATION "${CMAKE_INSTALL_PREFIX}/res") | | |||
53 | set(ABSOLUTE_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}") | | |||
54 | if(NOT IS_ABSOLUTE "${ABSOLUTE_INSTALL_PATH}") | | |||
55 | set(ABSOLUTE_INSTALL_PATH "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}") | | |||
56 | endif() | | |||
57 | get_filename_component(ABSOLUTE_INSTALL_PATH "${ABSOLUTE_INSTALL_PATH}" ABSOLUTE) | | |||
58 | get_filename_component(QT_ANDROID_QT_ROOT "${Qt5Core_DIR}/../../.." ABSOLUTE) | | |||
59 | set(ANDROID_SDK_ROOT $ENV{ANDROID_SDK_ROOT}) | | |||
60 | set(ANDROID_NDK_ROOT $ENV{ANDROID_NDK_ROOT}) | | |||
61 | set(QT_ANDROID_APP_PATH "${ABSOLUTE_INSTALL_PATH}/libs/${ANDROID_ABI}/libMarble.so") | | |||
62 | set(QT_ANDROID_APP_EXTRA_LIBS "${ABSOLUTE_INSTALL_PATH}/lib/libastro.so,${ABSOLUTE_INSTALL_PATH}/lib/libmarblewidget-qt5.so,${ABSOLUTE_INSTALL_PATH}/lib/libmarbledeclarative.so") | | |||
63 | set(QT_ANDROID_APP_PACKAGE_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/package") | | |||
64 | set(QT_ANDROID_APP_PACKAGE_NAME "org.kde.marble.maps") | | |||
65 | set(QT_ANDROID_APP_NAME "Marble Maps") | | |||
66 | set(QT_ANDROID_APP_EXTRA_PLUGINS "${ABSOLUTE_INSTALL_PATH}//share,${ABSOLUTE_INSTALL_PATH}//lib/qml") | | |||
67 | configure_file(package/deploy-marble-maps.json.in ${CMAKE_CURRENT_BINARY_DIR}/deploy-marble-maps.json @ONLY) | | |||
68 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/deploy-marble-maps.json DESTINATION "${CMAKE_INSTALL_PREFIX}/share") | | |||
69 | install(TARGETS ${TARGET} LIBRARY DESTINATION libs/${ANDROID_ABI}) | | |||
70 | if (TARGET create-apk-Marble) | | |||
71 | set(PACKAGE_DIR "${CMAKE_BINARY_DIR}/Marble_projects/") | | |||
72 | set_target_properties(create-apk-Marble PROPERTIES ANDROID_APK_DIR "${PACKAGE_DIR}") | | |||
73 | add_custom_target(marble-move-metadata ALL | | |||
74 | COMMAND cmake -E echo "Moving Marble shared Android resources" | | |||
75 | COMMAND cmake -E remove_directory "${PACKAGE_DIR}" | | |||
76 | COMMAND cmake -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/package" "${PACKAGE_DIR}" | | |||
77 | COMMAND cmake -E copy_directory "${CMAKE_SOURCE_DIR}/data/android/" "${PACKAGE_DIR}/res" | | |||
78 | ) | | |||
79 | add_dependencies(create-apk-Marble marble-move-metadata) | | |||
80 | endif() | | |||
81 | else() | | |||
82 | if(MARBLE_INSTALL_ANDROID_APPS) | | |||
83 | if(APPS_INSTALL_DIR) | | |||
84 | install(PROGRAMS org.kde.marble.maps.desktop DESTINATION ${APPS_INSTALL_DIR}) | | |||
85 | endif(APPS_INSTALL_DIR) | | |||
86 | install(TARGETS ${TARGET} RUNTIME DESTINATION bin) | | |||
87 | endif() | | |||
88 | endif() | |