diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt index bb3d985ec4d29..c480e1267ca8e 100644 --- a/sycl/CMakeLists.txt +++ b/sycl/CMakeLists.txt @@ -6,6 +6,16 @@ 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_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_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}") # enable all warnings by default if (MSVC) @@ -200,7 +210,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. 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 diff --git a/sycl/source/CMakeLists.txt b/sycl/source/CMakeLists.txt index d4619bfff785b..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() @@ -74,6 +82,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 diff --git a/sycl/source/version.rc.in b/sycl/source/version.rc.in new file mode 100644 index 0000000000000..b5d947ff5bdb5 --- /dev/null +++ b/sycl/source/version.rc.in @@ -0,0 +1,26 @@ +#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 +