Enable ARC on all platforms

This commit is contained in:
Inori 2019-12-14 18:56:52 -05:00 committed by Inori
parent 21da5b74c0
commit 6e37aa15b3
3 changed files with 28 additions and 26 deletions

View file

@ -43,7 +43,10 @@ endif
# Suppress warnings # Suppress warnings
global_args += ['-Wno-non-virtual-dtor', '-Wno-reorder', '-Wno-uninitialized', '-Wno-unknown-pragmas'] global_args += ['-Wno-non-virtual-dtor', '-Wno-reorder', '-Wno-uninitialized', '-Wno-unknown-pragmas']
if compilers['objc'].get_id() == 'clang' 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 endif
if get_option('workdir_current') if get_option('workdir_current')
@ -66,22 +69,19 @@ if get_option('mk')
global_args += '-DMARIN' global_args += '-DMARIN'
endif endif
# Objectify our C
global_args += run_command(objfw,'--cppflags').stdout().split() global_args += run_command(objfw,'--cppflags').stdout().split()
add_project_arguments(run_command(objfw,'--objcflags').stdout().split(), language:'objc') 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']) add_project_link_arguments(run_command(objfw,'--libs','--ldflags').stdout().split(), language:['objc','objcpp'])
gc = get_option('gc_type') # Make sure to use ARC
if compilers['objc'].get_id() == 'clang'
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'])
endif
elif gc == 'arc'
add_project_arguments(run_command(objfw,'--arc').stdout().split(), language:['objc','objcpp']) add_project_arguments(run_command(objfw,'--arc').stdout().split(), language:['objc','objcpp'])
else if host_system != 'darwin'
add_project_arguments('-fobjc-'+get_option('gc_type'), language: ['objc', 'objcpp']) add_project_arguments('-fobjc-runtime=objfw', language:['objc','objcpp'])
endif endif
endif
subdir('src') subdir('src')
subdir('binding') subdir('binding')

View file

@ -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('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('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('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('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') option('cjk_fallback_font', type: 'boolean', value: false, description: 'Use WenQuanYi Micro Hei as the fallback font')

View file

@ -715,6 +715,8 @@ void FileSystem::openReadRaw(SDL_RWops &ops,
char* FileSystem::normalize(const char *pathname, bool preferred, bool absolute) char* FileSystem::normalize(const char *pathname, bool preferred, bool absolute)
{ {
char* ret = new char[512]; char* ret = new char[512];
@autoreleasepool
{
id str = [OFMutableString stringWithUTF8String:pathname]; id str = [OFMutableString stringWithUTF8String:pathname];
if (absolute) if (absolute)
@ -732,6 +734,7 @@ char* FileSystem::normalize(const char *pathname, bool preferred, bool absolute)
} }
#endif #endif
strncpy(ret, [[str stringByStandardizingPath] UTF8String], 512); strncpy(ret, [[str stringByStandardizingPath] UTF8String], 512);
}
return ret; return ret;
} }