Skip to content

Commit 71ea2a6

Browse files
authored
Static fixes (#270)
* Disable loader managed dispatch when building static libraries. * Disable DllMain in static builds.
1 parent 405c4be commit 71ea2a6

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ option(OPENCL_ICD_LOADER_BUILD_SHARED_LIBS "Build OpenCL ICD Loader as shared li
5252
# It is currently needed default while the specification is being formalized,
5353
# and to study the performance impact.
5454
option (ENABLE_OPENCL_LAYERS "Enable OpenCL Layers" ON)
55-
option (ENABLE_OPENCL_LOADER_MANAGED_DISPATCH "Enable OpenCL Loader managed dispatch" ON)
5655
include(CMakeDependentOption)
56+
cmake_dependent_option(ENABLE_OPENCL_LOADER_MANAGED_DISPATCH "Enable OpenCL Loader managed dispatch" ON OPENCL_ICD_LOADER_BUILD_SHARED_LIBS OFF)
5757
cmake_dependent_option(ENABLE_OPENCL_LAYERINFO "Enable building cllayerinfo tool" ON ENABLE_OPENCL_LAYERS OFF)
5858

5959
include(GNUInstallDirs)
@@ -170,6 +170,7 @@ set (OPENCL_COMPILE_DEFINITIONS
170170
OPENCL_ICD_LOADER_VERSION_REV=8
171171
$<$<BOOL:${ENABLE_OPENCL_LAYERS}>:CL_ENABLE_LAYERS>
172172
$<$<BOOL:${ENABLE_OPENCL_LOADER_MANAGED_DISPATCH}>:CL_ENABLE_LOADER_MANAGED_DISPATCH>
173+
$<$<BOOL:${OPENCL_ICD_LOADER_BUILD_SHARED_LIBS}>:CL_SHARED_BUILD>
173174
)
174175

175176
target_compile_definitions (OpenCL

loader/windows/icd_windows.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ void khrIcdOsVendorsEnumerateOnce()
411411
InitOnceExecuteOnce(&initialized, khrIcdOsVendorsEnumerate, NULL, NULL);
412412
}
413413

414-
#ifndef CL_LAYER_INFO
414+
#if !defined(CL_LAYER_INFO) && defined(CL_SHARED_BUILD)
415415
BOOL APIENTRY DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
416416
(void)hinst;
417417
(void)reserved;

0 commit comments

Comments
 (0)