summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/genie/src/tools/valac.lua
blob: 43f65818cf4f757f184388ade1d82f91be1165c9 (plain) (blame)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--
-- valac.lua
-- Provides valac-specific configuration strings.
--


	premake.valac = { }


--
-- Set default tools
--

	premake.valac.valac  = "valac"
	premake.valac.cc     = premake.gcc.cc
	premake.valac.glibrc = "glib-compile-resources"


--
-- Translation of Premake flags into GCC flags
--

	local valaflags =
	{
		DisableAssert             = "--disable-assert",               -- Disable assertions
		DisableSinceCheck         = "--disable-since-check",          -- Do not check whether used symbols exist in local packages
		DisableWarnings           = "--disable-warnings",             -- Disable warnings
		EnableChecking            = "--enable-checking",              -- Enable additional run-time checks
		EnableDeprecated          = "--enable-deprecated",            -- Enable deprecated features
		EnableExperimental        = "--enable-experimental",          -- Enable experimental features
		EnableExperimentalNonNull = "--enable-experimental-non-null", -- Enable experimental enhancements for non-null types
		EnableGObjectTracing      = "--enable-gobject-tracing",       -- Enable GObject creation tracing
		EnableMemProfiler         = "--enable-mem-profiler",          -- Enable GLib memory profiler
		FatalWarnings             = "--fatal-warnings",               -- Treat warnings as fatal
		HideInternal              = "--hide-internal",                -- Hide symbols marked as internal
		NoStdPkg                  = "--nostdpkg",                     -- Do not include standard packages
		Symbols                   = "-g",                             -- Produce debug information
	}

	local valaccflags =
	{
		Optimize                  = "-O2",
		OptimizeSize              = "-Os",
		OptimizeSpeed             = "-O3",
		Symbols                   = "-g",                             -- Produce debug information
	}

--
-- Map platforms to flags
--

	premake.valac.platforms =
	{
		Native = {
		},
		x64 = {
			flags = "-m64"
		},
	}



--
-- Returns a list of compiler flags for `valac`, based on the supplied configuration.
--

	function premake.valac.getvalaflags(cfg)
		return table.translate(cfg.flags, valaflags)
	end



--
-- Returns a list of compiler flags for `cc`, based on the supplied configuration.
--

	function premake.valac.getvalaccflags(cfg)
		return table.translate(cfg.flags, valaccflags)
	end



--
-- Decorate pkgs for the Vala command line.
--

	function premake.valac.getlinks(links)
		local result = { }
		for _, pkg in ipairs(links) do
			table.insert(result, '--pkg ' .. pkg)
		end
		return result
	end



--
-- Decorate defines for the Vala command line.
--

	function premake.valac.getdefines(defines)
		local result = { }
		for _, def in ipairs(defines) do
			table.insert(result, '-D ' .. def)
		end
		return result
	end



--
-- Decorate vapidirs for the Vala command line.
--

	function premake.valac.getvapidirs(vapidirs)
		local result = { }
		for _, def in ipairs(vapidirs) do
			table.insert(result, '--vapidir=' .. def)
		end
		return result
	end