From 82780a1aab7bc6f13972a9177c4e82a0714d6a3a Mon Sep 17 00:00:00 2001 From: Tony Ciavarella Date: Wed, 25 Feb 2026 00:14:22 -0500 Subject: [PATCH] fix freeglut static linking on MSVC The -DFREEGLUT_LIB_PRAGMAS=0 compiler argument needs to be used when building freeglut as a static library on windows to avoid freeglut_std.h injecting a dependency on the non-existent freeglut_staticd.lib into the resultant libfreeglut.a via comment pragma. FREEGLUT_LIB_PRAGMAS only has relevance on Windows when building with MSVC, so it's only defined in that context now. This fixes the following link error when using freeglut as a static library subproject with MSVC: LINK : fatal error LNK1104: cannot open file 'freeglut_staticd.lib' --- releases.json | 1 + subprojects/packagefiles/freeglut/meson.build | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/releases.json b/releases.json index ad2f7bcc17..16ca8305e6 100644 --- a/releases.json +++ b/releases.json @@ -1146,6 +1146,7 @@ "glut" ], "versions": [ + "3.8.0-2", "3.8.0-1", "3.6.0-1", "3.4.0-3", diff --git a/subprojects/packagefiles/freeglut/meson.build b/subprojects/packagefiles/freeglut/meson.build index feee480e0d..473e711f28 100644 --- a/subprojects/packagefiles/freeglut/meson.build +++ b/subprojects/packagefiles/freeglut/meson.build @@ -93,12 +93,15 @@ freeglut_deps = [ dep_glu, ] +compile_args = [] + if host_system == 'windows' if cc.get_id() == 'msvc' add_project_arguments( - '/source-charset:windows-1252', + ['/source-charset:windows-1252', '-DFREEGLUT_LIB_PRAGMAS=0'], language: 'c', ) + compile_args += '-DFREEGLUT_LIB_PRAGMAS=0' endif freeglut_sources += files( @@ -293,7 +296,6 @@ freeglut_def = configure_file( configuration: config, ) -compile_args = ['-DFREEGLUT_LIB_PRAGMAS=0'] if get_option('default_library') == 'static' compile_args += '-DFREEGLUT_STATIC' add_project_arguments(