Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant setting of environment variables #1561

Merged
merged 21 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6a3f1e8
remove deprecated setting of PYTHONPATH and redundant sourcing of nes…
clinssen Apr 28, 2020
6f60d78
add debug statements to Travis build/test script
clinssen Apr 28, 2020
f985feb
add debug statements to Travis build/test script; set runpath for libs
clinssen Apr 29, 2020
2cda395
remove debug statements to Travis build/test script
clinssen Apr 29, 2020
71d8d64
add documentation of RPATH logic in cmake script
clinssen Apr 29, 2020
2335d03
add DYLD_LIBRARY_PATH for MacOS
clinssen May 2, 2020
e1f5e33
remove setting environment variables in CMakeLists and do_tests; sour…
clinssen May 2, 2020
170327e
fix syntax in Travis build script
clinssen May 2, 2020
2c7f2a8
fix path to nest_vars.sh in CMakeLists
clinssen May 2, 2020
a1c5681
add debug message to CMakeLists
clinssen May 2, 2020
a259d6a
add debug message to CMakeLists
clinssen May 2, 2020
b1d52bf
hard-code correct Travis path for testing
clinssen May 2, 2020
f4ab0b6
move sourcing nest_vars.sh to do_tests.sh
clinssen May 5, 2020
20eb440
make nest_vars.sh and do_tests.sh more portable across shells
clinssen May 5, 2020
6e916a2
Merge remote-tracking branch 'origin/master' into paths_cleanup
clinssen May 5, 2020
4715911
fix CMake variable syntax in do_tests.sh.in
clinssen May 5, 2020
f901877
add comment about ensuring make install always runs before make insta…
clinssen May 5, 2020
9501009
update comment in CMakeLists
clinssen May 7, 2020
57a23b2
fix RPATH setting for MacOS
clinssen May 7, 2020
87a6733
Merge remote-tracking branch 'clinssen/paths_cleanup' into paths_cleanup
clinssen May 7, 2020
23de22d
update comment in ProcessOptions.cmake
clinssen May 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,23 +197,27 @@ file( MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/reports/ )
if ( HAVE_PYTHON )
add_custom_target( installcheck
COMMAND ${CMAKE_COMMAND} -E env
NEST_PATH=${CMAKE_INSTALL_FULL_BINDIR}
PYTHON="${PYTHON}"
NEST_PYTHONPATH="${CMAKE_INSTALL_PREFIX}/${PYEXECDIR}"
${CMAKE_INSTALL_FULL_DATADIR}/extras/do_tests.sh --test-pynest
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
COMMENT "Execute NEST's testsuite...."
)
else ()
add_custom_target( installcheck
COMMAND ${CMAKE_COMMAND} -E env
NEST_PATH=${CMAKE_INSTALL_FULL_BINDIR}
${CMAKE_INSTALL_FULL_DATADIR}/extras/do_tests.sh
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
COMMENT "Execute NEST's testsuite...."
)
endif ()

# N.B. to ensure "make install" is always run before "make installcheck", we
# would ideally like to add:
# add_dependencies( installcheck install )
# However, an issue in CMake at time of writing (May 2020, see
# https://gitlab.kitware.com/cmake/cmake/-/issues/8438) precludes us from doing
# so.

heplesser marked this conversation as resolved.
Show resolved Hide resolved
################################################################################
################## Define Subdirectories here ##################
################################################################################
Expand Down
22 changes: 20 additions & 2 deletions cmake/ProcessOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,34 @@ function( NEST_PROCESS_STATIC_LIBRARIES )
# (but later on when installing)
set( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE PARENT_SCOPE )

# set the rpath only when installed
# set run-time search path (RPATH) so that dynamic libraries in ``lib/nest`` can be located

# Note: "$ORIGIN" (on Linux) and "@loader_path" (on MacOS) are not CMake variables, but special keywords for the
# Linux resp. the macOS dynamic loader. They refer to the path in which the object is located, e.g.
# ``${CMAKE_INSTALL_PREFIX}/bin`` for the nest and sli executables, ``${CMAKE_INSTALL_PREFIX}/lib/nest`` for all
# dynamic libraries except PyNEST (libnestkernel.so, etc.), and something like
# ``${CMAKE_INSTALL_PREFIX}/lib/python3.x/site-packages/nest`` for ``pynestkernel.so``. The RPATH is relative to
# this origin, so the binary ``bin/nest`` can find the files in the relative location ``../lib/nest``, and
# similarly for PyNEST and the other libraries. For simplicity, we set all the possibilities on all generated
# objects.

# PyNEST can only act as an entry point; it does not need to be included in the other objects' RPATH itself.

