project(qml-phone-shell) cmake_minimum_required(VERSION 2.8.9) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) # enable QML debugging string(TOLOWER "${CMAKE_BUILD_TYPE}" typelower) # Build types should always be lowercase but sometimes they are not. if(typelower MATCHES "debug") add_definitions(-DQT_QML_DEBUG) endif() include(EnableCoverageReport) ##################################################################### # Enable code coverage calculation with gcov/gcovr/lcov # Usage: # * Switch build type to coverage (use ccmake or cmake-gui) # * Invoke make, make test, make coverage (or ninja if you use that backend) # * Find html report in subdir coveragereport # * Find xml report feasible for jenkins in coverage.xml ##################################################################### if(typelower MATCHES coverage) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" ) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage" ) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" ) ENABLE_COVERAGE_REPORT(TARGETS ${SHELL_APP}) endif() find_package(Qt5Qml) find_package(Qt5Quick) find_package(Qt5Gui) find_package(Qt5DBus) # Standard install paths include(GNUInstallDirs) set(SHELL_APP_DIR ${CMAKE_INSTALL_DATADIR}/qml-phone-shell) configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${Qt5Gui_PRIVATE_INCLUDE_DIRS} ) # Tests enable_testing() add_custom_target(check make test CTEST_OUTPUT_ON_FAILURE=1) # Autopilot tests include(autopilot) declare_autopilot_test(qml_phone_shell ${CMAKE_SOURCE_DIR}/tests/autopilot/) add_subdirectory(tests) set(SHELL_APP qml-phone-shell) set(shell_app_HDRS ) set(shell_app_SRCS main.cpp) add_executable(${SHELL_APP} ${shellapplication_MOC_SRCS} ${shell_app_SRCS} ) qt5_use_modules(${SHELL_APP} Qml Quick) target_link_libraries(${SHELL_APP} ${Qt5Qml_LIBRARIES} ${Qt5Quick_LIBRARIES} ) # install binaries install(TARGETS ${SHELL_APP} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) # install top level qml and js files file(GLOB QML_JS_FILES *.qml *.js) install(FILES ${QML_JS_FILES} DESTINATION ${SHELL_APP_DIR} ) # add subdirectories to build add_subdirectory(plugins) # install subdirectories set(QML_DIRS Applications Bottombar Components Dash graphics Greeter Hud Panel Launcher OnScreenKeyboard SideStage ) install(DIRECTORY ${QML_DIRS} DESTINATION ${SHELL_APP_DIR} ) # generate desktop file configure_file(${SHELL_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop @ONLY) # install desktop file install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )