Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Adjust MPI and ZLIB support query for p4est version 2.8 #13374

Merged
merged 1 commit into from
Feb 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions cmake/modules/FindP4EST.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ IF(EXISTS ${P4EST_INCLUDE_DIR}/p4est_config.h)
FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_MPI_STRING
REGEX "#define.*P4EST_MPI 1")
IF("${P4EST_MPI_STRING}" STREQUAL "")
SET(P4EST_WITH_MPI FALSE)
FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_MPI_STRING
REGEX "#define.*P4EST_ENABLE_MPI")
IF("${P4EST_MPI_STRING}" STREQUAL "")
SET(P4EST_WITH_MPI FALSE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this even possible? I didn't know you could compile p4est without MPI, and in any case, what would one want to use it for?

Copy link
Member Author

@tamiko tamiko Feb 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is perfectly possible to compile P4est without MPI support:
https://github.com/cburstedde/p4est/blob/feature-cmake/cmake/options.cmake#L9
https://github.com/cburstedde/p4est/blob/master/src/p4est.c#L1297-L1327

P4est without MPI support isn't really useful for us. Because of that we require enabled MPI for P4est. 😸

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fascinating. Why would one do that?

ELSE()
SET(P4EST_WITH_MPI TRUE)
ENDIF()
ELSE()
SET(P4EST_WITH_MPI TRUE)
ENDIF()
Expand All @@ -123,7 +129,7 @@ IF(EXISTS ${P4EST_INCLUDE_DIR}/p4est_config.h)
# Is p4est built against zlib?
#
FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_ZLIB_STRING
REGEX "#define.*P4EST_HAVE_ZLIB 1")
REGEX "^#define.*P4EST_HAVE_ZLIB")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not important, but the C preprocessor syntax doesn't actually require the # to appear at the top of the line (it just has to be the first non-space-non-tab of the line), and it can be followed by zero or more spaces. So technically, the regex isn't quite correct. But then if it works, that's good enough :-)

IF("${P4EST_ZLIB_STRING}" STREQUAL "")
SET(P4EST_WITH_ZLIB FALSE)
ELSE()
Expand Down