Skip to content

Commit

Permalink
Set up config.h for LAPACK configuration on build machine
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanwweber committed Nov 29, 2024
1 parent 3fc01d7 commit 0bab70a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions interfaces/python_sdist/build_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ def do_configure_substitution(
"FTN_TRAILING_UNDERSCORE": "#define FTN_TRAILING_UNDERSCORE 1",
"LAPACK_FTN_STRING_LEN_AT_END": "#define LAPACK_FTN_STRING_LEN_AT_END 1",
"LAPACK_FTN_TRAILING_UNDERSCORE": "#define LAPACK_FTN_TRAILING_UNDERSCORE 1",
"CT_USE_LAPACK": "#define CT_USE_LAPACK 1",
"CT_USE_LAPACK": "#cmakedefine01 CT_USE_LAPACK",
"CT_USE_SYSTEM_EIGEN": "#define CT_USE_SYSTEM_EIGEN 1",
"CT_USE_SYSTEM_EIGEN_PREFIXED": "/* #undef CT_USE_SYSTEM_EIGEN_PREFIXED */",
"CT_USE_SYSTEM_FMT": "#define CT_USE_SYSTEM_FMT 1",
"CT_USE_SYSTEM_YAMLCPP": "#define CT_USE_SYSTEM_YAMLCPP 1",
"CT_SUNDIALS_USE_LAPACK": "#define CT_SUNDIALS_USE_LAPACK 1",
"CT_SUNDIALS_USE_LAPACK": "#cmakedefine01 CT_SUNDIALS_USE_LAPACK",
"CT_USE_HDF5": "#define CT_USE_HDF5 1",
"CT_USE_SYSTEM_HIGHFIVE": "#define CT_USE_SYSTEM_HIGHFIVE 1",
"CT_USE_HIGHFIVE_BOOLEAN": "#define CT_USE_HIGHFIVE_BOOLEAN 1",
Expand Down Expand Up @@ -175,7 +175,7 @@ def main(

config_h_in = Path("include", "cantera", "base", "config.h.in")
configure_source = source_directory / config_h_in
configure_target = target_directory / config_h_in.with_suffix("")
configure_target = target_directory / config_h_in
configure_target.write_text(
do_configure_substitution(
configure_source, cantera_version, cantera_short_version
Expand Down
6 changes: 6 additions & 0 deletions interfaces/python_sdist/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,17 @@ list(APPEND CT_LIB_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/extensions/canteraShared
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
find_package(LAPACK REQUIRED)
find_package(BLAS REQUIRED)
set(CT_USE_LAPACK 1)
set(CT_SUNDIALS_USE_LAPACK 1)
set (SUNDIALS_LIBRARIES BLAS::BLAS LAPACK::LAPACK SUNDIALS::sunlinsollapackdense_static SUNDIALS::sunlinsollapackband_static)
else()
set (SUNDIALS_LIBRARIES SUNDIALS::sunlinsoldense_static SUNDIALS::sunlinsolband_static)
set(CT_USE_LAPACK 0)
set(CT_SUNDIALS_USE_LAPACK 0)
endif()

configure_file("../include/cantera/base/config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/../include/cantera/base/config.h")

add_library(cantera_lib STATIC ${CT_LIB_SOURCES})
target_include_directories(cantera_lib PRIVATE "../include" "${Python_INCLUDE_DIRS}" "${Boost_INCLUDE_DIRS}")
set_target_properties(cantera_lib PROPERTIES POSITION_INDEPENDENT_CODE ON)
Expand Down

0 comments on commit 0bab70a

Please sign in to comment.