Port plugin building to AMBuild.

Former-commit-id: 9ac73de5b247da341b0b4cdf00ec3c7e0472be82
This commit is contained in:
David Anderson 2014-02-08 12:42:00 -08:00
parent c4e90ce865
commit ad36859607
8 changed files with 125 additions and 2 deletions

View File

@ -5,7 +5,9 @@ class AMXXConfig(object):
def __init__(self): def __init__(self):
self.binaries = [] self.binaries = []
self.modules = [] self.modules = []
self.plugins = {}
self.libpc300 = None self.libpc300 = None
self.amxxpc = None
self.metamod_path = None self.metamod_path = None
self.hlsdk_path = None self.hlsdk_path = None
self.mysql_path = None self.mysql_path = None
@ -253,6 +255,7 @@ builder.RunBuildScripts(
'dlls/tfcx/AMBuilder', 'dlls/tfcx/AMBuilder',
'dlls/ts/tsfun/AMBuilder', 'dlls/ts/tsfun/AMBuilder',
'dlls/ts/tsx/AMBuilder', 'dlls/ts/tsx/AMBuilder',
'plugins/AMBuilder',
], ],
{ {
'AMXX': AMXX 'AMXX': AMXX

View File

@ -23,4 +23,4 @@ binary.sources = [
'Binary.cpp', 'Binary.cpp',
] ]
AMXX.modules += [builder.Add(binary)] AMXX.amxxpc = builder.Add(binary)

View File

@ -35,4 +35,4 @@ binary.sources = [
'memfile.c', 'memfile.c',
] ]
AMXX.libpc300 = [builder.Add(binary)] AMXX.libpc300 = builder.Add(binary)

View File

@ -763,6 +763,7 @@ SC_VDECL int sc_needsemicolon;/* semicolon required to terminate expressions? */
SC_VDECL int sc_dataalign; /* data alignment value */ SC_VDECL int sc_dataalign; /* data alignment value */
SC_VDECL int sc_alignnext; /* must frame of the next function be aligned? */ SC_VDECL int sc_alignnext; /* must frame of the next function be aligned? */
SC_VDECL int pc_docexpr; /* must expression be attached to documentation comment? */ SC_VDECL int pc_docexpr; /* must expression be attached to documentation comment? */
SC_VDECL int sc_showincludes; /* show include files? */
SC_VDECL int curseg; /* 1 if currently parsing CODE, 2 if parsing DATA */ SC_VDECL int curseg; /* 1 if currently parsing CODE, 2 if parsing DATA */
SC_VDECL cell sc_stksize; /* stack size */ SC_VDECL cell sc_stksize; /* stack size */
SC_VDECL cell sc_amxlimit; /* abstract machine size limit */ SC_VDECL cell sc_amxlimit; /* abstract machine size limit */

View File

@ -1013,6 +1013,9 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam
hwndFinish=(HWND)0; hwndFinish=(HWND)0;
break; break;
#endif #endif
case 'h':
sc_showincludes = 1;
break;
case 'i': case 'i':
strncpy(str,option_value(ptr),sizeof str); /* set name of include directory */ strncpy(str,option_value(ptr),sizeof str); /* set name of include directory */
str[sizeof(str)-1]='\0'; str[sizeof(str)-1]='\0';

View File

@ -142,6 +142,9 @@ static char *extensions[] = { ".inc", ".p", ".pawn" };
*ext='\0'; /* restore filename */ *ext='\0'; /* restore filename */
return FALSE; return FALSE;
} /* if */ } /* if */
if (sc_showincludes && sc_status==statFIRST) {
fprintf(stdout, "Note: including file: %s\n", name);
}
PUSHSTK_P(inpf); PUSHSTK_P(inpf);
PUSHSTK_P(inpfname); /* pointer to current file name */ PUSHSTK_P(inpfname); /* pointer to current file name */
PUSHSTK_P(curlibrary); PUSHSTK_P(curlibrary);

View File

