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

Add support for pip install #1941

Merged
merged 3 commits into from
Oct 30, 2024

Conversation

matthewdcong
Copy link
Contributor

This PR adds preliminary support for pip install. Assuming that the dependencies required for building OpenVDB and NanoVDB are installed, then pip install <openvdb_source_root> will

  1. Build OpenVDB, NanoVDB, and their corresponding Python bindings.
  2. Install these Python bindings and dependent libraries in the site-packages directory
  3. Enable the user to import openvdb and import nanovdb when launching Python.

This is a first-step towards making installation of OpenVDB easier for new users, and will help users dive into the library via the Python interface.

pyproject.toml Outdated Show resolved Hide resolved
Copy link

linux-foundation-easycla bot commented Oct 23, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@matthewdcong
Copy link
Contributor Author

Why is the CLA check failing?

@danrbailey
Copy link
Contributor

Why is the CLA check failing?

Just pushed a commit and it's failing for me as well, let me message John...

@jmertic
Copy link
Contributor

jmertic commented Oct 23, 2024

/easycla

ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()
if(SKBUILD)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if there's a cleaner way to handle this kind of case without all of this conditional branching. What about using an INSTALL_PREFIX and including the forward slash in the prefix (although potentially needs thought for multi-platforms):

if (SKBUILD)
  set(INSTALL_PREFIX "openvdb/")
else
  set(INSTALL_PREFIX "")
endif()

install(TARGETS openvdb_static
  RUNTIME_DESTINATION ${INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR}
)

Ultimately, it would be nice to use less if (SKBUILD) logic if possible?

Copy link
Contributor Author

@matthewdcong matthewdcong Oct 27, 2024

Choose a reason for hiding this comment

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

Yeah, I'm not a huge fan of all the SKBUILD logic either. I'm happy to take another look.

In an ideal world, it'd be possible to separate them entirely, but in practice Python packaging has very limited support for two modules in a single package. Thus, we need to delegate a lot of the pip install location logic to CMake since Python just doesn't provide us with the expressiveness to do so hence the SKBUILD custom logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestions @danrbailey ! I've consolidated the conditional branching significantly. Please take another look and let me know what you think.

Signed-off-by: Matthew Cong <[email protected]>
Copy link
Contributor

@danrbailey danrbailey left a comment

Choose a reason for hiding this comment

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

This is much better, thanks Matt! Just one small comment which I think is probably a find-replace typo...

set(NANOVDB_INSTALL_MATH_DIR ${NANOVDB_INSTALL_INCLUDE_DIR}/math)
set(NANOVDB_INSTALL_TOOLS_DIR ${NANOVDB_INSTALL_INCLUDE_DIR}/tools)
set(NANOVDB_INSTALL_ROOT_DIR ${NANOVDB_INSTALL_INCLUDEDIR}/nanovdb)
set(NANOVDB_INSTALL_CUDA_DIR ${NANOVDB_INSTALL_ROOT_DIR}/cuda)
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 a few of these variables that are swapping INCLUDE paths for ROOT paths?

Copy link
Contributor Author

@matthewdcong matthewdcong Oct 29, 2024

Choose a reason for hiding this comment

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

Not a typo I think.

Prior to this change, NANOVDB_INSTALL_INCLUDE_DIR (note the underscore between include and dir) was already defined. I've renamed NANOVDB_INSTALL_INCLUDE_DIR to NANOVDB_INSTALL_ROOT_DIR in order to avoid confusion with the newly introduced/very similarly named NANOVDB_INSTALL_INCLUDEDIR (that defaults to CMAKE_INSTALL_INCLUDEDIR).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that makes sense, thanks for explaining.

Copy link
Contributor

@apradhana apradhana left a comment

Choose a reason for hiding this comment

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

Tested on Linux with the latest changes. LGTM.

@danrbailey danrbailey merged commit 58c8d3a into AcademySoftwareFoundation:master Oct 30, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants