moduleCppTargetBlock function
The .target(...) block for one module's SPM C++ target, named after the
module's Dart class (<ModuleClass>Cpp). It depends on the plugin-level
<pluginClass>Cpp target, which owns dart_api_dl.c and the shared nitro
headers — compiled exactly once for the whole package (compiling
dart_api_dl.c per target would duplicate its symbols at link time).
Implementation
String moduleCppTargetBlock(String moduleClass, String pluginClass, {String indent = ' '}) =>
'$indent.target(\n'
'$indent name: "${moduleClass}Cpp",\n'
'$indent dependencies: ["${pluginClass}Cpp"],\n'
'$indent path: "Sources/${moduleClass}Cpp",\n'
'$indent publicHeadersPath: "include",\n'
'$indent cxxSettings: [\n'
'$indent .headerSearchPath("include"),\n'
'$indent .unsafeFlags(["${BuildVersions.spmCxxFlag}"])\n'
'$indent ]\n'
'$indent),';