Skip to content

Commit c21ee11

Browse files
linking also utils lib statically in wrapper
1 parent 9a1112c commit c21ee11

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

cmake/AddGRBInstall.cmake

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ set( HYBRID_BACKEND_INSTALL_DIR "${BINARY_LIBRARIES_INSTALL_DIR}/hybrid" )
5454
set( COMMON_COMPILE_DEFINITIONS "${REFERENCE_INCLUDE_DEFS};${REFERENCE_OMP_INCLUDE_DEFS}" )
5555
set( COMMON_COMPILE_OPTIONS "-fopenmp" )
5656

57-
# link flags common to all backends, to be inserted before and after the
58-
# backend-specific flags
59-
set( COMMON_LFLAGS_PRE
60-
"-l${ALP_UTILS_LIBRARY_OUTPUT_NAME};-L '${BINARY_LIBRARIES_INSTALL_DIR}'"
61-
)
57+
# link flags common to all backends, to be inserted after the backend-specific flags
6258
if( WITH_NUMA )
6359
list( APPEND COMMON_LFLAGS_POST "-lnuma" )
6460
endif()

src/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ add_subdirectory( transition )
2828
### BUILD WRAPPER SCRIPTS FOR INSTALLATION
2929

3030
assert_valid_variables( AVAILABLE_BACKENDS CMAKE_INSTALL_PREFIX INCLUDE_INSTALL_DIR
31-
VERSION BIN_INSTALL_DIR COMMON_LFLAGS_PRE COMMON_LFLAGS_POST
31+
VERSION BIN_INSTALL_DIR COMMON_LFLAGS_POST
3232
)
3333

3434
if( WITH_BSP1D_BACKEND OR WITH_HYBRID_BACKEND )
@@ -94,7 +94,6 @@ joinWithNewLine( library_dir LIBRARY_DIRS_SPACED )
9494

9595
joinWithNewLine( compile_options_list BACKEND_CFLAGS_SPACED )
9696
joinWithNewLine( link_flags_list BACKEND_LFLAGS_SPACED )
97-
list( JOIN COMMON_LFLAGS_PRE " " COMMON_LFLAGS_PRE_SPACED )
9897
list( JOIN COMMON_LFLAGS_POST " " COMMON_LFLAGS_POST_SPACED )
9998
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/grbcxx.in ${CMAKE_CURRENT_BINARY_DIR}/grbcxx @ONLY )
10099

src/grbcxx.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ BACKENDLFLAGS=(@BACKEND_LFLAGS_SPACED@)
2424
VERSION="@VERSION@"
2525
BACKEND_LIBRARY_OUTPUT_NAME="@BACKEND_LIBRARY_OUTPUT_NAME@"
2626
LIBRARY_DIRS=(@LIBRARY_DIRS_SPACED@)
27+
UTILS_LIBRARY_NAME="@ALP_UTILS_LIBRARY_OUTPUT_NAME@"
28+
UTILS_LIBRARY_DIR="@ALP_UTILS_INSTALL_DIR@"
2729

2830
declare -a ARGS
2931
LINK="dynamic"
@@ -127,11 +129,11 @@ then
127129
fi
128130

129131
if [[ "${LINK}" == "dynamic" ]]; then
130-
LIB="-l${BACKEND_LIBRARY_OUTPUT_NAME} -L '${LIBRARY_DIRS[${BACKENDID}]}'"
132+
LIB="-l${UTILS_LIBRARY_NAME} -L '${UTILS_LIBRARY_DIR}' -l${BACKEND_LIBRARY_OUTPUT_NAME} -L '${LIBRARY_DIRS[${BACKENDID}]}'"
131133
else
132-
LIB="'${LIBRARY_DIRS[${BACKENDID}]}/lib${BACKEND_LIBRARY_OUTPUT_NAME}.a'"
134+
LIB="'${UTILS_LIBRARY_DIR}/lib${UTILS_LIBRARY_NAME}.a' '${LIBRARY_DIRS[${BACKENDID}]}/lib${BACKEND_LIBRARY_OUTPUT_NAME}.a'"
133135
fi
134-
LFLAGS="@COMMON_LFLAGS_PRE_SPACED@ ${LIB} ${BACKENDLFLAGS[${BACKENDID}]} @COMMON_LFLAGS_POST_SPACED@"
136+
LFLAGS="${LIB} ${BACKENDLFLAGS[${BACKENDID}]} @COMMON_LFLAGS_POST_SPACED@"
135137

136138
CMD="${COMPILER} -std=${CXXSTD} -I'${INCLUDEDIR}' ${BACKENDCFLAGS[${BACKENDID}]} ${ARGS[@]} "$@" ${LFLAGS}"
137139

0 commit comments

Comments
 (0)