scilab: in library name remove suffix lib, add option to choose name instead

This commit is contained in:
Simon Marchetto 2014-04-17 14:39:04 +02:00
commit 4c426d47a0
3 changed files with 23 additions and 9 deletions

View file

@ -1611,7 +1611,7 @@ scilab_version:
# -----------------------------------------------------------------
scilab_clean:
rm -f *.sce *.so lib*lib.c *_wrap.*
rm -f *.sce *.so lib*.c *_wrap.*
##################################################################
##### Go ######

View file

@ -10,7 +10,7 @@ swigtestname = strsubst(fileparts(names, "fname"), "_runme", "");
testdir = swigtestname + ".dir";
// Does the library exists? If not then exit!
libname = "lib" + swigtestname + "lib" + getdynlibext();
libname = "lib" + swigtestname + getdynlibext();
if ~isfile(fullfile(testdir, libname)) then
mfprintf(0, "*** LIBRARY NOT FOUND: %s ***\n", libname);
exit(1)

View file

@ -23,7 +23,8 @@ Scilab options (available with -scilab)\n\
-vbl <level> - Sets the build verbose <level> (default 0)\n\
-buildflags <file> - Uses a Scilab script in <file> to set build flags\n\
-nobuilder - Do not generate builder script\n\
-gwid <id> - Gateway ID \n\n"
-gwid <id> - Gateway ID \n\
-ol <library name> - Set name of the output library\n\n"
;
static const char *SWIG_CREATE_VARIABLES_FUNCTION_NAME = "SWIG_CreateScilabVariables";
@ -55,6 +56,8 @@ protected:
String *gatewayID;
int primitiveID;
String *libraryName;
bool generateBuilder;
bool extraWarning;
public:
@ -71,6 +74,7 @@ public:
buildFlagsScript = NULL;
generateBuilder = true;
gatewayID = NULL;
libraryName = NULL;
extraWarning = false;
/* Manage command line arguments */
@ -91,13 +95,13 @@ public:
} else if (strcmp(argv[argIndex], "-addcflag") == 0) {
Swig_mark_arg(argIndex);
if (argv[argIndex + 1] != NULL) {
DohInsertitem(cflags, Len(cflags), argv[argIndex + 1]);
DohInsertitem(cflags, Len(cflags), argv[argIndex + 1]);
Swig_mark_arg(argIndex + 1);
}
} else if (strcmp(argv[argIndex], "-addldflag") == 0) {
Swig_mark_arg(argIndex);
if (argv[argIndex + 1] != NULL) {
DohInsertitem(ldflags, Len(ldflags), argv[argIndex + 1]);
DohInsertitem(ldflags, Len(ldflags), argv[argIndex + 1]);
Swig_mark_arg(argIndex + 1);
}
} else if (strcmp(argv[argIndex], "-vbl") == 0) {
@ -117,6 +121,11 @@ public:
gatewayID = NewString(argv[argIndex + 1]);
Swig_mark_arg(argIndex + 1);
}
else if (strcmp(argv[argIndex], "-ol") == 0) {
Swig_mark_arg(argIndex);
libraryName = NewString(argv[argIndex + 1]);
Swig_mark_arg(argIndex + 1);
}
else if (strcmp(argv[argIndex], "-Wextra") == 0) {
extraWarning = true;
}
@ -153,6 +162,11 @@ public:
/* Get the module name */
String *moduleName = Getattr(node, "name");
/* Set the library name if not specified */
if (libraryName == NULL) {
libraryName = moduleName;
}
/* Get the output file name */
String *outputFilename = Getattr(node, "outfile");
@ -755,7 +769,7 @@ public:
Printf(builderCode, "ilib_verbose(%s);\n", verboseBuildLevel);
Printf(builderCode, "ilib_name = \"%slib\";\n", moduleName);
Printf(builderCode, "lib_name = \"%s\";\n", libraryName);
Printf(builderCode, "libs = [];\n");
@ -808,8 +822,8 @@ public:
Printf(builderCode, "];\n");
Printf(builderCode, "err_msg = [];\n");
Printf(builderCode, "if ~isempty(table) then\n");
Printf(builderCode, " ilib_build(ilib_name, table, files, libs, [], ldflags, cflags);\n");
Printf(builderCode, " libfilename = 'lib' + ilib_name + getdynlibext();\n");
Printf(builderCode, " ilib_build('%s', table, files, libs, [], ldflags, cflags);\n", libraryName);
Printf(builderCode, " libfilename = 'lib%s' + getdynlibext();\n", libraryName);
Printf(builderCode, " if ~isfile(libfilename) then\n");
Printf(builderCode, " err_msg = 'Error while building library ' + libfilename ' + '.');\n");
Printf(builderCode, " end\n");
@ -824,7 +838,7 @@ public:
}
/* -----------------------------------------------------------------------
* saveBuilderCode():
* saveBuilderCode()
* ----------------------------------------------------------------------- */
void saveBuilderFile() {
Printv(builderFile, builderCode, NIL);