-
Notifications
You must be signed in to change notification settings - Fork 18
/
CMakeLists.txt
116 lines (95 loc) · 3.59 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
cmake_minimum_required (VERSION 2.8)
project (MVP)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -g -O3")
include(MvpHelpers)
###
### Load configuration
### TODO: Do the right way
if (EXISTS ${CMAKE_BINARY_DIR}/config.cmake)
include (${CMAKE_BINARY_DIR}/config.cmake)
endif()
###
### Find Packages
###
find_package(VW REQUIRED COMPONENTS Cartography Camera Plate Image Math FileIO Core)
find_package(Boost REQUIRED COMPONENTS program_options regex filesystem system thread)
find_package(Protobuf REQUIRED)
find_package(ZeroMQ REQUIRED)
find_package(Octave)
###
### Set Options
###
option(BINARY_DIR_INSTALL "Install in the build directory" OFF)
option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Use the link path as the rpath in the install" ON)
# the RPATH to be used when installing, but only if it's not a system directory
# see http://www.cmake.org/Wiki/CMake_RPATH_handling#Always_full_RPATH
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()
# ENABLE_OCTAVE_SUPPORT
if (OCTAVE_FOUND)
option(ENABLE_OCTAVE_SUPPORT "Build the MVP with octave support" ON)
else()
option(ENABLE_OCTAVE_SUPPORT "Build the MVP with octave support" OFF)
endif()
option(BUILD_PYTHON_APPS "Build python apps" OFF)
if (BUILD_PYTHON_APPS)
# PYTHON_INSTALL_DIR
# TODO: CACHE variable?
set(PYTHON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/mvp/python)
endif()
# MFILE_INSTALL_DIR, OCTFILE_INSTALL_DIR
if (ENABLE_OCTAVE_SUPPORT)
set(MFILE_INSTALL_DIR ${OCTAVE_MFILE_DIR}/mvp CACHE PATH "Install prefix for octave m-files")
set(OCTFILE_INSTALL_DIR ${OCTAVE_OCTFILE_DIR} CACHE PATH "Install prefix for octive oct-files")
mark_as_advanced(CLEAR FORCE MFILE_INSTALL_DIR
OCTFILE_INSTALL_DIR)
else()
set(MFILE_INSTALL_DIR "NOTFOUND" CACHE PATH "Install prefix for octave m-files")
set(OCTFILE_INSTALL_DIR "NOTFOUND" CACHE PATH "Install prefix for octave oct-files")
mark_as_advanced(FORCE MFILE_INSTALL_DIR
OCTFILE_INSTALL_DIR)
endif()
# Force settings if BINARY_DIR_INSTALL, otherwise make them available
if (BINARY_DIR_INSTALL)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/usr CACHE PATH "Install prefix" FORCE)
if (ENABLE_OCTAVE_SUPPORT)
set(MFILE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/mvp/m CACHE PATH "Install prefix for octave m-files" FORCE)
set(OCTFILE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/mvp/oct CACHE PATH "Install prefix for octave oct-files" FORCE)
endif()
mark_as_advanced(FORCE CMAKE_INSTALL_PREFIX
MFILE_INSTALL_DIR
OCTFILE_INSTALL_DIR)
else()
mark_as_advanced(CLEAR FORCE CMAKE_INSTALL_PREFIX)
if (ENABLE_OCTAVE_SUPPORT)
mark_as_advanced(CLEAR FORCE MFILE_INSTALL_DIR
OCTFILE_INSTALL_DIR)
endif()
endif()
###
### Testing
###
option(BUILD_TESTS "Build tests" OFF)
if (BUILD_TESTS)
enable_testing()
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/gtest/include)
endif()
###
### Add include paths and subdirs to build
###
include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${CMAKE_BINARY_DIR}/src)
include_directories(${VW_INCLUDE_DIRS})
include_directories(${PROTOBUF_INCLUDE_DIRS})
include_directories(${ZEROMQ_INCLUDE_DIRS})
if (ENABLE_OCTAVE_SUPPORT)
include_directories(${OCTAVE_INCLUDE_DIRS})
link_directories(${OCTAVE_LIBRARY_DIRS})
endif()
add_subdirectory(src)
if (BUILD_PYTHON_APPS)
add_subdirectory(python)
endif()