summaryrefslogtreecommitdiff
path: root/Tests/VSWinStorePhone
diff options
context:
space:
mode:
authorGilles Khouzam <gillesk@microsoft.com>2019-02-01 09:40:58 -0800
committerBrad King <brad.king@kitware.com>2019-02-01 13:04:52 -0500
commitcff026dbc01f975857236a11fc033af48b5e130a (patch)
treeb9d95dad15a93df1bc6f41084731451893c88a6e /Tests/VSWinStorePhone
parent6c21722adbc1745b6362ca9501692805c19eb8ac (diff)
downloadcmake-cff026dbc01f975857236a11fc033af48b5e130a.tar.gz
VS: Fix WinRT component references
WinRT components need to be referenced in a similar way that managed code libraries are referenced. Validate that the library reference is a WinRT component and reference it through the project. Add test coverage for `VS_WINRT_COMPONENT`. While at it, fix the IOT reference failing on Win10 SDK 17763 which doesn't include it anymore. Fixes: #18846
Diffstat (limited to 'Tests/VSWinStorePhone')
-rw-r--r--Tests/VSWinStorePhone/CMakeLists.txt5
-rw-r--r--Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp4
-rw-r--r--Tests/VSWinStorePhone/WinRT/Batman.cpp14
-rw-r--r--Tests/VSWinStorePhone/WinRT/Batman.h12
-rw-r--r--Tests/VSWinStorePhone/WinRT/CMakeLists.txt13
5 files changed, 46 insertions, 2 deletions
diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt
index eefd9a61e6..efc77601d2 100644
--- a/Tests/VSWinStorePhone/CMakeLists.txt
+++ b/Tests/VSWinStorePhone/CMakeLists.txt
@@ -8,6 +8,8 @@ elseif(MSVC_VERSION GREATER 1600)
set(COMPILER_VERSION "11")
endif()
+add_subdirectory(WinRT)
+
set (APP_MANIFEST_NAME Package.appxmanifest)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone")
set(PLATFORM WP)
@@ -149,5 +151,4 @@ if("${SHORT_VERSION}" STREQUAL "10.0")
set_property(TARGET ${EXE_NAME} PROPERTY VS_SDK_REFERENCES "Microsoft.UniversalCRT.Debug, Version=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
endif()
-
-target_link_libraries(${EXE_NAME} d3d11)
+target_link_libraries(${EXE_NAME} d3d11 JusticeLeagueWinRT)
diff --git a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp
index 1c969cd2fc..3ba35fa436 100644
--- a/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp
+++ b/Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp
@@ -6,11 +6,15 @@ using namespace DirectX;
using namespace Microsoft::WRL;
using namespace Windows::Foundation;
using namespace Windows::UI::Core;
+using namespace JusticeLeagueWinRT;
CubeRenderer::CubeRenderer()
: m_loadingComplete(false)
, m_indexCount(0)
{
+ // Create a new WinRT object to validate that we can link properly
+ Batman ^ hero = ref new Batman();
+ hero->savePeople();
}
void CubeRenderer::CreateDeviceResources()
diff --git a/Tests/VSWinStorePhone/WinRT/Batman.cpp b/Tests/VSWinStorePhone/WinRT/Batman.cpp
new file mode 100644
index 0000000000..e092258982
--- /dev/null
+++ b/Tests/VSWinStorePhone/WinRT/Batman.cpp
@@ -0,0 +1,14 @@
+#include "Batman.h"
+
+using namespace JusticeLeagueWinRT;
+using namespace Platform;
+
+Batman::Batman()
+{
+}
+
+void Batman::savePeople()
+{
+ int i = 0;
+ i++;
+}
diff --git a/Tests/VSWinStorePhone/WinRT/Batman.h b/Tests/VSWinStorePhone/WinRT/Batman.h
new file mode 100644
index 0000000000..e2dcabc46e
--- /dev/null
+++ b/Tests/VSWinStorePhone/WinRT/Batman.h
@@ -0,0 +1,12 @@
+#pragma once
+
+namespace JusticeLeagueWinRT {
+public
+ref class Batman sealed
+{
+public:
+ Batman();
+
+ void savePeople();
+};
+}
diff --git a/Tests/VSWinStorePhone/WinRT/CMakeLists.txt b/Tests/VSWinStorePhone/WinRT/CMakeLists.txt
new file mode 100644
index 0000000000..bb93333606
--- /dev/null
+++ b/Tests/VSWinStorePhone/WinRT/CMakeLists.txt
@@ -0,0 +1,13 @@
+project(JusticeLeagueWinRT CXX)
+
+# create project
+add_library(JusticeLeagueWinRT SHARED
+ "${CMAKE_CURRENT_SOURCE_DIR}/Batman.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/Batman.h"
+)
+
+set_target_properties(JusticeLeagueWinRT PROPERTIES
+ VS_WINRT_COMPONENT TRUE
+ VS_GLOBAL_ROOTNAMESPACE "JusticeLeagueWinRT"
+ OUTPUT_NAME "JusticeLeagueWinRT"
+)