-
Notifications
You must be signed in to change notification settings - Fork 407
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
Use external GoogleTest optionally #4563
Use external GoogleTest optionally #4563
Conversation
Should I add something like this:
to README.md / BUILD.md? Or is that too much detail? |
) | ||
|
||
# avoid deprecation warnings from MSVC | ||
TARGET_COMPILE_DEFINITIONS(kokkos_gtest PUBLIC GTEST_HAS_TR1_TUPLE=0 GTEST_HAS_PTHREAD=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually GTEST_HAS_TR1_TUPLE
option was removed completely from gtest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To other reviewers: Make sure you see that this is dropping the compile definition -DGTEST_HAS_PTHREAD=0
Retest this please |
) | ||
|
||
# avoid deprecation warnings from MSVC | ||
TARGET_COMPILE_DEFINITIONS(kokkos_gtest PUBLIC GTEST_HAS_TR1_TUPLE=0 GTEST_HAS_PTHREAD=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To other reviewers: Make sure you see that this is dropping the compile definition -DGTEST_HAS_PTHREAD=0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should test this with Trilinos
before merging. Otherwise, this looks good to me.
Not a bad idea. @ndellingwood would you assist with this? |
No experience with |
@cz4rs @dalg24 so far I tested Trilinos with builds without an external Gtest package, so they fell back to the internal copy; for that case everything passed fine, no surprise. I still need to install and test with Gtest as an external package. My understanding with these changes is that the use of Gtest as an external package here would be isolated to Kokkos' testing, so this should not impact users of Trilinos (and downstream applications) that rely on the Trilinos Gtest package |
@dalg24 @cz4rs My assumption was incorrect - If I enable gtest as TPL in Trilinos and add my external gtest install (googletest v.1.8.0) to the system PATH so my install is found by CMake, then Trilinos configuration fails:
The relevant CMake configure options I used were:
I confirmed the above works with Kokkos' develop branch, so the changes in this PR are impacting the Trilinos configuration. Some applications use gtest through Trilinos for their testing, so this will need to be resolved for acceptance of the next release with Trilinos. When testing I modified my existing configuration to enable Gtest as TPL as above, but a simplified Trilinos setup and configuration to reproduce using just Kokkos' develop branch should look something like this:
cmake -DCMAKE_CXX_COMPLER=<g++,clang++, or icpc> -DTPL_ENABLE_GTEST=ON -DGTEST_INCLUDE_DIR=<path-to-ext-gtest-include> -DTrilinos_ENABLE_Kokkos=ON -DKokkos_ENABLE_TESTS=ON -DKokkos_SOURCE_DIR_OVERRIDE:STRING=kokkos $TRILINOS_DIR |
I tried another configuration option, enabling Gtest as a package in Trilinos (i.e. |
Thanks for the feedback! I will see what can be done about this (and take a look at the Trilinos issues linked). |
Rebased on top of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good. Do we still need the changes in cmake/kokkos_tribits.cmake
since we use the internal gtest with Trilinos?
SET(KOKKOS_GTEST_LIB GTest::gtest) | ||
ELSE() # fallback to internal gtest | ||
SET(KOKKOS_GTEST_LIB kokkos_gtest) | ||
ENDIF() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need these changes since we now always use us the internal gtest with Trilinos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because it's still possible to use either the internal copy or external GTest (without Trilinos).
fixes #4384
Use
find_package(GTest)
to check for external GoogleTest library.When not available, fallback to our internal copy in
tpls/gtest
.edit: Always use internal copy when building as a part of Trilinos.
Notes:
(for example in case when a GTest package is found, but it's not working correctly)