https://github.com/keith/staticindexstore
A static archive of libIndexStore.dylib
https://github.com/keith/staticindexstore
Last synced: 9 months ago
JSON representation
A static archive of libIndexStore.dylib
- Host: GitHub
- URL: https://github.com/keith/staticindexstore
- Owner: keith
- License: mit
- Created: 2022-01-27T18:09:43.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-14T05:13:56.000Z (over 1 year ago)
- Last Synced: 2025-01-16T22:43:16.645Z (over 1 year ago)
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# StaticIndexStore
This is distribution of `libIndexStore.dylib` from
[`apple/llvm-project`](https://github.com/apple/llvm-project) as a
static archive. This way you do not have to add a non-portable rpath in
your binaries to Xcode internals or distribute the library alongside
your tool.
# Usage
See [the releases
page](https://github.com/keith/StaticIndexStore/releases) to get the
right version based on your version of Xcode / Swift.
With Swift Package Manager you can use the `.binaryTarget` type with
this:
```swift
targets: [
// Some targets
.binaryTarget(
name: "libIndexStore",
url: "See releases page",
checksum: "See releases page"
),
],
```
Then add `libIndexStore` to the `dependencies` of another target.
If you want to use this without Swift Package Manager you can download
the xcframework and use the internal `libIndexStore.framework` however
you'd normally include dependencies.
## Building
To create a new release for this project follow these steps:
- Clone [`apple/llvm-project`](https://github.com/apple/llvm-project)
and checkout the branch you want to build from
- Cherry pick the most recent commit from the releases page, or use the
`example.patch` checked into this repo as a starting point
- Create a `build` directory in the root of the repo
- Run cmake with something like `cmake ../llvm -G Ninja
-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra'
-DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
-DLLVM_ENABLE_LTO=Thin -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64'`
- Run `ninja libIndexStore.dylib`
- Run `create-xcframework.sh binary` to create the combined framework
## Notes
- This method doesn't actually produce a static binary, but it produces
a relocatable object file which is similar enough for this use case.
This is because cmake cannot create distributable static library
targets that include all of their nested dependencies
- Be sure to pass `-dead_strip` to your linker when linking this library
with a binary to save on binary size (you likely already are)
- Depending on how you're building your tools, you might be better off
using cmake and depending on this target manually in your build. See
[index-import](https://github.com/MobileNativeFoundation/index-import)
for an example