diff --git a/projects/clr/hipamd/src/hiprtc/CMakeLists.txt b/projects/clr/hipamd/src/hiprtc/CMakeLists.txt index 33f8334be5..60799f4aba 100644 --- a/projects/clr/hipamd/src/hiprtc/CMakeLists.txt +++ b/projects/clr/hipamd/src/hiprtc/CMakeLists.txt @@ -35,6 +35,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") if(BUILD_SHARED_LIBS) add_library(hiprtc SHARED) + target_compile_definitions(hiprtc PRIVATE BUILD_SHARED_LIBS) # Windows doesn't have a strip utility, so CMAKE_STRIP won't be set. if((CMAKE_BUILD_TYPE STREQUAL "Release") AND NOT ("${CMAKE_STRIP}" STREQUAL "")) add_custom_command(TARGET hiprtc POST_BUILD COMMAND ${CMAKE_STRIP} $) diff --git a/projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp b/projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp index de597272aa..d81d930bd6 100644 --- a/projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp +++ b/projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp @@ -65,6 +65,8 @@ RTCProgram::RTCProgram(std::string name) : name_(name) { } bool RTCProgram::findIsa() { + +#ifdef BUILD_SHARED_LIBS const char* libName; #ifdef _WIN32 std::string dll_name = std::string("amdhip64_" + std::to_string(HIP_VERSION_MAJOR) + ".dll"); @@ -121,6 +123,23 @@ bool RTCProgram::findIsa() { amd::Os::unloadLibrary(handle); return true; + +#else + int device; + hipError_t status = hipGetDevice(&device); + if (status != hipSuccess) { + return false; + } + hipDeviceProp_t props; + status = hipGetDeviceProperties(&props, device); + if (status != hipSuccess) { + return false; + } + isa_ = "amdgcn-amd-amdhsa--"; + isa_.append(props.gcnArchName); + + return true; +#endif } // RTC Compile Program Member Functions