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 cmake scripts and add them to github actions #1302

Merged
merged 10 commits into from
Sep 13, 2024

Conversation

vissarion
Copy link
Member

This PR:

@vissarion vissarion added this to the 1.87 milestone Aug 14, 2024
@barendgehrels
Copy link
Collaborator

Cool PR, I review later

.)

# To compile with C++14
target_compile_features(${unit_test_name} PRIVATE cxx_std_14)

# To be able to run ctest
add_test(NAME ${unit_test_name} COMMAND ${unit_test_name})
if (NOT ("boost_geometry_${prefix}_${item}" STREQUAL "boost_geometry_cs_undefined_setops1") AND
NOT ("boost_geometry_${prefix}_${item}" STREQUAL "boost_geometry_cs_undefined_setops2"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this too specific?

Copy link
Collaborator

Choose a reason for hiding this comment

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

And why is it excluded. I get a memory violation - so that might be the reason.
Can't we pass an optional boolean variable to this function, to add to the test suite, or not?
(and then for ones like this we should not, but with a comment why not).

And then, probably, it can still be added as a unit test - but not as dependency to the custom tests target

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thanks.

setops2
)
boost_geometry_add_unit_test("cs_undefined" ${item})
endforeach()
Copy link
Collaborator

Choose a reason for hiding this comment

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

So, in line with my comment above, you would get a second loop here

foreach(item IN ITEMS
    setops1
    setops2
  )
  boost_geometry_add_unit_test("cs_undefined" ${item} FALSE)
endforeach()

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I added then one by one though.

PRIVATE
"${PROJECT_SOURCE_DIR}/test/robustness"
.)
endforeach()
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are not unit tests. These are programs.
I think we need to add a specific function for them.

But anyway, great they are at least compiled now.

Copy link
Collaborator

@barendgehrels barendgehrels left a comment

Choose a reason for hiding this comment

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

Thanks!

I made some comments, which can be applied either now, or in a subsequent PR (doesn't have to be you, I can also take care maybe) is also fine.

# Include the main Geometry test folder and the current folder
target_include_directories(${unit_test_name}
PRIVATE
"${PROJECT_SOURCE_DIR}/test"
"${PROJECT_SOURCE_DIR}/test"
"${PROJECT_SOURCE_DIR}/index/test"
.)

# To compile with C++14
target_compile_features(${unit_test_name} PRIVATE cxx_std_14)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The PR description mentions: test compilation with C++17
But won't this setting override that?

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems that cmake selects the highest version of the standard specified in both CMAKE_CXX_STANDARD and target_compile_features.
see also https://discourse.cmake.org/t/how-to-handle-different-cxx-standards-in-the-same-project/6510/6

However, it is not very neat to mix CMAKE_CXX_STANDARD and target_compile_features. As the code is right now I think it is simpler to just use CMAKE_CXX_STANDARD and avoid target_compile_features, as the former only needed to be set once while the latter need to be set for each individual test. But maybe for this PR it is OK as is. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree, maybe we should just use CMAKE_CXX_STANDARD
And for this PR, it is OK as it is.

Agreed.

#ticket_9081
)
boost_geometry_add_unit_test("robustness" ${item})
target_include_directories(boost_geometry_robustness_${item}
Copy link
Collaborator

@barendgehrels barendgehrels Aug 24, 2024

Choose a reason for hiding this comment

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

You might use ${BOOST_GEOMETRY_UNIT_TEST_NAME}, it is set by previous function for this purpose

@vissarion
Copy link
Member Author

@barendgehrels thansk for the review and the comments. I addressed them all. Only the discussion on the c++ standard needs some check.

.)

# To compile with C++14
target_compile_features(${unit_test_name} PRIVATE cxx_std_14)

# To be able to run ctest
add_test(NAME ${unit_test_name} COMMAND ${unit_test_name})
set(extra_macro_args ${ARGN})
if (NOT extra_macro_args STREQUAL "not_run")
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@barendgehrels
Copy link
Collaborator

Thanks for handling everything, completely fine!

@vissarion vissarion merged commit ad2a134 into boostorg:develop Sep 13, 2024
23 checks passed
@vissarion vissarion deleted the cmake_ci branch September 13, 2024 13:03
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.

Test libraries and executables should be declared EXCLUDE_FROM_ALL
2 participants