Skip to content
Snippets Groups Projects
Commit 8de8411f authored by Dilawar Singh's avatar Dilawar Singh
Browse files

Squashed 'moose-core/' changes from d462351..4650fe4

4650fe4 Disabled pyNeuroML since it is breaking on travis.
f59669b changes to buidld system - python setup.py install does not work anymore if --prefix is not PYTHONPATH.   This way of installing python module does not work on newer linux. - To solve above problem, we create a binary distribution using python setup.py   bdist and unarhive it. - These changes are to be applied to all release branches such as master,   chennapoda, and chacham.

git-subtree-dir: moose-core
git-subtree-split: 4650fe460e362b60f14388c56d3346d479b6ad23
parent 333090e6
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,6 @@ apt-get install -qq libgsl0-dev ...@@ -30,6 +30,6 @@ apt-get install -qq libgsl0-dev
apt-get install -qq python-pip python3-pip apt-get install -qq python-pip python3-pip
apt-get install -qq libgraphviz-dev apt-get install -qq libgraphviz-dev
# Dependencies for NML2 # Dependencies for NML2
apt-get install -qq python-scipy python3-scipy apt-get install -qq python-scipy python3-scipy
pip install pyNeuroML libNeuroML #pip install pyNeuroML libNeuroML
...@@ -121,10 +121,7 @@ endif() ...@@ -121,10 +121,7 @@ endif()
################################### TARGETS #################################### ################################### TARGETS ####################################
add_library(libmoose SHARED basecode/main.cpp) add_library(libmoose SHARED basecode/main.cpp)
add_executable(moose.bin basecode/main.cpp)
if(DEBUG)
add_executable(moose.bin basecode/main.cpp)
endif( )
################################### SETUP BUILD ################################ ################################### SETUP BUILD ################################
...@@ -373,46 +370,23 @@ ELSE(MACOSX) ...@@ -373,46 +370,23 @@ ELSE(MACOSX)
) )
endif(MACOSX) endif(MACOSX)
if(DEBUG) add_dependencies(moose.bin libmoose)
add_dependencies(moose.bin libmoose) target_link_libraries(moose.bin moose ${CMAKE_DL_LIBS})
target_link_libraries(moose.bin moose ${CMAKE_DL_LIBS}) if( WITH_BOOST )
if( WITH_BOOST ) target_link_libraries( moose.bin ${Boost_LIBRARIES} )
target_link_libraries( moose.bin ${Boost_LIBRARIES} ) endif( WITH_BOOST )
endif( WITH_BOOST )
endif()
######################### BUILD PYMOOSE ######################################## ######################### BUILD PYMOOSE ########################################
# This target is built by pymoose/CMakeLists.txt file.
add_subdirectory( pymoose ) add_subdirectory( pymoose )
######################### INSTALL ##############################################
if(DEBUG)
install(TARGETS moose.bin
DESTINATION bin
)
install(TARGETS libmoose
DESTINATION lib
)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/moose
DESTINATION bin
)
endif( )
# INSTALL python module.
# This target is built by pymoose/CMakeLists.txt file. Using the --prefix option
# always override debian default installation directory. It will be installed in # always override debian default installation directory. It will be installed in
# site-packages instead of dist-packages. # site-packages instead of dist-packages.
# See https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/362570 # See https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/362570
# HACK: Get platform information from python and use it to fix the layout. # HACK: Get platform information from python and use it to fix the layout.
execute_process( execute_process(COMMAND ${PYTHON_EXECUTABLE} -mplatform OUTPUT_VARIABLE _platform_desc)
COMMAND ${PYTHON_EXECUTABLE} -mplatform OUTPUT_VARIABLE _platform_desc message(STATUS "Platform: ${_platform_desc}")
)
message( STATUS "Platform ${_platform_desc}" )
# DISTUTILS_EXTRA_ARGS may come of top-level cmake script. On DEBIAN/UBUNTU, it # DISTUTILS_EXTRA_ARGS may come of top-level cmake script. On DEBIAN/UBUNTU, it
# is most likely to be --install-layout=deb . # is most likely to be --install-layout=deb .
...@@ -421,21 +395,56 @@ set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX} ${DISTUTILS_EXTRA_ARGS}") ...@@ -421,21 +395,56 @@ set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX} ${DISTUTILS_EXTRA_ARGS}")
# On Debian/Ubuntu install using debian layout. # On Debian/Ubuntu install using debian layout.
# NOTE: Also create setup.cfg file which setup prefix and install-layout # NOTE: Also create setup.cfg file which setup prefix and install-layout
# suitable for DEBIAN systems. # suitable for DEBIAN systems.
if( ${_platform_desc} MATCHES ".*(Ubuntu|Debian).*" ) if(${_platform_desc} MATCHES ".*(Ubuntu|Debian).*")
list( APPEND EXTRA_ARGS "--install-layout=deb" ) list(APPEND EXTRA_ARGS "--install-layout=deb")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/python/setup.cfg file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/python/setup.cfg
"[install]\nprefix=/usr\ninstall-layout=deb" "[install]\nprefix=/usr\ninstall-layout=deb"
) )
endif()
# Set PYMOOSE binary distribution build and install directories.
# Target for creating bdist. This is handy for creating bdist for packaging.
# Save the binary distribution (tar.gz) to PYMOOSE_BDIST_DIR.
find_package(PythonInterp REQUIRED)
if(NOT PYMOOSE_BDIST_DIR)
set(PYMOOSE_BDIST_DIR ${CMAKE_BINARY_DIR}/bdist)
endif( ) endif( )
set(PYMOOSE_BDIST_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/pymoose_bdist_install)
file(MAKE_DIRECTORY ${PYMOOSE_BDIST_INSTALL_DIR})
# We need a custom name for bdist; same on all platform.
set(_platform "CMAKE" )
set(PYMOOSE_BDIST_FILE ${PYMOOSE_BDIST_DIR}/pymoose-${VERSION_MOOSE}.${_platform}.tar.gz)
message(STATUS "binary distribution file ${PYMOOSE_BDIST_FILE}")
add_custom_target(bdist ALL DEPENDS ${PYMOOSE_BDIST_FILE} )
add_custom_command( OUTPUT ${PYMOOSE_BDIST_FILE}
COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist -p ${_platform} -d ${PYMOOSE_BDIST_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
COMMENT "bdist is saved to ${PYMOOSE_BDIST_DIR}"
VERBATIM
)
add_custom_command(TARGET bdist POST_BUILD
COMMAND ${CMAKE_COMMAND} -E chdir ${PYMOOSE_BDIST_INSTALL_DIR} tar xvf ${PYMOOSE_BDIST_FILE}
COMMENT "Unarchiving bdist file ${PYMOOSE_BDIST_FILE} to ${PYMOOSE_BDIST_INSTALL_DIR}"
VERBATIM
)
add_dependencies( bdist _moose )
# If make is called with sudo, install in system directories. Otherwise use ######################### INSTALL ##############################################
# --user to install in user home.
install(CODE install(TARGETS moose.bin DESTINATION bin CONFIGURATIONS Debug)
"execute_process(
COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py install -f ${EXTRA_ARGS} ${PYMOOSE_EXTRA_INSTALL_ARGS} install(TARGETS libmoose DESTINATION lib CONFIGURATIONS Debug)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
)" install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/moose
) DESTINATION bin CONFIGURATIONS Debug
)
# install pymoose bdist.
install(DIRECTORY ${PYMOOSE_BDIST_INSTALL_DIR}/
DESTINATION ${CMAKE_INSTALL_PREFIX}
CONFIGURATIONS Release
)
# Print message to start build process # Print message to start build process
if(${CMAKE_BUILD_TOOL} MATCHES "make") if(${CMAKE_BUILD_TOOL} MATCHES "make")
...@@ -447,27 +456,6 @@ if(${CMAKE_BUILD_TOOL} MATCHES "make") ...@@ -447,27 +456,6 @@ if(${CMAKE_BUILD_TOOL} MATCHES "make")
) )
endif() endif()
# Target for creating bdist. This is handy for creating bdist for packaging.
# Save the binary distribution (tar.gz) to PYMOOSE_BDIST_DIR. Note that this
# target is only useful when creating packages on Open Build Service i.e. if you
# use this target on distribution X, it may not work on distrbutions other than
# X. See python-wheels for making portable distributions.
if(NOT PYMOOSE_BDIST_DIR)
set(PYMOOSE_BDIST_DIR ${CMAKE_BINARY_DIR}/pymoose_bdist)
endif( )
# get platform and arch using python.
# NOTE: creating bdist or bdist_dump uses /usr and /usr/local on rpm and deb
# based unix respectively. Not a great situation to be in. Need to write a
# setup.cfg file to fix the prefix in all cases.
find_package( PythonInterp REQUIRED)
add_custom_target( bdist
COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist_dumb -d ${PYMOOSE_BDIST_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
COMMENT "Genearating bdist using setup.cmake.py."
VERBATIM
)
############################ CTEST ###################################### ############################ CTEST ######################################
include( CTest ) include( CTest )
......
...@@ -34,8 +34,13 @@ except Exception as e: ...@@ -34,8 +34,13 @@ except Exception as e:
print( 'Failed to read VERSION %s' % e ) print( 'Failed to read VERSION %s' % e )
print( 'Using default %s' % version ) print( 'Using default %s' % version )
import importlib.machinery # importlib is available only for python3.
suffix = importlib.machinery.EXTENSION_SUFFIXES[-1] suffix = '.so'
try:
import importlib.machinery
suffix = importlib.machinery.EXTENSION_SUFFIXES[-1]
except ImportError as e:
pass
setup( setup(
name='pymoose', name='pymoose',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment