diff options
-rw-r--r-- | CMakeLists.txt | 42 | ||||
-rw-r--r-- | include/local-def.h | 4 | ||||
-rw-r--r-- | src/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/rest-api.c | 2 |
4 files changed, 55 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..d7805884 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,42 @@ +PROJECT(afb-daemon C) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +SET(CMAKE_BUILD_TYPE, Debug) +SET(CMAKE_POSITION_INDEPENDENT_CODE ON) + +SET(PROJECT_NAME "AFB Daemon") +SET(PROJECT_PRETTY_NAME "Application Framework Binder Daemon") +SET(PROJECT_VERSION "0.1") + +INCLUDE(FindPkgConfig) +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckLibraryExists) + +CHECK_INCLUDE_FILES(magic.h HAVE_MAGIC_H) +CHECK_LIBRARY_EXISTS(magic magic_load "" HAVE_LIBMAGIC_SO) +IF(HAVE_MAGIC_H) + IF(HAVE_LIBMAGIC_SO) + SET(HAVE_LIBMAGIC "1") + 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) + +IF(CMAKE_BUILD_TYPE MATCHES Debug) + CHECK_LIBRARY_EXISTS(efence malloc "" HAVE_LIBEFENCE) + IF(HAVE_LIBEFENCE) + MESSAGE(STATUS "Linking with ElectricFence for debugging purposes...") + SET(libefence_LIBRARIES "-lefence") + ENDIF(HAVE_LIBEFENCE) +ENDIF(CMAKE_BUILD_TYPE MATCHES Debug) + +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(json-c REQUIRED json-c) +PKG_CHECK_MODULES(libmicrohttpd REQUIRED libmicrohttpd) + +SET(include_dirs ${INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include ${json-c_INCLUDE_DIRS} ${libmicrohttpd_INCLUDE_DIRS}) +SET(link_libraries ${json-c_LIBRARIES} ${libmicrohttpd_LIBRARIES} ${libefence_LIBRARIES} -lmagic) + +ADD_SUBDIRECTORY(src) diff --git a/include/local-def.h b/include/local-def.h index 5deca987..8fe87d0c 100644 --- a/include/local-def.h +++ b/include/local-def.h @@ -19,7 +19,9 @@ */ -#define _GNU_SOURCE +#ifndef _GNU_SOURCE + #define _GNU_SOURCE +#endif #include <stdio.h> #include <stdlib.h> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..434332b4 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,9 @@ +SET(AFB-DAEMON_HEADERS local-def.h proto-def.h) +SET(AFB-DAEMON_SOURCES main.c config.c session.c http-svc.c afbs-api.c dbus-api.c rest-api.c alsa-api.c) +ADD_EXECUTABLE(afb-daemon ${AFB-DAEMON_SOURCES}) + +include_directories(${include_dirs}) +target_link_libraries(afb-daemon ${link_libraries}) + +INSTALL(TARGETS afb-daemon + RUNTIME DESTINATION bin) diff --git a/src/rest-api.c b/src/rest-api.c index be16b814..5e32d318 100644 --- a/src/rest-api.c +++ b/src/rest-api.c @@ -330,4 +330,4 @@ void initPlugins(AFB_session *session) { // complete plugins and save them within current sessions session->plugins = RegisterPlugins(plugins); -}
\ No newline at end of file +} |