Merge branch 'master' into vulkan

This commit is contained in:
Lynix
2018-01-16 21:15:58 +01:00
375 changed files with 133309 additions and 549 deletions

View File

@@ -104,7 +104,7 @@ ACTION.Function = function ()
for arch, enabled in pairs(archEnabled) do
if (enabled) then
local archLibSrc = realLibDir .. arch .. "/"
local arch3rdPartyBinSrc = "../extlibs/lib/common/" .. arch .. "/"
local arch3rdPartyBinSrc = "../thirdparty/lib/common/" .. arch .. "/"
local archBinDst = "bin/" .. arch .. "/"
local archLibDst = "lib/" .. arch .. "/"

View File

@@ -4,12 +4,12 @@ NazaraBuild = {}
local clangGccActions = "action:" .. table.concat({"codeblocks", "codelite", "gmake", "xcode3", "xcode4"}, " or ")
function NazaraBuild:AddExecutablePath(path)
self.ExecutableDir[path] = true
self.InstallDir[path] = true
table.insert(self.ExecutableDir, path)
self:AddInstallPath(path)
end
function NazaraBuild:AddInstallPath(path)
self.InstallDir[path] = true
table.insert(self.InstallDir, path)
end
function NazaraBuild:FilterLibDirectory(prefix, func)
@@ -53,41 +53,49 @@ function NazaraBuild:Execute()
end
if (self.Actions[_ACTION] == nil) then
-- Start defining projects
workspace("NazaraEngine")
platforms(platformData)
location(_ACTION)
do
local linkTypes = {"Dynamic"} -- {"Static", "Dynamic"}
local configs = {}
for k,linkType in pairs(linkTypes) do
for k,config in pairs(self.Config["Configurations"]) do
table.insert(configs, config .. linkType)
end
end
configurations(configs)
end
-- Extern libraries
if (self.Config["BuildDependencies"]) then
workspace("NazaraExtlibs")
platforms(platformData)
-- Configuration générale
configurations({
"DebugStatic",
"ReleaseStatic"
})
self:PrepareGeneric()
self:FilterLibDirectory("../extlibs/lib/", targetdir)
filter(clangGccActions)
buildoptions("-U__STRICT_ANSI__")
filter({})
includedirs("../extlibs/include")
libdirs("../extlibs/lib/common")
location(_ACTION)
self:FilterLibDirectory("../thirdparty/lib/", targetdir)
for k, libTable in ipairs(self.OrderedExtLibs) do
project(libTable.Name)
self:PrepareGeneric()
language(libTable.Language)
location(_ACTION .. "/extlibs")
location(_ACTION .. "/thirdparty")
files(libTable.Files)
excludes(libTable.FilesExcluded)
defines(libTable.Defines)
flags(libTable.Flags)
kind("StaticLib") -- Force them as static libs
includedirs("../thirdparty/include")
includedirs(libTable.Includes)
links(libTable.Libraries)
libdirs("../thirdparty/lib/common")
filter(clangGccActions)
buildoptions("-U__STRICT_ANSI__")
filter("architecture:x86")
libdirs(libTable.LibraryPaths.x86)
@@ -103,31 +111,7 @@ function NazaraBuild:Execute()
filter({})
end
end
-- Start defining projects
workspace("NazaraEngine")
platforms(platformData)
self:PrepareMainWorkspace()
-- Add lib/conf/arch to library search path
self:FilterLibDirectory("../lib/", libdirs)
do
local linkTypes = {"Dynamic"} -- {"Static", "Dynamic"}
local configs = {}
for k,linkType in pairs(linkTypes) do
for k,config in pairs(self.Config["Configurations"]) do
table.insert(configs, config .. linkType)
end
end
configurations(configs)
end
language("C++")
location(_ACTION)
if (self.Config["PremakeProject"] and os.ishost("windows")) then
local commandLine = "premake5.exe " .. table.concat(_ARGV, ' ')
project("_PremakeProject")
@@ -138,11 +122,15 @@ function NazaraBuild:Execute()
-- Modules
if (_OPTIONS["united"]) then
project("NazaraEngine")
self:PrepareMainWorkspace()
end
for k, moduleTable in ipairs(self.OrderedModules) do
if (not _OPTIONS["united"]) then
project("Nazara" .. moduleTable.Name)
self:PrepareMainWorkspace()
end
location(_ACTION .. "/modules")
@@ -150,7 +138,7 @@ function NazaraBuild:Execute()
includedirs({
"../include",
"../src/",
"../extlibs/include"
"../thirdparty/include"
})
files(moduleTable.Files)
@@ -162,7 +150,7 @@ function NazaraBuild:Execute()
links(moduleTable.Libraries)
libdirs({
"../extlibs/lib/common",
"../thirdparty/lib/common",
"../lib"
})
@@ -195,6 +183,8 @@ function NazaraBuild:Execute()
project(prefix .. toolTable.Name)
self:PrepareMainWorkspace()
location(_ACTION .. "/tools")
if (toolTable.Kind == "plugin" or toolTable.Kind == "library") then
@@ -216,11 +206,11 @@ function NazaraBuild:Execute()
includedirs({
"../include",
"../extlibs/include"
"../thirdparty/include"
})
libdirs({
"../extlibs/lib/common",
"../thirdparty/lib/common",
"../lib"
})
@@ -258,6 +248,8 @@ function NazaraBuild:Execute()
project("Demo" .. exampleTable.Name)
self:PrepareMainWorkspace()
location(_ACTION .. "/examples")
if (exampleTable.Kind == "plugin" or exampleTable.Kind == "library") then
@@ -278,7 +270,7 @@ function NazaraBuild:Execute()
debugdir(destPath)
includedirs({
"../include",
"../extlibs/include"
"../thirdparty/include"
})
libdirs("../lib")
@@ -355,7 +347,7 @@ function NazaraBuild:Initialize()
ACTION = nil
-- Extern libraries
local extlibs = os.matchfiles("../extlibs/build/*.lua")
local extlibs = os.matchfiles("../thirdparty/build/*.lua")
for k,v in pairs(extlibs) do
local f, err = loadfile(v)
if (f) then
@@ -463,7 +455,7 @@ function NazaraBuild:Initialize()
if (self:Process(projectTable)) then
table.insert(orderedTables[k], projectTable)
else
print("Rejected " .. projectTable.Name .. " " .. string.lower(projectTable.Type) .. ": " .. projectTable.ExcludeReason)
print("Rejected " .. projectTable.Name .. " " .. string.lower(projectTable.Category) .. ": " .. projectTable.ExcludeReason)
end
end
@@ -610,11 +602,13 @@ function NazaraBuild:MakeInstallCommands(infoTable)
postbuildmessage("Copying " .. infoTable.Name .. " library and its dependencies to install/executable directories...")
for k,v in pairs(self.InstallDir) do
local destPath = path.translate(path.isabsolute(k) and k or "../../" .. k)
-- Copy built file to install directory
for k,installPath in pairs(self.InstallDir) do
local destPath = path.translate(path.isabsolute(installPath) and installPath or "../../" .. installPath)
postbuildcommands({[[xcopy "%{path.translate(cfg.buildtarget.relpath)}" "]] .. destPath .. [[\" /E /Y]]})
end
-- Copy additional dependencies to executable directories too
for k,fileName in pairs(table.join(infoTable.Libraries, infoTable.DynLib)) do
local paths = {}
for k,v in pairs(infoTable.BinaryPaths.x86) do
@@ -637,9 +631,9 @@ function NazaraBuild:MakeInstallCommands(infoTable)
filter("architecture:" .. arch)
for k,v in pairs(self.ExecutableDir) do
for k,execPath in pairs(self.ExecutableDir) do
local srcPath = path.isabsolute(srcPath) and path.translate(srcPath) or [[%{path.translate(cfg.linktarget.relpath:sub(1, -#cfg.linktarget.name - 1) .. "../../]] .. srcPath .. [[")}]]
local destPath = path.translate(path.isabsolute(k) and k or "../../" .. k)
local destPath = path.translate(path.isabsolute(execPath) and execPath or "../../" .. execPath)
postbuildcommands({[[xcopy "]] .. srcPath .. [[" "]] .. destPath .. [[\" /E /Y]]})
end
end
@@ -658,13 +652,17 @@ local PosixOSes = {
}
function NazaraBuild:Process(infoTable)
if (infoTable.Excluded) then
return false
end
local libraries = {}
for k, library in pairs(infoTable.Libraries) do
local libraryTable = self:GetDependency(infoTable, library)
if (libraryTable) then
if (libraryTable.Excluded) then
infoTable.Excluded = true
infoTable.ExcludeReason = "depends on excluded " .. library .. " " .. libraryTable.Type:lower()
infoTable.ExcludeReason = "depends on excluded " .. library .. " " .. libraryTable.Category:lower()
return false
end
@@ -686,12 +684,16 @@ function NazaraBuild:Process(infoTable)
elseif (libraryTable.Type == "ExternLib") then
library = libraryTable.Name
table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
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")
if (self.Config["BuildDependencies"]) then
table.insert(libraries, library)
else
table.insert(infoTable.ConfigurationLibraries.DebugStatic, library .. "-s-d")
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
elseif (libraryTable.Type == "Tool") then
library = "Nazara" .. libraryTable.Name
@@ -786,7 +788,7 @@ function NazaraBuild:PrepareGeneric()
cppdialect("C++14")
self:FilterLibDirectory("../extlibs/lib/", libdirs)
self:FilterLibDirectory("../thirdparty/lib/", libdirs)
-- Fixes Premake stuff
filter({"kind:SharedLib", clangGccActions})
@@ -801,13 +803,13 @@ function NazaraBuild:PrepareGeneric()
filter("kind:*Lib")
pic("On")
filter({"kind:*Lib", "configurations:DebugStatic"})
filter({"kind:StaticLib", "configurations:Debug*"})
targetsuffix("-s-d")
filter({"kind:*Lib", "configurations:ReleaseStatic"})
filter({"kind:StaticLib", "configurations:Release*"})
targetsuffix("-s")
filter({"kind:*Lib", "configurations:DebugDynamic"})
filter({"kind:SharedLib", "configurations:Debug*"})
targetsuffix("-d")
filter("configurations:*Debug*")
@@ -840,6 +842,11 @@ end
function NazaraBuild:PrepareMainWorkspace()
self:PrepareGeneric()
language("C++")
-- Add lib/conf/arch to library search path
self:FilterLibDirectory("../lib/", libdirs)
filter("action:vs*")
buildoptions({"/MP", "/bigobj"}) -- Multiprocessus build and big .obj
defines("_CRT_SECURE_NO_WARNINGS")
@@ -927,6 +934,8 @@ function NazaraBuild:RegisterExample(exampleTable)
exampleTable.Files = files
exampleTable.Type = "Example"
exampleTable.Category = exampleTable.Category or exampleTable.Type
self.Examples[lowerCaseName] = exampleTable
return true
end
@@ -950,6 +959,8 @@ function NazaraBuild:RegisterExternLibrary(libTable)
end
libTable.Type = "ExternLib"
libTable.Category = libTable.Category or libTable.Type
self.ExtLibs[lowerCaseName] = libTable
return true
end
@@ -976,6 +987,8 @@ function NazaraBuild:RegisterModule(moduleTable)
end
moduleTable.Type = "Module"
moduleTable.Category = moduleTable.Category or moduleTable.Type
self.Modules[lowerCaseName] = moduleTable
return true
end
@@ -1006,10 +1019,13 @@ function NazaraBuild:RegisterTool(toolTable)
end
toolTable.Type = "Tool"
toolTable.Category = toolTable.Category or toolTable.Type
self.Tools[lowerCaseName] = toolTable
return true
end
local globalExcludes = {}
function NazaraBuild:Resolve(infoTable)
if (infoTable.ClientOnly and self.Config["ServerMode"]) then
infoTable.Excluded = true
@@ -1017,15 +1033,28 @@ function NazaraBuild:Resolve(infoTable)
end
if (infoTable.Excludable) then
local optionName = "excludes-" .. string.lower(infoTable.Type .. "-" .. infoTable.Name)
local globalExcludeOption = "excludes-" .. infoTable.Category:lower() .. "s"
if (not globalExcludes[infoTable.Category]) then
newoption({
trigger = globalExcludeOption,
description = "Excludes all " .. string.lower(infoTable.Category) .. "s and projects relying on it"
})
globalExcludes[infoTable.Category] = true
end
local specificExcludeOption = "excludes-" .. string.lower(infoTable.Category .. "-" .. infoTable.Name)
newoption({
trigger = optionName,
description = "Excludes the " .. infoTable.Name .. " " .. string.lower(infoTable.Type) .. " and projects relying on it"
trigger = specificExcludeOption,
description = "Excludes the " .. infoTable.Name .. " " .. string.lower(infoTable.Category) .. " and projects relying on it"
})
if (_OPTIONS[optionName]) then
if (_OPTIONS[globalExcludeOption]) then
infoTable.Excluded = true
infoTable.ExcludeReason = "excluded by command-line options"
infoTable.ExcludeReason = "excluded by global command-line options"
elseif (_OPTIONS[specificExcludeOption]) then
infoTable.Excluded = true
infoTable.ExcludeReason = "excluded by specific command-line options"
end
end
@@ -1069,10 +1098,10 @@ function NazaraBuild:SetupExtlibTable(infoTable)
infoTable.Kind = "library"
table.insert(infoTable.BinaryPaths.x86, "../extlibs/lib/common/x86")
table.insert(infoTable.BinaryPaths.x64, "../extlibs/lib/common/x64")
table.insert(infoTable.LibraryPaths.x86, "../extlibs/lib/common/x86")
table.insert(infoTable.LibraryPaths.x64, "../extlibs/lib/common/x64")
table.insert(infoTable.BinaryPaths.x86, "../thirdparty/lib/common/x86")
table.insert(infoTable.BinaryPaths.x64, "../thirdparty/lib/common/x64")
table.insert(infoTable.LibraryPaths.x86, "../thirdparty/lib/common/x86")
table.insert(infoTable.LibraryPaths.x64, "../thirdparty/lib/common/x64")
end
function NazaraBuild:SetupModuleTable(infoTable)
@@ -1080,10 +1109,10 @@ function NazaraBuild:SetupModuleTable(infoTable)
infoTable.Kind = "library"
table.insert(infoTable.BinaryPaths.x86, "../extlibs/lib/common/x86")
table.insert(infoTable.BinaryPaths.x64, "../extlibs/lib/common/x64")
table.insert(infoTable.LibraryPaths.x86, "../extlibs/lib/common/x86")
table.insert(infoTable.LibraryPaths.x64, "../extlibs/lib/common/x64")
table.insert(infoTable.BinaryPaths.x86, "../thirdparty/lib/common/x86")
table.insert(infoTable.BinaryPaths.x64, "../thirdparty/lib/common/x64")
table.insert(infoTable.LibraryPaths.x86, "../thirdparty/lib/common/x86")
table.insert(infoTable.LibraryPaths.x64, "../thirdparty/lib/common/x64")
end
NazaraBuild.SetupToolTable = NazaraBuild.SetupInfoTable

View File

@@ -1,6 +1,8 @@
MODULE.Name = "Physics2D"
MODULE.Defines = {"CP_USE_CGTYPES=0", "TARGET_OS_IPHONE=0", "TARGET_OS_MAC=0"}
MODULE.Libraries = {
"NazaraCore",
"chipmunk-s"
"chipmunk"
}

View File

@@ -4,7 +4,7 @@ TOOL.Directory = "../plugins/Assimp"
TOOL.Kind = "Plugin"
TOOL.Includes = {
"../extlibs/include",
"../thirdparty/include",
"../include",
"../plugins/Assimp"
}

View File

@@ -27,5 +27,8 @@ TOOL.Libraries = function()
table.insert(libraries, "Nazara" .. v.Name)
end
-- Keep libraries in the same order to prevent useless premake regeneration
table.sort(libraries)
return libraries
end

View File

@@ -1,5 +1,6 @@
TOOL.Name = "UnitTests"
TOOL.Category = "Test"
TOOL.Directory = "../tests"
TOOL.EnableConsole = true
TOOL.Kind = "Application"

View File

@@ -1,5 +1,6 @@
TOOL.Name = "UnitTestsServer"
TOOL.Category = "Test"
TOOL.Directory = "../tests"
TOOL.EnableConsole = true
TOOL.Kind = "Application"