diff --git a/meson.build b/meson.build index 3bb38b19..59f9960a 100644 --- a/meson.build +++ b/meson.build @@ -43,7 +43,10 @@ endif # Suppress warnings global_args += ['-Wno-non-virtual-dtor', '-Wno-reorder', '-Wno-uninitialized', '-Wno-unknown-pragmas'] if compilers['objc'].get_id() == 'clang' - global_args += ['-Wno-undefined-var-template','-Wno-delete-non-abstract-non-virtual-dtor'] + global_args += ['-Wno-undefined-var-template'] + if host_system == 'darwin' or host_system == 'windows' + global_args += '-Wno-delete-non-abstract-non-virtual-dtor' + endif endif if get_option('workdir_current') @@ -66,23 +69,20 @@ if get_option('mk') global_args += '-DMARIN' endif +# Objectify our C global_args += run_command(objfw,'--cppflags').stdout().split() add_project_arguments(run_command(objfw,'--objcflags').stdout().split(), language:'objc') add_project_link_arguments(run_command(objfw,'--libs','--ldflags').stdout().split(), language:['objc','objcpp']) -gc = get_option('gc_type') - -if gc == 'auto' - gc = compilers['objc'].first_supported_argument('-fobjc-gc', '-fobjc-gc-only', '-fobjc-arc') - if gc != [] - add_project_arguments(gc, language: ['objc','objcpp']) +# Make sure to use ARC +if compilers['objc'].get_id() == 'clang' + add_project_arguments(run_command(objfw,'--arc').stdout().split(), language:['objc','objcpp']) + if host_system != 'darwin' + add_project_arguments('-fobjc-runtime=objfw', language:['objc','objcpp']) endif -elif gc == 'arc' - add_project_arguments(run_command(objfw,'--arc').stdout().split(), language: ['objc','objcpp']) -else - add_project_arguments('-fobjc-'+get_option('gc_type'), language: ['objc', 'objcpp']) endif + subdir('src') subdir('binding') subdir('shader') diff --git a/meson_options.txt b/meson_options.txt index 7c085af1..efbb0fb8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,7 +3,6 @@ option('mk', type: 'boolean', value: false, description: 'Build to fit Marin\'s option('ruby_lib', type: 'string', value: 'ruby', description: 'Name of the Ruby library') option('console', type: 'boolean', value: true, description: 'Whether to debug information in the console') option('macos_min_version', type: 'string', value: '10.10', description: 'Minimum macOS system version to support') -option('gc_type', type: 'combo', choices: ['gc','gc-only','arc', 'auto', 'none'], value: 'auto', description: 'Which method of garbage collection to utilize') option('shared_fluid', type: 'boolean', value: false, description: 'Dynamically link fluidsynth at build time') option('cjk_fallback_font', type: 'boolean', value: false, description: 'Use WenQuanYi Micro Hei as the fallback font') diff --git a/src/filesystem.mm b/src/filesystem.mm index 1b1bceec..58acb755 100644 --- a/src/filesystem.mm +++ b/src/filesystem.mm @@ -715,23 +715,26 @@ void FileSystem::openReadRaw(SDL_RWops &ops, char* FileSystem::normalize(const char *pathname, bool preferred, bool absolute) { char* ret = new char[512]; - id str = [OFMutableString stringWithUTF8String:pathname]; - - if (absolute) + @autoreleasepool { - OFURL* base = [OFURL fileURLWithPath:[[OFFileManager defaultManager] currentDirectoryPath]]; - OFURL* purl = [OFURL fileURLWithPath:str]; - OFString* path = [[OFURL URLWithString:[purl string] relativeToURL:base] path]; - str = [OFMutableString stringWithString:path]; - } + id str = [OFMutableString stringWithUTF8String:pathname]; -#ifdef __WIN32__ - if (preferred) - { - [str replaceOccurrencesOfString:@"/" withString:@"\\"]; + if (absolute) + { + OFURL* base = [OFURL fileURLWithPath:[[OFFileManager defaultManager] currentDirectoryPath]]; + OFURL* purl = [OFURL fileURLWithPath:str]; + OFString* path = [[OFURL URLWithString:[purl string] relativeToURL:base] path]; + str = [OFMutableString stringWithString:path]; + } + + #ifdef __WIN32__ + if (preferred) + { + [str replaceOccurrencesOfString:@"/" withString:@"\\"]; + } + #endif + strncpy(ret, [[str stringByStandardizingPath] UTF8String], 512); } -#endif - strncpy(ret, [[str stringByStandardizingPath] UTF8String], 512); return ret; }