diff options
author | Adam Mitz <mitza@objectcomputing.com> | 2021-11-08 11:18:42 -0600 |
---|---|---|
committer | Adam Mitz <mitza@objectcomputing.com> | 2021-11-08 11:19:47 -0600 |
commit | bdb7c35e6d8ae3451123ed1694a58a744c48e957 (patch) | |
tree | 9a5e83c83c0f75e3d6f225fea31653c147858b03 | |
parent | cdf4e7e044a258dbe9da7ee359f9ddf885d9c755 (diff) | |
download | MPC-bdb7c35e6d8ae3451123ed1694a58a744c48e957.tar.gz |
Generate Visual Studio 2022 projects and solutions
-rw-r--r-- | modules/VS2022ProjectCreator.pm | 56 | ||||
-rw-r--r-- | modules/VS2022WorkspaceCreator.pm | 39 | ||||
-rw-r--r-- | templates/vs2022dll.mpt | 4 | ||||
-rw-r--r-- | templates/vs2022exe.mpt | 4 | ||||
-rw-r--r-- | templates/vs2022lib.mpt | 4 | ||||
-rw-r--r-- | templates/vs2022libexe.mpt | 4 | ||||
-rw-r--r-- | templates/vs2022platforms.mpt | 38 |
7 files changed, 149 insertions, 0 deletions
diff --git a/modules/VS2022ProjectCreator.pm b/modules/VS2022ProjectCreator.pm new file mode 100644 index 00000000..2f9ce191 --- /dev/null +++ b/modules/VS2022ProjectCreator.pm @@ -0,0 +1,56 @@ +package VS2022ProjectCreator; + +# ************************************************************ +# Description : vs2022 (Visual Studio 2022) Project Creator +# ************************************************************ + +# ************************************************************ +# Pragmas +# ************************************************************ + +use strict; + +use VC12ProjectCreator; + +use vars qw(@ISA); +@ISA = qw(VC12ProjectCreator); + +## NOTE: We call the constant as a function to support Perl 5.6. +my %info = (Creator::cplusplus() => {'ext' => '.vcxproj', + 'dllexe' => 'vs2022exe', + 'libexe' => 'vs2022libexe', + 'dll' => 'vs2022dll', + 'lib' => 'vs2022lib', + 'template' => [ 'vc10', 'vc10filters' ], + }, + ); + +my %config = ('vcversion' => '16.00', + 'toolsversion' => '16.0', + ); + +# ************************************************************ +# Subroutine Section +# ************************************************************ + +sub get_info_hash { + my($self, $key) = @_; + + ## If we have the setting in our information map, then use it. + return $info{$key} if (defined $info{$key}); + + ## Otherwise, see if our parent type can take care of it. + return $self->SUPER::get_info_hash($key); +} + +sub get_configurable { + my($self, $name) = @_; + + ## If we have the setting in our config map, then use it. + return $config{$name} if (defined $config{$name}); + + ## Otherwise, see if our parent type can take care of it. + return $self->SUPER::get_configurable($name); +} + +1; diff --git a/modules/VS2022WorkspaceCreator.pm b/modules/VS2022WorkspaceCreator.pm new file mode 100644 index 00000000..39393912 --- /dev/null +++ b/modules/VS2022WorkspaceCreator.pm @@ -0,0 +1,39 @@ +package VS2022WorkspaceCreator; + +# ************************************************************ +# Description : vs2022 (Visual Studio 2022) Workspace Creator +# ************************************************************ + +# ************************************************************ +# Pragmas +# ************************************************************ + +use strict; + +use VS2022ProjectCreator; +use VC12WorkspaceCreator; + +use vars qw(@ISA); +@ISA = qw(VC12WorkspaceCreator); + +# ************************************************************ +# Subroutine Section +# ************************************************************ + +sub pre_workspace { + my($self, $fh) = @_; + my $crlf = $self->crlf(); + + print $fh '', $crlf, + 'Microsoft Visual Studio Solution File, Format Version 12.00', $crlf; + $self->print_workspace_comment($fh, + '# Visual Studio 17', $crlf, + '#', $crlf, + '# This file was generated by MPC. Any changes made directly to', $crlf, + '# this file will be lost the next time it is generated.', $crlf, + '#', $crlf, + '# MPC Command:', $crlf, + '# ', $self->create_command_line_string($0, @ARGV), $crlf); +} + +1; diff --git a/templates/vs2022dll.mpt b/templates/vs2022dll.mpt new file mode 100644 index 00000000..bc918721 --- /dev/null +++ b/templates/vs2022dll.mpt @@ -0,0 +1,4 @@ +// -*- MPC -*- +conditional_include "vs2022platforms" +conditional_include "vc1xdll" +conditional_include "user_vs2022dll" diff --git a/templates/vs2022exe.mpt b/templates/vs2022exe.mpt new file mode 100644 index 00000000..cc2bbc24 --- /dev/null +++ b/templates/vs2022exe.mpt @@ -0,0 +1,4 @@ +// -*- MPC -*- +conditional_include "vs2022platforms" +conditional_include "vc1xexe" +conditional_include "user_vs2022exe" diff --git a/templates/vs2022lib.mpt b/templates/vs2022lib.mpt new file mode 100644 index 00000000..29fcdcd9 --- /dev/null +++ b/templates/vs2022lib.mpt @@ -0,0 +1,4 @@ +// -*- MPC -*- +conditional_include "vs2022platforms" +conditional_include "vc1xlib" +conditional_include "user_vs2022lib" diff --git a/templates/vs2022libexe.mpt b/templates/vs2022libexe.mpt new file mode 100644 index 00000000..8f347b3e --- /dev/null +++ b/templates/vs2022libexe.mpt @@ -0,0 +1,4 @@ +// -*- MPC -*- +conditional_include "vs2022platforms" +conditional_include "vc1xlibexe" +conditional_include "user_vs2022libexe" diff --git a/templates/vs2022platforms.mpt b/templates/vs2022platforms.mpt new file mode 100644 index 00000000..6e08c088 --- /dev/null +++ b/templates/vs2022platforms.mpt @@ -0,0 +1,38 @@ +// -*- MPC -*- +// +// Any of these platforms can set using value_template platforms= +// when generating solutions/projects. +// + +platforms = Win32 x64 ARM ARM64 +default_platform = x64 +PlatformToolset = v143 +WindowsTargetPlatformVersion = 10.0 + +Win32 { + output_subdir = I386 +} + +x64 { + output_subdir = AMD64 + cpu_defines = _AMD64_ + platform_defines = _WIN64 + TargetMachine = "0" // We let VC++ figure it out for us. + link_options = /machine:AMD64 +} + +ARM { + output_subdir = ARM + cpu_defines = _ARM_ + platform_defines = _ARM + TargetMachine = "0" // We let VC++ figure it out for us. + link_options = /machine:ARM +} + +ARM64 { + output_subdir = ARM64 + cpu_defines = _ARM64_ + platform_defines = _ARM64 + TargetMachine = "0" // We let VC++ figure it out for us. + link_options = /machine:ARM64 +} |