proper link/build options for MinGW + reorder them for consistency

This commit is contained in:
otavepto 2024-05-28 22:29:00 +03:00
parent 6bba1efc9e
commit 5863d61665

View File

@ -418,41 +418,30 @@ filter {} -- reset the filter and remove all active keywords
-- MinGw on Windows -- MinGw on Windows
--------- ---------
-- MinGw on Windows common compiler/linker options
filter { "system:windows", "action:gmake*", } filter { "system:windows", "action:gmake*", }
buildoptions { -- MinGw on Windows common compiler/linker options
-- MinGw on Windows cannot compile 'creatwth.cpp' from Detours lib (error: 'DWordMult' was not declared in this scope)
-- because intsafe.h isn't included by default
"-include intsafe.h",
}
-- source: https://gcc.gnu.org/onlinedocs/gcc/Cygwin-and-MinGW-Options.html -- source: https://gcc.gnu.org/onlinedocs/gcc/Cygwin-and-MinGW-Options.html
linkoptions { buildoptions {
-- I don't know why but if libgcc/libstdc++ as well as pthreads are not statically linked
-- none of the output binary .dlls will reach their DllMain() in x64dbg
-- even when they're force-loaded in any process they immediately unload
"-static",
-- from docs: "specifies that the typical Microsoft Windows predefined macros are to be set in the pre-processor, -- from docs: "specifies that the typical Microsoft Windows predefined macros are to be set in the pre-processor,
-- but does not influence the choice of runtime library/startup code" -- but does not influence the choice of runtime library/startup code"
-- optional really -- optional really
'-mwin32', '-mwin32',
} }
-- MinGw on Windows common defines -- MinGw on Windows common defines
-- MinGw on Windows doesn't have a definition for '_S_IFDIR' which is microsoft specific: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions -- MinGw on Windows doesn't have a definition for '_S_IFDIR' which is microsoft specific: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions
-- this is used in 'base.cpp' -> if ( buffer.st_mode & _S_IFDIR) -- this is used in 'base.cpp' -> if ( buffer.st_mode & _S_IFDIR)
-- instead microsoft has an alternative but only enabled when _CRT_DECLARE_NONSTDC_NAMES is defined -- instead microsoft has an alternative but only enabled when _CRT_DECLARE_NONSTDC_NAMES is defined
-- https://learn.microsoft.com/en-us/cpp/c-runtime-library/compatibility -- https://learn.microsoft.com/en-us/cpp/c-runtime-library/compatibility
defines { defines {
-- '_CRT_NONSTDC_NO_WARNINGS', -- '_CRT_NONSTDC_NO_WARNINGS',
'_CRT_DECLARE_NONSTDC_NAMES', '_CRT_DECLARE_NONSTDC_NAMES',
} }
-- MinGw on Windows common libs to link linkoptions {
-- links { -- I don't know why but if libgcc/libstdc++ as well as pthreads are not statically linked
-- -- CoreLibraryDependencies, copied from VS 2022 -- none of the output binary .dlls will reach their DllMain() in x64dbg
-- "kernel32", "user32", "gdi32", "winspool", "comdlg32", "advapi32", "shell32", "ole32", "oleaut32", "uuid", "odbc32", "odbccp32", -- even when they're force-loaded in any process they immediately unload
-- 'Xinput', "-static",
-- -- 'mingw32', 'gcc', 'msvcrt', 'mingwex', }
-- 'ucrt', 'libstdc++',
-- }