use buildMode from user defines (if present)

This commit is contained in:
Nick Fisher
2025-07-01 12:14:53 +08:00
parent 6ab1411801
commit dbcf463fd1

View File

@@ -19,8 +19,14 @@ void main(List<String> args) async {
// Also note that there are known driver issues with Android debug builds, e.g.: // Also note that there are known driver issues with Android debug builds, e.g.:
// https://github.com/google/filament/issues/7162 // https://github.com/google/filament/issues/7162
// (these aren't present in Filament release builds). // (these aren't present in Filament release builds).
// However, if you know what you're doing, you can change "release" to "debug" . // However, if you know what you're doing, you can change "mode" to "debug" in the
final buildMode = BuildMode.release; // `hooks` section of pubspec.yaml.
var buildMode = BuildMode.release;
if (input.userDefines["mode"] == "debug") {
buildMode = BuildMode.debug;
}
final packageName = input.packageName; final packageName = input.packageName;
final outputDirectory = input.outputDirectory; final outputDirectory = input.outputDirectory;
@@ -43,8 +49,7 @@ void main(List<String> args) async {
var platform = targetOS.toString().toLowerCase(); var platform = targetOS.toString().toLowerCase();
logger logger.info("Building Thermion for ${targetOS} in mode ${buildMode.name}");
.info("Building Thermion for ${targetOS} in mode ${buildMode.name}");
var libDir = (await getLibDir( var libDir = (await getLibDir(
packageRoot, targetOS, targetArchitecture, logger, buildMode)) packageRoot, targetOS, targetArchitecture, logger, buildMode))
@@ -110,19 +115,21 @@ void main(List<String> args) async {
// (these are linked via ThermionWin32.h) // (these are linked via ThermionWin32.h)
libDir = libDir =
Directory(libDir).uri.toFilePath(windows: targetOS == OS.windows); Directory(libDir).uri.toFilePath(windows: targetOS == OS.windows);
} }
final defines = <String, String?>{}; final defines = <String, String?>{};
logger.info("User defines : ${input.userDefines}");
if ((input.userDefines["tracing"] as String?)?.isNotEmpty == true) { if ((input.userDefines["tracing"] as String?)?.isNotEmpty == true) {
logger.info("Enabling tracing"); logger.info("Enabling tracing");
defines["ENABLE_TRACING"] = "1"; defines["ENABLE_TRACING"] = "1";
} }
final flags = [ ]; //"-fsanitize=address"]; logger.info("Defines : ${defines}");
final flags = []; //"-fsanitize=address"];
var frameworks = []; var frameworks = [];
if (platform != "windows") { if (platform != "windows") {
flags.addAll(['-std=c++17']); flags.addAll(['-std=c++17']);
} else { } else {