Skip to content

[CMake] Install library#13

Merged
kpet merged 1 commit intokpet:mainfrom
ProGTX:peter/install
Mar 26, 2022
Merged

[CMake] Install library#13
kpet merged 1 commit intokpet:mainfrom
ProGTX:peter/install

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