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 paths for dependent package use #478

Merged
merged 5 commits into from
Aug 21, 2023
Merged

Conversation

mlxd
Copy link
Member

@mlxd mlxd commented Aug 21, 2023

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    tests directory!

  • All new functions and code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the .github/CHANGELOG.md file, summarizing the
    change, and including a link back to the PR.

  • Ensure that code is properly formatted by running make format.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Context: Currently the new package design assumes that all use will be internal to the nested projects. This however prevents packages depending on Lightning, for example through the CMake FetchContent utility, as source directories are assumed to be top-level of the outer package only. This PR updates all Lightning CMake references from CMAKE_SOURCE_DIR to pennylane_lightning_SOURCE_DIR, as discussed by https://cmake.org/cmake/help/v3.27/command/project.html#command:project

Description of the Change: As above.

Benefits: Allows the repo to be used as a sub-package with CMake.

Possible Drawbacks:

Related GitHub Issues:

@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

.github/CHANGELOG.md Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

Merging #478 (9fcc6e6) into master (32b0c8f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           master     #478    +/-   ##
========================================
  Coverage   97.21%   97.22%            
========================================
  Files         141      142     +1     
  Lines       16280    16420   +140     
========================================
+ Hits        15827    15964   +137     
- Misses        453      456     +3     
Files Changed Coverage Δ
pennylane_lightning/core/_version.py 100.00% <100.00%> (ø)

... and 13 files with indirect coverage changes

Copy link
Contributor

@vincentmr vincentmr left a comment

Choose a reason for hiding this comment

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

Unblocks LGPU updates. Thanks a lot @mlxd

Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

Looks good. Only left one suggestions.

@@ -21,6 +21,9 @@

### Bug fixes

* Update the CMake internal references to enable sub-project compilation with affecting the parent package.
Copy link
Contributor

Choose a reason for hiding this comment

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

I know why you did it, but I'm not getting what you meant by "with affecting the parent package.".
Could you maybe rephrase 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.

That was a hastily written message indeed. Let's push ahead for the GPU fixes, and I'll make it better for release

@mlxd mlxd merged commit d853d80 into master Aug 21, 2023
60 checks passed
@mlxd mlxd deleted the update/nested_cmake_paths branch August 21, 2023 20:14
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.

3 participants