diff --git a/.codeql-prebuild-cpp-Linux.sh b/.codeql-prebuild-cpp-Linux.sh index 042ae12c828..244c0531bf2 100644 --- a/.codeql-prebuild-cpp-Linux.sh +++ b/.codeql-prebuild-cpp-Linux.sh @@ -24,10 +24,6 @@ sudo apt-get install -y \ g++-10 \ libayatana-appindicator3-dev \ libavdevice-dev \ - libboost-filesystem-dev \ - libboost-locale-dev \ - libboost-log-dev \ - libboost-program-options-dev \ libcap-dev \ libcurl4-openssl-dev \ libdrm-dev \ diff --git a/.codeql-prebuild-cpp-Windows.sh b/.codeql-prebuild-cpp-Windows.sh index 98b49cc8d6b..79158ebf62d 100644 --- a/.codeql-prebuild-cpp-Windows.sh +++ b/.codeql-prebuild-cpp-Windows.sh @@ -19,7 +19,6 @@ pacman -Syu --noconfirm --ignore=mingw-w64-ucrt-x86_64-curl \ gcc \ git \ make \ - mingw-w64-ucrt-x86_64-boost \ mingw-w64-ucrt-x86_64-cmake \ mingw-w64-ucrt-x86_64-cppwinrt \ mingw-w64-ucrt-x86_64-graphviz \ diff --git a/.codeql-prebuild-cpp-macOS.sh b/.codeql-prebuild-cpp-macOS.sh index 4e74c8599e5..a4d283749a8 100644 --- a/.codeql-prebuild-cpp-macOS.sh +++ b/.codeql-prebuild-cpp-macOS.sh @@ -3,7 +3,6 @@ set -e # install dependencies brew install \ - boost \ cmake \ miniupnpc \ node \ diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1d902563fce..5ed019ccbde 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -252,10 +252,6 @@ jobs: g++-10 \ libayatana-appindicator3-dev \ libavdevice-dev \ - libboost-filesystem-dev \ - libboost-locale-dev \ - libboost-log-dev \ - libboost-program-options-dev \ libcap-dev \ libcurl4-openssl-dev \ libdrm-dev \ @@ -951,7 +947,6 @@ jobs: pacman -Syu --noconfirm --ignore=mingw-w64-ucrt-x86_64-curl \ doxygen \ git \ - mingw-w64-ucrt-x86_64-boost \ mingw-w64-ucrt-x86_64-cmake \ mingw-w64-ucrt-x86_64-cppwinrt \ mingw-w64-ucrt-x86_64-graphviz \ diff --git a/cmake/compile_definitions/common.cmake b/cmake/compile_definitions/common.cmake index 90a71802cde..d9879432554 100644 --- a/cmake/compile_definitions/common.cmake +++ b/cmake/compile_definitions/common.cmake @@ -129,6 +129,16 @@ include_directories( ${PLATFORM_INCLUDE_DIRS} ) +if(BOOST_USE_STATIC) + list(APPEND PLATFORM_LIBRARIES + Boost::filesystem + Boost::locale + Boost::log + Boost::program_options) +else() + list(APPEND PLATFORM_LIBRARIES Boost::dynamic_linking) +endif() + list(APPEND SUNSHINE_EXTERNAL_LIBRARIES ${MINIUPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} diff --git a/cmake/compile_definitions/linux.cmake b/cmake/compile_definitions/linux.cmake index b323eb82e84..fd04f0b951c 100644 --- a/cmake/compile_definitions/linux.cmake +++ b/cmake/compile_definitions/linux.cmake @@ -246,7 +246,6 @@ list(APPEND PLATFORM_TARGET_FILES "${CMAKE_SOURCE_DIR}/third-party/glad/include/glad/egl.h") list(APPEND PLATFORM_LIBRARIES - Boost::dynamic_linking dl pulse pulse-simple) diff --git a/cmake/dependencies/Boost_Sunshine.cmake b/cmake/dependencies/Boost_Sunshine.cmake new file mode 100644 index 00000000000..34382cc1be5 --- /dev/null +++ b/cmake/dependencies/Boost_Sunshine.cmake @@ -0,0 +1,33 @@ +# +# Loads the boost library giving the priority to the system package first, with a fallback to FetchContent. +# +include_guard(GLOBAL) + +set(BOOST_VERSION 1.85) +set(BOOST_COMPONENTS + filesystem + locale + log + program_options + system) # system is not used by Sunshine, but by Simple-Web-Server, added here for convenience + +find_package(Boost ${BOOST_VERSION} COMPONENTS ${BOOST_COMPONENTS}) +if(NOT Boost_FOUND) + message(STATUS "Boost v${BOOST_VERSION}.x package not found in the system. Falling back to FetchContent.") + include(FetchContent) + + # Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24: + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + cmake_policy(SET CMP0135 NEW) + endif() + + # Limit boost to the required libraries only + set(BOOST_INCLUDE_LIBRARIES + ${BOOST_COMPONENTS}) + FetchContent_Declare( + Boost + URL https://github.com/boostorg/boost/releases/download/boost-1.85.0/boost-1.85.0-cmake.tar.xz + URL_HASH MD5=BADEA970931766604D4D5F8F4090B176 + ) + FetchContent_MakeAvailable(Boost) +endif() diff --git a/cmake/dependencies/common.cmake b/cmake/dependencies/common.cmake index d10a769ca9c..c9106f7ed8f 100644 --- a/cmake/dependencies/common.cmake +++ b/cmake/dependencies/common.cmake @@ -1,9 +1,15 @@ # load common dependencies # this file will also load platform specific dependencies +# boost, this should be before Simple-Web-Server as it also depends on boost +if(BOOST_USE_STATIC) + set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103 +endif() +include(dependencies/Boost_Sunshine) + # submodules # moonlight common library -set(ENET_NO_INSTALL ON CACHE BOOL "Don't install any libraries build for enet") +set(ENET_NO_INSTALL ON CACHE BOOL "Don't install any libraries built for enet") add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/enet") # web server diff --git a/cmake/dependencies/unix.cmake b/cmake/dependencies/unix.cmake index 5b13bf60403..1f5ffd3adc8 100644 --- a/cmake/dependencies/unix.cmake +++ b/cmake/dependencies/unix.cmake @@ -1,4 +1,2 @@ # unix specific dependencies # put anything here that applies to both linux and macos - -find_package(Boost COMPONENTS locale log filesystem program_options REQUIRED) diff --git a/cmake/dependencies/windows.cmake b/cmake/dependencies/windows.cmake index a7ecce3963d..b5ce18e209a 100644 --- a/cmake/dependencies/windows.cmake +++ b/cmake/dependencies/windows.cmake @@ -1,7 +1,5 @@ # windows specific dependencies -set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103 -find_package(Boost 1.71.0 COMPONENTS locale log filesystem program_options REQUIRED) - # nlohmann_json +# TODO: should we use boost json instead? pkg_check_modules(NLOHMANN_JSON nlohmann_json REQUIRED IMPORTED_TARGET) diff --git a/cmake/packaging/linux.cmake b/cmake/packaging/linux.cmake index 4d9cfbcec72..115606ef9f9 100644 --- a/cmake/packaging/linux.cmake +++ b/cmake/packaging/linux.cmake @@ -28,10 +28,6 @@ set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_DEBIAN_PACKAGE_DEPENDS "\ ${CPACK_DEB_PLATFORM_PACKAGE_DEPENDS} \ - libboost-filesystem${Boost_VERSION}, \ - libboost-locale${Boost_VERSION}, \ - libboost-log${Boost_VERSION}, \ - libboost-program-options${Boost_VERSION}, \ libcap2, \ libcurl4, \ libdrm2, \ @@ -47,11 +43,7 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "\ miniupnpc, \ openssl | libssl3") set(CPACK_RPM_PACKAGE_REQUIRES "\ - ${CPACK_RPM_PLATFORM_PACKAGE_REQUIRES} \ - boost-filesystem >= ${Boost_VERSION}, \ - boost-locale >= ${Boost_VERSION}, \ - boost-log >= ${Boost_VERSION}, \ - boost-program-options >= ${Boost_VERSION}, \ + ${CPACK_RPM_PLATFORM_PACKAGE_REQUIRES} \, libcap >= 2.22, \ libcurl >= 7.0, \ libdrm >= 2.4.97, \ @@ -66,6 +58,21 @@ set(CPACK_RPM_PACKAGE_REQUIRES "\ openssl >= 3.0.2, \ pulseaudio-libs >= 10.0") +if(NOT BOOST_USE_STATIC) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "\ + ${CPACK_DEBIAN_PACKAGE_DEPENDS}, \ + libboost-filesystem${Boost_VERSION}, \ + libboost-locale${Boost_VERSION}, \ + libboost-log${Boost_VERSION}, \ + libboost-program-options${Boost_VERSION}") + set(CPACK_RPM_PACKAGE_REQUIRES "\ + ${CPACK_RPM_PACKAGE_REQUIRES}, \ + boost-filesystem >= ${Boost_VERSION}, \ + boost-locale >= ${Boost_VERSION}, \ + boost-log >= ${Boost_VERSION}, \ + boost-program-options >= ${Boost_VERSION}") +endif() + # This should automatically figure out dependencies, doesn't work with the current config set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) diff --git a/cmake/prep/options.cmake b/cmake/prep/options.cmake index 1555036eeb0..a6dc284a1c7 100644 --- a/cmake/prep/options.cmake +++ b/cmake/prep/options.cmake @@ -15,6 +15,8 @@ option(SUNSHINE_REQUIRE_TRAY "Require system tray icon. Fail the build if tray r option(SUNSHINE_SYSTEM_WAYLAND_PROTOCOLS "Use system installation of wayland-protocols rather than the submodule." OFF) +option(BOOST_USE_STATIC "Use static boost libraries." 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) @@ -23,7 +25,7 @@ if(UNIX) # technically, the homebrew build could be on linux as well... no idea if it would actually work option(SUNSHINE_BUILD_HOMEBREW "Enable a Homebrew build." OFF) -endif () +endif() if(APPLE) option(SUNSHINE_CONFIGURE_HOMEBREW diff --git a/docker/clion-toolchain.dockerfile b/docker/clion-toolchain.dockerfile index 204450bf1c9..b731c41722c 100644 --- a/docker/clion-toolchain.dockerfile +++ b/docker/clion-toolchain.dockerfile @@ -33,10 +33,6 @@ apt-get install -y --no-install-recommends \ git \ graphviz \ libayatana-appindicator3-dev \ - libboost-filesystem-dev=1.74.* \ - libboost-locale-dev=1.74.* \ - libboost-log-dev=1.74.* \ - libboost-program-options-dev=1.74.* \ libcap-dev \ libcurl4-openssl-dev \ libdrm-dev \ diff --git a/docker/debian-bookworm.dockerfile b/docker/debian-bookworm.dockerfile index 34cf29bedc9..82b1b44c029 100644 --- a/docker/debian-bookworm.dockerfile +++ b/docker/debian-bookworm.dockerfile @@ -36,10 +36,6 @@ apt-get install -y --no-install-recommends \ git \ graphviz \ libayatana-appindicator3-dev \ - libboost-filesystem-dev=1.74.* \ - libboost-locale-dev=1.74.* \ - libboost-log-dev=1.74.* \ - libboost-program-options-dev=1.74.* \ libcap-dev \ libcurl4-openssl-dev \ libdrm-dev \ diff --git a/docker/debian-bullseye.dockerfile b/docker/debian-bullseye.dockerfile index 2a491559083..3a04f2e0232 100644 --- a/docker/debian-bullseye.dockerfile +++ b/docker/debian-bullseye.dockerfile @@ -37,10 +37,6 @@ apt-get install -y --no-install-recommends \ git \ graphviz \ libayatana-appindicator3-dev \ - libboost-filesystem-dev=1.74.* \ - libboost-locale-dev=1.74.* \ - libboost-log-dev=1.74.* \ - libboost-program-options-dev=1.74.* \ libcap-dev \ libcurl4-openssl-dev \ libdrm-dev \ diff --git a/docker/fedora-39.dockerfile b/docker/fedora-39.dockerfile index 262b40fc7ac..ebaaad8f1d1 100644 --- a/docker/fedora-39.dockerfile +++ b/docker/fedora-39.dockerfile @@ -30,7 +30,6 @@ set -e dnf -y update dnf -y group install "Development Tools" dnf -y install \ - boost-devel-1.81.0* \ cmake-3.27.* \ doxygen \ gcc-13.2.* \ diff --git a/docker/fedora-40.dockerfile b/docker/fedora-40.dockerfile index 94a8a9fa733..a77c2ddf602 100644 --- a/docker/fedora-40.dockerfile +++ b/docker/fedora-40.dockerfile @@ -30,7 +30,6 @@ set -e dnf -y update dnf -y group install "Development Tools" dnf -y install \ - boost-devel-1.83.0* \ cmake-3.28.* \ doxygen \ gcc-14.1.* \ diff --git a/docker/ubuntu-22.04.dockerfile b/docker/ubuntu-22.04.dockerfile index e02ca1eba91..b76af8b1d78 100644 --- a/docker/ubuntu-22.04.dockerfile +++ b/docker/ubuntu-22.04.dockerfile @@ -37,10 +37,6 @@ apt-get install -y --no-install-recommends \ git \ graphviz \ libayatana-appindicator3-dev \ - libboost-filesystem-dev=1.74.* \ - libboost-locale-dev=1.74.* \ - libboost-log-dev=1.74.* \ - libboost-program-options-dev=1.74.* \ libcap-dev \ libcurl4-openssl-dev \ libdrm-dev \ diff --git a/docker/ubuntu-24.04.dockerfile b/docker/ubuntu-24.04.dockerfile index 7ef83bfba39..0f0b9ebcd22 100644 --- a/docker/ubuntu-24.04.dockerfile +++ b/docker/ubuntu-24.04.dockerfile @@ -39,10 +39,6 @@ apt-get install -y --no-install-recommends \ git \ graphviz \ libayatana-appindicator3-dev \ - libboost-filesystem-dev=1.83.* \ - libboost-locale-dev=1.83.* \ - libboost-log-dev=1.83.* \ - libboost-program-options-dev=1.83.* \ libcap-dev \ libcurl4-openssl-dev \ libdrm-dev \ diff --git a/docs/source/building/linux.rst b/docs/source/building/linux.rst index d0d0af6ed9c..32a107f766e 100644 --- a/docs/source/building/linux.rst +++ b/docs/source/building/linux.rst @@ -16,10 +16,6 @@ Install Requirements build-essential \ cmake \ libayatana-appindicator3-dev \ - libboost-filesystem-dev \ - libboost-locale-dev \ - libboost-log-dev \ - libboost-program-options-dev \ libcap-dev \ # KMS libcurl4-openssl-dev \ libdrm-dev \ # KMS @@ -55,7 +51,6 @@ Install Requirements sudo dnf update && \ sudo dnf group install "Development Tools" && \ sudo dnf install \ - boost-devel \ cmake \ gcc \ gcc-c++ \ @@ -97,10 +92,6 @@ Install Requirements build-essential \ cmake \ libappindicator3-dev \ - libboost-filesystem-dev \ - libboost-locale-dev \ - libboost-log-dev \ - libboost-program-options-dev \ libcap-dev \ # KMS libcurl4-openssl-dev \ libdrm-dev \ # KMS @@ -138,10 +129,6 @@ Install Requirements gcc-11 \ g++-11 \ libappindicator3-dev \ - libboost-filesystem-dev \ - libboost-locale-dev \ - libboost-log-dev \ - libboost-program-options-dev \ libcap-dev \ # KMS libcurl4-openssl-dev \ libdrm-dev \ # KMS diff --git a/docs/source/building/windows.rst b/docs/source/building/windows.rst index 084c492f59a..76cf6ac3ffb 100644 --- a/docs/source/building/windows.rst +++ b/docs/source/building/windows.rst @@ -17,7 +17,6 @@ Install dependencies: pacman -S \ doxygen \ git \ - mingw-w64-ucrt-x86_64-boost \ mingw-w64-ucrt-x86_64-cmake \ mingw-w64-ucrt-x86_64-cppwinrt \ mingw-w64-ucrt-x86_64-curl \ diff --git a/packaging/linux/Arch/PKGBUILD b/packaging/linux/Arch/PKGBUILD index 42e5843b029..2aaf3ba8a97 100644 --- a/packaging/linux/Arch/PKGBUILD +++ b/packaging/linux/Arch/PKGBUILD @@ -13,7 +13,6 @@ install=sunshine.install _gcc_version=13 depends=('avahi' - 'boost-libs' 'curl' 'libayatana-appindicator' 'libcap' @@ -37,8 +36,7 @@ depends=('avahi' 'udev') checkdepends=('doxygen' 'graphviz') -makedepends=('boost' - 'cmake' +makedepends=('cmake' "gcc${_gcc_version}" 'git' 'make' diff --git a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml index cba627807c3..8a58540dac1 100644 --- a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml +++ b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml @@ -36,24 +36,24 @@ build-options: modules: - "org.flatpak.Builder.BaseApp/xvfb.json" - - name: boost - disabled: false - buildsystem: simple - build-commands: - - cd tools/build && bison -y -d -o src/engine/jamgram.cpp src/engine/jamgram.y - - ./bootstrap.sh --prefix=$FLATPAK_DEST --with-libraries=locale,log,program_options,system,thread - - ./b2 install variant=release link=shared runtime-link=shared cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" - -j $FLATPAK_BUILDER_N_JOBS - sources: - - type: archive - url: http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.74/boost1.74_1.74.0.orig.tar.xz - sha256: 2467be4af625b5ae4b3c93fc7af196a09eba39c11a7338cd9e8b356fa44d2f45 - - type: archive - url: http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.74/boost1.74_1.74.0-18.1ubuntu3.debian.tar.xz - sha256: d5660bdce3ea4ac66194b0c4bc6dc3b9d43d41cc16af8bc6024980d965e40ae2 - - type: shell - commands: - - for n in $(cat patches/series); do if [[ $n != "#"* ]]; then patch -Np1 -i "patches/$n" -d .; fi; done +# - name: boost +# disabled: false +# buildsystem: simple +# build-commands: +# - cd tools/build && bison -y -d -o src/engine/jamgram.cpp src/engine/jamgram.y +# - ./bootstrap.sh --prefix=$FLATPAK_DEST --with-libraries=locale,log,program_options,system,thread +# - ./b2 install variant=release link=static,shared runtime-link=shared cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" +# -j $FLATPAK_BUILDER_N_JOBS +# sources: +# - type: archive +# url: http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.74/boost1.74_1.74.0.orig.tar.xz +# sha256: 2467be4af625b5ae4b3c93fc7af196a09eba39c11a7338cd9e8b356fa44d2f45 +# - type: archive +# url: http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.74/boost1.74_1.74.0-18.1ubuntu3.debian.tar.xz +# sha256: d5660bdce3ea4ac66194b0c4bc6dc3b9d43d41cc16af8bc6024980d965e40ae2 +# - type: shell +# commands: +# - for n in $(cat patches/series); do if [[ $n != "#"* ]]; then patch -Np1 -i "patches/$n" -d .; fi; done - name: avahi disabled: false diff --git a/packaging/macos/Portfile b/packaging/macos/Portfile index e0cc9ef34f6..e53166876c6 100644 --- a/packaging/macos/Portfile +++ b/packaging/macos/Portfile @@ -5,7 +5,6 @@ PortSystem 1.0 PortGroup cmake 1.1 PortGroup github 1.0 -PortGroup boost 1.0 name @PROJECT_NAME@ version @PROJECT_VERSION@ @@ -45,8 +44,6 @@ depends_lib port:avahi \ depends_test port:doxygen \ port:graphviz -boost.version 1.81 - configure.args -DBUILD_WERROR=ON \ -DCMAKE_INSTALL_PREFIX=${prefix} \ -DSUNSHINE_ASSETS_DIR=etc/sunshine/assets