From ad0e4f03b44d32380fdd85affa4c457a9bbed327 Mon Sep 17 00:00:00 2001 From: tdijck Date: Wed, 25 Mar 2015 10:37:51 -0700 Subject: [PATCH] Adding VS 2015 support. --- src/_manifest.lua | 1 + src/actions/vstudio/vs2010_vcxproj.lua | 4 +- src/actions/vstudio/vs2012.lua | 1 + src/actions/vstudio/vs2013.lua | 1 + src/actions/vstudio/vs2015.lua | 61 ++++++++++++++++++++++++++ 5 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 src/actions/vstudio/vs2015.lua diff --git a/src/_manifest.lua b/src/_manifest.lua index 9bcb3897..39bf1129 100644 --- a/src/_manifest.lua +++ b/src/_manifest.lua @@ -80,6 +80,7 @@ "actions/vstudio/vs2010_rules_xml.lua", "actions/vstudio/vs2012.lua", "actions/vstudio/vs2013.lua", + "actions/vstudio/vs2015.lua", -- Clean action "actions/clean/_clean.lua", diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index 6edbbe12..931d3a43 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -1396,8 +1396,8 @@ function m.platformToolset(cfg) - local map = { vs2012 = "v110", vs2013 = "v120" } - local value = map[_ACTION] + local action = premake.action.current() + local value = action.vstudio.platformToolset if value then -- should only be written if there is a C/C++ file in the config for i = 1, #cfg.files do diff --git a/src/actions/vstudio/vs2012.lua b/src/actions/vstudio/vs2012.lua index 34551299..de164ad9 100644 --- a/src/actions/vstudio/vs2012.lua +++ b/src/actions/vstudio/vs2012.lua @@ -53,6 +53,7 @@ versionName = "2012", targetFramework = "4.5", toolsVersion = "4.0", + platformToolset = "v110" } } diff --git a/src/actions/vstudio/vs2013.lua b/src/actions/vstudio/vs2013.lua index ee7b2b0f..ee815bc7 100644 --- a/src/actions/vstudio/vs2013.lua +++ b/src/actions/vstudio/vs2013.lua @@ -56,5 +56,6 @@ targetFramework = "4.5", toolsVersion = "12.0", filterToolsVersion = "4.0", + platformToolset = "v120" } } diff --git a/src/actions/vstudio/vs2015.lua b/src/actions/vstudio/vs2015.lua new file mode 100644 index 00000000..b3b3066e --- /dev/null +++ b/src/actions/vstudio/vs2015.lua @@ -0,0 +1,61 @@ +-- +-- actions/vstudio/vs2015.lua +-- Extend the existing exporters with support for Visual Studio 2015. +-- Copyright (c) 2015-2015 Jason Perkins and the Premake project +-- + + premake.vstudio.vc2015 = {} + + local p = premake + local vstudio = p.vstudio + local vc2010 = vstudio.vc2010 + + local m = vstudio.vc2015 + + +--- +-- Define the Visual Studio 2015 export action. +--- + + newaction { + -- Metadata for the command line and help system + + trigger = "vs2015", + shortname = "Visual Studio 2015", + description = "Generate Visual Studio 2015 project files", + + -- Visual Studio always uses Windows path and naming conventions + + os = "windows", + + -- The capabilities of this action + + valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" }, + valid_languages = { "C", "C++", "C#" }, + valid_tools = { + cc = { "msc" }, + dotnet = { "msnet" }, + }, + + -- Solution and project generation logic + + onSolution = vstudio.vs2005.generateSolution, + onProject = vstudio.vs2010.generateProject, + + onCleanSolution = vstudio.cleanSolution, + onCleanProject = vstudio.cleanProject, + onCleanTarget = vstudio.cleanTarget, + + pathVars = vstudio.pathVars, + + -- This stuff is specific to the Visual Studio exporters + + vstudio = { + solutionVersion = "12", + versionName = "2015", + targetFramework = "4.5", + toolsVersion = "14.0", + filterToolsVersion = "4.0", + platformToolset = "v140" + } + }