Skip to content

Commit c4b21f4

Browse files
authored
Merge pull request #65 from lightningdevkit/2022-07-fix-xcframework-zip
Fix xcframework zipping to include parent directory and update README.
2 parents 38290d9 + 3c3ce6e commit c4b21f4

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

.github/actions/upload-xcframework-artifact/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ runs:
66
- name: Zip Xcframework
77
shell: bash
88
run: |
9-
ditto -c -k --sequesterRsrc /Users/runner/work/ldk-swift/ldk-swift/bindings/bin/release/LightningDevKit.xcframework LightningDevKit.xcframework.zip
9+
ditto -c -k --sequesterRsrc --keepParent /Users/runner/work/ldk-swift/ldk-swift/bindings/bin/release/LightningDevKit.xcframework LightningDevKit.xcframework.zip
1010
- name: Upload Framework Artifact
1111
uses: actions/upload-artifact@v3
1212
with:

README.md

+32-12
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,46 @@ python3 ./
9898

9999
Now, the contents of the `bindings/LDK` folder will have been completely regenerated.
100100

101-
### Configuring Xcode for Framework Compilation
102-
Go to the `xcode` folder and open `LDKFramework.xcworkspace`.
101+
### Preparing the correct Xcode version
102+
To make sure the next two steps work correctly, you need to verify that you're using Xcode 13.2.1.
103+
If you have a later version, you can download the correct version from here: https://xcodereleases.com/
103104

104-
Then, navigate to the "LDKFramework" project and click on the LDKFramework project target:
105-
![](https://user-images.githubusercontent.com/5944973/175575527-97073a18-76fc-4ab0-928f-d40ac643e607.png)
105+
The direct download link is
106106

107-
Search for `LDK_C_BINDINGS_BASE`:
108-
![](https://user-images.githubusercontent.com/5944973/177420117-bcf7fc32-b07d-440f-84d1-fe2d373c355b.png)
107+
https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_13.2.1/Xcode_13.2.1.xip
109108

110-
Here, enter the absolute path, pointing to your `ldk-c-bindings`.
109+
You may be asked to log in to your Apple developer account.
111110

112-
You will now also have to do the same for `LDK_C_BINDINGS_BINARY_DIRECTORY`, and enter any directory you wish. We like to use just `bin/`.
111+
After downloading the correct Xcode version and copying it to Applications, you might also need to run
112+
the following command with root privileges:
113+
114+
```shell
115+
sudo xcode-select -s /Applications/Xcode\ 13.2.1.app/Contents/Developer/
116+
```
117+
118+
### Building requisite binaries
119+
Navigate (`cd`) to the `./src/scripts` folder, and run the following Python script:
120+
121+
```shell
122+
python3 ./build_bulk_libldks.py /path/to/ldk-c-bindings
123+
```
124+
125+
This command will take a while, but it will eventually produce a set of binaries for all the
126+
platform/architecture combinations we're trying to support. Those binaries should adhere to the
127+
`./bindings/bin/release/<platform>/` folder pattern.
128+
129+
Each of those folders will contain an `architectures` directory with subdirectories such as `arm64`
130+
or `x86_64`, as well as a `libldk.a` file, which is the `lipo` product of all the targeted
131+
architectures.
113132

114133
#### Generating the *.xcframework files
115134

116-
With all the bindings generated, you will just have to run two commands to generate the xcframework:
135+
With all the binaries generated, still in the `./src/scripts` directory, you just need to run one
136+
last Python script to produce the framework:
117137

118138
```shell
119-
cd xcode
120-
./build_framework.sh
139+
python3 ./generate_xcframework.py /path/to/ldk-c-bindings
121140
```
122141

123-
Once the script finishes running, you should see `LDKFramework.xcframework` in the `xcode/build` folder. Drag that into your project, and you're done!
142+
Once the script finishes running, you should see `LightningDevKit.xcframework` in the
143+
`./bindings/bin/release` folder. Drag that into your project, and you're done!

0 commit comments

Comments
 (0)