From d1ee3b078001fc2bd5f0454cf457897cd0a0a817 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 8 Feb 2014 14:49:03 -0800 Subject: [PATCH] Get parity with makefile flags. --- AMBuildScript | 38 +++++++++++++++++++++++++++++++++++--- compiler/amxxpc/AMBuilder | 1 + dlls/mysqlx/AMBuilder | 4 ++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/AMBuildScript b/AMBuildScript index a660fb46..b205b941 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -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++', diff --git a/compiler/amxxpc/AMBuilder b/compiler/amxxpc/AMBuilder index 00c36774..6d26f9e0 100644 --- a/compiler/amxxpc/AMBuilder +++ b/compiler/amxxpc/AMBuilder @@ -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 += [ diff --git a/dlls/mysqlx/AMBuilder b/dlls/mysqlx/AMBuilder index 8e590054..d62905b9 100644 --- a/dlls/mysqlx/AMBuilder +++ b/dlls/mysqlx/AMBuilder @@ -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'