default to release mode builds

This commit is contained in:
Nick Fisher
2025-04-16 16:01:49 +08:00
parent 85a0451f1b
commit 9ceedb4e1c
2 changed files with 16 additions and 21 deletions

View File

@@ -13,7 +13,14 @@ void main(List<String> args) async {
.toFilePath(windows: Platform.isWindows); .toFilePath(windows: Platform.isWindows);
final config = input.config; final config = input.config;
final buildMode = BuildMode.debug;
// Most users will only need release builds of Filament.
// Debug builds are probably only relevant if you're a package developer debugging an internal Filament issue.
// Also note that there are known driver issues with Android debug builds, e.g.:
// https://github.com/google/filament/issues/7162
// (these aren't present in Filament release builds).
// However, if you know what you're doing, you can change "release" to "debug" .
final buildMode = BuildMode.release;
final dryRun = false; final dryRun = false;
final packageName = input.packageName; final packageName = input.packageName;
@@ -49,7 +56,7 @@ void main(List<String> args) async {
throw Exception("TODO"); throw Exception("TODO");
} }
var libDir = (await getLibDir(packageRoot, targetOS, targetArchitecture, logger)).path; var libDir = (await getLibDir(packageRoot, targetOS, targetArchitecture, logger, buildMode)).path;
var sources = Directory(path.join(pkgRootFilePath, "native", "src")) var sources = Directory(path.join(pkgRootFilePath, "native", "src"))
.listSync(recursive: true) .listSync(recursive: true)
@@ -114,14 +121,15 @@ void main(List<String> args) async {
} else { } else {
libs.add("stdc++"); libs.add("stdc++");
} }
final flags = []; //"-fsanitize=address"]; final flags = []; //"-fsanitize=address"];
final defines = <String, String?>{ final defines = <String, String?>{
// uncomment this to enable (very verbose) trace logging // uncomment this to enable (very verbose) trace logging
// "ENABLE_TRACING": "1" // "ENABLE_TRACING": "1"
}; };
var frameworks = [];
var frameworks = [];
if (platform != "windows") { if (platform != "windows") {
flags.addAll(['-std=c++17']); flags.addAll(['-std=c++17']);
} else if (!dryRun) { } else if (!dryRun) {
@@ -208,6 +216,8 @@ void main(List<String> args) async {
dartBuildFiles: ['hook/build.dart'], dartBuildFiles: ['hook/build.dart'],
); );
await cbuilder.run( await cbuilder.run(
input: input, input: input,
output: output, output: output,
@@ -308,23 +318,10 @@ String _getLibraryUrl(String platform, String mode) {
// //
// Download precompiled Filament libraries for the target platform from Cloudflare. // Download precompiled Filament libraries for the target platform from Cloudflare.
// //
Future<Directory> getLibDir(Uri packageRoot, OS targetOS, Architecture targetArchitecture, Logger logger) async { Future<Directory> getLibDir(Uri packageRoot, OS targetOS, Architecture targetArchitecture, Logger logger, BuildMode buildMode) async {
var platform = targetOS.toString().toLowerCase(); var platform = targetOS.toString().toLowerCase();
// Except on Windows, most users will only need release builds of Filament. var mode = buildMode == BuildMode.debug ? "debug" : "release";
// Debug builds are probably only relevant if you're a package developer debugging an internal Filament issue
// or if you're working on Flutter+Windows (which requires the CRT debug DLLs).
// Also note that there are known driver issues with Android debug builds, e.g.:
// https://github.com/google/filament/issues/7162
// (these aren't present in Filament release builds).
// However, if you know what you're doing, you can change "release" to "debug" below.
// TODO - check if we can pass this as a CLI compiler flag
var mode = "debug";
// var mode = "release";
// if ({OS.windows, OS.macOS}.contains(targetOS)) {
// mode = buildMode == BuildMode.debug ? "debug" : "release";
// }
var libDir = Directory(path.join( var libDir = Directory(path.join(
packageRoot.toFilePath(windows: Platform.isWindows), packageRoot.toFilePath(windows: Platform.isWindows),

View File

@@ -4,8 +4,6 @@ project(${PROJECT_NAME} LANGUAGES C CXX)
cmake_policy(VERSION 3.14...3.25) cmake_policy(VERSION 3.14...3.25)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
set(PLUGIN_NAME "thermion_flutter_plugin") set(PLUGIN_NAME "thermion_flutter_plugin")
list(APPEND PLUGIN_SOURCES list(APPEND PLUGIN_SOURCES