if ( APPLE )
set( CMAKE_INSTALL_RPATH
# for binaries
"@loader_path/../${CMAKE_INSTALL_LIBDIR}/nest"
# for pynestkernel: @loader_path at <prefix>/lib/python3.x/site-packages/nest
# for libraries (except pynestkernel)
"@loader_path/../../${CMAKE_INSTALL_LIBDIR}/nest"
# for pynestkernel: origin at <prefix>/lib/python3.x/site-packages/nest
"@loader_path/../../../nest"
PARENT_SCOPE )
else ()
set( CMAKE_INSTALL_RPATH
# for binaries
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/nest"
# for libraries (except pynestkernel)
"\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}/nest"
jougs marked this conversation as resolved.
Show resolved Hide resolved
# for pynestkernel: origin at <prefix>/lib/python3.x/site-packages/nest
"\$ORIGIN/../../../nest"
PARENT_SCOPE )
Expand Down
2 changes: 1 addition & 1 deletion extras/nest_vars.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export NEST_DATA_DIR="${NEST_INSTALL_DIR}/@CMAKE_INSTALL_DATADIR@"
export NEST_DOC_DIR="${NEST_INSTALL_DIR}/@CMAKE_INSTALL_DOCDIR@"

# The path in which NEST dynamic libraries are found. Works also if $(DY)LD_LIBRARY_PATH is undefined.
if [[ "$OSTYPE" == "darwin"* ]]; then
if [ "`uname`" = "Darwin" ]; then
export DYLD_LIBRARY_PATH="$NEST_INSTALL_DIR/@CMAKE_INSTALL_LIBDIR@/nest"${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
else
export LD_LIBRARY_PATH="$NEST_INSTALL_DIR/@CMAKE_INSTALL_LIBDIR@/nest"${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
Expand Down
12 changes: 6 additions & 6 deletions extras/travis_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ if [ "$xPYTHON" = "1" ] ; then
if [[ $OSTYPE = darwin* ]]; then
CONFIGURE_PYTHON="-DPYTHON_LIBRARY=/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/include//python3.7m/"
fi
export PYTHONPATH=/usr/lib/x86_64-linux-gnu/:$PYTHONPATH

mkdir -p $HOME/.matplotlib
cat > $HOME/.matplotlib/matplotlibrc <<EOF
backend : svg
Expand Down Expand Up @@ -108,7 +106,11 @@ if [ "$xLIBNEUROSIM" = "1" ] ; then
CONFIGURE_LIBNEUROSIM="-Dwith-libneurosim=$HOME/.cache/libneurosim.install"
chmod +x extras/install_csa-libneurosim.sh
./extras/install_csa-libneurosim.sh
export LD_LIBRARY_PATH=$HOME/.cache/csa.install/lib:$LD_LIBRARY_PATH
if [[ $OSTYPE == darwin* ]]; then
jougs marked this conversation as resolved.
Show resolved Hide resolved
export DYLD_LIBRARY_PATH=$HOME/.cache/csa.install/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
else
export LD_LIBRARY_PATH=$HOME/.cache/csa.install/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
fi
else
CONFIGURE_LIBNEUROSIM="-Dwith-libneurosim=OFF"
fi
Expand All @@ -117,7 +119,7 @@ if [[ $OSTYPE = darwin* ]]; then
export CC=$(ls /usr/local/bin/gcc-* | grep '^/usr/local/bin/gcc-\d$')
export CXX=$(ls /usr/local/bin/g++-* | grep '^/usr/local/bin/g++-\d$')
fi

NEST_VPATH=build
NEST_RESULT=result
if [ "$(uname -s)" = 'Linux' ]; then
Expand Down Expand Up @@ -282,8 +284,6 @@ echo "MSGBLD0270: Running make install."
make install
echo "MSGBLD0280: Make install completed."

source $NEST_RESULT/bin/nest_vars.sh

jougs marked this conversation as resolved.
Show resolved Hide resolved
echo
echo "+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"
echo "+ R U N N E S T T E S T S U I T E +"
Expand Down
11 changes: 5 additions & 6 deletions testsuite/do_tests.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
# They return a specific exit code
#

#
# set up environment variables
#
. @CMAKE_INSTALL_FULL_BINDIR@/nest_vars.sh

#
# usage [exit_code bad_option]
#
Expand Down Expand Up @@ -350,12 +355,6 @@ run_test ()
rm -f "${TEST_OUTFILE}" "${TEST_RETFILE}"
}

# Set environment variables.
# The NEST_ variants of the global variables were set by
# cmake during configuration.
export PYTHONPATH="${NEST_PYTHONPATH}:${PYTHONPATH}"
export PATH="${NEST_PATH}:${PATH}"

# Gather some information about the host
INFO_ARCH="$(uname -m)"
INFO_HOME="$(/bin/sh -c 'echo ~')"
Expand Down