/
project_lib_sample.lua
74 lines (56 loc) · 1.93 KB
/
project_lib_sample.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--
-- Copyright 2023 Milos Tosic. All rights reserved.
-- License: http://www.opensource.org/licenses/BSD-2-Clause
--
function addProject_lib_sample(_name, _sampleName)
if _ACTION == nil then return end
group ("samples")
project (_name .. "_sample_" .. _sampleName)
language "C++"
kind "ConsoleApp"
uuid ( os.uuid(project().name) )
local libsPath = getProjectPath(_name, ProjectPath.Root)
project().path = libsPath .. _name .. "/"
local srcFilesPath = project().path .. "samples/" .. _sampleName .. "/"
local incFilesPath = project().path .. "samples/" .. _sampleName .. "/"
local sourceFiles = mergeTables( { srcFilesPath .. "**.cpp" },
{ incFilesPath .. "**.h" } )
files { sourceFiles }
local withBGFX = false
local headers = os.matchfiles( incFilesPath .. "**.h")
for _,file in ipairs( headers ) do
local headerSrc = file_read(file);
if headerSrc:find("#define RAPP_WITH_BGFX") then -- NB: a single space character between 'define' and 'RAPP_WITH_BGFX'
withBGFX = true
break
end
end
local name = _sampleName
if string.find(_sampleName, "_") ~= nil then
name = string.sub(_sampleName, string.find(_sampleName, "_") + 1, string.len(_sampleName))
end
addPCH( srcFilesPath, name )
includedirs
{
project().path .. "samples/",
incFilesPath,
}
flags { Flags_Libraries }
assert(loadfile(RTM_SCRIPTS_DIR .. "configurations.lua"))( sourceFiles,
false, -- IS_LIBRARY
false, -- IS_SHARED_LIBRARY
false, -- COPY_QT_DLLS
false, -- WITH_QT
true -- EXECUTABLE
)
local dependencies = {}
if _name ~= "rapp" then
dependencies = mergeTables(dependencies, { _name })
end
if withBGFX then
dependencies = mergeTables(dependencies, {{"rapp", "bgfx"}})
else
dependencies = mergeTables(dependencies, {"rapp"})
end
addDependencies(_sampleName, dependencies)
end