Skip to content

Commit

Permalink
build(linux): fail build if capture dependencies not found (#3305)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Oct 14, 2024
1 parent 67ab6e3 commit 7352e72
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
23 changes: 8 additions & 15 deletions cmake/compile_definitions/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -95,18 +97,14 @@ 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
include(dependencies/libevdev_Sunshine)

# vaapi
if(${SUNSHINE_ENABLE_VAAPI})
find_package(Libva)
find_package(Libva REQUIRED)
else()
set(LIBVA_FOUND OFF)
endif()
Expand All @@ -121,7 +119,7 @@ endif()

# wayland
if(${SUNSHINE_ENABLE_WAYLAND})
find_package(Wayland)
find_package(Wayland REQUIRED)
else()
set(WAYLAND_FOUND OFF)
endif()
Expand Down Expand Up @@ -153,7 +151,7 @@ endif()

# x11
if(${SUNSHINE_ENABLE_X11})
find_package(X11)
find_package(X11 REQUIRED)
else()
set(X11_FOUND OFF)
endif()
Expand Down Expand Up @@ -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})
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cmake/prep/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions packaging/sunshine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def install
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
Expand Down

4 comments on commit 7352e72

@parkerlreed
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this failing the build if CUDA is not found? It makes no sense to install the CUDA compiler for AMD systems.

@parkerlreed
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CMake flag appears to work fine. Does this just mean we're going to have to have two separate PKGBUILDs now If we prefer building ourselves?

@ReenigneArcher
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, just add the new flag and it won't fail if cuda is missing.

@cgutman
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should put the option to set to ignore CUDA in the failure message?

Please sign in to comment.