Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/targets/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ endif()

# tests
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()

Expand Down
17 changes: 7 additions & 10 deletions packaging/linux/copr/Sunshine.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -241,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}
Expand Down Expand Up @@ -380,8 +377,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
Expand All @@ -390,8 +387,8 @@ appstream-util validate %{buildroot}%{_metainfodir}/*.metainfo.xml
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop

# run tests
cd %{_builddir}/Sunshine/build
xvfb-run ./tests/test_sunshine
cd %{_builddir}/Sunshine/
%ctest

%install
# Load NVM for Fedora 44+ so npm is available during make install
Expand All @@ -409,8 +406,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
Expand Down
3 changes: 3 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,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
Expand Down