diff --git a/CMakeLists.txt b/CMakeLists.txt index ccdeefbe38d122df714110ab4e4e6d04a041b8ab..f1b1a9b5453609688f957a89a574ea1613a5325e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,41 +1,62 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(moose) - -## Default install prefix. When building packages, such as on launchpad, we need -## to modify installation prefix. -if(DEVELOPER) - option(CMAKE_INSTALL_PREFIX "Install prefix" ${CMAKE_BINARY_DIR}/_install) -else() - option(CMAKE_INSTALL_PREFIX "Install prefix" /usr) -endif() +PROJECT(moose-all) ## 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_INSTALL_PREFIX}") +FILE(MAKE_DIRECTORY ${MOOSE_CORE_BUILD_DIR}) set(DATA_DIR ${CMAKE_SOURCE_DIR}/data) -include(ExternalProject) -message("[INFO] Installtion directory is ${CMAKE_INSTALL_PREFIX}") -ExternalProject_Add( moose-core - PREFIX ${CMAKE_CURRENT_BINARY_DIR}/__moose-core - SOURCE_DIR ${MOOSE_CORE_DIR} - # Extremely useful in packaging - #BINARY_DIR ${MOOSE_CORE_INSTALL_DIR} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - TEST_COMMAND ctest --output-on-failure - TEST_BEFORE_INSTALL 1 - BUILD_IN_SOURCE 0 -) +add_custom_command(OUTPUT __moose_core_built__ + COMMAND ${CMAKE_COMMAND} + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DDEBUG=OFF + ${MOOSE_CORE_DIR} + COMMAND $(MAKE) + WORKING_DIRECTORY ${MOOSE_CORE_BUILD_DIR} + VERBATIM + ) + +add_custom_target(moose-all ALL + DEPENDS __moose_core_built__ + ) + +install(CODE + " + execute_process(COMMAND ctest --output-on-failure + WORKING_DIRECTORY ${MOOSE_CORE_BUILD_DIR}) + + execute_process(COMMAND ${CMAKE_COMMAND} install + WORKING_DIRECTORY ${MOOSE_CORE_BUILD_DIR}) + " + ) ## moose-gui ## TODO: moose-gui should be a python module. set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui) -set(MOOSE_GUI_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/moose/gui) -add_custom_target(moose-gui ALL) -add_custom_command(TARGET moose-gui - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${MOOSE_GUI_DIR} ${MOOSE_GUI_INSTALL_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${DATA_DIR}/moosegui ${CMAKE_INSTALL_PREFIX}/bin/ + +install(DIRECTORY ${MOOSE_GUI_DIR} + DESTINATION lib/moose/gui + PATTERN ".git" EXCLUDE ) +install(PROGRAMS ${DATA_DIR}/moosegui + DESTINATION bin + ) + +## UNINSTALL +add_custom_target(uninstall + DEPENDS __uninstall_moose-core__ __uninstall_moose-gui__ + ) + +add_custom_command(OUTPUT __uninstall_moose-core__ + COMMAND make uninstall + WORKING_DIRECTORY ${MOOSE_CORE_BUILD_DIR} + ) + +add_custom_command(OUTPUT __uninstall_moose-gui__ + COMMAND ${CMAKE_COMMAND} -E remove_directory + ${CMAKE_INSTALL_PREFIX}/usr/lib/moose + COMMAND ${CMAKE_COMMAND} -R remove ${CMAKE_INSTALL_PREFIX}/bin/moosegui + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) diff --git a/README.md b/README.md index d676c7fc2c493c4fa121bd5cd750312781722aaa..82b47aca35d716d7fe80e4226c7815f0633c19d3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,21 @@ Build Status - master (This is stable branch): [](https://travis-ci.org/BhallaLab/moose) -This is a meta repository of MOOSE simulator. It contains MOOSE, its GUI and -other sister projects a submodule. For more details about these projects, read -respective README files. +This is the meta repository of MOOSE simulator. It contains C++ core of MOOSE, +python scripting interface and its GUI. -# Install +For more details about these projects, read respective README files. +# Installation using cmake + +First, run the `bootstrap` script. It will fetch the submodules and/or update +them. You should have `cmake` installed on your system to build and install +moose from this repository. + + cmake . + make + sudo make install + +To uninstall moose, do the following in the same directory where you ran +previous `make install` command. + + sudo make uninstall diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000000000000000000000000000000000000..1153b7cbfa8ebf1465724396bc56ef00209983c7 --- /dev/null +++ b/bootstrap @@ -0,0 +1,7 @@ +#!/bin/bash + +# Bootstrap script. Run it to update the repo. + +echo "- Updating submodules" +git submodule update --init +git submodule foreach git pull origin master diff --git a/data/moosegui b/data/moosegui index 4d8e95bd443965601c588a356f8a6d688db3ca07..2bd54687af0719a6dddfa2641445327053faa1bd 100755 --- a/data/moosegui +++ b/data/moosegui @@ -1,2 +1,2 @@ #!/bin/bash -( cd /usr/share/moose/gui && python mgui.py ) +( cd /usr/lib/moose/gui && python mgui.py ) diff --git a/moose-core b/moose-core index 02aabd788aba7cf3650a7751dff80f89c95f9b61..3e6bf56253d762737a0584bbf8b2fcd8cb1b5eb8 160000 --- a/moose-core +++ b/moose-core @@ -1 +1 @@ -Subproject commit 02aabd788aba7cf3650a7751dff80f89c95f9b61 +Subproject commit 3e6bf56253d762737a0584bbf8b2fcd8cb1b5eb8 diff --git a/moose-gui b/moose-gui index 46c19805bcb0b90c7fecdfa869dc37d304b0d6b7..ee905e56abb794c47cb0aabbb16010ac55b89e9d 160000 --- a/moose-gui +++ b/moose-gui @@ -1 +1 @@ -Subproject commit 46c19805bcb0b90c7fecdfa869dc37d304b0d6b7 +Subproject commit ee905e56abb794c47cb0aabbb16010ac55b89e9d