diff options
author | Stephane Desneux <stephane.desneux@iot.bzh> | 2016-07-08 19:22:22 +0200 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@iot.bzh> | 2016-07-09 11:21:16 +0200 |
commit | dd9a802209b6d7a41f16b0123090b93a428c9404 (patch) | |
tree | 37c62dc3ba40e8455c3fcdfd1d480639385a3f8b | |
parent | 81df68c04dc5e32d5d6d06bc20a7030afdf45f59 (diff) |
cmake: handle build for SDK
When building for SDK, only the wgtpkg tools should be built
Change-Id: I2f935bae1b26d1d0e8b9513ade85703f8f49cf9d
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | conf/CMakeLists.txt | 20 | ||||
-rw-r--r-- | scripts/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/CMakeLists.txt | 108 |
4 files changed, 75 insertions, 58 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f399ad6..9ade5bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ SET(PROJECT_VERSION "1.0") setc(USE_LIBZIP 1) setc(USE_SIMULATION 1) +setc(USE_SDK 0) setc(afm_name "afm") setc(afm_confdir "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${afm_name}") diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index 62bdf0f..078253c 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -18,14 +18,16 @@ cmake_minimum_required(VERSION 2.8) -setc(SYSCONFDIR_DBUS_SYSTEM ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d) -setc(SYSCONFDIR_DBUS_USER ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/session.d) -setc(UNITDIR_SYSTEM ${CMAKE_INSTALL_LIBDIR}/systemd/system) -setc(UNITDIR_USER ${CMAKE_INSTALL_LIBDIR}/systemd/user) +if(NOT USE_SDK) + setc(SYSCONFDIR_DBUS_SYSTEM ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d) + setc(SYSCONFDIR_DBUS_USER ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/session.d) + setc(UNITDIR_SYSTEM ${CMAKE_INSTALL_LIBDIR}/systemd/system) + setc(UNITDIR_USER ${CMAKE_INSTALL_LIBDIR}/systemd/user) -install(FILES afm-system-daemon.conf DESTINATION ${SYSCONFDIR_DBUS_SYSTEM}) -install(FILES afm-system-daemon.service DESTINATION ${UNITDIR_SYSTEM}) -install(FILES afm-user-daemon.conf DESTINATION ${SYSCONFDIR_DBUS_USER}) -install(FILES afm-user-daemon.service DESTINATION ${UNITDIR_USER}) -install(FILES afm-launch.conf DESTINATION ${afm_confdir}) + install(FILES afm-system-daemon.conf DESTINATION ${SYSCONFDIR_DBUS_SYSTEM}) + install(FILES afm-system-daemon.service DESTINATION ${UNITDIR_SYSTEM}) + install(FILES afm-user-daemon.conf DESTINATION ${SYSCONFDIR_DBUS_USER}) + install(FILES afm-user-daemon.service DESTINATION ${UNITDIR_USER}) + install(FILES afm-launch.conf DESTINATION ${afm_confdir}) +endif() diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 34c37cf..873e90c 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -18,5 +18,7 @@ cmake_minimum_required(VERSION 2.8) -install(PROGRAMS afm-util DESTINATION ${CMAKE_INSTALL_BINDIR}) +if(NOT USE_SDK) + install(PROGRAMS afm-util DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0f07059..ac5c105 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -41,7 +41,7 @@ set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage") include(FindPkgConfig) -pkg_check_modules(EXTRAS REQUIRED libxml-2.0 openssl xmlsec1 xmlsec1-openssl json-c libsystemd) +pkg_check_modules(EXTRAS REQUIRED libxml-2.0 openssl xmlsec1 xmlsec1-openssl) add_compile_options(${EXTRAS_CFLAGS}) include_directories(${EXTRAS_INCLUDE_DIRS}) link_libraries(${EXTRAS_LIBRARIES}) @@ -84,8 +84,6 @@ add_library(wgtpkg STATIC add_library(utils STATIC utils-dir.c - utils-jbus.c - utils-json.c verbose.c ) @@ -99,13 +97,6 @@ add_library(secwrp STATIC secmgr-wrap.c ) -add_library(afm STATIC - afm-db.c - afm-launch.c - afm-launch-mode.c - afm-run.c - ) - ########################################################################### # packaging tools @@ -126,41 +117,62 @@ target_link_libraries(wgtpkg-installer wgtpkg wgt secwrp utils) install(TARGETS wgtpkg-sign wgtpkg-pack wgtpkg-info wgtpkg-installer DESTINATION ${CMAKE_INSTALL_BINDIR}) ########################################################################### -# the daemons - -MESSAGE(STATUS "Creating daemons") - -add_executable(afm-user-daemon afm-user-daemon.c) -target_link_libraries(afm-user-daemon afm secwrp wgt utils ) -install(TARGETS afm-user-daemon DESTINATION ${CMAKE_INSTALL_BINDIR}) - -add_executable(afm-system-daemon afm-system-daemon.c) -target_link_libraries(afm-system-daemon wgtpkg afm secwrp wgt utils) -install(TARGETS afm-system-daemon DESTINATION ${CMAKE_INSTALL_BINDIR}) - -########################################################################### -# the binding for afb - -pkg_check_modules(afb afb-daemon) -if(afb_FOUND) - message(STATUS "Creation afm-main-binding for AFB-DAEMON") - ############################################################### - #pkg_get_variable(afb_binding_install_dir afb-daemon binding_install_dir) - execute_process( - COMMAND pkg-config --variable binding_install_dir afb-daemon - OUTPUT_VARIABLE afb_binding_install_dir OUTPUT_STRIP_TRAILING_WHITESPACE - ) - ############################################################### - add_library(afm-main-binding MODULE afm-main-binding.c) - target_compile_options(afm-main-binding PRIVATE ${afb_CFLAGS}) - target_include_directories(afm-main-binding PRIVATE ${afb_INCLUDE_DIRS}) - target_link_libraries(afm-main-binding utils ${afb_LIBRARIES}) - set_target_properties(afm-main-binding PROPERTIES - PREFIX "" - LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/afm-main-binding.export-map" - ) - install(TARGETS afm-main-binding LIBRARY DESTINATION ${afb_binding_install_dir}) -else() - message(STATUS "Not creating the binding for AFB-DAEMON") -endif() - +# the targeted + +pkg_check_modules(EXTRA2 json-c libsystemd) +if(EXTRA2_FOUND) + add_compile_options(${EXTRA2_CFLAGS}) + include_directories(${EXTRA2_INCLUDE_DIRS}) + link_libraries(${EXTRA2_LIBRARIES}) + + add_library(utils2 STATIC + utils-jbus.c + utils-json.c + ) + + add_library(afm STATIC + afm-db.c + afm-launch.c + afm-launch-mode.c + afm-run.c + ) + + ########################################################################### + # the daemons + MESSAGE(STATUS "Creating daemons") + + add_executable(afm-user-daemon afm-user-daemon.c) + target_link_libraries(afm-user-daemon afm secwrp wgt utils utils2) + install(TARGETS afm-user-daemon DESTINATION ${CMAKE_INSTALL_BINDIR}) + + add_executable(afm-system-daemon afm-system-daemon.c) + target_link_libraries(afm-system-daemon wgtpkg afm secwrp wgt utils utils2) + install(TARGETS afm-system-daemon DESTINATION ${CMAKE_INSTALL_BINDIR}) + + ########################################################################### + # the binding for afb + + pkg_check_modules(afb afb-daemon) + if(afb_FOUND) + message(STATUS "Creation afm-main-binding for AFB-DAEMON") + ############################################################### + #pkg_get_variable(afb_binding_install_dir afb-daemon binding_install_dir) + execute_process( + COMMAND pkg-config --variable binding_install_dir afb-daemon + OUTPUT_VARIABLE afb_binding_install_dir OUTPUT_STRIP_TRAILING_WHITESPACE + ) + ############################################################### + add_library(afm-main-binding MODULE afm-main-binding.c) + target_compile_options(afm-main-binding PRIVATE ${afb_CFLAGS}) + target_include_directories(afm-main-binding PRIVATE ${afb_INCLUDE_DIRS}) + target_link_libraries(afm-main-binding utils utils2 ${afb_LIBRARIES}) + set_target_properties(afm-main-binding PROPERTIES + PREFIX "" + LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/afm-main-binding.export-map" + ) + install(TARGETS afm-main-binding LIBRARY DESTINATION ${afb_binding_install_dir}) + else() + message(STATUS "Not creating the binding for AFB-DAEMON") + endif() + +endif(EXTRA2_FOUND) |