-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (45 loc) · 1.79 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
cmake_minimum_required(VERSION 1.8)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
add_definitions(-DOPENMP_FOUND)
endif()
option(STATIC_BUILD "Build static binary" OFF)
if(STATIC_BUILD)
set(Boost_USE_STATIC_LIBS ON)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
SET(BUILD_SHARED_LIBS OFF)
SET(CMAKE_EXE_LINKER_FLAGS "-static")
else()
add_definitions(-DBOOST_LOG_DYN_LINK)
endif()
option(USE_GPU "Compile to use GPUs" OFF)
if(USE_GPU)
add_definitions(-DUSE_GPU)
endif()
find_package(Boost 1.55 COMPONENTS log log_setup thread date_time filesystem system program_options REQUIRED)
find_package(OpenCV 2.4 REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
include_directories(${OpenCV_INCLUDE_DIR})
add_executable(besra-trainer src/besra-trainer.cpp src/besra.cpp)
target_link_libraries( besra-trainer ${Boost_LIBRARIES} ${OpenCV_LIBS} )
add_executable(besra-classify src/besra-classify.cpp src/besra.cpp)
target_link_libraries( besra-classify ${Boost_LIBRARIES} ${OpenCV_LIBS} )
if(NOT STATIC_BUILD)
add_executable(besra-view src/besra-view.cpp src/besra.cpp)
target_link_libraries( besra-view ${Boost_LIBRARIES} ${OpenCV_LIBS} )
endif()