37
37
endif
38
38
39
39
cc = meson .get_compiler(' c' )
40
+ if plat == ' win' and cc.get_id() != ' msvc' and get_option (' win_force_msvc' )
41
+ error (' Tried to compile with a non-msvc compiler when msvc is forced' )
42
+ endif
43
+
40
44
fs = import (' fs' )
41
45
42
46
py = import (' python' ).find_installation(pure : false )
@@ -55,7 +59,6 @@ pg_lib_dirs = []
55
59
sdl_image_extra_links = []
56
60
if (
57
61
plat == ' win'
58
- and cc.get_argument_syntax() == ' msvc'
59
62
and host_machine .cpu_family().startswith(' x86' )
60
63
)
61
64
# yes, this is a bit ugly and hardcoded but it is what it is
@@ -105,12 +108,12 @@ if (
105
108
' libpng' ,
106
109
output : ' libpng16-16.lib' ,
107
110
input : [libpng_def, sdl_image_lib_dir / ' libpng16-16.dll' ],
108
- command : [
111
+ command : cc.get_argument_syntax() == ' msvc ' ? [
109
112
' lib' ,
110
113
' /def:' + libpng_def,
111
114
' /machine:' + arch_suffix,
112
115
' /out:@OUTPUT@' ,
113
- ]
116
+ ] : [ ' dlltool ' , ' -k ' , ' --output-lib ' , ' @OUTPUT@ ' , ' --def ' , libpng_def]
114
117
)
115
118
116
119
# SDL2_mixer
@@ -139,6 +142,19 @@ if (
139
142
pg_lib_dirs += common_lib_dir
140
143
dlls += [common_lib_dir / ' freetype.dll' , common_lib_dir / ' portmidi.dll' ]
141
144
145
+ # clean unneeded file that causes build issues
146
+ unneeded_file = common_lib_dir / ' libportmidi.dll.a'
147
+ if fs.exists(unneeded_file)
148
+ run_command (
149
+ [
150
+ find_program (' python3' , ' python' ),
151
+ ' -c' ,
152
+ ' import os; os.remove("@0@")' .format(unneeded_file),
153
+ ],
154
+ check : true ,
155
+ )
156
+ endif
157
+
142
158
# put dlls in root of install
143
159
install_data (dlls, install_dir : pg_dir)
144
160
else
0 commit comments