-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (66 loc) · 3.46 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
# Scripts want to rely on stock FindOpenCL.cmake
cmake_minimum_required (VERSION 3.1)
set (Target_Name InteropWindowImpl)
# Always include current directory for all compile commands
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE})
# Generate the configuration file for application to locate shader files
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/include/${Target_Name}-Config.in.hpp"
"${CMAKE_CURRENT_BINARY_DIR}/include/${Target_Name}-Config.hpp")
# Specify source and header files
set (Sources source/Main.cpp
source/${Target_Name}.cpp
source/InteropWindow.cpp
source/LatticeBoltzmann2D.cpp
source/Raycaster.cpp
source/RaycasterLatticeBoltzmann2D.cpp
source/SphericalHarmonicsRaycaster.cpp
source/CubeRaycaster.cpp
source/RaycasterLbm3D.cpp
)
set (Headers include/InteropWindow.hpp
include/LatticeBoltzmann2D.hpp
include/Raycaster.hpp
include/RaycasterLatticeBoltzmann2D.hpp
include/SphericalHarmonicsRaycaster.hpp
include/CubeRaycaster.hpp
include/RaycasterLbm3D.hpp
include/${Target_Name}.hpp
${CMAKE_CURRENT_BINARY_DIR}/include/${Target_Name}-Config.hpp)
set (Shaders shader/Vertex.glsl
shader/Fragment.glsl)
find_package(glm)
find_package (Qt5 5.5 CONFIG REQUIRED Core Gui OpenGL)
find_package (OpenGL REQUIRED)
# Append to module path for locating FindComputeCpp.cmake
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
# Find dependencies
find_package (ComputeCpp REQUIRED)
# Declare executable target
add_executable(${Target_Name} ${Sources} ${Headers} ${Shaders})
# Target include directories
target_include_directories (${Target_Name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
${ComputeCpp_INCLUDE_DIRS})
# Target link directives
target_link_libraries(${Target_Name} PUBLIC Qt5::Core Qt5::Gui Qt5::OpenGL $<$<PLATFORM_ID:Windows>:Qt5::WinMain>
OpenGL::GL glm)
# Automatically invoke Qt tools on source files
set_target_properties(${Target_Name} PROPERTIES CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
AUTOMOC ON)
# Apply the ComputeCpp compiler to select source files (containing SYCL code)
add_sycl_to_target(TARGET ${Target_Name}
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/source/${Target_Name}.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/LatticeBoltzmann2D.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/Raycaster.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/SphericalHarmonicsRaycaster.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/CubeRaycaster.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/RaycasterLatticeBoltzmann2D.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/RaycasterLbm3D.cpp
)
# Create source groups for IDE
source_group ("Sources" FILES ${Sources})
source_group ("Headers" FILES ${Headers})
source_group ("Shaders" FILES ${Shaders})