Skip to content

Commit

Permalink
Also provide static & shared libs in actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Dec 3, 2024
1 parent 3d97f51 commit 501364c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 38 deletions.
52 changes: 44 additions & 8 deletions .github/workflows/cli.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build CLI
name: Build

on: push

Expand Down Expand Up @@ -57,8 +57,11 @@ jobs:
- name: Upload soup
uses: actions/upload-artifact@v4
with:
name: "Debian 10 and above"
path: CLI/soup
name: "Debian 10 and above (X64)"
path: |
CLI/soup
libsoup.a
libsoup.so
arm64:
runs-on: [ARM64]
Expand All @@ -81,7 +84,10 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: "Debian 12 (ARM64)"
path: CLI/soup
path: |
CLI/soup
libsoup.a
libsoup.so
macos-13:
runs-on: macos-13
Expand All @@ -103,8 +109,11 @@ jobs:
- name: Upload soup
uses: actions/upload-artifact@v4
with:
name: "MacOS (X86)"
path: CLI/soup
name: "MacOS (X64)"
path: |
CLI/soup
libsoup.a
libsoup.so
windows-latest:
runs-on: windows-latest
Expand All @@ -129,5 +138,32 @@ jobs:
- name: Upload soup
uses: actions/upload-artifact@v4
with:
name: "Windows"
path: CLI/soup.exe
name: "Windows (X64)"
path: |
CLI/soup.exe
soup.lib
soup.dll
emscripten:
runs-on: ubuntu-latest
steps:
- uses: mymindstorm/setup-emsdk@v13

- uses: actions/checkout@v4

- name: Build Soup
run: php wasm.php

- name: Ensure files exist
uses: andstor/file-existence-action@v3
with:
files: "bindings/libsoup.js, bindings/libsoup.wasm"
fail: true

- name: Upload
uses: actions/upload-artifact@v4
with:
name: "WASM"
path: |
bindings/libsoup.js
bindings/libsoup.wasm
28 changes: 0 additions & 28 deletions .github/workflows/lib-wasm.yml

This file was deleted.

12 changes: 10 additions & 2 deletions build_lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,28 @@
if(substr($file, -4) == ".cpp")
{
$file = substr($file, 0, -4);
run_command_async("$clang -c ".__DIR__."/soup/$file.cpp -o ".__DIR__."/bin/int/$file.o");
array_push($objects, escapeshellarg("bin/int/$file.o"));
run_command_async("$clang -c ".__DIR__."/soup/$file.cpp -o ".__DIR__."/bin/int/$file.o -fPIC -DSOUP_STANDALONE");
if ($file != "soup.cpp")
{
array_push($objects, escapeshellarg("bin/int/$file.o"));
}
}
}
await_commands();

echo "Bundling static lib...\n";
$archiver = "ar";
$libname = "libsoup.a";
$dllname = "libsoup.so";
if (defined("PHP_WINDOWS_VERSION_MAJOR"))
{
$archiver = "llvm-ar";
$libname = "soup.lib";
$dllname = "soup.dll";
}
passthru("$archiver rc $libname ".join(" ", $objects));

echo "Linking shared lib...\n";
passthru("$clang -o $dllname --shared bin/int/soup.o ".join(" ", $objects));

chdir($cd);

0 comments on commit 501364c

Please sign in to comment.