windows: use 'windows' subsystem for release build

Only show the console on debug builds.

Fixes item 2 in #177.
This commit is contained in:
Nunuhara Cabbage
2024-08-25 10:10:46 -07:00
parent 486d89669f
commit 8cc2334692
4 changed files with 13 additions and 20 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ _Noreturn void vm_reset(void);
extern bool vm_reset_once;
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(RELEASE)
// Report the error with a message box and exit.
#define VM_ERROR ERROR
#else
+4
View File
@@ -4,6 +4,10 @@ project('system4', 'c',
add_project_arguments('-D_DEFAULT_SOURCE', language : 'c')
add_project_arguments('-DXSYS4_DATA_DIR="' + get_option('prefix') / get_option('datadir') / 'xsystem4"', language : 'c')
if get_option('buildtype').startswith('release')
add_project_arguments('-DRELEASE', language : 'c')
endif
static_libs = false
if host_machine.system() == 'windows'
static_libs = true
+6
View File
@@ -190,9 +190,15 @@ if host_machine.system() == 'windows'
static_link_args = ['-static', '-lstdc++']
endif
winsys = 'console'
if get_option('buildtype').startswith('release')
winsys = 'windows'
endif
executable('xsystem4', xsystem4,
dependencies : xsystem4_deps,
c_args : ['-Wno-unused-parameter'],
link_args : static_link_args,
include_directories : incdir,
win_subsystem : winsys,
install : true)
+2 -19
View File
@@ -402,31 +402,14 @@ enum {
#endif
};
#ifdef _WIN32
static void windows_error_handler(const char *msg)
{
sys_warning("%s", msg);
sys_warning("Press the enter key to exit...\n");
getchar();
sys_exit(1);
}
#endif
#ifdef __ANDROID__
static void android_error_handler(const char *msg)
static void error_handler(const char *msg)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "xsystem4", msg, NULL);
}
#endif
int main(int argc, char *argv[])
{
#ifdef _WIN32
sys_error_handler = windows_error_handler;
#endif
#ifdef __ANDROID__
sys_error_handler = android_error_handler;
#endif
sys_error_handler = error_handler;
initialize_instructions();
char *ainfile;