-
Notifications
You must be signed in to change notification settings - Fork 81
/
CMakeLists.txt
181 lines (138 loc) · 6.68 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
cmake_minimum_required(VERSION 3.15)
project(sycl_cts LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON) # Required for hex floats in C++11 mode on gcc 6+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
find_package(Threads REQUIRED)
find_package(PythonInterp 3 REQUIRED)
macro(add_submodule_directory RELPATH)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${RELPATH}/CMakeLists.txt")
message(FATAL_ERROR "The git submodule ${RELPATH} is missing.\nTry running `git submodule update --init`.")
endif()
add_subdirectory("${RELPATH}")
endmacro()
add_submodule_directory(vendor/Catch2)
# set host compiler flags
if(WIN32 AND MSVC)
add_compile_options(/bigobj)
endif()
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU" OR
${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_compile_options(-Wall -Wno-unused-variable)
endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(AddCTSOption)
add_cts_option(SYCL_CTS_ENABLE_FULL_CONFORMANCE
"Enable full conformance with extensive tests" OFF
WARN_IF_OFF "Full conformance mode (SYCL_CTS_ENABLE_FULL_CONFORMANCE) should be used for conformance submission")
# TODO: Should SYCL_CTS_ENABLE_FULL_CONFORMANCE=ON imply this?
add_cts_option(SYCL_CTS_ENABLE_DEPRECATED_FEATURES_TESTS
"Enable tests for deprecated SYCL features" ON
WARN_IF_OFF "Tests for deprecated SYCL features should be enabled for conformance submission")
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS
"Enable all extension oneAPI tests" OFF)
add_cts_option(SYCL_CTS_ENABLE_KHR_TESTS
"Enable all extension Khronos tests" OFF)
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_PROPERTIES_TESTS
"Enable extension oneAPI compile-time property list tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_SUB_GROUP_MASK_TESTS
"Enable extension oneAPI sub_group_mask tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_DEVICE_GLOBAL_TESTS
"Enable extension oneAPI device_global tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_MEMCPY2D_TESTS
"Enable extension oneAPI memcpy2d tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_ENQUEUE_BARRIER_TESTS
"Enable extension oneAPI enqueue_barrier tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_WEAK_OBJECT_TESTS
"Enable extension oneAPI weak_object tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_QUEUE_EMPTY
"Enable extension oneAPI queue_empty tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_DISCARD_QUEUE_EVENTS_TESTS
"Enable extension oneAPI discard_queue_events tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_BFLOAT16_TESTS
"Enable extension oneAPI bfloat16 tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_AUTO_LOCAL_RANGE_TESTS
"Enable extension oneAPI auto_local_range tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_KERNEL_COMPILER_SPIRV_TESTS
"Enable extension oneAPI kernel_compiler_spirv tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_COMPOSITE_DEVICE_TESTS
"Enable extension oneAPI composite_device tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_NON_UNIFORM_GROUPS_TESTS
"Enable extension oneAPI non_uniform_groups tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_ROOT_GROUP_TESTS
"Enable extension oneAPI root group tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_ENQUEUE_FUNCTIONS_TESTS
"Enable extension oneAPI enqueue_functions tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_EXT_ONEAPI_TESTS})
add_cts_option(SYCL_CTS_ENABLE_KHR_DEFAULT_CONTEXT_TESTS
"Enable extension Khronos default_context tests" OFF
FORCE_ON ${SYCL_CTS_ENABLE_KHR_TESTS})
# TODO: Deprecated - remove
add_cts_option(SYCL_CTS_ENABLE_VERBOSE_LOG
"Enable debug-level logs (deprecated)" OFF)
add_cts_option(SYCL_CTS_ENABLE_DOUBLE_TESTS
"Enable tests that require double precision floating point capabilities" ON)
add_cts_option(SYCL_CTS_ENABLE_HALF_TESTS
"Enable tests that require half precision floating point capabilities" ON)
add_cts_option(SYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS
"Enable OpenCL interoperability tests" ON)
add_cts_option(SYCL_CTS_ENABLE_CUDA_INTEROP_TESTS
"Enable CUDA interoperability tests" OFF)
add_cts_option(SYCL_CTS_ENABLE_FEATURE_SET_FULL
"Enable full feature set, which includes all features specified in the core SYCL specification" ON)
include(AddOpenCLProxy)
include(AddSYCLExecutable)
# ------------------
# Enable CUDA language and add library, for CUDA interop tests
if(SYCL_CTS_ENABLE_CUDA_INTEROP_TESTS)
find_package(CUDA REQUIRED)
set(CMAKE_CUDA_COMPILER ${CMAKE_CXX_COMPILER})
enable_language(CUDA)
add_library(CUDA::CUDA INTERFACE IMPORTED GLOBAL)
set_target_properties(
CUDA::CUDA PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CUDA_TOOLKIT_INCLUDE}
)
endif()
# ------------------
# ------------------
# Device used for running with CTest (e.g. during conformance report generation)
set(SYCL_CTS_CTEST_DEVICE "" CACHE STRING "Device used when running with CTest")
# ------------------
# ------------------
# Measure build times
option(SYCL_CTS_MEASURE_BUILD_TIMES "Measure build time for each translation unit and write it to 'build_times.log'" OFF)
if(SYCL_CTS_MEASURE_BUILD_TIMES)
if(CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
# Wrap compiler calls in utility script to measure build times.
# Note that SYCL implementations that require custom build steps, e.g. for dedicated
# device compiler passes may require special handling.
# In case the user already specified a compiler launcher, make sure ours comes first.
list(PREPEND CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_SOURCE_DIR}/tools/measure_build_time.py")
else()
# Only Makefiles and Ninja support CMake compiler launchers
message(FATAL_ERROR "Build time measurements are only supported for the 'Unix Makefiles' and 'Ninja' generators.")
endif()
endif()
# ------------------
enable_testing()
add_subdirectory(util)
add_subdirectory(tests)
add_subdirectory(oclmath)
# This should be the last line
print_cts_config_summary()