diff --git a/CMakeLists.txt b/CMakeLists.txt index d2da3f7f7fc44abfad6e88f7583e9e3c59de58ff..4df4ddc0947310877f1bc730678342ab608174f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,50 +1,58 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(moose-all) + +PROJECT(MOOSE) set(MOOSE_VERSION "3.0.2") +include( ExternalProject ) + + +# Options to pass down to moose-core +option(WITH_DOC "Build documentation" OFF) +option(DEBUG "Build with DEBUG support" OFF) +option(WITH_BOOST "Use Boost libraries instead of GSL" OFF) +option(WITH_CUSA "Use CUDA/GPU" OFF) +option(WITH_MPI "Use MPI" OFF) ## intialize paths set(MOOSE_CORE_DIR "${CMAKE_SOURCE_DIR}/moose-core") set(MOOSE_CORE_BUILD_DIR ${CMAKE_BINARY_DIR}/_build_moose_core) +set(MOOSE_CORE_INSTALL_DIR ${CMAKE_BINARY_DIR}/_install_moose_core) FILE(MAKE_DIRECTORY ${MOOSE_CORE_BUILD_DIR}) set(DATA_DIR ${CMAKE_SOURCE_DIR}/data) set(OUTPUT_MOOSEBIN ${MOOSE_CORE_BUILD_DIR}/moose.bin) set(OUTPUT_MOOSESDIST ${MOOSE_CORE_BUILD_DIR}/moose-${MOOSE_VERSION}.tar.gz) -# Options to pass down to moose-core -option(WITH_DOC "Build documentation" OFF) -option(DEBUG "Build with DEBUG support" OFF) -add_custom_command(OUTPUT ${OUTPUT_MOOSEBIN} ${OUTPUT_MOOSESDIST} - COMMAND ${CMAKE_COMMAND} - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DDEBUG=${DEBUG} - -DWITH_DOC=${WITH_DOC} - ${MOOSE_CORE_DIR} - COMMAND $(MAKE) - WORKING_DIRECTORY ${MOOSE_CORE_BUILD_DIR} - VERBATIM - ) - -add_custom_target(moose-all ALL - DEPENDS ${OUTPUT_MOOSESDIST} ${OUTPUT_MOOSEBIN} - ) - -install(CODE - " - execute_process(COMMAND ctest --output-on-failure - WORKING_DIRECTORY ${MOOSE_CORE_BUILD_DIR}) +find_package(PythonInterp REQUIRED) +include(ExternalProject) +ExternalProject_Add( + moose-core + PREFIX ${CMAKE_CURRENT_BINARY_DIR} + SOURCE_DIR ${CMAKE_SOURCE_DIR}/moose-core + BINARY_DIR ${MOOSE_CORE_BUILD_DIR} + CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_INSTALL_PREFIX=${MOOSE_CORE_INSTALL_DIR} + -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} + -DDEBUG=${DEBUG} + -DWITH_DOC=${WITH_DOC} + -DWITH_BOOST=${WITH_BOOST} + -DWITH_MPI=${WITH_MPI} + -DWITH_CUDA=${WITH_CUDA} + TEST_BEFORE_INSTALL 1 +) - execute_process(COMMAND ${CMAKE_COMMAND} -P cmake_install.cmake - WORKING_DIRECTORY ${MOOSE_CORE_BUILD_DIR}) - " - ) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}}/moose-core/include) +LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}}/moose-core/lib) ## moose-gui ## TODO: moose-gui should be a python module. set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui) +install(DIRECTORY ${MOOSE_CORE_INSTALL_DIR}/ + DESTINATION ${CMAKE_INSTALL_PREFIX} + ) + install(DIRECTORY ${MOOSE_GUI_DIR} - DESTINATION lib/moose/gui + DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/moose/gui PATTERN ".git" EXCLUDE ) diff --git a/README.md b/README.md index 00bbb2f48498bdbb0bdaaf57251276168f96908e..1ba7569e2f9196712ee5d5a09b318acaaf2dd605 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,18 @@ [](https://travis-ci.org/BhallaLab/moose) -This is the parent repository of [MOOSE simulator](https://moose.ncbs.res.in). It hosts components of MOOSE: core (written in C++) of MOOSE, python scripting interface, and its graphical user interface (GUI), and MOOGLI as [git-submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules). +This is the parent repository of [MOOSE simulator](https://moose.ncbs.res.in). It keeps the snanshots of components of MOOSE: core (written in C++) of MOOSE, python scripting interface, and its graphical user interface (GUI). This is your source +stable MOOSE code. + +# Building + + mkdir _build + cd _build + cmake .. + make + sudo make install + + +# Repositories You can find detailed description of each MOOSE component in respective `README.md` in their repositories below: