-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
81 lines (56 loc) · 1.86 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
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
project(libfluid VERSION 1.0.0)
option(BUILD_SAMPLES "Build samples" ON)
option(BUILD_TESTS "Build tests" ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(mio REQUIRED)
find_package(glm REQUIRED)
find_package(OpenCL REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(OpenMP)
if (NOT TARGET OpenMP::OpenMP_CXX)
# https://cliutils.gitlab.io/modern-cmake/chapters/packages/OpenMP.html
find_package(Threads REQUIRED)
add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
set_property(TARGET OpenMP::OpenMP_CXX
PROPERTY INTERFACE_COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
set_property(TARGET OpenMP::OpenMP_CXX
PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads)
endif ()
add_library(fluid INTERFACE)
include_directories(third_party)
target_include_directories(fluid INTERFACE
include/fluid
include/fluid/oclsph_kernel.h
third_party
)
#set_source_files_properties(
# clmc_kernel.cl
# clsph_kernel.cl
# PROPERTIES LANGUAGE CXX)
add_library(fluid::fluid ALIAS fluid)
target_include_directories(fluid
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}>
)
target_compile_features(fluid INTERFACE cxx_std_14)
target_link_libraries(fluid
INTERFACE
nlohmann_json::nlohmann_json
glm
mio::mio
OpenCL::OpenCL
OpenMP::OpenMP_CXX
)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
# CL2 typedefs cl types with attributes
target_compile_options(fluid INTERFACE -Wno-ignored-attributes)
endif ()
if (BUILD_SAMPLES)
add_subdirectory(samples)
endif ()
if (BUILD_TESTS)
add_subdirectory(tests)
endif ()