swig --addsrc option: support several source files
This commit is contained in:
parent
0ac03d9fe9
commit
e9dd482c83
1 changed files with 25 additions and 8 deletions
|
|
@ -35,7 +35,7 @@ protected:
|
||||||
String *builderCode;
|
String *builderCode;
|
||||||
int builderFunctionCount;
|
int builderFunctionCount;
|
||||||
|
|
||||||
String *sourceFile;
|
List *sourceFileList;
|
||||||
String *cflag;
|
String *cflag;
|
||||||
String *ldflag;
|
String *ldflag;
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ public:
|
||||||
* ----------------------------------------------------------------------*/
|
* ----------------------------------------------------------------------*/
|
||||||
virtual void main(int argc, char* argv[]) {
|
virtual void main(int argc, char* argv[]) {
|
||||||
|
|
||||||
sourceFile = NULL;
|
sourceFileList = NewList();
|
||||||
ldflag = NULL;
|
ldflag = NULL;
|
||||||
cflag = NULL;
|
cflag = NULL;
|
||||||
|
|
||||||
|
|
@ -58,9 +58,14 @@ public:
|
||||||
/* Indicate arg as valid */
|
/* Indicate arg as valid */
|
||||||
Swig_mark_arg(argIndex);
|
Swig_mark_arg(argIndex);
|
||||||
} else if (strcmp(argv[argIndex], "-addsrc") == 0) {
|
} else if (strcmp(argv[argIndex], "-addsrc") == 0) {
|
||||||
Swig_mark_arg(argIndex);
|
|
||||||
if (argv[argIndex+1] != NULL) {
|
if (argv[argIndex+1] != NULL) {
|
||||||
sourceFile = NewString(argv[argIndex+1]);
|
Swig_mark_arg(argIndex);
|
||||||
|
char *sourceFile = strtok(argv[argIndex+1], " ");
|
||||||
|
while (sourceFile != NULL)
|
||||||
|
{
|
||||||
|
DohInsertitem(sourceFileList, Len(sourceFileList), sourceFile);
|
||||||
|
sourceFile = strtok(NULL, " ");
|
||||||
|
}
|
||||||
Swig_mark_arg(argIndex+1);
|
Swig_mark_arg(argIndex+1);
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[argIndex], "-addcflag") == 0) {
|
} else if (strcmp(argv[argIndex], "-addcflag") == 0) {
|
||||||
|
|
@ -138,10 +143,6 @@ public:
|
||||||
Printf(builderCode, "ilib_verbose(0);\n");
|
Printf(builderCode, "ilib_verbose(0);\n");
|
||||||
#endif
|
#endif
|
||||||
Printf(builderCode, "ilib_name = \"%slib\";\n", moduleName);
|
Printf(builderCode, "ilib_name = \"%slib\";\n", moduleName);
|
||||||
Printf(builderCode, "files = \"%s\";\n", outputFilename);
|
|
||||||
if (sourceFile != NULL) {
|
|
||||||
Printf(builderCode, "files($+1) = \"%s\";\n", sourceFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
Printf(builderCode, "libs = [];\n");
|
Printf(builderCode, "libs = [];\n");
|
||||||
if (ldflag != NULL) {
|
if (ldflag != NULL) {
|
||||||
|
|
@ -149,12 +150,28 @@ public:
|
||||||
} else {
|
} else {
|
||||||
Printf(builderCode, "ldflags = \"\";\n");
|
Printf(builderCode, "ldflags = \"\";\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(builderCode, "cflags = [\"-g -I\" + get_absolute_file_path(\"builder.sce\")];\n");
|
Printf(builderCode, "cflags = [\"-g -I\" + get_absolute_file_path(\"builder.sce\")];\n");
|
||||||
if (cflag != NULL) {
|
if (cflag != NULL) {
|
||||||
Printf(builderCode, "includepath = \"%s\";\n", cflag);
|
Printf(builderCode, "includepath = \"%s\";\n", cflag);
|
||||||
Printf(builderCode, "includepath = fullpath(part(includepath, 3:length(includepath)));\n");
|
Printf(builderCode, "includepath = fullpath(part(includepath, 3:length(includepath)));\n");
|
||||||
Printf(builderCode, "cflags = cflags + \" -I\" + includepath;\n");
|
Printf(builderCode, "cflags = cflags + \" -I\" + includepath;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DohInsertitem(sourceFileList, 0, outputFilename);
|
||||||
|
for (int i=0; i<Len(sourceFileList); i++)
|
||||||
|
{
|
||||||
|
String* sourceFile = Getitem(sourceFileList, i);
|
||||||
|
if (i==0)
|
||||||
|
{
|
||||||
|
Printf(builderCode, "files = \"%s\";\n", sourceFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Printf(builderCode, "files($ + 1) = \"%s\";\n", sourceFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Printf(builderCode, "table = [");
|
Printf(builderCode, "table = [");
|
||||||
|
|
||||||
/* Emit code for children */
|
/* Emit code for children */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue