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 uninstall target #366

Merged
merged 1 commit into from
Feb 12, 2024
Merged

Conversation

cary-ilm
Copy link
Member

Satisfy the OpenSSF Best Practices Badge requirement for an insta/uninstall process:
https://www.bestpractices.dev/en/criteria/1#1.installation_common

CMake does not support a standard "uninstall" target, but the community recommends implementing an "uninstal" target that remove files named in the install_manifest.txt:
https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake

However, our existing process of installing the symlink to the "bare" library, i.e. the symlink from libImath-3_2.so to libImath.so, fails to add the symlink to the manifest, so "make uninstall" misses the symlink. The existing mechanism uses "install(CODE execute_process(cmake -E create_symlink))".

This changes that to use a simpler "file(CREATE_LINK)" and "install(FILES)" to accomplish the same thing while also registering the symlink the the manifest.

This change also adds the cmake option IMATH_INSTALL, on by default and for normal usage, but which allows disabling of the installation when Imath is configured as a subproject of another project. OpenEXR propgates the OPENEXR_INSTALL option to IMATH_INSTALL.

Satisfy the OpenSSF Best Practices Badge requirement for an
insta/uninstall process:
https://www.bestpractices.dev/en/criteria/1#1.installation_common

CMake does not support a standard "uninstall" target, but the
community recommends implementing an "uninstal" target that remove files named in the
`install_manifest.txt`:
https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake

However, our existing process of installing the symlink to the "bare"
library, i.e. the symlink from libImath-3_2.so to libImath.so, fails
to add the symlink to the manifest, so "make uninstall" misses the
symlink. The existing mechanism uses "install(CODE execute_process(cmake -E create_symlink))".

This changes that to use a simpler "file(CREATE_LINK)" and
"install(FILES)" to accomplish the same thing while also registering
the symlink the the manifest.

This change also adds the cmake option `IMATH_INSTALL`, on by default
and for normal usage, but which allows disabling of the installation
when Imath is configured as a subproject of another project. OpenEXR
propgates the `OPENEXR_INSTALL` option to `IMATH_INSTALL`.

Signed-off-by: Cary Phillips <[email protected]>
@meshula
Copy link
Contributor

meshula commented Feb 11, 2024

but which allows disabling of the installation when Imath is configured as a subproject of another project.

I haven't seen this pattern in other projects, I think I missed the motivation when it was introduced upstream at OpenEXR?

@cary-ilm
Copy link
Member Author

OPENEXR_INSTALL has been there all along, since 3.0: https://github.com/AcademySoftwareFoundation/openexr/blob/44d2d0eaf289f54d4f86f45f4b6b68fac2d15f0e/CMakeLists.txt#L35

It's needed by the python bindings because the cmake target that installs the wheels should not install the libraries, so this option makes it possible to suppress installing the libraries. Imath needs it, too, otherwise the OpenEXR target that installs the wheels would also install the Imath library.

@meshula
Copy link
Contributor

meshula commented Feb 12, 2024

Gotcha, lgtm!

@cary-ilm cary-ilm merged commit f372d29 into AcademySoftwareFoundation:main Feb 12, 2024
24 checks passed
cary-ilm added a commit to cary-ilm/Imath that referenced this pull request Feb 16, 2024
Satisfy the OpenSSF Best Practices Badge requirement for an
insta/uninstall process:
https://www.bestpractices.dev/en/criteria/1#1.installation_common

CMake does not support a standard "uninstall" target, but the
community recommends implementing an "uninstal" target that remove files named in the
`install_manifest.txt`:
https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake

However, our existing process of installing the symlink to the "bare"
library, i.e. the symlink from libImath-3_2.so to libImath.so, fails
to add the symlink to the manifest, so "make uninstall" misses the
symlink. The existing mechanism uses "install(CODE execute_process(cmake -E create_symlink))".

This changes that to use a simpler "file(CREATE_LINK)" and
"install(FILES)" to accomplish the same thing while also registering
the symlink the the manifest.

This change also adds the cmake option `IMATH_INSTALL`, on by default
and for normal usage, but which allows disabling of the installation
when Imath is configured as a subproject of another project. OpenEXR
propgates the `OPENEXR_INSTALL` option to `IMATH_INSTALL`.

Signed-off-by: Cary Phillips <[email protected]>
cary-ilm added a commit to cary-ilm/Imath that referenced this pull request Feb 22, 2024
This should have gone into PR AcademySoftwareFoundation#366, since `file(CREATE_LINK)` was
introduced in cmake 3.14, not sure how it slipped through the CI.

Signed-off-by: Cary Phillips <[email protected]>
cary-ilm added a commit that referenced this pull request Feb 29, 2024
This should have gone into PR #366, since `file(CREATE_LINK)` was
introduced in cmake 3.14, not sure how it slipped through the CI.

Signed-off-by: Cary Phillips <[email protected]>
cary-ilm added a commit to cary-ilm/Imath that referenced this pull request Mar 13, 2024
This part of AcademySoftwareFoundation#366, backported for the 3.1 branch.

Signed-off-by: Cary Phillips <[email protected]>
cary-ilm added a commit to cary-ilm/Imath that referenced this pull request Mar 13, 2024
This part of AcademySoftwareFoundation#366, backported for the 3.1 branch.

Signed-off-by: Cary Phillips <[email protected]>
cary-ilm added a commit that referenced this pull request Mar 14, 2024
This part of #366, backported for the 3.1 branch.

Signed-off-by: Cary Phillips <[email protected]>
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.

2 participants