Skip to content

Commit

Permalink
#718: fix cmake; update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Feb 19, 2025
1 parent e670c7b commit e722669
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 15 deletions.
23 changes: 16 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,33 @@ include(colors)
#=====================================================================
if(PRESSIO_OPS_INCLUDE_DIR)
message("${Green}-- Using ${PRESSIO_OPS_INCLUDE_DIR}")
include_directories(SYSTEM ${PRESSIO_OPS_INCLUDE_DIR})

else()

include(FetchContent)
message("${Green}-- PRESSIO_OPS_INCLUDE_DIR is not defined, so fetching pressio-ops...")

FetchContent_Declare(
pressio-ops
GIT_REPOSITORY https://github.com/Pressio/pressio-ops.git
GIT_TAG develop
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
)

FetchContent_MakeAvailable(pressio-ops)
set(PRESSIO_OPS_INCLUDE_DIR ${pressio-ops_SOURCE_DIR}/include)
endif()

# pull in pressio-log and read macros
#=====================================================================
option(PRESSIO_ENABLE_LOGGING "Enable logging via pressio-log" ON)
if (PRESSIO_ENABLE_LOGGING)
add_compile_definitions(PRESSIO_ENABLE_LOGGING=1)
else()
add_compile_definitions(PRESSIO_ENABLE_LOGGING=0)
endif()

message(STATUS "PRESSIO_ENABLE_LOGGING = ${PRESSIO_ENABLE_LOGGING}")
if (PRESSIO_ENABLE_LOGGING)
if(PRESSIO_LOG_INCLUDE_DIR)
message("${Green}-- Using ${PRESSIO_LOG_INCLUDE_DIR}")
include_directories(SYSTEM ${PRESSIO_LOG_INCLUDE_DIR})
else()
include(FetchContent)
message("${Green}-- PRESSIO_LOG_INCLUDE_DIR is not defined, so fetching pressio-log...")
Expand Down Expand Up @@ -97,9 +99,16 @@ if(PRESSIO_ENABLE_TESTS)

target_include_directories(
pressio INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include;${PRESSIO_OPS_INCLUDE_DIR};${PRESSIO_LOG_INCLUDE_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include;${PRESSIO_OPS_INCLUDE_DIR}>"
)

if (PRESSIO_ENABLE_LOGGING)
target_include_directories(
pressio INTERFACE
"$<BUILD_INTERFACE:${PRESSIO_LOG_INCLUDE_DIR}>"
)
endif()

enable_testing()
add_subdirectory(tests)
endif()
25 changes: 25 additions & 0 deletions docs/source/keywords.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,31 @@ For example, if we enable Trilinos then ``pressio`` automatically
enables also Kokkos, BLAS, LAPACK and MPI.


Logging
=======

.. list-table::
:widths: 30 60 10
:header-rows: 1
:align: left

* - Variable
- Description
- Default

* - ``PRESSIO_ENABLE_LOGGING``
- enables logging with ``pressio-log``
- ``ON``

* - ``PRESSIO_ENABLE_COLORIZED_OUTPUT``
- logging output will be colorized (warnings=yellow, errors=red)
- ``OFF``

* - ``PRESSIO_SILENCE_WARNINGS``
- the logger will omit any warning messages
- ``OFF``


Other Options
=============

Expand Down
8 changes: 0 additions & 8 deletions tests/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ if (PRESSIO_ENABLE_DEBUG_PRINT)
endif()

# LOGGING MACROS

option(PRESSIO_ENABLE_LOGGING "Enable logging via pressio-log" ON)
if (PRESSIO_ENABLE_LOGGING)
add_compile_definitions(PRESSIO_ENABLE_LOGGING=1)
else()
add_compile_definitions(PRESSIO_ENABLE_LOGGING=0)
endif()

option(PRESSIO_SILENCE_WARNINGS "Enable or disable warnings" OFF)
if (PRESSIO_SILENCE_WARNINGS)
add_compile_definitions(PRESSIO_SILENCE_WARNINGS=1)
Expand Down

0 comments on commit e722669

Please sign in to comment.