Skip to content

Commit 2421820

Browse files
committed
add CMake option to custom PCH extension map
1 parent c891e1d commit 2421820

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ if (NOT DEFINED COMMON_CLANG_LIBRARY_NAME)
106106
endif()
107107
set(TARGET_NAME ${COMMON_CLANG_LIBRARY_NAME}${BUILD_PLATFORM} )
108108

109+
option(CUSTOM_PCH_EXTENSION_MAP "Set PCH extension map" OFF)
110+
if(CUSTOM_PCH_EXTENSION_MAP)
111+
add_definitions(-DPCH_EXTENSION="cl_khr_3d_image_writes,cl_khr_depth_images,cl_khr_global_int32_base_atomics,cl_khr_global_int32_extended_atomics,cl_khr_int64_base_atomics,cl_khr_int64_extended_atomics,cl_khr_local_int32_base_atomics,cl_khr_local_int32_extended_atomics,cl_intel_subgroups,cl_intel_subgroups_short")
112+
endif()
113+
114+
109115
if(NOT USE_PREBUILT_LLVM)
110116

111117
if(NOT LLVM_EXTERNAL_CLANG_SOURCE_DIR)

options_compile.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,27 +257,36 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
257257
std::map<std::string, bool> extMap{
258258
{"cl_khr_3d_image_writes", true},
259259
{"cl_khr_depth_images", true},
260-
#ifdef GPU_EXT
261260
{"cl_khr_fp16", true},
262-
{"cl_khr_mipmap_image", true},
263-
{"cl_khr_mipmap_image_writes", true},
264-
{"cl_khr_subgroups", true},
265-
{"cl_intel_device_side_avc_motion_estimation", true},
266-
{"cl_intel_planar_yuv", true},
267261
#ifdef _WIN32
268262
// cl_khr_gl_msaa_sharing is only supported on Windows [NEO].
269263
{"cl_khr_gl_msaa_sharing", true},
270-
#endif
271264
#endif
272265
{"cl_khr_global_int32_base_atomics", true},
273266
{"cl_khr_global_int32_extended_atomics", true},
274267
{"cl_khr_int64_base_atomics", true},
275268
{"cl_khr_int64_extended_atomics", true},
276269
{"cl_khr_local_int32_base_atomics", true},
277270
{"cl_khr_local_int32_extended_atomics", true},
271+
{"cl_khr_mipmap_image", true},
272+
{"cl_khr_mipmap_image_writes", true},
273+
{"cl_khr_subgroups", true},
274+
{"cl_intel_device_side_avc_motion_estimation", true},
275+
{"cl_intel_planar_yuv", true},
278276
{"cl_intel_subgroups", true},
279277
{"cl_intel_subgroups_short", true}};
280278

279+
#ifdef PCH_EXTENSION
280+
extMap.clear();
281+
std::string customPCHExtStr(PCH_EXTENSION);
282+
std::stringstream sstr(customPCHExtStr);
283+
while(sstr.good()) {
284+
std::string substr;
285+
getline(sstr, substr, ',');
286+
extMap[substr] = true;
287+
}
288+
#endif
289+
281290
auto parseClExt = [&](const std::string &clExtStr) {
282291
llvm::StringRef clExtRef(clExtStr);
283292
clExtRef.consume_front("-cl-ext=");

0 commit comments

Comments
 (0)