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

Adding option for downloading Boost using CMake FetchContent #6424

Merged
merged 11 commits into from
Apr 3, 2024

Conversation

vrnimje
Copy link
Contributor

@vrnimje vrnimje commented Jan 23, 2024

Fixes #6392

Proposed Changes

  • Adding HPX_WITH_FETCH_BOOST bool option for fetching Boost v1.84.0 using CMake FetchContent
  • Adding CI tests for the above on macOS, Linux and Windows (VS2022, Debug)

Checklist

  • I have added a new feature and have added tests to go along with it.
  • I have fixed a bug and have added a regression test.

@vrnimje vrnimje requested a review from hkaiser as a code owner January 23, 2024 16:38
@jenkins-cscs
Copy link
Collaborator

Can one of the admins verify this patch?

CMakeLists.txt Outdated
hpx_option(
HPX_WITH_FETCH_BOOST
BOOL
"Use FetchContent to fetch Asio. By default an installed Asio will be used. (default: OFF)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change description

Comment on lines 57 to 58
set(Boost_DIR "${CMAKE_BINARY_DIR}/_deps/boost-src")
set(Boost_INCLUDE_DIR "${CMAKE_BINARY_DIR}/_deps/boost-src")
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure this should not be internal?

Copy link
Contributor Author

@vrnimje vrnimje Jan 23, 2024

Choose a reason for hiding this comment

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

I guess it makes sense to keep it Internal, as it is set when the option is used, so should not be visible
Will make the changes

Comment on lines 59 to 60
endif()
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

There are two endifs, does it not cause errors?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, seems like you have fixed it

Copy link

codacy-production bot commented Jan 23, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
0.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (8365e76) 201880 171929 85.16%
Head commit (437f365) 190686 (-11194) 162390 (-9539) 85.16% (0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#6424) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

@SAtacker
Copy link
Contributor

@hkaiser PTAL, thanks!

execute_process(
COMMAND
cmd /C
"cd ${CMAKE_BINARY_DIR}\\_deps\\boost-src && .\\bootstrap.bat && .\\b2 headers cxxflags=/std:c++20"
Copy link
Member

Choose a reason for hiding this comment

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

Should we compile with the C++ version that corresponds to what the user requested for HPX (HPX_CXX_STANDARD)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we could do that. Will make the changes

execute_process(
COMMAND
sh -c
"cd ${CMAKE_BINARY_DIR}/_deps/boost-src && ./bootstrap.sh --prefix=${CMAKE_BINARY_DIR}/_deps/boost-installed && ./b2 && ./b2 install --prefix=${CMAKE_BINARY_DIR}/_deps/boost-installed cxxflags=--std=c++20"
Copy link
Member

Choose a reason for hiding this comment

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

Same here (and in more places below). Should we use HPX_CXX_STANDARD?

"cd ${CMAKE_BINARY_DIR}/_deps/boost-src && ./bootstrap.sh && ./b2 headers cxxflags=--std=c++20"
)
endif()
set(EX_PRC_INTERNAL
Copy link
Member

Choose a reason for hiding this comment

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

What is this used for?

Copy link
Contributor Author

@vrnimje vrnimje Jan 25, 2024

Choose a reason for hiding this comment

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

It makes sure that the commands defined to build Boost are not executed again, if the project is reconfigured
But I noticed that I have mistakenly defined it as INTERNAL instead of STRING above. Will make the changes

Copy link
Member

@hkaiser hkaiser Jan 26, 2024

Choose a reason for hiding this comment

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

If this is something that is used outside of a CMake configuration step (e.g. needed for configuring dependent applications), please prefix the variable name with HPX_WITH_ for consistency and to avoid name clashes.

Copy link
Contributor Author

@vrnimje vrnimje Jan 26, 2024

Choose a reason for hiding this comment

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

Yes, it is used for configuring the building of fetched Boost, so will update with the variable naming you have mentioned.

"${CMAKE_BINARY_DIR}/_deps/boost-src"
CACHE INTERNAL ""
)
endif()
Copy link
Member

Choose a reason for hiding this comment

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

Should all of the above go into a separate file FindBoost.cmake or similar (just for consistency reasons)? OTOH, this may conflict with the file with the same name in the CMake distribution...

execute_process(
COMMAND
sh -c
"cd ${CMAKE_BINARY_DIR}/_deps/boost-src && ./bootstrap.sh && ./b2 headers cxxflags=--std=c++${HPX_WITH_CXX_STANDARD}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"cd ${CMAKE_BINARY_DIR}/_deps/boost-src && ./bootstrap.sh && ./b2 headers cxxflags=--std=c++${HPX_WITH_CXX_STANDARD}"
"cd ${CMAKE_BINARY_DIR}/_deps/boost-src && ./bootstrap.sh && ./b2 headers cxxflags=--std=c++${HPX_CXX_STANDARD}"

DOWNLOAD_EXTRACT_TIMESTAMP true
)
fetchcontent_populate(Boost)
set(HPX_WITH_EX_PRC
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind making this variable a bit more self-explanatory?

@SAtacker
Copy link
Contributor

What is stopping us here @vrnimje @hkaiser ?

@vrnimje
Copy link
Contributor Author

vrnimje commented Mar 26, 2024

What is stopping us here @vrnimje @hkaiser ?

I have made all the requested changes from my side, as far as I know.
Just pending more reviews / confirmation

@hkaiser hkaiser merged commit fe66c1b into STEllAR-GROUP:master Apr 3, 2024
44 of 50 checks passed
@hkaiser hkaiser added this to the 1.10.0 milestone May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Install dependencies using CMake
4 participants