@@ -160,7 +160,11 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointe
160160
161161if (WIN32 OR Haiku)
162162 enable_language (CXX )
163- set (CMAKE_CXX_STANDARD 17)
163+ if (WIN32 )
164+ set (CMAKE_CXX_STANDARD 20)
165+ else ()
166+ set (CMAKE_CXX_STANDARD 17)
167+ endif ()
164168 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} " )
165169endif ()
166170
@@ -1065,7 +1069,7 @@ elseif(WIN32)
10651069 src/detection/locale/locale_windows.c
10661070 src/detection/localip/localip_windows.c
10671071 src/detection/gamepad/gamepad_windows.c
1068- src/detection/media/media_windows.c
1072+ src/detection/media/media_windows.cpp
10691073 src/detection/memory/memory_windows.c
10701074 src/detection/mouse/mouse_windows.c
10711075 src/detection/physicalmemory/physicalmemory_linux.c
@@ -1332,6 +1336,14 @@ endif()
13321336if (WIN32 )
13331337 list (APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_intel.c)
13341338 list (APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_amd.c)
1339+
1340+ include (CheckIncludeFileCXX )
1341+ CHECK_INCLUDE_FILE_CXX ("winrt/Windows.Foundation.h" HAVE_WINRT )
1342+ if (HAVE_WINRT)
1343+ message (STATUS "WinRT headers are available, media detection will use WinRT APIs" )
1344+ else ()
1345+ message (STATUS "WinRT headers are NOT available, media detection will be disabled" )
1346+ endif ()
13351347endif ()
13361348include (CheckFunctionExists )
13371349check_function_exists (wcwidth HAVE_WCWIDTH )
@@ -1434,7 +1446,7 @@ if(LINUX)
14341446elseif (ANDROID )
14351447 target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE _FILE_OFFSET_BITS=64 "$<$<CONFIG :DEBUG >:__BIONIC_FORTIFY >" "$<$<CONFIG :DEBUG >:__BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED >" )
14361448elseif (WIN32 )
1437- target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0A00 NOMINMAX UNICODE ) # "$<$<CONFIG:Release>:_FORTIFY_SOURCE=3>"
1449+ target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE WIN32_LEAN_AND_MEAN WINRT_LEAN_AND_MEAN _WIN32_WINNT=0x0A00 NOMINMAX UNICODE ) # "$<$<CONFIG:Release>:_FORTIFY_SOURCE=3>"
14381450elseif (APPLE )
14391451 target_compile_definitions (libfastfetch PUBLIC _GNU_SOURCE _XOPEN_SOURCE __STDC_WANT_LIB_EXT1__ _FILE_OFFSET_BITS=64 _DARWIN_C_SOURCE )
14401452elseif (OpenBSD)
@@ -1745,6 +1757,12 @@ elseif(WIN32)
17451757 PRIVATE "mincore"
17461758 )
17471759 endif ()
1760+ if (HAVE_WINRT)
1761+ target_link_libraries (libfastfetch
1762+ PRIVATE
1763+ "RuntimeObject"
1764+ )
1765+ endif ()
17481766elseif (FreeBSD)
17491767 target_link_libraries (libfastfetch
17501768 PRIVATE "m"
@@ -1831,20 +1849,6 @@ target_link_libraries(libfastfetch
18311849target_compile_options (libfastfetch PRIVATE
18321850 $<$<COMPILE_LANGUAGE :CXX >:-fno -exceptions -fno -rtti >)
18331851
1834- if (WIN32 )
1835- set (CMAKE_CXX_STANDARD 20)
1836- include (CheckIncludeFileCXX )
1837- CHECK_INCLUDE_FILE_CXX ("winrt/Windows.Foundation.h" HAVE_WINRT )
1838- if (HAVE_WINRT)
1839- add_library (ffwinrt MODULE src/detection/media/media_windows.dll.cpp )
1840- target_link_libraries (ffwinrt PRIVATE "RuntimeObject" )
1841- target_compile_definitions (ffwinrt PRIVATE WIN32_LEAN_AND_MEAN=1 WINRT_LEAN_AND_MEAN=1 )
1842- target_link_options (ffwinrt
1843- PRIVATE "-static" # stdc++, winpthread, gcc_s, etc.
1844- )
1845- endif ()
1846- set (CMAKE_CXX_STANDARD 17)
1847- endif ()
18481852if (FreeBSD)
18491853 set (CMAKE_REQUIRED_INCLUDES "/usr/local/include" "/usr/include" )
18501854endif ()
@@ -1891,6 +1895,8 @@ if(NOT WIN32)
18911895 message (WARNING "pthread_timedjoin_np was not found; networking timeout will not work" )
18921896 endif ()
18931897 endif ()
1898+ elseif (HAVE_WINRT)
1899+ target_compile_definitions (libfastfetch PRIVATE FF_HAVE_WINRT=1 )
18941900endif ()
18951901
18961902set (PACKAGES_DISABLE_LIST "" )
@@ -2037,13 +2043,6 @@ if (TARGET flashfetch)
20372043 )
20382044endif ()
20392045
2040- if (TARGET ffwinrt)
2041- install (
2042- TARGETS ffwinrt
2043- DESTINATION "${CMAKE_INSTALL_BINDIR} "
2044- )
2045- endif ()
2046-
20472046install (
20482047 FILES "${CMAKE_SOURCE_DIR} /completions/${CMAKE_PROJECT_NAME} .bash"
20492048 DESTINATION "${CMAKE_INSTALL_DATAROOTDIR} /bash-completion/completions"
0 commit comments