Commit 77d0a48a authored by Nicolas Fella's avatar Nicolas Fella
Browse files

CMake cleanup

Remove traces from when it was part of Kirigami
Use Release Service version number
Remove uneeded stuff
Simplify Android checks
Update requirements to recent stuff
parent 0e80fdde
cmake_minimum_required(VERSION 3.0)
set(KF5_VERSION "5.47.0") # handled by release scripts
set(KF5_DEP_VERSION "5.47.0") # handled by release scripts
# KDE Release Service Version, managed by release script
set (RELEASE_SERVICE_VERSION_MAJOR "21")
set (RELEASE_SERVICE_VERSION_MINOR "03")
set (RELEASE_SERVICE_VERSION_MICRO "70")
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
project(kirigami2gallery VERSION ${KF5_VERSION})
project(kirigami2gallery VERSION ${RELEASE_SERVICE_VERSION})
set(REQUIRED_QT_VERSION 5.8.0)
set(REQUIRED_QT_VERSION 5.15.0)
set(KF5_DEP_VERSION "5.79.0")
SET(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
################# Disallow in-source build #################
find_package(ECM ${KF5_DEP_VERSION} REQUIRED)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "kirigami gallery requires an out of source build. Please create a separate build directory and run 'cmake path_to_kirigami [options]' there.")
endif()
# Make CPack available to easy generate binary packages
include(CPack)
include(FeatureSummary)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Gui Svg QuickControls2)
set(CMAKE_AUTOMOC ON)
set(AUTOMOC_MOC_OPTIONS -Muri=org.kde.kirigami)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
################# set KDE specific information #################
find_package(ECM 5.47.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules")
find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS Kirigami2 ItemModels)
option(ENABLE_QML_PROFILING "Enable QML profiler support" ON)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMPoQmTools)
include(ECMQMLModules)
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
if(ANDROID)
find_package(Qt5AndroidExtras ${REQUIRED_QT_VERSION} REQUIRED)
endif()
ecm_find_qmlmodule(QtGraphicalEffects 1.0)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
......
......@@ -3,21 +3,6 @@ if (ENABLE_QML_PROFILING)
add_definitions(-DQT_QML_DEBUG)
endif()
set(kirigami2gallery_SRCS
main.cpp
InfoData.cpp
)
qt5_add_resources(RESOURCES resources.qrc)
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(KF5Kirigami2 ${KF5_DEP_VERSION})
find_package(KF5ItemModels ${KF5_DEP_VERSION})
set(kirigami2gallery_EXTRA_LIBS Qt5::AndroidExtras
#FIXME: we shouldn't have to link to it but otherwise the lib won't be packaged on Android
Qt5::QuickControls2 KF5::Kirigami2 KF5::ItemModels)
endif()
find_program(kpackagetool_cmd kpackagetool5)
if (kpackagetool_cmd)
set(component org.kde.kirigami2.gallery)
......@@ -42,13 +27,16 @@ else()
message(WARNING "KPackage components should be specified in reverse domain notation. Appstream information won't be generated for ${component}.")
endif()
add_executable(kirigami2gallery ${kirigami2gallery_SRCS} ${RESOURCES})
target_link_libraries(kirigami2gallery Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg ${kirigami2gallery_EXTRA_LIBS})
install(TARGETS kirigami2gallery ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES data/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.kirigami2.gallery.desktop)
add_executable(kirigami2gallery
main.cpp
InfoData.cpp
resources.qrc)
target_link_libraries(kirigami2gallery Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::QuickControls2 KF5::Kirigami2 KF5::ItemModels)
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(KF5Kirigami2 REQUIRED)
if (ANDROID)
target_link_libraries(kirigami2gallery Qt5::AndroidExtras)
kirigami_package_breeze_icons(ICONS applications-graphics view-list-icons folder-sync view-list-details configure document-edit dialog-information dialog-positive dialog-warning dialog-error dialog-cancel document-decrypt system-run mail-reply-sender bookmarks folder media-record-symbolic add-placemark address-book-new-symbolic view-right-new view-right-close documentinfo go-home)
endif()
install(TARGETS kirigami2gallery ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES data/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.kirigami2.gallery.desktop)
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