Added freebsd specific configuration to fix issues of detection on freebsd

pull/517/head
SeleDreams 2021-02-21 00:23:06 +01:00
parent eafe6d9622
commit 45fef69aca
1 changed files with 7 additions and 5 deletions

View File

@ -58,6 +58,8 @@ def add_sources(sources, dir, extension):
# This is used if no `platform` argument is passed # This is used if no `platform` argument is passed
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
host_platform = 'linux' host_platform = 'linux'
elif sys.platform.startswith('freebsd'):
host_platform = 'freebsd'
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
host_platform = 'osx' host_platform = 'osx'
elif sys.platform == 'win32' or sys.platform == 'msys': elif sys.platform == 'win32' or sys.platform == 'msys':
@ -84,7 +86,7 @@ opts.Add(EnumVariable(
'platform', 'platform',
'Target platform', 'Target platform',
host_platform, host_platform,
allowed_values=('linux', 'osx', 'windows', 'android', 'ios'), allowed_values=('linux', 'freebsd', 'osx', 'windows', 'android', 'ios'),
ignorecase=2 ignorecase=2
)) ))
opts.Add(EnumVariable( opts.Add(EnumVariable(
@ -95,7 +97,7 @@ opts.Add(EnumVariable(
)) ))
opts.Add(BoolVariable( opts.Add(BoolVariable(
'use_llvm', 'use_llvm',
'Use the LLVM compiler - only effective when targeting Linux', 'Use the LLVM compiler - only effective when targeting Linux or FreeBSD',
False False
)) ))
opts.Add(BoolVariable( opts.Add(BoolVariable(
@ -185,7 +187,7 @@ if host_platform == 'windows' and env['platform'] != 'android':
opts.Update(env) opts.Update(env)
if env['platform'] == 'linux': if env['platform'] == 'linux' or env['platform'] == 'freebsd':
if env['use_llvm']: if env['use_llvm']:
env['CXX'] = 'clang++' env['CXX'] = 'clang++'
@ -278,7 +280,7 @@ elif env['platform'] == 'windows':
elif env['target'] == 'release': elif env['target'] == 'release':
env.Append(CCFLAGS=['/O2', '/EHsc', '/DNDEBUG', '/MD']) env.Append(CCFLAGS=['/O2', '/EHsc', '/DNDEBUG', '/MD'])
elif host_platform == 'linux' or host_platform == 'osx': elif host_platform == 'linux' or host_platform == 'freebsd' or host_platform == 'osx':
# Cross-compilation using MinGW # Cross-compilation using MinGW
if env['bits'] == '64': if env['bits'] == '64':
env['CXX'] = 'x86_64-w64-mingw32-g++' env['CXX'] = 'x86_64-w64-mingw32-g++'
@ -300,7 +302,7 @@ elif env['platform'] == 'windows':
env["SPAWN"] = mySpawn env["SPAWN"] = mySpawn
# Native or cross-compilation using MinGW # Native or cross-compilation using MinGW
if host_platform == 'linux' or host_platform == 'osx' or env['use_mingw']: if host_platform == 'linux' or host_platform == 'freebsd' or host_platform == 'osx' or env['use_mingw']:
# These options are for a release build even using target=debug # These options are for a release build even using target=debug
env.Append(CCFLAGS=['-O3', '-std=c++14', '-Wwrite-strings']) env.Append(CCFLAGS=['-O3', '-std=c++14', '-Wwrite-strings'])
env.Append(LINKFLAGS=[ env.Append(LINKFLAGS=[