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 COMPONENT to all install() commands #756

Closed

Conversation

kleisauke
Copy link
Contributor

@kleisauke kleisauke commented Apr 12, 2024

Allows users to choose specific components for installation. The names of the components are based on the directory in which they will be installed.

Helps: libvips/libvips#3931.
Context: #338 (comment).

@dcommander
Copy link
Member

I am out of the office right now but will evaluate this when I get back.

@dcommander
Copy link
Member

For some reason, installing the runtime component doesn't install the shared libraries. I've tried that on two different systems running two completely different operating systems and CMake versions. Any idea what's going on?

@kleisauke
Copy link
Contributor Author

kleisauke commented May 3, 2024

Ah, you're right. It looks like COMPONENT needs to be applied to each <artifact-kind> <artifact-option>... group, fixed with commit e24359e.

I now see:

$ cmake -GNinja -DCMAKE_INSTALL_PREFIX=/tmp .
$ cmake --build .
$ cmake --install . --component runtime
-- Install configuration: "Release"
-- Installing: /tmp/lib64/libjpeg.so.62.4.0
-- Installing: /tmp/lib64/libjpeg.so.62
-- Set non-toolchain portion of runtime path of "/tmp/lib64/libjpeg.so.62.4.0" to "/tmp/lib64"
-- Installing: /tmp/lib64/libjpeg.so
-- Installing: /tmp/bin/cjpeg
-- Set non-toolchain portion of runtime path of "/tmp/bin/cjpeg" to "/tmp/lib64"
-- Installing: /tmp/bin/djpeg
-- Set non-toolchain portion of runtime path of "/tmp/bin/djpeg" to "/tmp/lib64"
-- Installing: /tmp/bin/jpegtran
-- Set non-toolchain portion of runtime path of "/tmp/bin/jpegtran" to "/tmp/lib64"
-- Installing: /tmp/lib64/libturbojpeg.so.0.3.0
-- Installing: /tmp/lib64/libturbojpeg.so.0
-- Set non-toolchain portion of runtime path of "/tmp/lib64/libturbojpeg.so.0.3.0" to "/tmp/lib64"
-- Installing: /tmp/lib64/libturbojpeg.so
-- Installing: /tmp/bin/tjbench
-- Set non-toolchain portion of runtime path of "/tmp/bin/tjbench" to "/tmp/lib64"
-- Installing: /tmp/bin/rdjpgcom
-- Set non-toolchain portion of runtime path of "/tmp/bin/rdjpgcom" to "/tmp/lib64"
-- Installing: /tmp/bin/wrjpgcom
-- Set non-toolchain portion of runtime path of "/tmp/bin/wrjpgcom" to "/tmp/lib64"

Thinking about this further, perhaps the runtime-tag is too broad? I could split it to runtime-lib and runtime-exe, which would let someone install the shared libraries without the executables, or vice versa.

@dcommander
Copy link
Member

Would it make sense to split it based on directories, that is to have lib, bin, and include components? (The doc and man components are fine as-is.) That would seemingly be a more natural fit for our build/packaging system, since you can already set CMake variables to disable/enable shared and static libs. Presumably, if someone doesn't want to install shared or static libraries, then chances are good that they don't want to build them either.

Allows users to choose specific components for installation. The
names of the components are based on the directory in which they
will be installed.

Helps: libvips/libvips#3931.
@kleisauke
Copy link
Contributor Author

Good idea! I've updated the PR to incorporate this.

@dcommander dcommander closed this in 24e09ba May 4, 2024
@dcommander
Copy link
Member

Further thoughts:

It doesn't make much sense to install the executables without the shared libraries, because if libjpeg-turbo is built with ENABLE_SHARED=1 (the default), then the executables will depend on the shared libraries. It also probably doesn't make much sense to install the development libraries without the headers. However, CMake doesn't do the "right thing" with respect to development stubs for Un*x shared libraries. It treats both the shared library and its development stub as LIBRARY artifacts, so the ideal solution of placing the shared library into the runtime category and the development stub into the devel category isn't possible because of CMake's limitations. The solution I like the most (or, rater, dislike the least) is the current solution of having a different component for every install directory. I have integrated your latest patch with only a couple of minor formatting tweaks, as well as a modification to add a component for the Java JAR if using CMake 3.4 or later.

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.

None yet

2 participants