Skip to content

Commit 368911d

Browse files
Diptorup Deboleksandr-pavlyk
Diptorup Deb
andauthored
Use linker scripts instead of symlink. (#472)
* Use linker scripts instead of symlink. * Use same VERSION and SOVERSION Since Python (or dlopen) is not able to follow chained linker scripts set both properties to be the same, and use one linker script for .so file which redirectes to .so.MAJOR.MINOR * Execute linker script on Unix only Co-authored-by: Oleksandr Pavlyk <oleksandr.pavlyk@intel.com>
1 parent 612fe24 commit 368911d

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

dpctl-capi/CMakeLists.txt

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,24 +147,36 @@ target_link_libraries(DPCTLSyclInterface
147147
PRIVATE ${IntelSycl_OPENCL_LIBRARY}
148148
)
149149

150+
include(GetProjectVersion)
151+
# the get_version function is defined in the GetProjectVersion module and
152+
# defines: VERSION, SEMVER, MAJOR, MINOR, PATCH. These variables are populated
153+
# by parsing the output of git describe.
154+
get_version()
155+
set_target_properties(DPCTLSyclInterface
156+
PROPERTIES
157+
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}
158+
SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}
159+
)
160+
161+
if(UNIX)
162+
set(linker_script1
163+
"INPUT(libDPCTLSyclInterface.so.${VERSION_MAJOR}.${VERSION_MINOR})"
164+
)
165+
add_custom_command(TARGET DPCTLSyclInterface POST_BUILD
166+
COMMAND "${CMAKE_COMMAND}" -E remove "libDPCTLSyclInterface.so"
167+
COMMAND "${CMAKE_COMMAND}"
168+
-E echo "${linker_script1}" > "libDPCTLSyclInterface.so"
169+
VERBATIM
170+
)
171+
endif()
172+
150173
if(DPCTL_ENABLE_LO_PROGRAM_CREATION)
151174
target_include_directories(DPCTLSyclInterface
152175
PRIVATE
153176
${LEVEL_ZERO_INCLUDE_DIR}
154177
)
155178
endif()
156179

157-
# FIXME: Turning off for release until conda build can be packaging symbolic links
158-
# NOTE: Till we hit 1.0.0 we will keep using the MINOR version to set the API
159-
# version of the library.
160-
# include(GetProjectVersion)
161-
# the get_version function is defined in the GetProjectVersion module and
162-
# defines: VERSION, SEMVER, MAJOR, MINOR, PATCH. These variables are populated
163-
# by parsing the output of git describe.
164-
# get_version()
165-
# set_target_properties(DPCTLSyclInterface PROPERTIES VERSION ${VERSION_MINOR})
166-
# set_target_properties(DPCTLSyclInterface PROPERTIES SOVERSION 1)
167-
168180
install(TARGETS
169181
DPCTLSyclInterface
170182
LIBRARY

0 commit comments

Comments
 (0)