Update date of copyright notices
[src/app-framework-main.git] / src / CMakeLists.txt
index b7c130a..6a1b497 100644 (file)
@@ -1,5 +1,5 @@
 ###########################################################################
-# Copyright 2015, 2016, 2017 IoT.bzh
+# Copyright (C) 2015-2018 IoT.bzh
 #
 # author: José Bollo <jose.bollo@iot.bzh>
 #
@@ -56,6 +56,22 @@ else()
        add_definitions(-DUSE_LIBZIP=0)
 endif()
 
+pkg_check_modules(libsystemd libsystemd>=222)
+if(libsystemd_FOUND)
+       add_compile_options(${libsystemd_CFLAGS})
+       include_directories(${libsystemd_INCLUDE_DIRS})
+       link_libraries(${libsystemd_LIBRARIES})
+else()
+       add_definitions(-DNO_LIBSYSTEMD)
+endif()
+
+pkg_check_modules(AFB afb-daemon>=4.99 libafbwsc>=4.99)
+if(AFB_FOUND)
+       add_compile_options(${AFB_CFLAGS})
+       include_directories(${AFB_INCLUDE_DIRS})
+       link_libraries(${AFB_LIBRARIES})
+endif()
+
 ###########################################################################
 
 if(SIMULATE_SECMGR)
@@ -100,6 +116,7 @@ add_library(utils STATIC
        utils-dir.c
        utils-file.c
        utils-json.c
+       utils-systemd.c
        verbose.c
        )
 
@@ -115,8 +132,13 @@ add_library(secwrp STATIC
        secmgr-wrap.c
        )
 
+add_library(afm STATIC
+       afm-udb.c
+       afm-urun.c
+       )
+
 ###########################################################################
-# packaging tools
+# off line tools tools
 
 MESSAGE(STATUS "Creating packaging tools")
 
@@ -135,60 +157,30 @@ target_link_libraries(wgtpkg-installer wgtpkg wgt secwrp utils)
 install(TARGETS wgtpkg-sign wgtpkg-pack wgtpkg-info wgtpkg-installer DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 ###########################################################################
-# the targeted
-
-pkg_check_modules(SYSTEMD libsystemd>=222)
-if(SYSTEMD_FOUND)
-       add_compile_options(${SYSTEMD_CFLAGS})
-       include_directories(${SYSTEMD_INCLUDE_DIRS})
-       link_libraries(${SYSTEMD_LIBRARIES})
-
-       add_library(utils2 STATIC
-               utils-jbus.c
-               )
-
-       add_library(afm STATIC
-               afm-db.c
-               afm-launch.c
-               afm-launch-mode.c
-               afm-run.c
-               )
-
-       ###########################################################################
-       # the daemons
+# dynamic tool daemons
+
+if(libsystemd_FOUND AND AFB_FOUND)
        MESSAGE(STATUS "Creating daemons")
 
+       add_library(jbus STATIC utils-jbus.c)
+
        add_executable(afm-user-daemon afm-user-daemon.c)
-       target_link_libraries(afm-user-daemon afm secwrp wgt utils utils2)
+       target_link_libraries(afm-user-daemon jbus utils afbwsc)
        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)
-               ###############################################################
-               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(SYSTEMD_FOUND)
+       add_library(afm-binding MODULE afm-binding.c)
+       target_link_libraries(afm-binding wgtpkg wgt secwrp utils afm)
+       set_target_properties(afm-binding PROPERTIES
+               PREFIX ""
+               LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/afm-binding.export-map"
+       )
+       install(TARGETS afm-binding LIBRARY DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/afm)
+
+       add_executable(afm-user-session afm-user-session.c)
+       install(TARGETS afm-user-session DESTINATION ${CMAKE_INSTALL_BINDIR})
+else()
+       MESSAGE(STATUS "Not creating daemons")
+endif()
 
 ###########################################################################
 # the tests