build: optionally static link boost (#2628)

This commit is contained in:
ReenigneArcher
2024-06-14 17:37:46 -04:00
committed by GitHub
parent 5f6fe3319c
commit ebc41acf98
30 changed files with 194 additions and 134 deletions

View File

@@ -125,8 +125,8 @@ include_directories(
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/enet/include"
"${CMAKE_SOURCE_DIR}/third-party/nanors"
"${CMAKE_SOURCE_DIR}/third-party/nanors/deps/obl"
${Boost_INCLUDE_DIRS}
${FFMPEG_INCLUDE_DIRS}
${PLATFORM_INCLUDE_DIRS}
)
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES

View File

@@ -117,43 +117,7 @@ elseif(NOT LIBDRM_FOUND)
endif()
# evdev
pkg_check_modules(PC_EVDEV libevdev)
if(PC_EVDEV_FOUND)
find_path(EVDEV_INCLUDE_DIR libevdev/libevdev.h
HINTS ${PC_EVDEV_INCLUDE_DIRS} ${PC_EVDEV_INCLUDEDIR})
find_library(EVDEV_LIBRARY
NAMES evdev libevdev)
else()
include(ExternalProject)
set(LIBEVDEV_VERSION libevdev-1.13.2)
ExternalProject_Add(libevdev
URL http://www.freedesktop.org/software/libevdev/${LIBEVDEV_VERSION}.tar.xz
PREFIX ${LIBEVDEV_VERSION}
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
BUILD_COMMAND "make"
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(libevdev SOURCE_DIR)
message(STATUS "libevdev source dir: ${SOURCE_DIR}")
set(EVDEV_INCLUDE_DIR "${SOURCE_DIR}")
ExternalProject_Get_Property(libevdev BINARY_DIR)
message(STATUS "libevdev binary dir: ${BINARY_DIR}")
set(EVDEV_LIBRARY "${BINARY_DIR}/libevdev/.libs/libevdev.a")
# compile libevdev before sunshine
set(SUNSHINE_TARGET_DEPENDENCIES ${SUNSHINE_TARGET_DEPENDENCIES} libevdev)
endif()
if(EVDEV_INCLUDE_DIR AND EVDEV_LIBRARY)
include_directories(SYSTEM ${EVDEV_INCLUDE_DIR})
list(APPEND PLATFORM_LIBRARIES ${EVDEV_LIBRARY})
else()
message(FATAL_ERROR "Couldn't find or fetch libevdev")
endif()
include(dependencies/libevdev_Sunshine)
# vaapi
if(${SUNSHINE_ENABLE_VAAPI})
@@ -274,7 +238,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)

View File

@@ -13,7 +13,9 @@ foreach(dir ${MACOS_LINK_DIRECTORIES})
endif()
endforeach()
ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
if(NOT BOOST_USE_STATIC AND NOT FETCH_CONTENT_BOOST_USED)
ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
endif()
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
${APP_KIT_LIBRARY}
@@ -24,9 +26,6 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
${FOUNDATION_LIBRARY}
${VIDEO_TOOLBOX_LIBRARY})
set(PLATFORM_INCLUDE_DIRS
${Boost_INCLUDE_DIR})
set(APPLE_PLIST_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/Info.plist")
# todo - tray is not working on macos

View File

@@ -2,7 +2,6 @@
# put anything here that applies to both linux and macos
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
Boost::log
${CURL_LIBRARIES})
# add install prefix to assets path if not already there