diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 5d810f733a..0a9cef6f52 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -57,7 +57,7 @@ endif() # Put Driver version into define if(NEO_DRIVER_VERSION) - set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/device/device_caps.cpp PROPERTIES COMPILE_DEFINITIONS NEO_DRIVER_VERSION="${NEO_DRIVER_VERSION}") + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/device/device_caps.cpp PROPERTIES COMPILE_DEFINITIONS "NEO_DRIVER_VERSION=${NEO_DRIVER_VERSION}") endif() if(WIN32) diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index dd9239cf05..da50d9ef22 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -41,7 +41,9 @@ static std::string vendor = "Intel(R) Corporation"; static std::string profile = "FULL_PROFILE"; static std::string spirVersions = "1.2 "; static const char *spirvVersion = "SPIR-V_1.0 "; -static std::string driverVersion = NEO_DRIVER_VERSION; +#define QTR(a) #a +#define TOSTR(b) QTR(b) +static std::string driverVersion; const char *builtInKernels = ""; // the "always available" (extension-independent) builtin kernels @@ -70,7 +72,7 @@ void Device::initializeCaps() { DEBUG_BREAK_IF(tempName.size() > name.size()); name = tempName; - driverVersion = NEO_DRIVER_VERSION; + driverVersion = TOSTR(NEO_DRIVER_VERSION); if (driverInfo) { name.assign(driverInfo.get()->getDeviceName(tempName).c_str()); diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 8ae799c220..601453b501 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -100,7 +100,7 @@ if(NOT MSVC) endif() if(NEO_DRIVER_VERSION) - set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/device/device_caps_tests.cpp PROPERTIES COMPILE_DEFINITIONS NEO_DRIVER_VERSION="${NEO_DRIVER_VERSION}") + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/device/device_caps_tests.cpp PROPERTIES COMPILE_DEFINITIONS "NEO_DRIVER_VERSION=${NEO_DRIVER_VERSION}") endif() target_link_libraries(igdrcl_tests ${NEO_MOCKABLE_LIB_NAME}) diff --git a/unit_tests/device/device_caps_tests.cpp b/unit_tests/device/device_caps_tests.cpp index af85707a4f..a118ee9af2 100644 --- a/unit_tests/device/device_caps_tests.cpp +++ b/unit_tests/device/device_caps_tests.cpp @@ -672,7 +672,11 @@ TEST(Device_GetCaps, givenSystemWithNoDriverInfoWhenGettingNameAndVersionThenRet tempName += familyName[platformDevices[0]->pPlatform->eRenderCoreFamily]; tempName += " HD Graphics NEO"; - const std::string expectedVersion = NEO_DRIVER_VERSION; +#define QTR(a) #a +#define TOSTR(b) QTR(b) + const std::string expectedVersion = TOSTR(NEO_DRIVER_VERSION); +#undef QTR +#undef TOSTR EXPECT_STREQ(tempName.c_str(), caps.name); EXPECT_STREQ(expectedVersion.c_str(), caps.driverVersion);