summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/VsDotnetSdk
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/VsDotnetSdk')
-rw-r--r--Tests/RunCMake/VsDotnetSdk/App.xaml9
-rw-r--r--Tests/RunCMake/VsDotnetSdk/App.xaml.cs17
-rw-r--r--Tests/RunCMake/VsDotnetSdk/MainWindow.xaml12
-rw-r--r--Tests/RunCMake/VsDotnetSdk/MainWindow.xaml.cs28
-rw-r--r--Tests/RunCMake/VsDotnetSdk/Resources.Designer.cs63
-rw-r--r--Tests/RunCMake/VsDotnetSdk/Resources.resx117
-rw-r--r--Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles-check.cmake56
-rw-r--r--Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles.cmake48
9 files changed, 351 insertions, 0 deletions
diff --git a/Tests/RunCMake/VsDotnetSdk/App.xaml b/Tests/RunCMake/VsDotnetSdk/App.xaml
new file mode 100644
index 0000000..156e0fc
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/App.xaml
@@ -0,0 +1,9 @@
+<Application x:Class="Example.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="clr-namespace:Example"
+ StartupUri="MainWindow.xaml">
+ <Application.Resources>
+
+ </Application.Resources>
+</Application>
diff --git a/Tests/RunCMake/VsDotnetSdk/App.xaml.cs b/Tests/RunCMake/VsDotnetSdk/App.xaml.cs
new file mode 100644
index 0000000..df2669e
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Example
+{
+ /// <summary>
+ /// Interaction logic for App.xaml
+ /// </summary>
+ public partial class App : Application
+ {
+ }
+}
diff --git a/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml b/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml
new file mode 100644
index 0000000..9a8597d
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml
@@ -0,0 +1,12 @@
+<Window x:Class="Example.MainWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:local="clr-namespace:Example"
+ mc:Ignorable="d"
+ Title="MainWindow" Height="350" Width="525">
+ <Grid>
+
+ </Grid>
+</Window>
diff --git a/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml.cs b/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml.cs
new file mode 100644
index 0000000..7d059ed
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/MainWindow.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Example
+{
+ /// <summary>
+ /// Interaction logic for MainWindow.xaml
+ /// </summary>
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Tests/RunCMake/VsDotnetSdk/Resources.Designer.cs b/Tests/RunCMake/VsDotnetSdk/Resources.Designer.cs
new file mode 100644
index 0000000..58ac7d0
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Properties {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Tests/RunCMake/VsDotnetSdk/Resources.resx b/Tests/RunCMake/VsDotnetSdk/Resources.resx
new file mode 100644
index 0000000..ea9cbcd
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
diff --git a/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake b/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake
index 22e2bb3..34259b7 100644
--- a/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VsDotnetSdk/RunCMakeTest.cmake
@@ -6,6 +6,7 @@ run_cmake(VsDotnetSdkCustomCommandsSource)
run_cmake(VsDotnetSdkStartupObject)
run_cmake(VsDotnetSdkDefines)
run_cmake(DotnetSdkVariables)
+run_cmake(VsDotnetSdkXamlFiles)
function(run_VsDotnetSdk)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VsDotnetSdk-build)
diff --git a/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles-check.cmake b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles-check.cmake
new file mode 100644
index 0000000..3e2c6de
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles-check.cmake
@@ -0,0 +1,56 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/dotNetSdkWpfApp.csproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(inAppDefinition FALSE)
+set(inPageDefinition FALSE)
+set(inResourceDefinition FALSE)
+set(xamlAppDefinitionSet FALSE)
+set(xamlPageSet FALSE)
+set(resourcesSet FALSE)
+
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(NOT inAppDefinition AND line MATCHES "^ *<ApplicationDefinition[^>]*>")
+ set(inAppDefinition TRUE)
+ elseif(inAppDefinition AND line MATCHES "^ *<Link>([^<>]+)</Link>$")
+ if("${CMAKE_MATCH_1}" STREQUAL "App.xaml")
+ message(STATUS "dotNetSdkWpfApp.csproj has app definition set")
+ set(xamlAppDefinitionSet TRUE)
+ set(inAppDefinition FALSE)
+ endif()
+ elseif(NOT inPageDefinition AND line MATCHES "^ *<Page[^>]*>")
+ set(inPageDefinition TRUE)
+ elseif(inPageDefinition AND line MATCHES "^ *<Link>([^<>]+)</Link>$")
+ if("${CMAKE_MATCH_1}" STREQUAL "MainWindow.xaml")
+ message(STATUS "dotNetSdkWpfApp.csproj has main window page set")
+ set(xamlPageSet TRUE)
+ set(inPageDefinition FALSE)
+ endif()
+ elseif(NOT inResourceDefinition AND line MATCHES "^ *<EmbeddedResource[^>]*>")
+ set(inResourceDefinition TRUE)
+ elseif(inResourceDefinition AND line MATCHES "^ *<Link>([^<>]+)</Link>$")
+ if("${CMAKE_MATCH_1}" STREQUAL "Resources.resx")
+ message(STATUS "dotNetSdkWpfApp.csproj has embedded resources set")
+ set(resourcesSet TRUE)
+ set(inResourceDefinition FALSE)
+ endif()
+ endif()
+endforeach()
+
+if(NOT xamlAppDefinitionSet)
+ set(RunCMake_TEST_FAILED "Xaml App definition not set correctly.")
+ return()
+endif()
+
+if(NOT xamlPageSet)
+ set(RunCMake_TEST_FAILED "Xaml Page not set correctly.")
+ return()
+endif()
+
+if(NOT resourcesSet)
+ set(RunCMake_TEST_FAILED "resources not set correctly.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles.cmake b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles.cmake
new file mode 100644
index 0000000..8faf3a7
--- /dev/null
+++ b/Tests/RunCMake/VsDotnetSdk/VsDotnetSdkXamlFiles.cmake
@@ -0,0 +1,48 @@
+enable_language(CSharp)
+
+if(NOT CMAKE_CSharp_COMPILER)
+ return()
+endif()
+
+include(CSharpUtilities)
+
+add_executable(dotNetSdkWpfApp)
+target_sources(dotNetSdkWpfApp
+ PRIVATE
+ App.xaml
+ App.xaml.cs
+ MainWindow.xaml
+ MainWindow.xaml.cs
+ Resources.Designer.cs
+ Resources.resx)
+
+csharp_set_xaml_cs_properties(
+ App.xaml
+ App.xaml.cs
+ MainWindow.xaml
+ MainWindow.xaml.cs)
+
+csharp_set_designer_cs_properties(
+ Resources.Designer.cs
+ Resources.resx)
+
+set_target_properties(dotNetSdkWpfApp
+ PROPERTIES
+ DOTNET_SDK "Microsoft.NET.Sdk"
+ DOTNET_TARGET_FRAMEWORK "net5.0")
+
+set_property(SOURCE App.xaml PROPERTY VS_XAML_TYPE "ApplicationDefinition")
+
+set_property(TARGET dotNetSdkWpfApp PROPERTY VS_DOTNET_REFERENCES
+ "Microsoft.CSharp"
+ "PresentationCore"
+ "PresentationFramework"
+ "System"
+ "System.Core"
+ "System.Data"
+ "System.Data.DataSetExtensions"
+ "System.Net.Http"
+ "System.Xaml"
+ "System.Xml"
+ "System.Xml.Linq"
+ "WindowsBase")