From a3c264b9c1ce6f9ff3b0e973611bdc06549a6b3a Mon Sep 17 00:00:00 2001 From: rhuze-emryk Date: Tue, 4 Feb 2025 02:22:00 -0500 Subject: [PATCH 1/2] Update workflow to run on rhuze-dev verify where ergo_lib.h is generated rhuze-removed note to kick off new build ergo-lib.h check correction in the build.yml Update workflow to trigger ios_tests & added GitHub CLI installation step Fix: Use correct package name for GitHub CLI (gh) Fix: Use correct workflow filename (ci.yml) Fix: Trigger workflow using GitHub API-ugh Trigger ios_tests workflow using GitHub API with correct ID Fix: Pass GITHUB_TOKEN directly using command substitution Fix: Use correct workflow ID (141976691) Fix: Use Bearer token scheme for GITHUB_TOKEN Trigger ci.yml with workflow_dispatch on rhuze-dev & Add workflow_dispatch trigger to ci.yml Fix: Added correct damned workspace ID Moved workflow_dispatch in ci.yml to test Fix: Use environment variable for GITHUB_TOKEN Fix: Target forked repo for workflow dispatch Fix: Use correct cursed workflow ID for forked repo (141976691) Added a comment to force a refresh Attempt gh command Simplify ci.yml to test workflow_dispatch Attempt gh command Set default repo for gh CLI and use workflow name Set GH_TOKEN for GitHub CLI Try triggering workflow using filename with gh CLI Use full relative path to workflow file with gh CLI Restore ci.yml to match upstream develop branch Integrate ios_tests steps into build.yml Link against SystemConfiguration.framework Use -Xswiftc to link against SystemConfiguration.framework Specify library path and architecture Build standard library for aarch64-apple-ios Add rust-src component to nightly toolchain Fix: Build for aarch64-apple-darwin Fix: Build for aarch64-apple-ios Simplify build.yml and verify library path Use stable Rust and verify build command Fix: Correct target architecture and library path and contemplate buying cigarettes Remove -Z build-std flag Switch to nightly and set RUST_BACKTRACE Check Rust Version Add flag to build standard library Try building with only stable Add ~/.cargo/bin to PATH Use Environment Files to add ~/.cargo/bin to PATH Removed the target from the cargo build command Add llvm-tools-preview to the Install Rust Toolchain step docs: enhance Linux development documentation - Add detailed toolbox setup instructions - Include toolbox creation and entry steps - Add repository cloning instructions - Update troubleshooting with toolbox-specific information feat: regenerate C bindings with updated toolchain - Regenerate C bindings using cbindgen 0.28.0 - Use nightly-2024-01-26 toolchain - Successfully verify binding generation - Verify library builds correctly Build verification: - Generated header: h/ergo_lib.h size: 87503 bytes - Static library builds successfully - All required functions and types present in header docs: comprehensive update to iOS bindings documentation - Update iOS README with Xcode 15 build instructions - Add detailed Linux development guide - Document verified Linux build process - Update toolchain requirements (nightly-2024-01-26) - Add cross-references between documents - Include troubleshooting section - Note platform-specific limitations Verified: - Linux build process - C bindings generation - Header file generation Needs verification: - iOS-specific build steps - Xcode 15 configuration - macOS-specific paths chore: remove leftover build.yml workflow docs: update iOS bindings and add Linux development documentation - Update iOS build instructions for Xcode 15 compatibility - Add comprehensive Linux development guide (bindings/ergo-lib-ios/LINUX_DEVELOPMENT.md) - Standardize toolchain requirements to nightly-2024-01-26 - Improve cross-platform build instructions clarity - Verify C bindings generation on Linux (Fedora 40) Closes #759 --- .github/workflows/build.yml.backup | 45 ++++++ LINUX_DEVELOPMENT.md | 89 ++++++++++++ bindings/ergo-lib-c/cbingen_toml.txt | 152 +++++++++++++++++++++ bindings/ergo-lib-ios/LINUX_DEVELOPMENT.md | 75 ++++++++++ bindings/ergo-lib-ios/README.md | 84 +++++++----- 5 files changed, 409 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/build.yml.backup create mode 100644 LINUX_DEVELOPMENT.md create mode 100644 bindings/ergo-lib-c/cbingen_toml.txt create mode 100644 bindings/ergo-lib-ios/LINUX_DEVELOPMENT.md diff --git a/.github/workflows/build.yml.backup b/.github/workflows/build.yml.backup new file mode 100644 index 000000000..0d737fa4a --- /dev/null +++ b/.github/workflows/build.yml.backup @@ -0,0 +1,45 @@ +name: Build and Test + +on: + push: + branches: [ rhuze-dev ] + pull_request: + branches: [ develop ] + +jobs: + build: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-01-26 + override: true + components: rust-src, llvm-tools-preview #Added llvm-tools-preview + target: aarch64-apple-ios + + - name: Generate C-bindings header file + run: | + cd bindings/ergo-lib-c + RUST_BACKTRACE=1 cbindgen --config cbindgen.toml --crate ergo-lib-c --output h/ergo_lib.h # Added RUST_BACKTRACE + env: + RUST_BACKTRACE: 1 + + - name: Build Rust Library (ergo-lib-c) + run: cargo build --all-features -p ergo-lib-c --target aarch64-apple-ios + + - name: Verify Library Path + run: ls -al ../../target/aarch64-apple-ios/release + + - name: Build Swift Project + run: | + cd bindings/ergo-lib-ios + swift build -Xswiftc "-framework" -Xswiftc "SystemConfiguration" -Xlinker "-L../../target/aarch64-apple-ios/release" -Xlinker "-lergo" + + - name: Run Swift Tests + run: | + cd bindings/ergo-lib-ios + swift test -Xswiftc "-framework" -Xswiftc "SystemConfiguration" -Xlinker "-L../../target/aarch64-apple-ios/release" -Xlinker "-lergo" --skip RestNodeApiTests diff --git a/LINUX_DEVELOPMENT.md b/LINUX_DEVELOPMENT.md new file mode 100644 index 000000000..825cf5b9e --- /dev/null +++ b/LINUX_DEVELOPMENT.md @@ -0,0 +1,89 @@ +# Linux Development Setup + +This guide covers setting up the development environment for sigma-rust on Linux systems. + +## Prerequisites + +- Fedora/RHEL-based system (tested on Fedora 40) +- Toolbox installed on your system +- Git + +## Toolbox Setup + +1. Create and enter a new development toolbox: + ```bash + # Create a new toolbox (if not already created) + toolbox create --distro fedora --release 40 fedora-40 + + # Enter the toolbox + toolbox enter fedora-40 + + # Verify you're inside the toolbox + cat /etc/os-release + ``` + +2. Clone the repository (if not already done): + ```bash + # Navigate to your preferred directory + cd ~/GitIt # or your preferred directory + + # Clone the repository + git clone https://github.com/ergoplatform/sigma-rust.git + cd sigma-rust + ``` + +## Development Environment Setup + +1. Install system dependencies: + ```bash + sudo dnf install gcc make cmake git pkg-config + ``` + +2. Install Rust and required components: + ```bash + # Install Rust + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + source "$HOME/.cargo/env" + + # Add required targets + rustup target add aarch64-apple-ios + rustup target add x86_64-apple-ios + + # Install nightly toolchain + rustup toolchain install nightly-2024-01-26 + + # Install cbindgen + cargo install cbindgen + ``` + +3. Build Components: + ```bash + # Build ergo-lib-c + cd bindings/ergo-lib-c + cargo build --release --all-features + + # Generate C headers + rustup override set nightly + cbindgen --config cbindgen.toml --crate ergo-lib-c --output h/ergo_lib.h + rustup override set stable + ``` + +## Limitations + +- iOS/Swift components cannot be directly tested on Linux +- Full iOS integration testing is performed via GitHub Actions + +## Development Workflow + +1. Make changes to Rust components +2. Build and test locally using the commands above +3. Commit changes with clear commit messages +4. Push to GitHub where Actions will perform full iOS integration testing + +## Troubleshooting + +If you encounter any issues: +1. Ensure all prerequisites are installed +2. Verify you're using the correct Rust toolchain +3. Check the GitHub Actions logs for detailed error messages +4. Verify you're working inside the toolbox environment diff --git a/bindings/ergo-lib-c/cbingen_toml.txt b/bindings/ergo-lib-c/cbingen_toml.txt new file mode 100644 index 000000000..16aa6e873 --- /dev/null +++ b/bindings/ergo-lib-c/cbingen_toml.txt @@ -0,0 +1,152 @@ +# This is a template cbindgen.toml file with all of the default values. +# Some values are commented out because their absence is the real default. +# +# See https://github.com/eqrion/cbindgen/blob/master/docs.md#cbindgentoml +# for detailed documentation of every option here. + + +language = "C" + + +############## Options for Wrapping the Contents of the Header ################# + +# header = "/* Text to put at the beginning of the generated file. Probably a license. */" +# trailer = "/* Text to put at the end of the generated file */" +# include_guard = "my_bindings_h" +# pragma_once = true +autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" +include_version = false +# namespace = "my_namespace" +namespaces = [] +using_namespaces = [] +sys_includes = [] +includes = [] +no_includes = false +after_includes = "" + + + + +############################ Code Style Options ################################ + +braces = "SameLine" +line_length = 100 +tab_width = 2 +documentation_style = "auto" + + + + + +############################# Codegen Options ################################## + +style = "both" + + + +[defines] +# "target_os = freebsd" = "DEFINE_FREEBSD" +# "feature = serde" = "DEFINE_SERDE" +"feature = rest" = "ERGO_REST" + + + +[export] +include = [] +exclude = [] +# prefix = "CAPI_" +item_types = [] +renaming_overrides_prefixing = false + + + +[export.rename] + + + +[export.body] + + + + +[fn] +rename_args = "None" +# must_use = "MUST_USE_FUNC" +# prefix = "START_FUNC" +# postfix = "END_FUNC" +args = "auto" +sort_by = "Name" + + + + +[struct] +rename_fields = "None" +# must_use = "MUST_USE_STRUCT" +derive_constructor = false +derive_eq = false +derive_neq = false +derive_lt = false +derive_lte = false +derive_gt = false +derive_gte = false + + + + +[enum] +rename_variants = "None" +# must_use = "MUST_USE_ENUM" +add_sentinel = false +prefix_with_name = false +derive_helper_methods = false +derive_const_casts = false +derive_mut_casts = false +# cast_assert_name = "ASSERT" +derive_tagged_enum_destructor = false +derive_tagged_enum_copy_constructor = false +enum_class = true +private_default_tagged_enum_constructor = false + + + + +[const] +allow_static_const = true +allow_constexpr = false + + + + +[macro_expansion] +bitflags = false + + + + + + +############## Options for How Your Rust library Should Be Parsed ############## + +[parse] +parse_deps = true +include = ["ergo-lib-c-core"] +# exclude = [] +clean = false +extra_bindings = [] + + + +[parse.expand] +crates = ["ergo-lib-c"] +all_features = false +default_features = true +features = ["rest", "mnemonic_gen"] + + +[ptr] +# An optional string to decorate all pointers that are +# required to be non null. Nullability is inferred from the Rust type: `&T`, +# `&mut T` and `NonNull` all require a valid pointer value. +non_null_attribute = "_Nonnull" + diff --git a/bindings/ergo-lib-ios/LINUX_DEVELOPMENT.md b/bindings/ergo-lib-ios/LINUX_DEVELOPMENT.md new file mode 100644 index 000000000..6ed470ed2 --- /dev/null +++ b/bindings/ergo-lib-ios/LINUX_DEVELOPMENT.md @@ -0,0 +1,75 @@ +# Linux Development Guide for Ergo iOS Bindings + +## Prerequisites + +- Fedora/RHEL-based system (tested on Fedora 40) +- Toolbox or similar container environment (recommended) +- Rust toolchain +- cbindgen 0.28.0 or later + +## Development Environment Setup + +1. Create and enter development toolbox: + ```bash + toolbox create --distro fedora --release 40 fedora-40 + toolbox enter fedora-40 + ``` + +2. Install system dependencies: + ```bash + sudo dnf install gcc make cmake git pkg-config + ``` + +3. Install Rust components: + ```bash + # Install Rust + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + source "$HOME/.cargo/env" + + # Install required toolchain and targets + rustup toolchain install nightly-2024-01-26 + rustup target add aarch64-apple-ios + rustup target add x86_64-apple-ios + + # Install cbindgen + cargo install cbindgen + ``` + +## Building Components + +1. Build ergo-lib-c: + ```bash + # From sigma-rust root directory + cargo build --release --features rest --features mnemonic_gen -p ergo-lib-c + ``` + +2. Generate C headers: + ```bash + cd bindings/ergo-lib-c + rustup override set nightly-2024-01-26 + cbindgen --config cbindgen.toml --crate ergo-lib-c --output h/ergo_lib.h + rustup override set stable + ``` + +3. Verify build artifacts: + ```bash + # Check the generated header file + ls -l h/ergo_lib.h + + # Check the library + ls -l ../../target/release/libergo.* + ``` + +## Limitations + +- iOS/Swift components cannot be directly tested on Linux +- Full iOS integration testing must be performed on macOS +- This environment is primarily for development and testing of the C bindings + +## Troubleshooting + +If you encounter any issues: +1. Ensure all prerequisites are installed +2. Verify you're using the correct Rust toolchain (nightly-2024-01-26) +3. Check that all required targets are installed +4. Verify the paths to build artifacts are correct diff --git a/bindings/ergo-lib-ios/README.md b/bindings/ergo-lib-ios/README.md index fde525c45..7289e7f39 100644 --- a/bindings/ergo-lib-ios/README.md +++ b/bindings/ergo-lib-ios/README.md @@ -1,84 +1,96 @@ +```markdown # Swift wrapper for [C bindings](../ergo-lib-c) of ergo-lib. +## Development Environments + +- **iOS/macOS**: Follow the instructions below (requires verification on macOS) +- **Linux**: See [Linux Development Guide](LINUX_DEVELOPMENT.md) for Linux-specific setup + +## Prerequisites + +- Xcode 15 or later (macOS only) +- Rust toolchain with specific targets +- cbindgen 0.28.0 or later ## Build instructions -First build `ergo-lib-c`: +1. Build `ergo-lib-c`: ```shell cargo build --release --features rest --features mnemonic_gen -p ergo-lib-c ``` -adding: -- `--target x86_64-apple-ios` for iPhone simulator on Intel macs, -- `--target aarch64-apple-ios` for iPhone on Apple silicon macs, -- `--target aarch64-apple-ios-sim` for iPhone simulator on Apple silicon macs. -To install a target run `rustup target add ` using triple for target from the list above. +2. Add required targets: +```shell +# For iPhone simulator on Intel macs +rustup target add x86_64-apple-ios + +# For iPhone on Apple silicon macs +rustup target add aarch64-apple-ios -This creates a static library under `/target/release`. Next we use `cbindgen` -to generate C-headers. -**Important:** we need a nightly version of `rustc` for this step, as we use macros to generate -*portions of the C-bindings. `cbindgen` can't 'see' through the macros so the nightly compiler is -used to expand the macros before `cbindgen` passes over the code. +# For iPhone simulator on Apple silicon macs +rustup target add aarch64-apple-ios-sim +``` +3. Generate C headers: ```shell cd bindings/ergo-lib-c -rustup override set nightly +rustup override set nightly-2024-01-26 cbindgen --config cbindgen.toml --crate ergo-lib-c --output h/ergo_lib.h rustup override set stable ``` - -To build this project we need to point `swift` to this directory for linking. +4. Build Swift project: ```shell cd ../ergo-lib-ios swift build -Xlinker -L../../target/release/ ``` -To run tests we must also pass in the library directory: +5. Run tests: ```shell swift test -Xlinker -L../../target/release/ --skip RestNodeApiTests --skip RestNodeApiIntegrationTests ``` -The `RestNodeApiTests` assume you have an ergo node running on localhost. - +Note: `RestNodeApiTests` require an ergo node running on localhost. -### Building Xcode 13 project for `iPhoneSimulator` +### Building Xcode 15 project for iPhone Simulator -Make sure `ergo-lib-c` is built as described above. - -Starting at the root of the `sigma-rust` repository, type: +1. Ensure `ergo-lib-c` is built (steps 1-3 above) +2. Generate Xcode project: ```shell cd bindings/ergo-lib-ios swift package generate-xcodeproj xcodebuild -project ./ErgoLib.xcodeproj -xcconfig ./Config/iPhoneSimulator_{arm|intel}.xcconfig -sdk iphonesimulator ``` +Choose `arm` or `intel` based on your Mac's architecture. -choosing either `arm` or `intel` in the last line depending on your mac's architecture. - -Then double click `ErgoLib.xcodeproj` which opens Xcode. You need to manually point the linker towards the directory where the `ergo-lib` static library resides. Refer to the following image: - -![image](xcode_linker_settings.png) - -Set `Other Linker Flags` to be `-L/absolute/path/to/sigma-rust/target/release` for x86_64 and ` -L/absolute/path/to/sigma-rust/target/aarch64-apple-ios-sim/release` for simulator on Apple silicon macs. The project can now be built. +3. Configure Xcode project: +- Open `ErgoLib.xcodeproj` +- Set linker flags: + - For Intel Macs: `-L/absolute/path/to/sigma-rust/target/release` + - For Apple Silicon Macs: `-L/absolute/path/to/sigma-rust/target/aarch64-apple-ios-sim/release` -### Building Xcode 13 project for `iPhone(iOS)` - -First we need to build an ARM64 target for `ergo-lib-c`: +### Building Xcode 15 project for iPhone (iOS) +1. Build ARM64 target: ```shell rustup target add aarch64-apple-ios cargo build --release --target=aarch64-apple-ios -p ergo-lib-c ``` -Next starting at the root of the `sigma-rust` repository, type: - +2. Generate Xcode project: ```shell cd bindings/ergo-lib-ios swift package generate-xcodeproj xcodebuild -project ./ErgoLib.xcodeproj -xcconfig ./Config/iPhoneOS.xcconfig -sdk iphoneos ``` -Next navigate in Xcode to `Build Settings` as indicated by 1 and 2 in the picture below. Set the fields `Base SDK`, `Excluded Architecture` and `Supported Platforms` **exactly** as pictured by 3 and 4. -![image](xcode_ios_settings.png) +3. Configure Xcode settings: +- Open Build Settings +- Set: + - Base SDK: iOS + - Excluded Architecture: arm64 (for simulator builds) + - Supported Platforms: iOS +- Set Other Linker Flags: `-L/absolute/path/to/sigma-rust/aarch64-apple-ios/release` -Then set `Other Linker Flags` to be `-L/absolute/path/to/sigma-rust/aarch64-apple-ios/release`. Finally we can build the project. \ No newline at end of file +Note: iOS build instructions require verification on macOS with Xcode 15. +``` From 72958a0bf7ad4a24812aaf3d0f6ad61fb9065320 Mon Sep 17 00:00:00 2001 From: rhuze-emryk Date: Mon, 17 Feb 2025 20:43:40 -0500 Subject: [PATCH 2/2] Move LINUX_DEVELOPMENT.md to bindings/ergo-lib-c, remove build.yml.backup and cbingen_toml.txt --- .github/workflows/build.yml.backup | 45 ------- bindings/ergo-lib-c/LINUX_DEVELOPMENT.md | 89 +++++++++++++ bindings/ergo-lib-c/cbingen_toml.txt | 152 ----------------------- 3 files changed, 89 insertions(+), 197 deletions(-) delete mode 100644 .github/workflows/build.yml.backup create mode 100644 bindings/ergo-lib-c/LINUX_DEVELOPMENT.md delete mode 100644 bindings/ergo-lib-c/cbingen_toml.txt diff --git a/.github/workflows/build.yml.backup b/.github/workflows/build.yml.backup deleted file mode 100644 index 0d737fa4a..000000000 --- a/.github/workflows/build.yml.backup +++ /dev/null @@ -1,45 +0,0 @@ -name: Build and Test - -on: - push: - branches: [ rhuze-dev ] - pull_request: - branches: [ develop ] - -jobs: - build: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v3 - - - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2024-01-26 - override: true - components: rust-src, llvm-tools-preview #Added llvm-tools-preview - target: aarch64-apple-ios - - - name: Generate C-bindings header file - run: | - cd bindings/ergo-lib-c - RUST_BACKTRACE=1 cbindgen --config cbindgen.toml --crate ergo-lib-c --output h/ergo_lib.h # Added RUST_BACKTRACE - env: - RUST_BACKTRACE: 1 - - - name: Build Rust Library (ergo-lib-c) - run: cargo build --all-features -p ergo-lib-c --target aarch64-apple-ios - - - name: Verify Library Path - run: ls -al ../../target/aarch64-apple-ios/release - - - name: Build Swift Project - run: | - cd bindings/ergo-lib-ios - swift build -Xswiftc "-framework" -Xswiftc "SystemConfiguration" -Xlinker "-L../../target/aarch64-apple-ios/release" -Xlinker "-lergo" - - - name: Run Swift Tests - run: | - cd bindings/ergo-lib-ios - swift test -Xswiftc "-framework" -Xswiftc "SystemConfiguration" -Xlinker "-L../../target/aarch64-apple-ios/release" -Xlinker "-lergo" --skip RestNodeApiTests diff --git a/bindings/ergo-lib-c/LINUX_DEVELOPMENT.md b/bindings/ergo-lib-c/LINUX_DEVELOPMENT.md new file mode 100644 index 000000000..825cf5b9e --- /dev/null +++ b/bindings/ergo-lib-c/LINUX_DEVELOPMENT.md @@ -0,0 +1,89 @@ +# Linux Development Setup + +This guide covers setting up the development environment for sigma-rust on Linux systems. + +## Prerequisites + +- Fedora/RHEL-based system (tested on Fedora 40) +- Toolbox installed on your system +- Git + +## Toolbox Setup + +1. Create and enter a new development toolbox: + ```bash + # Create a new toolbox (if not already created) + toolbox create --distro fedora --release 40 fedora-40 + + # Enter the toolbox + toolbox enter fedora-40 + + # Verify you're inside the toolbox + cat /etc/os-release + ``` + +2. Clone the repository (if not already done): + ```bash + # Navigate to your preferred directory + cd ~/GitIt # or your preferred directory + + # Clone the repository + git clone https://github.com/ergoplatform/sigma-rust.git + cd sigma-rust + ``` + +## Development Environment Setup + +1. Install system dependencies: + ```bash + sudo dnf install gcc make cmake git pkg-config + ``` + +2. Install Rust and required components: + ```bash + # Install Rust + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + source "$HOME/.cargo/env" + + # Add required targets + rustup target add aarch64-apple-ios + rustup target add x86_64-apple-ios + + # Install nightly toolchain + rustup toolchain install nightly-2024-01-26 + + # Install cbindgen + cargo install cbindgen + ``` + +3. Build Components: + ```bash + # Build ergo-lib-c + cd bindings/ergo-lib-c + cargo build --release --all-features + + # Generate C headers + rustup override set nightly + cbindgen --config cbindgen.toml --crate ergo-lib-c --output h/ergo_lib.h + rustup override set stable + ``` + +## Limitations + +- iOS/Swift components cannot be directly tested on Linux +- Full iOS integration testing is performed via GitHub Actions + +## Development Workflow + +1. Make changes to Rust components +2. Build and test locally using the commands above +3. Commit changes with clear commit messages +4. Push to GitHub where Actions will perform full iOS integration testing + +## Troubleshooting + +If you encounter any issues: +1. Ensure all prerequisites are installed +2. Verify you're using the correct Rust toolchain +3. Check the GitHub Actions logs for detailed error messages +4. Verify you're working inside the toolbox environment diff --git a/bindings/ergo-lib-c/cbingen_toml.txt b/bindings/ergo-lib-c/cbingen_toml.txt deleted file mode 100644 index 16aa6e873..000000000 --- a/bindings/ergo-lib-c/cbingen_toml.txt +++ /dev/null @@ -1,152 +0,0 @@ -# This is a template cbindgen.toml file with all of the default values. -# Some values are commented out because their absence is the real default. -# -# See https://github.com/eqrion/cbindgen/blob/master/docs.md#cbindgentoml -# for detailed documentation of every option here. - - -language = "C" - - -############## Options for Wrapping the Contents of the Header ################# - -# header = "/* Text to put at the beginning of the generated file. Probably a license. */" -# trailer = "/* Text to put at the end of the generated file */" -# include_guard = "my_bindings_h" -# pragma_once = true -autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" -include_version = false -# namespace = "my_namespace" -namespaces = [] -using_namespaces = [] -sys_includes = [] -includes = [] -no_includes = false -after_includes = "" - - - - -############################ Code Style Options ################################ - -braces = "SameLine" -line_length = 100 -tab_width = 2 -documentation_style = "auto" - - - - - -############################# Codegen Options ################################## - -style = "both" - - - -[defines] -# "target_os = freebsd" = "DEFINE_FREEBSD" -# "feature = serde" = "DEFINE_SERDE" -"feature = rest" = "ERGO_REST" - - - -[export] -include = [] -exclude = [] -# prefix = "CAPI_" -item_types = [] -renaming_overrides_prefixing = false - - - -[export.rename] - - - -[export.body] - - - - -[fn] -rename_args = "None" -# must_use = "MUST_USE_FUNC" -# prefix = "START_FUNC" -# postfix = "END_FUNC" -args = "auto" -sort_by = "Name" - - - - -[struct] -rename_fields = "None" -# must_use = "MUST_USE_STRUCT" -derive_constructor = false -derive_eq = false -derive_neq = false -derive_lt = false -derive_lte = false -derive_gt = false -derive_gte = false - - - - -[enum] -rename_variants = "None" -# must_use = "MUST_USE_ENUM" -add_sentinel = false -prefix_with_name = false -derive_helper_methods = false -derive_const_casts = false -derive_mut_casts = false -# cast_assert_name = "ASSERT" -derive_tagged_enum_destructor = false -derive_tagged_enum_copy_constructor = false -enum_class = true -private_default_tagged_enum_constructor = false - - - - -[const] -allow_static_const = true -allow_constexpr = false - - - - -[macro_expansion] -bitflags = false - - - - - - -############## Options for How Your Rust library Should Be Parsed ############## - -[parse] -parse_deps = true -include = ["ergo-lib-c-core"] -# exclude = [] -clean = false -extra_bindings = [] - - - -[parse.expand] -crates = ["ergo-lib-c"] -all_features = false -default_features = true -features = ["rest", "mnemonic_gen"] - - -[ptr] -# An optional string to decorate all pointers that are -# required to be non null. Nullability is inferred from the Rust type: `&T`, -# `&mut T` and `NonNull` all require a valid pointer value. -non_null_attribute = "_Nonnull" -