Skip to content

Commit

Permalink
Update D module to VS2019 and latest D compiler options.
Browse files Browse the repository at this point in the history
  • Loading branch information
TurkeyMan committed Jun 2, 2019
1 parent 82bcf8b commit f741685
Show file tree
Hide file tree
Showing 9 changed files with 503 additions and 162 deletions.
74 changes: 33 additions & 41 deletions modules/d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,67 +16,59 @@ to your project definition and populate with .d files.
C and C++ projects that include .d files will also support some of the API below. Any API tagged with (D/C/C++) works in D and C/C++ projects. Any API tagged with (C/C++) only works for .d files in C/C++ projects.

### APIs ###
## D ##

* [flags](https://github.com/premake/premake-dlang/wiki/flags)
* AllInstantiate
* CodeCoverage
* Deprecated
* Color
* Documentation
* GenerateHeader
* GenerateJSON
* GenerateMap
* NoBoundsCheck
* IgnorePragma
* LowMem
* Main
* PerformSyntaxCheckOnly
* Profile
* ProfileGC
* Quiet
* RetainPaths
* SeparateCompilation
* ShowCommandLine
* ShowDependencies
* ShowGC
* ShowTLS
* StackFrame
* StackStomp
* SymbolsLikeC
* UnitTest
* UseLDC
* Verbose
* [versionconstants](https://github.com/premake/premake-dlang/wiki/versionconstants)
* [versionlevel](https://github.com/premake/premake-dlang/wiki/versionlevel)
* boundscheck ("type") [Off, SafeOnly, On]
* compilationmodel ("model") [ Project, Package, File ]
* checkaction
* computetargets
* [debugconstants](https://github.com/premake/premake-dlang/wiki/debugconstants)
* [debuglevel](https://github.com/premake/premake-dlang/wiki/debuglevel)
* dependenciesfile ("filename")
* deprecatedfeatures ("feature") [ Error, Info, Allow ]
* [docdir](https://github.com/premake/premake-dlang/wiki/docdir)
* [docname](https://github.com/premake/premake-dlang/wiki/docname)
* [headerdir](https://github.com/premake/premake-dlang/wiki/headerdir)
* [headername](https://github.com/premake/premake-dlang/wiki/headername)

## C/C++ ##

* [flags](https://github.com/premake/premake-dlang/wiki/flags)
* CodeCoverage
* UnitTest
* Verbose
* Profile
* ProfileGC
* StackFrame
* StackStomp
* AllTemplateInst
* BetterC
* Main
* ShowCommandLine
* ShowTLS
* ShowGC
* IgnorePragma
* ShowDependencies
* [versionconstants](https://github.com/premake/premake-dlang/wiki/versionconstants)
* [debugconstants](https://github.com/premake/premake-dlang/wiki/debugconstants)
* [docdir](https://github.com/premake/premake-dlang/wiki/docdir)
* [docname](https://github.com/premake/premake-dlang/wiki/docname)
* [headerdir](https://github.com/premake/premake-dlang/wiki/headerdir)
* [headername](https://github.com/premake/premake-dlang/wiki/headername)
* dependenciesfile ("filename")
* jsonfile ("filename")
* importpaths { "paths" }
* stringimportpaths { "paths" }
* compilationmodel ("model") [ Project, Package, File ]
* importdirs { "paths" }
* [inlining](https://github.com/premake/premake-core/wiki/inlining)
* jsonfile ("filename")
* importdirs
* [optimize](https://github.com/premake/premake-core/wiki/optimize)
* preview
* revert
* runtime ("type") [ Debug, Release ]
* staticruntime ("state") [ on, off ]
* [optimize](https://github.com/premake/premake-core/wiki/optimize)
* [inlining](https://github.com/premake/premake-core/wiki/inlining)
* boundscheck ("type") [Off, SafeOnly, On]
* deprecatedfeatures ("feature") [ Error, Info, Allow ]
* stringimportdirs { "paths" }
* transition
* [versionconstants](https://github.com/premake/premake-dlang/wiki/versionconstants)
* [versionlevel](https://github.com/premake/premake-dlang/wiki/versionlevel)

### Example ###

The contents of your premake5.lua file would be:
Expand Down
174 changes: 101 additions & 73 deletions modules/d/_preload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,24 @@
api.addAllowed("floatingpoint", "None")
api.addAllowed("flags", {
"CodeCoverage",
"Deprecated", -- DEPRECATED
"Color",
"Documentation",
"GenerateHeader",
"GenerateJSON",
"GenerateMap",
"NoBoundsCheck", -- DEPRECATED
"LowMem",
"Profile",
"Quiet",
-- "Release", // Note: We infer this flag from config.isDebugBuild()
"RetainPaths",
"SeparateCompilation", -- DEPRECATED
"SymbolsLikeC",
"UnitTest",
-- These are used by C++/D mixed $todo move them somewhere else? "flags2" "Dflags"?
-- [Code Generation Flags]
"UseLDC",
"ProfileGC",
"StackFrame",
"StackStomp",
"AllTemplateInst",
"AllInstantiate",
"BetterC",
"Main",
"PerformSyntaxCheckOnly",
Expand All @@ -61,18 +60,54 @@
--

api.register {
name = "versionconstants",
name = "boundscheck",
scope = "config",
kind = "list:string",
tokens = true,
kind = "string",
allowed = {
"Default",
"Off",
"On",
"SafeOnly",
},
}

api.register {
name = "versionlevel",
name = "compilationmodel",
scope = "config",
kind = "integer",
kind = "string",
allowed = {
"Default",
"File",
"Package", -- TODO: this doesn't work with gmake!!
"Project",
},
}

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",
-- }

api.register {
name = "debugconstants",
scope = "config",
Expand All @@ -86,6 +121,25 @@
kind = "integer",
}

api.register {
name = "dependenciesfile",
scope = "config",
kind = "path",
tokens = true,
}

api.register {
name = "deprecatedfeatures",
scope = "config",
kind = "string",
allowed = {
"Default",
"Allow",
"Warn",
"Error",
},
}

api.register {
name = "docdir",
scope = "config",
Expand Down Expand Up @@ -114,22 +168,11 @@
tokens = true,
}

-- api.register {
-- name = "debugcode",
-- scope = "config",
-- kind = "string",
-- }

api.register {
name = "compilationmodel",
name = "jsonfile",
scope = "config",
kind = "string",
allowed = {
"Default",
"File",
"Package", -- TODO: this doesn't work with gmake!!
"Project",
},
kind = "path",
tokens = true,
}

api.register {
Expand All @@ -140,48 +183,62 @@
}

api.register {
name = "stringimportdirs",
name = "preview",
scope = "config",
kind = "list:path",
tokens = true,
kind = "list:string",
allowed = {
"dip25",
"dip1000",
"dip1008",
"fieldwise",
"markdown",
"fixAliasThis",
"intpromote",
"dtorfields",
},
}

api.register {
name = "deprecatedfeatures",
name = "revert",
scope = "config",
kind = "string",
kind = "list:string",
allowed = {
"Default",
"Allow",
"Warn",
"Error",
"dip25",
"import",
},
}

api.register {
name = "boundscheck",
name = "stringimportdirs",
scope = "config",
kind = "string",
kind = "list:path",
tokens = true,
}

api.register {
name = "transition",
scope = "config",
kind = "list:string",
allowed = {
"Default",
"Off",
"On",
"SafeOnly",
"field",
"checkimports",
"complex",
"tls",
"vmarkdown",
},
}

api.register {
name = "dependenciesfile",
name = "versionconstants",
scope = "config",
kind = "path",
kind = "list:string",
tokens = true,
}

api.register {
name = "jsonfile",
name = "versionlevel",
scope = "config",
kind = "path",
tokens = true,
kind = "integer",
}

--
Expand All @@ -201,35 +258,6 @@
}


--
-- Deprecate old stuff
--

api.deprecateValue("flags", "SeparateCompilation", 'Use `compilationmodel "File"` instead',
function(value)
compilationmodel "File"
end,
function(value)
compilationmodel "Default"
end)

api.deprecateValue("flags", "Deprecated", 'Use `deprecatedfeatures "Allow"` instead',
function(value)
deprecatedfeatures "Allow"
end,
function(value)
deprecatedfeatures "Default"
end)

api.deprecateValue("flags", "NoBoundsCheck", 'Use `boundscheck "Off"` instead',
function(value)
boundscheck "Off"
end,
function(value)
boundscheck "Default"
end)


--
-- Decide when to load the full module
--
Expand Down
Loading

0 comments on commit f741685

Please sign in to comment.