diff --git a/CMakeLists.txt b/CMakeLists.txt index b13f56ab70db6adcce7ae5312aeed41b943a8884..c1612c8dd55dd69605efa7d2252286df646febb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,9 +60,10 @@ set(PYMOOSE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/moose-core") set(PYMOOSE_BUILD_DIR ${CMAKE_BINARY_DIR}/__moose-core_build) # NOTE: new setuptools does not install python module to this directory unless -# it supports .pth file or PYTHONPATH points to it. Make sure when moose-core is -# installing into user_specified path, set PYTHONPATH to this directory. +# installing into user_specified path, set PYTHONPATH to this directory. We now +# create a bdist to this directory. set(PYMOOSE_INSTALL_DIR ${CMAKE_BINARY_DIR}/__moose-core_install) +set(PYMOOSE_BDIST_DIR ${PYMOOSE_BUILD_DIR}/) if(WITH_GUI) set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui) diff --git a/cmake/build_moose-core.sh.in b/cmake/build_moose-core.sh.in index 084f8f91c527bb3edd0494cdccfc86048bb2147d..c4a1a940d55d890bdb3f513756464dcd6694e2e1 100755 --- a/cmake/build_moose-core.sh.in +++ b/cmake/build_moose-core.sh.in @@ -11,20 +11,18 @@ if [ -z "$MAKE" ]; then MAKE=make fi -echo "Building MOOSE" -( - export GSL_ROOT_DIR=@GSL_ROOT_DIR@ - export HDF5_ROOT=@HDF5_ROOT@ - cd @PYMOOSE_BUILD_DIR@ - cmake -DCMAKE_INSTALL_PREFIX=@PYMOOSE_INSTALL_DIR@ \ - -DCMAKE_BUILD_TYPE=Release \ - -DWITH_BOOST=@WITH_BOOST@ \ - -DPYTHON_EXECUTABLE=@PYTHON_EXECUTABLE@ \ - -DVERSION_MOOSE=@MOOSE_VERSION@ \ - @CMAKE_PYMOOSE_ARGS@ \ - @PYMOOSE_SOURCE_DIR@ - $MAKE - ctest -output-on-failure || echo "Some tests failed" - $MAKE install -) - +echo "Building pymoose and creating bdist." +export GSL_ROOT_DIR=@GSL_ROOT_DIR@ +export HDF5_ROOT=@HDF5_ROOT@ +cd @PYMOOSE_BUILD_DIR@ +cmake -DCMAKE_INSTALL_PREFIX=@PYMOOSE_INSTALL_DIR@ \ + -DCMAKE_BUILD_TYPE=Release \ + -DWITH_BOOST=@WITH_BOOST@ \ + -DPYTHON_EXECUTABLE=@PYTHON_EXECUTABLE@ \ + -DVERSION_MOOSE=@MOOSE_VERSION@ \ + -DPYMOOSE_BDIST_DIR=@PYMOOSE_BDIST_DIR@ \ + @CMAKE_PYMOOSE_ARGS@ \ + @PYMOOSE_SOURCE_DIR@ +$MAKE +ctest --output-on-failure || echo "Some tests failed" +$MAKE bdist diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt index e202e7b87ed2095731b7754c5afed9059ab02918..df0b25510ef5f8e51a8277228d2f5c1558d2ae34 100644 --- a/moose-core/CMakeLists.txt +++ b/moose-core/CMakeLists.txt @@ -393,6 +393,7 @@ endif() ######################### BUILD PYMOOSE ######################################## add_subdirectory( pymoose ) + ######################### INSTALL ############################################## if(DEBUG) @@ -449,6 +450,22 @@ if(${CMAKE_BUILD_TOOL} MATCHES "make") ) 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( ) +add_custom_target( bdist + DEPENDS pymoose + COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist -d ${PYMOOSE_BDIST_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python + COMMENT "Genearating bdist using setup.cmake.py." + VERBATIM + ) + ############################ CTEST ###################################### include( CTest )