diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/CMakeLists.txt b/projects/rocr-runtime/runtime/hsa-runtime/core/CMakeLists.txt index 7c59dbab4c..a7f4495203 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/CMakeLists.txt +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/CMakeLists.txt @@ -97,6 +97,20 @@ add_definitions ( -DHSA_EXPORT=1 ) add_definitions ( -DHSA_EXPORT_FINALIZER=1 ) add_definitions ( -DHSA_EXPORT_IMAGES=1 ) +if ( DEFINED BUILDID ) + add_definitions ( -DROCR_BUILD_ID=${BUILDID}) +else ( NOT DEFINED BUILDID) + ## get date information based on UTC - full date + execute_process(COMMAND date --utc +%F WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE ROCR_BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE) + ## get commit information + execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE ROCR_BUILD_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE) + ## check dirty tree status + execute_process(COMMAND "git diff --shortstat 2> /dev/null|grep \"0 files changed\"|wc -l" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE ROCR_CLEAN_TREE OUTPUT_STRIP_TRAILING_WHITESPACE) + set ( BUILD_ID "${ROCR_BUILD_COMMIT}.${ROCR_BUILD_TIME}.${ROCR_CLEAN_TREE}") + add_definitions ( -DROCR_BUILD_ID=${BUILD_ID}) +endif () + + ## ------------------------- Linux Compiler and Linker options ------------------------- set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-deprecated-declarations -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=unused-function" ) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/hsacore.so.def b/projects/rocr-runtime/runtime/hsa-runtime/core/hsacore.so.def index 769809dc96..4e04a8e2a1 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/hsacore.so.def +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/hsacore.so.def @@ -1,3 +1,4 @@ +ROCR_1 { global: hsa_init; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp index 4ae87718e8..bccd952145 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -64,6 +64,8 @@ #define HSA_VERSION_MAJOR 1 #define HSA_VERSION_MINOR 0 +const char rocrbuildid[] = "ROCR BUILD ID: " STRING(ROCR_BUILD_ID); + namespace core { bool g_use_interrupt_wait = true;