build(linux): fail build if capture dependencies not found (#3305)

This commit is contained in:
ReenigneArcher 2024-10-14 18:28:55 -04:00 committed by GitHub
parent 67ab6e3c79
commit 7352e7277a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 16 deletions

View File

@ -67,6 +67,8 @@ if(${SUNSHINE_ENABLE_CUDA})
# message(STATUS "CUDA NVCC Flags: ${CUDA_NVCC_FLAGS}")
message(STATUS "CUDA Architectures: ${CMAKE_CUDA_ARCHITECTURES}")
elseif(${CUDA_FAIL_ON_MISSING})
message(FATAL_ERROR "CUDA not found")
endif()
endif()
if(CUDA_FOUND)
@ -82,8 +84,8 @@ endif()
# drm
if(${SUNSHINE_ENABLE_DRM})
find_package(LIBDRM)
find_package(LIBCAP)
find_package(LIBDRM REQUIRED)
find_package(LIBCAP REQUIRED)
else()
set(LIBDRM_FOUND OFF)
set(LIBCAP_FOUND OFF)
@ -95,10 +97,6 @@ if(LIBDRM_FOUND AND LIBCAP_FOUND)
list(APPEND PLATFORM_TARGET_FILES
"${CMAKE_SOURCE_DIR}/src/platform/linux/kmsgrab.cpp")
list(APPEND SUNSHINE_DEFINITIONS EGL_NO_X11=1)
elseif(NOT LIBDRM_FOUND)
message(WARNING "Missing libdrm")
elseif(NOT LIBDRM_FOUND)
message(WARNING "Missing libcap")
endif()
# evdev
@ -106,7 +104,7 @@ include(dependencies/libevdev_Sunshine)
# vaapi
if(${SUNSHINE_ENABLE_VAAPI})
find_package(Libva)
find_package(Libva REQUIRED)
else()
set(LIBVA_FOUND OFF)
endif()
@ -121,7 +119,7 @@ endif()
# wayland
if(${SUNSHINE_ENABLE_WAYLAND})
find_package(Wayland)
find_package(Wayland REQUIRED)
else()
set(WAYLAND_FOUND OFF)
endif()
@ -153,7 +151,7 @@ endif()
# x11
if(${SUNSHINE_ENABLE_X11})
find_package(X11)
find_package(X11 REQUIRED)
else()
set(X11_FOUND OFF)
endif()
@ -187,10 +185,9 @@ if(${SUNSHINE_ENABLE_TRAY})
endif()
pkg_check_modules(LIBNOTIFY libnotify)
if(NOT APPINDICATOR_FOUND OR NOT LIBNOTIFY_FOUND)
set(SUNSHINE_TRAY 0)
message(WARNING "Missing appindicator or libnotify, disabling tray icon")
message(STATUS "APPINDICATOR_FOUND: ${APPINDICATOR_FOUND}")
message(STATUS "LIBNOTIFY_FOUND: ${LIBNOTIFY_FOUND}")
message(FATAL_ERROR "Couldn't find either appindicator or libnotify")
else()
include_directories(SYSTEM ${APPINDICATOR_INCLUDE_DIRS} ${LIBNOTIFY_INCLUDE_DIRS})
link_directories(${APPINDICATOR_LIBRARY_DIRS} ${LIBNOTIFY_LIBRARY_DIRS})
@ -203,10 +200,6 @@ else()
message(STATUS "Tray icon disabled")
endif()
if(${SUNSHINE_ENABLE_TRAY} AND ${SUNSHINE_TRAY} EQUAL 0 AND SUNSHINE_REQUIRE_TRAY)
message(FATAL_ERROR "Tray icon is required")
endif()
if(${SUNSHINE_USE_LEGACY_INPUT}) # TODO: Remove this legacy option after the next stable release
list(APPEND PLATFORM_TARGET_FILES "${CMAKE_SOURCE_DIR}/src/platform/linux/input/legacy_input.cpp")
else()

View File

@ -22,7 +22,6 @@ option(BUILD_WERROR "Enable -Werror flag." OFF)
option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF)
option(SUNSHINE_ENABLE_TRAY "Enable system tray icon. This option will be ignored on macOS." ON)
option(SUNSHINE_REQUIRE_TRAY "Require system tray icon. Fail the build if tray requirements are not met." ON)
option(SUNSHINE_SYSTEM_WAYLAND_PROTOCOLS "Use system installation of wayland-protocols rather than the submodule." OFF)
@ -32,6 +31,7 @@ else()
option(BOOST_USE_STATIC "Use static boost libraries." ON)
endif()
option(CUDA_FAIL_ON_MISSING "Fail the build if CUDA is not found." ON)
option(CUDA_INHERIT_COMPILE_OPTIONS
"When building CUDA code, inherit compile options from the the main project. You may want to disable this if
your IDE throws errors about unknown flags after running cmake." ON)

View File

@ -105,6 +105,8 @@ class @PROJECT_NAME@ < Formula
ohai "Linking against ICU libraries at: #{icu4c_lib_path}"
end
args << "-DCUDA_FAIL_ON_MISSING=OFF" if OS.linux?
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
cd "build" do