Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ The Smith project release numbers follow [Semantic Versioning](http://semver.org

- Reworked the trust-region solver to use an MFEM/LAPACK subspace solve with cached reduced problems and simplified Steihaug-Toint CG internals.
- [Changed `TimeDiscretizedWeakForm` class name to `FunctionalWeakForm`](https://github.com/llnl/smith/pull/1609/).
- Required third-party libraries (Camp, Axom, MFEM, and Adiak/Caliper when profiling) are now found via the generic
`find_package` search paths (e.g. `CMAKE_PREFIX_PATH`) when their `<TPL>_DIR` variable is not given.

### Fixed

- FunctionalWeakForm::jvp() to include shape-displacement contributions, which were previously ignored.
- Given `<TPL>_DIR` variables now take precedence over packages installed in system paths.

## [Version 0.1.0] - Release date 2026-04-28

Expand Down
72 changes: 72 additions & 0 deletions cmake/SmithMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,78 @@ macro(smith_assert_find_succeeded)
endmacro(smith_assert_find_succeeded)


##------------------------------------------------------------------------------
## smith_find_package(NAME <package name given to find_package>
## PROJECT_NAME <project name used in messages>
## TARGET <expected target>
## DIR_VARIABLE <variable that holds the prefix>
## [PATH_SUFFIXES <suffix>...])
##
## Finds a required package that provides a CMake config file. If DIR_VARIABLE
## is set, it is searched first. The generic find_package(<NAME>) search paths
## (e.g. <NAME>_ROOT, CMAKE_PREFIX_PATH, and system paths) are always searched.
##
## Sets <NAME in upper case>_FOUND. If the package was found without
## DIR_VARIABLE, DIR_VARIABLE is set to the found install prefix so it is
## recorded in the installed smith-config.cmake.
##
## Fails with a helpful message when the package could not be found.
##------------------------------------------------------------------------------
macro(smith_find_package)

set(options)
set(singleValueArgs NAME PROJECT_NAME TARGET DIR_VARIABLE)
set(multiValueArgs PATH_SUFFIXES)

# Parse the arguments to the macro
# Note: Use a unique prefix since this macro calls other macros that use 'arg'
cmake_parse_arguments(_sfp
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})

string(TOUPPER ${_sfp_NAME} _sfp_upper_name)

set(_sfp_find_args)
if(${_sfp_DIR_VARIABLE})
smith_assert_is_directory(DIR_VARIABLE ${_sfp_DIR_VARIABLE})
set(_sfp_dir_given TRUE)
set(_sfp_dir "${${_sfp_DIR_VARIABLE}}")
list(APPEND _sfp_find_args HINTS "${_sfp_dir}")
else()
set(_sfp_dir_given FALSE)
endif()
if(_sfp_PATH_SUFFIXES)
list(APPEND _sfp_find_args PATH_SUFFIXES ${_sfp_PATH_SUFFIXES})
endif()

find_package(${_sfp_NAME} ${_sfp_find_args})

if(TARGET ${_sfp_TARGET})
if(NOT _sfp_dir_given)
# Record the install prefix of the found config file, e.g. <prefix>/lib/cmake/<name>
string(REGEX REPLACE "/(lib[^/]*|share)/cmake(/[^/]*)?/?$" ""
_sfp_dir "${${_sfp_NAME}_DIR}")
set(${_sfp_DIR_VARIABLE} "${_sfp_dir}" CACHE PATH "" FORCE)
endif()
smith_assert_find_succeeded(PROJECT_NAME ${_sfp_PROJECT_NAME}
TARGET ${_sfp_TARGET}
DIR_VARIABLE ${_sfp_DIR_VARIABLE})
message(STATUS "${_sfp_PROJECT_NAME} support is ON")
set(${_sfp_upper_name}_FOUND TRUE)
elseif(_sfp_dir_given)
message(FATAL_ERROR "${_sfp_PROJECT_NAME} failed to load from given ${_sfp_DIR_VARIABLE}: ${_sfp_dir}")
else()
message(FATAL_ERROR "Could not find ${_sfp_PROJECT_NAME}. Either set ${_sfp_DIR_VARIABLE} to its "
"install prefix or add the install prefix to CMAKE_PREFIX_PATH.")
endif()

unset(_sfp_dir)
unset(_sfp_dir_given)
unset(_sfp_find_args)
unset(_sfp_upper_name)

endmacro(smith_find_package)


##------------------------------------------------------------------------------
## smith_convert_to_native_escaped_file_path( path output )
##
Expand Down
29 changes: 20 additions & 9 deletions cmake/thirdparty/FindMFEM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,27 @@
# STRUMPACK_FOUND - If MFEM was built with STRUMPACK
#------------------------------------------------------------------------------

if(NOT MFEM_DIR)
message(FATAL_ERROR "MFEM support needs explicit MFEM_DIR")
if(MFEM_DIR)
message(STATUS "Looking for MFEM using MFEM_DIR = ${MFEM_DIR}")
smith_assert_is_directory(DIR_VARIABLE MFEM_DIR)

set(_MFEM_DIR ${MFEM_DIR}) # Save MFEM_DIR as a non-cache variable
find_package(MFEM CONFIG NO_DEFAULT_PATH PATHS "${MFEM_DIR}/lib/cmake/mfem")
# find_package will overwrite MFEM_DIR, so restore it here
set(MFEM_DIR ${_MFEM_DIR} CACHE PATH "" FORCE)
else()
# Without MFEM_DIR, we can only find an MFEM that was built with CMake
message(STATUS "Looking for MFEM's CMake config file in the default search paths")
find_package(MFEM CONFIG)
if(NOT MFEM_FOUND)
message(FATAL_ERROR "Could not find MFEM. Either set MFEM_DIR to its install prefix "
"or add the install prefix to CMAKE_PREFIX_PATH.")
endif()
# find_package sets MFEM_DIR to the config file directory, so set it to the install prefix
get_filename_component(_MFEM_DIR "${MFEM_DIR}/../../.." ABSOLUTE)
set(MFEM_DIR ${_MFEM_DIR} CACHE PATH "" FORCE)
endif()
message(STATUS "Looking for MFEM using MFEM_DIR = ${MFEM_DIR}")
smith_assert_is_directory(DIR_VARIABLE MFEM_DIR)

set(_MFEM_DIR ${MFEM_DIR}) # Save MFEM_DIR as a non-cache variable
find_package(MFEM CONFIG NO_DEFAULT_PATH PATHS "${MFEM_DIR}/lib/cmake/mfem")
# find_package will overwrite MFEM_DIR, so restore it here
set(MFEM_DIR ${_MFEM_DIR} CACHE PATH "" FORCE)
unset(_MFEM_DIR)

set(_mfem_uses_mpi FALSE)
set(_mfem_uses_openmp FALSE)
Expand Down
Loading