From cc8e0a090c59b7921ac92958645fc5de59e047b3 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 13 Jun 2026 02:07:40 -0400 Subject: [PATCH] better x11 --- CMakeLists.txt | 8 ++------ externals/CMakeLists.txt | 8 ++++++++ src/video_core/CMakeLists.txt | 10 ++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a49f8e7b8c..d7f6989b31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,16 +30,12 @@ endif() # Needed for FFmpeg w/ VAAPI and DRM if (PLATFORM_OPENBSD) # OpenBSD 7.8 broke libcxx when upgrading, so we must define the PSTL backend manually - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R6/include -D_LIBCPP_PSTL_BACKEND_SERIAL=1") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R6/include -D_LIBCPP_PSTL_BACKEND_SERIAL=1") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/X11R6/lib") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LIBCPP_PSTL_BACKEND_SERIAL=1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LIBCPP_PSTL_BACKEND_SERIAL=1") elseif (PLATFORM_NETBSD) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R7/include") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_SYSROOT}/usr/X11R7/include") if (NOT CXX_GCC OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14.0") message(FATAL_ERROR "You must use gcc14 (or newer) from pkgin; feel free to fix clang yourself otherwise.") endif() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/X11R7/lib") endif() # NetBSD: Fun for the whole family! diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index aafa518ed2..5fc38fb6c9 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -411,3 +411,11 @@ if (APPLE) set(MOLTENVK_LIBRARY "${moltenvk_SOURCE_DIR}/MoltenVK/dylib/macOS/libMoltenVK.dylib" CACHE STRING "" FORCE) endif() endif() + +# must match src/video_core/vulkan_common/vulkan.h logic +# No we can't "bundle" this... never... NEVER +if (WIN32 OR APPLE OR ANDROID OR PLATFORM_HAIKU OR PLATFORM_PS4) + # ... +else() + find_package(X11 REQUIRED) +endif() diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 5c02b5ed90..badda7930b 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -344,6 +344,16 @@ target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE}) target_link_libraries(video_core PRIVATE sirit::sirit) +# Since this is also used by header-only whom is public: +# a) you must also make it public +# b) should precede the headers themselves +# must match src/video_core/vulkan_common/vulkan.h logic +if (WIN32 OR APPLE OR ANDROID OR PLATFORM_HAIKU OR PLATFORM_PS4) + # ... +else() + target_link_libraries(video_core PUBLIC X11::X11) +endif() + # Header-only stuff needed by all dependent targets target_link_libraries(video_core PUBLIC Vulkan::Headers Vulkan::UtilityHeaders GPUOpen::VulkanMemoryAllocator)