Skip to content

Commit

Permalink
Merge branch 'boost-update' into 'master'
Browse files Browse the repository at this point in the history
[cmake] Update Boost to 1.82

See merge request ogs/ogs!5122
  • Loading branch information
endJunction committed Oct 1, 2024
2 parents eb18999 + 1b35e53 commit 365a294
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 46 deletions.
1 change: 1 addition & 0 deletions Applications/FileIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ target_link_libraries(
$<$<BOOL:${OGS_BUILD_GUI}>:QtBase>
$<$<TARGET_EXISTS:shp>:shp>
$<$<TARGET_EXISTS:SwmmInterface>:SwmmInterface>
Boost::dynamic_bitset
PRIVATE MeshLib MeshToolsLib GitInfoLib
)

Expand Down
3 changes: 2 additions & 1 deletion BaseLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ ogs_add_library(BaseLib GENERATE_EXPORT_HEADER ${SOURCES})

target_link_libraries(
BaseLib
PUBLIC Boost::boost
PUBLIC Boost::algorithm
Boost::property_tree
spdlog
tclap
$<$<BOOL:${MSVC}>:WinMM> # needed for timeGetTime
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ cmake_minimum_required(VERSION 3.22)
if(CMAKE_VERSION GREATER_EQUAL 3.29)
cmake_policy(SET CMP0156 NEW)
endif()
if(CMAKE_VERSION GREATER_EQUAL 3.30)
cmake_policy(SET CMP0167 NEW)
endif()

project(OGS-6)

Expand Down
2 changes: 1 addition & 1 deletion MaterialLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ogs_add_library(MaterialLib GENERATE_EXPORT_HEADER ${SOURCES})
target_link_libraries(
MaterialLib PUBLIC BaseLib Eigen3::Eigen MaterialLib_SolidModels
MaterialLib_FractureModels
PRIVATE MathLib MeshLib ParameterLib exprtk Boost::boost
PRIVATE MathLib MeshLib ParameterLib exprtk Boost::math
)

target_precompile_headers(
Expand Down
1 change: 1 addition & 0 deletions MaterialLib/FractureModels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ append_source_files(SOURCES Permeability)
ogs_add_library(MaterialLib_FractureModels GENERATE_EXPORT_HEADER ${SOURCES})
target_link_libraries(
MaterialLib_FractureModels PUBLIC MathLib PRIVATE ParameterLib NumLib
Boost::math
)
10 changes: 6 additions & 4 deletions MaterialLib/SolidModels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ get_source_files(SOURCES)

ogs_add_library(MaterialLib_SolidModels ${SOURCES})
target_link_libraries(
MaterialLib_SolidModels PUBLIC MathLib PRIVATE ParameterLib
NumLib
MaterialLib_SolidModels PUBLIC MathLib Boost::math PRIVATE ParameterLib
NumLib
)

if(OGS_USE_MFRONT)
Expand All @@ -14,5 +14,7 @@ if(OGS_USE_MFRONT)
)
endif()

target_precompile_headers(MaterialLib_SolidModels PRIVATE [["BaseLib/Error.h"]]
[["BaseLib/ConfigTree.h"]] [["BaseLib/Logging.h"]] <Eigen/Core>)
target_precompile_headers(
MaterialLib_SolidModels PRIVATE [["BaseLib/Error.h"]]
[["BaseLib/ConfigTree.h"]] [["BaseLib/Logging.h"]] <Eigen/Core>
)
3 changes: 1 addition & 2 deletions MaterialLib/SolidModels/MFront/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ ogs_add_library(MaterialLib_SolidModels_MFront ${SOURCES})

target_link_libraries(
MaterialLib_SolidModels_MFront PUBLIC BaseLib NumLib MFrontGenericInterface
Boost::boost PRIVATE MathLib MeshLib
ParameterLib
PRIVATE MathLib MeshLib ParameterLib
)
target_include_directories(
MaterialLib_SolidModels_MFront PUBLIC ThirdParty/MGIS/include
Expand Down
4 changes: 2 additions & 2 deletions NumLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ ogs_add_library(NumLib GENERATE_EXPORT_HEADER ${SOURCES})
set_target_properties(NumLib PROPERTIES LINKER_LANGUAGE CXX)

target_link_libraries(
NumLib PUBLIC BaseLib GeoLib MathLib MeshLib $<$<TARGET_EXISTS:petsc>:petsc>
Boost::boost
NumLib PUBLIC BaseLib GeoLib MathLib MeshLib
$<$<TARGET_EXISTS:petsc>:petsc>
)

target_precompile_headers(
Expand Down
33 changes: 16 additions & 17 deletions ProcessLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ append_source_files(SOURCES Output)
append_source_files(SOURCES Utils)
append_source_files(SOURCES Reflection)
append_source_files(SOURCES Graph)
### For processes that contains both hydraulical process and mechanical process
# For processes that contains both hydraulical process and mechanical process
# Define a function to check if enabled_processes contains LIE, HydroMechanics,
# ThermoHydroMechanics, RichardsMechanics, or ThermoRichardsMechanics
function(check_enabled_processes contains_hm_process)
set(${contains_hm_process} FALSE PARENT_SCOPE)
foreach(process ${_enabled_processes})
if(process STREQUAL "LIE"
OR process STREQUAL "HydroMechanics"
OR process STREQUAL "ThermoHydroMechanics"
OR process STREQUAL "RichardsMechanics"
OR process STREQUAL "TH2M"
OR process STREQUAL "ThermoRichardsMechanics")
OR process STREQUAL "HydroMechanics"
OR process STREQUAL "ThermoHydroMechanics"
OR process STREQUAL "RichardsMechanics"
OR process STREQUAL "TH2M"
OR process STREQUAL "ThermoRichardsMechanics"
)
set(${contains_hm_process} TRUE PARENT_SCOPE)
return()
endif()
Expand All @@ -46,17 +47,15 @@ add_subdirectory(BoundaryConditionAndSourceTerm/Python)

target_link_libraries(
ProcessLib
PUBLIC
BaseLib
MaterialLib
MathLib
MeshGeoToolsLib
MeshLib
NumLib
Boost::boost
range-v3
$<$<TARGET_EXISTS:petsc>:petsc>
ProcessLibBoundaryConditionAndSourceTermPython
PUBLIC BaseLib
MaterialLib
MathLib
MeshGeoToolsLib
MeshLib
NumLib
range-v3
$<$<TARGET_EXISTS:petsc>:petsc>
ProcessLibBoundaryConditionAndSourceTermPython
PRIVATE ParameterLib GitInfoLib $<$<TARGET_EXISTS:InSituLib>:InSituLib>
)

Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/LIE/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
get_source_files(SOURCES)

ogs_add_library(LIECommon ${SOURCES})
target_link_libraries(LIECommon PUBLIC MeshLib)
target_link_libraries(LIECommon PUBLIC MeshLib PRIVATE Boost::math)
2 changes: 1 addition & 1 deletion Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ target_link_libraries(
TestInfoLib
VTK::FiltersGeneral
VTK::FiltersSources
Boost::boost # TODO move OGSMFrontThermodynamicForcesView to MathLib?
Boost::math # TODO move OGSMFrontThermodynamicForcesView to MathLib?
$<$<TARGET_EXISTS:LIE>:LIE>
$<$<TARGET_EXISTS:TH2M>:TH2M>
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:MPI::MPI_CXX>>:MPI::MPI_CXX>
Expand Down
2 changes: 1 addition & 1 deletion Tests/xdmfdiff/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ogs_add_executable(xdmfdiff xdmfdiff.cpp)
target_link_libraries(xdmfdiff OgsXdmf GitInfoLib tclap)
target_link_libraries(xdmfdiff OgsXdmf GitInfoLib tclap Boost::range)
install(PROGRAMS $<TARGET_FILE:xdmfdiff> DESTINATION bin)
2 changes: 1 addition & 1 deletion scripts/cmake/CheckHeaderCompilation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function(_check_header_compilation target)
lib
${LINK_LIBS}
spdlog::spdlog
Boost::boost
Boost::headers
Eigen3::Eigen
nlohmann_json::nlohmann_json
range-v3
Expand Down
43 changes: 29 additions & 14 deletions scripts/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -190,22 +190,35 @@ if(OGS_USE_MFRONT)
endif()
endif()

CPMFindPackage(
NAME Boost
VERSION ${ogs.minimum_version.boost}
URL https://gitlab.opengeosys.org/ogs/libs/boost-subset/-/jobs/303158/artifacts/raw/ogs-boost-${ogs.minimum_version.boost}.tar.gz
SYSTEM TRUE
# Boost libraries used by ogs, can be linked with Boost::[lib_name]
set(BOOST_INCLUDE_LIBRARIES
math
property_tree
algorithm
smart_ptr
tokenizer
assign
dynamic_bitset
range
variant
)
if(Boost_ADDED)
add_library(Boost::boost INTERFACE IMPORTED)
target_include_directories(
Boost::boost SYSTEM INTERFACE "${Boost_SOURCE_DIR}"
)
if(GUIX_BUILD)
find_package(Boost REQUIRED)
else()
target_include_directories(
Boost::boost SYSTEM INTERFACE "${Boost_INCLUDE_DIR}"
CPMFindPackage(
NAME Boost
VERSION ${ogs.minimum_version.boost}
URL https://github.com/boostorg/boost/releases/download/boost-${ogs.minimum_version.boost}/boost-${ogs.minimum_version.boost}.tar.xz
OPTIONS "BOOST_ENABLE_CMAKE ON"
)
endif()
if(NOT Boost_ADDED)
# Boost from system found. There are only Boost::headers and Boost::boost
# targets.
foreach(lib ${BOOST_INCLUDE_LIBRARIES})
add_library(Boost::${lib} ALIAS Boost::headers)
endforeach()
endif()

CPMFindPackage(
NAME LibXml2
Expand Down Expand Up @@ -406,14 +419,16 @@ if((OGS_BUILD_TESTING OR OGS_BUILD_UTILS) AND NOT GUIX_BUILD)
OgsXdmf SYSTEM PUBLIC ${xdmf_SOURCE_DIR} ${xdmf_BINARY_DIR}
)

target_link_libraries(OgsXdmf Boost::boost)
target_link_libraries(OgsXdmf Boost::tokenizer)
target_include_directories(
OgsXdmfCore SYSTEM PUBLIC ${xdmf_SOURCE_DIR}/core
${xdmf_BINARY_DIR}/core
PRIVATE ${xdmf_SOURCE_DIR}/CMake/VersionSuite
)
target_link_libraries(
OgsXdmfCore PUBLIC Boost::boost LibXml2::LibXml2 ${HDF5_LIBRARIES}
OgsXdmfCore PUBLIC LibXml2::LibXml2 ${HDF5_LIBRARIES} Boost::variant
Boost::smart_ptr
PRIVATE Boost::tokenizer Boost::assign Boost::algorithm
)

set_target_properties(
Expand Down
2 changes: 1 addition & 1 deletion web/data/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"git": "2.14",
"cmake": "3.22",
"hugo": "0.122.0",
"boost": "1.73.0",
"boost": "1.82.0",
"eigen": "3.4.0",
"eigen-unsupported": "9000b3767770f6dd0f4cfb12f4e19c71921885a4",
"vtk": "9.3.0",
Expand Down

0 comments on commit 365a294

Please sign in to comment.