From e8e168469435eb7b6d93779b227dc035152d245d Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Wed, 26 Jun 2024 01:49:37 +1000 Subject: [PATCH] fix: on Windows, pass static libs via -l rather than custom linkWith property so build.dart stays compatible between published & custom versions --- thermion_dart/hook/build.dart | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/thermion_dart/hook/build.dart b/thermion_dart/hook/build.dart index da71bf8b..25a1bad1 100644 --- a/thermion_dart/hook/build.dart +++ b/thermion_dart/hook/build.dart @@ -62,7 +62,7 @@ void main(List args) async { "${config.packageRoot.toFilePath()}/native/include/material/image.c", ]); - final libs = [ + var libs = [ "filament", "backend", "filameshio", @@ -91,12 +91,12 @@ void main(List args) async { "basis_transcoder" ]; - final linkWith = []; if (platform == "windows") { - linkWith.addAll(libs.map((lib) => "$libDir/$lib.lib")); - linkWith.addAll(["$libDir/bluevk.lib", "$libDir/bluegl.lib"]); - linkWith.addAll([ + libDir = Directory(libDir).uri.toFilePath(); + libs = libs.map((lib) => "${libDir}${lib}.lib").toList(); + libs.addAll(["${libDir}bluevk.lib", "${libDir}bluegl.lib"]); + libs.addAll([ "gdi32.lib", "user32.lib", "shell32.lib", @@ -151,14 +151,12 @@ void main(List args) async { sources: sources, includes: ['native/include', 'native/include/filament'], defines: defines, - // UNCOMMENT THIS IF YOU ARE BUILDING WITH THE CUSTOM native_toolchain_c FORK FOR WINDOWS - // linkWith: linkWith, flags: [ if (platform == "macos") '-mmacosx-version-min=13.0', if (platform == "ios") '-mios-version-min=13.0', ...flags, ...frameworks, - if (platform != "windows") ...libs.map((lib) => "-l$lib"), + ...libs.map((lib) => "-l$lib"), "-L$libDir", ], dartBuildFiles: ['hook/build.dart'],