[+] staticImpDefines for stupid modules that assume shared linkage over static

This commit is contained in:
Reece Wilson 2021-06-06 13:15:07 +01:00
parent d4d6151260
commit 353237353a
2 changed files with 21 additions and 3 deletions

View File

@ -76,13 +76,13 @@ function JsonProcessor(info)
local handleDllImportMaybe = function(this) local handleDllImportMaybe = function(this)
if (this.info.isShared) then if (this.info.isShared) then
defines(this.result.dllimport) forEach(this.result.dllimport, defines)
end end
end end
local handleDllExportMaybe = function(this) local handleDllExportMaybe = function(this)
if (this.info.isShared) then if (this.info.isShared) then
defines(this.result.dllexport) forEach(this.result.dllexport, defines)
end end
end end
@ -124,6 +124,10 @@ function JsonProcessor(info)
forEach(result.staticImport, defines) forEach(result.staticImport, defines)
end end
if (this.info.isStatic) then
forEach(result.staticImpDefines, defines)
end
handleInclude(this, false) handleInclude(this, false)
defines(("_auhas_" .. this.result.name):upper() .. "=1") defines(("_auhas_" .. this.result.name):upper() .. "=1")
@ -267,6 +271,7 @@ function JsonProcessor(info)
forEach(object.depends, handleDepends, a, false) forEach(object.depends, handleDepends, a, false)
forEach(object["soft-depends"], handleDepends, a, true) forEach(object["soft-depends"], handleDepends, a, true)
forEach(object.impDefines, defines) forEach(object.impDefines, defines)
forEach(object.links, links)
if (usingMSVC) then if (usingMSVC) then
forEach(object.msvcIgnore, disablewarnings) forEach(object.msvcIgnore, disablewarnings)
end end
@ -322,13 +327,17 @@ function JsonProcessor(info)
forEach(result.impInclude, handleUserJsonInclude, info.path, true) forEach(result.impInclude, handleUserJsonInclude, info.path, true)
if (a.info.projectType:lower() == "sharedlib") then if (a.info.projectType:lower() == "sharedlib") then
tryAddDefine(result.dllexport) forEach(result.dllexport, defines)
end end
end end
forEach(result.actions, handleAction, info.path) forEach(result.actions, handleAction, info.path)
forEach(result.events, handleBuildEvent, info.path) forEach(result.events, handleBuildEvent, info.path)
if (info.isStatic) then
forEach(result.staticImpDefines, defines)
end
end end
forEach(result.subprojs, function(subproj) forEach(result.subprojs, function(subproj)

View File

@ -68,6 +68,15 @@
}, },
"description": "adds a preprocessor definition to translation units linking against a shared project" "description": "adds a preprocessor definition to translation units linking against a shared project"
}, },
"staticImpDefines":
{
"type": ["array", "string"],
"items":
{
"type": "string"
},
"description": "adds a preprocessor definition to translation units linking against or compiling a static project"
},
"impDefines": "impDefines":