Repository navigation
Expand file tree
/
Copy pathproject_lib.lua
More file actions
77 lines (60 loc) · 2.16 KB
/
Copy pathproject_lib.lua
File metadata and controls
77 lines (60 loc) · 2.16 KB
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
75
76
77
--
-- Zidar - Build system scripts
-- Copyright (c) 2025-2026 Milos Tosic, Rudji Games. All rights reserved.
-- License: https://github.com/RudjiGames/zidar/blob/master/LICENSE
--
function addProject_lib(_name, _libType, _shared, _suffix, _disablePCH)
-- A suffixed variant (e.g. "rapp_bgfx") is a second project built from the
-- same sources as its base project ("rapp") but with a different
-- configuration. All paths are resolved from the base name; only the
-- project (and its dependencies/extra-config hooks) use the suffixed name.
_suffix = _suffix or ""
local projectName = _name .. _suffix
group ( vpathStringFromLibraryType(_libType) )
project ( projectName )
_shared = _shared or false
_disablePCH = _disablePCH or false
project().kind = "StaticLib"
if _shared then
project().kind = "SharedLib"
end
kind ( project().kind )
uuid ( os.uuid(project().name) )
flags { Flags_Libraries }
local projectPath = projectGetPath(_name)
local libsPath = path.getdirectory(projectPath)
local srcFilesPath = projectPath .. "/src"
local incFilesPath = projectGetIncludePath(projectPath)
local sourceFiles, isCPP, walks = projectSourceFiles(srcFilesPath, incFilesPath)
if isCPP then
language "C++"
else
language "C"
end
files { sourceFiles }
-- Windows resource scripts (e.g. VERSIONINFO) - compiled only for Windows targets.
configuration { "windows" }
files { filterFilesByExtension(walks[srcFilesPath], { ".rc" }) }
configuration {}
local targetOS = getTargetOS()
if targetOS == "ios" or targetOS == "osx" then
files { filterFilesByExtension(walks[srcFilesPath], { ".mm" }) }
end
removefiles { projectPath .. "/tests/**.*" }
removefiles { projectPath .. "/samples/**.*" }
removefiles { projectPath .. "/tools/**.*" }
includedirs { libsPath }
if incFilesPath then
includedirs { incFilesPath }
end
includedirs { srcFilesPath }
-- no need to cache, done once per project
if os.isdir(projectPath .. "/3rd") then
addIncludePath(_name, projectPath .. "/3rd")
end
if _disablePCH ~= true then
addPCH( srcFilesPath, projectName )
end
projectConfig()
addDependencies(project().name)
end