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 CMake installation rules #2184

Merged
merged 1 commit into from
Feb 19, 2025
Merged

Conversation

ahesham-arm
Copy link
Contributor

Add installation rules for all the binary targets.

Targets are installed under <CMAKE_INSTALL_PREFIX>/bin/<CONFIG> where <CONFIG> is CMAKE_BUILD_TYPE for single-config generators, e.g. Unix Makefiles and Ninja, or the build configuration for multi-config generators, e.g. Ninja Multi-Config and Visual Studio.

This creates the target install on Unix and INSTALL on Windows.

Copy link
Contributor

@bashbaug bashbaug left a comment

Choose a reason for hiding this comment

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

Can you please also check if we need to install the Vulkan SPIR-V files? See: #2055

At some point it would be nice to install the OpenCL SPIR-V files in a sensible place also (and ideally, to auto-build them if any of the source spvasm changes), but this is less critical because the path to the OpenCL SPIR-V files can be set using --spirv-binaries-path.

@ahesham-arm
Copy link
Contributor Author

Can you please also check if we need to install the Vulkan SPIR-V files? See: #2055

You're right, yes they do. I note that the CMakeLists.txt for the Vulkan shaders is wrong in two ways:

  1. Project configuration and building are two distinct steps. execute_process runs in configuration time and should not be used for generating files. Instead, add_custom_command and add_custom_target should be used to define build targets that get executed at build times.
  2. The source directory should never be modified by the configuration or build processes, thanks for fixing that in compile Vulkan SPIR-V shaders in CMAKE_CURRENT_BINARY_DIR #2055.

@ahesham-arm
Copy link
Contributor Author

Fixed the way the Vulkan shaders are generated in #2199 as a requirement for having correct installation rules for them.

@ahesham-arm
Copy link
Contributor Author

#2200 handles the automatic generation of the OpenCL SPIR-V files for spirv_new.

bashbaug
bashbaug previously approved these changes Jan 7, 2025
@bashbaug
Copy link
Contributor

bashbaug commented Jan 7, 2025

Is there any ordering requirement for this PR and #2199 or #2200?

@ahesham-arm
Copy link
Contributor Author

Is there any ordering requirement for this PR and #2199 or #2200?

We should merge #2199 and #2200 first (no specific order required), and then I can edit this PR to additionally install those files as well.

@bashbaug
Copy link
Contributor

Hi, both #2199 and #2200 are merged now, so I think this is ready for the final updates.

Add installation rules for all the binary targets.

Targets are installed under `<CMAKE_INSTALL_PREFIX>/bin/<CONFIG>`
where `<CONFIG>` is `CMAKE_BUILD_TYPE` for single-config generators,
e.g. Unix Makefiles and Ninja, or the build configuration for
multi-config generators, e.g. Ninja Multi-Config and Visual Studio.

This creates the target `install` on Unix and `INSTALL` on Windows.
@ahesham-arm
Copy link
Contributor Author

Hi, both #2199 and #2200 are merged now, so I think this is ready for the final updates.

Thanks for reminding me! Updated the pull request to include installation rules for both SPIR-V binaries and Vulkan shaders.

Copy link
Contributor

@bashbaug bashbaug left a comment

Choose a reason for hiding this comment

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

I tested this on Linux and everything seems to have been installed in the right place.

I specifically tested:

  • test_spirv_new, to ensure that the SPIR-V binaries are picked up properly
  • test_compiler, to ensure that the compiler include directories are picked up properly
  • test_vulkan, to ensure that the Vulkan SPIR-V shaders are picked up properly.

It'd be nice for somebody to verify Windows as well, since I'm not sure if I'll get to this before the call tomorrow.

Note that there is no requirement to use the install target, so the risk of merging these changes as-is are fairly low.

@bashbaug
Copy link
Contributor

Merging as per discussion in the February 18th teleconference.

@bashbaug bashbaug merged commit 485964d into KhronosGroup:main Feb 19, 2025
9 checks passed
@ahesham-arm ahesham-arm deleted the install branch February 19, 2025 08:47
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.

3 participants