DcbCMakeBuilder class final
A reusable build-hook builder that drives CMake to compile a native library
and emits it as a bundled CodeAsset.
The builder performs three CMake steps inside
input.outputDirectory/dcb_build/:
cmake -S <sourceDir> -B <buildDir> [generator] [defines]cmake --build <buildDir> --config <Release|Debug>- Locate the produced dynamic library and emit it as a
CodeAsset.
On Windows with WindowsConfig.dynamicCrt = true and
WindowsConfig.bundleCrt = true, the correct CRT runtime DLLs are copied
next to the output library after a successful build.
Constructors
-
DcbCMakeBuilder({required DcbPlatformConfig config, required String assetName, String? assetPackage, String? sourceDir, String? libName, List<
String> extraDefines = const [], bool useDefaultCmakeArgs = true, DcbBuildOptions buildOptions = const DcbBuildOptions()}) -
const
Properties
- assetName → String
-
The code-asset name within the package, e.g.
'hook_demo.dart'.final - assetPackage → String?
-
The package namespace for the emitted code asset.
final
- buildOptions → DcbBuildOptions
-
Top-level build options (debug/release, etc.).
final
- config → DcbPlatformConfig
-
The platform configuration selecting CMake behavior.
final
-
extraDefines
→ List<
String> -
Extra definitions passed verbatim to the CMake configure step,
applied on all platforms. Platform-specific defines can also be set
via WindowsConfig.extraDefines.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- libName → String?
-
The expected library base name (CMake output name). Defaults to the
package name.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sourceDir → String?
-
The CMake source directory (
cmake -S), relative to the package root. Defaults to the package root.final - useDefaultCmakeArgs → bool
-
Whether to inject the builder's default CMake configure arguments.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
{required BuildInput input, required BuildOutputBuilder output}) → Future< void> -
Runs the CMake build and emits the produced library as a bundled
CodeAsset. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
resolveAndroidAbi(
Architecture? arch, [String? override]) → String - Resolve an Android ABI using the same target/override rules as run.
-
resolveWindowsArchitecture(
Architecture? targetArchitecture, [String? override]) → String - Resolve a Windows CMake architecture using the same target/override rules as run.