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

[CMake] Install library #13

Merged
merged 1 commit into from
Mar 26, 2022
Merged

[CMake] Install library #13

merged 1 commit into from
Mar 26, 2022

Conversation

ProGTX
Copy link
Contributor

@ProGTX ProGTX commented Mar 23, 2022

Install the library and the headers it depends on.
Works with a shared library build (BUILD_SHARED_LIBS=ON).

In theory it works with a static library build as well,
but the installation step would have to include the SPIR-V dependencies as static libraries,
which this patch doesn't address.

Provided some installation info.


Example install folder:

> tree package/
package/
├── include
│   ├── libspirv2clc_export.h
│   ├── spirv
│   │   ├── 1.0
│   │   ├── 1.1
│   │   ├── 1.2
│   │   └── unified1
│   │       └── spirv.h
│   ├── spirv-tools
│   │   └── libspirv.h
│   └── spirv2clc.h
└── lib
    └── liblibspirv2clc.so

I wasn't sure how to get rid of the empty folders, but I figured there's no harm in keeping them.

Also note that this doesn't do a "proper" CMake installation, which would require exporting the targets and creating a config file, but it's the first step to making spirv2clc much easier to set up in external projects.

Install the library and the headers it depends on.
Works with a shared library build (`BUILD_SHARED_LIBS=ON`).

In theory it works with a static library build as well,
but the installation step would have to include the SPIR-V dependencies as static libraries,
which this patch doesn't address.

Provided some installation info.
Copy link
Owner

@kpet kpet left a comment

Choose a reason for hiding this comment

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

Great, thanks! The CI didn't trigger (Github has been a bit flaky these past few days) but a local build suggests everything should be fine. I'll modify the CI to also exercise installation.

Note that a static library build at the moment requires the user
to manually provide the SPIR-V dependencies as static libraries
in the target project (where you want to embed spirv2clc).
* `CMAKE_POSITION_INDEPENDENT_CODE` - Whether to enable `fPIC` or similar flags
Copy link
Owner

Choose a reason for hiding this comment

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

I'm going to always enable PIC on the library. This will be required by the layer being introduced by #14. I'll tweak this after merging.

@kpet kpet merged commit 085868b into kpet:main Mar 26, 2022
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