Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build with RelWithDebInfo configuration #99

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ endif()
## Include common cmake modules
include(utils)

if (NOT DEFINED CPACK_RESOURCE_FILE_LICENSE)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
endif()

set(ROCM_SMI "rocm_smi")
set(ROCM_SMI_COMPONENT "lib${ROCM_SMI}")
set(ROCM_SMI_TARGET "${ROCM_SMI}64")
Expand Down Expand Up @@ -96,7 +100,7 @@ endif ()
# Use this instead of above for 32 bit
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")

if ("${CMAKE_BUILD_TYPE}" STREQUAL Release)
if ("${CMAKE_BUILD_TYPE}" MATCHES Rel.*)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0 -DDEBUG")
Expand Down Expand Up @@ -170,7 +174,9 @@ install(FILES
install(EXPORT rocm_smiTargets DESTINATION
"${ROCM_SMI}/lib/cmake" COMPONENT dev)


#License file
set(CPACK_RPM_PACKAGE_LICENSE "NCSA")
install( FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION share/doc/smi-lib RENAME LICENSE.txt)

###########################
# Packaging directives
Expand Down
5 changes: 3 additions & 2 deletions src/rocm_smi_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) {
ret = RSMI_STATUS_NOT_SUPPORTED;
}
fs.close();

return ret;
}

Expand Down Expand Up @@ -742,7 +742,8 @@ int Device::readDevInfoMultiLineStr(DevInfoTypes type,
return 0;
}
// Remove any *trailing* empty (whitespace) lines
while (retVec->back().find_first_not_of(" \t\n\v\f\r") == std::string::npos) {
while (retVec->size() != 0 &&
retVec->back().find_first_not_of(" \t\n\v\f\r") == std::string::npos) {
retVec->pop_back();
}
return 0;
Expand Down