diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-11-17 11:10:43 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-11-17 11:58:13 +0100 |
commit | 8cbdf0a5cb4d9abf0684344a28746a21dfc36ac3 (patch) | |
tree | eb84bacb00a38758234b62ee2bd2dac6dc71cbd4 | |
parent | 3a3ee2aa68333fce13fb2611b0165def47573c5d (diff) |
CMAKE: allow to compile afb-genskel only
When missing components are detected, allows to not compile
the binder if ALLOW_NO_BINDER is ON
Change-Id: I0fb27844e3f36d4dd643bdf250f05b4f6769bc53
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | CMakeLists.txt | 45 | ||||
-rw-r--r-- | bindings/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/CMakeLists.txt | 9 |
3 files changed, 44 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 163a74b6..568eb42b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,19 +70,14 @@ CHECK_LIBRARY_EXISTS(magic magic_load "" HAVE_LIBMAGIC_SO) IF(HAVE_MAGIC_H) IF(HAVE_LIBMAGIC_SO) SET(HAVE_LIBMAGIC "1") + SET(LIBMAGIC_LDFLAGS -lmagic) ENDIF(HAVE_LIBMAGIC_SO) ENDIF(HAVE_MAGIC_H) -IF(NOT HAVE_LIBMAGIC) - MESSAGE(FATAL_ERROR "\"magic.h\" or \"libmagic.so\" missing. - Please install the \"file-devel\" or \"libmagic-dev\" package !") -ENDIF(NOT HAVE_LIBMAGIC) -ADD_DEFINITIONS(-DUSE_MAGIC_MIME_TYPE) - -PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222) -PKG_CHECK_MODULES(libmicrohttpd REQUIRED libmicrohttpd>=0.9.55) -PKG_CHECK_MODULES(openssl REQUIRED openssl) -PKG_CHECK_MODULES(uuid REQUIRED uuid) +PKG_CHECK_MODULES(libsystemd libsystemd>=222) +PKG_CHECK_MODULES(libmicrohttpd libmicrohttpd>=0.9.55) +PKG_CHECK_MODULES(openssl openssl) +PKG_CHECK_MODULES(uuid uuid) PKG_CHECK_MODULES(cynara cynara-client) IF(AGL_DEVEL) @@ -93,6 +88,32 @@ IF(cynara_FOUND) ADD_DEFINITIONS(-DBACKEND_PERMISSION_IS_CYNARA) ENDIF(cynara_FOUND) +IF(HAVE_LIBMAGIC AND libsystemd_FOUND AND libmicrohttpd_FOUND AND openssl_FOUND AND uuid_FOUND) + SET(WITH_BINDER TRUE) + ADD_DEFINITIONS(-DUSE_MAGIC_MIME_TYPE) +ELSE() + IF(NOT HAVE_LIBMAGIC) + MESSAGE(WARNING "\"magic.h\" or \"libmagic.so\" missing. + Please install the \"file-devel\" or \"libmagic-dev\" package !") + ENDIF(NOT HAVE_LIBMAGIC) + IF(NOT libsystemd_FOUND) + MESSAGE(WARNING "Dependency to 'libsystemd' is missing") + ENDIF() + IF(NOT libmicrohttpd_FOUND) + MESSAGE(WARNING "Dependency to 'libmicrohttpd' is missing") + ENDIF() + IF(NOT openssl_FOUND) + MESSAGE(WARNING "Dependency to 'openssl' is missing") + ENDIF() + IF(NOT uuid_FOUND) + MESSAGE(WARNING "Dependency to 'uuid' is missing") + ENDIF() + IF(NOT ALLOW_NO_BINDER) + MESSAGE(FATAL_ERROR "Can't compile the binder, either define ALLOW_NO_BINDER or install dependencies") + ENDIF() + SET(WITH_BINDER FALSE) +ENDIF() + ADD_DEFINITIONS(-DAFB_VERSION="${PROJECT_VERSION}") INCLUDE_DIRECTORIES( @@ -114,7 +135,7 @@ SET(link_libraries ${uuid_LDFLAGS} ${openssl_LDFLAGS} ${cynara_LDFLAGS} - -lmagic + ${LIBMAGIC_LDFLAGS} -ldl -lrt ) @@ -123,7 +144,7 @@ SET(binding_install_dir ${CMAKE_INSTALL_FULL_LIBDIR}/afb) ########################################################################### # activates the monitoring by default -if(INCLUDE_MONITORING) +if(INCLUDE_MONITORING AND WITH_BINDER) add_definitions(-DWITH_MONITORING_OPTION) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test/monitoring diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt index 1a1e9016..509c6cbf 100644 --- a/bindings/CMakeLists.txt +++ b/bindings/CMakeLists.txt @@ -16,6 +16,9 @@ # limitations under the License. ########################################################################### +IF(WITH_BINDER) ADD_SUBDIRECTORY(intrinsics) ADD_SUBDIRECTORY(samples) ADD_SUBDIRECTORY(tutorial) +ENDIF(WITH_BINDER) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 68f1505a..d531ca2e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,6 +23,10 @@ endif(CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) INCLUDE(FindPkgConfig) ADD_SUBDIRECTORY(genskel) + +IF(WITH_BINDER) +########################################### + ADD_SUBDIRECTORY(tests) ADD_DEFINITIONS(-DBINDING_INSTALL_DIR="${binding_install_dir}") @@ -115,4 +119,7 @@ TARGET_LINK_LIBRARIES(afb-client-demo INSTALL(TARGETS afb-client-demo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - +########################################### +ELSE(WITH_BINDER) + MESSAGE(WARNING "NOT compiling the binder! but tools are compiled") +ENDIF(WITH_BINDER) |