forked from codeplaysoftware/syclacademy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (63 loc) · 2.4 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
#[[
SYCL Academy (c)
SYCL Academy is licensed under a Creative Commons Attribution-ShareAlike 4.0
International License.
You should have received a copy of the license along with this work. If not,
see <http://creativecommons.org/licenses/by-sa/4.0/>.
]]
cmake_minimum_required (VERSION 3.14)
project (SYCLAcademy)
# Options
option(SYCL_ACADEMY_USE_COMPUTECPP "Configure to compile with ComputeCpp" OFF)
# option(SYCL_ACADEMY_USE_DPCPP "Configure to compile with DPC++" OFF)
option(SYCL_ACADEMY_USE_HIPSYCL "Configure to compile with hipSYCL" OFF)
option(SYCL_ACADEMY_ENABLE_SOLUTIONS "Include solution files in project" OFF)
# Variables
set(SYCL_ACADEMY_INSTALL_ROOT CACHE STRING "NOT-FOUND")
set(SYCL_IMPLEMENTATIONS_USED 0)
if(SYCL_ACADEMY_USE_COMPUTECPP)
math(EXPR SYCL_IMPLEMENTATIONS_USED ${SYCL_IMPLEMENTATIONS_USED}+1)
endif()
# if(SYCL_ACADEMY_USE_DPCPP)
# math(EXPR SYCL_IMPLEMENTATIONS_USED ${SYCL_IMPLEMENTATIONS_USED}+1)
# endif()
if(SYCL_ACADEMY_USE_HIPSYCL)
math(EXPR SYCL_IMPLEMENTATIONS_USED ${SYCL_IMPLEMENTATIONS_USED}+1)
endif()
if (${SYCL_IMPLEMENTATIONS_USED} EQUAL 0)
message(FATAL_ERROR "No SYCL implementation specified, please set either "
"SYCL_ACADEMY_USE_COMPUTECPP or SYCL_ACADEMY_USE_HIPSYCL to ON.")
endif()
if (${SYCL_IMPLEMENTATIONS_USED} GREATER 1)
message(FATAL_ERROR "Multiple SYCL implementations specified, please only "
"set one of SYCL_ACADEMY_USE_COMPUTECPP or SYCL_ACADEMY_USE_HIPSYCL to ON.")
endif()
# Common setup
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/External/computecpp-sdk/cmake/Modules/")
find_package(Threads REQUIRED)
add_subdirectory(Utilities)
# ComputeCpp setup
if (SYCL_ACADEMY_USE_COMPUTECPP)
if (NOT SYCL_ACADEMY_INSTALL_ROOT)
message(FATAL_ERROR "SYCL implementation root not provided, please specify "
"the path to the root of the chosen SYCL implementation using "
"SYCL_ACADEMY_INSTALL_ROOT=<path/to/install/root>.")
endif()
set(ComputeCpp_DIR ${SYCL_ACADEMY_INSTALL_ROOT})
include(External/computecpp-sdk/cmake/Modules/ComputeCppCompilerChecks.cmake)
find_package(ComputeCpp REQUIRED)
endif()
# DPC++ setup
if (SYCL_ACADEMY_USE_DPCPP)
# Not implemented
endif()
# hipSYCL setup
if (SYCL_ACADEMY_USE_HIPSYCL)
set(hipSYCL_DIR ${SYCL_ACADEMY_INSTALL_ROOT}/lib/cmake/hipSYCL)
find_package(hipSYCL CONFIG REQUIRED PATHS)
endif()
# Exercises
enable_testing()
add_subdirectory(External/Catch2)
add_subdirectory(Code_Exercises)