From 4212fb88c84d5d035b126e921c85310f04c87a1b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 23 Feb 2015 20:21:17 -0800 Subject: [PATCH] Build the debug spshell as part of AMBuild. --- sourcepawn/jit/AMBuilder | 55 ++++++++++++++++++++++++---------- sourcepawn/jit/dll_exports.cpp | 1 - 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/sourcepawn/jit/AMBuilder b/sourcepawn/jit/AMBuilder index b00f2133..7fb74fb4 100644 --- a/sourcepawn/jit/AMBuilder +++ b/sourcepawn/jit/AMBuilder @@ -1,8 +1,7 @@ # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python: import os -binary = SM.Library(builder, 'sourcepawn.jit.x86') -binary.compiler.includes += [ +Includes = [ os.path.join(SM.mms_root, 'core', 'sourcehook'), os.path.join(builder.sourcePath, 'sourcepawn', 'jit'), os.path.join(builder.sourcePath, 'sourcepawn', 'jit', 'x86'), @@ -17,21 +16,23 @@ binary.compiler.includes += [ os.path.join(builder.sourcePath, 'sourcepawn', 'include'), ] -if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang': - binary.compiler.cxxflags += ['-fno-rtti'] -elif binary.compiler.vendor == 'msvc': - binary.compiler.cxxflags += ['/GR-'] +def setup(binary): + compiler = binary.compiler + compiler.includes += Includes + if compiler.vendor == 'gcc' or compiler.vendor == 'clang': + compiler.cxxflags += ['-fno-rtti'] + elif binary.compiler.vendor == 'msvc': + compiler.cxxflags += ['/GR-'] + + if binary.compiler.cc.behavior == 'msvc': + compiler.cxxflags.remove('/TP') + return binary -if builder.target_platform == 'linux': - binary.compiler.postlink += ['-lpthread', '-lrt'] - -if binary.compiler.cc.behavior == 'msvc': - binary.compiler.cxxflags.remove('/TP') - -binary.sources += [ +# Build the static library. +library = setup(builder.compiler.StaticLibrary('sourcepawn')) +library.sources += [ 'plugin-runtime.cpp', 'compiled-function.cpp', - 'dll_exports.cpp', 'engine2.cpp', 'sp_vm_basecontext.cpp', 'sp_vm_engine.cpp', @@ -56,4 +57,28 @@ binary.sources += [ '../../knight/shared/KeCodeAllocator.cpp', '../../public/jit/x86/assembler-x86.cpp', ] -SM.binaries += [builder.Add(binary)] +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 builder.target_platform == 'linux': + shell.compiler.postlink += ['-lpthread', '-lrt'] +builder.Add(shell) diff --git a/sourcepawn/jit/dll_exports.cpp b/sourcepawn/jit/dll_exports.cpp index 9a7bc354..55495425 100644 --- a/sourcepawn/jit/dll_exports.cpp +++ b/sourcepawn/jit/dll_exports.cpp @@ -32,7 +32,6 @@ #include #include #include -#include "x86/jit_x86.h" #include "dll_exports.h" #include "sp_vm_engine.h" #include "engine2.h"