Skip to content

Commit bb563b1

Browse files
kkwlixingxue-ibm
andauthored
[OpenMP][AIX] Not to create symbolic links to libomp.so on AIX (#165890)
On AIX, it generates libomp for both static and dynamic. There is no need to create symbolic links to libomp.so. --------- Co-authored-by: Xing Xue <[email protected]>
1 parent 2b45efe commit bb563b1

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

openmp/runtime/src/CMakeLists.txt

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -254,23 +254,35 @@ set(LIBOMP_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
254254

255255
# Add symbolic links to libomp
256256
if(NOT WIN32)
257-
add_custom_command(TARGET omp POST_BUILD
258-
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE}
259-
libgomp${LIBOMP_LIBRARY_SUFFIX}
260-
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE}
261-
libiomp5${LIBOMP_LIBRARY_SUFFIX}
262-
WORKING_DIRECTORY ${LIBOMP_LIBRARY_DIR}
263-
)
264-
if(LIBOMP_ENABLE_SHARED)
265-
if(APPLE)
266-
set(VERSIONED_LIBGOMP_NAME libgomp.1${LIBOMP_LIBRARY_SUFFIX})
267-
else()
268-
set(VERSIONED_LIBGOMP_NAME libgomp${LIBOMP_LIBRARY_SUFFIX}.1)
269-
endif()
257+
if(AIX)
258+
# On AIX, libomp.a is the name for both static and shared objects.
259+
set(LIBOMP_AIX_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
270260
add_custom_command(TARGET omp POST_BUILD
271-
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE} ${VERSIONED_LIBGOMP_NAME}
261+
COMMAND ${CMAKE_COMMAND} -E create_symlink
262+
${LIBOMP_LIB_NAME}${LIBOMP_AIX_SUFFIX} libgomp${LIBOMP_AIX_SUFFIX}
263+
COMMAND ${CMAKE_COMMAND} -E create_symlink
264+
${LIBOMP_LIB_NAME}${LIBOMP_AIX_SUFFIX} libiomp5${LIBOMP_AIX_SUFFIX}
272265
WORKING_DIRECTORY ${LIBOMP_LIBRARY_DIR}
273266
)
267+
else()
268+
add_custom_command(TARGET omp POST_BUILD
269+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE}
270+
libiomp5${LIBOMP_LIBRARY_SUFFIX}
271+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE}
272+
libgomp${LIBOMP_LIBRARY_SUFFIX}
273+
WORKING_DIRECTORY ${LIBOMP_LIBRARY_DIR}
274+
)
275+
if(LIBOMP_ENABLE_SHARED)
276+
if(APPLE)
277+
set(VERSIONED_LIBGOMP_NAME libgomp.1${LIBOMP_LIBRARY_SUFFIX})
278+
else()
279+
set(VERSIONED_LIBGOMP_NAME libgomp${LIBOMP_LIBRARY_SUFFIX}.1)
280+
endif()
281+
add_custom_command(TARGET omp POST_BUILD
282+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE} ${VERSIONED_LIBGOMP_NAME}
283+
WORKING_DIRECTORY ${LIBOMP_LIBRARY_DIR}
284+
)
285+
endif()
274286
endif()
275287
endif()
276288

0 commit comments

Comments
 (0)