VS: Add support for XAML source files

XAML files are by default of type Page in the vcxproj and can be
overriden by setting the VS_XAML_TYPE property.  The .cpp and .h file
of the same name are automatically added as depending on the XAML file.

New VSXaml test builds a basic XAML WindowsStore 8.1 app with VS2013.
This commit is contained in:
Gilles Khouzam
2015-03-31 13:49:39 -07:00
committed by Brad King
parent 84136c5a83
commit 01a9ab0def
24 changed files with 498 additions and 4 deletions
+49
View File
@@ -56,6 +56,7 @@ struct ResxTag {};
struct ModuleDefinitionFileTag {};
struct AppManifestTag{};
struct CertificatesTag{};
struct XamlTag{};
template<typename Tag, typename OtherTag>
struct IsSameTag
@@ -98,6 +99,20 @@ struct DoAccept<true>
data.ExpectedResxHeaders.insert(hFileName);
data.ResxSources.push_back(f);
}
static void Do(cmGeneratorTarget::XamlData& data, cmSourceFile* f)
{
// Build and save the name of the corresponding .h and .cpp file
// This relationship will be used later when building the project files.
// Both names would have been auto generated from Visual Studio
// where the user supplied the file name and Visual Studio
// appended the suffix.
std::string xaml = f->GetFullPath();
std::string hFileName = xaml + ".h";
std::string cppFileName = xaml + ".cpp";
data.ExpectedXamlHeaders.insert(hFileName);
data.ExpectedXamlSources.insert(cppFileName);
data.XamlSources.push_back(f);
}
static void Do(std::string& data, cmSourceFile* f)
{
data = f->GetFullPath();
@@ -186,6 +201,10 @@ struct TagVisitor
{
DoAccept<IsSameTag<Tag, CertificatesTag>::Result>::Do(this->Data, sf);
}
else if (ext == "xaml")
{
DoAccept<IsSameTag<Tag, XamlTag>::Result>::Do(this->Data, sf);
}
else if(this->Header.find(sf->GetFullPath().c_str()))
{
DoAccept<IsSameTag<Tag, HeaderSourcesTag>::Result>::Do(this->Data, sf);
@@ -437,6 +456,36 @@ cmGeneratorTarget
IMPLEMENT_VISIT(Certificates);
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget::GetExpectedXamlHeaders(std::set<std::string>& headers,
const std::string& config) const
{
XamlData data;
IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData)
headers = data.ExpectedXamlHeaders;
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget::GetExpectedXamlSources(std::set<std::string>& srcs,
const std::string& config) const
{
XamlData data;
IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData)
srcs = data.ExpectedXamlSources;
}
//----------------------------------------------------------------------------
void cmGeneratorTarget
::GetXamlSources(std::vector<cmSourceFile const*>& srcs,
const std::string& config) const
{
XamlData data;
IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData)
srcs = data.XamlSources;
}
//----------------------------------------------------------------------------
bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
const std::string& config) const