summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorGilles Khouzam <gillesk@microsoft.com>2015-03-31 20:49:39 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-03 17:40:35 (GMT)
commit01a9ab0def07ecddbc1bdfa67fec1bd3e6d030ea (patch)
treed5ae25dcf79d63031f26f2b879a30c19d388020f /Source/cmGeneratorTarget.cxx
parent84136c5a83bf9e1caf158a37f987465a8f39f8d0 (diff)
downloadCMake-01a9ab0def07ecddbc1bdfa67fec1bd3e6d030ea.zip
CMake-01a9ab0def07ecddbc1bdfa67fec1bd3e6d030ea.tar.gz
CMake-01a9ab0def07ecddbc1bdfa67fec1bd3e6d030ea.tar.bz2
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.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx49
1 files changed, 49 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e0af47a..41d12d7 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -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);
@@ -438,6 +457,36 @@ cmGeneratorTarget
}
//----------------------------------------------------------------------------
+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
{