================
@@ -227,35 +180,45 @@ set(compile_flags
   ${target_compile_flags}
 )
 
-set(_common_defs
+set(common_defs
   ${target_extra_defines}
   __CLC_PRIVATE_ADDRSPACE_VAL=${private_addrspace_val}
   __CLC_GENERIC_ADDRSPACE_VAL=${generic_addrspace_val}
 )
 
-# Build the CLC internal builtins library.
-string(REPLACE "-" "_" lib_suffix ${LIBCLC_TARGET})
-set(clc_lib clc_builtins_${lib_suffix})
-add_libclc_builtin_library(${clc_lib}
-  SOURCES ${clc_sources}
+# Configure the CLC internal builtins library.
+set(LIBCLC_CLC_TARGET clc)
+libclc_add_builtin_library(${LIBCLC_CLC_TARGET}
   COMPILE_OPTIONS ${compile_flags}
   INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/clc/include
-  COMPILE_DEFINITIONS ${_common_defs}
+  COMPILE_DEFINITIONS ${common_defs}
   FOLDER "libclc/Device IR/CLC"
 )
 
-# Build, link, and install the final OpenCL builtins library.
-add_libclc_library(libclc-${LIBCLC_TARGET}
-  ARCH ${ARCH}
-  TRIPLE ${clang_triple}
-  TARGET_TRIPLE ${LIBCLC_TARGET}
-  SOURCES ${opencl_sources}
+set(LIBCLC_OPENCL_TARGET opencl)
+libclc_add_builtin_library(${LIBCLC_OPENCL_TARGET}
   COMPILE_OPTIONS ${compile_flags} "SHELL:-Xclang -fdeclare-opencl-builtins"
   INCLUDE_DIRS
     ${CMAKE_CURRENT_SOURCE_DIR}/clc/include
     ${CMAKE_CURRENT_SOURCE_DIR}/opencl/include
-  COMPILE_DEFINITIONS ${_common_defs}
-  INTERNALIZE_LIBRARIES ${clc_lib}
+  COMPILE_DEFINITIONS ${common_defs}
+  FOLDER "libclc/Device IR/Intermediate"
+)
+
+add_subdirectory(clc)
+add_subdirectory(opencl)
+
+add_custom_target(libclc ALL)
+add_custom_target(libclc-opencl-builtins COMMENT "Build libclc OpenCL 
builtins")
+add_dependencies(libclc libclc-opencl-builtins)
----------------
wenju-he wrote:

keep above 3 lines at old earlier place or before the first 
libclc_add_builtin_library? This place will see definition of multiple 
libraries. Putting top-level `add_custom_target(libclc ALL)` target here might 
not be appropriate.

https://github.com/llvm/llvm-project/pull/197034
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to