###########################################################################
-# Copyright 2015 IoT.bzh
+# Copyright 2015, 2016, 2017 IoT.bzh
#
# author: José Bollo <jose.bollo@iot.bzh>
#
# limitations under the License.
###########################################################################
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.4.3)
###########################################################################
include(FindPkgConfig)
-pkg_check_modules(EXTRAS REQUIRED libxml-2.0 openssl xmlsec1 xmlsec1-openssl)
+pkg_check_modules(EXTRAS REQUIRED libxml-2.0 openssl xmlsec1 xmlsec1-openssl json-c)
add_compile_options(${EXTRAS_CFLAGS})
include_directories(${EXTRAS_INCLUDE_DIRS})
link_libraries(${EXTRAS_LIBRARIES})
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()
+
###########################################################################
if(SIMULATE_SECMGR)
wgtpkg-digsig.c
wgtpkg-files.c
wgtpkg-install.c
+ wgtpkg-mustach.c
wgtpkg-permissions.c
wgtpkg-uninstall.c
+ wgtpkg-unit.c
wgtpkg-workdir.c
wgtpkg-xmlsec.c
wgtpkg-zip.c
)
add_library(utils STATIC
+ mustach.c
utils-dir.c
+ utils-file.c
+ utils-json.c
+ utils-systemd.c
verbose.c
)
add_library(wgt STATIC
wgt-config.c
wgt-info.c
+ wgt-strings.c
+ wgt-json.c
wgt.c
)
secmgr-wrap.c
)
+add_library(afm STATIC
+ afm-db.c
+ afm-udb.c
+ afm-launch.c
+ afm-launch-mode.c
+ afm-run.c
+ afm-urun.c
+ )
+
###########################################################################
# packaging tools
install(TARGETS wgtpkg-sign wgtpkg-pack wgtpkg-info wgtpkg-installer DESTINATION ${CMAKE_INSTALL_BINDIR})
-###########################################################################
-# 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
- )
-
+if(libsystemd_FOUND)
###########################################################################
# the daemons
+
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 afm secwrp wgt utils jbus)
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)
+ target_link_libraries(afm-system-daemon wgtpkg afm secwrp wgt utils jbus)
install(TARGETS afm-system-daemon DESTINATION ${CMAKE_INSTALL_BINDIR})
###########################################################################
# the binding for afb
- pkg_check_modules(afb afb-daemon)
- if(afb_FOUND)
+ 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
- )
+ 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})
+ 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 jbus ${AFB_LIBRARIES})
set_target_properties(afm-main-binding PROPERTIES
PREFIX ""
LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/afm-main-binding.export-map"
else()
message(STATUS "Not creating the binding for AFB-DAEMON")
endif()
+endif()
+
+###########################################################################
+# the tests
+
+add_subdirectory(tests)
-endif(EXTRA2_FOUND)