diff options
Diffstat (limited to 'Tests/FindOpenCL')
-rw-r--r-- | Tests/FindOpenCL/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindOpenCL/Test/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindOpenCL/Test/main.c | 16 |
3 files changed, 40 insertions, 0 deletions
diff --git a/Tests/FindOpenCL/CMakeLists.txt b/Tests/FindOpenCL/CMakeLists.txt new file mode 100644 index 0000000..88d2eae --- /dev/null +++ b/Tests/FindOpenCL/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindOpenCL.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindOpenCL/Test" + "${CMake_BINARY_DIR}/Tests/FindOpenCL/Test" + ${build_generator_args} + --build-project TestFindOpenCL + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindOpenCL/Test/CMakeLists.txt b/Tests/FindOpenCL/Test/CMakeLists.txt new file mode 100644 index 0000000..f8a6587 --- /dev/null +++ b/Tests/FindOpenCL/Test/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindOpenCL C) +include(CTest) + +find_package(OpenCL REQUIRED) + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt OpenCL::OpenCL) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${OpenCL_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${OpenCL_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindOpenCL/Test/main.c b/Tests/FindOpenCL/Test/main.c new file mode 100644 index 0000000..b075caf --- /dev/null +++ b/Tests/FindOpenCL/Test/main.c @@ -0,0 +1,16 @@ +#ifdef __APPLE__ + #include <OpenCL/opencl.h> +#else + #include <CL/cl.h> +#endif + +int main() +{ + cl_uint platformIdCount; + + // We can't assert on the result because this may return an error if no ICD is + // found + clGetPlatformIDs (0, NULL, &platformIdCount); + + return 0; +} |