1 function(add_startup_object name)
4 "ALIAS" # Option argument
5 "SRC" # Single value arguments
6 "DEPENDS;COMPILE_OPTIONS" # Multi value arguments
10 get_fq_target_name(${name} fq_target_name)
11 if(ADD_STARTUP_OBJECT_ALIAS)
12 get_fq_deps_list(fq_dep_list ${ADD_STARTUP_OBJECT_DEPENDS})
13 add_library(${fq_target_name} ALIAS ${fq_dep_list})
19 SRCS ${ADD_STARTUP_OBJECT_SRC}
20 DEPENDS ${ADD_STARTUP_OBJECT_DEPENDS}
21 COMPILE_OPTIONS ${ADD_STARTUP_OBJECT_COMPILE_OPTIONS}
23 set_target_properties(
30 if(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
31 add_subdirectory(amdgpu)
39 elseif(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
40 add_subdirectory(nvptx)
49 # Skip building the startup code if there are no supported GPUs.
50 message(STATUS "Skipping startup for gpu target, no GPUs were detected")
54 add_custom_target(libc-startup)
55 set(startup_components crt1)
56 foreach(target IN LISTS startup_components)
57 set(fq_target_name libc.startup.gpu.${target})
58 add_dependencies(libc-startup ${fq_target_name})
59 install(FILES $<TARGET_OBJECTS:${fq_target_name}>
60 DESTINATION ${CMAKE_INSTALL_LIBDIR}
61 RENAME $<TARGET_PROPERTY:${fq_target_name},OUTPUT_NAME>