diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index 59d6bee..439d098 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -30,6 +30,13 @@ jobs: version: '16' platform: 'x64' + - name: 'Setup Clang for FFI metadata' + uses: KyleMayes/install-llvm-action@v2 + with: + version: '22.1.0' + force-url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-22.1.0/LLVM-22.1.0-Linux-X64.tar.xz' + env: false + - name: 'Setup CMake' uses: jwlawson/actions-setup-cmake@v2 with: @@ -39,11 +46,13 @@ jobs: run: | cmake --preset linux-gcc-release \ -DCMAKE_C_COMPILER=gcc-16 \ - -DCMAKE_CXX_COMPILER=g++-16 + -DCMAKE_CXX_COMPILER=g++-16 \ + -DCPP_CORE_AST_CLANGXX="${LLVM_PATH}/bin/clang++" - name: 'Build' run: | - cmake --build --preset linux-gcc-release --target cpp_bindings_linux + cmake --build --preset linux-gcc-release \ + --target cpp_bindings_linux cpp_core_ast_slim_json - name: 'Set PACKAGE_VERSION from env.bat' id: version @@ -70,7 +79,9 @@ jobs: with: if-no-files-found: error name: libcpp_bindings_linux - path: build/libcpp_bindings_linux.so + path: | + build/libcpp_bindings_linux.so + build/ast/cpp_core_ffi_api.json - name: 'Create GitHub Release' if: github.ref_type == 'tag' && steps.check-tag.outputs.IS_VALID_PACKAGE_VERSION == 'true' diff --git a/.github/workflows/publish_jsr.yml b/.github/workflows/publish_jsr.yml index daef149..b47aaa6 100644 --- a/.github/workflows/publish_jsr.yml +++ b/.github/workflows/publish_jsr.yml @@ -49,7 +49,9 @@ jobs: - name: 'Prepare files for JSR' run: | mkdir -p ./jsr/bin + mkdir -p ./jsr/ffi cp ./artifacts/libcpp_bindings_linux.so ./jsr/bin/x86_64.so + cp ./artifacts/ast/cpp_core_ffi_api.json ./jsr/ffi/cpp_core_ffi_api.json ./jsr/scripts/binary_to_json.sh \ ./artifacts/libcpp_bindings_linux.so \ @@ -71,4 +73,3 @@ jobs: working-directory: jsr run: | deno publish --allow-dirty --dry-run - diff --git a/jsr/.gitignore b/jsr/.gitignore index 0e547b0..a6eb0e0 100644 --- a/jsr/.gitignore +++ b/jsr/.gitignore @@ -1,2 +1,3 @@ bin/ +ffi/ !src/bin/ diff --git a/jsr/README.md b/jsr/README.md index ecd8b74..c29e06d 100644 --- a/jsr/README.md +++ b/jsr/README.md @@ -5,6 +5,11 @@ Binaries are provided as a [package on JSR](https://jsr.io/@serial/cpp-bindings-linux). They are serialized as a base64 string inside the JSON file. +The package also includes the generated cpp-core FFI API metadata at +`ffi/cpp_core_ffi_api.json`. It describes the exported C symbols, parameter and +return types, callbacks, default values, and API documentation used by downstream +FFI adapter generators. + This package is primarily intended as a dependency for [`@serial/serial`](https://jsr.io/@serial/serial). However, it can also be used independently. diff --git a/jsr/jsr.json b/jsr/jsr.json index e26d409..6c558c6 100644 --- a/jsr/jsr.json +++ b/jsr/jsr.json @@ -12,12 +12,12 @@ "LICENSE", "jsr.json", "src/**", - "bin/**" + "bin/**", + "ffi/**" ], "exclude": [ - "!bin/" + "!bin/", + "!ffi/" ] } } - -