aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDeal <[email protected]>2023-09-23 00:33:09 +0800
committerGitHub <[email protected]>2023-09-22 16:33:09 +0000
commit6f33ba65d6470a99dac860dcd8472d47370be77f (patch)
treedc6fc9885625536b681c2267116adb207d109db6 /CMakeLists.txt
parent1b8c63910fc36a292ae591f5bedc8654c0173be9 (diff)
UWP: migrate C++/CX to C++/WinRT (#916)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt28
1 files changed, 12 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b75514b2..7a01eb9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1062,19 +1062,8 @@ if(WIN32)
set(HAVE_WASAPI 1)
set(BACKENDS "${BACKENDS} WASAPI,")
set(ALC_OBJS ${ALC_OBJS} alc/backends/wasapi.cpp alc/backends/wasapi.h)
- if(ALSOFT_UWP)
- set_source_files_properties(alc/backends/wasapi.cpp alc/alconfig.cpp PROPERTIES COMPILE_FLAGS /ZW)
- endif()
endif()
endif()
-
- # Setup properly link flags for UWP
- if(ALSOFT_UWP AND HAVE_WASAPI)
- # Add compile and link flags required C++/CX
- set(C_FLAGS "/Zc:twoPhase-" ${C_FLAGS})
- set(LINKER_FLAGS_DEBUG "/nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib ${LINKER_FLAGS_DEBUG}")
- set(LINKER_FLAGS_RELEASE "/nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib ${LINKER_FLAGS_RELEASE}")
- endif()
endif()
if(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM)
message(FATAL_ERROR "Failed to enabled required WinMM backend")
@@ -1419,13 +1408,20 @@ else()
endif()
target_link_libraries(${IMPL_TARGET} PRIVATE alcommon ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB})
- if(ALSOFT_UWP AND HAVE_WASAPI)
+ if(ALSOFT_UWP)
+ find_program(NUGET_EXE NAMES nuget)
+ if(NOT NUGET_EXE)
+ message("NUGET.EXE not found.")
+ message(FATAL_ERROR "Please install this executable, and run CMake again.")
+ endif()
+
+ exec_program(${NUGET_EXE}
+ ARGS install "Microsoft.Windows.CppWinRT" -Version 2.0.230706.1 -ExcludeVersion -OutputDirectory "\"${CMAKE_BINARY_DIR}/packages\"")
+
set_target_properties(${IMPL_TARGET} PROPERTIES
- LINK_FLAGS_DEBUG "${LINKER_FLAGS_DEBUG}"
- LINK_FLAGS_RELEASE "${LINKER_FLAGS_RELEASE}"
- LINK_FLAGS_MINSIZEREL "${LINKER_FLAGS_RELEASE}"
- LINK_FLAGS_RELWITHDEBINFO "${LINKER_FLAGS_RELEASE}"
+ VS_PROJECT_IMPORT ${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT/build/native/Microsoft.Windows.CppWinRT.props
)
+ target_link_libraries(${IMPL_TARGET} PRIVATE ${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT/build/native/Microsoft.Windows.CppWinRT.targets)
endif()
if(NOT WIN32 AND NOT APPLE)