Skip to content

Commit 4370630

Browse files
author
Alexander Batashev
authored
[SYCL] Add runtime library versioning (#1604)
Signed-off-by: Alexander Batashev <[email protected]>
1 parent edc87b2 commit 4370630

File tree

4 files changed

+63
-3
lines changed

4 files changed

+63
-3
lines changed

sycl/CMakeLists.txt

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ set(CMAKE_CXX_STANDARD 14)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
77
set(CMAKE_CXX_EXTENSIONS OFF)
88
option(SYCL_ENABLE_WERROR "Treat all warnings as errors in SYCL project" OFF)
9+
option(SYCL_ADD_DEV_VERSION_POSTFIX "Adds -V postfix to version string" ON)
10+
11+
set(SYCL_MAJOR_VERSION 0)
12+
set(SYCL_MINOR_VERSION 1)
13+
set(SYCL_PATCH_VERSION 0)
14+
set(SYCL_DEV_ABI_VERSION 0)
15+
if (SYCL_ADD_DEV_VERSION_POSTFIX)
16+
set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}")
17+
endif()
18+
set(SYCL_VERSION_STRING "${SYCL_MAJOR_VERSION}.${SYCL_MINOR_VERSION}.${SYCL_PATCH_VERSION}${SYCL_VERSION_POSTFIX}")
919

1020
# enable all warnings by default
1121
if (MSVC)
@@ -200,7 +210,11 @@ add_subdirectory( source )
200210

201211
# Auxilliary extras for SYCL headers/library
202212
if (NOT WIN32)
203-
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/xmethods/$<TARGET_FILE_NAME:sycl>-gdb.py" DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT sycl-headers-extras)
213+
install(FILES
214+
"${CMAKE_CURRENT_SOURCE_DIR}/xmethods/libsycl.so-gdb.py"
215+
RENAME "${CMAKE_CURRENT_SOURCE_DIR}/xmethods/$<TARGET_FILE_NAME:sycl>-gdb.py"
216+
DESTINATION lib${LLVM_LIBDIR_SUFFIX}
217+
COMPONENT sycl-headers-extras)
204218
endif()
205219

206220
# SYCL toolchain builds all components: compiler, libraries, headers, etc.

sycl/doc/ABIPolicyGuide.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ Adding a new exported symbol is considered to be non-breaking change.
3232

3333
## ABI Versioning Policy
3434

35-
TBD
35+
The release version of the DPC++ runtime library follows
36+
[Semantic Versioning](https://semver.org/) scheme: `MAJOR.MINOR.PATCH`. `MAJOR`
37+
version indicates breaking change. Version `X` is backwards incompatible with
38+
version `X-1`. `MINOR` indicates a non-breaking change. The development version
39+
of the library has a postfix `-V` that indicates breaking changes between
40+
releases. Every time a pull request introduces a breaking change, it must also
41+
uplift `V`. It is pull request author responsibility to accordingly update
42+
this version. If `V > 0` on release date, then `MAJOR_VERSION` is uplifted and
43+
`V` is set to zero.
3644

3745
## `__SYCL_EXPORT` Macro
3846

sycl/source/CMakeLists.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
#cmake_policy(SET CMP0057 NEW)
55
#include(AddLLVM)
66

7+
configure_file(
8+
${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in
9+
${CMAKE_CURRENT_BINARY_DIR}/version.rc
10+
@ONLY)
11+
712
if (SYCL_ENABLE_XPTI_TRACING)
813
if (NOT EXISTS ${LLVM_EXTERNAL_XPTI_SOURCE_DIR})
914
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)
1924
set(LIB_OBJ_NAME ${LIB_NAME}_object)
2025

2126
add_library(${LIB_OBJ_NAME} OBJECT ${ARG_SOURCES})
22-
add_library(${LIB_NAME} SHARED $<TARGET_OBJECTS:${LIB_OBJ_NAME}>)
27+
add_library(${LIB_NAME} SHARED
28+
$<TARGET_OBJECTS:${LIB_OBJ_NAME}>
29+
${CMAKE_CURRENT_BINARY_DIR}/version.rc)
30+
2331
if (ARG_COMPILE_OPTIONS)
2432
target_compile_options(${LIB_OBJ_NAME} PRIVATE ${ARG_COMPILE_OPTIONS})
2533
endif()
@@ -78,6 +86,10 @@ function(add_sycl_rt_library LIB_NAME)
7886

7987
add_common_options(${LIB_NAME})
8088

89+
set_target_properties(${LIB_NAME} PROPERTIES
90+
VERSION ${SYCL_VERSION_STRING}
91+
SOVERSION ${SYCL_MAJOR_VERSION})
92+
8193
endfunction(add_sycl_rt_library)
8294

8395
set(SYCL_SOURCES

sycl/source/version.rc.in

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#define VER_FILEVERSION @SYCL_MAJOR_VERSION@,@SYCL_MINOR_VERSION@,@SYCL_PATCH_VERSION@,@SYCL_DEV_ABI_VERSION@
2+
#define VER_FILEVERSION_STR "@SYCL_VERSION_STRING@\0"
3+
4+
#define VER_PRODUCTVERSION @SYCL_MAJOR_VERSION@,@SYCL_MINOR_VERSION@,0,0
5+
#define VER_PRODUCTVERSION_STR "@SYCL_MAJOR_VERSION@.@SYCL_MINOR_VERSION@\0"
6+
7+
1 VERSIONINFO
8+
FILEVERSION VER_FILEVERSION
9+
PRODUCTVERSION VER_PRODUCTVERSION
10+
BEGIN
11+
BLOCK "StringFileInfo"
12+
BEGIN
13+
BLOCK "040904E4"
14+
BEGIN
15+
VALUE "FileVersion", VER_FILEVERSION_STR
16+
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
17+
END
18+
END
19+
/* For some reason the ProductVersion would not appear unless I add */
20+
/* the following section: VarFileInfo */
21+
BLOCK "VarFileInfo"
22+
BEGIN
23+
VALUE "Translation", 0x0409, 1252
24+
END
25+
END
26+

0 commit comments

Comments
 (0)