blob: cc2074779e513ffd0286e390f016af9454582034 [file] [log] [blame]
--- a/CMakeLists.txt 2019-11-06 07:51:09.522309900 +0300
+++ b/CMakeLists.txt 2019-11-06 07:56:58.190798200 +0300
@@ -1,6 +1,6 @@
-cmake_minimum_required (VERSION 2.8.11)
+cmake_minimum_required (VERSION 3.1)
-project (OPENCL_ICD_LOADER)
+project (OPENCL_ICD_LOADER VERSION 2.2)
include (GNUInstallDirs)
find_package (Threads REQUIRED)
@@ -75,9 +75,9 @@
set (OPENCL_ICD_LOADER_HEADERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inc CACHE PATH "Path to OpenCL Headers")
add_library (OpenCL ${OPENCL_ICD_LOADER_SOURCES})
-set_target_properties (OpenCL PROPERTIES VERSION "1.2" SOVERSION "1")
+set_target_properties (OpenCL PROPERTIES VERSION "2.2" SOVERSION "1")
-if (WIN32)
+if (MSVC)
target_link_libraries (OpenCL cfgmgr32.lib)
option (OPENCL_ICD_LOADER_REQUIRE_WDK "Build with D3DKMT support, which requires the Windows WDK." ON)
@@ -112,6 +113,8 @@
string(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif()
+elseif(MINGW)
+ target_link_libraries (OpenCL cfgmgr32)
else()
if (APPLE)
target_link_libraries (OpenCL ${CMAKE_THREAD_LIBS_INIT})
@@ -131,8 +133,36 @@
if (BUILD_TESTING)
add_subdirectory (test)
endif()
+
+set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
+set(config_install_dir "lib/cmake/${PROJECT_NAME}")
+set(include_install_dir "include")
+
+set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
+set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
+set(targets_export_name "${PROJECT_NAME}Targets")
+set(namespace "${PROJECT_NAME}::")
+
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+ "${version_config}" COMPATIBILITY SameMajorVersion
+)
+
+configure_file("Config.cmake.in" "${project_config}" @ONLY)
+
+install(
+ FILES "${project_config}" "${version_config}"
+ DESTINATION "${config_install_dir}"
+)
+
+install(
+ EXPORT "${targets_export_name}"
+ NAMESPACE "${namespace}"
+ DESTINATION "${config_install_dir}"
+)
install (TARGETS OpenCL
+ EXPORT "${targets_export_name}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
--- /dev/null
+++ b/Config.cmake.in
@@ -0,0 +1,3 @@
+include(CMakeFindDependencyMacro)
+find_dependency(Threads)
+include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
--- a/loader/windows/icd_windows_hkr.c 2019-11-06 08:40:22.398746600 +0300
+++ b/loader/windows/icd_windows_hkr.c 2019-11-06 08:42:02.322895900 +0300
@@ -27,6 +27,12 @@
#include <devpkey.h>
#include <devguid.h>
+#define CM_GETIDLIST_FILTER_PRESENT (0x00000100)
+#define CM_GETIDLIST_FILTER_CLASS (0x00000200)
+
+DEFINE_DEVPROPKEY(DEVPKEY_Device_ClassGuid, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 10); // DEVPROP_TYPE_GUID
+
+
// This GUID was only added to devguid.h on Windows SDK v10.0.16232 which
// corresponds to Windows 10 Redstone 3 (Windows 10 Fall Creators Update).
DEFINE_GUID(OCL_GUID_DEVCLASS_SOFTWARECOMPONENT, 0x5c4c3332, 0x344d, 0x483c, 0x87, 0x39, 0x25, 0x9e, 0x93, 0x4c, 0x9c, 0xc8);
--- a/test/loader_test/test_create_calls.c
+++ b/test/loader_test/test_create_calls.c
@@ -174,12 +174,17 @@ int test_clGetPlatformIDs(const struct clGetPlatformIDs_st* data)
&param_val_ret_size );
if (ret_val == CL_SUCCESS ){
- if(!strcmp(platform_name, "ICD_LOADER_TEST_OPENCL_STUB")) {
+ if (!strcmp(platform_name, "ICD_LOADER_TEST_OPENCL_STUB")) {
platform = all_platforms[i];
}
}
}
+ if (!platform) {
+ // The stub OpenCL not found.
+ return -2;
+ }
+
#if ENABLE_MISMATCHING_PRINTS
test_icd_app_log("Value returned: %d\n", ret_val);
#endif
--- a/test/loader_test/test_program_objects.c
+++ b/test/loader_test/test_program_objects.c
@@ -165,6 +165,11 @@ int test_clGetExtensionFunctionAddressForPlatform(const struct clGetExtensionFun
platform,
data->func_name);
+ if (!platform) {
+ test_icd_app_log("No stub platform\n");
+ return -2;
+ }
+
return_value=clGetExtensionFunctionAddressForPlatform(platform,
data->func_name);