Skip to content

Commit

Permalink
use VG CMake kit FindOrFetchBoost.cmake that installs modularized Boo…
Browse files Browse the repository at this point in the history
…st if missing
  • Loading branch information
evaleev committed Jan 17, 2024
1 parent 248f85c commit 6f2c0ec
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 100 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,9 @@ if (ENABLE_WFN91_LINALG_DISCOVERY_KIT)
include(FetchWfn91LinAlgModules)
include(FindLinalg)
endif(ENABLE_WFN91_LINALG_DISCOVERY_KIT)
# BTAS does a better job of building and checking Boost since it uses Boost::serialization
# it also memorized the location of its config for use from install tree
# Boost is to be discovered by the top cmake project, and every (sub)project needs to make sure it has all of its targets
include(external/boost.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchBTAS.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchBoost.cmake)
if(ENABLE_SCALAPACK)
include(external/scalapackpp.cmake)
endif()
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Both methods are supported. However, for most users we _strongly_ recommend to b
- Boost.Container: header-only
- Boost.Test: header-only or (optionally) as a compiled library, *only used for unit testing*
- Boost.Range: header-only, *only used for unit testing*
- [BTAS](http://github.com/ValeevGroup/BTAS), tag bf0c376d5cdd6f668174b2a4c67b19634d1c0da7 . If usable BTAS installation is not found, TiledArray will download and compile
- [BTAS](http://github.com/ValeevGroup/BTAS), tag 85eea7796651de1bcb4781b0081a352b32bf91d5 . If usable BTAS installation is not found, TiledArray will download and compile
BTAS from source. *This is the recommended way to compile BTAS for all users*.
- [MADNESS](https://github.com/m-a-d-n-e-s-s/madness), tag 39de6cb4d262b3df1f67b3c04a37a935564ca657 .
Only the MADworld runtime and BLAS/LAPACK C API component of MADNESS is used by TiledArray.
Expand Down
3 changes: 0 additions & 3 deletions bin/admin/dependency-versions-update-hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ def replace_dep_id(topsrc, file_ext, dep_name, old_id, new_id, search_prefix = '

any_files_changed = False

# Boost version in INSTALL.md
any_files_changed |= replace_dep_id(topsrc, 'md', 'Boost', boost_old_version, boost_new_version, 'boost.org/), version ', ' or higher')

# Eigen version in INSTALL.md
any_files_changed |= replace_dep_id(topsrc, 'md', 'Eigen', eigen_old_version, eigen_new_version, 'eigen.tuxfamily.org), version ', ' or higher')
# Eigen install version in eigen.cmake
Expand Down
79 changes: 0 additions & 79 deletions cmake/modules/FindOrFetchBoost.cmake

This file was deleted.

10 changes: 8 additions & 2 deletions cmake/tiledarray-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ set(TILEDARRAY_EXT_VERSION "@TILEDARRAY_EXT_VERSION@")

@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

# Include library IMPORT targets

@Boost_CONFIG_FILE_CONTENTS@

if (NOT TARGET BTAS::BTAS)
get_filename_component(BTAS_DIR "@BTAS_CONFIG@" DIRECTORY)
find_package(BTAS 1.0.0 QUIET CONFIG REQUIRED HINTS "${BTAS_DIR}")
find_dependency(BTAS 1.0.0 QUIET CONFIG REQUIRED HINTS "${BTAS_DIR}")
endif()

if(NOT TARGET MADworld)
# if madness installed separately, use the madness install discovered when configuring TA
set(MADNESS_CONFIG_DIR "@MADNESS_CONFIG_DIR@")
Expand All @@ -38,7 +44,7 @@ set(TILEDARRAY_HAS_CUDA "@CUDA_FOUND@")
if(TILEDARRAY_HAS_CUDA)
cmake_minimum_required(VERSION 3.17)
if (NOT TARGET CUDA::cublas)
find_package(CUDAToolkit REQUIRED COMPONENTS cublas nvToolsExt)
find_dependency(CUDAToolkit REQUIRED COMPONENTS cublas nvToolsExt)
endif(NOT TARGET CUDA::cublas)
set(CMAKE_CUDA_HOST_COMPILER "@CMAKE_CUDA_HOST_COMPILER@")
# workaround from https://gitlab.kitware.com/cmake/cmake/issues/18614#note_485631
Expand Down
36 changes: 36 additions & 0 deletions external/boost.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Boost can be discovered by every (sub)package but only the top package can build it ...
# if we are the top package need to include the list of Boost components to be built
if("${CMAKE_PROJECT_NAME}" STREQUAL "${PROJECT_NAME}")
set(required_components
headers # TA, BTAS
algorithm # TA
container # TA, BTAS
iterator # TA, BTAS
random # TA, BTAS
tuple # TA
)
if (DEFINED Boost_REQUIRED_COMPONENTS)
list(APPEND Boost_REQUIRED_COMPONENTS
${required_components})
list(REMOVE_DUPLICATES Boost_REQUIRED_COMPONENTS)
else()
set(Boost_REQUIRED_COMPONENTS "${required_components}" CACHE STRING "Components of Boost to discovered or built")
endif()
set(optional_components
serialization # BTAS
)
if (DEFINED Boost_OPTIONAL_COMPONENTS)
list(APPEND Boost_OPTIONAL_COMPONENTS
${optional_components}
)
list(REMOVE_DUPLICATES Boost_OPTIONAL_COMPONENTS)
else()
set(Boost_OPTIONAL_COMPONENTS "${optional_components}" CACHE STRING "Optional components of Boost to discovered or built")
endif()
endif()

if (NOT DEFINED Boost_FETCH_IF_MISSING)
set(Boost_FETCH_IF_MISSING 1)
endif()

include(${vg_cmake_kit_SOURCE_DIR}/modules/FindOrFetchBoost.cmake)
14 changes: 3 additions & 11 deletions external/versions.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
# for each dependency track both current and previous id (the variable for the latter must contain PREVIOUS)
# to be able to auto-update them

set(TA_TRACKED_VGCMAKEKIT_TAG d6746098e63deab4032309c4455bb084a17ff51a)

# Boost explicitly downgraded to 1.59 from 1.68
set(TA_TRACKED_BOOST_VERSION 1.59)
set(TA_TRACKED_BOOST_PREVIOUS_VERSION 1.68)
set(TA_INSTALL_BOOST_VERSION 1.70.0)
set(TA_INSTALL_BOOST_PREVIOUS_VERSION 1.70.0)
set(TA_INSTALL_BOOST_URL_HASH 882b48708d211a5f48e60b0124cf5863c1534cd544ecd0664bb534a4b5d506e9)
set(TA_INSTALL_BOOST_PREVIOUS_URL_HASH 882b48708d211a5f48e60b0124cf5863c1534cd544ecd0664bb534a4b5d506e9)
set(TA_TRACKED_VGCMAKEKIT_TAG 8713beb71ff6b7d4b1c758e9e1c7d814bd97b0af)

# N.B. may need to update INSTALL.md manually with the CUDA-specific version
set(TA_TRACKED_EIGEN_VERSION 3.3.5)
Expand All @@ -24,8 +16,8 @@ set(TA_TRACKED_MADNESS_PREVIOUS_TAG 51c2728d664c096d0ea39d3b9cbf2895d8d99439)
set(TA_TRACKED_MADNESS_VERSION 0.10.1)
set(TA_TRACKED_MADNESS_PREVIOUS_VERSION 0.10.1)

set(TA_TRACKED_BTAS_TAG bf0c376d5cdd6f668174b2a4c67b19634d1c0da7)
set(TA_TRACKED_BTAS_PREVIOUS_TAG 3c91f086090390930bba62c6512c4e74a5520e76)
set(TA_TRACKED_BTAS_TAG 85eea7796651de1bcb4781b0081a352b32bf91d5)
set(TA_TRACKED_BTAS_PREVIOUS_TAG bf0c376d5cdd6f668174b2a4c67b19634d1c0da7)

set(TA_TRACKED_LIBRETT_TAG 6eed30d4dd2a5aa58840fe895dcffd80be7fbece)
set(TA_TRACKED_LIBRETT_PREVIOUS_TAG 354e0ccee54aeb2f191c3ce2c617ebf437e49d83)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ add_library(tiledarray ${TILEDARRAY_SOURCE_FILES} ${TILEDARRAY_HEADER_FILES})

target_link_libraries(${targetname} PUBLIC ${TILEDARRAY_PRIVATE_LINK_LIBRARIES})
target_link_libraries(${targetname} PUBLIC MADworld)
target_link_libraries(${targetname} PUBLIC Boost::boost)
target_link_libraries(${targetname} PUBLIC Boost::headers)

# build all external deps before building tiledarray
add_dependencies(${targetname} External-tiledarray)
Expand Down

0 comments on commit 6f2c0ec

Please sign in to comment.