Build: Rework build system + introduced SDK build file

Former-commit-id: 90727a78031a83753404d2fe09a6347315a00a39
This commit is contained in:
Lynix 2015-06-14 15:48:16 +02:00
parent 7b7b74bdf3
commit 71e595fe49
10 changed files with 424 additions and 334 deletions

View File

@ -1,5 +1,3 @@
local PosixOSes = {"bsd", "linux", "macosx", "solaris"}
NazaraBuild = {} -- L'équivalent d'un namespace en Lua est une table NazaraBuild = {} -- L'équivalent d'un namespace en Lua est une table
function NazaraBuild:Execute() function NazaraBuild:Execute()
@ -10,7 +8,7 @@ function NazaraBuild:Execute()
if (self.Actions[_ACTION] ~= nil) then if (self.Actions[_ACTION] ~= nil) then
self.Actions[_ACTION].Function() self.Actions[_ACTION].Function()
else else
if (_OPTIONS["with-extlibs"]) then if (#self.OrderedExtLibs > 0) then
solution("NazaraExtlibs") solution("NazaraExtlibs")
-- Configuration générale -- Configuration générale
configurations({ configurations({
@ -49,8 +47,7 @@ function NazaraBuild:Execute()
configuration("codeblocks or codelite or gmake or xcode3 or xcode4") configuration("codeblocks or codelite or gmake or xcode3 or xcode4")
buildoptions("-std=c++11") buildoptions("-std=c++11")
for i=1, #self.ExtLibs do for k, libTable in ipairs(self.OrderedExtLibs) do
local libTable = self.ExtLibs[i]
project(libTable.Name) project(libTable.Name)
language(libTable.Language) language(libTable.Language)
@ -61,6 +58,7 @@ function NazaraBuild:Execute()
defines(libTable.Defines) defines(libTable.Defines)
flags(libTable.Flags) flags(libTable.Flags)
includedirs(libTable.Includes)
links(libTable.Libraries) links(libTable.Libraries)
for k,v in pairs(libTable.ConfigurationLibraries) do for k,v in pairs(libTable.ConfigurationLibraries) do
@ -120,8 +118,7 @@ function NazaraBuild:Execute()
project("NazaraEngine") project("NazaraEngine")
end end
for i=1, #self.Modules do for k, moduleTable in ipairs(self.OrderedModules) do
local moduleTable = self.Modules[i]
if (not _OPTIONS["united"]) then if (not _OPTIONS["united"]) then
project("Nazara" .. moduleTable.Name) project("Nazara" .. moduleTable.Name)
end end
@ -169,6 +166,7 @@ function NazaraBuild:Execute()
defines(moduleTable.Defines) defines(moduleTable.Defines)
flags(moduleTable.Flags) flags(moduleTable.Flags)
includedirs(moduleTable.Includes)
links(moduleTable.Libraries) links(moduleTable.Libraries)
for k,v in pairs(moduleTable.ConfigurationLibraries) do for k,v in pairs(moduleTable.ConfigurationLibraries) do
@ -178,11 +176,77 @@ function NazaraBuild:Execute()
configuration({}) configuration({})
end end
-- Tools
for k, toolTable in ipairs(self.OrderedTools) do
project("Nazara" .. toolTable.Name)
location(_ACTION .. "/tools")
targetdir(toolTable.Directory)
if (toolTable.Kind == "library") then
kind("SharedLib")
elseif (toolTable.Kind == "consoleapp") then
debugdir(toolTable.Directory)
kind("ConsoleApp")
elseif (toolTable.Kind == "windowapp") then
debugdir(toolTable.Directory)
kind("Window")
else
assert(false, "wut")
end end
if (_OPTIONS["with-examples"]) then includedirs({
for i=1, #self.Examples do "../include",
local exampleTable = self.Examples[i] "../extlibs/include"
})
libdirs("../lib")
if (_OPTIONS["x64"]) then
defines("NAZARA_PLATFORM_x64")
libdirs("../extlibs/lib/x64")
else
libdirs("../extlibs/lib/x86")
end
targetdir("../lib")
configuration("*Static")
kind("StaticLib")
configuration("*Dynamic")
kind("SharedLib")
configuration("DebugStatic")
targetsuffix("-s-d")
configuration("ReleaseStatic")
targetsuffix("-s")
configuration("DebugDynamic")
targetsuffix("-d")
configuration({})
files(toolTable.Files)
excludes(toolTable.FilesExclusion)
defines(toolTable.Defines)
flags(toolTable.Flags)
includedirs(toolTable.Includes)
links(toolTable.Libraries)
for k,v in pairs(toolTable.ConfigurationLibraries) do
configuration(k)
links(v)
end
configuration({})
end
end
for k, exampleTable in ipairs(self.OrderedExamples) do
project("Demo" .. exampleTable.Name) project("Demo" .. exampleTable.Name)
location(_ACTION .. "/examples") location(_ACTION .. "/examples")
@ -194,7 +258,10 @@ function NazaraBuild:Execute()
end end
debugdir("../examples/bin") debugdir("../examples/bin")
includedirs("../include") includedirs({
"../include",
"../extlibs/include"
})
libdirs("../lib") libdirs("../lib")
if (_OPTIONS["x64"]) then if (_OPTIONS["x64"]) then
@ -211,6 +278,7 @@ function NazaraBuild:Execute()
defines(exampleTable.Defines) defines(exampleTable.Defines)
flags(exampleTable.Flags) flags(exampleTable.Flags)
includedirs(exampleTable.Includes)
links(exampleTable.Libraries) links(exampleTable.Libraries)
for k,v in pairs(exampleTable.ConfigurationLibraries) do for k,v in pairs(exampleTable.ConfigurationLibraries) do
@ -221,7 +289,6 @@ function NazaraBuild:Execute()
configuration({}) configuration({})
end end
end end
end
function NazaraBuild:Initialize() function NazaraBuild:Initialize()
-- Commençons par les options -- Commençons par les options
@ -245,86 +312,13 @@ function NazaraBuild:Initialize()
description = "Builds the examples" description = "Builds the examples"
}) })
-- Puis par les bibliothèques externes
self.ExtLibs = {}
local extlibs = os.matchfiles("../extlibs/build/*.lua")
for k,v in pairs(extlibs) do
local f, err = loadfile(v)
if (f) then
LIBRARY = {}
LIBRARY.ConfigurationLibraries = {}
LIBRARY.ConfigurationLibraries.DebugStatic = {}
LIBRARY.ConfigurationLibraries.ReleaseStatic = {}
LIBRARY.ConfigurationLibraries.DebugDynamic = {}
LIBRARY.ConfigurationLibraries.ReleaseDynamic = {}
LIBRARY.Defines = {}
LIBRARY.Files = {}
LIBRARY.FilesExclusion = {}
LIBRARY.Flags = {}
LIBRARY.Libraries = {}
LIBRARY.OsFiles = {}
LIBRARY.OsLibraries = {}
f()
local succeed, err = self:RegisterExternLibrary(LIBRARY)
if (not succeed) then
print("Unable to register extern library: " .. err)
end
else
print("Unable to load extern library file: " .. err)
end
end
LIBRARY = nil
-- Ensuite nous allons parcourir tous les scripts de modules
self.Modules = {}
local modules = os.matchfiles("scripts/module/*.lua")
for k,v in pairs(modules) do
local moduleName = v:match(".*/(.*).lua")
local moduleNameLower = moduleName:lower()
if (moduleNameLower ~= "core") then -- exclure le noyau n'aurait aucun sens
newoption({
trigger = "exclude-" .. moduleNameLower,
description = "Exclude the " .. moduleName .. " module from the build system"
})
end
if (not _OPTIONS["exclude-" .. moduleNameLower]) then
local f, err = loadfile(v)
if (f) then
MODULE = {}
MODULE.ConfigurationLibraries = {}
MODULE.ConfigurationLibraries.DebugStatic = {}
MODULE.ConfigurationLibraries.ReleaseStatic = {}
MODULE.ConfigurationLibraries.DebugDynamic = {}
MODULE.ConfigurationLibraries.ReleaseDynamic = {}
MODULE.Defines = {}
MODULE.ExtLibs = {}
MODULE.Files = {}
MODULE.FilesExclusion = {}
MODULE.Flags = {}
MODULE.Libraries = {}
MODULE.OsFiles = {}
MODULE.OsLibraries = {}
f()
local succeed, err = self:RegisterModule(MODULE)
if (not succeed) then
print("Unable to register module: " .. err)
end
else
print("Unable to load module file: " .. err)
end
end
end
MODULE = nil
table.sort(self.Modules, function (a, b) return a.Name < b.Name end)
-- Et ensuite les scripts d'actions possibles
self.Actions = {} self.Actions = {}
self.Examples = {}
self.ExtLibs = {}
self.Modules = {}
self.Tools = {}
-- Actions
modules = os.matchfiles("scripts/actions/*.lua") modules = os.matchfiles("scripts/actions/*.lua")
for k,v in pairs(modules) do for k,v in pairs(modules) do
local f, err = loadfile(v) local f, err = loadfile(v)
@ -343,7 +337,92 @@ function NazaraBuild:Initialize()
end end
ACTION = nil ACTION = nil
self.Examples = {} -- Extern libraries
if (_OPTIONS["with-extlibs"]) then
local extlibs = os.matchfiles("../extlibs/build/*.lua")
for k,v in pairs(extlibs) do
local f, err = loadfile(v)
if (f) then
LIBRARY = {}
self:SetupInfoTable(LIBRARY)
f()
local succeed, err = self:RegisterExternLibrary(LIBRARY)
if (not succeed) then
print("Unable to register extern library: " .. err)
end
else
print("Unable to load extern library file: " .. err)
end
end
LIBRARY = nil
end
-- Then the modules
local modules = os.matchfiles("scripts/modules/*.lua")
for k,v in pairs(modules) do
local moduleName = v:match(".*/(.*).lua")
local moduleNameLower = moduleName:lower()
if (moduleNameLower ~= "core") then -- exclure le noyau n'aurait aucun sens
newoption({
trigger = "exclude-" .. moduleNameLower,
description = "Exclude the " .. moduleName .. " module from the build system"
})
end
if (not _OPTIONS["exclude-" .. moduleNameLower]) then
local f, err = loadfile(v)
if (f) then
MODULE = {}
self:SetupInfoTable(MODULE)
f()
local succeed, err = self:RegisterModule(MODULE)
if (not succeed) then
print("Unable to register module: " .. err)
end
else
print("Unable to load module file: " .. err)
end
end
end
MODULE = nil
-- Continue with the tools (ex: SDK)
local tools = os.matchfiles("scripts/tools/*.lua")
for k,v in pairs(tools) do
local toolName = v:match(".*/(.*).lua")
local toolNameLower = toolName:lower()
newoption({
trigger = "exclude-" .. toolNameLower,
description = "Exclude the " .. toolName .. " tool from the build system"
})
if (not _OPTIONS["exclude-" .. toolNameLower]) then
local f, err = loadfile(v)
if (f) then
TOOL = {}
self:SetupInfoTable(TOOL)
f()
local succeed, err = self:RegisterTool(TOOL)
if (not succeed) then
print("Unable to register tool: " .. err)
end
else
print("Unable to load tool file: " .. err)
end
end
end
TOOL = nil
-- Examples
if (_OPTIONS["with-examples"]) then
local examples = os.matchdirs("../examples/*") local examples = os.matchdirs("../examples/*")
for k,v in pairs(examples) do for k,v in pairs(examples) do
local dirName = v:match(".*/(.*)") local dirName = v:match(".*/(.*)")
@ -351,19 +430,8 @@ function NazaraBuild:Initialize()
local f, err = loadfile(v .. "/build.lua") local f, err = loadfile(v .. "/build.lua")
if (f) then if (f) then
EXAMPLE = {} EXAMPLE = {}
EXAMPLE.ConfigurationLibraries = {}
EXAMPLE.ConfigurationLibraries.DebugStatic = {}
EXAMPLE.ConfigurationLibraries.ReleaseStatic = {}
EXAMPLE.ConfigurationLibraries.DebugDynamic = {}
EXAMPLE.ConfigurationLibraries.ReleaseDynamic = {}
EXAMPLE.Defines = {}
EXAMPLE.Directory = dirName EXAMPLE.Directory = dirName
EXAMPLE.Files = {} self:SetupInfoTable(EXAMPLE)
EXAMPLE.FilesExclusion = {}
EXAMPLE.Flags = {}
EXAMPLE.Libraries = {}
EXAMPLE.OsFiles = {}
EXAMPLE.OsLibraries = {}
f() f()
@ -379,13 +447,32 @@ function NazaraBuild:Initialize()
EXAMPLE = nil EXAMPLE = nil
end end
function NazaraBuild:RegisterAction(actionTable) -- Once everything is registred, let's process all the tables
if (actionTable.Name == nil or type(actionTable.Name) ~= "string") then self.OrderedExamples = {}
return false, "Action name is invalid" self.OrderedExtLibs = {}
self.OrderedModules = {}
self.OrderedTools = {}
local tables = {self.Examples, self.ExtLibs, self.Modules, self.Tools}
local orderedTables = {self.OrderedExamples, self.OrderedExtLibs, self.OrderedModules, self.OrderedTools}
for k,projects in ipairs(tables) do
for projectId,projectTable in pairs(projects) do
self:Process(projectTable)
table.insert(orderedTables[k], projectTable)
end end
if (string.len(actionTable.Name) == 0) then table.sort(orderedTables[k], function (a, b) return a.Name < b.Name end)
return false, "Action name is empty" end
end
function NazaraBuild:RegisterAction(actionTable)
if (actionTable.Name == nil or type(actionTable.Name) ~= "string" or string.len(actionTable.Name) == 0) then
return false, "Invalid action name"
end
local lowerCaseName = string.lower(actionTable.Name)
if (self.Actions[lowerCaseName] ~= nil) then
return false, "This action name is already in use"
end end
if (actionTable.Description == nil or type(actionTable.Description) ~= "string") then if (actionTable.Description == nil or type(actionTable.Description) ~= "string") then
@ -404,13 +491,11 @@ function NazaraBuild:RegisterAction(actionTable)
return false, "Action function is invalid" return false, "Action function is invalid"
end end
local actionTrigger = string.lower(actionTable.Name) self.Actions[lowerCaseName] = actionTable
self.Actions[actionTrigger] = actionTable
newaction newaction
{ {
trigger = actionTrigger, trigger = lowerCaseName,
description = actionTable.Description, description = actionTable.Description,
execute = actionTable.Function execute = actionTable.Function
} }
@ -419,12 +504,13 @@ function NazaraBuild:RegisterAction(actionTable)
end end
function NazaraBuild:RegisterExample(exampleTable) function NazaraBuild:RegisterExample(exampleTable)
if (exampleTable.Name == nil or type(exampleTable.Name) ~= "string") then if (exampleTable.Name == nil or type(exampleTable.Name) ~= "string" or string.len(exampleTable.Name) == 0) then
return false, "Example name is invalid" return false, "Invalid example name"
end end
if (string.len(exampleTable.Name) == 0) then local lowerCaseName = exampleTable.Name:lower()
return false, "Example name is empty" if (self.Examples[lowerCaseName] ~= nil) then
return false, "This library name is already in use"
end end
if (exampleTable.Files == nil or type(exampleTable.Files) ~= "table") then if (exampleTable.Files == nil or type(exampleTable.Files) ~= "table") then
@ -432,7 +518,7 @@ function NazaraBuild:RegisterExample(exampleTable)
end end
if (#exampleTable.Files == 0) then if (#exampleTable.Files == 0) then
return false, "Example files table is empty" return false, "This example has no files"
end end
local files = {} local files = {}
@ -441,144 +527,42 @@ function NazaraBuild:RegisterExample(exampleTable)
end end
exampleTable.Files = files exampleTable.Files = files
local libraries = {} exampleTable.Type = "Example"
for k, library in ipairs(exampleTable.Libraries) do self.Examples[lowerCaseName] = exampleTable
if (string.sub(library, 1, 6) == "Nazara") then
if (_OPTIONS["united"]) then
table.insert(exampleTable.ConfigurationLibraries.DebugStatic, "NazaraEngine-s-d")
table.insert(exampleTable.ConfigurationLibraries.ReleaseStatic, "NazaraEngine-s")
table.insert(exampleTable.ConfigurationLibraries.DebugDynamic, "NazaraEngine-d")
table.insert(exampleTable.ConfigurationLibraries.ReleaseDynamic, "NazaraEngine")
else
table.insert(exampleTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
table.insert(exampleTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
table.insert(exampleTable.ConfigurationLibraries.DebugDynamic, library .. "-d")
table.insert(exampleTable.ConfigurationLibraries.ReleaseDynamic, library)
end
else
table.insert(libraries, library)
end
end
exampleTable.Libraries = libraries
for platform, fileTable in ipairs(exampleTable.OsFiles) do
platform = string.lower(platform)
if (platform == "posix") then
for k,v in ipairs(PosixOSes) do
if (os.is(v)) then
platform = v
break
end
end
end
if (os.is(platform)) then
for k,v in ipairs(fileTable) do
table.insert(exampleTable.Files, v)
end
else
for k,v in ipairs(fileTable) do
table.insert(exampleTable.FilesExclusion, v)
end
end
end
exampleTable.OsFiles = nil
for platform, libraryTable in ipairs(exampleTable.OsLibraries) do
platform = string.lower(platform)
if (platform == "posix") then
for k,v in ipairs(PosixOSes) do
if (os.is(v)) then
platform = v
break
end
end
end
if (os.is(platform)) then
for k,v in ipairs(libraryTable) do
table.insert(exampleTable.Libraries, v)
end
end
end
exampleTable.OsLibraries = nil
table.insert(self.Examples, exampleTable)
return true return true
end end
function NazaraBuild:RegisterExternLibrary(libTable) function NazaraBuild:RegisterExternLibrary(libTable)
if (libTable.Name == nil or type(libTable.Name) ~= "string") then if (libTable.Name == nil or type(libTable.Name) ~= "string" or string.len(libTable.Name) == 0) then
return false, "Module name is invalid" return false, "Invalid library name"
end end
if (string.len(libTable.Name) == 0) then local lowerCaseName = libTable.Name:lower()
return false, "Module name is empty" if (self.ExtLibs[lowerCaseName] ~= nil) then
return false, "This library name is already in use"
end end
if (libTable.Files == nil or type(libTable.Files) ~= "table") then if (libTable.Files == nil or type(libTable.Files) ~= "table") then
return false, "Module files table is invalid" return false, "Invalid file table"
end end
if (#libTable.Files == 0) then if (#libTable.Files == 0) then
return false, "Module files table is empty" return false, "This library has no files"
end end
libTable.Libraries = libraries libTable.Type = "ExternLib"
self.ExtLibs[lowerCaseName] = libTable
for platform, fileTable in pairs(libTable.OsFiles) do
platform = string.lower(platform)
if (platform == "posix") then
for k,v in ipairs(PosixOSes) do
if (os.is(v)) then
platform = v
break
end
end
end
if (os.is(platform)) then
for k,v in pairs(fileTable) do
table.insert(libTable.Files, v)
end
else
for k,v in pairs(fileTable) do
table.insert(libTable.FilesExclusion, v)
end
end
end
libTable.OsFiles = nil
for platform, libraryTable in pairs(libTable.OsLibraries) do
platform = string.lower(platform)
if (platform == "posix") then
for k,v in ipairs(PosixOSes) do
if (os.is(v)) then
platform = v
break
end
end
end
if (os.is(platform)) then
for k,v in pairs(libraryTable) do
table.insert(libTable.Libraries, v)
end
end
end
libTable.OsLibraries = nil
table.insert(self.ExtLibs, libTable)
return true return true
end end
function NazaraBuild:RegisterModule(moduleTable) function NazaraBuild:RegisterModule(moduleTable)
if (moduleTable.Name == nil or type(moduleTable.Name) ~= "string") then if (moduleTable.Name == nil or type(moduleTable.Name) ~= "string" or string.len(moduleTable.Name) == 0) then
return false, "Module name is invalid" return false, "Invalid module name"
end end
if (string.len(moduleTable.Name) == 0) then local lowerCaseName = moduleTable.Name:lower()
return false, "Module name is empty" if (self.Modules[lowerCaseName] ~= nil) then
return false, "This module name is already in use"
end end
table.insert(moduleTable.Defines, "NAZARA_" .. moduleTable.Name:upper() .. "_BUILD") table.insert(moduleTable.Defines, "NAZARA_" .. moduleTable.Name:upper() .. "_BUILD")
@ -587,79 +571,154 @@ function NazaraBuild:RegisterModule(moduleTable)
table.insert(moduleTable.Files, "../src/Nazara/" .. moduleTable.Name .. "/**.hpp") table.insert(moduleTable.Files, "../src/Nazara/" .. moduleTable.Name .. "/**.hpp")
table.insert(moduleTable.Files, "../src/Nazara/" .. moduleTable.Name .. "/**.inl") table.insert(moduleTable.Files, "../src/Nazara/" .. moduleTable.Name .. "/**.inl")
table.insert(moduleTable.Files, "../src/Nazara/" .. moduleTable.Name .. "/**.cpp") table.insert(moduleTable.Files, "../src/Nazara/" .. moduleTable.Name .. "/**.cpp")
table.insert(moduleTable.FilesExclusion, "../src/Nazara/" .. moduleTable.Name .. "/Debug/NewOverload.cpp")
if (_OPTIONS["united"] and lowerCaseName ~= "core") then
table.insert(moduleTable.FilesExclusion, "../src/Nazara/" .. moduleTable.Name .. "/Debug/NewOverload.cpp")
end
moduleTable.Type = "Module"
self.Modules[lowerCaseName] = moduleTable
return true
end
function NazaraBuild:RegisterTool(toolTable)
if (toolTable.Name == nil or type(toolTable.Name) ~= "string" or string.len(toolTable.Name) == 0) then
return false, "Invalid tool name"
end
local lowerCaseName = toolTable.Name:lower()
if (self.Tools[lowerCaseName] ~= nil) then
return false, "This tool name is already in use"
end
if (toolTable.Directory == nil or type(toolTable.Directory) ~= "string" or string.len(toolTable.Directory) == 0) then
return false, "Invalid tool directory"
end
if (toolTable.Kind == nil or type(toolTable.Kind) ~= "string" or string.len(toolTable.Kind) == 0) then
return false, "Invalid tool type"
end
local lowerCaseKind = toolTable.Kind:lower()
if (lowerCaseKind == "library" or lowerCaseKind == "consoleapp" or lowerCaseKind == "windowapp") then
toolTable.Kind = lowerCaseKind
else
return false, "Invalid tool type"
end
toolTable.Type = "Tool"
self.Tools[lowerCaseName] = toolTable
return true
end
local PosixOSes = {
["bsd"] = true,
["linux"] = true,
["macosx"] = true,
["solaris"] = true
}
function NazaraBuild:Process(infoTable)
local libraries = {} local libraries = {}
for k, library in pairs(moduleTable.Libraries) do for k, library in pairs(infoTable.Libraries) do
if (string.sub(library, 1, 6) == "Nazara") then local moduleName = library:match("Nazara(%w+)")
if (not _OPTIONS["united"]) then local moduleTable = moduleName and self.Modules[moduleName:lower()]
table.insert(moduleTable.ConfigurationLibraries.DebugStatic, library .. "-s-d") local toolTable = moduleName and self.Tools[moduleName:lower()]
table.insert(moduleTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
table.insert(moduleTable.ConfigurationLibraries.DebugDynamic, library .. "-d") if (moduleTable) then
table.insert(moduleTable.ConfigurationLibraries.ReleaseDynamic, library) if (_OPTIONS["united"]) then
library = "NazaraEngine"
else
library = "Nazara" .. moduleTable.Name
end
if (not _OPTIONS["united"] or infoTable.Type ~= "Module") then
table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, library .. "-d")
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library)
end end
else else
local found = false local extLibTable = self.ExtLibs[library:lower()]
for k,extlibTable in pairs(self.ExtLibs) do if (extLibTable) then
if (library == extlibTable.Name) then library = extLibTable.Name
table.insert(moduleTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
table.insert(moduleTable.ConfigurationLibraries.ReleaseStatic, library .. "-s") table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
table.insert(moduleTable.ConfigurationLibraries.DebugDynamic, library .. "-s-d") table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
table.insert(moduleTable.ConfigurationLibraries.ReleaseDynamic, library .. "-s") table.insert(infoTable.ConfigurationLibraries.DebugDynamic, library .. "-s-d")
found = true table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library .. "-s")
break else
end if (toolTable and toolTable.Kind == "library") then
library = "Nazara" .. toolTable.Name
-- Import tools includes
for k,v in ipairs(toolTable.Includes) do
table.insert(infoTable.Includes, v)
end end
if (not found) then table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
table.insert(infoTable.ConfigurationLibraries.ReleaseStatic, library .. "-s")
table.insert(infoTable.ConfigurationLibraries.DebugDynamic, library .. "-d")
table.insert(infoTable.ConfigurationLibraries.ReleaseDynamic, library)
else
table.insert(libraries, library) table.insert(libraries, library)
end end
end end
end end
moduleTable.Libraries = libraries end
infoTable.Libraries = libraries
for platform, fileTable in pairs(moduleTable.OsFiles) do for platform, fileTable in pairs(infoTable.OsFiles) do
platform = string.lower(platform) platform = string.lower(platform)
if (platform == "posix") then if (platform == "posix") then
for k,v in ipairs(PosixOSes) do local osname = os.get()
if (os.is(v)) then if (PosixOSes[osname]) then
platform = v platform = osname
break
end
end end
end end
if (os.is(platform)) then if (os.is(platform)) then
for k,v in pairs(fileTable) do for k,v in ipairs(fileTable) do
table.insert(moduleTable.Files, v) table.insert(infoTable.Files, v)
end end
else else
for k,v in pairs(fileTable) do for k,v in ipairs(fileTable) do
table.insert(moduleTable.FilesExclusion, v) table.insert(infoTable.FilesExclusion, v)
end end
end end
end end
moduleTable.OsFiles = nil infoTable.OsFiles = nil
for platform, libraryTable in pairs(moduleTable.OsLibraries) do for platform, libraryTable in pairs(infoTable.OsLibraries) do
platform = string.lower(platform) platform = string.lower(platform)
if (platform == "posix") then if (platform == "posix") then
for k,v in ipairs(PosixOSes) do local osname = os.get()
if (os.is(v)) then if (PosixOSes[osname]) then
platform = v platform = osname
break
end
end end
end end
if (os.is(platform)) then if (os.is(platform)) then
for k,library in pairs(libraryTable) do for k,v in ipairs(libraryTable) do
table.insert(moduleTable.Libraries, library) table.insert(infoTable.Libraries, v)
end end
end end
end end
moduleTable.OsLibraries = nil infoTable.OsLibraries = nil
end
table.insert(self.Modules, moduleTable) function NazaraBuild:SetupInfoTable(infoTable)
return true infoTable.ConfigurationLibraries = {}
infoTable.ConfigurationLibraries.DebugStatic = {}
infoTable.ConfigurationLibraries.ReleaseStatic = {}
infoTable.ConfigurationLibraries.DebugDynamic = {}
infoTable.ConfigurationLibraries.ReleaseDynamic = {}
infoTable.Defines = {}
infoTable.Files = {}
infoTable.FilesExclusion = {}
infoTable.Flags = {}
infoTable.Includes = {}
infoTable.Libraries = {}
infoTable.OsFiles = {}
infoTable.OsLibraries = {}
end end

View File

@ -0,0 +1,31 @@
TOOL.Name = "SDK"
TOOL.Directory = "../SDK/lib"
TOOL.Kind = "Library"
TOOL.Defines = {
"NDK_BUILD"
}
TOOL.Includes = {
"../SDK/include"
}
TOOL.Files = {
"../SDK/include/NDK/**.hpp",
"../SDK/include/NDK/**.inl",
"../SDK/src/NDK/**.hpp",
"../SDK/src/NDK/**.inl",
"../SDK/src/NDK/**.cpp"
}
TOOL.Libraries = {
"NazaraCore",
"NazaraAudio",
"NazaraLua",
"NazaraNoise",
"NazaraPhysics",
"NazaraUtility",
"NazaraRenderer",
"NazaraGraphics",
}