From efe01d92a65a4f63fdc7975121e389c896653298 Mon Sep 17 00:00:00 2001 From: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Date: Mon, 24 Feb 2025 18:49:22 +0000 Subject: [PATCH] Fix MSVC build again, add support for standalone MSVC compiler (#59) After switching away from VS, I realized the buildscript wouldn't detect the standalone MSVC compiler, because for whatever genius reason, MS installs that in the x86 program files directory... Also fixes some duplicate definitions and a missing library that MSVC doesn't like ah compilers... Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/59 Co-authored-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Co-committed-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> --- .gitignore | 3 +++ amex/gpio.c | 1 - hooklib/meson.build | 1 + meson.build | 1 + msvc-build.bat | 9 ++++----- platform/system.c | 1 - unityhook/doorstop.c | 1 + 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index d42760f4..f5d90086 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ subprojects/capnhook # For enabling debug logging on local builds MesonLocalOptions.mk + +# Some meson cache thing +.meson-subproject-wrap-hash.txt diff --git a/amex/gpio.c b/amex/gpio.c index 86eadadb..5d6ead14 100644 --- a/amex/gpio.c +++ b/amex/gpio.c @@ -1,5 +1,4 @@ #include -#include #include #include diff --git a/hooklib/meson.build b/hooklib/meson.build index 7d5e7b8c..e6908d6a 100644 --- a/hooklib/meson.build +++ b/hooklib/meson.build @@ -4,6 +4,7 @@ hooklib_lib = static_library( implicit_include_directories : false, dependencies : [ capnhook.get_variable('hook_dep'), + Ws2_32_lib ], sources : [ 'cursor.c', diff --git a/meson.build b/meson.build index 41b49f4e..40a99c47 100644 --- a/meson.build +++ b/meson.build @@ -83,6 +83,7 @@ dxguid_lib = cc.find_library('dxguid') xinput_lib = cc.find_library('xinput') pathcch_lib = cc.find_library('pathcch') imagehlp_lib = cc.find_library('imagehlp') +Ws2_32_lib = cc.find_library('Ws2_32') inc = include_directories('.') capnhook = subproject('capnhook') diff --git a/msvc-build.bat b/msvc-build.bat index ae060f06..fac39259 100644 --- a/msvc-build.bat +++ b/msvc-build.bat @@ -52,17 +52,16 @@ exit /b rem This should works for Visual Studio 2017+ :detect-visual-studio ( - rem Who the hell on earth is still using a 32bit Windows in 2024 - if "%ProgramFiles(x86)%"=="" ( - set VSWHERE="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" - ) else ( + rem Fall back to x86 program directory for MSVC standalone if it can't be found in x64, because even though it's x64 compilers, they install in x86 program files for whatever dumb reason + set VSWHERE="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" + if not exist %VSWHERE% ( set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ) if exist %VSWHERE% ( REM get vcvarsall by using vswhere set VSVARSALL="" - for /f "tokens=* usebackq" %%i in (`%VSWHERE% -find VC\Auxiliary\Build\vcvarsall.bat`) do set VSVARSALL="%%i" + for /f "tokens=* usebackq" %%i in (`%VSWHERE% -products * -find VC\Auxiliary\Build\vcvarsall.bat`) do set VSVARSALL="%%i" ) else ( REM fallback to old method set VSVARSALL="%VS_INSTALLATION%\VC\Auxiliary\Build\vcvarsall.bat" diff --git a/platform/system.c b/platform/system.c index a82c3265..dbc832f7 100644 --- a/platform/system.c +++ b/platform/system.c @@ -1,5 +1,4 @@ #include -#include #include #include diff --git a/unityhook/doorstop.c b/unityhook/doorstop.c index d2cbd5c4..04dee02e 100644 --- a/unityhook/doorstop.c +++ b/unityhook/doorstop.c @@ -5,6 +5,7 @@ // https://github.com/NeighTools/UnityDoorstop #include #include +#include #include #include