Skip to content

Instantly share code, notes, and snippets.

@reinsteam
Created August 8, 2015 18:51
Show Gist options
  • Save reinsteam/b8cc75a3e1f234ec7848 to your computer and use it in GitHub Desktop.
Save reinsteam/b8cc75a3e1f234ec7848 to your computer and use it in GitHub Desktop.
Build
{
Units = function ()
local prog = Program
{
Name = "project_name",
Sources = { "main.c" },
-- Place in MSVC solution folder.
IdeGenerationHints =
{
Msvc =
{
SolutionFolder = "Sources",
}
},
}
Default(prog)
end,
Env =
{
-- /O2 equivalent to /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy
CCOPTS =
{
"/Wall", "/WL", "/Za", "/Zl", "/GR-", "/EHs-c-", "/analyze", "/LD", "/TC",
{ "/O2", "/GL", "/GS-", "/Gw"; Config = "*-vs2013-release" },
{ "/Od", "/GL-", "/GS", "/RTCcsu"; Config = "*-vs2013-debug" },
},
LIBS =
{
"kernel32.lib",
{ "libcmt.lib"; Config = "*-vs2013-release"},
{ "libcmtd.lib"; Config = "*-vs2013-debug"},
},
PROGOPTS =
{
"/subsystem:console", "/nodefaultlib",
{ "/ltcg", "/opt:ref", "/incremental:no"; Config = "*-vs2013-release" }
},
GENERATE_PDB = {
{ "0"; Config = "*-vs2013-release" },
{ "1"; Config = "*-vs2013-debug" },
}
},
Configs =
{
Config
{
Name = 'win64-vs2013',
Tools = { { "msvc-vs2013"; TargetArch = "x64" }, },
DefaultOnHost = "windows",
},
Config
{
Name = 'win32-vs2013',
Tools = { { "msvc-vs2013"; TargetArch = "x86" }, },
SupportedHosts = { "windows" },
},
},
Variants =
{
{ Name = "debug", Options = { GeneratePdb = true } },
{ Name = "release" },
},
DefaultVariant = "release",
IdeGenerationHints =
{
Msvc =
{
-- Remap config names to MSVC platform names (affects things like header scanning & debugging)
PlatformMappings =
{
['win64-vs2013'] = 'x64',
['win32-vs2013'] = 'Win32',
},
-- Remap variant names to MSVC friendly names
VariantMappings =
{
['release'] = 'Release',
['debug'] = 'Debug',
},
},
-- Override output directory for sln/vcxproj files.
MsvcSolutionDir = 'vs2013',
-- Override solutions to generate and what units to put where.
MsvcSolutions =
{
['project_name.sln'] = { Projects = { "project_name" } },
},
-- Cause all projects to have "Build" ticked on them inside the MSVC Configuration Manager.
-- As a result of this, you can choose a project as the "Startup Project",
-- and when hitting "Debug" or "Run", the IDE will build that project before running it.
-- You will want to avoid pressing "Build Solution" with this option turned on, because MSVC
-- will kick off all project builds simultaneously.
BuildAllByDefault = true,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment