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

CGAL: Modernize CMakeLists.txt #8528

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

afabri
Copy link
Member

@afabri afabri commented Oct 8, 2024

Summary of Changes

  • Changed PUBLIC to PRIVATE in the target_link_libraries()
  • Link against Boost::<COMPONENT> as we do more than just linking and must use the CGAL::_.._support
  • Use target_compile_definitions() and add_compile_definitions()

More to be done.

Release Management

@afabri
Copy link
Member Author

afabri commented Oct 9, 2024

Why do we have this cmake if-then-else here? Is it for backward compatibility for older versions of cmake? @lrineau

@lrineau
Copy link
Member

lrineau commented Oct 9, 2024

Why do we have this cmake if-then-else here? Is it for backward compatibility for older versions of cmake? @lrineau

Yes, I think so. Maybe it can be removed.

@afabri
Copy link
Member Author

afabri commented Oct 9, 2024

Why do we have this cmake if-then-else here? Is it for backward compatibility for older versions of cmake? @lrineau

Yes, I think so. Maybe it can be removed.

I guess we have a test platform where we use the "minimal required" version of cmake?

Also can we then remove the line add_definitions("-DCGAL_USE_BOOST_PROGRAM_OPTIONS") ??

@afabri
Copy link
Member Author

afabri commented Oct 9, 2024

Also can we then remove the line add_definitions("-DCGAL_USE_BOOST_PROGRAM_OPTIONS") ??

It is needed. Does that need "modernization" @lrineau ?

@sloriot
Copy link
Member

sloriot commented Oct 9, 2024

Why do we have this cmake if-then-else here? Is it for backward compatibility for older versions of cmake? @lrineau

Yes, I think so. Maybe it can be removed.

I guess we have a test platform where we use the "minimal required" version of cmake?

My guess is that it will depend how boost is found (config mode or with FindBoost.cmake).

Also can we then remove the line add_definitions("-DCGAL_USE_BOOST_PROGRAM_OPTIONS") ??

IIRC, this is to disable something at runtime in the example. So if you remove it you need to update the example and the cmake script to not compile it.

…where, but let's first see a green testsuite
@lrineau
Copy link
Member

lrineau commented Oct 9, 2024

CGAL_USE_BOOST_PROGRAM_OPTIONS

No. That preprocessor macro is used in Ridges_3 examples.

@lrineau
Copy link
Member

lrineau commented Oct 9, 2024

Also can we then remove the line add_definitions("-DCGAL_USE_BOOST_PROGRAM_OPTIONS") ??

It is needed. Does that need "modernization" @lrineau ?

add_definitions("-DCGAL_USE_BOOST_PROGRAM_OPTIONS")
if(TARGET Boost::program_options)
target_link_libraries(Compute_Ridges_Umbilics PRIVATE Boost::program_options)
target_link_libraries(Ridges_Umbilics_SM PRIVATE Boost::program_options)
target_link_libraries(Ridges_Umbilics_LCC PRIVATE Boost::program_options)
else()
target_link_libraries(Compute_Ridges_Umbilics PRIVATE ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(Ridges_Umbilics_SM PRIVATE ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(Ridges_Umbilics_LCC PRIVATE ${Boost_PROGRAM_OPTIONS_LIBRARY})
endif()

It swaps three lines of target_compile_definitions against one line add_definitions that is for the three programs after. I think it is all right. But, as for all the other cases, that is a matter of taste. If the other way around looks better for you, change the code.

@afabri
Copy link
Member Author

afabri commented Oct 9, 2024

TBB seems also to use keywords like emit(), as can be seen in the CI

/usr/include/oneapi/tbb/profiling.h:229:15: error: expected unqualified-id before ‘)’ token
  229 |     void emit() { }

Maybe we can tell moc not to parse TBB headers. Would even accelerate compilation.
Or we just keep QT_NO_KEYWORDS

@lrineau
Copy link
Member

lrineau commented Oct 9, 2024

TBB seems also to use keywords like emit(), as can be seen in the CI

/usr/include/oneapi/tbb/profiling.h:229:15: error: expected unqualified-id before ‘)’ token
  229 |     void emit() { }

Bless the CI!

And I thanks myself for that initiative (started by #4234).

@afabri
Copy link
Member Author

afabri commented Oct 9, 2024

There is a disussion on github/TBB. There I even saw @mglisse.
My conclusion is that we just keep QT_NO_KEYWORDS

@sloriot
Copy link
Member

sloriot commented Oct 9, 2024

Why do we have this cmake if-then-else here? Is it for backward compatibility for older versions of cmake? @lrineau

Yes, I think so. Maybe it can be removed.

I guess we have a test platform where we use the "minimal required" version of cmake?

My guess is that it will depend how boost is found (config mode or with FindBoost.cmake).

Also can we then remove the line add_definitions("-DCGAL_USE_BOOST_PROGRAM_OPTIONS") ??

IIRC, this is to disable something at runtime in the example. So if you remove it you need to update the example and the cmake script to not compile it.

Starting cmake 3.5, Boost::<COMPONENT> are also defined by FindBoost.cmake so we can get rid of the else case.

@afabri
Copy link
Member Author

afabri commented Oct 10, 2024

@lrineau what is CGAL::Data in target_link_libraries() about ?

@sloriot
Copy link
Member

sloriot commented Oct 10, 2024

@lrineau what is CGAL::Data in target_link_libraries() about ?

it is used to set the path to the data directory

@afabri
Copy link
Member Author

afabri commented Oct 10, 2024

Concering VTK it seems that we still have to link against ${VTK_LIBRARIES}

@lrineau
Copy link
Member

lrineau commented Oct 10, 2024

@lrineau what is CGAL::Data in target_link_libraries() about ?

That is the CMake support for the function CGAL::data_file_path. As for CGAL-6.0, it only adds a compile definition -DCGAL_DATA_DIR=</path/to/Data/data>.

@lrineau lrineau added the Not yet approved The feature or pull-request has not yet been approved. label Oct 10, 2024
@lrineau lrineau self-requested a review October 10, 2024 09:37
afabri and others added 2 commits October 10, 2024 13:35
[skip ci] (wait for the second batch of modifications)
lrineau

This comment was marked as outdated.

@lrineau
Copy link
Member

lrineau commented Oct 16, 2024

/build:doc

Copy link

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/8528/doc/Manual/index.html

I have reviewed all modifications. It should be the last batch.
@lrineau lrineau self-assigned this Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleaning Not yet approved The feature or pull-request has not yet been approved. Ready to be tested Under Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants