diff --git a/CMakeLists.txt b/CMakeLists.txt index c21f247..5bd3e45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,6 @@ if (NOT WIN32) # C++17 does not require the std lib linking target_link_libraries(hipconfig.bin ${LINK_LIBS} ) # for hipconfig.bin endif() -set(HIP_VERSION_MAJOR 4 PARENT_SCOPE) -set(HIP_VERSION_MINOR 4 PARENT_SCOPE) -set(HIP_VERSION_PATCH 4 PARENT_SCOPE) +set(HIP_VERSION_MAJOR @version_major@) +set(HIP_VERSION_MINOR @version_minor@) +set(HIP_VERSION_PATCH @version_patch@) diff --git a/src/hipBin_amd.h b/src/hipBin_amd.h index f94e4a5..f0b1b83 100644 --- a/src/hipBin_amd.h +++ b/src/hipBin_amd.h @@ -207,7 +207,7 @@ void HipBinAmd::initializeHipCXXFlags() { hipClangIncludePath = getCompilerIncludePath(); hipCXXFlags += " -isystem \"" + hipClangIncludePath; fs::path hipCXXFlagsTempFs = hipCXXFlags; - hipCXXFlagsTempFs /= "..\""; + hipCXXFlagsTempFs /= "\""; hipCXXFlags = hipCXXFlagsTempFs.string(); const EnvVariables& var = getEnvVariables(); // Allow __fp16 as function parameter and return type. @@ -266,7 +266,7 @@ void HipBinAmd::printCompilerInfo() const { string cmd = hipClangPath + "/clang++ --version"; system(cmd.c_str()); // hipclang version cout << "llc-version :" << endl; - cmd = hipClangPath + "/llc --version"; + cmd = "@llvm@/bin/llc --version"; system(cmd.c_str()); // llc version cout << "hip-clang-cxxflags :" << endl; cmd = hipPath + "/bin/hipcc --cxxflags"; @@ -278,7 +278,7 @@ void HipBinAmd::printCompilerInfo() const { } else { string cmd = hipClangPath + "/clang++ --version"; system(cmd.c_str()); // hipclang version - cmd = hipClangPath + "/llc --version"; + cmd = "@llvm@/bin/llc --version"; system(cmd.c_str()); // llc version cout << "hip-clang-cxxflags :" << endl; cmd = hipPath + "/bin/hipcc --cxxflags"; @@ -331,10 +331,7 @@ string HipBinAmd::getCppConfig() { hipPathInclude /= "include"; const string& compilerPath = getCompilerPath(); - hipClangInclude = compilerPath; - hipClangInclude = hipClangInclude.parent_path(); - hipClangInclude /= "lib/clang/"; - hipClangInclude /= compilerVersion; + hipClangInclude = "@clang@/resource-root/include"; string hipClangPath = hipClangInclude.string(); const OsType& osInfo = getOSInfo(); @@ -442,17 +439,7 @@ string HipBinAmd::getHipCC() const { string HipBinAmd::getCompilerIncludePath() { - string hipClangVersion, includePath, compilerIncludePath; - const string& hipClangPath = getCompilerPath(); - hipClangVersion = getCompilerVersion(); - fs::path includePathfs = hipClangPath; - includePathfs = includePathfs.parent_path(); - includePathfs /= "lib/clang/"; - includePathfs /= hipClangVersion; - includePathfs /= "include"; - includePathfs = fs::absolute(includePathfs).string(); - compilerIncludePath = includePathfs.string(); - return compilerIncludePath; + return "@clang@/resource-root/include"; } @@ -506,8 +493,8 @@ void HipBinAmd::printFull() { cout << endl << "== Envirnoment Variables" << endl; printEnvironmentVariables(); getSystemInfo(); - if (fs::exists("/usr/bin/lsb_release")) - system("/usr/bin/lsb_release -a"); + if (fs::exists("@lsb_release@/bin/lsb_release")) + system("@lsb_release@/bin/lsb_release -a"); cout << endl; } @@ -993,7 +980,7 @@ void HipBinAmd::executeHipCCCmd(vector argv) { } else if (os != windows) { // Else try using rocm_agent_enumerator string ROCM_AGENT_ENUM; - ROCM_AGENT_ENUM = roccmPath + "/bin/rocm_agent_enumerator"; + ROCM_AGENT_ENUM = "@rocminfo@/bin/rocm_agent_enumerator"; targetsStr = ROCM_AGENT_ENUM +" -t GPU"; SystemCmdOut sysOut = hipBinUtilPtr_->exec(targetsStr.c_str()); regex toReplace("\n+"); @@ -1097,7 +1084,7 @@ void HipBinAmd::executeHipCCCmd(vector argv) { string hipClangVersion, toolArgTemp; if (linkType == 0) { toolArgTemp = " -L"+ hipLibPath + "-lamdhip64 -L" + - roccmPath+ "/lib -lhsa-runtime64 -ldl -lnuma " + toolArgs; + "@rocm_runtime@/lib -lhsa-runtime64 -ldl -lnuma " + toolArgs; toolArgs = toolArgTemp; } else { toolArgTemp = toolArgs + " -Wl,--enable-new-dtags -Wl,-rpath=" + hipLibPath + ":" @@ -1107,8 +1094,7 @@ void HipBinAmd::executeHipCCCmd(vector argv) { hipClangVersion = getCompilerVersion(); // To support __fp16 and _Float16, explicitly link with compiler-rt - toolArgs += " -L" + hipClangPath + "/../lib/clang/" + - hipClangVersion + "/lib/linux -lclang_rt.builtins-x86_64 "; + toolArgs += " -L@clang@/resource-root/lib/linux -lclang_rt.builtins-x86_64 "; } if (!var.hipccCompileFlagsAppendEnv_.empty()) { HIPCXXFLAGS += " " + var.hipccCompileFlagsAppendEnv_ + " "; diff --git a/src/hipBin_nvidia.h b/src/hipBin_nvidia.h index 6feb315..b61739d 100644 --- a/src/hipBin_nvidia.h +++ b/src/hipBin_nvidia.h @@ -157,8 +157,8 @@ void HipBinNvidia::printFull() { cout << endl << "== Envirnoment Variables" << endl; printEnvironmentVariables(); getSystemInfo(); - if (fs::exists("/usr/bin/lsb_release")) - system("/usr/bin/lsb_release -a"); + if (fs::exists("@lsb_release@/bin/lsb_release")) + system("@lsb_release@/bin/lsb_release -a"); } // returns hip include