diff options
author | Brad King <brad.king@kitware.com> | 2019-02-04 12:47:08 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-02-04 12:47:15 (GMT) |
commit | 40e12882609619a902d19b94de442b2874bf7a45 (patch) | |
tree | 368bb0aafdd058b41fd1fc56fd55406a271f8d22 | |
parent | dc4a2749a52cb7f96ad8d7146ee4d680a2beb5fa (diff) | |
parent | cff026dbc01f975857236a11fc033af48b5e130a (diff) | |
download | CMake-40e12882609619a902d19b94de442b2874bf7a45.zip CMake-40e12882609619a902d19b94de442b2874bf7a45.tar.gz CMake-40e12882609619a902d19b94de442b2874bf7a45.tar.bz2 |
Merge topic 'winrtrefs'
cff026dbc0 VS: Fix WinRT component references
6c21722adb Tests: Fix VSWinStorePhone test with Windows 10 SDK 17763
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2906
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 10 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp | 4 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/WinRT/Batman.cpp | 14 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/WinRT/Batman.h | 12 | ||||
-rw-r--r-- | Tests/VSWinStorePhone/WinRT/CMakeLists.txt | 13 |
6 files changed, 59 insertions, 5 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9d7dd07..c4040e1 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3884,8 +3884,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) this->WriteDotNetReferenceCustomTags(e2, name); // If the dependency target is not managed (compiled with /clr or - // C# target) we cannot reference it and have to set - // 'ReferenceOutputAssembly' to false. + // C# target) and not a WinRT component we cannot reference it and + // have to set 'ReferenceOutputAssembly' to false. auto referenceNotManaged = dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed; // Workaround to check for manually set /clr flags. @@ -3902,6 +3902,12 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) if (referenceNotManaged && dt->GetType() == cmStateEnums::STATIC_LIBRARY) { referenceNotManaged = !dt->IsCSharpOnly(); } + + // Referencing WinRT components is okay. + if (referenceNotManaged) { + referenceNotManaged = !dt->GetPropertyAsBool("VS_WINRT_COMPONENT"); + } + if (referenceNotManaged) { e2.Element("ReferenceOutputAssembly", "false"); e2.Element("CopyToOutputDirectory", "Never"); diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt index acda117..efc7760 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) @@ -139,11 +141,14 @@ if("${SHORT_VERSION}" STREQUAL "10.0") message(STATUS "Targeting Windows 10. Setting Extensions to version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") set_property(TARGET ${EXE_NAME} PROPERTY VS_DESKTOP_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") set_property(TARGET ${EXE_NAME} PROPERTY VS_MOBILE_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") - set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + + # The last IOT reference is on 10.0.17134.0, so only add it if supported + if("${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}" VERSION_LESS "10.0.17135.0") + set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + endif() # Add a reference to an SDK 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 1c969cd..3ba35fa 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 0000000..e092258 --- /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 0000000..e2dcabc --- /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 0000000..bb93333 --- /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" +) |