SWDEV-262810: skip duplicate compile flag inclusion

Change-Id: I02ebfb3cbaf6ec25819de0c4952795c6cc949e4d


[ROCm/clr commit: 567a95b4e4]
This commit is contained in:
Sarbojit Sarkar
2020-12-14 01:48:43 -05:00
committed by Sarbojit Sarkar
parent 7cecbfee83
commit e2171447ff
+25 -17
View File
@@ -151,22 +151,26 @@ else()
endif() endif()
if(HIP_COMPILER STREQUAL "clang") if(HIP_COMPILER STREQUAL "clang")
if (HIP_CXX_COMPILER MATCHES ".*clang\\+\\+") get_property(compilePropIsSet TARGET hip::device PROPERTY INTERFACE_COMPILE_OPTIONS SET)
if (NOT compilePropIsSet AND HIP_CXX_COMPILER MATCHES ".*clang\\+\\+")
set_property(TARGET hip::device APPEND PROPERTY set_property(TARGET hip::device APPEND PROPERTY
INTERFACE_COMPILE_OPTIONS -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false INTERFACE_COMPILE_OPTIONS -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false
) )
endif() endif()
if (EXISTS ${AMD_DEVICE_LIBS_PREFIX}/amdgcn/bitcode) if (NOT compilePropIsSet)
set_property(TARGET hip::device APPEND PROPERTY if (EXISTS ${AMD_DEVICE_LIBS_PREFIX}/amdgcn/bitcode)
INTERFACE_COMPILE_OPTIONS -xhip set_property(TARGET hip::device APPEND PROPERTY
) INTERFACE_COMPILE_OPTIONS -xhip
else() )
# This path is to support an older build of the device library else()
# TODO: To be removed in the future. # This path is to support an older build of the device library
set_property(TARGET hip::device APPEND PROPERTY # TODO: To be removed in the future.
INTERFACE_COMPILE_OPTIONS -xhip --hip-device-lib-path=${AMD_DEVICE_LIBS_PREFIX}/lib set_property(TARGET hip::device APPEND PROPERTY
) INTERFACE_COMPILE_OPTIONS -xhip --hip-device-lib-path=${AMD_DEVICE_LIBS_PREFIX}/lib
)
endif()
endif() endif()
set_property(TARGET hip::device APPEND PROPERTY set_property(TARGET hip::device APPEND PROPERTY
@@ -182,9 +186,11 @@ if(HIP_COMPILER STREQUAL "clang")
) )
foreach(GPU_TARGET ${GPU_TARGETS}) foreach(GPU_TARGET ${GPU_TARGETS})
set_property(TARGET hip::device APPEND PROPERTY if (NOT compilePropIsSet)
INTERFACE_COMPILE_OPTIONS "--offload-arch=${GPU_TARGET}" set_property(TARGET hip::device APPEND PROPERTY
) INTERFACE_COMPILE_OPTIONS "--offload-arch=${GPU_TARGET}"
)
endif()
set_property(TARGET hip::device APPEND PROPERTY set_property(TARGET hip::device APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "--offload-arch=${GPU_TARGET}" INTERFACE_LINK_LIBRARIES "--offload-arch=${GPU_TARGET}"
) )
@@ -195,9 +201,11 @@ if(HIP_COMPILER STREQUAL "clang")
endif() endif()
if(HIP_CLANG_NUM_PARALLEL_JOBS GREATER 1) if(HIP_CLANG_NUM_PARALLEL_JOBS GREATER 1)
if(${HIP_CLANG_SUPPORTS_PARALLEL_JOBS} ) if(${HIP_CLANG_SUPPORTS_PARALLEL_JOBS} )
set_property(TARGET hip::device APPEND PROPERTY if (NOT compilePropIsSet)
INTERFACE_COMPILE_OPTIONS -parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS} -Wno-format-nonliteral set_property(TARGET hip::device APPEND PROPERTY
) INTERFACE_COMPILE_OPTIONS -parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS} -Wno-format-nonliteral
)
endif()
set_property(TARGET hip::device APPEND PROPERTY set_property(TARGET hip::device APPEND PROPERTY
INTERFACE_LINK_LIBRARIES -parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS} INTERFACE_LINK_LIBRARIES -parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS}
) )