diff options
-rw-r--r-- | src/CMakeLists.txt | 57 | ||||
-rw-r--r-- | src/config.h.in | 2 | ||||
-rw-r--r-- | src/uca.c | 6 | ||||
-rw-r--r-- | src/uca.h | 6 | ||||
-rw-r--r-- | test/control.c | 2 | ||||
-rw-r--r-- | test/enum.c | 2 | ||||
-rw-r--r-- | test/grab.c | 2 |
7 files changed, 41 insertions, 36 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 @@ -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; @@ -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 diff --git a/test/control.c b/test/control.c index 6024c08..98daffd 100644 --- a/test/control.c +++ b/test/control.c @@ -274,7 +274,7 @@ void value_cell_data_func(GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkT int main(int argc, char *argv[]) { - struct uca_t *uca = uca_init(); + struct uca_t *uca = uca_init(NULL); if (uca == NULL) { g_print("Couldn't initialize frame grabber and/or cameras\n"); return 1; diff --git a/test/enum.c b/test/enum.c index 1164399..88f226e 100644 --- a/test/enum.c +++ b/test/enum.c @@ -21,7 +21,7 @@ void print_level(int depth) int main(int argc, char *argv[]) { - struct uca_t *uca = uca_init(); + struct uca_t *uca = uca_init(NULL); if (uca == NULL) { printf("Couldn't find a camera\n"); return 1; diff --git a/test/grab.c b/test/grab.c index 6f646c7..2994689 100644 --- a/test/grab.c +++ b/test/grab.c @@ -6,7 +6,7 @@ int main(int argc, char *argv[]) { - struct uca_t *uca = uca_init(); + struct uca_t *uca = uca_init(NULL); if (uca == NULL) { printf("Couldn't find a camera\n"); return 1; |