Skip to content

Commit

Permalink
Merge commit '0ffdccc3a190c9d6d292f2fd77637ff13f4cdc8c' into ffigen-11
Browse files Browse the repository at this point in the history
  • Loading branch information
dcharkes committed Jan 3, 2024
2 parents 200885e + 0ffdccc commit 7a49e70
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkgs/ffigen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ must be passed to change this behaviour.
- __Breaking change__: Stop generating setters for global variables marked `const` in C.
- Fix objc_msgSend being used on arm64 platforms where it's not available.
- Fix missing comma with `ffi-native` functions marked `leaf`.
- Add support for finding libclang in Conda environment.

## 10.0.0

Expand Down
19 changes: 18 additions & 1 deletion pkgs/ffigen/lib/src/config_provider/spec_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,27 @@ Headers headersExtractor(
);
}

String? _findLibInConda() {
final condaEnvPath = Platform.environment['CONDA_PREFIX'] ?? '';
if (condaEnvPath.isNotEmpty) {
final locations = [
p.join(condaEnvPath, 'lib'),
p.join(p.dirname(p.dirname(condaEnvPath)), 'lib'),
];
for (final l in locations) {
final k = findLibclangDylib(l);
if (k != null) return k;
}
}
return null;
}

/// Returns location of dynamic library by searching default locations. Logs
/// error and throws an Exception if not found.
String findDylibAtDefaultLocations() {
String? k;
// Assume clang in conda has a higher priority.
var k = _findLibInConda();
if (k != null) return k;
if (Platform.isLinux) {
for (final l in strings.linuxDylibLocations) {
k = findLibclangDylib(l);
Expand Down

0 comments on commit 7a49e70

Please sign in to comment.