brintos

brintos / llvm-project-archived public Read only

0
0
Text · 18.0 KiB · 9a81f26 Raw
498 lines · plain
1cmake_minimum_required(VERSION 3.20.0)2 3if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)4  project(libclc VERSION 0.2.0 LANGUAGES CXX C)5endif()6set(LLVM_SUBPROJECT_TITLE "libclc")7 8set(CMAKE_CXX_STANDARD 17)9 10# Add path for custom modules11list( INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )12 13set( LIBCLC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )14set( LIBCLC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} )15set( LIBCLC_OBJFILE_DIR ${LIBCLC_BINARY_DIR}/obj.libclc.dir )16 17include( AddLibclc )18 19include( GNUInstallDirs )20set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS21  # OpenCL libraries22  opencl/lib/amdgcn-amdhsa/SOURCES;23  opencl/lib/amdgcn/SOURCES;24  opencl/lib/clspv/SOURCES;25  opencl/lib/generic/SOURCES;26  opencl/lib/ptx-nvidiacl/SOURCES;27  opencl/lib/r600/SOURCES;28  opencl/lib/spirv/SOURCES;29  # CLC internal libraries30  clc/lib/generic/SOURCES;31  clc/lib/amdgcn/SOURCES;32  clc/lib/amdgpu/SOURCES;33  clc/lib/clspv/SOURCES;34  clc/lib/ptx-nvidiacl/SOURCES;35  clc/lib/r600/SOURCES;36  clc/lib/spirv/SOURCES;37)38 39set( LIBCLC_MIN_LLVM 3.9.0 )40 41set( LIBCLC_TARGETS_TO_BUILD "all"42    CACHE STRING "Semicolon-separated list of libclc targets to build, or 'all'." )43 44option( ENABLE_RUNTIME_SUBNORMAL "Enable runtime linking of subnormal support." OFF )45 46option(47  LIBCLC_USE_SPIRV_BACKEND "Build SPIR-V targets with the SPIR-V backend." OFF48)49 50# Top level target used to build all Libclc libraries.51add_custom_target( libclc ALL )52 53add_custom_target( libclc-opencl-builtins COMMENT "Build libclc OpenCL builtins" )54add_dependencies( libclc libclc-opencl-builtins )55 56if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )57  # Out-of-tree configuration58  set( LIBCLC_STANDALONE_BUILD TRUE )59 60  find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}")61  include(AddLLVM)62 63  message( STATUS "libclc LLVM version: ${LLVM_PACKAGE_VERSION}" )64 65  if( LLVM_PACKAGE_VERSION VERSION_LESS LIBCLC_MIN_LLVM )66    message( FATAL_ERROR "libclc needs at least LLVM ${LIBCLC_MIN_LLVM}" )67  endif()68 69  # Import required tools70  if( NOT EXISTS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} )71    foreach( tool IN ITEMS clang llvm-as llvm-link opt )72      find_program( LLVM_TOOL_${tool} ${tool} PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )73      set( ${tool}_exe ${LLVM_TOOL_${tool}} )74      set( ${tool}_target )75    endforeach()76  endif()77 78  # Setup the paths where libclc runtimes should be stored.79  set( LIBCLC_OUTPUT_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR} )80  set( LIBCLC_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/clc )81else()82  # In-tree configuration83  set( LIBCLC_STANDALONE_BUILD FALSE )84 85  set( LLVM_PACKAGE_VERSION ${LLVM_VERSION} )86 87  # Note that we check this later (for both build types) but we can provide a88  # more useful error message when built in-tree. We assume that LLVM tools are89  # always available so don't warn here.90  if( NOT LLVM_RUNTIMES_BUILD AND NOT clang IN_LIST LLVM_ENABLE_PROJECTS )91    message(FATAL_ERROR "Clang is not enabled, but is required to build libclc in-tree")92  endif()93 94  if( NOT EXISTS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} )95    get_host_tool_path( clang CLANG clang_exe clang_target )96    get_host_tool_path( llvm-as LLVM_AS llvm-as_exe llvm-as_target )97    get_host_tool_path( llvm-link LLVM_LINK llvm-link_exe llvm-link_target )98    get_host_tool_path( opt OPT opt_exe opt_target )99  endif()100 101  # Setup the paths where libclc runtimes should be stored. By default, in an102  # in-tree build we place the libraries in clang's resource driectory.103  include(GetClangResourceDir)104  get_clang_resource_dir( LIBCLC_INSTALL_DIR )105  cmake_path( APPEND LIBCLC_INSTALL_DIR "lib" "libclc" )106 107  # Note we do not adhere to LLVM_ENABLE_PER_TARGET_RUNTIME_DIR.108  cmake_path( GET LLVM_LIBRARY_OUTPUT_INTDIR PARENT_PATH LIBCLC_OUTPUT_LIBRARY_DIR )109  cmake_path( APPEND LIBCLC_OUTPUT_LIBRARY_DIR ${LIBCLC_INSTALL_DIR} )110  file( MAKE_DIRECTORY ${LIBCLC_OUTPUT_LIBRARY_DIR} )111endif()112 113if( EXISTS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} )114  message( WARNING "Using custom LLVM tools to build libclc: "115    "${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR}, "116    " ensure the tools are up to date." )117  # Note - use a differently named variable than LLVM_TOOL_${tool} as above, as118  # the variable name is used to cache the result of find_program. If we used119  # the same name, a user wouldn't be able to switch a build between default120  # and custom tools.121  foreach( tool IN ITEMS clang llvm-as llvm-link opt )122    find_program( LLVM_CUSTOM_TOOL_${tool} ${tool}123      PATHS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH )124    set( ${tool}_exe ${LLVM_CUSTOM_TOOL_${tool}} )125    set( ${tool}_target )126  endforeach()127endif()128 129foreach( tool IN ITEMS clang opt llvm-as llvm-link )130  if( NOT EXISTS "${${tool}_exe}" AND "${${tool}_target}" STREQUAL "" )131    message( FATAL_ERROR "libclc toolchain incomplete - missing tool ${tool}!" )132  endif()133endforeach()134 135if( NOT LIBCLC_USE_SPIRV_BACKEND )136  # llvm-spirv is an optional dependency, used to build spirv-* targets when137  # the SPIR-V backend hasn't been requested. It may be provided in-tree or138  # externally.139  if( TARGET llvm-spirv )140    get_host_tool_path( llvm-spirv LLVM_SPIRV llvm-spirv_exe llvm-spirv_target )141  else()142    find_program( LLVM_SPIRV llvm-spirv HINTS ${LLVM_TOOLS_BINARY_DIR} )143    set( llvm-spirv_exe "${LLVM_SPIRV}" )144    set( llvm-spirv_target )145  endif()146endif()147 148# List of all targets. Note that some are added dynamically below.149set( LIBCLC_TARGETS_ALL150  amdgcn--151  amdgcn--amdhsa152  clspv--153  clspv64--154  r600--155  nvptx--156  nvptx64--157  nvptx--nvidiacl158  nvptx64--nvidiacl159)160 161# The mesa3d environment is only available since LLVM 4.0162if( LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 4.0.0 )163  list( APPEND LIBCLC_TARGETS_ALL amdgcn-mesa-mesa3d )164endif()165 166# The spirv-mesa3d and spirv64-mesa3d targets are optional and can be built167# with either the LLVM SPIR-V backend or the external llvm-spirv tool.168if( LIBCLC_USE_SPIRV_BACKEND OR llvm-spirv_exe )169  list( APPEND LIBCLC_TARGETS_ALL spirv-mesa3d- spirv64-mesa3d- )170endif()171 172# Verify that the user hasn't requested mesa3d targets without an available173# llvm-spirv tool.174if( spirv-mesa3d- IN_LIST LIBCLC_TARGETS_TO_BUILD175    OR spirv64-mesa3d- IN_LIST LIBCLC_TARGETS_TO_BUILD )176  if( NOT LIBCLC_USE_SPIRV_BACKEND AND NOT llvm-spirv_exe )177    message( FATAL_ERROR "SPIR-V targets requested, but spirv-tools is not "178      "installed and the SPIR-V backend has not been requested." )179  endif()180endif()181 182if( LIBCLC_TARGETS_TO_BUILD STREQUAL "all" )183  set( LIBCLC_TARGETS_TO_BUILD ${LIBCLC_TARGETS_ALL} )184else()185  foreach(TARGET_TO_BUILD ${LIBCLC_TARGETS_TO_BUILD})186    if (NOT ${TARGET_TO_BUILD} IN_LIST LIBCLC_TARGETS_ALL)187      message ( FATAL_ERROR "Unknown target in LIBCLC_TARGETS_TO_BUILD: \"${TARGET_TO_BUILD}\"\n"188                            "Valid targets are: ${LIBCLC_TARGETS_ALL}\n")189    endif()190  endforeach()191endif()192 193list( SORT LIBCLC_TARGETS_TO_BUILD )194 195# This needs to be set before any target that needs it196# We need to use LLVM_INCLUDE_DIRS here, because if we are linking to an197# llvm build directory, this includes $src/llvm/include which is where all the198# headers are not $build/include/ which is what LLVM_INCLUDE_DIR is set to.199include_directories( ${LLVM_INCLUDE_DIRS} )200 201# Configure prepare_builtins202add_subdirectory( utils )203 204# Setup arch devices205set( r600--_devices cedar cypress barts cayman )206set( amdgcn--_devices tahiti )207set( amdgcn-mesa-mesa3d_devices ${amdgcn--_devices} )208set( amdgcn--amdhsa_devices none )209set( clspv--_devices none )210set( clspv64--_devices none )211set( nvptx--_devices none )212set( nvptx64--_devices none )213set( nvptx--nvidiacl_devices none )214set( nvptx64--nvidiacl_devices none )215set( spirv-mesa3d-_devices none )216set( spirv64-mesa3d-_devices none )217 218# Setup aliases219set( cedar_aliases palm sumo sumo2 redwood juniper )220set( cypress_aliases hemlock )221set( barts_aliases turks caicos )222set( cayman_aliases aruba )223set( tahiti_aliases pitcairn verde oland hainan bonaire kabini kaveri hawaii224  mullins tonga tongapro iceland carrizo fiji stoney polaris10 polaris11225  gfx602 gfx705 gfx805226  gfx900 gfx902 gfx904 gfx906 gfx908 gfx909 gfx90a gfx90c gfx942 gfx950227  gfx1010 gfx1011 gfx1012 gfx1013228  gfx1030 gfx1031 gfx1032 gfx1033 gfx1034 gfx1035 gfx1036229  gfx1100 gfx1101 gfx1102 gfx1103230  gfx1150 gfx1151 gfx1152 gfx1153231  gfx1200 gfx1201 gfx1250 gfx1251232)233 234# pkg-config file235configure_file( libclc.pc.in libclc.pc @ONLY )236install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig" )237 238if( ENABLE_RUNTIME_SUBNORMAL )239  foreach( file IN ITEMS subnormal_use_default subnormal_disable )240    link_bc(241       TARGET ${file}242       INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/${file}.ll243    )244    install(245      FILES $<TARGET_PROPERTY:${file},TARGET_FILE>246      DESTINATION "${CMAKE_INSTALL_DATADIR}/clc"247    )248  endforeach()249endif()250 251find_package( Python3 REQUIRED COMPONENTS Interpreter )252file( TO_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/utils/gen_convert.py script_loc )253add_custom_command(254  OUTPUT convert.cl255  COMMAND ${Python3_EXECUTABLE} ${script_loc} > convert.cl256  DEPENDS ${script_loc} )257add_custom_target( generate-convert.cl DEPENDS convert.cl )258set_target_properties( generate-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" )259 260add_custom_command(261  OUTPUT clc-convert.cl262  COMMAND ${Python3_EXECUTABLE} ${script_loc} --clc > clc-convert.cl263  DEPENDS ${script_loc} )264add_custom_target( generate-clc-convert.cl DEPENDS clc-convert.cl )265set_target_properties( generate-clc-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" )266 267if ( clspv-- IN_LIST LIBCLC_TARGETS_TO_BUILD OR clspv64-- IN_LIST LIBCLC_TARGETS_TO_BUILD )268  add_custom_command(269    OUTPUT clspv-convert.cl270    COMMAND ${Python3_EXECUTABLE} ${script_loc} --clspv > clspv-convert.cl271    DEPENDS ${script_loc} )272  add_custom_target( generate-clspv-convert.cl DEPENDS clspv-convert.cl )273  set_target_properties( generate-clspv-convert.cl PROPERTIES FOLDER "libclc/Sourcegenning" )274endif()275 276set_source_files_properties(277  # CLC builtins278  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_cos.cl279  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_divide.cl280  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_exp10.cl281  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_exp2.cl282  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_exp.cl283  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_log10.cl284  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_log2.cl285  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_log.cl286  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_powr.cl287  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_recip.cl288  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_rsqrt.cl289  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_sin.cl290  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_sqrt.cl291  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/generic/math/clc_native_tan.cl292  # Target-specific CLC builtins293  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/amdgpu/math/clc_native_exp2.cl294  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/amdgpu/math/clc_native_exp.cl295  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/amdgpu/math/clc_native_log10.cl296  ${CMAKE_CURRENT_SOURCE_DIR}/clc/lib/r600/math/clc_native_rsqrt.cl297  # OpenCL builtins298  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_cos.cl299  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_divide.cl300  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_exp.cl301  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_exp10.cl302  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_exp2.cl303  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_log.cl304  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_log10.cl305  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_log2.cl306  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_powr.cl307  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_recip.cl308  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_rsqrt.cl309  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_sin.cl310  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_sqrt.cl311  ${CMAKE_CURRENT_SOURCE_DIR}/opencl/lib/generic/math/native_tan.cl312  PROPERTIES COMPILE_OPTIONS -fapprox-func313)314 315enable_testing()316 317foreach( t ${LIBCLC_TARGETS_TO_BUILD} )318  message( STATUS "libclc target '${t}' is enabled" )319  string( REPLACE "-" ";" TRIPLE  ${t} )320  list( GET TRIPLE 0 ARCH )321  list( GET TRIPLE 1 VENDOR )322  list( GET TRIPLE 2 OS )323 324  set( opencl_dirs )325 326  if( ${ARCH} STREQUAL r600 OR ${ARCH} STREQUAL amdgcn )327    list( APPEND opencl_dirs amdgpu )328  endif()329 330  # Some targets' directories alias others331  if( ${ARCH} STREQUAL nvptx OR ${ARCH} STREQUAL nvptx64 )332    set( DARCH ptx )333  elseif( ${ARCH} STREQUAL clspv OR ${ARCH} STREQUAL clspv64 )334    set( DARCH clspv )335  elseif( ${ARCH} STREQUAL spirv OR ${ARCH} STREQUAL spirv64 )336    set( DARCH spirv )337  elseif( ${ARCH} STREQUAL amdgcn-mesa3d )338    set( DARCH amdgcn-amdhsa )339  else()340    set( DARCH ${ARCH} )341  endif()342 343  # Append a variety of target- and triple-based directories to search,344  # increasing in specificity.345  list( APPEND opencl_dirs ${DARCH} ${DARCH}-${OS} ${DARCH}-${VENDOR}-${OS} )346 347  # The 'generic' directory contains all of the generic implementations of the348  # builtins. It is included first so it has the lowest search priority,349  # allowing targets to override builtins based on file names found later in350  # the list of search directories.351  # CLC builds all builtins for all targets, so unconditionally prepend the352  # 'generic' directory.353  set( clc_dirs generic ${opencl_dirs} )354  # Some OpenCL targets don't build all builtins, in which case they don't want355  # the 'generic' directory. Otherwise, prepend the 'generic' directory.356  if ( NOT ARCH STREQUAL spirv AND NOT ARCH STREQUAL spirv64 AND357       NOT ARCH STREQUAL clspv AND NOT ARCH STREQUAL clspv64)358    list( PREPEND opencl_dirs generic )359  endif()360 361  set( clc_lib_files )362  set( clc_gen_files clc-convert.cl )363 364  libclc_configure_lib_source(365    clc_lib_files366    LIB_ROOT_DIR clc367    DIRS ${clc_dirs}368  )369 370  set( opencl_lib_files )371  set( opencl_gen_files )372 373  if( NOT ARCH STREQUAL spirv AND NOT ARCH STREQUAL spirv64 )374    if( ARCH STREQUAL clspv OR ARCH STREQUAL clspv64 )375      list( APPEND opencl_gen_files clspv-convert.cl )376    else()377      list( APPEND opencl_gen_files convert.cl )378      if ( NOT ENABLE_RUNTIME_SUBNORMAL )379        list( APPEND opencl_lib_files opencl/lib/generic/subnormal_use_default.ll )380      endif()381    endif()382  endif()383 384  libclc_configure_lib_source(385    opencl_lib_files386    LIB_ROOT_DIR opencl387    DIRS ${opencl_dirs}388  )389 390  foreach( d ${${t}_devices} )391    get_libclc_device_info(392      TRIPLE ${t}393      DEVICE ${d}394      CPU cpu395      ARCH_SUFFIX arch_suffix396      CLANG_TRIPLE clang_triple397    )398 399    message( STATUS "  device: ${d} ( ${${d}_aliases} )" )400 401    set( MACRO_ARCH ${ARCH} )402    if ( ARCH STREQUAL spirv OR ARCH STREQUAL spirv64 )403      set( build_flags -O0 -finline-hint-functions -DCLC_SPIRV )404      set( opt_flags )405      set( spvflags --spirv-max-version=1.1 )406      set( MACRO_ARCH SPIRV32 )407      if( ARCH STREQUAL spirv64 )408        set( MACRO_ARCH SPIRV64 )409      endif()410    elseif( ARCH STREQUAL clspv OR ARCH STREQUAL clspv64 )411      set( build_flags "-Wno-unknown-assumption" -DCLC_CLSPV )412      set( opt_flags -O3 )413      set( MACRO_ARCH CLSPV32 )414      if( ARCH STREQUAL clspv64 )415        set( MACRO_ARCH CLSPV64 )416      endif()417    else()418      set( build_flags )419      set( opt_flags -O3 )420    endif()421 422    set( LIBCLC_ARCH_OBJFILE_DIR "${LIBCLC_OBJFILE_DIR}/${arch_suffix}" )423    file( MAKE_DIRECTORY ${LIBCLC_ARCH_OBJFILE_DIR} )424 425    # Build for OpenCL 3.0 independently of the target or device.426    list( APPEND build_flags -cl-std=CL3.0 )427 428    string( TOUPPER "CLC_${MACRO_ARCH}" CLC_TARGET_DEFINE )429 430    list( APPEND build_flags431      -D${CLC_TARGET_DEFINE}432      # All libclc builtin libraries see CLC headers433      -I${CMAKE_CURRENT_SOURCE_DIR}/clc/include434      # Error on undefined macros435      -Werror=undef436      -fdiscard-value-names437    )438 439    if( NOT "${cpu}" STREQUAL "" )440      list( APPEND build_flags -mcpu=${cpu} )441    endif()442 443    # Generic address space support.444    # Note: when declaring builtins, we must consider that even if a target445    # formally/nominally supports the generic address space, in practice that446    # target may map it to the same target address space as another address447    # space (often the private one). In such cases we must be careful not to448    # multiply-define a builtin in a single target address space, as it would449    # result in a mangling clash.450    # For this reason we must consider the target support of the generic451    # address space separately from the *implementation* decision about whether452    # to declare certain builtins in that address space.453    # Note: we assume that if there is no distinct generic address space, it454    # maps to the private address space.455    set ( private_addrspace_val 0 )456    set ( generic_addrspace_val 0 )457    if( ARCH STREQUAL amdgcn OR ARCH STREQUAL r600 OR ARCH STREQUAL amdgcn-amdhsa )458      set ( private_addrspace_val 5 )459    endif()460    if( ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)461      set ( generic_addrspace_val 4 )462    endif()463    list( APPEND build_flags464      -D__CLC_PRIVATE_ADDRSPACE_VAL=${private_addrspace_val}465      -D__CLC_GENERIC_ADDRSPACE_VAL=${generic_addrspace_val}466    )467 468    add_libclc_builtin_set(469      CLC_INTERNAL470      ARCH ${ARCH}471      ARCH_SUFFIX clc-${arch_suffix}472      TRIPLE ${clang_triple}473      COMPILE_FLAGS ${build_flags}474      OPT_FLAGS ${opt_flags}475      LIB_FILES ${clc_lib_files}476      GEN_FILES ${clc_gen_files}477    )478 479    list( APPEND build_flags480      -I${CMAKE_CURRENT_SOURCE_DIR}/opencl/include481    )482 483    add_libclc_builtin_set(484      ARCH ${ARCH}485      ARCH_SUFFIX ${arch_suffix}486      TRIPLE ${clang_triple}487      COMPILE_FLAGS ${build_flags}488      OPT_FLAGS ${opt_flags}489      LIB_FILES ${opencl_lib_files}490      GEN_FILES ${opencl_gen_files}491      ALIASES ${${d}_aliases}492      PARENT_TARGET libclc-opencl-builtins493      # Link in the CLC builtins and internalize their symbols494      INTERNAL_LINK_DEPENDENCIES builtins.link.clc-${arch_suffix}495    )496  endforeach( d )497endforeach( t )498