summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt30
-rw-r--r--plugins/pco/CMakeLists.txt12
-rw-r--r--plugins/pco/uca-pco-camera.c2
-rw-r--r--src/CMakeLists.txt26
4 files changed, 43 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b5f435..1dac9e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,36 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/package.sh.in
add_definitions("-std=c99 -Wall")
+# --- Common macros
+
+# create_enums
+# @prefix: prefix of the output enum files
+# @template_prefix: prefix of the template (should be src/uca-enums)
+# @header_list: list with header files that should be searched for enums
+macro(create_enums prefix template_prefix header_list)
+ ${CMAKE_CURRENT_SOURCE_DIR}")
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h
+ COMMAND ${GLIB2_MKENUMS}
+ ARGS
+ --template ${template_prefix}.h.template
+ ${header_list} > ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${header_list})
+
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.c
+ COMMAND ${GLIB2_MKENUMS}
+ ARGS
+ --template ${template_prefix}.c.template
+ ${header_list} > ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.c
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${header_list}
+ ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h
+ )
+endmacro()
+
+
# --- Common libraries --------------------------------------------------------
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
diff --git a/plugins/pco/CMakeLists.txt b/plugins/pco/CMakeLists.txt
index 040026f..9207ff0 100644
--- a/plugins/pco/CMakeLists.txt
+++ b/plugins/pco/CMakeLists.txt
@@ -13,13 +13,19 @@ if (PCO_FOUND AND CLSERME4_FOUND AND FGLIB5_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../package-plugin.sh.in
${CMAKE_CURRENT_BINARY_DIR}/../../package-plugin-${UCA_CAMERA_NAME}.sh)
-
include_directories(${PCO_INCLUDE_DIRS}
${CLSERME4_INCLUDE_DIR}
- ${FGLIB5_INCLUDE_DIR})
+ ${FGLIB5_INCLUDE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR})
+
+ create_enums(uca-pco-enums
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/uca-enums
+ uca-pco-camera.h)
add_library(ucapco SHARED
- uca-pco-camera.c)
+ uca-pco-camera.c
+ uca-pco-enums.c)
target_link_libraries(ucapco
${UCA_DEPS}
diff --git a/plugins/pco/uca-pco-camera.c b/plugins/pco/uca-pco-camera.c
index 3eee186..137bddc 100644
--- a/plugins/pco/uca-pco-camera.c
+++ b/plugins/pco/uca-pco-camera.c
@@ -25,7 +25,7 @@
#include <fgrab_prototyp.h>
#include "uca-camera.h"
#include "uca-pco-camera.h"
-#include "uca-enums.h"
+#include "uca-pco-enums.h"
#define FG_TRY_PARAM(fg, error, param, val_addr, port) \
{ int r = Fg_setParameter(fg, param, val_addr, port); \
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 443025d..6d4d6b9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -11,29 +11,9 @@ set(uca_HDRS
uca-camera.h
uca-plugin-manager.h)
-# --- Generate enum file
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/uca-enums.h
- COMMAND ${GLIB2_MKENUMS}
- ARGS
- --template uca-enums.h.template
- ${UCA_ENUM_HDRS} > ${CMAKE_CURRENT_BINARY_DIR}/uca-enums.h
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ${UCA_ENUM_HDRS}
- ${CMAKE_CURRENT_SOURCE_DIR}/uca-enums.h.template)
-
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/uca-enums.c
- COMMAND ${GLIB2_MKENUMS}
- ARGS
- --template uca-enums.c.template
- ${UCA_ENUM_HDRS} > ${CMAKE_CURRENT_BINARY_DIR}/uca-enums.c
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ${UCA_ENUM_HDRS}
- ${CMAKE_CURRENT_BINARY_DIR}/uca-enums.h
- ${CMAKE_CURRENT_SOURCE_DIR}/uca-enums.c.template
- )
-
+create_enums(uca-enums
+ ${CMAKE_CURRENT_SOURCE_DIR}/uca-enums
+ ${uca_HDRS})
# --- Configure ---------------------------------------------------------------