1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Compiling, Windows . Avoid unnecessary rebuilds with MSVC.

To export symbols from the mysqld.exe, use lib.exe with /DEF, rather than
pre-link step when building mysqld.exe.

This helps to avoid relinking all plugins, if mysqld.exe was recompiled
but the list of its exports has not changed.

Also removed unnecessary DEPENDS in some ADD_CUSTOM_COMMAND (gen_lex_token,
gen_lex_hash etc). They confuse VS generator which tends to
recreate headers and do unnecessary recompilations.
This commit is contained in:
Vladislav Vaintroub
2017-04-03 18:48:48 +00:00
parent ff6f4d7db1
commit f2dc04abea
3 changed files with 111 additions and 29 deletions

View File

@@ -54,6 +54,22 @@ var is64 = args.Item(0).toLowerCase() == "x64";
var shell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
/*
If .def file is used with together with lib.exe
the name mangling for stdcall is slightly different.
Undescore prefix for stdcall function name must be removed for
lib.exe but not link.exe (see ScrubSymbol())
This difference is not documented anywhere and could
be a bug in compiler tools.
We use a parameter /forLib, if the resulting .def file is used
with lib.exe .
*/
var forLib = false;
OutputSymbols(CollectSymbols());
@@ -62,8 +78,8 @@ function OutputSymbols(symbols)
{
var out = WScript.StdOut;
out.WriteLine("EXPORTS");
for (var sym in symbols)
out.WriteLine(sym);
for (var i= 0; i < symbols.length; i++)
out.WriteLine(symbols[i]);
}
function echo(message)
@@ -72,9 +88,10 @@ function echo(message)
}
// Extract global symbol names and type from objects
// Returns string array with symbol names
function CollectSymbols()
{
var uniqueSymbols = new Array();
var uniqueSymbols = new Object();
try
{
@@ -146,7 +163,19 @@ function CollectSymbols()
uniqueSymbols[symbol] = 1;
}
fso.DeleteFile(rspfilename);
return uniqueSymbols;
// Sort symbols names
var keys=[];
var sorted = {};
for (key in uniqueSymbols)
{
if (uniqueSymbols.hasOwnProperty(key))
{
keys.push(key);
}
}
keys.sort();
return keys;
}
// performs necessary cleanup on the symbol name
@@ -156,6 +185,9 @@ function ScrubSymbol(symbol)
if (symbol.charAt(0) != "_")
return symbol;
if (forLib)
return symbol.substring(1, symbol.length);
var atSign = symbol.indexOf("@");
if (atSign != -1)
{
@@ -189,7 +221,11 @@ function CreateResponseFile(filename)
var index = 1;
for (; index < args.length; index++)
{
addToResponseFile(args.Item(index),responseFile);
var param = args.Item(index);
if (param == "/forLib")
forLib = true;
else
addToResponseFile(args.Item(index),responseFile);
}
responseFile.Close();
}