From 64b8f9178fdd4373f81fb0574208b092b8cd51f6 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Fri, 26 Jun 2026 13:52:07 +0200 Subject: [PATCH 1/5] Use standard cmake macros This will pick up the distro's best generator --- packaging/linux/copr/Sunshine.spec | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packaging/linux/copr/Sunshine.spec b/packaging/linux/copr/Sunshine.spec index f79c35d2b4c..d1df2c8c353 100644 --- a/packaging/linux/copr/Sunshine.spec +++ b/packaging/linux/copr/Sunshine.spec @@ -224,13 +224,9 @@ cuda_supported_architectures=("x86_64" "aarch64") # prepare CMAKE args cmake_args=( - "-B=%{_builddir}/Sunshine/build" - "-G=Unix Makefiles" - "-S=." "-DBUILD_DOCS=OFF" "-DBUILD_WERROR=ON" "-DCMAKE_BUILD_TYPE=Release" - "-DCMAKE_INSTALL_PREFIX=%{_prefix}" "-DSUNSHINE_ASSETS_DIR=%{_datadir}/sunshine" "-DSUNSHINE_EXECUTABLE_PATH=%{_bindir}/sunshine" "-DSUNSHINE_ENABLE_DRM=ON" @@ -380,8 +376,8 @@ uv sync \ %endif echo "cmake args:" echo "${cmake_args[@]}" -cmake "${cmake_args[@]}" -make -j$(nproc) -C "%{_builddir}/Sunshine/build" +%cmake ${cmake_args[@]} +%cmake_build %check # validate the metainfo file @@ -390,7 +386,7 @@ appstream-util validate %{buildroot}%{_metainfodir}/*.metainfo.xml desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop # run tests -cd %{_builddir}/Sunshine/build +cd %{_builddir}/Sunshine/%_vpath_builddir xvfb-run ./tests/test_sunshine %install @@ -409,8 +405,8 @@ echo "Node.js version: $(node --version)" echo "npm version: $(npm --version)" %endif -cd %{_builddir}/Sunshine/build -%make_install +cd %{_builddir}/Sunshine +%cmake_install %post # Note: this is copied from the postinst script From 5c83eab06ee072dfeab445beb0f43465e85b2332 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 30 Jun 2026 23:22:54 +0200 Subject: [PATCH 2/5] Account for different build dir definition on opensuse --- packaging/linux/copr/Sunshine.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packaging/linux/copr/Sunshine.spec b/packaging/linux/copr/Sunshine.spec index d1df2c8c353..66f0013902c 100644 --- a/packaging/linux/copr/Sunshine.spec +++ b/packaging/linux/copr/Sunshine.spec @@ -386,8 +386,13 @@ appstream-util validate %{buildroot}%{_metainfodir}/*.metainfo.xml desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop # run tests -cd %{_builddir}/Sunshine/%_vpath_builddir -xvfb-run ./tests/test_sunshine +cd %{_builddir}/Sunshine/ +# TODO: Switch to using %%ctest +%if 0%{?suse_version} +xvfb-run %__builddir/tests/test_sunshine +%else +xvfb-run %_vpath_builddir/tests/test_sunshine +%endif %install # Load NVM for Fedora 44+ so npm is available during make install From 5abdf71332e411fd5b22cbefafd758b9503687c4 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 30 Jun 2026 23:28:38 +0200 Subject: [PATCH 3/5] Allow ctest to be launched from main builddir --- cmake/targets/common.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/targets/common.cmake b/cmake/targets/common.cmake index d55e1f68f48..7862a5167ba 100644 --- a/cmake/targets/common.cmake +++ b/cmake/targets/common.cmake @@ -69,6 +69,7 @@ endif() # tests if(BUILD_TESTS) + enable_testing() add_subdirectory(tests) endif() From b9628c9d639ede0422e40c33d772945c2c3337e3 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 30 Jun 2026 23:33:43 +0200 Subject: [PATCH 4/5] Add tests as ctest --- tests/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1ebeea95981..2517ff1eb33 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -126,6 +126,9 @@ list(REMOVE_ITEM SUNSHINE_SOURCES ${CMAKE_SOURCE_DIR}/src/main.cpp) add_executable(${PROJECT_NAME} ${TEST_SOURCES} ${SUNSHINE_SOURCES}) +# TODO: Use proper gtest integration from GoogleTest module +add_test(NAME ${PROJECT_NAME} + COMMAND ${PROJECT_NAME}) # Copy files needed for config consistency tests to build directory # This ensures both CLI and CLion can access the same files relative to the test executable From 073854d3c180aaae0b5243a1d0bf18b0cbf4976c Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 30 Jun 2026 23:27:27 +0200 Subject: [PATCH 5/5] Use ctest in spec file --- packaging/linux/copr/Sunshine.spec | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packaging/linux/copr/Sunshine.spec b/packaging/linux/copr/Sunshine.spec index 66f0013902c..cf092521383 100644 --- a/packaging/linux/copr/Sunshine.spec +++ b/packaging/linux/copr/Sunshine.spec @@ -237,6 +237,7 @@ cmake_args=( "-DSUNSHINE_PUBLISHER_NAME=LizardByte" "-DSUNSHINE_PUBLISHER_WEBSITE=https://app.lizardbyte.dev" "-DSUNSHINE_PUBLISHER_ISSUE_URL=https://app.lizardbyte.dev/support" + "-DCMAKE_TEST_LAUNCHER=xvfb-run" ) %if 0%{?fedora} @@ -387,12 +388,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop # run tests cd %{_builddir}/Sunshine/ -# TODO: Switch to using %%ctest -%if 0%{?suse_version} -xvfb-run %__builddir/tests/test_sunshine -%else -xvfb-run %_vpath_builddir/tests/test_sunshine -%endif +%ctest %install # Load NVM for Fedora 44+ so npm is available during make install