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

update bot tooling #137

Merged
merged 6 commits into from
Dec 16, 2024
Merged

update bot tooling #137

merged 6 commits into from
Dec 16, 2024

Conversation

dneto0
Copy link
Collaborator

@dneto0 dneto0 commented Dec 13, 2024

Update to:

  • gcc-13 on linux
  • cmake 3.31.2 on linux, windows
  • python 3.12 on Windows

Turn off warnings in googletest source. There are some warnings in it that cause compilation failure when using warnings-as-errors

This is required in order to build with GCC 13 with warnings-as-errors
Also:
  Linux: gcc-13, cmake-3.31.2
  Windows: python 3.12

Bug: crbug.com/383538610
CMakeLists.txt Outdated
@@ -301,6 +301,9 @@ if(CPPDAP_BUILD_TESTS)
list(APPEND DAP_TEST_LIST
${CPPDAP_GOOGLETEST_DIR}/googletest/src/gtest-all.cc
)
set_property(SOURCE
${CPPDAP_GOOGLETEST_DIR}/googletest/src/gtest-all.cc
APPEND PROPERTY COMPILE_OPTIONS -w)
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect indentation. But more importantly, I don't think this will work on MSVC builds. I think the problem here is the fact that we're adding gtest-all.cc to cppdap's SOURCE var, so it inherits the compilation flags from it. We can see that when CPPDAP_USE_EXTERNAL_GTEST_PACKAGE is defined, we use find_package, which brings in the GTest::gtest target. I think in the else() case above, we could use add_subdirectory to add ${CPPDAP_GOOGLETEST_DIR}/googletest, which would allow us to just link against the same target below. This would no longer build with the same compilation/warning flags.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, looking at that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dneto0
Copy link
Collaborator Author

dneto0 commented Dec 13, 2024

I've updated the build procedure to use add_subdirectory to include gtest code rather than reaching into its source tree.

@dneto0 dneto0 requested a review from amaiorano December 13, 2024 23:02
CMakeLists.txt Outdated
# Disable all warnings in googletest code.
target_compile_options(gtest PRIVATE -w)
set(CPPDAP_GTEST_TARGET gtest)
set(DAP_TEST_INCLUDE_DIR ${CPPDAP_GOOGLETEST_DIR}/googlemock/include/)
Copy link
Member

Choose a reason for hiding this comment

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

Turns out that this isn't necessary. You need to also link against the gmock target. See, GTest::gtest is an alias for those two targets, but sadly, it doesn't get added with add_subdirectory.

Also, you need to enable gtest_force_shared_crt on Windows, anyway, otherwise you get linker errors about mismatched CRTs. Finally, when setting sub-project variables in CMake, you want to set them in the CACHE, because these only get set once during CMake generation, but any build steps that rely on these values will not work properly if they're not cached (CMake sucks).

Take a look at my changes here: main...amaiorano:cppdap:main#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR299

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I pulled in your commit, thanks!

I still need to add the -w compile option though. Am trying that.

Copy link
Member

@amaiorano amaiorano left a comment

Choose a reason for hiding this comment

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

Am pre-approving so that you can get this landed asap as it's the weekend.

amaiorano and others added 2 commits December 16, 2024 10:23
GCC 13 issues a maybe-uninitialized warning on googletest
code. Use -w to disable it.

Note: MSVC understands -w
@dneto0 dneto0 merged commit 9fd09d6 into google:main Dec 16, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants