Rework build system to handle better external libs
This commit is contained in:
parent
9b313dac2e
commit
f24e48e2dc
|
|
@ -24,3 +24,18 @@ ServerMode = false
|
||||||
|
|
||||||
-- Builds modules as one united library (useless on POSIX systems)
|
-- Builds modules as one united library (useless on POSIX systems)
|
||||||
UniteModules = false
|
UniteModules = false
|
||||||
|
|
||||||
|
-- Qt5 directories (required for ShaderNodes editor)
|
||||||
|
--Qt5IncludeDir = [[C:\Projets\Libs\Qt\5.15.0\msvc2019\include]]
|
||||||
|
--Qt5BinDir_x86 = [[C:\Projets\Libs\Qt\5.15.0\msvc2019\bin]]
|
||||||
|
--Qt5BinDir_x64 = [[C:\Projets\Libs\Qt\5.15.0\msvc2019_64\bin]]
|
||||||
|
--Qt5LibDir_x86 = [[C:\Projets\Libs\Qt\5.15.0\msvc2019\lib]]
|
||||||
|
--Qt5LibDir_x64 = [[C:\Projets\Libs\Qt\5.15.0\msvc2019_64\lib]]
|
||||||
|
|
||||||
|
|
||||||
|
-- QtNodes directories (required for ShaderNodes editor)
|
||||||
|
--QtNodesIncludeDir = [[C:\Projets\Libs\nodeeditor\include]]
|
||||||
|
--QtNodesBinDir_x86 = [[C:\Projets\Libs\nodeeditor\build32\bin\Release]]
|
||||||
|
--QtNodesBinDir_x64 = [[C:\Projets\Libs\nodeeditor\build64\bin\Release]]
|
||||||
|
--QtNodesLibDir_x86 = [[C:\Projets\Libs\nodeeditor\build32\lib\Release]]
|
||||||
|
--QtNodesLibDir_x64 = [[C:\Projets\Libs\nodeeditor\build64\lib\Release]]
|
||||||
|
|
@ -699,6 +699,24 @@ local PosixOSes = {
|
||||||
["solaris"] = true
|
["solaris"] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function ProcessOption(libName, option, enable)
|
||||||
|
return libName:gsub("%%" .. option .. "%((.+)%)", enable and "%1" or "")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function HandleLib(infoTable, libName)
|
||||||
|
local debugDynamic = ProcessOption(ProcessOption(libName, "d", true), "s", false)
|
||||||
|
local debugStatic = ProcessOption(ProcessOption(libName, "d", true), "s", true)
|
||||||
|
local releaseStatic = ProcessOption(ProcessOption(libName, "d", false), "s", true)
|
||||||
|
local releaseDynamic = ProcessOption(ProcessOption(libName, "d", false), "s", false)
|
||||||
|
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.DebugStatic, debugStatic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, releaseStatic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugStatic, releaseStatic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, debugDynamic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, releaseDynamic)
|
||||||
|
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugDynamic, releaseDynamic)
|
||||||
|
end
|
||||||
|
|
||||||
function NazaraBuild:Process(infoTable)
|
function NazaraBuild:Process(infoTable)
|
||||||
if (infoTable.Excluded) then
|
if (infoTable.Excluded) then
|
||||||
return false
|
return false
|
||||||
|
|
@ -718,16 +736,11 @@ function NazaraBuild:Process(infoTable)
|
||||||
if (_OPTIONS["united"]) then
|
if (_OPTIONS["united"]) then
|
||||||
library = "NazaraEngine"
|
library = "NazaraEngine"
|
||||||
else
|
else
|
||||||
library = "Nazara" .. libraryTable.Name
|
library = "Nazara" .. libraryTable.Name .. "%s(-s)%d(-d)"
|
||||||
end
|
end
|
||||||
|
|
||||||
if (not self.Config["UniteModules"] or infoTable.Type ~= "Module") then
|
if (not self.Config["UniteModules"] or infoTable.Type ~= "Module") then
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
|
HandleLib(infoTable, library)
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, library .. "-d")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library)
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugDynamic, library)
|
|
||||||
end
|
end
|
||||||
elseif (libraryTable.Type == "ExternLib") then
|
elseif (libraryTable.Type == "ExternLib") then
|
||||||
library = libraryTable.Name
|
library = libraryTable.Name
|
||||||
|
|
@ -735,15 +748,10 @@ function NazaraBuild:Process(infoTable)
|
||||||
if (self.Config["BuildDependencies"]) then
|
if (self.Config["BuildDependencies"]) then
|
||||||
table.insert(libraries, library)
|
table.insert(libraries, library)
|
||||||
else
|
else
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
|
HandleLib(infoTable, library)
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, library .. "-s-d")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugDynamic, library .. "-s")
|
|
||||||
end
|
end
|
||||||
elseif (libraryTable.Type == "Tool") then
|
elseif (libraryTable.Type == "Tool") then
|
||||||
library = "Nazara" .. libraryTable.Name
|
library = "Nazara" .. libraryTable.Name .. "%s(-s)%d(-d)"
|
||||||
|
|
||||||
-- Import tools includes
|
-- Import tools includes
|
||||||
for k,v in ipairs(libraryTable.Includes) do
|
for k,v in ipairs(libraryTable.Includes) do
|
||||||
|
|
@ -761,19 +769,14 @@ function NazaraBuild:Process(infoTable)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
|
HandleLib(infoTable, library)
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugStatic, library .. "-s")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, library .. "-d")
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library)
|
|
||||||
table.insert(infoTable.ConfigurationLibraries.ReleaseWithDebugDynamic, library)
|
|
||||||
else
|
else
|
||||||
infoTable.Excluded = true
|
infoTable.Excluded = true
|
||||||
infoTable.ExcludeReason = "dependency " .. library .. " has invalid type \"" .. libraryTable.Type .. "\""
|
infoTable.ExcludeReason = "dependency " .. library .. " has invalid type \"" .. libraryTable.Type .. "\""
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
table.insert(libraries, library)
|
HandleLib(infoTable, library)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
infoTable.Libraries = libraries
|
infoTable.Libraries = libraries
|
||||||
|
|
@ -881,9 +884,11 @@ function NazaraBuild:PreconfigGenericProject()
|
||||||
filter("configurations:*Dynamic")
|
filter("configurations:*Dynamic")
|
||||||
kind("SharedLib")
|
kind("SharedLib")
|
||||||
|
|
||||||
-- Enable MSVC conformance (not required but better)
|
-- Enable MSVC conformance (not required but better) and some extra warnings
|
||||||
filter("action:vs*")
|
filter("action:vs*")
|
||||||
buildoptions({"/permissive-", "/Zc:__cplusplus", "/Zc:referenceBinding", "/Zc:throwingNew"})
|
buildoptions({"/permissive-", "/Zc:__cplusplus", "/Zc:referenceBinding", "/Zc:throwingNew"})
|
||||||
|
--enablewarnings("4062") -- switch case not handled
|
||||||
|
buildoptions("/w44062") -- looks like enablewarnings is broken currently for msvc
|
||||||
|
|
||||||
-- Enable SSE math and vectorization optimizations
|
-- Enable SSE math and vectorization optimizations
|
||||||
filter({"configurations:Release*", clangGccActions})
|
filter({"configurations:Release*", clangGccActions})
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,7 @@ TOOL.Defines = {
|
||||||
TOOL.Includes = {
|
TOOL.Includes = {
|
||||||
"../include",
|
"../include",
|
||||||
"../extlibs/include",
|
"../extlibs/include",
|
||||||
"../src",
|
"../src"
|
||||||
[[C:\Projets\Libs\Qt\5.15.0\msvc2019_64\include]],
|
|
||||||
[[C:\Projets\Libs\Qt\5.15.0\msvc2019_64\include\QtCore]],
|
|
||||||
[[C:\Projets\Libs\Qt\5.15.0\msvc2019_64\include\QtGui]],
|
|
||||||
[[C:\Projets\Libs\Qt\5.15.0\msvc2019_64\include\QtWidgets]],
|
|
||||||
[[C:\Projets\Libs\nodeeditor\include]],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TOOL.Files = {
|
TOOL.Files = {
|
||||||
|
|
@ -27,16 +22,71 @@ TOOL.Files = {
|
||||||
}
|
}
|
||||||
|
|
||||||
TOOL.Libraries = {
|
TOOL.Libraries = {
|
||||||
"NazaraCore",
|
"NazaraCore%s(-s)%d(-d)",
|
||||||
"NazaraShader",
|
"NazaraShader%s(-s)%d(-d)",
|
||||||
"NazaraUtility",
|
"NazaraUtility%s(-s)%d(-d)",
|
||||||
"Qt5Cored",
|
"Qt5Core%d(d)",
|
||||||
"Qt5Guid",
|
"Qt5Gui%d(d)",
|
||||||
"Qt5Widgetsd",
|
"Qt5Widgets%d(d)",
|
||||||
"nodes"
|
"nodes%d(d)"
|
||||||
}
|
}
|
||||||
|
|
||||||
TOOL.LibraryPaths.x64 = {
|
local function AppendValues(tab, value)
|
||||||
[[C:\Projets\Libs\Qt\5.15.0\msvc2019_64\lib]],
|
if (type(value) == "table") then
|
||||||
[[C:\Projets\Libs\nodeeditor\build\lib\Debug]]
|
for _, v in pairs(value) do
|
||||||
}
|
AppendValues(tab, v)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
table.insert(tab, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TOOL:ValidateLib(libName)
|
||||||
|
local config = NazaraBuild:GetConfig()
|
||||||
|
local includes = config[libName .. "IncludeDir"]
|
||||||
|
local binDir32 = config[libName .. "BinDir_x86"]
|
||||||
|
local binDir64 = config[libName .. "BinDir_x64"]
|
||||||
|
local libDir32 = config[libName .. "LibDir_x86"]
|
||||||
|
local libDir64 = config[libName .. "LibDir_x64"]
|
||||||
|
if (not includes) then
|
||||||
|
return false, "missing " .. libName .. " includes directories in config.lua"
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not libDir32 and not libDir64) then
|
||||||
|
return false, "missing " .. libName .. " library search directories in config.lua"
|
||||||
|
end
|
||||||
|
|
||||||
|
AppendValues(self.Includes, includes)
|
||||||
|
|
||||||
|
if (binDir32) then
|
||||||
|
AppendValues(self.BinaryPaths.x86, binDir32)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (binDir64) then
|
||||||
|
AppendValues(self.BinaryPaths.x64, binDir64)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (libDir32) then
|
||||||
|
AppendValues(self.LibraryPaths.x86, libDir32)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (libDir64) then
|
||||||
|
AppendValues(self.LibraryPaths.x64, libDir64)
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function TOOL:Validate()
|
||||||
|
local success, err = self:ValidateLib("Qt5")
|
||||||
|
if (not success) then
|
||||||
|
return false, err
|
||||||
|
end
|
||||||
|
|
||||||
|
local success, err = self:ValidateLib("QtNodes")
|
||||||
|
if (not success) then
|
||||||
|
return false, err
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue