CREATE_PROJECT: Set MSVC default subsystem to CONSOLE

MSVC builds now use the CONSOLE subsystem by default,
just like all our other Windows builds.

--use-windows-subsystem is now available to generate
projects with the WINDOWS subsystem.
This commit is contained in:
sluicebox 2023-11-15 14:30:10 -08:00
parent 61cca4f30e
commit 335f90b136
3 changed files with 9 additions and 3 deletions

View File

@ -303,6 +303,8 @@ int main(int argc, char *argv[]) {
setup.useWindowsUnicode = true;
} else if (!std::strcmp(argv[i], "--use-windows-ansi")) {
setup.useWindowsUnicode = false;
} else if (!std::strcmp(argv[i], "--use-windows-subsystem")) {
setup.useWindowsSubsystem = true;
} else if (!std::strcmp(argv[i], "--use-xcframework")) {
setup.useXCFramework = true;
} else if (!std::strcmp(argv[i], "--vcpkg")) {
@ -753,6 +755,7 @@ void displayHelp(const char *exe) {
" (default: true)\n"
" --use-windows-ansi Use Windows ANSI APIs\n"
" (default: false)\n"
" --use-windows-subsystem Use Windows subsystem instead of Console\n"
" --libs-path path Specify the path of pre-built libraries instead of using the\n"
" " LIBS_DEFINE " environment variable\n "
" --vcpkg Use vcpkg-provided libraries instead of pre-built libraries\n"

View File

@ -248,6 +248,7 @@ struct BuildSetup {
bool useSDL2; ///< Whether to use SDL2 or not.
bool useStaticDetection; ///< Whether to link detection features inside the executable or not.
bool useWindowsUnicode; ///< Whether to use Windows Unicode APIs or ANSI APIs.
bool useWindowsSubsystem; ///< Whether to use Windows subsystem or Console subsystem (default: Console)
bool useXCFramework; ///< Whether to use Apple XCFrameworks instead of static libraries
bool useVcpkg; ///< Whether to load libraries from vcpkg or SCUMMVM_LIBS
@ -259,6 +260,7 @@ struct BuildSetup {
useSDL2 = true;
useStaticDetection = true;
useWindowsUnicode = true;
useWindowsSubsystem = false;
useXCFramework = false;
useVcpkg = false;
}

View File

@ -416,10 +416,11 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea
<< "\t\t</ClCompile>\n"
<< "\t\t<Link>\n"
<< "\t\t\t<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\n";
if (!setup.featureEnabled("text-console") && !setup.devTools && !setup.tests) {
properties << "\t\t\t<SubSystem>Windows</SubSystem>\n";
} else {
// console subsystem is required for text-console, tools, and tests
if (!setup.useWindowsSubsystem || setup.featureEnabled("text-console") || setup.devTools || setup.tests) {
properties << "\t\t\t<SubSystem>Console</SubSystem>\n";
} else {
properties << "\t\t\t<SubSystem>Windows</SubSystem>\n";
}
if (!setup.devTools && !setup.tests)