From 1057626dedee2657ae773c7872edbcaa4c538c2b Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Wed, 22 Apr 2020 13:21:38 +0300 Subject: [PATCH 1/5] [SYCL] Add runtime library versioning Signed-off-by: Alexander Batashev --- sycl/CMakeLists.txt | 9 +++++++++ sycl/source/CMakeLists.txt | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index bb3d985ec4d29..86434ac1cd306 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -6,6 +6,15 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) option(SYCL_ENABLE_WERROR "Treat all warnings as errors in SYCL project" OFF) +option(SYCL_ENABLE_VERSION_POSTFIX "Adds -V postfix to version string" ON) + +set(SYCL_MAJOR_VERSION 0) +set(SYCL_MINOR_VERSION 1) +set(SYCL_PATCH_VERSION 0) +if (SYCL_ENABLE_VERSION_POSTFIX) + set(SYCL_VERSION_POSTFIX "-0") +endif() +set(SYCL_VERSION_STRING "${SYCL_MAJOR_VERSION}.${SYCL_MINOR_VERSION}.${SYCL_PATCH_VERSION}${SYCL_VERSION_POSTFIX}") # enable all warnings by default if (MSVC) diff --git a/sycl/source/CMakeLists.txt b/sycl/source/CMakeLists.txt index d4619bfff785b..21d912d81ba2f 100644 --- a/sycl/source/CMakeLists.txt +++ b/sycl/source/CMakeLists.txt @@ -74,6 +74,10 @@ function(add_sycl_rt_library LIB_NAME) add_common_options(${LIB_NAME}) + set_target_properties(${LIB_NAME} PROPERTIES + VERSION ${SYCL_VERSION_STRING} + SOVERSION ${SYCL_MAJOR_VERSION}) + endfunction(add_sycl_rt_library) set(SYCL_SOURCES From 6ba2b0da201235d9cd39b872576c286bbd010639 Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Wed, 22 Apr 2020 14:58:06 +0300 Subject: [PATCH 2/5] Add Windows support Signed-off-by: Alexander Batashev --- sycl/CMakeLists.txt | 3 ++- sycl/source/CMakeLists.txt | 10 +++++++++- sycl/source/version.rc.in | 25 +++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 sycl/source/version.rc.in diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index 86434ac1cd306..3efa885185a5a 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -11,8 +11,9 @@ option(SYCL_ENABLE_VERSION_POSTFIX "Adds -V postfix to version string" ON) set(SYCL_MAJOR_VERSION 0) set(SYCL_MINOR_VERSION 1) set(SYCL_PATCH_VERSION 0) +set(SYCL_DEV_ABI_VERSION 0) if (SYCL_ENABLE_VERSION_POSTFIX) - set(SYCL_VERSION_POSTFIX "-0") + set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}") endif() set(SYCL_VERSION_STRING "${SYCL_MAJOR_VERSION}.${SYCL_MINOR_VERSION}.${SYCL_PATCH_VERSION}${SYCL_VERSION_POSTFIX}") diff --git a/sycl/source/CMakeLists.txt b/sycl/source/CMakeLists.txt index 21d912d81ba2f..03c5312e6db7f 100644 --- a/sycl/source/CMakeLists.txt +++ b/sycl/source/CMakeLists.txt @@ -4,6 +4,11 @@ #cmake_policy(SET CMP0057 NEW) #include(AddLLVM) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/version.rc + @ONLY) + if (SYCL_ENABLE_XPTI_TRACING) if (NOT EXISTS ${LLVM_EXTERNAL_XPTI_SOURCE_DIR}) message (FATAL_ERROR "Undefined LLVM_EXTERNAL_XPTI_SOURCE_DIR variable: Must be set when XPTI tracing is set to ON") @@ -19,7 +24,10 @@ function(add_sycl_rt_library LIB_NAME) set(LIB_OBJ_NAME ${LIB_NAME}_object) add_library(${LIB_OBJ_NAME} OBJECT ${ARG_SOURCES}) - add_library(${LIB_NAME} SHARED $) + add_library(${LIB_NAME} SHARED + $ + ${CMAKE_CURRENT_BINARY_DIR}/version.rc) + if (ARG_COMPILE_OPTIONS) target_compile_options(${LIB_OBJ_NAME} PRIVATE ${ARG_COMPILE_OPTIONS}) endif() diff --git a/sycl/source/version.rc.in b/sycl/source/version.rc.in new file mode 100644 index 0000000000000..12661ba2b3a1b --- /dev/null +++ b/sycl/source/version.rc.in @@ -0,0 +1,25 @@ +#define VER_FILEVERSION @SYCL_MAJOR_VERSION@,@SYCL_MINOR_VERSION@,@SYCL_PATCH_VERSION@,@SYCL_DEV_ABI_VERSION@ +#define VER_FILEVERSION_STR "@SYCL_VERSION_STRING@\0" + +#define VER_PRODUCTVERSION @SYCL_MAJOR_VERSION@,@SYCL_MINOR_VERSION@,0,0 +#define VER_PRODUCTVERSION_STR "@SYCL_MAJOR_VERSION@.@SYCL_MINOR_VERSION@\0" + +1 VERSIONINFO +FILEVERSION VER_FILEVERSION +PRODUCTVERSION VER_PRODUCTVERSION +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "ProductVersion", VER_PRODUCTVERSION_STR + END + END + /* For some reason the ProductVersion would not appear unless I add */ + /* the following section: VarFileInfo */ + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END \ No newline at end of file From cc62207e946677e29234f3c83b07a142b2e1b7ea Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Thu, 23 Apr 2020 16:09:10 +0300 Subject: [PATCH 3/5] Rename xmethods script Signed-off-by: Alexander Batashev --- sycl/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index 86434ac1cd306..7761cda53693b 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -209,7 +209,11 @@ add_subdirectory( source ) # Auxilliary extras for SYCL headers/library if (NOT WIN32) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/xmethods/$-gdb.py" DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT sycl-headers-extras) + install(FILES + "${CMAKE_CURRENT_SOURCE_DIR}/xmethods/libsycl.so-gdb.py" + RENAME "${CMAKE_CURRENT_SOURCE_DIR}/xmethods/$-gdb.py" + DESTINATION lib${LLVM_LIBDIR_SUFFIX} + COMPONENT sycl-headers-extras) endif() # SYCL toolchain builds all components: compiler, libraries, headers, etc. From 2184c38043e5116df5f5447d5d53dc59f060da4b Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Sun, 26 Apr 2020 22:10:07 +0300 Subject: [PATCH 4/5] Add Versioning Policy Signed-off-by: Alexander Batashev --- sycl/doc/ABIPolicyGuide.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sycl/doc/ABIPolicyGuide.md b/sycl/doc/ABIPolicyGuide.md index 09f3607101a5e..4a8bcd409d72f 100644 --- a/sycl/doc/ABIPolicyGuide.md +++ b/sycl/doc/ABIPolicyGuide.md @@ -32,7 +32,15 @@ Adding a new exported symbol is considered to be non-breaking change. ## ABI Versioning Policy -TBD +The release version of the DPC++ runtime library follows +[Semantic Versioning](https://semver.org/) scheme: `MAJOR.MINOR.PATCH`. `MAJOR` +version indicates breaking change. Version `X` is backwards incompatible with +version `X-1`. `MINOR` indicates a non-breaking change. The development version +of the library has a postfix `-V` that indicates breaking changes between +releases. Every time a pull request introduces a breaking change, it must also +uplift `V`. It is pull request author responsibility to accordingly update +this version. If `V > 0` on release date, then `MAJOR_VERSION` is uplifted and +`V` is set to zero. ## `__SYCL_EXPORT` Macro From 4fc6691c7ffedd68a32ec093a1f9c30687df368e Mon Sep 17 00:00:00 2001 From: Alexander Batashev Date: Wed, 29 Apr 2020 10:14:31 +0300 Subject: [PATCH 5/5] Minor improvements Signed-off-by: Alexander Batashev --- sycl/CMakeLists.txt | 4 ++-- sycl/source/version.rc.in | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index e0309ed3e0dc7..c480e1267ca8e 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -6,13 +6,13 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) option(SYCL_ENABLE_WERROR "Treat all warnings as errors in SYCL project" OFF) -option(SYCL_ENABLE_VERSION_POSTFIX "Adds -V postfix to version string" ON) +option(SYCL_ADD_DEV_VERSION_POSTFIX "Adds -V postfix to version string" ON) set(SYCL_MAJOR_VERSION 0) set(SYCL_MINOR_VERSION 1) set(SYCL_PATCH_VERSION 0) set(SYCL_DEV_ABI_VERSION 0) -if (SYCL_ENABLE_VERSION_POSTFIX) +if (SYCL_ADD_DEV_VERSION_POSTFIX) set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}") endif() set(SYCL_VERSION_STRING "${SYCL_MAJOR_VERSION}.${SYCL_MINOR_VERSION}.${SYCL_PATCH_VERSION}${SYCL_VERSION_POSTFIX}") diff --git a/sycl/source/version.rc.in b/sycl/source/version.rc.in index 12661ba2b3a1b..b5d947ff5bdb5 100644 --- a/sycl/source/version.rc.in +++ b/sycl/source/version.rc.in @@ -22,4 +22,5 @@ BEGIN BEGIN VALUE "Translation", 0x0409, 1252 END -END \ No newline at end of file +END +