Skip to content

Commit

Permalink
Removed OpenCV and boost::filesystem dependency from utils
Browse files Browse the repository at this point in the history
scm-to-cereal is the only util and it now only requires boost::program_options.
  • Loading branch information
patrikhuber committed Jun 30, 2019
1 parent dd4cd62 commit d465a04
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
# The utils need a few additional dependencies (e.g. boost::split, boost filesystem, program_options, and OpenCV highgui):

# Check installed version in order to include the correct OpenCV libraries:
# First call find_package without a version to find any OpenCV. OpenCV_VERSION_MAJOR is then defined.
find_package(OpenCV REQUIRED core)
if("${OpenCV_VERSION_MAJOR}$" EQUAL 2)
message(STATUS "OpenCV 2.x detected")
find_package(OpenCV 2.4.3 REQUIRED core imgproc highgui)
elseif("${OpenCV_VERSION_MAJOR}$" EQUAL 3)
message(STATUS "OpenCV 3.x detected - including imgcodecs for compatibility")
find_package(OpenCV 3 REQUIRED core imgproc imgcodecs)
endif()
# This allows us to compile in RelWithDebInfo. It'll use the Release-version of OpenCV:
set_target_properties(${OpenCV_LIBS} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELEASE)

# scm-to-cereal needs boost::program_options:
if(MSVC)
# The standard find_package for boost on Win finds the dynamic libs, so for dynamic linking to boost we need to #define:
add_definitions(-DBOOST_ALL_NO_LIB) # Don't use the automatic library linking by boost with VS (#pragma ...). Instead, we specify everything here in cmake.
add_definitions(-DBOOST_ALL_DYN_LINK) # Link against the dynamic boost lib - needs to match with the version that find_package finds.
add_definitions(-D_HAS_AUTO_PTR_ETC) # Boost 1.65.1 still does not work with VS C++17 mode, this is the workaround
endif()
find_package(Boost 1.50.0 COMPONENTS system filesystem program_options REQUIRED)
find_package(Boost 1.50.0 COMPONENTS system program_options REQUIRED)
message(STATUS "Boost found at ${Boost_INCLUDE_DIRS}")

# Converts a CVSSP .scm Morphable Model to a cereal binary file:
add_executable(scm-to-cereal scm-to-cereal.cpp)
target_link_libraries(scm-to-cereal eos ${OpenCV_LIBS} ${Boost_LIBRARIES})
target_include_directories(scm-to-cereal PUBLIC ${OpenCV_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
target_link_libraries(scm-to-cereal eos ${Boost_LIBRARIES})
target_include_directories(scm-to-cereal PUBLIC ${Boost_INCLUDE_DIRS})

# Install targets:
install(TARGETS scm-to-cereal DESTINATION bin)

0 comments on commit d465a04

Please sign in to comment.