Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial structure of the image_pipeline standalone library.

  • Loading branch information...
commit f5392f51f62c4b1a138153bc351c848b2d790f04 1 parent cf964f3
@ethanrublee ethanrublee authored
View
31 CMakeLists.txt
@@ -0,0 +1,31 @@
+cmake_minimum_required(VERSION 2.8)
+project(image_pipeline)
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
+ FORCE)
+endif()
+
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+
+add_definitions("-Wall -Werror")
+
+find_package(Boost REQUIRED)
+find_package(Eigen REQUIRED)
+find_package(OpenCV REQUIRED)
+
+include_directories(
+ include
+ ${EIGEN_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+ )
+
+add_subdirectory(src)
+
+option(BUILD_TEST "Build tests" ON)
+if(BUILD_TEST)
+ enable_testing()
+ add_subdirectory(test)
+endif()
View
30 include/image_pipeline/abi.hpp
@@ -0,0 +1,30 @@
+#pragma once
+#include <stdexcept>
+namespace image_pipeline
+{
+ const static unsigned abi_version = 0; // incrementable ABI version
+
+ // exception to be thrown in case of detected incompatiblity
+ struct incompatible_version : std::exception
+ {
+ unsigned compiled_version, running_version;
+ incompatible_version(unsigned compiledwith, unsigned runningwith);
+ virtual const char* what() const throw();
+ };
+
+ // object that checks ABI version in its constructor
+ struct abi_checker {
+ abi_checker(unsigned version);
+ };
+
+// CMake will define foo_EXPORTS when compiling foo itself (and not
+// when compiling *against* Foo. So this will save us a very small amount
+// of space inside libfoo itself, but it doesn't hurt if they are there.
+#ifndef image_pipeline_EXPORTS
+ // an instance of this object... there will be one in each
+ // translation unit that compiles against this header
+ namespace {
+ abi_checker checker(abi_version);
+ }
+#endif //image_pipeline_EXPORTS
+}
View
5 include/image_pipeline/image_pipeline.hpp
@@ -0,0 +1,5 @@
+#pragma once
+#include <image_pipeline/abi.hpp>
+namespace image_pipeline
+{
+}
View
1  readme.rst
@@ -24,6 +24,7 @@ requires
* cmake
* Eigen3 http://eigen.tuxfamily.org/
* OpenCV > 2.3 http://opencv.willowgarage.com/wiki/
+* *optional* gtest
* *optional* ecto https://github.com/plasmodic/ecto
build it
View
9 src/CMakeLists.txt
@@ -0,0 +1,9 @@
+
+add_library(image_pipeline
+ abi.cpp
+ )
+
+target_link_libraries(image_pipeline
+ ${OpenCV_LIBS}
+ )
+
View
21 src/abi.cpp
@@ -0,0 +1,21 @@
+#include <image_pipeline/abi.hpp>
+#include <stdexcept>
+
+namespace image_pipeline {
+
+ abi_checker::abi_checker(unsigned running_version)
+ {
+ if (running_version != abi_version)
+ throw incompatible_version(running_version, abi_version);
+ };
+
+ incompatible_version::incompatible_version(unsigned c, unsigned r)
+ : compiled_version(c), running_version(r)
+ { }
+
+ const char* incompatible_version::what() const throw() {
+ return "Runtime version ofimage_pipeline is incompatible with"
+ " the compiletime version of image_pipeline. Check "
+ "the contents of your runtime link path.";
+ }
+}
View
21 test/CMakeLists.txt
@@ -0,0 +1,21 @@
+find_package(GTest)
+
+if(NOT GTEST_FOUND)
+ message(STATUS "Disabling testing since gtest was not found.")
+ return()
+endif()
+
+include_directories(${GTEST_INCLUDE_DIRS})
+
+add_executable(image_pipeline-test
+ main.cpp
+ pinhole.cpp
+ )
+
+target_link_libraries(image_pipeline-test
+ image_pipeline
+ ${OpenCV_LIBS}
+ ${GTEST_LIBRARIES}
+ )
+
+add_test(image_pipeline-test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/image_pipeline-test)
View
7 test/main.cpp
@@ -0,0 +1,7 @@
+#include <gtest/gtest.h>
+
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
View
8 test/pinhole.cpp
@@ -0,0 +1,8 @@
+#include <gtest/gtest.h>
+#include <image_pipeline/image_pipeline.hpp>
+
+TEST(pinhole, Serialize)
+{
+ std::cout << "Hello"<<std::endl;
+ EXPECT_TRUE(true);
+}
Please sign in to comment.
Something went wrong with that request. Please try again.