Add build option for objc GC type

This commit is contained in:
Inori 2019-12-14 16:00:05 -05:00
parent 4348462d84
commit 6e078adeff
3 changed files with 19 additions and 19 deletions

View file

@ -65,8 +65,10 @@ 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'])
if compilers['objc'].get_id() == 'clang'
if (compilers['objc'].get_id() == 'clang' and get_option('gc_type') == 'arc' and host_machine.cpu_family() == 'x86_64')
add_project_arguments(run_command(objfw,'--arc').stdout().split(), language: ['objc','objcpp'])
else
add_project_arguments('-fobjc-gc', language: ['objc', 'objcpp'])
endif
subdir('src')

View file

@ -3,6 +3,7 @@ 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','arc'], value: 'arc', 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')

View file

@ -714,28 +714,25 @@ void FileSystem::openReadRaw(SDL_RWops &ops,
// SDL_SaveBMP wants absolute paths
char* FileSystem::normalize(const char *pathname, bool preferred, bool absolute)
{
@autoreleasepool
{
char* ret = new char[512];
id str = [OFMutableString stringWithUTF8String:pathname];
char* ret = new char[512];
id str = [OFMutableString stringWithUTF8String:pathname];
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];
}
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);
return ret;
if (preferred)
{
[str replaceOccurrencesOfString:@"/" withString:@"\\"];
}
#endif
strncpy(ret, [[str stringByStandardizingPath] UTF8String], 512);
return ret;
}
bool FileSystem::exists(const char *filename)