diff --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt --- a/openmp/libomptarget/DeviceRTL/CMakeLists.txt +++ b/openmp/libomptarget/DeviceRTL/CMakeLists.txt @@ -241,3 +241,22 @@ foreach(mcpu ${amdgpu_mcpus}) compileDeviceRTLLibrary(${mcpu} amdgpu -target amdgcn-amd-amdhsa -D__AMDGCN__ -nogpulib) endforeach() + +# Set the flags to build the device runtime from clang. +set(clang_lib_flags -fopenmp -fopenmp-cuda-mode -foffload-lto -fvisibility=hidden -mllvm -openmp-opt-disable -nogpulib -nostdinc -DSHARED_SCRATCHPAD_SIZE=512) +foreach(arch ${nvptx_sm_list}) + set(clang_lib_flags ${clang_lib_flags} --offload-arch=sm_${arch}) +endforeach() +foreach(arch ${amdgpu_mcpus}) + set(clang_lib_flags ${clang_lib_flags} --offload-arch=${arch}) +endforeach() + +# Build the static library version of the device runtime. +add_library(omptarget.devicertl STATIC) +target_compile_features(omptarget.devicertl PRIVATE cxx_std_17) +target_include_directories(omptarget.devicertl PRIVATE ${include_directory} ${devicertl_base_directory}/../include) +target_compile_options(omptarget.devicertl PRIVATE ${clang_lib_flags}) + +install(TARGETS omptarget.devicertl ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR}) + +add_subdirectory(src) diff --git a/openmp/libomptarget/DeviceRTL/src/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/src/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/openmp/libomptarget/DeviceRTL/src/CMakeLists.txt @@ -0,0 +1,13 @@ +target_sources(omptarget.devicertl PRIVATE + Configuration.cpp + Debug.cpp + Kernel.cpp + Mapping.cpp + Misc.cpp + Parallelism.cpp + Reduction.cpp + State.cpp + Synchronization.cpp + Tasking.cpp + Utils.cpp + Workshare.cpp)