aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-05-18 17:29:26 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-05-18 17:29:26 +0200
commit9481b4f2960c560ec8297bdc37d8014230072a5c (patch)
treeb076d389746ae8e33f68855146fa5c58318764c4
parentceb2e567b5f26ff148fbc0e9526f7e7e99464000 (diff)
improves the build system
Change-Id: Idad84e88cd8c21d111ce7ed44340f6d2b0fccb37 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--CMakeLists.txt65
-rw-r--r--plugins/afm-main-plugin/CMakeLists.txt17
-rw-r--r--plugins/afm-main-plugin/export.map1
-rw-r--r--plugins/audio/CMakeLists.txt19
-rw-r--r--plugins/audio/audio-api.c2
-rw-r--r--plugins/audio/export.map1
-rw-r--r--plugins/media/CMakeLists.txt14
-rw-r--r--plugins/media/export.map1
-rw-r--r--plugins/media/media-api.c2
-rw-r--r--plugins/radio/CMakeLists.txt13
-rw-r--r--plugins/radio/export.map1
-rw-r--r--plugins/samples/CMakeLists.txt16
-rw-r--r--plugins/samples/export.map1
-rw-r--r--plugins/session/CMakeLists.txt5
-rw-r--r--plugins/session/export.map1
-rw-r--r--src/CMakeLists.txt59
16 files changed, 127 insertions, 91 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 76000105..54cc6407 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
SET(PROJECT_NAME "AFB Daemon")
SET(PROJECT_PRETTY_NAME "Application Framework Binder Daemon")
-SET(PROJECT_VERSION "0.3")
+SET(PROJECT_VERSION "0.4")
INCLUDE(FindPkgConfig)
INCLUDE(CheckIncludeFiles)
@@ -32,19 +32,6 @@ set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
###########################################################################
-
-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)
@@ -53,33 +40,7 @@ IF(CMAKE_BUILD_TYPE MATCHES Debug)
ENDIF(HAVE_LIBEFENCE)
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222)
PKG_CHECK_MODULES(json-c REQUIRED json-c)
-PKG_CHECK_MODULES(libmicrohttpd REQUIRED libmicrohttpd>=0.9.48)
-PKG_CHECK_MODULES(openssl REQUIRED openssl)
-PKG_CHECK_MODULES(uuid REQUIRED uuid)
-# Optional plugin dependencies
-PKG_CHECK_MODULES(alsa alsa)
-PKG_CHECK_MODULES(pulseaudio libpulse libpulse-simple)
-PKG_CHECK_MODULES(librtlsdr librtlsdr>=0.5.0)
-PKG_CHECK_MODULES(gupnp gupnp-1.0 gupnp-av-1.0 gssdp-1.0 gobject-2.0 gio-2.0)
-
-IF(alsa_FOUND)
- MESSAGE(STATUS "ALSA found ; will compile Audio plugin... (PLUGIN)")
- IF(pulseaudio_FOUND)
- MESSAGE(STATUS "PulseAudio found ; Audio plugin will have PulseAudio support")
- ADD_DEFINITIONS(-DHAVE_PULSE=1)
- ENDIF(pulseaudio_FOUND)
-ENDIF(alsa_FOUND)
-
-IF(librtlsdr_FOUND)
- MESSAGE(STATUS "librtlsdr found ; will compile Radio plugin... (PLUGIN)")
-ENDIF(librtlsdr_FOUND)
-
-IF(gupnp_FOUND)
- MESSAGE(STATUS "gupnp found ; will compile Media plugin... (PLUGIN)")
-ENDIF(gupnp_FOUND)
INCLUDE(FindThreads)
FIND_PACKAGE(Threads)
@@ -87,33 +48,13 @@ FIND_PACKAGE(Threads)
SET(include_dirs
${INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/include
- ${libsystemd_INCLUDE_DIRS}
${json-c_INCLUDE_DIRS}
- ${libmicrohttpd_INCLUDE_DIRS}
- ${uuid_INCLUDE_DIRS}
- ${alsa_INCLUDE_DIRS}
- ${pulseaudio_INCLUDE_DIRS}
- ${librtlsdr_INCLUDE_DIRS}
- ${gupnp_INCLUDE_DIRS}
- ${openssl_INCLUDE_DIRS}
)
SET(link_libraries
- ${libsystemd_LIBRARIES}
- ${json-c_LIBRARIES}
- ${libmicrohttpd_LIBRARIES}
- ${uuid_LIBRARIES}
- ${alsa_LIBRARIES}
- ${pulseaudio_LIBRARIES}
- ${librtlsdr_LIBRARIES}
- ${gupnp_LIBRARIES}
+ ${libefence_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
-# ${libefence_LIBRARIES}
- ${openssl_LIBRARIES}
- -lmagic
- -lm
- -ldl
- -lrt
+ ${json-c_LIBRARIES}
)
SET(plugin_install_dir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/afb)
diff --git a/plugins/afm-main-plugin/CMakeLists.txt b/plugins/afm-main-plugin/CMakeLists.txt
index 5ed1d4b2..6da0e915 100644
--- a/plugins/afm-main-plugin/CMakeLists.txt
+++ b/plugins/afm-main-plugin/CMakeLists.txt
@@ -1,7 +1,20 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222)
+
+INCLUDE_DIRECTORIES(
+ ${INCLUDE_DIRS}
+ ${libsystemd_INCLUDE_DIRS}
+)
+
+
ADD_LIBRARY(afm-main-api MODULE afm-main-plugin.c utils-jbus.c)
-SET_TARGET_PROPERTIES(afm-main-api PROPERTIES PREFIX "")
-TARGET_LINK_LIBRARIES(afm-main-api ${link_libraries})
+SET_TARGET_PROPERTIES(afm-main-api PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
+)
+
+TARGET_LINK_LIBRARIES(afm-main-api ${link_libraries} ${libsystemd_LIBRARIES})
INCLUDE_DIRECTORIES(${include_dirs})
INSTALL(TARGETS afm-main-api
LIBRARY DESTINATION ${plugin_install_dir})
diff --git a/plugins/afm-main-plugin/export.map b/plugins/afm-main-plugin/export.map
new file mode 100644
index 00000000..e2da85ca
--- /dev/null
+++ b/plugins/afm-main-plugin/export.map
@@ -0,0 +1 @@
+{ global: pluginAfbV1Register; local: *; };
diff --git a/plugins/audio/CMakeLists.txt b/plugins/audio/CMakeLists.txt
index ee858b4c..2d74fd62 100644
--- a/plugins/audio/CMakeLists.txt
+++ b/plugins/audio/CMakeLists.txt
@@ -1,13 +1,26 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(alsa alsa)
+PKG_CHECK_MODULES(pulseaudio libpulse libpulse-simple)
+INCLUDE(FindThreads)
+FIND_PACKAGE(Threads)
+
IF(alsa_FOUND)
+ MESSAGE(STATUS "ALSA found ; will compile Audio plugin... (PLUGIN)")
+
IF(pulseaudio_FOUND)
+ MESSAGE(STATUS "PulseAudio found ; Audio plugin will have PulseAudio support")
+ ADD_DEFINITIONS(-DHAVE_PULSE=1)
SET(pulse_sources audio-pulse.c)
ENDIF(pulseaudio_FOUND)
+ INCLUDE_DIRECTORIES(${include_dirs} ${alsa_INCLUDE_DIRS} ${pulseaudio_INCLUDE_DIRS})
ADD_LIBRARY(audio-api MODULE audio-api.c audio-alsa.c ${pulse_sources})
- SET_TARGET_PROPERTIES(audio-api PROPERTIES PREFIX "")
- TARGET_LINK_LIBRARIES(audio-api ${link_libraries})
- INCLUDE_DIRECTORIES(${include_dirs})
+ SET_TARGET_PROPERTIES(audio-api PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
+ )
+ TARGET_LINK_LIBRARIES(audio-api ${link_libraries} ${alsa_LIBRARIES} ${pulseaudio_LIBRARIES})
INSTALL(TARGETS audio-api
LIBRARY DESTINATION ${plugin_install_dir})
diff --git a/plugins/audio/audio-api.c b/plugins/audio/audio-api.c
index 4eeed92d..8956f809 100644
--- a/plugins/audio/audio-api.c
+++ b/plugins/audio/audio-api.c
@@ -349,7 +349,7 @@ static const struct AFB_plugin pluginDesc = {
}
};
-const struct AFB_plugin *pluginAfbV1Entry (const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Register (const struct AFB_interface *itf)
{
return &pluginDesc;
}
diff --git a/plugins/audio/export.map b/plugins/audio/export.map
new file mode 100644
index 00000000..e2da85ca
--- /dev/null
+++ b/plugins/audio/export.map
@@ -0,0 +1 @@
+{ global: pluginAfbV1Register; local: *; };
diff --git a/plugins/media/CMakeLists.txt b/plugins/media/CMakeLists.txt
index a6fc34ed..5febc02d 100644
--- a/plugins/media/CMakeLists.txt
+++ b/plugins/media/CMakeLists.txt
@@ -1,9 +1,17 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(gupnp gupnp-1.0 gupnp-av-1.0 gssdp-1.0 gobject-2.0 gio-2.0)
+
IF(gupnp_FOUND)
+ MESSAGE(STATUS "gupnp found ; will compile Media plugin... (PLUGIN)")
+
+ INCLUDE_DIRECTORIES( ${include_dirs} ${gupnp_INCLUDE_DIRS})
ADD_LIBRARY(media-api MODULE media-api.c media-rygel.c)
- SET_TARGET_PROPERTIES(media-api PROPERTIES PREFIX "")
- TARGET_LINK_LIBRARIES(media-api ${link_libraries})
- INCLUDE_DIRECTORIES(${include_dirs})
+ SET_TARGET_PROPERTIES(media-api PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
+ )
+ TARGET_LINK_LIBRARIES(media-api ${link_libraries} ${gupnp_LIBRARIES})
INSTALL(TARGETS media-api
LIBRARY DESTINATION ${plugin_install_dir})
diff --git a/plugins/media/export.map b/plugins/media/export.map
new file mode 100644
index 00000000..e2da85ca
--- /dev/null
+++ b/plugins/media/export.map
@@ -0,0 +1 @@
+{ global: pluginAfbV1Register; local: *; };
diff --git a/plugins/media/media-api.c b/plugins/media/media-api.c
index dace151f..6ba8d1e0 100644
--- a/plugins/media/media-api.c
+++ b/plugins/media/media-api.c
@@ -323,7 +323,7 @@ static const struct AFB_plugin pluginDesc = {
}
};
-const struct AFB_plugin *pluginAfbV1Entry (const struct AFB_interface *itf)
+const struct AFB_plugin *pluginAfbV1Register (const struct AFB_interface *itf)
{
return &pluginDesc;
}
diff --git a/plugins/radio/CMakeLists.txt b/plugins/radio/CMakeLists.txt
index 04d0fa21..d86ca2b5 100644
--- a/plugins/radio/CMakeLists.txt
+++ b/plugins/radio/CMakeLists.txt
@@ -1,9 +1,16 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(librtlsdr librtlsdr>=0.5.0)
+
IF(librtlsdr_FOUND)
+ MESSAGE(STATUS "librtlsdr found ; will compile Radio plugin... (PLUGIN)")
+ INCLUDE_DIRECTORIES(${include_dirs} ${librtlsdr_INCLUDE_DIRS})
ADD_LIBRARY(radio-api MODULE radio-api.c radio-rtlsdr.c)
- SET_TARGET_PROPERTIES(radio-api PROPERTIES PREFIX "")
- TARGET_LINK_LIBRARIES(radio-api ${link_libraries})
- INCLUDE_DIRECTORIES(${include_dirs})
+ SET_TARGET_PROPERTIES(radio-api PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
+ )
+ TARGET_LINK_LIBRARIES(radio-api ${link_libraries} ${librtlsdr_LIBRARIES})
INSTALL(TARGETS radio-api
LIBRARY DESTINATION ${plugin_install_dir})
diff --git a/plugins/radio/export.map b/plugins/radio/export.map
new file mode 100644
index 00000000..e2da85ca
--- /dev/null
+++ b/plugins/radio/export.map
@@ -0,0 +1 @@
+{ global: pluginAfbV1Register; local: *; };
diff --git a/plugins/samples/CMakeLists.txt b/plugins/samples/CMakeLists.txt
index c3c305ca..271fb850 100644
--- a/plugins/samples/CMakeLists.txt
+++ b/plugins/samples/CMakeLists.txt
@@ -1,19 +1,29 @@
+
INCLUDE_DIRECTORIES(${include_dirs})
ADD_LIBRARY(helloWorld-api MODULE HelloWorld.c)
-SET_TARGET_PROPERTIES(helloWorld-api PROPERTIES PREFIX "")
+SET_TARGET_PROPERTIES(helloWorld-api PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
+)
TARGET_LINK_LIBRARIES(helloWorld-api ${link_libraries})
INSTALL(TARGETS helloWorld-api
LIBRARY DESTINATION ${plugin_install_dir})
ADD_LIBRARY(samplePost-api MODULE SamplePost.c)
-SET_TARGET_PROPERTIES(samplePost-api PROPERTIES PREFIX "")
+SET_TARGET_PROPERTIES(samplePost-api PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
+)
TARGET_LINK_LIBRARIES(samplePost-api ${link_libraries})
INSTALL(TARGETS samplePost-api
LIBRARY DESTINATION ${plugin_install_dir})
ADD_LIBRARY(clientCtx-api MODULE ClientCtx.c)
-SET_TARGET_PROPERTIES(clientCtx-api PROPERTIES PREFIX "")
+SET_TARGET_PROPERTIES(clientCtx-api PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
+)
TARGET_LINK_LIBRARIES(clientCtx-api ${link_libraries})
INSTALL(TARGETS clientCtx-api
LIBRARY DESTINATION ${plugin_install_dir})
diff --git a/plugins/samples/export.map b/plugins/samples/export.map
new file mode 100644
index 00000000..e2da85ca
--- /dev/null
+++ b/plugins/samples/export.map
@@ -0,0 +1 @@
+{ global: pluginAfbV1Register; local: *; };
diff --git a/plugins/session/CMakeLists.txt b/plugins/session/CMakeLists.txt
index ab0596e6..e13a16b3 100644
--- a/plugins/session/CMakeLists.txt
+++ b/plugins/session/CMakeLists.txt
@@ -1,6 +1,9 @@
ADD_LIBRARY(token-api MODULE token-api.c)
-SET_TARGET_PROPERTIES(token-api PROPERTIES PREFIX "")
+SET_TARGET_PROPERTIES(token-api PROPERTIES
+ PREFIX ""
+ LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
+)
TARGET_LINK_LIBRARIES(token-api ${link_libraries})
INCLUDE_DIRECTORIES(${include_dirs})
INSTALL(TARGETS token-api
diff --git a/plugins/session/export.map b/plugins/session/export.map
new file mode 100644
index 00000000..e2da85ca
--- /dev/null
+++ b/plugins/session/export.map
@@ -0,0 +1 @@
+{ global: pluginAfbV1Register; local: *; };
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a1abf45c..94ed5a56 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,33 @@
-ADD_LIBRARY(afb-lib OBJECT
+INCLUDE(FindPkgConfig)
+
+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)
+
+PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222)
+PKG_CHECK_MODULES(libmicrohttpd REQUIRED libmicrohttpd>=0.9.48)
+PKG_CHECK_MODULES(openssl REQUIRED openssl)
+PKG_CHECK_MODULES(uuid REQUIRED uuid)
+
+INCLUDE_DIRECTORIES(
+ ${include_dirs}
+ ${libsystemd_INCLUDE_DIRS}
+ ${libmicrohttpd_INCLUDE_DIRS}
+ ${uuid_INCLUDE_DIRS}
+ ${openssl_INCLUDE_DIRS}
+)
+
+ADD_LIBRARY(afb-lib STATIC
afb-api-dbus.c
afb-api-so.c
afb-apis.c
@@ -21,19 +49,26 @@ ADD_LIBRARY(afb-lib OBJECT
websock.c
)
-
-INCLUDE_DIRECTORIES(${include_dirs})
-
-ADD_EXECUTABLE(afb-daemon $<TARGET_OBJECTS:afb-lib> main.c)
-INCLUDE_DIRECTORIES(${include_dirs})
-TARGET_LINK_LIBRARIES(afb-daemon ${link_libraries})
-
-ADD_EXECUTABLE(afb-client-demo $<TARGET_OBJECTS:afb-lib> afb-client-demo.c)
-INCLUDE_DIRECTORIES(${include_dirs})
-TARGET_LINK_LIBRARIES(afb-client-demo ${link_libraries})
-
+ADD_EXECUTABLE(afb-daemon main.c)
+TARGET_LINK_LIBRARIES(afb-daemon
+ afb-lib
+ ${link_libraries}
+ ${libsystemd_LIBRARIES}
+ ${libmicrohttpd_LIBRARIES}
+ ${uuid_LIBRARIES}
+ ${openssl_LIBRARIES}
+ -lmagic
+ -ldl
+ -lrt
+)
INSTALL(TARGETS afb-daemon
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ADD_EXECUTABLE(afb-client-demo afb-client-demo.c)
+TARGET_LINK_LIBRARIES(afb-client-demo
+ afb-lib
+ ${link_libraries}
+ ${libsystemd_LIBRARIES}
+)
INSTALL(TARGETS afb-client-demo
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})