Lines 298-318
else()
Link Here
|
298 |
) |
298 |
) |
299 |
endif() |
299 |
endif() |
300 |
|
300 |
|
301 |
add_library(${TARGET_NAME} SHARED |
301 |
set(EXCLUDE_LIBS_FROM_ALL "" CACHE STRING "Space-separated list of LLVM libraries to exclude from all") |
302 |
${TARGET_INCLUDE_FILES} |
302 |
llvm_map_components_to_libnames(ALL_LLVM_LIBS all) |
303 |
${TARGET_SOURCE_FILES} |
303 |
if (NOT "${EXCLUDE_LIBS_FROM_ALL}" STREQUAL "") |
304 |
$<TARGET_OBJECTS:cl_headers> |
304 |
list(REMOVE_ITEM ALL_LLVM_LIBS ${EXCLUDE_LIBS_FROM_ALL}) |
305 |
) |
|
|
306 |
|
307 |
# Same CRT compile option are reqiured to avoid link errors on Windows. |
308 |
# MD and MDd are choosed by default for release and debug build in LLVM. |
309 |
# If users set MT or MTd flags, they also need to add the flags for |
310 |
# opencl-clang sources using a custom macro set_msvc_crt_flags. |
311 |
if(COMMAND set_msvc_crt_flags) |
312 |
set_msvc_crt_flags(${TARGET_NAME}) |
313 |
endif() |
305 |
endif() |
|
|
306 |
list(APPEND OPENCL_CLANG_LINK_LIBS ${ALL_LLVM_LIBS}) |
307 |
|
308 |
add_llvm_library(${TARGET_NAME} SHARED |
309 |
${TARGET_INCLUDE_FILES} |
310 |
${TARGET_SOURCE_FILES} |
311 |
$<TARGET_OBJECTS:cl_headers> |
314 |
|
312 |
|
315 |
add_dependencies(${TARGET_NAME} CClangCompileOptions) |
313 |
DEPENDS CClangCompileOptions |
|
|
314 |
|
315 |
LINK_LIBS |
316 |
${OPENCL_CLANG_LINK_LIBS} |
317 |
) |
316 |
|
318 |
|
317 |
if (WIN32) |
319 |
if (WIN32) |
318 |
# Enable compiler generation of Control Flow Guard security checks. |
320 |
# Enable compiler generation of Control Flow Guard security checks. |
Lines 328-378
elseif(UNIX)
Link Here
|
328 |
LINK_FLAGS " -Wl,--no-undefined") |
330 |
LINK_FLAGS " -Wl,--no-undefined") |
329 |
endif(WIN32) |
331 |
endif(WIN32) |
330 |
|
332 |
|
331 |
# Enable new IN_LIST operator. |
|
|
332 |
cmake_policy(SET CMP0057 NEW) |
333 |
set(OTHER_LIBRARIES) |
334 |
if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD) |
335 |
list(APPEND OTHER_LIBRARIES LLVMNVPTXCodeGen LLVMNVPTXDesc LLVMNVPTXInfo) |
336 |
endif() |
337 |
if ("AMDGPU" IN_LIST LLVM_TARGETS_TO_BUILD) |
338 |
list(APPEND OTHER_LIBRARIES LLVMAMDGPUCodeGen LLVMAMDGPUAsmParser LLVMAMDGPUDesc LLVMAMDGPUInfo) |
339 |
endif() |
340 |
|
341 |
target_link_libraries( ${TARGET_NAME} |
342 |
LINK_PRIVATE |
343 |
${OPENCL_CLANG_LINK_LIBS} |
344 |
LLVMX86CodeGen |
345 |
LLVMX86AsmParser |
346 |
LLVMX86Desc |
347 |
LLVMX86Info |
348 |
LLVMX86Disassembler |
349 |
LLVMAnalysis |
350 |
LLVMCodeGen |
351 |
LLVMCore |
352 |
LLVMipo |
353 |
LLVMInstCombine |
354 |
LLVMInstrumentation |
355 |
LLVMMC |
356 |
LLVMMCParser |
357 |
LLVMObjCARCOpts |
358 |
LLVMOption |
359 |
LLVMScalarOpts |
360 |
LLVMSupport |
361 |
LLVMTransformUtils |
362 |
LLVMVectorize |
363 |
LLVMAsmPrinter |
364 |
LLVMSelectionDAG |
365 |
LLVMMCDisassembler |
366 |
LLVMProfileData |
367 |
LLVMObject |
368 |
LLVMBitWriter |
369 |
LLVMIRReader |
370 |
LLVMAsmParser |
371 |
LLVMTarget |
372 |
LLVMBitReader |
373 |
${OTHER_LIBRARIES} |
374 |
) |
375 |
|
376 |
install(FILES opencl_clang.h |
333 |
install(FILES opencl_clang.h |
377 |
DESTINATION include/cclang |
334 |
DESTINATION include/cclang |
378 |
COMPONENT ${TARGET_NAME}) |
335 |
COMPONENT ${TARGET_NAME}) |