From b01fb5d72f7e24ec8f9c373b5bd90efa9b7aa411 Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Tue, 15 Jun 2021 05:29:20 -0400 Subject: [PATCH] Revert "SWDEV-288593 - hip-config only adds compile and link options to C++" This reverts commit 641514cdb1b0c5e5d24542093b1d25f2deb96048. Reason for revert: Need to rework this to support older cmake releases as well. Change-Id: I95dd2311c0166656099229128ed5344eb761942e --- hip-config.cmake.in | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/hip-config.cmake.in b/hip-config.cmake.in index 31790d3431..914d71be17 100755 --- a/hip-config.cmake.in +++ b/hip-config.cmake.in @@ -187,15 +187,16 @@ if(HIP_COMPILER STREQUAL "clang") if (NOT compilePropIsSet AND HIP_CXX_COMPILER MATCHES ".*clang\\+\\+") set_property(TARGET hip::device APPEND PROPERTY - INTERFACE_COMPILE_OPTIONS "$<$:SHELL:-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() if (NOT compilePropIsSet) - set_property(TARGET hip::device APPEND PROPERTY - INTERFACE_COMPILE_OPTIONS "$<$:SHELL:-x hip>" - ) - if (NOT EXISTS ${AMD_DEVICE_LIBS_PREFIX}/amdgcn/bitcode) + if (EXISTS ${AMD_DEVICE_LIBS_PREFIX}/amdgcn/bitcode) + set_property(TARGET hip::device APPEND PROPERTY + INTERFACE_COMPILE_OPTIONS -xhip + ) + else() # This path is to support an older build of the device library # TODO: To be removed in the future. if(WIN32) @@ -207,14 +208,14 @@ if(HIP_COMPILER STREQUAL "clang") ) else() set_property(TARGET hip::device APPEND PROPERTY - INTERFACE_COMPILE_OPTIONS "$<$:--hip-device-lib-path=${AMD_DEVICE_LIBS_PREFIX}/lib>" + INTERFACE_COMPILE_OPTIONS -xhip --hip-device-lib-path=${AMD_DEVICE_LIBS_PREFIX}/lib ) endif() endif() endif() set_property(TARGET hip::device APPEND PROPERTY - INTERFACE_LINK_LIBRARIES "$<$:--hip-link>" + INTERFACE_LINK_LIBRARIES --hip-link ) set_property(TARGET hip::device APPEND PROPERTY @@ -228,11 +229,11 @@ if(HIP_COMPILER STREQUAL "clang") foreach(GPU_TARGET ${GPU_TARGETS}) if (NOT compilePropIsSet) set_property(TARGET hip::device APPEND PROPERTY - INTERFACE_COMPILE_OPTIONS "$<$:--offload-arch=${GPU_TARGET}>" + INTERFACE_COMPILE_OPTIONS "--offload-arch=${GPU_TARGET}" ) endif() set_property(TARGET hip::device APPEND PROPERTY - INTERFACE_LINK_LIBRARIES "$<$:--offload-arch=${GPU_TARGET}>" + INTERFACE_LINK_LIBRARIES "--offload-arch=${GPU_TARGET}" ) endforeach() #Add support for parallel build and link @@ -243,11 +244,11 @@ if(HIP_COMPILER STREQUAL "clang") if(${HIP_CLANG_SUPPORTS_PARALLEL_JOBS} ) if (NOT compilePropIsSet) set_property(TARGET hip::device APPEND PROPERTY - INTERFACE_COMPILE_OPTIONS "$<$:-parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS};-Wno-format-nonliteral>" + INTERFACE_COMPILE_OPTIONS -parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS} -Wno-format-nonliteral ) endif() 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} ) else() message("clang compiler doesn't support parallel jobs") @@ -256,10 +257,10 @@ if(HIP_COMPILER STREQUAL "clang") # Add support for __fp16 and _Float16, explicitly link with compiler-rt set_property(TARGET hip::host APPEND PROPERTY - INTERFACE_LINK_LIBRARIES "$<$:${HIP_CLANG_INCLUDE_PATH}/../lib/linux/libclang_rt.builtins-x86_64.a>" + INTERFACE_LINK_LIBRARIES "-L\"${HIP_CLANG_INCLUDE_PATH}/../lib/linux\" -lclang_rt.builtins-x86_64" ) set_property(TARGET hip::device APPEND PROPERTY - INTERFACE_LINK_LIBRARIES "$<$:${HIP_CLANG_INCLUDE_PATH}/../lib/linux/libclang_rt.builtins-x86_64.a>" + INTERFACE_LINK_LIBRARIES "-L\"${HIP_CLANG_INCLUDE_PATH}/../lib/linux\" -lclang_rt.builtins-x86_64" ) endif()