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

Avoid naming conflicts by installing shared objects to lib/nest instead of lib #1513

Merged
merged 8 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 0 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,6 @@ set( CMAKE_INSTALL_DATADIR "share/${PROJECT_NAME}" CACHE STRING "Relative direct

include( GNUInstallDirs )

################################################################################
################# Do not install into /usr/local #################
################################################################################

get_filename_component(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
# If CMAKE_INSTALL_PREFIX is omitted CMake will set the installation prefix to its default '/usr/local'.
# This is not desired. A subdirectory is allowed, e.g. 'usr/local/nest'.
if ( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local" )
message( FATAL_ERROR "Do not install into '${CMAKE_INSTALL_PREFIX}'. Please set -DCMAKE_INSTALL_PREFIX:PATH=<install prefix>." )
endif ()

################################################################################
################## Find utility programs ##################
################################################################################
Expand Down
3 changes: 3 additions & 0 deletions cmake/ConfigureSummary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ function( NEST_PRINT_CONFIG_SUMMARY )
message( "The NEST executable will be installed to:" )
message( " ${CMAKE_INSTALL_FULL_BINDIR}/" )
message( "" )
message( "NEST dynamic libraries and user modules will be installed to:" )
message( " ${CMAKE_INSTALL_FULL_LIBDIR}/nest/" )
message( "" )
message( "Documentation and examples will be installed to:" )
message( " ${CMAKE_INSTALL_FULL_DOCDIR}/" )
message( "" )
Expand Down
8 changes: 2 additions & 6 deletions cmake/ProcessOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,14 @@ function( NEST_PROCESS_STATIC_LIBRARIES )
# set the rpath only when installed
if ( APPLE )
set( CMAKE_INSTALL_RPATH
"@loader_path/../${CMAKE_INSTALL_LIBDIR}"
"@loader_path/../${CMAKE_INSTALL_LIBDIR}/nest"
# for pynestkernel: @loader_path at <prefix>/lib/python2.7/site-packages/nest
"@loader_path/../../.."
# for pynestkernel: @loader_path at <prefix>/lib/python3.x/site-packages/nest
"@loader_path/../../../nest"
PARENT_SCOPE )
else ()
set( CMAKE_INSTALL_RPATH
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/nest"
# for pynestkernel: origin at <prefix>/lib/python2.7/site-packages/nest
"\$ORIGIN/../../.."
# for pynestkernel: origin at <prefix>/lib/python3.x/site-packages/nest
"\$ORIGIN/../../../nest"
PARENT_SCOPE )
endif ()
Expand Down
4 changes: 2 additions & 2 deletions conngen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ target_include_directories( conngen PRIVATE
)

install( TARGETS conngen
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down
2 changes: 1 addition & 1 deletion doc/installation/linux_install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ What gets installed where
By default, everything will be installed to the subdirectories ``/install/path/{bin,lib,share}``, where ``/install/path`` is the install path given to ``cmake``:

- Executables ``/install/path/bin``
- Dynamic libraries ``/install/path/lib/``
- Dynamic libraries ``/install/path/lib/nest``
- SLI libraries ``/install/path/share/nest/sli``
- Documentation ``/install/path/share/doc/nest``
- Examples ``/install/path/share/doc/nest/examples``
Expand Down
23 changes: 11 additions & 12 deletions examples/MyModule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,11 @@ execute_process(
# on OS X
set( CMAKE_MACOSX_RPATH ON )

# Use the NEST_INSTALL_* variables as CMAKE_INSTALL_*, if not set explicitly.
if ( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local" )
set( CMAKE_INSTALL_PREFIX "${NEST_INSTALL_PREFIX}" CACHE STRING "Install path prefix, prepended onto install directories." FORCE )
set( CMAKE_INSTALL_LIBDIR "${NEST_LIBDIR}/nest" CACHE STRING "object code libraries (lib/nest or lib64/nest or lib/<multiarch-tuple>/nest on Debian)" FORCE )
set( CMAKE_INSTALL_DOCDIR "${NEST_INSTALL_DOCDIR}" CACHE STRING "documentation root (DATAROOTDIR/doc/nest)" FORCE )
set( CMAKE_INSTALL_DATADIR "${NEST_INSTALL_DATADIR}" CACHE STRING "read-only architecture-independent data (DATAROOTDIR/nest)" FORCE )
endif ()
# Use the NEST_INSTALL_* variables as CMAKE_INSTALL_*
set( CMAKE_INSTALL_PREFIX "${NEST_INSTALL_PREFIX}" CACHE STRING "Install path prefix, prepended onto install directories." FORCE )
set( CMAKE_INSTALL_LIBDIR "${NEST_LIBDIR}" CACHE STRING "object code libraries (lib/nest or lib64/nest or lib/<multiarch-tuple>/nest on Debian)" FORCE )
set( CMAKE_INSTALL_DOCDIR "${NEST_INSTALL_DOCDIR}" CACHE STRING "documentation root (DATAROOTDIR/doc/nest)" FORCE )
set( CMAKE_INSTALL_DATADIR "${NEST_INSTALL_DATADIR}" CACHE STRING "read-only architecture-independent data (DATAROOTDIR/nest)" FORCE )

include( GNUInstallDirs )

Expand Down Expand Up @@ -285,7 +283,7 @@ if ( BUILD_SHARED_LIBS )
PREFIX ""
OUTPUT_NAME ${MODULE_NAME} )
install( TARGETS ${MODULE_NAME}_module
DESTINATION ${CMAKE_INSTALL_LIBDIR}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
)
endif ()

Expand All @@ -303,7 +301,7 @@ set_target_properties( ${MODULE_NAME}_lib
OUTPUT_NAME ${MODULE_NAME} )

# Install library, header and sli init files.
install( TARGETS ${MODULE_NAME}_lib DESTINATION ${CMAKE_INSTALL_LIBDIR} )
install( TARGETS ${MODULE_NAME}_lib DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest )
install( FILES ${MODULE_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${MODULE_NAME} )
install( DIRECTORY sli DESTINATION ${CMAKE_INSTALL_DATADIR} )

Expand Down Expand Up @@ -364,7 +362,7 @@ message( " make" )
message( " make install" )
message( "" )
message( "The library file lib${MODULE_NAME}.so will be installed to" )
message( " ${CMAKE_INSTALL_FULL_LIBDIR}" )
message( " ${CMAKE_INSTALL_FULL_LIBDIR}/nest/" )
message( "Help files will be installed to" )
message( " ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}" )
message( "" )
Expand All @@ -373,10 +371,11 @@ message( " (${MODULE_NAME}) Install (in SLI)" )
message( " nest.Install('${MODULE_NAME}') (in PyNEST)" )
message( "" )

if( NOT "${CMAKE_INSTALL_PREFIX}" EQUAL "${NEST_INSTALL_PREFIX}" )
if( NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "${NEST_INSTALL_PREFIX}" )
message( "The module will be installed into a non-default location!" )
message( "Make sure to set the environment variables:" )
message( " export NEST_MODULE_PATH=${CMAKE_INSTALL_FULL_LIBDIR}:$NEST_MODULE_PATH" )
message( " export LD_LIBRARY_PATH=${CMAKE_INSTALL_FULL_LIBDIR}/nest:$LD_LIBRARY_PATH" )
message( "Note that on the Mac, the variable LD_LIBRARY_PATH is called DYLD_LIBRARY_PATH." )
message( " export SLI_PATH=${CMAKE_INSTALL_FULL_DATADIR}/sli:$SLI_PATH" )
message( "" )
endif ()
2 changes: 1 addition & 1 deletion extras/nest-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ while test $# -gt 0; do
echo "@ALL_CXXFLAGS@"
;;
--libs)
echo "-L$prefix/@CMAKE_INSTALL_LIBDIR@ @ALL_LIBS@"
echo "-L$prefix/@CMAKE_INSTALL_LIBDIR@/nest @ALL_LIBS@"
jougs marked this conversation as resolved.
Show resolved Hide resolved
;;
--compiler)
echo "@CMAKE_CXX_COMPILER@"
Expand Down
14 changes: 9 additions & 5 deletions extras/nest_vars.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ export NEST_DATA_DIR="${NEST_INSTALL_DIR}/@CMAKE_INSTALL_DATADIR@"
# NEST finds help files $NEST_DOC_DIR/help
export NEST_DOC_DIR="${NEST_INSTALL_DIR}/@CMAKE_INSTALL_DOCDIR@"

# The path where NEST looks for user modules.
export NEST_MODULE_PATH="${NEST_INSTALL_DIR}/@CMAKE_INSTALL_LIBDIR@/nest"
# The path in which NEST dynamic libraries are found. Works also if $(DY)LD_LIBRARY_PATH is undefined.
if [[ "$OSTYPE" == "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}
fi

# The path where the PyNEST bindings are installed.
export NEST_PYTHON_PREFIX="${NEST_INSTALL_DIR}/@PYEXECDIR@"

# Prepend NEST to PYTHONPATH in a safe way even if PYTHONPATH is undefined
export PYTHONPATH="${NEST_PYTHON_PREFIX}${PYTHONPATH:+:$PYTHONPATH}"
# Prepend NEST to PYTHONPATH. Works also if $PYTHONPATH is undefined.
export PYTHONPATH="$NEST_PYTHON_PREFIX${PYTHONPATH:+:$PYTHONPATH}"

# Make nest / sli /... executables visible.
# Make nest/sli/... executables visible.
export PATH="${NEST_INSTALL_DIR}/bin:${PATH}"
4 changes: 3 additions & 1 deletion extras/travis_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ if [ "$xSTATIC_ANALYSIS" = "1" ]; then
# Set the command line arguments for the static code analysis script and execute it.

# The names of the static code analysis tools executables.
VERA=vera++
VERA=vera++
clinssen marked this conversation as resolved.
Show resolved Hide resolved
CPPCHECK=cppcheck
CLANG_FORMAT=clang-format
PEP8=pep8
Expand Down Expand Up @@ -275,6 +275,8 @@ echo "MSGBLD0270: Running make install."
make install
echo "MSGBLD0280: Make install completed."

source $NEST_RESULT/bin/nest_vars.sh

echo
echo "+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"
echo "+ R U N N E S T T E S T S U I T E +"
Expand Down
4 changes: 2 additions & 2 deletions libnestutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ target_include_directories( nestutil PRIVATE
)

install( TARGETS nestutil
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down
4 changes: 2 additions & 2 deletions librandom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ target_include_directories( randomtest PRIVATE
)

install( TARGETS random
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down
4 changes: 2 additions & 2 deletions models/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ target_include_directories( models PRIVATE
)

install( TARGETS models
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down
4 changes: 2 additions & 2 deletions nest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ if ( HAVE_PYTHON )
endif ()

install( TARGETS nest nest_lib
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down
4 changes: 2 additions & 2 deletions nestkernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ target_include_directories( nestkernel PRIVATE
)

install( TARGETS nestkernel
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down
19 changes: 2 additions & 17 deletions nestkernel/dynamicloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,24 +272,9 @@ DynamicLoaderModule::init( SLIInterpreter* i )

int dl_error = lt_dlinit();

if ( not dl_error )
if ( dl_error )
{
const char* path = getenv( "NEST_MODULE_PATH" );
if ( path != NULL )
{
LOG( M_DEBUG, "DynamicLoaderModule::init", "Setting module path to" );
LOG( M_DEBUG, "DynamicLoaderModule::init", path );

dl_error = lt_dlsetsearchpath( path );
if ( dl_error )
{
LOG( M_ERROR, "DynamicLoaderModule::init", "Could not set dynamic module path." );
}
}
}
else
{
LOG( M_ERROR, "DynamicLoaderModule::init", "Could not initialize libltdl. No dynamic modules will be avaiable." );
LOG( M_ERROR, "DynamicLoaderModule::init", "Could not initialize libltdl. No dynamic modules will be available." );
}
}

Expand Down
4 changes: 2 additions & 2 deletions precise/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ target_include_directories( precise PRIVATE
)

install( TARGETS precise
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down
4 changes: 2 additions & 2 deletions sli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ target_include_directories( sli_readline PRIVATE
)

install( TARGETS sli_readline sli_lib sli
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down
4 changes: 2 additions & 2 deletions topology/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ target_include_directories( topology PRIVATE
)

install( TARGETS topology
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nest
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down