Skip to content

Commit

Permalink
Added new way to specify compiler options for CCR (#507)
Browse files Browse the repository at this point in the history
* added blass to explict library requirements

* trying static blas

* added required to BLAS

* removed system hack

* added optional CXX_ADDITIONAL_FLAGS

* revert debug

* removed required

* wrapped blas

* fixed typo

* version bump
  • Loading branch information
mmcgurn authored Dec 13, 2023
1 parent a18f6b7 commit 959c10a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.18.4)
include(config/petscCompilers.cmake)

# Set the project details
project(ablateLibrary VERSION 0.12.15)
project(ablateLibrary VERSION 0.12.16)

# Load the Required 3rd Party Libaries
pkg_check_modules(PETSc REQUIRED IMPORTED_TARGET GLOBAL PETSc)
Expand Down Expand Up @@ -66,6 +66,15 @@ target_link_libraries(ablateLibrary
PRIVATE
chrestCompilerFlags)

# depending upon the build, we may need to add blas
find_package(BLAS)
if (BLAS_FOUND)
target_link_libraries(ablateLibrary
PUBLIC
BLAS::BLAS)
endif ()


# Set the ablate library requirements
set_property(TARGET ablateLibrary PROPERTY CXX_EXTENSIONS ON)
set_property(TARGET ablateLibrary PROPERTY CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
6 changes: 6 additions & 0 deletions config/petscCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ if (NOT DEFINED CMAKE_CXX_COMPILER)

pkg_get_variable(PETSC_CXX_FLAGS PETSc cxxflags_extra)
configure_flags("${PETSC_CXX_FLAGS}" PETSC_FLAGS_OUT)

# allow adding custom CXX_ADDITIONAL_FLAGS
if (DEFINED ENV{CXX_ADDITIONAL_FLAGS})
string(APPEND PETSC_FLAGS_OUT " " $ENV{CXX_ADDITIONAL_FLAGS})
endif ()

set(CMAKE_CXX_FLAGS_INIT ${PETSC_FLAGS_OUT})

message(STATUS "Using found PETSc c++ Compiler/Flags: ${PETSC_CXX_COMPILER} ${PETSC_FLAGS_OUT}\n")
Expand Down

0 comments on commit 959c10a

Please sign in to comment.