metamod-source/loader/test/AMBuilder
2025-03-16 12:42:30 -04:00

45 lines
1.6 KiB
Python

# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for cxx in MMS.all_targets:
name = 'test_loader'
binary = MMS.Program(cxx, name)
# NOTE: this macro isn't getting fed through for some reason
if binary.compiler.target.platform == 'windows' and binary.compiler.target.arch == 'x86_64':
binary.compiler.defines += ['WIN64']
# add some required defines for Linux builds
if binary.compiler.target.platform == 'linux' and binary.compiler.target.arch == 'x86':
binary.compiler.defines += ['LIB_PREFIX=""', 'LIB_SUFFIX="_i486.so"']
# add some required defines for Linux builds
if binary.compiler.target.platform == 'linux' and binary.compiler.target.arch == 'x86_64':
binary.compiler.defines += ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"']
# TODO: hack - something makes it try and compile with /SUBSYSTEM:WINDOWS which then causes it to complain that WinMain is missing
if binary.compiler.target.platform == 'windows':
binary.compiler.linkflags = ['Advapi32.lib', 'kernel32.lib', 'shell32.lib']
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'core'),
os.path.join(builder.sourcePath, 'core', 'sourcehook'),
os.path.join(builder.sourcePath, 'loader'),
]
if binary.compiler.version >= 'gcc-4.9':
binary.compiler.cxxflags += ['-fno-devirtualize']
if binary.compiler.version >= 'clang-2.9' or binary.compiler.version >= 'apple-clang-3.0':
binary.compiler.cxxflags += ['-Wno-null-dereference']
binary.sources += [
'main.cpp',
'../gamedll.cpp',
'../loader.cpp',
'../serverplugin.cpp',
'../utility.cpp',
'testdeterminebackends1.cpp',
]
builder.Add(binary)