Skip to content

Commit ef49455

Browse files
committed
Use NuGet packages via VS_PACKAGE_REFERENCES and VS_USER_PROPS trick
1 parent ea3790b commit ef49455

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

cmake/XRay.Build.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ else()
5151
message(FATAL_ERROR "Unsupported or unknown compiler.")
5252
endif()
5353

54+
# https://stackoverflow.com/questions/61909735/cmakes-vs-package-references-not-adding-a-reference-to-vs2017-project
55+
# https://stackoverflow.com/questions/2973263/add-visual-c-property-sheets-using-cmake
56+
set(XRAY_MSBUILD_PROPS "${CMAKE_CURRENT_LIST_DIR}/XRay.MSBuild.props")
57+
58+
message("${XRAY_MSBUILD_PROPS}")
59+
5460
if (WIN32)
5561
include_directories("${XRAY_SDK_INCLUDE_DIR}")
5662
include_directories("${XRAY_SDK_INCLUDE_DIR}/SDL2")

cmake/XRay.MSBuild.props

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ImportGroup Label="PropertySheets">
4+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
5+
</ImportGroup>
6+
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
7+
<ProjectCapability Include="PackageReferences" />
8+
</ItemGroup>
9+
10+
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
11+
<NuGetTargetMoniker Condition="'$(NuGetTargetMoniker)' == ''">native,Version=v0.0</NuGetTargetMoniker>
12+
<RuntimeIdentifiers Condition="'$(RuntimeIdentifiers)' == ''">win;win-x86;win-x64;win-arm;win-arm64</RuntimeIdentifiers>
13+
</PropertyGroup>
14+
</Project>

src/Layers/xrRenderPC_R4/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ target_compile_definitions(xrRenderPC_R4
151151

152152
set_target_properties(xrRenderPC_R4 PROPERTIES
153153
PREFIX ""
154+
VS_USER_PROPS ${XRAY_MSBUILD_PROPS}
155+
VS_PACKAGE_REFERENCES "directxmath_2024.10.15.1;directxtex_desktop_2019_2024.10.29.1"
154156
)
155157

156158
target_precompile_headers(xrRenderPC_R4

src/xrCore/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@ endif()
513513

514514
set_target_properties(xrCore PROPERTIES
515515
PREFIX ""
516+
VS_USER_PROPS ${XRAY_MSBUILD_PROPS}
517+
VS_PACKAGE_REFERENCES "sdl2.nuget_2.32.4;sdl2.nuget.redist_2.32.4"
516518
)
517519

518520
target_precompile_headers(xrCore

0 commit comments

Comments
 (0)