diff --git a/thermion_dart/hook/build.dart b/thermion_dart/hook/build.dart index aecda6b2..84583c5f 100644 --- a/thermion_dart/hook/build.dart +++ b/thermion_dart/hook/build.dart @@ -6,12 +6,11 @@ import 'package:native_toolchain_c/native_toolchain_c.dart'; void main(List args) async { await build(args, (config, output) async { - var logDir = Directory( - "${config.packageRoot.toFilePath()}.dart_tool/thermion_dart/log/"); - if (!logDir.existsSync()) { - logDir.createSync(recursive: true); + var logFile = File( + "${config.packageRoot.toFilePath()}.dart_tool/thermion_dart/log/build.log"); + if (!logFile.parent.existsSync()) { + logFile.parent.createSync(recursive: true); } - var logFile = File(logDir.path + "/build.log"); final logger = Logger("") ..level = Level.ALL @@ -22,6 +21,8 @@ void main(List args) async { var platform = config.targetOS.toString().toLowerCase(); + logger.info("Building Thermion for ${config.targetOS} in mode ${config.buildMode.name}"); + // We don't support Linux (yet), so the native/Filament libraries won't be // compiled/available. However, we still want to be able to run the Dart // package itself on a Linux host(e.g. for dart_services backed), so if @@ -110,11 +111,19 @@ void main(List args) async { flags.addAll(['-std=c++17']); } else { defines["WIN32"] = "1"; - defines["_DEBUG"] = "1"; defines["_DLL"] = "1"; + if(config.buildMode == BuildMode.debug) { + defines["_DEBUG"] = "1"; + } else { + defines["RELEASE"] = "1"; + defines["NDEBUG"] = "1"; + } flags.addAll([ "/std:c++20", + if(config.buildMode == BuildMode.debug) "/MDd", + if(config.buildMode == BuildMode.release) + "/MD", "/VERBOSE", ...defines.keys.map((k) => "/D$k=${defines[k]}").toList() ]); @@ -272,6 +281,8 @@ Future getLibDir(BuildConfig config, Logger logger) async { } } + logger.info("Searching for Filament libraries under ${libDir.path}"); + final url = _getLibraryUrl(platform, mode); final filename = url.split("/").last;