Skip to content

Commit 2a34457

Browse files
committed
fix: and now register their own
CMake rules for
1 parent 10d833b commit 2a34457

5 files changed

Lines changed: 41 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
## [0.1.0-beta.3] - 2026-07-26
10+
## [0.1.0-beta.4] - 2026-07-02
11+
12+
### Changed
13+
- `linux/CMakeLists.txt` and `windows/CMakeLists.txt` now register their own
14+
CMake `install()` rules for `bclibc_ffi`, so consuming Flutter apps no longer
15+
need to add manual `install(TARGETS bclibc_ffi …)` blocks to their platform
16+
`CMakeLists.txt`. On Windows, `add_dependencies(flutter_assemble bclibc_ffi)`
17+
is also registered automatically, preserving the correct build order in
18+
Visual Studio. Android is unaffected — the Gradle/AGP native build collects
19+
shared library targets from the CMake project without `install()`.
20+
21+
## [0.1.0-beta.3] - 2026-07-01
1122

1223
### Fixed
1324
- `bin/build_native.dart` resolved its own package root via `Platform.script`,
@@ -19,7 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1930
which goes through the actual `package_config.json` resolution and works
2031
regardless of pub-cache vs. path dependency vs. snapshot caching.
2132

22-
## [0.1.0-beta.2] - 2026-07-26
33+
## [0.1.0-beta.2] - 2026-07-01
2334

2435
### Added
2536
- `bin/build_native.dart``dart run dart_bclibc:build_native` builds the
@@ -71,7 +82,8 @@ First public release as a standalone package.
7182
2. pre-installed library found → use it (Flatpak `/app/lib`)
7283
3. fallback → `FetchContent` from GitHub (git dep via `dart pub get`)
7384

74-
[Unreleased]: https://github.com/ballistics-lab/dart-bclibc/compare/v0.1.0-beta.3...HEAD
85+
[Unreleased]: https://github.com/ballistics-lab/dart-bclibc/compare/v0.1.0-beta.4...HEAD
86+
[0.1.0-beta.4]: https://github.com/ballistics-lab/dart-bclibc/compare/v0.1.0-beta.3...v0.1.0-beta.4
7587
[0.1.0-beta.3]: https://github.com/ballistics-lab/dart-bclibc/compare/v0.1.0-beta.2...v0.1.0-beta.3
7688
[0.1.0-beta.2]: https://github.com/ballistics-lab/dart-bclibc/compare/v0.1.0-beta.1...v0.1.0-beta.2
7789
[0.1.0-beta.1]: https://github.com/ballistics-lab/dart-bclibc/releases/tag/v0.1.0-beta.1

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ cmake -S bclibc -B build/bclibc -DCMAKE_BUILD_TYPE=Release
189189
cmake --build build/bclibc --parallel
190190
```
191191

192-
> For Flutter apps the native library is built automatically by `flutter build` — no manual step needed.
192+
> For Flutter apps the native library is built and bundled automatically by `flutter build`.
193+
> No changes to the app's platform `CMakeLists.txt` are required — the library registers its own
194+
> CMake install rules on Linux and Windows; Android is handled by Gradle.
193195
194196
#### Consuming apps: `flutter test` / `dart test`
195197

linux/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ endif()
8080
# TARGET_LINKER_FILE resolves to the .so symlink; cmake's install(FILES) then
8181
# dereferences it and writes "libbclibc_ffi.so" to the bundle lib dir, which
8282
# is the name DynamicLibrary.open() expects at runtime.
83+
#
84+
# DESTINATION is intentionally relative (not ${INSTALL_BUNDLE_LIB_DIR}): this
85+
# install() runs while the plugin is add_subdirectory'd, before the consumer's
86+
# CMakeLists.txt sets INSTALL_BUNDLE_LIB_DIR. The relative path is resolved
87+
# against CMAKE_INSTALL_PREFIX at install time — which by then is the bundle
88+
# directory set by the consuming app.
8389
if(TARGET bclibc_ffi)
8490
dart_bclibc_set_bundled_lib($<TARGET_LINKER_FILE:bclibc_ffi>)
91+
install(FILES "$<TARGET_LINKER_FILE:bclibc_ffi>"
92+
DESTINATION lib
93+
COMPONENT Runtime)
8594
endif()

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dart_bclibc
22
description: "Dart FFI bindings for the bclibc ballistics engine. Provides a thin, zero-copy Dart wrapper around libbclibc_ffi with full trajectory integration, zero-finding, and apex/max-range solvers."
3-
version: 0.1.0-beta.3
3+
version: 0.1.0-beta.4
44
repository: https://github.com/ballistics-lab/dart-bclibc
55

66
environment:

windows/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,16 @@ else()
4646
endif()
4747

4848
# On Windows TARGET_FILE and TARGET_LINKER_FILE are the same (bclibc_ffi.dll).
49-
set(dart_bclibc_bundled_libraries
50-
$<TARGET_FILE:bclibc_ffi>
51-
PARENT_SCOPE
52-
)
49+
# DLLs live in the bundle root alongside the executable — DESTINATION "." is
50+
# relative to CMAKE_INSTALL_PREFIX (the bundle dir set by the app's CMakeLists).
51+
# flutter_assemble is wired before the main binary, so hooking bclibc_ffi onto
52+
# it ensures Visual Studio builds bclibc_ffi whenever it builds the app.
53+
if(TARGET bclibc_ffi)
54+
set(dart_bclibc_bundled_libraries $<TARGET_FILE:bclibc_ffi> PARENT_SCOPE)
55+
install(FILES "$<TARGET_FILE:bclibc_ffi>"
56+
DESTINATION .
57+
COMPONENT Runtime)
58+
if(TARGET flutter_assemble)
59+
add_dependencies(flutter_assemble bclibc_ffi)
60+
endif()
61+
endif()

0 commit comments

Comments
 (0)