Skip to content
Snippets Groups Projects
Commit ab7b7f10 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

MNT: Add FSLDEVDIR to rpath entry for shared libs/exes

parent 1f2af62d
No related branches found
No related tags found
1 merge request!30Mnt/fsldevdir rpath
...@@ -78,17 +78,19 @@ ARCHNVCCLDFLAGS = ...@@ -78,17 +78,19 @@ ARCHNVCCLDFLAGS =
# #
##################################################################### #####################################################################
# Drop -rpath flags from LDFLAGS if it is # Drop -rpath flags from LDFLAGS if it is set in
# set in the environment - we explicitly # the environment - we explicitly add them below
# add them below such that executables # such that executables will be able to find libs
# will be able to find libs in $(pwd) and # in $(pwd), $FSLDEVDIR/lib, and $FSLDIR/lib *in
# in $FSLDIR/lib *in that order*. This is # that order*. This is so that executables
# so that executables located in the # located in the project source dir can be
# project source dir can be executed in # executed in place with sensible behaviour (i.e.
# place with sensible behaviour (i.e. any # any shared libs located in the same dir will
# shared libs located in the same dir will # take precedence over libs of the same name in
# take precedence over libs of the same # $FSLDIR/lib/).
# name in $FSLDIR/lib/). #
# Fortunately -Wl,-rpath is used for both g++ and
# clang, so we can cover both with one substitution.
COMMA := , COMMA := ,
_LDFLAGS := $(patsubst -Wl${COMMA}-rpath%,,${LDFLAGS}) _LDFLAGS := $(patsubst -Wl${COMMA}-rpath%,,${LDFLAGS})
LDFLAGS = ${_LDFLAGS} LDFLAGS = ${_LDFLAGS}
...@@ -101,8 +103,12 @@ ifeq ($(SYSTYPE), Darwin) ...@@ -101,8 +103,12 @@ ifeq ($(SYSTYPE), Darwin)
CXX ?= clang++ CXX ?= clang++
CFLAGS ?= -arch x86_64 -Wall -pedantic CFLAGS ?= -arch x86_64 -Wall -pedantic
CXXFLAGS ?= -arch x86_64 -Wall -pedantic CXXFLAGS ?= -arch x86_64 -Wall -pedantic
LDFLAGS += -Wl,-rpath,"@executable_path/" \ LDFLAGS += -Wl,-rpath,"@executable_path/"
-Wl,-rpath,"${FSLDIR}/lib" # Only add FSLDEVDIR if different to FSLDIR
ifneq (${FSLDEVDIR}, ${FSLDIR})
LDFLAGS += -Wl,-rpath,"${FSLDEVDIR}/lib"
endif
LDFLAGS += -Wl,-rpath,"${FSLDIR}/lib"
ARCHLIBS += -llapack -lblas -lz -lm ARCHLIBS += -llapack -lblas -lz -lm
# On macOS, we need to change the install # On macOS, we need to change the install
...@@ -131,8 +137,15 @@ ifeq ($(SYSTYPE), Linux) ...@@ -131,8 +137,15 @@ ifeq ($(SYSTYPE), Linux)
-Wall -pedantic -Wno-long-long -Wall -pedantic -Wno-long-long
CXXFLAGS ?= -fexpensive-optimizations \ CXXFLAGS ?= -fexpensive-optimizations \
-Wall -pedantic -Wno-long-long -Wall -pedantic -Wno-long-long
LDFLAGS += -Wl,-rpath,'$$ORIGIN:${FSLDIR}/lib' \ LDFLAGS += -Wl,-rpath,'$$ORIGIN' \
-Wl,-rpath-link,'$$ORIGIN:${FSLDIR}/lib' -Wl,-rpath-link,'$$ORIGIN'
# Only add FSLDEVDIR if different to FSLDIR
ifneq (${FSLDEVDIR}, ${FSLDIR})
LDFLAGS += -Wl,-rpath,'${FSLDEVDIR}/lib' \
-Wl,-rpath-link,'${FSLDEVDIR}/lib'
endif
LDFLAGS += -Wl,-rpath,'${FSLDIR}/lib' \
-Wl,-rpath-link,'${FSLDIR}/lib'
ARCHLIBS += -lopenblas -lz -lm ARCHLIBS += -lopenblas -lz -lm
endif endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment