2016-11-09 19:29:33 +00:00
|
|
|
--
|
|
|
|
-- Name: d/_preload.lua
|
|
|
|
-- Purpose: Define the D language API's.
|
|
|
|
-- Author: Manu Evans
|
|
|
|
-- Created: 2013/10/28
|
|
|
|
-- Copyright: (c) 2013-2015 Manu Evans and the Premake project
|
|
|
|
--
|
|
|
|
|
|
|
|
-- TODO:
|
|
|
|
-- MonoDevelop/Xamarin Studio has 'workspaces', which correspond to collections
|
|
|
|
-- of Premake workspaces. If premake supports multiple workspaces, we should
|
|
|
|
-- write out a workspace file...
|
|
|
|
|
|
|
|
local p = premake
|
|
|
|
local api = p.api
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Register the D extension
|
|
|
|
--
|
|
|
|
|
|
|
|
p.D = "D"
|
|
|
|
api.addAllowed("language", p.D)
|
2017-01-31 20:10:40 +00:00
|
|
|
|
2016-11-09 19:29:33 +00:00
|
|
|
api.addAllowed("floatingpoint", "None")
|
|
|
|
api.addAllowed("flags", {
|
|
|
|
"CodeCoverage",
|
2019-06-02 08:41:27 +00:00
|
|
|
"Color",
|
2016-11-09 19:29:33 +00:00
|
|
|
"Documentation",
|
|
|
|
"GenerateHeader",
|
|
|
|
"GenerateJSON",
|
|
|
|
"GenerateMap",
|
2019-06-02 08:41:27 +00:00
|
|
|
"LowMem",
|
2016-11-09 19:29:33 +00:00
|
|
|
"Profile",
|
|
|
|
"Quiet",
|
|
|
|
"RetainPaths",
|
|
|
|
"SymbolsLikeC",
|
|
|
|
"UnitTest",
|
2018-04-19 20:42:13 +00:00
|
|
|
-- These are used by C++/D mixed $todo move them somewhere else? "flags2" "Dflags"?
|
|
|
|
-- [Code Generation Flags]
|
2019-06-02 08:41:27 +00:00
|
|
|
"UseLDC",
|
2018-04-19 20:42:13 +00:00
|
|
|
"ProfileGC",
|
|
|
|
"StackFrame",
|
|
|
|
"StackStomp",
|
2019-06-02 08:41:27 +00:00
|
|
|
"AllInstantiate",
|
2018-04-19 20:42:13 +00:00
|
|
|
"BetterC",
|
|
|
|
"Main",
|
|
|
|
"PerformSyntaxCheckOnly",
|
|
|
|
-- [Messages Flags]
|
|
|
|
"ShowCommandLine",
|
2016-11-09 19:29:33 +00:00
|
|
|
"Verbose",
|
2018-04-19 20:42:13 +00:00
|
|
|
"ShowTLS",
|
|
|
|
"ShowGC",
|
|
|
|
"IgnorePragma",
|
|
|
|
"ShowDependencies",
|
2016-11-09 19:29:33 +00:00
|
|
|
})
|
|
|
|
|
2021-06-24 15:53:10 +00:00
|
|
|
api.addAllowed("toolset", {
|
|
|
|
"dmd",
|
|
|
|
"gdc",
|
|
|
|
"ldc",
|
|
|
|
})
|
2016-11-09 19:29:33 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Register some D specific properties
|
|
|
|
--
|
|
|
|
|
|
|
|
api.register {
|
2019-06-02 08:41:27 +00:00
|
|
|
name = "boundscheck",
|
2016-11-09 19:29:33 +00:00
|
|
|
scope = "config",
|
2019-06-02 08:41:27 +00:00
|
|
|
kind = "string",
|
|
|
|
allowed = {
|
|
|
|
"Default",
|
|
|
|
"Off",
|
|
|
|
"On",
|
|
|
|
"SafeOnly",
|
|
|
|
},
|
2016-11-09 19:29:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
2019-06-02 08:41:27 +00:00
|
|
|
name = "compilationmodel",
|
2016-11-09 19:29:33 +00:00
|
|
|
scope = "config",
|
2019-06-02 08:41:27 +00:00
|
|
|
kind = "string",
|
|
|
|
allowed = {
|
|
|
|
"Default",
|
|
|
|
"File",
|
|
|
|
"Package", -- TODO: this doesn't work with gmake!!
|
|
|
|
"Project",
|
|
|
|
},
|
2016-11-09 19:29:33 +00:00
|
|
|
}
|
|
|
|
|
2019-06-02 08:41:27 +00:00
|
|
|
api.register {
|
|
|
|
name = "checkaction",
|
|
|
|
scope = "config",
|
|
|
|
kind = "string",
|
|
|
|
allowed = {
|
|
|
|
"Default",
|
|
|
|
"D",
|
|
|
|
"C",
|
|
|
|
"Halt",
|
|
|
|
"Context",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
|
|
|
name = "computetargets",
|
|
|
|
scope = "config",
|
|
|
|
kind = "list:string",
|
|
|
|
}
|
|
|
|
|
|
|
|
-- api.register {
|
|
|
|
-- name = "debugcode",
|
|
|
|
-- scope = "config",
|
|
|
|
-- kind = "string",
|
|
|
|
-- }
|
|
|
|
|
2016-11-09 19:29:33 +00:00
|
|
|
api.register {
|
|
|
|
name = "debugconstants",
|
|
|
|
scope = "config",
|
|
|
|
kind = "list:string",
|
|
|
|
tokens = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
|
|
|
name = "debuglevel",
|
|
|
|
scope = "config",
|
|
|
|
kind = "integer",
|
|
|
|
}
|
|
|
|
|
2019-06-02 08:41:27 +00:00
|
|
|
api.register {
|
|
|
|
name = "dependenciesfile",
|
|
|
|
scope = "config",
|
|
|
|
kind = "path",
|
|
|
|
tokens = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
|
|
|
name = "deprecatedfeatures",
|
|
|
|
scope = "config",
|
|
|
|
kind = "string",
|
|
|
|
allowed = {
|
|
|
|
"Default",
|
|
|
|
"Allow",
|
|
|
|
"Warn",
|
|
|
|
"Error",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2016-11-09 19:29:33 +00:00
|
|
|
api.register {
|
|
|
|
name = "docdir",
|
|
|
|
scope = "config",
|
|
|
|
kind = "path",
|
|
|
|
tokens = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
|
|
|
name = "docname",
|
|
|
|
scope = "config",
|
|
|
|
kind = "string",
|
|
|
|
tokens = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
|
|
|
name = "headerdir",
|
|
|
|
scope = "config",
|
|
|
|
kind = "path",
|
|
|
|
tokens = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
|
|
|
name = "headername",
|
|
|
|
scope = "config",
|
|
|
|
kind = "string",
|
|
|
|
tokens = true,
|
|
|
|
}
|
|
|
|
|
2018-04-19 20:42:13 +00:00
|
|
|
api.register {
|
2019-06-02 08:41:27 +00:00
|
|
|
name = "jsonfile",
|
2018-04-19 20:42:13 +00:00
|
|
|
scope = "config",
|
2019-06-02 08:41:27 +00:00
|
|
|
kind = "path",
|
|
|
|
tokens = true,
|
2018-04-19 20:42:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
|
|
|
name = "importdirs",
|
|
|
|
scope = "config",
|
2018-05-19 17:55:44 +00:00
|
|
|
kind = "list:path",
|
2018-04-19 20:42:13 +00:00
|
|
|
tokens = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
2019-06-02 08:41:27 +00:00
|
|
|
name = "preview",
|
2018-04-19 20:42:13 +00:00
|
|
|
scope = "config",
|
2019-06-02 08:41:27 +00:00
|
|
|
kind = "list:string",
|
|
|
|
allowed = {
|
|
|
|
"dip25",
|
|
|
|
"dip1000",
|
|
|
|
"dip1008",
|
|
|
|
"fieldwise",
|
|
|
|
"markdown",
|
|
|
|
"fixAliasThis",
|
|
|
|
"intpromote",
|
|
|
|
"dtorfields",
|
|
|
|
},
|
2018-04-19 20:42:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
2019-06-02 08:41:27 +00:00
|
|
|
name = "revert",
|
2018-04-19 20:42:13 +00:00
|
|
|
scope = "config",
|
2019-06-02 08:41:27 +00:00
|
|
|
kind = "list:string",
|
2018-04-19 20:42:13 +00:00
|
|
|
allowed = {
|
2019-06-02 08:41:27 +00:00
|
|
|
"dip25",
|
|
|
|
"import",
|
2018-04-19 20:42:13 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
2019-06-02 08:41:27 +00:00
|
|
|
name = "stringimportdirs",
|
2018-04-19 20:42:13 +00:00
|
|
|
scope = "config",
|
2019-06-02 08:41:27 +00:00
|
|
|
kind = "list:path",
|
|
|
|
tokens = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
|
|
|
name = "transition",
|
|
|
|
scope = "config",
|
|
|
|
kind = "list:string",
|
2018-04-19 20:42:13 +00:00
|
|
|
allowed = {
|
2019-06-02 08:41:27 +00:00
|
|
|
"field",
|
|
|
|
"checkimports",
|
|
|
|
"complex",
|
|
|
|
"tls",
|
|
|
|
"vmarkdown",
|
2018-04-19 20:42:13 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
2019-06-02 08:41:27 +00:00
|
|
|
name = "versionconstants",
|
2018-04-19 20:42:13 +00:00
|
|
|
scope = "config",
|
2019-06-02 08:41:27 +00:00
|
|
|
kind = "list:string",
|
2018-04-19 20:42:13 +00:00
|
|
|
tokens = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
api.register {
|
2019-06-02 08:41:27 +00:00
|
|
|
name = "versionlevel",
|
2018-04-19 20:42:13 +00:00
|
|
|
scope = "config",
|
2019-06-02 08:41:27 +00:00
|
|
|
kind = "integer",
|
2018-04-19 20:42:13 +00:00
|
|
|
}
|
2016-11-09 19:29:33 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Provide information for the help output
|
|
|
|
--
|
|
|
|
newoption
|
|
|
|
{
|
2018-10-02 17:10:53 +00:00
|
|
|
category = "compilers",
|
2016-11-09 19:29:33 +00:00
|
|
|
trigger = "dc",
|
|
|
|
value = "VALUE",
|
|
|
|
description = "Choose a D compiler",
|
|
|
|
allowed = {
|
|
|
|
{ "dmd", "Digital Mars (dmd)" },
|
|
|
|
{ "gdc", "GNU GDC (gdc)" },
|
|
|
|
{ "ldc", "LLVM LDC (ldc2)" },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Decide when to load the full module
|
|
|
|
--
|
|
|
|
|
|
|
|
return function (cfg)
|
2018-04-19 20:42:13 +00:00
|
|
|
return (cfg.language == p.D or cfg.language == "C" or cfg.language == "C++")
|
2016-11-09 19:29:33 +00:00
|
|
|
end
|