summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-16 09:25:02 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-16 09:25:02 +0100
commit3d037dbe86665b59c6bb5d71f3d58558a5848d38 (patch)
tree648e1252c1cf6f9637ffc93c994d41dc206454c8 /src
parent54a229b3864fe7867da69ef7427877094a256f1c (diff)
downloaduca-3d037dbe86665b59c6bb5d71f3d58558a5848d38.tar.gz
uca-3d037dbe86665b59c6bb5d71f3d58558a5848d38.tar.bz2
uca-3d037dbe86665b59c6bb5d71f3d58558a5848d38.tar.xz
uca-3d037dbe86665b59c6bb5d71f3d58558a5848d38.zip
Add soft MJSON dependency to load configuration/calibration data
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt57
-rw-r--r--src/config.h.in2
-rw-r--r--src/uca.c6
-rw-r--r--src/uca.h6
4 files changed, 38 insertions, 33 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 55cc2af..fdc19dd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -32,8 +32,9 @@ find_package(FgLib5)
find_package(ClSerMe4)
# --- Miscellanous packages
-find_package(SWIG)
-find_package(PythonLibs)
+find_package(PkgConfig)
+
+pkg_check_modules(MJSON mjson-1.2)
# --- Build options -----------------------------------------------------------
@@ -54,13 +55,10 @@ if (PF_FOUND)
${PF_LIBRARIES}
)
- include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${PF_INCLUDE_DIRS}
- )
+ include_directories(${PF_INCLUDE_DIRS})
endif()
-if(PCO_FOUND)
+if (PCO_FOUND)
set(HAVE_PCO_EDGE TRUE)
set(uca_SRCS
@@ -73,13 +71,10 @@ if(PCO_FOUND)
${PCO_LIBRARIES}
)
- include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${PCO_INCLUDE_DIRS}
- )
+ include_directories(${PCO_INCLUDE_DIRS})
endif()
-if(IPE_FOUND)
+if (IPE_FOUND)
set(HAVE_IPE_CAMERA TRUE)
set(uca_SRCS
@@ -91,13 +86,11 @@ if(IPE_FOUND)
${uca_LIBS}
${IPE_LIBRARIES}
)
- include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${IPE_INCLUDE_DIRS}
- )
+
+ include_directories(${IPE_INCLUDE_DIRS})
endif()
-if(CLSERME4_FOUND AND FGLIB5_FOUND)
+if (CLSERME4_FOUND AND FGLIB5_FOUND)
set(HAVE_ME4 TRUE)
set(uca_SRCS
@@ -112,35 +105,37 @@ if(CLSERME4_FOUND AND FGLIB5_FOUND)
)
include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
${CLSERME4_INCLUDE_DIR}
${FGLIB5_INCLUDE_DIR}
)
endif()
-if(HAVE_DUMMY_CAMERA)
+if (HAVE_DUMMY_CAMERA)
set(uca_SRCS
${uca_SRCS}
cameras/dummy.c
)
endif()
+if (MJSON_FOUND)
+ set(HAVE_MJSON TRUE)
+
+ set(uca_LIBS
+ ${uca_LIBS}
+ ${MJSON_LIBRARIES}
+ )
+
+ include_directories(${MJSON_INCLUDE_DIRS})
+endif()
+
# --- Configure step
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
-# --- Build language bindings via SWIG
-if(SWIG_FOUND AND PYTHONLIBS_FOUND)
- include(${SWIG_USE_FILE})
- include_directories(${PYTHON_INCLUDE_DIR})
- set(CMAKE_SWIG_FLAGS "")
-
- set_source_files_properties(uca.i PROPERTIES CPLUSPLUS ON)
- SWIG_ADD_MODULE(uca python uca.i ${uca_SRCS})
- SWIG_LINK_LIBRARIES(uca ${PYTHON_LIBRARIES} ${uca_LIBS})
-endif()
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ )
# --- Build target ------------------------------------------------------------
add_definitions("-std=c99 -Wall")
diff --git a/src/config.h.in b/src/config.h.in
index 58d975d..dcf8696 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -7,3 +7,5 @@
#cmakedefine HAVE_IPE_CAMERA
#cmakedefine HAVE_DUMMY_CAMERA
+
+#cmakedefine HAVE_MJSON
diff --git a/src/uca.c b/src/uca.c
index cf6e5ec..0f02ce1 100644
--- a/src/uca.c
+++ b/src/uca.c
@@ -6,6 +6,10 @@
#include "uca-cam.h"
#include "uca-grabber.h"
+#ifdef HAVE_MJSON
+#include "json.h"
+#endif
+
#ifdef HAVE_DUMMY_CAMERA
#include "cameras/dummy.h"
#endif
@@ -86,7 +90,7 @@ static struct uca_property_t property_map[UCA_PROP_LAST+1] = {
{ NULL, 0, 0, 0 }
};
-struct uca_t *uca_init(void)
+struct uca_t *uca_init(const char *config_filename)
{
struct uca_t *uca = (struct uca_t *) malloc(sizeof(struct uca_t));
uca->cameras = NULL;
diff --git a/src/uca.h b/src/uca.h
index ab59dc7..06904bc 100644
--- a/src/uca.h
+++ b/src/uca.h
@@ -123,9 +123,13 @@ enum uca_property_ids {
/**
* Initialize the unified camera access interface.
*
+ * \param[in] config_filename Configuration file in JSON format for cameras
+ * relying on external calibration data. It is ignored when no JSON parser can
+ * be found at compile time or config_filename is NULL.
+ *
* \return Pointer to a uca_t structure
*/
-struct uca_t *uca_init(void);
+struct uca_t *uca_init(const char *config_filename);
/**
* \brief Free resources of the unified camera access interface