-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
61 lines (48 loc) · 1.75 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
project(corticl)
cmake_minimum_required (VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
find_package(OpenCL REQUIRED)
find_package(SDL2)
if (${SDL2_FOUND})
include_directories(${SDL2_INCLUDE_DIRS})
endif()
include_directories(${OPENCL_INCLUDE_DIRS})
include_directories(${PROJECT_BINARY_DIR})
set(LIBS ${LIBS} ${SDL2_LIBRARIES} ${OPENCL_LIBRARIES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -Wno-deprecated-declarations -g -pthread -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
add_custom_command(
PRE_BUILD
OUTPUT ${PROJECT_BINARY_DIR}/spatial.cl.h
COMMAND ${CMAKE_COMMAND} -D SOURCE=${PROJECT_SOURCE_DIR}/src/cl/spatial.cl -D DESTINATION=${PROJECT_BINARY_DIR}/spatial.cl.h -P ${CMAKE_SOURCE_DIR}/cmake/stringify.cmake
DEPENDS ${PROJECT_SOURCE_DIR}/src/cl/spatial.cl
)
add_custom_command(
PRE_BUILD
OUTPUT ${PROJECT_BINARY_DIR}/temporal.cl.h
COMMAND ${CMAKE_COMMAND} -D SOURCE=${PROJECT_SOURCE_DIR}/src/cl/temporal.cl -D DESTINATION=${PROJECT_BINARY_DIR}/temporal.cl.h -P ${CMAKE_SOURCE_DIR}/cmake/stringify.cmake
DEPENDS ${PROJECT_SOURCE_DIR}/src/cl/temporal.cl
)
add_library(corticl STATIC
src/clregion.cpp
src/clspatial.cpp
src/cltemporal.cpp
src/clargs.cpp
src/cltopology.cpp
src/clcontext.cpp
${PROJECT_BINARY_DIR}/spatial.cl.h
${PROJECT_BINARY_DIR}/temporal.cl.h
)
if (${SDL2_FOUND})
add_executable(cldemo
src/demo/cldemo.cpp
src/demo/cldemo1.cpp
src/demo/cldemo2.cpp
src/demo/cldemo3.cpp
src/demo/sensor.cpp)
target_link_libraries(cldemo corticl SDL2 GL ${OPENCL_LIBRARIES})
else()
message(STATUS "SDL2 not found, not building cldemo")
endif()
add_executable(basic src/demo/basic.cpp)
target_link_libraries(basic corticl ${OPENCL_LIBRARIES})