Port AMBuild scripts to Windows.

Former-commit-id: 9af9b5f205cfd588a16e1164bd033c22ce2107fc
This commit is contained in:
David Anderson 2014-02-08 16:09:29 -08:00
parent bd586d37e6
commit 922b4802f1
7 changed files with 72 additions and 5 deletions

View File

@ -117,6 +117,42 @@ class AMXXConfig(object):
'-fno-exceptions',
'-fno-rtti',
]
elif cxx.name == 'msvc':
if builder.options.debug == '1':
cfg.cflags += ['/MTd']
cfg.linkflags += ['/NODEFAULTLIB:libcmt']
else:
cfg.cflags += ['/MT']
cfg.defines += [
'_CRT_SECURE_NO_DEPRECATE',
'_CRT_SECURE_NO_WARNINGS',
'_CRT_NONSTDC_NO_DEPRECATE',
'_ITERATOR_DEBUG_LEVEL=0',
]
cfg.cflags += [
'/W3',
]
cfg.cxxflags += [
'/EHsc',
'/GR-',
'/TP',
]
cfg.linkflags += [
'/MACHINE:X86',
'/SUBSYSTEM:WINDOWS',
'kernel32.lib',
'user32.lib',
'gdi32.lib',
'winspool.lib',
'comdlg32.lib',
'advapi32.lib',
'shell32.lib',
'ole32.lib',
'oleaut32.lib',
'uuid.lib',
'odbc32.lib',
'odbccp32.lib',
]
# Optimization
if builder.options.opt == '1':

View File

@ -23,6 +23,13 @@ elif builder.target_platform == 'linux':
binary.Dep('JIT/natives-x86.o'),
binary.Dep('JIT/helpers-x86.o'),
]
elif builder.target_platform == 'windows':
jit_objects = [
binary.Dep('JIT/amxexecn.obj'),
binary.Dep('JIT/amxjitsn.obj'),
binary.Dep('JIT/helpers-x86.obj'),
binary.Dep('JIT/natives-x86.obj'),
]
binary.compiler.linkflags += jit_objects

View File

@ -6,6 +6,8 @@ binary = AMXX.Program(builder, 'amxxpc')
binary.compiler.defines += [
'AMX_ANSIONLY',
]
if builder.target_platform != 'windows':
binary.compiler.cxxflags.remove('-fno-exceptions')
if builder.target_platform == 'linux':
@ -16,7 +18,10 @@ if builder.target_platform == 'linux':
elif builder.target_platform == 'mac':
binary.compiler.postlink += [binary.Dep('libz-darwin.a')]
elif builder.target_platform == 'windows':
binary.compiler.postlink += [binary.Dep('zlib.lib')]
binary.compiler.defines += ['_MBCS']
binary.compiler.linkflags += [binary.Dep('zlib.lib')]
binary.compiler.linkflags.remove('/SUBSYSTEM:WINDOWS')
binary.compiler.linkflags.append('/SUBSYSTEM:CONSOLE')
binary.sources = [
'amx.cpp',

View File

@ -9,4 +9,7 @@ binary.sources = [
'geoip_amxx.cpp',
]
if builder.target_platform == 'windows':
binary.compiler.postlink += ['ws2_32.lib']
AMXX.modules += [builder.Add(binary)]

View File

@ -10,6 +10,8 @@ elif builder.target_platform == 'mac':
elif builder.target_platform == 'windows':
binary.compiler.postlink += [binary.Dep('lib_win\\pcre.lib')]
binary.compiler.defines += ['PCRE_STATIC']
binary.sources = [
'sdk/amxxmodule.cpp',
'module.cpp',

View File

@ -8,4 +8,7 @@ binary.sources = [
'sockets.cpp',
]
if builder.target_platform == 'windows':
binary.compiler.postlink += ['wsock32.lib', 'ws2_32.lib']
AMXX.modules += [builder.Add(binary)]

View File

@ -5,6 +5,7 @@ binary = AMXX.MetaModule(builder, 'sqlite')
binary.compiler.cxxincludes += [
os.path.join(builder.currentSourcePath, 'sqlitepp'),
os.path.join(builder.currentSourcePath, 'thread'),
os.path.join(builder.currentSourcePath, 'sqlite-source'),
]
binary.compiler.defines += [
'SM_DEFAULT_THREADER',
@ -14,7 +15,7 @@ binary.compiler.defines += [
if builder.target_platform == 'linux':
binary.compiler.postlink += ['-lpthread']
binary.sources = [
binary.sources += [
'basic_sql.cpp',
'handles.cpp',
'module.cpp',
@ -23,7 +24,6 @@ binary.sources = [
'oldcompat_sql.cpp',
'thread/BaseWorker.cpp',
'thread/ThreadWorker.cpp',
'thread/PosixThreads.cpp',
'sqlitepp/SqliteQuery.cpp',
'sqlitepp/SqliteResultSet.cpp',
'sqlitepp/SqliteDatabase.cpp',
@ -47,7 +47,6 @@ binary.sources = [
'sqlite-source/main.c',
'sqlite-source/opcodes.c',
'sqlite-source/os.c',
'sqlite-source/os_unix.c',
'sqlite-source/pager.c',
'sqlite-source/parse.c',
'sqlite-source/pragma.c',
@ -71,4 +70,16 @@ binary.sources = [
'sqlite-source/where.c',
]
if builder.target_platform == 'windows':
binary.sources += [
'thread/WinThreads.cpp',
'sqlite-source/os_win.c',
]
else:
binary.sources += [
'thread/PosixThreads.cpp',
'sqlite-source/os_unix.c',
]
AMXX.modules += [builder.Add(binary)]