diff options
-rw-r--r-- | .bzrignore | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 32 | ||||
-rw-r--r-- | cmake/version.cmake | 12 | ||||
-rw-r--r-- | ipecamera.pc.in | 10 | ||||
-rw-r--r-- | model.c | 5 | ||||
-rw-r--r-- | version.h.in | 12 |
6 files changed, 71 insertions, 2 deletions
@@ -4,3 +4,5 @@ cmake_install.cmake CMakeCache.txt install_manifest.txt grab +ipecamera.pc +version.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bcfc15..610baa1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,10 @@ pkg_check_modules(UFODECODE ufodecode>=0.3 REQUIRED) pkg_check_modules(PCILIB pcitool>=0.2 REQUIRED) exec_program("pkg-config --variable=plugindir pcitool" OUTPUT_VARIABLE PCILIB_PLUGIN_DIR) +include(cmake/version.cmake) +VERSION_TO_VARS(${IPECAMERA_VERSION} IPECAMERA_VERSION_MAJOR IPECAMERA_VERSION_MINOR IPECAMERA_VERSION_MICRO) + + add_subdirectory(apps) include_directories( @@ -26,7 +30,7 @@ link_directories( ${PCILIB_LIBRARY_DIRS} ) -set(HEADERS ${HEADERS} model.h cmosis.h base.h reader.h events.h data.h private.h ipecamera.h) +set(HEADERS ${HEADERS} model.h cmosis.h base.h reader.h events.h data.h private.h ipecamera.h version.h) add_library(ipecamera SHARED model.c cmosis.c base.c reader.c events.c data.c) @@ -40,3 +44,29 @@ install(TARGETS ipecamera DESTINATION ${PCILIB_PLUGIN_DIR} ) +set(TARNAME "ipecamera") +set(PACKAGE_VERSION ${IPECAMERA_VERSION}) +set(PACKAGE_NAME "${TARNAME}") +set(PACKAGE_TARNAME "${TARNAME}") +set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") +set(PACKAGE_BUGREPORT "http://ufo.kit.edu/ufo/newticket") + +if(NOT DEFINED BIN_INSTALL_DIR) + set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin") +endif(NOT DEFINED BIN_INSTALL_DIR) + +if(NOT DEFINED LIB_INSTALL_DIR) + set(LIB_INSTALL_DIR "${LIB_INSTALL_DIR}") +endif(NOT DEFINED LIB_INSTALL_DIR) + +if(NOT DEFINED INCLUDE_INSTALL_DIR) + set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include") +endif(NOT DEFINED INCLUDE_INSTALL_DIR) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ipecamera.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ipecamera.pc) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/ipecamera.pc + DESTINATION ${LIB_INSTALL_DIR}/pkgconfig +) diff --git a/cmake/version.cmake b/cmake/version.cmake new file mode 100644 index 0000000..9023aef --- /dev/null +++ b/cmake/version.cmake @@ -0,0 +1,12 @@ +SET(VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+") + +MACRO(VERSION_TO_VARS version major minor patch) + IF(${version} MATCHES ${VERSION_REGEX}) + STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ${major} "${version}") + STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" ${minor} "${version}") + STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ${patch} "${version}") + ELSE(${version} MATCHES ${VERSION_REGEX}) + MESSAGE("MACRO(VERSION_TO_VARS ${version} ${major} ${minor} ${patch}") + MESSAGE(FATAL_ERROR "Problem parsing version string, I can't parse it properly.") + ENDIF(${version} MATCHES ${VERSION_REGEX}) +ENDMACRO(VERSION_TO_VARS) diff --git a/ipecamera.pc.in b/ipecamera.pc.in new file mode 100644 index 0000000..6d34409 --- /dev/null +++ b/ipecamera.pc.in @@ -0,0 +1,10 @@ +prefix=${CMAKE_INSTALL_PREFIX} +exec_prefix=${BIN_INSTALL_DIR} +libdir=${PCILIB_PLUGIN_DIR} +includedir=${INCLUDE_INSTALL_DIR} + +Name: ${TARNAME} +Description: IPECamera event engine for pcilib +Version: ${PACKAGE_VERSION} +Libs: -L${PCILIB_PLUGIN_DIR} -lipecamera +Cflags: -I${INCLUDE_INSTALL_DIR} @@ -6,6 +6,7 @@ #include "base.h" #include "cmosis.h" #include "model.h" +#include "version.h" enum ipecamera_protocol_s { IPECAMERA_PROTOCOL_CMOSIS = PCILIB_REGISTER_PROTOCOL0, @@ -13,7 +14,7 @@ enum ipecamera_protocol_s { static const pcilib_register_protocol_api_description_t ipecamera_cmosis_protocol_api = - { NULL, NULL, ipecamera_cmosis_read, ipecamera_cmosis_write }; + { IPECAMERA_VERSION, NULL, NULL, ipecamera_cmosis_read, ipecamera_cmosis_write }; /* static const pcilib_dma_description_t ipecamera_dma = @@ -150,6 +151,8 @@ static const pcilib_event_data_type_description_t ipecamera_data_types[] = { }; pcilib_event_api_description_t ipecamera_image_api = { + IPECAMERA_VERSION, + ipecamera_init, ipecamera_free, diff --git a/version.h.in b/version.h.in new file mode 100644 index 0000000..c6711a1 --- /dev/null +++ b/version.h.in @@ -0,0 +1,12 @@ +#ifndef _IPECAMERA_VERSION_H +#define _IPECAMERA_VERSION_H + +#include <pcilib/version.h> + +#define IPECAMERA_VERSION_MAJOR ${IPECAMERA_VERSION_MAJOR} +#define IPECAMERA_VERSION_MINOR ${IPECAMERA_VERSION_MINOR} +#define IPECAMERA_VERSION_MICRO ${IPECAMERA_VERSION_MICRO} + +#define IPECAMERA_VERSION PCILIB_MAKE_VERSION(IPECAMERA_VERSION_MAJOR, IPECAMERA_VERSION_MINOR, IPECAMERA_VERSION_MICRO) + +#endif /* _IPECAMERA_VERSION_H */ |