Commit a28319f4 authored by Patrik Huber's avatar Patrik Huber

Created utils/ directory and moved scm-to-cereal there

Added a BUILD_UTILS CMake option, defaulting to OFF.
parent a7f33122
...@@ -54,6 +54,8 @@ endif() ...@@ -54,6 +54,8 @@ endif()
message(STATUS "Options:") message(STATUS "Options:")
option(BUILD_EXAMPLES "Build the example applications." ON) option(BUILD_EXAMPLES "Build the example applications." ON)
message(STATUS "BUILD_EXAMPLES: ${BUILD_EXAMPLES}") message(STATUS "BUILD_EXAMPLES: ${BUILD_EXAMPLES}")
option(BUILD_UTILS "Build utility applications." OFF)
message(STATUS "BUILD_UTILS: ${BUILD_UTILS}")
option(BUILD_DOCUMENTATION "Build the library documentation." OFF) option(BUILD_DOCUMENTATION "Build the library documentation." OFF)
message(STATUS "BUILD_DOCUMENTATION: ${BUILD_DOCUMENTATION}") message(STATUS "BUILD_DOCUMENTATION: ${BUILD_DOCUMENTATION}")
...@@ -147,6 +149,10 @@ if(BUILD_EXAMPLES) ...@@ -147,6 +149,10 @@ if(BUILD_EXAMPLES)
add_subdirectory(examples) add_subdirectory(examples)
endif() endif()
if(BUILD_UTILS)
add_subdirectory(utils)
endif()
if(BUILD_DOCUMENTATION) if(BUILD_DOCUMENTATION)
add_subdirectory(doc) add_subdirectory(doc)
endif() endif()
...@@ -37,11 +37,7 @@ endif() ...@@ -37,11 +37,7 @@ endif()
add_executable(fit-model fit-model.cpp) add_executable(fit-model fit-model.cpp)
target_link_libraries(fit-model ${OpenCV_LIBS} ${Boost_LIBRARIES}) target_link_libraries(fit-model ${OpenCV_LIBS} ${Boost_LIBRARIES})
# 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 ${OpenCV_LIBS} ${Boost_LIBRARIES})
# install target: # install target:
install(TARGETS fit-model DESTINATION bin) install(TARGETS fit-model DESTINATION bin)
install(TARGETS scm-to-cereal DESTINATION bin)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/examples/data DESTINATION bin) install(DIRECTORY ${CMAKE_SOURCE_DIR}/examples/data DESTINATION bin)
...@@ -19,4 +19,5 @@ ...@@ -19,4 +19,5 @@
# Configuration options # Configuration options
# ============================== # ==============================
set(BUILD_EXAMPLES ON CACHE BOOL "Build the example applications." FORCE) set(BUILD_EXAMPLES ON CACHE BOOL "Build the example applications." FORCE)
set(BUILD_UTILS OFF CACHE BOOL "Build utility applications." FORCE)
set(BUILD_DOCUMENTATION OFF CACHE BOOL "Build the library documentation." FORCE) set(BUILD_DOCUMENTATION OFF CACHE BOOL "Build the library documentation." FORCE)
project(utils)
cmake_minimum_required(VERSION 2.8.10)
# The utils need a few additional dependencies (e.g. boost filesystem and OpenCV highgui):
#check installed version in order to include the correct OpenCV libraries
#version variable is defined from project root's CMakeLists
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.0.0 REQUIRED core imgproc imgcodecs)
endif()
message(STATUS "OpenCV include dir found at ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV lib dir found at ${OpenCV_LIB_DIR}")
# 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)
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.
endif()
find_package(Boost 1.50.0 COMPONENTS system filesystem program_options REQUIRED)
if(Boost_FOUND)
message(STATUS "Boost found at ${Boost_INCLUDE_DIRS}")
else(Boost_FOUND)
message(FATAL_ERROR "Boost not found")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
endif()
# 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 ${OpenCV_LIBS} ${Boost_LIBRARIES})
# install target:
install(TARGETS scm-to-cereal DESTINATION bin)
/* /*
* Eos - A 3D Morphable Model fitting library written in modern C++11/14. * Eos - A 3D Morphable Model fitting library written in modern C++11/14.
* *
* File: examples/scm-to-cereal.cpp * File: utils/scm-to-cereal.cpp
* *
* Copyright 2015 Patrik Huber * Copyright 2015 Patrik Huber
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment