sourcemod/extensions/geoip/AMBuilder
2018-12-05 01:14:06 -08:00

35 lines
1.2 KiB
Python

# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'geoip.ext', arch)
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
binary.compiler.cxxflags += ['-fno-rtti']
elif binary.compiler.family == 'msvc':
binary.compiler.cxxflags += ['/GR-']
binary.compiler.cxxflags.remove('/TP')
if builder.target.platform == 'windows':
binary.compiler.postlink += ['ws2_32.lib']
binary.compiler.includes += [
os.path.join(builder.sourcePath, 'extensions', 'geoip'),
os.path.join(builder.sourcePath, 'extensions', 'geoip', 'libmaxminddb', 'include'),
os.path.join(builder.sourcePath, 'extensions', 'geoip', 'libmaxminddb', 'src'),
]
# This is only defined in their headers for MSVC, else it would take from configure.
# We need to define manually since we're not using their build tools.
# TODO: parse from their file.
if not binary.compiler.like('msvc'):
binary.compiler.defines += ['PACKAGE_VERSION="1.3.2"']
binary.sources += [
'extension.cpp',
'../../public/smsdk_ext.cpp',
'libmaxminddb/src/data-pool.c',
'libmaxminddb/src/maxminddb.c',
]
SM.extensions += [builder.Add(binary)]