Skip to content
Permalink
Newer
Older
100644 92 lines (72 sloc) 3.48 KB
1
cmake_minimum_required(VERSION 3.15)
2
project(sycl_cts LANGUAGES CXX)
4
set(CMAKE_CXX_STANDARD 17)
5
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6
set(CMAKE_CXX_EXTENSIONS ON) # Required for hex floats in C++11 mode on gcc 6+
7
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
8
9
find_package(Threads REQUIRED)
10
find_package(OpenCL REQUIRED)
11
find_package(PythonInterp 3 REQUIRED)
12
13
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/vendor/Catch2/CMakeLists.txt")
14
message(FATAL_ERROR "The git submodule vendor/Catch2 is missing.\nTry running `git submodule update --init`.")
15
endif()
16
add_subdirectory(vendor/Catch2)
17
18
# set host compiler flags
19
if(WIN32)
20
add_compile_options(/bigobj)
21
endif()
22
23
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU" OR
24
${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
25
add_compile_options(-Wall -Wno-unused-variable)
26
endif()
27
28
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
29
include(AddSYCLExecutable)
30
include(AddCTSOption)
31
32
add_cts_option(SYCL_CTS_ENABLE_FULL_CONFORMANCE
33
"Enable full conformance with extensive tests" OFF
34
WARN_IF_OFF "Full conformance mode (SYCL_CTS_ENABLE_FULL_CONFORMANCE) should be used for conformance submission")
36
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_PROPERTIES_TESTS
37
"Enable extension oneAPI compile-time property list tests" OFF)
39
# TODO: Should SYCL_CTS_ENABLE_FULL_CONFORMANCE=ON imply this?
40
add_cts_option(SYCL_CTS_ENABLE_DEPRECATED_FEATURES_TESTS
41
"Enable tests for deprecated SYCL features" ON
42
WARN_IF_OFF "Tests for deprecated SYCL features should be enabled for conformance submission")
44
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_SUB_GROUP_MASK_TESTS
45
"Enable extension oneAPI sub_group_mask tests" OFF)
47
add_cts_option(SYCL_CTS_ENABLE_EXT_ONEAPI_DEVICE_GLOBAL_TESTS
48
"Enable extension oneAPI device_global tests" OFF)
50
# TODO: Deprecated - remove
51
add_cts_option(SYCL_CTS_ENABLE_VERBOSE_LOG
52
"Enable debug-level logs (deprecated)" OFF)
54
add_cts_option(SYCL_CTS_ENABLE_DOUBLE_TESTS
55
"Enable tests that require double precision floating point capabilities" ON)
57
add_cts_option(SYCL_CTS_ENABLE_HALF_TESTS
58
"Enable tests that require half precision floating point capabilities" ON)
60
add_cts_option(SYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS
61
"Enable OpenCL interoperability tests" ON)
63
# ------------------
64
# Device used for running with CTest (e.g. during conformance report generation)
65
set(SYCL_CTS_CTEST_DEVICE "" CACHE STRING "Device used when running with CTest")
66
# ------------------
67
68
# ------------------
69
# Measure build times
70
option(SYCL_CTS_MEASURE_BUILD_TIMES "Measure build time for each translation unit and write it to 'build_times.log'" OFF)
71
if(SYCL_CTS_MEASURE_BUILD_TIMES)
72
if(CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
73
# Wrap compiler calls in utility script to measure build times.
74
# Note that SYCL implementations that require custom build steps, e.g. for dedicated
75
# device compiler passes (such as ComputeCpp), may require special handling.
76
# In case the user already specified a compiler launcher, make sure ours comes first.
77
list(PREPEND CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_SOURCE_DIR}/tools/measure_build_time.py")
78
else()
79
# Only Makefiles and Ninja support CMake compiler launchers
80
message(FATAL_ERROR "Build time measurements are only supported for the 'Unix Makefiles' and 'Ninja' generators.")
81
endif()
82
endif()
83
# ------------------
84
85
enable_testing()
86
87
add_subdirectory(util)
88
add_subdirectory(tests)
89
add_subdirectory(oclmath)
90
91
# This should be the last line
92
print_cts_config_summary()