From fb9be868f52984d04e59a54f6e04c369c1fbb562 Mon Sep 17 00:00:00 2001 From: EZ4Stephen Date: Wed, 10 Dec 2025 19:09:45 +0400 Subject: [PATCH] Add MSVC specific compiler flags to wscript --- libs/ardour/wscript | 3 +++ wscript | 23 ++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libs/ardour/wscript b/libs/ardour/wscript index b6b55fb697..25a035ca48 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -283,6 +283,9 @@ def options(opt): pass def configure(conf): + if conf.env['build_target'] == 'msvc': + conf.find_program('ml64', var='AS') + conf.load('gas') # we don't use hard-coded micro versions with ardour, so hard code it to zero autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', diff --git a/wscript b/wscript index 4b36f23048..d311e59a66 100644 --- a/wscript +++ b/wscript @@ -86,7 +86,7 @@ compiler_flags_dictionaries= { 'cxx17': ['-std=c++17'], }, 'msvc' : { - 'debuggable' : ['/DDEBUG', '/Od', '/Zi', '/MDd', '/Gd', '/EHsc'], + 'debuggable' : ['/DDEBUG', '/Od', '/Z7', '/MDd', '/Gd', '/EHsc'], 'linker-debuggable' : ['/DEBUG', '/INCREMENTAL' ], 'nondebuggable' : ['/DNDEBUG', '/Ob1', '/MD', '/Gd', '/EHsc'], 'profile' : ['/Oy-'], @@ -477,6 +477,11 @@ int main() { return 0; }''', # libraries conf.env['compiler_flags_dict'] = flags_dict + if compiler_name == 'msvc': + compiler_flags.extend(['/nologo', '/FS', '/bigobj', '/JMC', '/FC', + '/diagnostics:column', '/Zc:__cplusplus']) + linker_flags.extend(['/guard:cf']) + autowaf.set_basic_compiler_flags (conf,flags_dict) if conf.options.asan: @@ -1262,6 +1267,14 @@ int main () { return 0; } # see http://gareus.org/wiki/ardour_windows_gdk_and_cairo conf.env.append_value('CFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE') conf.env.append_value('CXXFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE') + conf.env.append_value('LIB', 'pthreadVC3') + conf.env.append_value('LIB', 'Ws2_32') + conf.env.append_value('LIB', 'Advapi32') + conf.env.append_value('LIB', 'Shell32') + conf.env.append_value('LIB', 'Winmm') + conf.env.append_value('LIB', 'Dbghelp') + conf.env.append_value('LIB', 'User32') + conf.env.append_value('LIB', 'Kernel32') # MORE STUFF PROBABLY NEEDED HERE conf.define ('WINDOWS', 1) @@ -1413,8 +1426,12 @@ int main () { __int128 x = 0; return 0; } if re.search ("linux", sys.platform) is not None and Options.options.dist_target != 'mingw' and conf.env['BUILD_PABACKEND']: conf.fatal("lld is only for Linux builds") else: - conf.find_program ('lld') - conf.env.append_value('LINKFLAGS', '-fuse-ld=lld') + if Options.options.dist_target != 'msvc': + conf.find_program ('lld') + conf.env.append_value('LINKFLAGS', '-fuse-ld=lld') + else: + conf.find_program('lld-link', var='LINK') + conf.env.LINK_CXX = conf.env.LINK if re.search ("linux", sys.platform) is not None and Options.options.dist_target != 'mingw' and conf.env['BUILD_PABACKEND']: conf.fatal("PortAudio Backend is not for Linux")