-
Notifications
You must be signed in to change notification settings - Fork 60
/
CMakeLists.txt
103 lines (83 loc) · 2.01 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
# LBP
cmake_minimum_required(VERSION 2.8)
# project name
project(LBP)
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR} )
# find dependencies
find_path(FFTW_INCLUDE_DIR fftw3.h ${FFTW_INCLUDE_DIRS})
find_library(FFTW_LIBRARY fftw3 ${FFTW_LIBRARY_DIRS})
find_package(OpenCV REQUIRED)
INCLUDE_DIRECTORIES(
./
${FFTW_INCLUDE_DIR}
/usr/local/include
/opt/local/include
)
LINK_DIRECTORIES(
/usr/local/cuda/lib/
/opt/local/lib
)
add_library(LBP
STATIC
LBP.cpp
)
# The standard math functions are directly handled by MSVCR (ex: 'msvcr90.dll')
# 'm.lib' will cause an error if included as target link
IF(MSVC)
target_link_libraries(LBP
${OpenCV_LIBS} ${FFTW_LIBRARY}
)
ELSE()
target_link_libraries(LBP
${OpenCV_LIBS} ${FFTW_LIBRARY} m
)
ENDIF(MSVC)
add_executable(LBPTest
LBPTest.cpp
)
target_link_libraries(LBPTest
LBP
)
add_executable(LBPMain
LBPMain.cpp
)
target_link_libraries(LBPMain
LBP
)
option(BUILD_LBPGPU "Build GPU module" OFF)
if(BUILD_LBPGPU)
find_package(CUDA REQUIRED)
IF(APPLE)
SET(CUDA_HOST_COMPILER /usr/bin/clang CACHE FILEPATH "Setting clang as the CUDA compiler" FORCE)
SET(CUDA_NVCC_FLAGS "-Xcompiler -stdlib=libstdc++; -Xlinker -stdlib=libstdc++; -arch=sm_20" CACHE STRING "Setting NVCC compiler flags" FORCE)
ENDIF(APPLE)
CUDA_ADD_EXECUTABLE( LBPGPU
LBPGPU.cu
)
TARGET_LINK_LIBRARIES(LBPGPU
${CUDA_LIBRARIES} nppc nppi X11 pthread
)
endif(BUILD_LBPGPU)
option(BUILD_PYTHON "Build SWIG/Python module" OFF)
if(BUILD_PYTHON)
add_subdirectory(python)
endif(BUILD_PYTHON)
###############################################################################
## Install
# Binaries and libs
install(TARGETS LBP LBPMain
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(BUILD_LBPGPU)
install(TARGETS LBPGPU
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
endif(BUILD_LBPGPU)
# Header files
install(FILES LBP.hpp
DESTINATION include
)