# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python: import os Includes = [ os.path.join(SM.mms_root, 'core', 'sourcehook'), os.path.join(builder.sourcePath, 'sourcepawn', 'jit'), os.path.join(builder.sourcePath, 'public'), os.path.join(builder.sourcePath, 'public', 'sourcepawn'), os.path.join(builder.sourcePath, 'public', 'amtl'), os.path.join(builder.sourcePath, 'public', 'jit'), os.path.join(builder.sourcePath, 'public', 'jit', 'x86'), # The include path for SP v2 stuff. os.path.join(builder.sourcePath, 'sourcepawn', 'include'), ] def setup(binary): compiler = binary.compiler compiler.includes += Includes if compiler.vendor == 'gcc' or compiler.vendor == 'clang': compiler.cxxflags += [ '-fno-rtti', '-Wno-invalid-offsetof', ] elif binary.compiler.vendor == 'msvc': compiler.cxxflags += ['/GR-'] if binary.compiler.cc.behavior == 'msvc': compiler.cxxflags.remove('/TP') return binary # Build the static library. library = setup(builder.compiler.StaticLibrary('sourcepawn')) library.sources += [ 'api.cpp', 'code-allocator.cpp', 'code-stubs.cpp', 'compiled-function.cpp', 'debug-trace.cpp', 'environment.cpp', 'file-utils.cpp', 'opcodes.cpp', 'plugin-context.cpp', 'plugin-runtime.cpp', 'scripted-invoker.cpp', 'smx-v1-image.cpp', 'watchdog_timer.cpp', 'x86/code-stubs-x86.cpp', 'x86/jit_x86.cpp', 'x86/x86-utils.cpp', 'zlib/adler32.c', 'zlib/compress.c', 'zlib/crc32.c', 'zlib/deflate.c', 'zlib/gzio.c', 'zlib/infback.c', 'zlib/inffast.c', 'zlib/inflate.c', 'zlib/inftrees.c', 'zlib/trees.c', 'zlib/uncompr.c', 'zlib/zutil.c', 'md5/md5.cpp', '../../public/jit/x86/assembler-x86.cpp', ] libsourcepawn = builder.Add(library).binary # Build the dynamically-linked library. dll = setup(SM.Library(builder, 'sourcepawn.jit.x86')) dll.compiler.linkflags[0:0] = [libsourcepawn] dll.sources += [ 'dll_exports.cpp' ] if builder.target_platform == 'linux': dll.compiler.postlink += ['-lpthread', '-lrt'] SM.binaries += [builder.Add(dll)] # Build the debug shell. shell = setup(SM.Program(builder, 'spshell')) shell.compiler.defines += ['SPSHELL'] shell.compiler.linkflags[0:0] = [libsourcepawn] shell.sources += [ 'dll_exports.cpp' ] if shell.compiler.cc.behavior == 'msvc': shell.compiler.linkflags.remove('/SUBSYSTEM:WINDOWS') shell.compiler.linkflags.append('/SUBSYSTEM:CONSOLE') if builder.target_platform == 'linux': shell.compiler.postlink += ['-lpthread', '-lrt'] builder.Add(shell)