diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ce1addb9c0859ac2bffe2baa2947d83910e9c61..e5c21fe89afd8dc2ead7b503770c9e8f1974cc26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,37 +13,24 @@ option(WITH_CUDA "Use CUDA/GPU" OFF) option(WITH_MPI "Use MPI" OFF) ## intialize paths -set(MOOSE_CORE_DIR "${CMAKE_SOURCE_DIR}/moose-core") +set(MOOSE_CORE_SOURCE_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}) +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) -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} - -DVERSION=${MOOSE_VERSION} - -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_COMMAND "" # No tests -) +configure_file( ${CMAKE_SOURCE_DIR}/build_moose_core.sh.in + ${CMAKE_BINARY_DIR}/build_moose_core.sh ) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}}/moose-core/include) -LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}}/moose-core/lib) +add_custom_target( moose-core ALL DEPENDS ${OUTPUT_MOOSEBIN} ) +add_custom_command( OUTPUT ${OUTPUT_MOOSEBIN} + COMMAND MAKE=$(MAKE) bash -c ${CMAKE_BINARY_DIR}/build_moose_core.sh + VERBATIM + ) +find_package(PythonInterp REQUIRED) ## moose-gui ## TODO: moose-gui should be a python module. set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui) diff --git a/build_moose_core.sh.in b/build_moose_core.sh.in new file mode 100755 index 0000000000000000000000000000000000000000..ff9587aef0dc66d4e56637782e27b1720e323005 --- /dev/null +++ b/build_moose_core.sh.in @@ -0,0 +1,20 @@ +#!/bin/bash + +# NOTICE: This file is parsed by cmake to create a shell script. Not all syntax +# will play well with cmake. CMAKE replaces @FOO@ and ${FOO} with cmake variable +# values. + +if [ -z "$MAKE" ]; then + MAKE=make +fi + +echo "Building MOOSE" +( + cd @MOOSE_CORE_BUILD_DIR@ + cmake -DCMAKE_INSTALL_PREFIX=@MOOSE_CORE_INSTALL_DIR@ \ + @CMAKE_MOOSE_CORE_ARGS@ \ + @MOOSE_CORE_SOURCE_DIR@ + $MAKE + $MAKE install +) + diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt index bb5930f1494fdcef068a73aac9c94a85330d12b6..bca3590a98fd8e5f086cf14ab03ef10c7d120c10 100644 --- a/moose-core/CMakeLists.txt +++ b/moose-core/CMakeLists.txt @@ -94,37 +94,16 @@ option(DEBUG "Build with debug support" OFF) option(GPROF "Build for profiling using gprof" OFF) option(ENABLE_UNIT_TESTS "Enable unit tests (DEBUG should also be ON)" OFF) option(WITH_PYTHON "Build native python extension" ON) -option(WITH_CYTHON "Build python extension using Cython. (experimental)" OFF) option(WITH_MPI "Enable Openmpi support" OFF) option(WITH_BOOST "Use boost library instead of GSL" OFF) option(WITH_GSL "Use gsl-library. Alternative is WITH_BOOST" ON) -# If GSL_STATIC_HOME is set, we use it to search for static gsl libs. -option(GSL_STATIC_HOME - "Path prefix where static gsl library can be found e.g. /opt/sw/gsl116 " - OFF - ) -option(HDF5_STATIC_HOME - "Path prefix where static hdf5 library can be found e.g /opt/sw/hdf5 " - OFF - ) - ################################# CMKAE MACROS ################################# set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") ############################ BUILD CONFIGURATION ################################# -# VERBOSITY OF OUTPUT -if(VERBOSITY) - message(STATUS "Verbosity of output is ${VERBOSITY}. This is not implemented - yet!") - add_definitions(-DVERBOSITY=${VERBOSITY}) -else() - message(STATUS "Moose will be quiet") - add_definitions(-DQUIET_MODE) -endif() - # Default macros add_definitions(-DUSE_GENESIS_PARSER) @@ -232,29 +211,8 @@ elseif(WITH_BOOST) endif(BOOST_RANDOM_DEVICE_EXISTS) endif() -## Setup hdf5 -if(HDF5_STATIC_HOME) - SET(HDF5_INCLUDE_DIRS "${HDF5_STATIC_HOME}/include") - find_library(HDF5_LIBRARY - NAMES libhdf5-static.a libhdf5.a - PATHS ${HDF5_STATIC_HOME}/lib ${HDF5_STATIC_HOME}/lib64 - NO_DEFAULT_PATH - ) - find_library(HDF5_HL_LIBRARY - NAMES libhdf5_hl-static.a libhdf5_hl.a - PATHS ${HDF5_STATIC_HOME}/lib ${HDF5_STATIC_HOME}/lib64 - NO_DEFAULT_PATH - ) - SET(HDF5_LIBRARIES ${HDF5_LIBRARY} ${HDF5_HL_LIBRARY}) - SET(HDF5_FOUND TRUE) -ELSE(HDF5_STATIC_HOME) - pkg_check_modules(HDF5 hdf5) - if(NOT HDF5_FOUND) - message(STATUS "pkg-config could not find hdf5. fallback to default") - find_package(HDF5 COMPONENTS CXX HL REQUIRED) - endif() -endif(HDF5_STATIC_HOME) +find_package(HDF5 COMPONENTS CXX HL) if(NOT HDF5_FOUND) message( "==================================================================\n" @@ -269,13 +227,6 @@ if(NOT HDF5_FOUND) " variable HDF5_ROOT to the location. Rerun cmake \n" "================================================================ \n" ) -ELSEIF(HDF5_FOUND AND (NOT HDF5_STATIC_HOME)) - if(HDF5_HL_LIBRARIES) - set(HDF5_LIBRARIES ${HDF5_HL_LIBRARIES}) - else() - set(HDF5_LIBRARIES "-lhdf5 -lhdf5_hl") - endif() - include_directories(${HDF5_INCLUDE_DIRS}) endif(NOT HDF5_FOUND) if(HDF5_FOUND) @@ -347,15 +298,6 @@ endif(WITH_BOOST) # Here we make sure that the correct static version is linked; if a correct # shared version is found then link the shared version in SYSTEM_SHARED_LIBS. -# If CMAKE_STATIC_LIBRARIES are mentiond on command line, use it as list. -set(STATIC_LIBRARIES "") - -if(HDF5_STATIC_HOME) - list(APPEND STATIC_LIBRARIES ${HDF5_LIBRARIES}) -elseif(HDF5_FOUND) - list(APPEND SYSTEM_SHARED_LIBS ${HDF5_LIBRARIES}) -endif() - if(WITH_GSL) if(GSL_STATIC_HOME) message(STATUS "Using STATIC gsl libraries: ${GSL_LIBRARIES}") @@ -366,11 +308,6 @@ if(WITH_GSL) endif() endif() -# Deprecated. -#if(READLINE_FOUND AND TERMCAP_FOUND) -# list(APPEND SYSTEM_SHARED_LIBS ${Readline_LIBRARY} ${TERMCAP_LIBRARY}) -#endif() - if(WITH_MPI) if(MPI_CXX_FOUND) list(APPEND SYSTEM_SHARED_LIBS ${MPI_CXX_LIBRARIES}) @@ -387,16 +324,6 @@ else() list(APPEND MOOSE_LIBRARIES muparser) endif() -#pkg_check_modules(TINYXML tinyxml) -#if(TINYXML_FOUND) - #message(STATUS "Using system tinyxml ${TINYXML_VERSION}") - #list(APPEND SYSTEM_SHARED_LIBS ${TINYXML_LIBRARIES}) -#else() - #message(STATUS "Using private tinyxml") - #add_subdirectory(external/tinyxml) - #list(APPEND MOOSE_LIBRARIES tinyxml) -#endif() - ###################################### LINKING ################################# list(APPEND MOOSE_LIBRARIES moose_builtins @@ -427,7 +354,6 @@ if(MACOSX) target_link_libraries(libmoose "-Wl,-all_load" ${MOOSE_LIBRARIES} - ${STATIC_LIBRARIES} ) target_link_libraries(libmoose @@ -438,7 +364,6 @@ ELSE(MACOSX) target_link_libraries(libmoose "-Wl,--whole-archive" ${MOOSE_LIBRARIES} - ${STATIC_LIBRARIES} "-Wl,--no-whole-archive" ${SYSTEM_SHARED_LIBS} ) @@ -446,13 +371,7 @@ endif(MACOSX) add_dependencies(moose.bin libmoose) -# This target is only for testing purpose. It links to libmoose. -if(CMAKE_VERSION VERSION_LESS "2.8.0") - message(STATUS "Using a fix for cmake ( < 2.8)") - target_link_libraries(moose.bin PUBLIC moose ${CMAKE_DL_LIBS}) -ELSE() - target_link_libraries(moose.bin LINK_PUBLIC moose ${CMAKE_DL_LIBS}) -ENDIF() +target_link_libraries(moose.bin LINK_PUBLIC moose ${CMAKE_DL_LIBS}) ######################### BUILD PYMOOSE ######################################## # Root of all python module. diff --git a/moose-core/VERSION b/moose-core/VERSION index 50e47c89cafc3ec95774b3110a3dba45256d0b24..3087e817dc1628966069086ca1b568b49cc25cd3 100644 --- a/moose-core/VERSION +++ b/moose-core/VERSION @@ -1 +1 @@ -3.1.1 \ No newline at end of file +3.1.1-38-gfeb23a0 \ No newline at end of file