mirror of
https://github.com/LizardByte/Sunshine.git
synced 2024-11-16 23:10:13 +00:00
e90b71ce62
Some checks failed
CI / GitHub Env Debug (push) Waiting to run
CI / Setup Release (push) Waiting to run
CI / Setup Flatpak Matrix (push) Waiting to run
CI / Linux Flatpak (push) Blocked by required conditions
CI / Linux ${{ matrix.type }} (--appimage-build, 22.04, AppImage) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 13) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (macos, 14) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (ubuntu, latest) (push) Blocked by required conditions
CI / Homebrew (${{ matrix.os_name }}-${{ matrix.os_version }}${{ matrix.release == true && ' (Release)' || '' }}) (ubuntu, latest, true) (push) Blocked by required conditions
CI / Macports (macOS-${{ matrix.os_version }}) (13, true) (push) Blocked by required conditions
CI / Macports (macOS-${{ matrix.os_version }}) (14) (push) Blocked by required conditions
CI / Windows (push) Blocked by required conditions
CI Docker / Check Dockerfiles (push) Waiting to run
CI Docker / Setup Release (push) Blocked by required conditions
CI Docker / Docker${{ matrix.tag }} (push) Blocked by required conditions
CodeQL / Get language matrix (push) Waiting to run
CodeQL / Analyze (${{ matrix.name }}) (push) Blocked by required conditions
Build GH-Pages / update_pages (push) Waiting to run
localize / Update Localization (push) Has been cancelled
90 lines
3.0 KiB
CMake
90 lines
3.0 KiB
CMake
#
|
|
# Loads the boost library giving the priority to the system package first, with a fallback to FetchContent.
|
|
#
|
|
include_guard(GLOBAL)
|
|
|
|
set(BOOST_VERSION 1.86)
|
|
set(BOOST_COMPONENTS
|
|
filesystem
|
|
locale
|
|
log
|
|
program_options
|
|
system) # system is not used by Sunshine, but by Simple-Web-Server, added here for convenience
|
|
|
|
if(BOOST_USE_STATIC)
|
|
set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103
|
|
endif()
|
|
|
|
find_package(Boost CONFIG ${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()
|
|
|
|
# more components required for compiling boost targets
|
|
list(APPEND BOOST_COMPONENTS
|
|
asio
|
|
crc
|
|
format
|
|
process
|
|
property_tree)
|
|
|
|
set(BOOST_ENABLE_CMAKE ON)
|
|
|
|
# Limit boost to the required libraries only
|
|
set(BOOST_INCLUDE_LIBRARIES
|
|
${BOOST_COMPONENTS})
|
|
set(BOOST_URL
|
|
"https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.tar.xz")
|
|
set(BOOST_HASH
|
|
"MD5=D02759931CEDC02ADED80402906C5EB6")
|
|
|
|
if(CMAKE_VERSION VERSION_LESS "3.24.0")
|
|
FetchContent_Declare(
|
|
Boost
|
|
URL ${BOOST_URL}
|
|
URL_HASH ${BOOST_HASH}
|
|
)
|
|
elseif(APPLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.25.0")
|
|
# add SYSTEM to FetchContent_Declare, this fails on debian bookworm
|
|
FetchContent_Declare(
|
|
Boost
|
|
URL ${BOOST_URL}
|
|
URL_HASH ${BOOST_HASH}
|
|
SYSTEM # requires CMake 3.25+
|
|
OVERRIDE_FIND_PACKAGE # requires CMake 3.24+, but we have a macro to handle it for other versions
|
|
)
|
|
elseif(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
|
|
FetchContent_Declare(
|
|
Boost
|
|
URL ${BOOST_URL}
|
|
URL_HASH ${BOOST_HASH}
|
|
OVERRIDE_FIND_PACKAGE # requires CMake 3.24+, but we have a macro to handle it for other versions
|
|
)
|
|
endif()
|
|
|
|
FetchContent_MakeAvailable(Boost)
|
|
set(FETCH_CONTENT_BOOST_USED TRUE)
|
|
|
|
set(Boost_FOUND TRUE) # cmake-lint: disable=C0103
|
|
set(Boost_INCLUDE_DIRS # cmake-lint: disable=C0103
|
|
"$<BUILD_INTERFACE:${Boost_SOURCE_DIR}/libs/headers/include>;$<INSTALL_INTERFACE:include/boost-1_85>")
|
|
|
|
if(WIN32)
|
|
# Windows build is failing to create .h file in this directory
|
|
file(MAKE_DIRECTORY ${Boost_BINARY_DIR}/libs/log/src/windows)
|
|
endif()
|
|
|
|
set(Boost_LIBRARIES "") # cmake-lint: disable=C0103
|
|
foreach(component ${BOOST_COMPONENTS})
|
|
list(APPEND Boost_LIBRARIES "Boost::${component}")
|
|
endforeach()
|
|
endif()
|
|
|
|
message(STATUS "Boost include dirs: ${Boost_INCLUDE_DIRS}")
|
|
message(STATUS "Boost libraries: ${Boost_LIBRARIES}")
|