Scilab: support of multiple -addldflag

This commit is contained in:
Simon Marchetto 2013-10-09 15:46:59 +02:00
commit 92afbf08dc

View file

@ -43,7 +43,7 @@ protected:
List *sourceFileList; List *sourceFileList;
List *cflags; List *cflags;
String *ldflag; List *ldflags;
String *verboseBuildLevel; String *verboseBuildLevel;
String *buildFlagsScript; String *buildFlagsScript;
@ -60,7 +60,7 @@ public:
sourceFileList = NewList(); sourceFileList = NewList();
cflags = NewList(); cflags = NewList();
ldflag = NULL; ldflags = NewList();
verboseBuildLevel = NULL; verboseBuildLevel = NULL;
buildFlagsScript = NULL; buildFlagsScript = NULL;
generateBuilder = true; generateBuilder = true;
@ -90,7 +90,7 @@ public:
} else if (strcmp(argv[argIndex], "-addldflag") == 0) { } else if (strcmp(argv[argIndex], "-addldflag") == 0) {
Swig_mark_arg(argIndex); Swig_mark_arg(argIndex);
if (argv[argIndex + 1] != NULL) { if (argv[argIndex + 1] != NULL) {
ldflag = NewString(argv[argIndex + 1]); DohInsertitem(ldflags, Len(ldflags), argv[argIndex + 1]);
Swig_mark_arg(argIndex + 1); Swig_mark_arg(argIndex + 1);
} }
} else if (strcmp(argv[argIndex], "-vbl") == 0) { } else if (strcmp(argv[argIndex], "-vbl") == 0) {
@ -221,6 +221,7 @@ public:
Delete(sourceFileList); Delete(sourceFileList);
Delete(cflags); Delete(cflags);
Delete(ldflags);
return SWIG_OK; return SWIG_OK;
} }
@ -711,8 +712,15 @@ public:
Printf(builderCode, "cflags = cflags + \" %s\";\n", cflag); Printf(builderCode, "cflags = cflags + \" %s\";\n", cflag);
} }
if (ldflag != NULL) { if (Len(ldflags) > 0) {
for (int i = 0; i < Len(ldflags); i++) {
String *ldflag = Getitem(ldflags, i);
if (i == 0) {
Printf(builderCode, "ldflags = \"%s\";\n", ldflag); Printf(builderCode, "ldflags = \"%s\";\n", ldflag);
} else {
Printf(builderCode, "ldflags = ldflags + \" %s\";\n", ldflag);
}
}
} }
else { else {
Printf(builderCode, "ldflags = [];\n"); Printf(builderCode, "ldflags = [];\n");