diff --git a/CMakeLists.txt b/CMakeLists.txt index efa902d14b..ecb8eb9260 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,16 +29,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 d4ac807322..b93eda161d 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -412,3 +412,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 53b0d1638b..23d49d8dcc 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)