Skip to content

Commit

Permalink
[cmake] introduced MADNESS_BUILD_LIBRARIES_ONLY
Browse files Browse the repository at this point in the history
configuring with MADNESS_BUILD_LIBRARIES_ONLY=ON builds all MADNESS libraries only; similar to MADNESS_BUILD_MADWORLD_ONLY, supercedes it
  • Loading branch information
evaleev committed Oct 25, 2023
1 parent 88b34e4 commit 9ac6c14
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 25 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ set(MADNESS_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/madness"

# Build options ==============================================================

redefaultable_option(MADNESS_BUILD_MADWORLD_ONLY "Build only MADWorld runtime (excluding BLAS/LAPACK interfaces)" OFF)
redefaultable_option(MADNESS_BUILD_LIBRARIES_ONLY "Build only MADNESS libraries" OFF)
if (NOT MADNESS_BUILD_LIBRARIES_ONLY)
redefaultable_option(MADNESS_BUILD_MADWORLD_ONLY "Build only MADWorld runtime (excluding BLAS/LAPACK interfaces)" OFF)
endif()
redefaultable_option(MADNESS_ENABLE_CEREAL "Support use of Cereal archives as backends for MADNESS serialization" OFF)

# Enable optional libraries ====================================================
Expand Down Expand Up @@ -639,11 +642,11 @@ include(external/gperftools.cmake)
include(external/tbb.cmake)
include(external/parsec.cmake)
include(external/boost.cmake)
if (NOT MADNESS_BUILD_MADWORLD_ONLY)
if (NOT MADNESS_BUILD_MADWORLD_ONLY OR MADNESS_BUILD_LIBRARIES_ONLY)
include(external/lapack.cmake)
include(external/libxc.cmake)
include(external/pcm.cmake)
endif (NOT MADNESS_BUILD_MADWORLD_ONLY)
endif ()

if (DEFINED ELEMENTAL_TAG)
include(external/elemental.cmake)
Expand All @@ -655,7 +658,7 @@ endif (DEFINED ELEMENTAL_TAG)
add_custom_target(everything)
add_dependencies(everything madness)

if(NOT MADNESS_BUILD_MADWORLD_ONLY AND LAPACK_FOUND)
if(NOT (MADNESS_BUILD_MADWORLD_ONLY OR MADNESS_BUILD_LIBRARIES_ONLY) AND LAPACK_FOUND)
add_custom_target_subproject(madness numerical-examples)
add_custom_target_subproject(madness applications)
endif()
Expand Down
3 changes: 3 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ The following CMake cache variables turn features on and off.
otherwise the default is OFF.
* MADNESS_BUILD_MADWORLD_ONLY --- whether to build the MADNESS runtime only; if `ON`, discovery of BLAS/LAPACK
and building of numerical components and applications will be disabled [default=`OFF`]
* MADNESS_BUILD_LIBRARIES_ONLY --- whether to build the MADNESS libraries only; if `ON`,
building of numerical components and applications will be disabled and
the value of `MADNESS_BUILD_MADWORLD_ONLY` ignored [default=`OFF`]

## External libraries

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# src

add_subdirectory(madness)
if(NOT MADNESS_BUILD_MADWORLD_ONLY AND LAPACK_FOUND)
if(NOT (MADNESS_BUILD_MADWORLD_ONLY OR MADNESS_BUILD_LIBRARIES_ONLY) AND LAPACK_FOUND)
add_subdirectory(apps)
add_subdirectory(examples)
endif()
Expand Down
18 changes: 11 additions & 7 deletions src/madness/chem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ add_mad_library(chem MADCHEM_SOURCES MADCHEM_HEADERS "mra" "madness/chem/")
endif ()

# Add executables
add_mad_executable(plotxc "plotxc.cc;xcfunctional.h" "MADchem")
if (NOT MADNESS_BUILD_LIBRARIES_ONLY)
add_mad_executable(plotxc "plotxc.cc;xcfunctional.h" "MADchem")
endif()

# Install files
install(FILES sto-3g sto-6g 6-31g coredata/mcp coredata/mcp2 coredata/mcp_guess structure_library
Expand All @@ -149,10 +151,12 @@ if(BUILD_TESTING)
add_unittests(chem "${CHEM_TEST_SOURCES_SHORT}" "MADchem;MADgtest" "unittests;short")
add_unittests(chem "${CHEM_TEST_SOURCES_LONG}" "MADchem;MADgtest" "unittests;long")

# Create other test executables not included in the unit tests
set(CHEM_OTHER_TESTS testxc benchmark_exchange_operator)
foreach(_test ${CHEM_OTHER_TESTS})
add_mad_executable(${_test} "${_test}.cc" "MADchem")
endforeach()

# Create other test executables not included in the unit tests ... consider these executables (unlike unit tests)
if (NOT MADNESS_BUILD_LIBRARIES_ONLY)
set(CHEM_OTHER_TESTS testxc benchmark_exchange_operator)
foreach(_test ${CHEM_OTHER_TESTS})
add_mad_executable(${_test} "${_test}.cc" "MADchem")
endforeach()
endif()

endif()
28 changes: 15 additions & 13 deletions src/madness/mra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ set(MADMRA_SOURCES

# Create the MADmra library
add_mad_library(mra MADMRA_SOURCES MADMRA_HEADERS "linalg;tinyxml;muparser" "madness/mra")

# Create executables
# add_mad_executable(mraplot "mraplot.cc" "MADmra") # installation fails with gnu-8 and gnu-9

# Install the MADmra library
# install(TARGETS mraplot DESTINATION "${MADNESS_INSTALL_BINDIR}")
install(FILES autocorr coeffs gaussleg ble-first.txt ble-second.txt b-spline-deriv1.txt b-spline-deriv2.txt b-spline-deriv3.txt
install(FILES autocorr coeffs gaussleg ble-first.txt ble-second.txt b-spline-deriv1.txt b-spline-deriv2.txt b-spline-deriv3.txt
DESTINATION "${MADNESS_INSTALL_DATADIR}"
COMPONENT mra)

# Create executables
if (NOT MADNESS_BUILD_LIBRARIES_ONLY)
add_mad_executable(mraplot "mraplot.cc" "MADmra") # installation fails with gnu-8 and gnu-9
install(TARGETS mraplot DESTINATION "${MADNESS_INSTALL_BINDIR}")
endif()

# Add unit tests
if(BUILD_TESTING)

Expand All @@ -43,12 +43,14 @@ if(BUILD_TESTING)
testper.cc)
add_unittests(mra_sepop "${MRA_SEPOP_TEST_SOURCES}" "libtest_sepop;MADgtest" "unittests;short")

# Test executables that are not run with unit tests
set(MRA_OTHER_TESTS testperiodic testbc testqm test6
testdiff1D testdiff2D testdiff3D)
# Test executables that are not run with unit tests ... consider these executables (unlike unit tests)
if (NOT MADNESS_BUILD_LIBRARIES_ONLY)
set(MRA_OTHER_TESTS testperiodic testbc testqm test6
testdiff1D testdiff2D testdiff3D)

foreach(_test ${MRA_OTHER_TESTS})
add_mad_executable(${_test} "${_test}.cc" "MADmra")
endforeach()
foreach(_test ${MRA_OTHER_TESTS})
add_mad_executable(${_test} "${_test}.cc" "MADmra")
endforeach()
endif()

endif()

0 comments on commit 9ac6c14

Please sign in to comment.