Port simple C++ build scripts to AMBuild 2 (bug 5997 part 1, r=ds).

This commit is contained in:
David Anderson
2013-12-30 17:50:56 -05:00
parent b749bbf42b
commit e1a820dcf9
19 changed files with 955 additions and 1134 deletions
+46 -52
View File
@@ -1,56 +1,50 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultCompiler()
base = AMBuild.sourceFolder
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'sourcepawn', 'jit'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'sourcepawn', 'jit', 'x86'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'sourcepawn'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'amtl'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'jit'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'jit', 'x86'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'knight', 'shared'))
binary = SM.Library(builder, 'sourcepawn.jit.x86')
binary.compiler.includes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
os.path.join(builder.sourcePath, 'sourcepawn', 'jit'),
os.path.join(builder.sourcePath, 'sourcepawn', 'jit', 'x86'),
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'),
os.path.join(builder.sourcePath, 'knight', 'shared'),
]
if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'].append('-lpthread')
compiler['POSTLINKFLAGS'].append('-lrt')
if AMBuild.target['platform'] == 'darwin':
compiler['POSTLINKFLAGS'].append('-lpthread')
compiler['POSTLINKFLAGS'].append('-ldl')
extension = AMBuild.AddJob('sourcepawn.jit.x86')
binary = Cpp.LibraryBuilder('sourcepawn.jit.x86', AMBuild, extension, compiler)
binary.AddSourceFiles('sourcepawn/jit', [
'BaseRuntime.cpp',
'engine2.cpp',
'dll_exports.cpp',
'jit_function.cpp',
'sp_vm_basecontext.cpp',
'sp_vm_engine.cpp',
'sp_vm_function.cpp',
'opcodes.cpp',
'interpreter.cpp',
'watchdog_timer.cpp',
'x86/jit_x86.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',
'../../knight/shared/KeCodeAllocator.cpp',
'../../public/jit/x86/assembler-x86.cpp'
])
SM.AutoVersion('sourcepawn/jit', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
if builder.target_platform is 'linux':
binary.compiler.postlink += ['-lpthread', '-lrt']
elif builder.target_platform is 'darwin':
binary.compiler.postlink += ['-lpthread', '-ldl']
binary.sources += [
'BaseRuntime.cpp',
'engine2.cpp',
'dll_exports.cpp',
'jit_function.cpp',
'sp_vm_basecontext.cpp',
'sp_vm_engine.cpp',
'sp_vm_function.cpp',
'opcodes.cpp',
'interpreter.cpp',
'watchdog_timer.cpp',
'x86/jit_x86.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',
'../../knight/shared/KeCodeAllocator.cpp',
'../../public/jit/x86/assembler-x86.cpp',
]
SM.binaries += [builder.Add(binary)]