Get parity with makefile flags.

This commit is contained in:
David Anderson 2014-02-08 14:49:03 -08:00
parent ff7277048f
commit d1ee3b0780
3 changed files with 38 additions and 5 deletions

View File

@ -101,21 +101,53 @@ class AMXXConfig(object):
have_gcc = cxx.name == 'gcc'
have_clang = cxx.name == 'clang'
if have_clang or (have_gcc and cxx.majorVersion >= 4):
cfg.cflags += ['-fvisibility=hidden']
cfg.cxxflags += ['-fvisibility-inlines-hidden']
if (have_gcc and cxx.minorVersion >= 7) or (have_clang and cxx.majorVersion >= 3):
cfg.cxxflags += ['-Wno-delete-non-virtual-dtor']
if have_gcc:
cfg.cflags += ['-Wno-parentheses']
elif have_clang:
cfg.cflags += ['-Wno-logical-op-parentheses']
cfg.cxxflags += [
'-fno-exceptions',
'-fno-rtti',
]
# Optimization
if builder.options.opt == '1':
cfg.defines += ['NDEBUG']
if cxx.behavior == 'gcc':
cfg.cflags += ['-O2']
elif cxx.behavior == 'msvc':
cfg.cflags += ['/Ox']
cfg.linkflags += ['/OPT:ICF', '/OPT:REF']
# Debugging
if builder.options.debug == '1':
cfg.defines += ['DEBUG', '_DEBUG']
if cxx.behavior == 'msvc':
cfg.cflags += ['/Od', '/RTC1']
# This needs to be after our optimization flags which could otherwise disable it.
if cxx.name == 'msvc':
# Don't omit the frame pointer.
cfg.cflags += ['/Oy-']
# Platform-specifics
if builder.target_platform == 'linux':
cfg.defines += ['_LINUX', 'POSIX', 'LINUX']
cfg.postlink += ['-ldl']
if cxx.name == 'gcc':
cfg.linkflags += ['-static-libgcc']
cfg.postlink += ['-static-libgcc']
elif cxx.name == 'clang':
cfg.linkflags += ['-lgcc_eh']
cfg.postlink += ['-lgcc_eh']
elif builder.target_platform == 'mac':
cfg.defines += ['OSX', '_OSX', 'POSIX']
cfg.linkflags += [
cfg.postlink += [
'-mmacosx-version-min=10.5',
'-arch', 'i386',
'-lstdc++',

View File

@ -6,6 +6,7 @@ binary = AMXX.Program(builder, 'amxxpc')
binary.compiler.defines += [
'AMX_ANSIONLY',
]
binary.compiler.cxxflags.remove('-fno-exceptions')
if builder.target_platform == 'linux':
binary.compiler.postlink += [

View File

@ -16,14 +16,14 @@ if AMXX.mysql_path:
]
if builder.target_platform is 'linux' or builder.target_platform is 'mac':
binary.compiler.postlink += [
binary.compiler.linkflags += [
os.path.join(AMXX.mysql_path, 'lib', 'libmysqlclient_r.a'),
'-lz',
'-lpthread',
'-lm'
]
elif builder.target_platform is 'windows':
binary.compiler.postlink += [
binary.compiler.linkflags += [
os.path.join(AMXX.mysql_path, 'lib', 'opt', 'mysqlclient.lib'),
os.path.join(AMXX.mysql_path, 'lib', 'opt', 'zlib.lib'),
'wsock32.lib'