diff --git a/CMakeLists.txt b/CMakeLists.txt index c415f18..6a13db1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,58 +1,60 @@ 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 project(kirigami2gallery VERSION ${KF5_VERSION}) set(REQUIRED_QT_VERSION 5.8.0) SET(CMAKE_CXX_STANDARD 11) ################# Disallow in-source build ################# 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) 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") +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(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(ECMPoQmTools) include(ECMQMLModules) if(CMAKE_SYSTEM_NAME STREQUAL "Android") find_package(Qt5AndroidExtras ${REQUIRED_QT_VERSION} REQUIRED) endif() ecm_find_qmlmodule(QtGraphicalEffects 1.0) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) add_subdirectory(src) if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ecm_install_po_files_as_qm(po) endif() feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 015bb19..4898371 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,50 +1,53 @@ +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}) 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) endif() find_program(kpackagetool_cmd kpackagetool5) if (kpackagetool_cmd) set(component org.kde.kirigami2.gallery) set(APPDATAFILE "${CMAKE_CURRENT_BINARY_DIR}/${component}.appdata.xml") message(STATUS "${kpackagetool_cmd} --appstream-metainfo ${CMAKE_CURRENT_SOURCE_DIR}/data --appstream-metainfo-output ${APPDATAFILE}") execute_process( COMMAND ${kpackagetool_cmd} --appstream-metainfo ${CMAKE_CURRENT_SOURCE_DIR}/data --appstream-metainfo-output ${APPDATAFILE} ERROR_VARIABLE appstreamerror RESULT_VARIABLE result) if (NOT result EQUAL 0) message(WARNING "couldn't generate metainfo for ${component}: ${appstreamerror}") else() if(appstreamerror) message(WARNING "warnings during generation of metainfo for ${component}: ${appstreamerror}") endif() # OPTIONAL because desktop files can be NoDisplay so they render no XML. install(FILES ${APPDATAFILE} DESTINATION ${KDE_INSTALL_METAINFODIR} OPTIONAL) endif() 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) if (CMAKE_SYSTEM_NAME STREQUAL "Android") find_package(KF5Kirigami2 REQUIRED) 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) endif()