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

Updated code to Nest 3.1 #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
127 changes: 44 additions & 83 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Cereb/CMakeLists.txt

# cereb/CMakeLists.txt
#
# This file is part of NEST.
#
Expand All @@ -17,11 +18,10 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.

cmake_minimum_required( VERSION 2.8.12 )

# This CMakeLists.txt is configured to build your external module for NEST. For
# illustrative reasons this module is called 'my' (change SHORT_NAME to your
# preferred module name). NEST requires you to extend the 'SLIModule' and provide a module header
# preferred module name). NEST requires you to extend the 'SLIModule' (see
# mymodule.h and mymodule.cpp as an example) and provide a module header
# (see MODULE_HEADER). The subsequent instructions
#
# The configuration requires a compiled and installed NEST; if `nest-config` is
Expand All @@ -30,23 +30,30 @@ cmake_minimum_required( VERSION 2.8.12 )
# For more informations on how to extend and use your module see:
# https://nest.github.io/nest-simulator/extension_modules

# 1) Name your module here, i.e. add later with -Dexternal-modules=my:
set( SHORT_NAME cereb )
# 1) Name your module here, i.e. add later with -Dexternal-modules=${moduleName}:
set( SHORT_NAME cerebmodule )

# the complete module name is here:
set( MODULE_NAME ${SHORT_NAME}module )
set( MODULE_NAME ${SHORT_NAME} )

# 2) Add all your sources here
set( MODULE_SOURCES
cerebmodule.h cerebmodule.cpp


eglif_cond_alpha_multisyn.cpp eglif_cond_alpha_multisyn.h

mynames.h mynames.cpp

volume_transmitter_alberto.h volume_transmitter_alberto.cpp
eglif_cond_alpha_multisyn.h eglif_cond_alpha_multisyn.cpp

stdp_connection_alpha.h stdp_connection_alpha.cpp

stdp_connection_cosexp.h stdp_connection_cosexp.cpp

stdp_connection_sinexp.h stdp_connection_sinexp.cpp
stdp_connection_alpha.h stdp_connection_alpha.cpp
iSTDP.h
Sgritta2017.h
mynames.h mynames.cpp

cerebmodule.h cerebmodule.cpp

)

# 3) We require a header name like this:
Expand All @@ -58,9 +65,6 @@ set( MODULE_VERSION_MAJOR 1 )
set( MODULE_VERSION_MINOR 0 )
set( MODULE_VERSION "${MODULE_VERSION_MAJOR}.${MODULE_VERSION_MINOR}" )

# 5) Leave the rest as is. All files in `sli` will be installed to
# `share/nest/sli/`, so that NEST will find the during initialization.

# Leave the call to "project(...)" for after the compiler is determined.

# Set the `nest-config` executable to use during configuration.
Expand Down Expand Up @@ -100,27 +104,11 @@ set( CMAKE_CXX_COMPILER "${NEST_COMPILER}" )

project( ${MODULE_NAME} CXX )

# Get the Python executable (for help generation).
execute_process(
COMMAND ${NEST_CONFIG} --python-executable
RESULT_VARIABLE RES_VAR
OUTPUT_VARIABLE PYTHON_EXECUTABLE
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Get the Python executable (for help generation).
execute_process(
COMMAND ${NEST_CONFIG} --python-version
RESULT_VARIABLE RES_VAR
OUTPUT_VARIABLE PYTHON_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Get the install prefix.
execute_process(
COMMAND ${NEST_CONFIG} --prefix
RESULT_VARIABLE RES_VAR
OUTPUT_VARIABLE NEST_INSTALL_PREFIX
OUTPUT_VARIABLE NEST_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)

Expand Down Expand Up @@ -177,40 +165,30 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Get the data install dir.
execute_process(
COMMAND ${NEST_CONFIG} --datadir
RESULT_VARIABLE RES_VAR
OUTPUT_VARIABLE NEST_INSTALL_DATADIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Get the documentation install dir.
execute_process(
COMMAND ${NEST_CONFIG} --docdir
RESULT_VARIABLE RES_VAR
OUTPUT_VARIABLE NEST_INSTALL_DOCDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Get the library install dir.
execute_process(
COMMAND ${NEST_CONFIG} --libdir
RESULT_VARIABLE RES_VAR
OUTPUT_VARIABLE NEST_LIBDIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# 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 )

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Use the `NEST_PREFIX` as `CMAKE_INSTALL_PREFIX`.
set( CMAKE_INSTALL_PREFIX ${NEST_PREFIX} CACHE STRING "Install path prefix, prepended onto install directories." FORCE )
# Retrieve libs folder in nest
execute_process(
COMMAND ${NEST_CONFIG} --libdir
RESULT_VARIABLE RES_VAR
OUTPUT_VARIABLE NEST_LIBDIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Append lib/nest to the install_dir
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 ()
else()
# Check If CMAKE_INSTALL_PREFIX is not empty string
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "")
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX cannot be an empty string")
endif()
# Set lib folder to the given install_dir
set( CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX} CACHE STRING "object code libraries (lib/nest or lib64/nest or lib/<multiarch-tuple>/nest on Debian)" FORCE )
endif()


include( GNUInstallDirs )

Expand All @@ -219,7 +197,7 @@ set( CPACK_GENERATOR TGZ )
set( CPACK_SOURCE_GENERATOR TGZ )

set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "NEST Module ${MODULE_NAME}" )
set( CPACK_PACKAGE_VENDOR "NEST Initiative (https://www.nest-initiative.org/)" )
set( CPACK_PACKAGE_VENDOR "NEST Initiative (http://www.nest-initiative.org/)" )

set( CPACK_PACKAGE_VERSION_MAJOR ${MODULE_VERSION_MAJOR} )
set( CPACK_PACKAGE_VERSION_MINOR ${MODULE_VERSION_MINOR} )
Expand Down Expand Up @@ -282,12 +260,6 @@ set_target_properties( ${MODULE_NAME}_lib
LINK_FLAGS "${NEST_LIBS}"
OUTPUT_NAME ${MODULE_NAME} )

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


message( "" )
message( "-------------------------------------------------------" )
message( "${MODULE_NAME} Configuration Summary" )
Expand All @@ -308,18 +280,7 @@ message( " make install" )
message( "" )
message( "The library file lib${MODULE_NAME}.so will be installed to" )
message( " ${CMAKE_INSTALL_FULL_LIBDIR}" )
message( "Help files will be installed to" )
message( " ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DOCDIR}" )
message( "" )
message( "The module can be loaded into NEST using" )
message( " (${MODULE_NAME}) Install (in SLI)" )
message( " nest.Install('${MODULE_NAME}') (in PyNEST)" )
message( " (${MODULE_NAME}) Install (in SLI)" )
message( " nest.Install(${MODULE_NAME}) (in PyNEST)" )
message( "" )

if( NOT "${CMAKE_INSTALL_PREFIX}" EQUAL "${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 SLI_PATH=${CMAKE_INSTALL_FULL_DATADIR}/sli:$SLI_PATH" )
message( "" )
endif ()
Loading