project(bluetooth-settings) cmake_minimum_required(VERSION 3.3) include(GNUInstallDirs) set(PROJECT_VERSION "0.1") set(PROJECT_ICON "icon_bt.png") set(PROJECT_LIBDIR "lib") set(PROJECT_QML "qml") set(PROJECT_IMPORT "imports") set(PROJECT_DOC "doc") set(CMAKE_BUILD_TYPE Debug) ########################################################################### add_compile_options(-Wall -Wextra -Wconversion) add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care? add_compile_options(-Werror=maybe-uninitialized) add_compile_options(-Werror=implicit-function-declaration) add_compile_options(-ffunction-sections -fdata-sections) add_compile_options(-Wl,--as-needed -Wl,--gc-sections) add_compile_options(-fPIC) set(CMAKE_C_FLAGS_PROFILING "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE") set(CMAKE_C_FLAGS_DEBUG "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE") set(CMAKE_C_FLAGS_RELEASE "-g -O2") set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage") ########################################################################### include(FindPkgConfig) pkg_check_modules(EXTRAS REQUIRED json-c afb-daemon glib-2.0 gio-2.0 gobject-2.0 zlib) add_compile_options(${EXTRAS_CFLAGS}) include_directories(${EXTRAS_INCLUDE_DIRS}) link_libraries(${EXTRAS_LIBRARIES}) ########################################################################### # the binding for afb message(STATUS "Creation of ${PROJECT_NAME} for AFB-DAEMON") ############################################################### add_library(${PROJECT_NAME} MODULE bluetooth-api.c bluetooth-manager.c) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map" ) configure_file(config.xml.in config.xml) add_custom_command( OUTPUT ${PROJECT_NAME}.wgt DEPENDS ${PROJECT_NAME} COMMAND rm -rf package COMMAND mkdir -p package/${PROJECT_LIBDIR} package/htdocs COMMAND cp config.xml package/ COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_ICON} package/icon.png COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_QML} package/${PROJECT_QML} COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_IMPORT} package/${PROJECT_IMPORT} COMMAND cp -rf ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_DOC} package/${PROJECT_DOC} COMMAND cp ${PROJECT_NAME}.so package/${PROJECT_LIBDIR} COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt package COMMAND rm -rf package ) add_custom_target(widget ALL DEPENDS ${PROJECT_NAME}.wgt)