@ -85,6 +85,7 @@ SC_VDEFINE int sc_rationaltag=0; /* tag for rational numbers */
SC_VDEFINE int rational_digits=0; /* number of fractional digits */ SC_VDEFINE int rational_digits=0; /* number of fractional digits */
SC_VDEFINE int sc_allowproccall=0; /* allow/detect tagnames in lex() */ SC_VDEFINE int sc_allowproccall=0; /* allow/detect tagnames in lex() */
SC_VDEFINE short sc_is_utf8=FALSE; /* is this source file in UTF-8 encoding */ SC_VDEFINE short sc_is_utf8=FALSE; /* is this source file in UTF-8 encoding */
SC_VDEFINE int sc_showincludes=0; /* show include files */
SC_VDEFINE constvalue sc_automaton_tab = { NULL, "", 0, 0}; /* automaton table */ SC_VDEFINE constvalue sc_automaton_tab = { NULL, "", 0, 0}; /* automaton table */
SC_VDEFINE constvalue sc_state_tab = { NULL, "", 0, 0}; /* state table */ SC_VDEFINE constvalue sc_state_tab = { NULL, "", 0, 0}; /* state table */

112
plugins/AMBuilder Normal file
View File

@ -0,0 +1,112 @@
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
import os
files = [
'adminchat.sma',
'admincmd.sma',
'adminhelp.sma',
'adminslots.sma',
'adminvote.sma',
'antiflood.sma',
'imessage.sma',
'mapchooser.sma',
'mapsmenu.sma',
'menufront.sma',
'multilingual.sma',
'nextmap.sma',
'pausecfg.sma',
'plmenu.sma',
'scrollmsg.sma',
'statscfg.sma',
'telemenu.sma',
'timeleft.sma',
'cmdmenu.sma',
'pluginmenu.sma',
'cstrike/csstats.sma',
'cstrike/miscstats.sma',
'cstrike/restmenu.sma',
'cstrike/stats_logging.sma',
'cstrike/statsx.sma',
'dod/dodstats.sma',
'dod/plmenu.sma',
'dod/stats.sma',
'dod/stats_logging.sma',
'dod/statssounds.sma',
'esf/EvolutionX.Core.sma',
'ns/idlekicker.sma',
'ns/mapchooser.sma',
'ns/nextmap.sma',
'ns/nscommands.sma',
'ns/timeleft.sma',
'ns/unstuck.sma',
'ns/plmenu.sma',
'tfc/plmenu.sma',
'tfc/stats.sma',
'tfc/stats_logging.sma',
'tfc/statssounds.sma',
'tfc/tfcstats.sma',
'ts/stats.sma',
'ts/stats_logging.sma',
'ts/statssounds.sma',
'ts/tsstats.sma',
]
_, (libpc300,) = builder.AddCopy(AMXX.libpc300.binary, builder.localFolder)
_, (amxxpc,) = builder.AddCopy(AMXX.amxxpc.binary, builder.localFolder)
amxxpc_argv = [
os.path.join(os.curdir, 'amxxpc'),
'-i' + os.path.relpath(os.path.join(builder.buildPath, 'includes'),
os.path.join(builder.buildPath, builder.buildFolder)),
'-i' + os.path.relpath(os.path.join(builder.sourcePath, 'plugins', 'include'),
os.path.join(builder.buildPath, builder.buildFolder)),
'-h',
]
def build_plugin(script_path, amxx_file, extra_argv = []):
script_folder = os.path.dirname(amxx_file)
if len(script_folder):
builder.AddFolder(script_folder)
inputs = [
# Note, use the ones we locally copied, not the originals! Otherwise they
# could copy out of order.
amxxpc,
libpc300,
script_path,
]
outputs = [
amxx_file
]
argv = amxxpc_argv + extra_argv + [
script_path,
'-o' + amxx_file,
]
cmd_entry, (amx_entry,) = builder.AddCommand(
inputs = inputs,
argv = argv,
outputs = outputs,
dep_type = 'msvc'
)
AMXX.plugins[amxx_file] = amx_entry
for script_file in files:
script_path = os.path.join(builder.currentSourcePath, script_file)
amxx_file = os.path.splitext(script_file)[0] + '.amxx'
build_plugin(script_path, amxx_file)
# admin_sql.amxx is generated from admin.sma.
build_plugin(
script_path = os.path.join(builder.currentSourcePath, 'admin.sma'),
amxx_file = 'admin_sql.amxx',
extra_argv = ['USING_SQL=1']
)
# amxmod_compat is multi-file.
build_plugin(
script_path = os.path.join(builder.currentSourcePath, 'amxmod_compat', 'amxmod_compat.sma'),
amxx_file = 'amxmod_compat.amxx'
)