diff --git a/CMakeLists.txt b/CMakeLists.txt index 9443c9cbbb..eac7ad385a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -548,3 +548,4 @@ include(package.cmake) configure_file(config.h.in ${IGDRCL_BUILD_DIR}/config.h) configure_file(compiler.config.h.in ${IGDRCL_BUILD_DIR}/compiler.config.h) +configure_file(driver_version.h.in driver_version.h) # Put Driver version into define diff --git a/driver_version.h.in b/driver_version.h.in new file mode 100644 index 0000000000..c4d2787420 --- /dev/null +++ b/driver_version.h.in @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2018, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef DRIVER_VERSION_H +#define DRIVER_VERSION_H + +#cmakedefine NEO_DRIVER_VERSION ${NEO_DRIVER_VERSION} + +#endif /* DRIVER_VERSION_H */ diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 47032383d7..9d6f70aaf0 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -55,11 +55,6 @@ else() set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/command_queue/local_id_gen_sse4.cpp PROPERTIES COMPILE_FLAGS -msse4.2) 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}") -endif() - if(WIN32) if("${IGDRCL_OPTION__BITS}" STREQUAL "32" ) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") diff --git a/runtime/device/device_caps.cpp b/runtime/device/device_caps.cpp index 915d7aa4df..bf66b80f2f 100644 --- a/runtime/device/device_caps.cpp +++ b/runtime/device/device_caps.cpp @@ -21,17 +21,20 @@ */ #include "runtime/command_stream/command_stream_receiver.h" -#include #include "runtime/device/device.h" +#include "runtime/device/driver_info.h" #include "runtime/helpers/basic_math.h" #include "runtime/helpers/hw_helper.h" #include "runtime/helpers/options.h" #include "runtime/memory_manager/memory_manager.h" -#include "runtime/sharings/sharing_factory.h" -#include "runtime/device/driver_info.h" -#include "CL/cl_ext_intel.h" #include "runtime/os_interface/os_interface.h" #include "runtime/platform/extensions.h" +#include "runtime/sharings/sharing_factory.h" + +#include "CL/cl_ext_intel.h" +#include "driver_version.h" + +#include namespace OCLRT { extern const char *familyName[]; diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index a4d20c2191..6928e2380a 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -97,10 +97,6 @@ if(NOT MSVC) set_source_files_properties(helpers/uint16_sse4_tests.cpp PROPERTIES COMPILE_FLAGS -msse4.2) 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}") -endif() - target_link_libraries(igdrcl_tests ${NEO_MOCKABLE_LIB_NAME}) target_link_libraries(igdrcl_tests igdrcl_mocks) diff --git a/unit_tests/device/device_caps_tests.cpp b/unit_tests/device/device_caps_tests.cpp index b38ca85307..036d5d6d2c 100644 --- a/unit_tests/device/device_caps_tests.cpp +++ b/unit_tests/device/device_caps_tests.cpp @@ -21,21 +21,24 @@ */ #include "runtime/command_stream/command_stream_receiver.h" +#include "runtime/device/driver_info.h" #include "runtime/helpers/basic_math.h" #include "runtime/helpers/hw_info.h" -#include "runtime/os_interface/debug_settings_manager.h" -#include "runtime/os_interface/32bit_memory.h" -#include "runtime/memory_manager/os_agnostic_memory_manager.h" -#include "runtime/device/driver_info.h" -#include "hw_cmds.h" #include "runtime/helpers/options.h" +#include "runtime/memory_manager/os_agnostic_memory_manager.h" +#include "runtime/os_interface/32bit_memory.h" +#include "runtime/os_interface/debug_settings_manager.h" +#include "runtime/os_interface/os_interface.h" + #include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/helpers/debug_manager_state_restore.h" #include "unit_tests/mocks/mock_builtins.h" + +#include "hw_cmds.h" #include "test.h" -#include "gmock/gmock.h" +#include "driver_version.h" + #include -#include "runtime/os_interface/os_interface.h" namespace OCLRT { extern const char *familyName[];