diff --git a/include/vm.h b/include/vm.h index b156d90..6e76e35 100644 --- a/include/vm.h +++ b/include/vm.h @@ -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 diff --git a/meson.build b/meson.build index a3307d3..a59f42e 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/src/meson.build b/src/meson.build index f54fa19..35d8265 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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) diff --git a/src/system4.c b/src/system4.c index bb979ee..622aa10 100644 --- a/src/system4.c +++ b/src/system4.c @@ -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;