forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modules/rust: Allow explicitly setting the language to bind
This may be of particular use when a header is .h but should be treated as a C++ header instead of a C header.
- Loading branch information
Showing
4 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Overriding bindgen language setting | ||
|
||
Even though Meson will now tell bindgen to do the right thing in most cases, | ||
there may still be cases where Meson does not have the intended behavior, | ||
specifically with headers with a `.h` suffix, but are C++ headers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# SPDX-license-identifer: Apache-2.0 | ||
# Copyright © 2021-2023 Intel Corporation | ||
|
||
fs = import('fs') | ||
|
||
cpp_header = fs.copyfile('../src/header.hpp', 'cpp_header.h') | ||
|
||
cpp_bind_override = rust.bindgen( | ||
input : cpp_header, | ||
output : 'generated-cpp.rs', | ||
language : 'cpp', | ||
) | ||
|
||
cpp_exe2 = executable( | ||
'cpp_exe2', | ||
structured_sources(['../src/cpp.rs', cpp_bind_override]), | ||
link_with : cpp_lib, | ||
) | ||
test('cpp-forced', cpp_exe2) |