Skip to content

Commit b16dc10

Browse files
author
Diptorup Deb
committed
Use linker scripts instead of symlink.
1 parent 414f0a6 commit b16dc10

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

dpctl-capi/CMakeLists.txt

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,24 +147,38 @@ 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}
159+
)
160+
161+
set(linker_script1
162+
"INPUT(libDPCTLSyclInterface.so libDPCTLSyclInterface.so.${VERSION_MAJOR})"
163+
)
164+
set(linker_script2
165+
"INPUT(libDPCTLSyclInterface.so.${VERSION_MAJOR} libDPCTLSyclInterface.so.${VERSION_MAJOR}.${VERSION_MINOR})"
166+
)
167+
add_custom_command(TARGET DPCTLSyclInterface POST_BUILD
168+
COMMAND "${CMAKE_COMMAND}" -E remove "libDPCTLSyclInterface.so"
169+
COMMAND "${CMAKE_COMMAND}" -E echo "${linker_script1}" > "libDPCTLSyclInterface.so"
170+
COMMAND "${CMAKE_COMMAND}" -E remove "libDPCTLSyclInterface.so.${VERSION_MAJOR}"
171+
COMMAND "${CMAKE_COMMAND}" -E echo "${linker_script2}" > "libDPCTLSyclInterface.so.${VERSION_MAJOR}"
172+
VERBATIM
173+
)
174+
150175
if(DPCTL_ENABLE_LO_PROGRAM_CREATION)
151176
target_include_directories(DPCTLSyclInterface
152177
PRIVATE
153178
${LEVEL_ZERO_INCLUDE_DIR}
154179
)
155180
endif()
156181

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-
168182
install(TARGETS
169183
DPCTLSyclInterface
170184
LIBRARY

0 commit comments

Comments
 (0)