Skip to content

Commit

Permalink
chore: add cpp compat to wallet.h (#4245)
Browse files Browse the repository at this point in the history
Changed the build.rs for cbindgen to add the following:

```
#ifdef __cplusplus
extern "C" {

#endif

#ifdef __cplusplus
}

#endif

```

Also renamed the file to `wallet.h`
  • Loading branch information
stringhandler authored Jun 30, 2022
1 parent 90c39b2 commit 1b7b879
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/libwallet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-11-20
toolchain: nightly-2022-05-01
override: true
- name: Install cross
run: |
Expand Down Expand Up @@ -66,13 +66,13 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-11-20
toolchain: nightly-2022-05-01
target: aarch64-apple-ios
components: rustfmt
override: true
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-11-20
toolchain: nightly-2022-05-01
target: x86_64-apple-ios
components: rustfmt
override: true
Expand Down
70 changes: 35 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions base_layer/wallet_ffi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ use cbindgen::{Config, Language, ParseConfig, Style};
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();

let package_name = env::var("CARGO_PKG_NAME").unwrap();
let output_file = PathBuf::from(&crate_dir)
.join(format!("{}.h", package_name))
.display()
.to_string();
// let package_name = env::var("CARGO_PKG_NAME").unwrap();
let output_file = PathBuf::from(&crate_dir).join("wallet.h").display().to_string();

let config = Config {
language: Language::C,
Expand All @@ -28,7 +25,9 @@ fn main() {
]),
..Default::default()
},
autogen_warning: Some("// This file was generated by cargo-bindgen. Please do not edit manually.".to_string()),
style: Style::Tag,
cpp_compat: true,
..Default::default()
};

Expand Down
4 changes: 2 additions & 2 deletions base_layer/wallet_ffi/mobile_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if [ -n "${DEPENDENCIES}" ] && [ -n "${PKG_PATH}" ] && [ "${BUILD_IOS}" -eq 1 ]
if [ "${CARGO_CLEAN}" -eq "1" ]; then
cargo clean >> "${IOS_LOG_PATH}/cargo.txt" 2>&1
fi
cp tari_wallet_ffi.h "${DEPENDENCIES}/MobileWallet/TariLib/"
cp wallet.h "${DEPENDENCIES}/MobileWallet/TariLib/"
export PKG_CONFIG_PATH=${PKG_PATH}
# shellcheck disable=SC2028
echo "\t${CYAN}Building Wallet FFI${NC}"
Expand Down Expand Up @@ -424,7 +424,7 @@ EOF
else
cargo ndk --target ${PLATFORMABI} --android-platform ${LEVEL} -- build --release > "${ANDROID_LOG_PATH}/cargo_${PLATFORMABI}_${LEVEL}.txt" 2>&1
fi
cp tari_wallet_ffi.h "${DEPENDENCIES}/"
cp wallet.h "${DEPENDENCIES}/"
rm -rf .cargo
cd ../..
cd target || exit
Expand Down
Loading

0 comments on commit 1b7b879

Please sign in to comment.