-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
52 lines (45 loc) · 1.99 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
cmake_minimum_required(VERSION 2.8)
project(ocl)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF)
# experimental warning arguments (e.g. deprecated-declarations requried for OpenCL 1.2 functionality)
set(WARNARGS_EXPERIMENTAL "-Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-terminate")
# warning arguments
set(WARNARGS "-Wall -Werror -Wno-unused-function -Wno-ignored-attributes ${WARNARGS_EXPERIMENTAL}")
#ASan
option(WITH_ASAN "Enable ASan build flags" OFF)
if (${WITH_ASAN})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=leak -fsanitize=undefined")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libsan")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libasan")
endif()
endif (${WITH_ASAN})
set(THREADS "NONE" CACHE STRING "Threading backend. One of: NONE, OPENMP, SIMPLE, ADVANCE")
if (${THREADS} STREQUAL "NONE")
add_compile_definitions(THREADS=0)
elseif(${THREADS} STREQUAL "OPENMP")
add_compile_definitions(THREADS=1)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgomp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
elseif(${THREADS} STREQUAL "SIMPLE")
add_compile_definitions(THREADS=2)
elseif(${THREADS} STREQUAL "ADVANCE")
add_compile_definitions(THREADS=3)
else()
message(SEND_ERROR "Unknown -DTHREADS value specified")
endif()
# rules for debug and release
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -O0 ${WARNARGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 ${WARNARGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -g -O3 ${WARNARGS}")
# include root folder
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
# subfolders
add_subdirectory(img_processor)
add_subdirectory(eltwise_mat_add)
add_subdirectory(rgb2gray_blur)
add_subdirectory(stereo_disparity)