Skip to content

Commit a286ec1

Browse files
committed
'find_package'-friendly
1 parent e90e9af commit a286ec1

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

Samples/WindowsML/cpp-cmake/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cmake_policy(SET CMP0117 NEW) # MSVC RTTI flag /GR is not added to CMAKE_CXX_FLA
99
if(CMAKE_GENERATOR MATCHES "^Visual Studio")
1010
# To prevent builds (including try_compile) from picking up top-level 'Directory.Build.*' files,
1111
# write versions specific to the CMake builds at the root of the CMake build.
12-
file(WRITE "${CMAKE_BINARY_DIR}/Directory.Build.rsp" "-m -graphBuild:True -p:UseMultiToolTask=True")
12+
file(WRITE "${CMAKE_BINARY_DIR}/Directory.Build.rsp" "-m -graphBuild:true -p:UseMultiToolTask=true -nodeReuse:false")
1313
file(WRITE "${CMAKE_BINARY_DIR}/Directory.Build.props" "<Project></Project>")
1414
file(WRITE "${CMAKE_BINARY_DIR}/Directory.Build.targets" "<Project></Project>")
1515
elseif(CMAKE_GENERATOR MATCHES "^Ninja")
@@ -29,13 +29,22 @@ include(FetchContent)
2929
FetchContent_Declare(
3030
CMakeNuGetPackage
3131
GIT_REPOSITORY https://github.com/mschofie/NuGetCMakePackage
32-
GIT_TAG 74545405a30aa3e358665ea1431948f61875edad
32+
GIT_TAG d9fb6703b84b2cb5d65a317d1d7022da8a1f0518
3333
)
3434

3535
FetchContent_MakeAvailable(CMakeNuGetPackage)
3636

37-
add_nuget_library(Microsoft.Windows.ImplementationLibrary 1.0.250325.1)
38-
add_nuget_library(Microsoft.Windows.CppWinRT 2.0.250303.1)
37+
add_nuget_packages(
38+
PACKAGES
39+
Microsoft.Windows.ImplementationLibrary 1.0.240803.1
40+
Microsoft.Windows.CppWinRT 2.0.240405.15
41+
Microsoft.WindowsAppSDK.Runtime 1.8.250916003
42+
Microsoft.WindowsAppSDK.ML 1.8.2091
43+
)
44+
45+
find_package(Microsoft.Windows.ImplementationLibrary CONFIG REQUIRED)
46+
find_package(Microsoft.WindowsAppSDK.Runtime CONFIG REQUIRED)
47+
find_package(Microsoft.WindowsAppSDK.ML CONFIG REQUIRED)
3948

4049
set(RESNET_MODEL_FILES
4150
${CMAKE_SOURCE_DIR}/../Resources/ResNet50/model.Labels.txt

Samples/WindowsML/cpp-cmake/CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"binaryDir": "${sourceDir}/__output/${presetName}-$env{Platform}",
4242
"inherits": "windows",
4343
"displayName": "Windows MSVC/Ninja Generator presets",
44-
"description": "Windows, MSVC/Ninja Multi-Config Generator",
44+
"description": "Windows MSVC Ninja Multi-Config Generator",
4545
"generator": "Ninja Multi-Config",
4646
"cacheVariables": {
4747
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"

Samples/WindowsML/cpp-cmake/ResNetCommon/pch.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
// clang-format off
44
#include <unknwn.h>
55
#include <windows.h>
6-
#include <winrt/base.h>
6+
#include <wil/cppwinrt.h>
77
#include <wil/win32_helpers.h>
8+
#include <winrt/base.h>
89
// clang-format on
910

1011
#include <cstdint>

Samples/WindowsML/cpp-cmake/ResNetConsoleDesktop.SelfContained/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
#----------------------------------------------------------------------------------------------------------------------
44
project(ResNetConsoleDesktop.SelfContained LANGUAGES CXX)
55

6-
add_nuget_library(Microsoft.WindowsAppSDK.Runtime 1.8.250907001)
7-
add_nuget_library(Microsoft.WindowsAppSDK.ML 1.8.2084)
8-
96
add_executable(ResNetConsoleDesktop.SelfContained
107
app.manifest
118
main.cpp

Samples/WindowsML/cpp-cmake/ResNetConsoleDesktop/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
#----------------------------------------------------------------------------------------------------------------------
44
project(ResNetConsoleDesktop LANGUAGES CXX)
55

6-
add_nuget_library(Microsoft.WindowsAppSDK.Runtime 1.8.250907001)
7-
add_nuget_library(Microsoft.WindowsAppSDK.ML 1.8.2084)
8-
96
add_executable(ResNetConsoleDesktop
107
app.manifest
118
main.cpp

0 commit comments

Comments
 (0)