summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/genie/src/actions/ninja/_ninja.lua
blob: e0f9899fdb394ba6cadd9dc7bd68f0d7f8b5f014 (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
--
-- GENie - Project generator tool
-- https://github.com/bkaradzic/GENie#license
--

premake.ninja = { }

local p = premake

newaction
{
	-- Metadata for the command line and help system
	trigger     = "ninja",
	shortname   = "ninja",
	description = "Generate Ninja build files",
	module      = "ninja",

	-- The capabilities of this action
	valid_kinds     = {"ConsoleApp", "WindowedApp", "SharedLib", "StaticLib"},
	valid_languages = {"C", "C++", "Swift"},
	valid_tools     = {
		cc    = { "gcc" },
		swift = { "swift" },
	},

	-- Solution and project generation logic
	onsolution = function(sln)
		io.eol    = "\r\n"
		io.indent = "\t"
		io.escaper(p.ninja.esc)
		p.generate(sln, "Makefile", p.ninja.generate_solution)
		io.indent = "  "
		p.ninja.generate_ninja_builds(sln)
	end,

	onproject = function(prj)
		io.eol    = "\r\n"
		io.indent = "  "
		io.escaper(p.ninja.esc)
		p.ninja.generate_project(prj)
	end,

	oncleansolution = function(sln)
		for _,name in ipairs(sln.configurations) do
			premake.clean.file(sln, p.ninja.get_solution_name(sln, name))
		end
	end,

	oncleanproject = function(prj)
		-- TODO
	end,

	oncleantarget = function(prj)
		-- TODO
	end,
}