MSVC/mingw SUBSYSTEM:WINDOWS abstraction

This commit is contained in:
Robin Gareus
2026-03-06 19:15:55 +01:00
parent e6f9f965ee
commit 435d16b543
7 changed files with 24 additions and 20 deletions
+3 -6
View File
@@ -655,7 +655,7 @@ def build(bld):
'LOCALEDIR="' + autowaf.normpath(bld.env['LOCALEDIR']) + '"',
]
obj.install_path = bld.env['DLLDIR']
obj.linkflags = bld.env['compiler_flags_dict']['execstack']
obj.linkflags = [ bld.env['compiler_flags_dict']['execstack'] ]
obj.uselib = 'UUID FLAC FONTCONFIG GTHREAD OGG PANGOMM CURL DL CANVAS FFTW3F LO TAGLIB XML LILV RUBBERBAND AUBIO LRDF ARCHIVE VAMPSDK VAMPHOSTSDK GLIBMM GIOMM PANGOFT2 LIBPNG'
if bld.env['build_target'] == 'msvc':
@@ -687,10 +687,7 @@ def build(bld):
if bld.env['build_target'] == 'mingw' or bld.env['build_target'] == 'msvc':
obj.use += [ 'PANGOFT2' ]
if bld.env['build_target'] == 'mingw':
obj.linkflags += ' -mwindows'
else:
obj.linkflags += ' /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup'
obj.linkflags += bld.env['compiler_flags_dict']['mwindows']
if bld.is_defined('HAVE_SUIL'):
obj.source += [ 'lv2_plugin_ui.cc' ]
@@ -700,7 +697,7 @@ def build(bld):
bld.env['LIB_FFTW3F'] += ['fftw3f_threads']
if bld.is_defined('NEED_INTL'):
obj.linkflags += ' -lintl'
obj.linkflags.append ('-lintl')
if bld.is_defined('WINDOWS_VST_SUPPORT'):
obj.source += [ 'windows_vst_plugin_ui.cc' ]
+3 -3
View File
@@ -22,7 +22,7 @@ def build(bld):
obj.source = hardour_sources
obj.target = 'hardour-' + bld.env['VERSION']
obj.includes = ['.']
obj.linkflags= bld.env['compiler_flags_dict']['execstack']
obj.linkflags= [ bld.env['compiler_flags_dict']['execstack'] ]
obj.use = [ 'libpbd',
'libardour',
'libardour_cp',
@@ -52,9 +52,9 @@ def build(bld):
obj.use += ' libappleutility'
elif bld.env['build_target'] == 'mingw' or bld.env['build_target'] == 'msvc':
if bld.env['DEBUG'] == False:
obj.linkflags += ' -mwindows'
obj.linkflags += bld.env['compiler_flags_dict']['mwindows']
obj.includes += ['../libs']
if bld.is_defined('NEED_INTL'):
obj.linkflags += ' -lintl'
obj.linkflags.append ('-lintl')
+4 -4
View File
@@ -20,7 +20,7 @@ def build(bld):
obj.source = 'vst3-scanner.cc'
obj.target = 'ardour-vst3-scanner'
obj.includes = [ '../pbd/', '../ardour/', '../vst3/', '..' ]
obj.linkflags = bld.env['compiler_flags_dict']['execstack']
obj.linkflags= [ bld.env['compiler_flags_dict']['execstack'] ]
obj.defines = [
'VST3_SCANNER_APP',
'VERSIONSTRING="' + bld.env['VERSION'] + '"',
@@ -38,7 +38,7 @@ def build(bld):
obj.uselib += ' OSX'
elif bld.env['build_target'] == 'mingw' or bld.env['build_target'] == 'msvc':
obj.uselib += ' GDI32'
obj.linkflags += ' -mwindows'
obj.linkflags += bld.env['compiler_flags_dict']['mwindows']
if re.search ("bsd", sys.platform) != None:
obj.defines.append('_POSIX_C_SOURCE=200809L')
@@ -50,7 +50,7 @@ def build(bld):
obj = bld (features = 'cxx c cxxprogram')
obj.source = ( 'vst2-scanner.cc' )
obj.target = 'ardour-vst-scanner'
obj.linkflags = bld.env['compiler_flags_dict']['execstack']
obj.linkflags= [ bld.env['compiler_flags_dict']['execstack'] ]
if bld.is_defined('WINDOWS_VST_SUPPORT'):
bld (features = 'c', name='vstwin', source='vstwin.c', uselib = 'GIOMM', includes = [ '../pbd/', '../ardour/', '.' ])
obj.uselib = ['GIOMM', 'DL', 'GDI32', 'ARCHIVE', 'CURL', 'XML']
@@ -65,7 +65,7 @@ def build(bld):
if sys.platform == 'darwin':
pass
elif bld.env['build_target'] == 'mingw' or bld.env['build_target'] == 'msvc':
obj.linkflags += ' -mwindows'
obj.linkflags += bld.env['compiler_flags_dict']['mwindows']
obj.includes = [ '../pbd/', '../ardour/', '.' ]
obj.defines = [
+2 -1
View File
@@ -44,8 +44,9 @@ def build(bld):
if bld.env['build_target'] == 'mingw' or bld.env['build_target'] == 'msvc':
obj.source = 'windows/hid.c'
obj.linkflags = [ '-lsetupapi', '-mwindows' ]
obj.linkflags = [ '-lsetupapi' ]
obj.uselib = 'SETUPAPI'
obj.linkflags += bld.env['compiler_flags_dict']['mwindows']
else:
obj.cflags += [ bld.env['compiler_flags_dict']['pic'] ]
if sys.platform == 'darwin':
+3 -3
View File
@@ -45,7 +45,7 @@ def build(bld):
obj.source = 'luasession.cc'
obj.target = 'luasession'
obj.includes = ['../libs']
obj.linkflags = bld.env['compiler_flags_dict']['execstack']
obj.linkflags = [ bld.env['compiler_flags_dict']['execstack'] ]
obj.use = ['liblua',
'libpbd',
'libardour',
@@ -76,10 +76,10 @@ def build(bld):
obj.uselib += ' AUDIOUNITS OSX'
obj.use += ' libappleutility'
elif bld.env['build_target'] == 'mingw' or bld.env['build_target'] == 'msvc':
obj.linkflags += ' -mwindows'
obj.linkflags += bld.env['compiler_flags_dict']['mconsole']
if bld.is_defined('NEED_INTL'):
obj.linkflags += ' -lintl'
obj.linkflags.append ('-lintl')
if bld.env['build_target'] == 'mingw' or bld.env['build_target'] == 'msvc':
obj.install_path = bld.env['BINDIR']
+3 -3
View File
@@ -25,7 +25,7 @@ def build_ardour_util(bld, util):
obj.source = ['common.cc', util + '.cc' ]
obj.target = pgmprefix + '-' + util
obj.includes = ['.']
obj.linkflags= bld.env['compiler_flags_dict']['execstack']
obj.linkflags= [ bld.env['compiler_flags_dict']['execstack'] ]
obj.use = [ 'libpbd',
'libardour',
'libardour_cp',
@@ -53,7 +53,7 @@ def build_ardour_util(bld, util):
obj.uselib += ' AUDIOUNITS OSX'
obj.use += ' libappleutility'
elif bld.env['build_target'] == 'mingw' or bld.env['build_target'] == 'msvc':
obj.linkflags += ' -mwindows'
obj.linkflags += bld.env['compiler_flags_dict']['mconsole']
obj.includes += ['../libs']
@@ -61,7 +61,7 @@ def build_ardour_util(bld, util):
obj.install_path = bld.env['BINDIR']
if bld.is_defined('NEED_INTL'):
obj.linkflags += ' -lintl'
obj.linkflags.append ('-lintl')
def build(bld):
# session-utils depend on the dummy backend
+6
View File
@@ -85,6 +85,10 @@ compiler_flags_dictionaries= {
'execstack': '',
# force C++17
'cxx17': ['-std=c++17'],
# mingw's version of /SUBSYSTEM:WINDOWS,
'mwindows': ['-mwindows'],
# mingw's default is -mconsole (/SUBSYSTEM:CONSOLE)
'mconsole': ['-mconsole'],
},
'msvc' : {
'debuggable' : ['/DDEBUG', '/Od', '/Z7', '/MDd', '/Gd', '/EHsc'],
@@ -120,6 +124,8 @@ compiler_flags_dictionaries= {
'c-anonymous-union': '',
'execstack': '',
'cxx17': ['/std:c++17'],
'mwindows': ['/SUBSYSTEM:WINDOWS', '/ENTRY:mainCRTStartup'],
'mconsole': ['/SUBSYSTEM:CONSOLE', '/ENTRY:mainCRTStartup'],
},
}