mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-01-04 02:39:56 +00:00
131 lines
4.9 KiB
CMake
131 lines
4.9 KiB
CMake
# common compile definitions
|
|
# this file will also load platform specific definitions
|
|
|
|
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wall -Wno-sign-compare)
|
|
# Wall - enable all warnings
|
|
# Wno-sign-compare - disable warnings for signed/unsigned comparisons
|
|
|
|
# setup assets directory
|
|
if(NOT SUNSHINE_ASSETS_DIR)
|
|
set(SUNSHINE_ASSETS_DIR "assets")
|
|
endif()
|
|
|
|
# platform specific compile definitions
|
|
if(WIN32)
|
|
include(${CMAKE_MODULE_PATH}/compile_definitions/windows.cmake)
|
|
elseif(UNIX)
|
|
include(${CMAKE_MODULE_PATH}/compile_definitions/unix.cmake)
|
|
|
|
if(APPLE)
|
|
include(${CMAKE_MODULE_PATH}/compile_definitions/macos.cmake)
|
|
else()
|
|
include(${CMAKE_MODULE_PATH}/compile_definitions/linux.cmake)
|
|
endif()
|
|
endif()
|
|
|
|
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/third-party/nv-codec-headers/include")
|
|
file(GLOB NVENC_SOURCES CONFIGURE_DEPENDS "src/nvenc/*.cpp" "src/nvenc/*.h")
|
|
list(APPEND PLATFORM_TARGET_FILES ${NVENC_SOURCES})
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/src/version.h.in" version.h @ONLY)
|
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
set(SUNSHINE_TARGET_FILES
|
|
"${CMAKE_SOURCE_DIR}/third-party/nanors/rs.c"
|
|
"${CMAKE_SOURCE_DIR}/third-party/nanors/rs.h"
|
|
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Input.h"
|
|
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Rtsp.h"
|
|
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/RtspParser.c"
|
|
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Video.h"
|
|
"${CMAKE_SOURCE_DIR}/third-party/tray/tray.h"
|
|
"${CMAKE_SOURCE_DIR}/src/upnp.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/upnp.h"
|
|
"${CMAKE_SOURCE_DIR}/src/cbs.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/utility.h"
|
|
"${CMAKE_SOURCE_DIR}/src/uuid.h"
|
|
"${CMAKE_SOURCE_DIR}/src/config.h"
|
|
"${CMAKE_SOURCE_DIR}/src/config.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/main.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/main.h"
|
|
"${CMAKE_SOURCE_DIR}/src/crypto.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/crypto.h"
|
|
"${CMAKE_SOURCE_DIR}/src/nvhttp.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/nvhttp.h"
|
|
"${CMAKE_SOURCE_DIR}/src/httpcommon.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/httpcommon.h"
|
|
"${CMAKE_SOURCE_DIR}/src/confighttp.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/confighttp.h"
|
|
"${CMAKE_SOURCE_DIR}/src/rtsp.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/rtsp.h"
|
|
"${CMAKE_SOURCE_DIR}/src/stream.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/stream.h"
|
|
"${CMAKE_SOURCE_DIR}/src/video.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/video.h"
|
|
"${CMAKE_SOURCE_DIR}/src/video_colorspace.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/video_colorspace.h"
|
|
"${CMAKE_SOURCE_DIR}/src/input.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/input.h"
|
|
"${CMAKE_SOURCE_DIR}/src/audio.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/audio.h"
|
|
"${CMAKE_SOURCE_DIR}/src/platform/common.h"
|
|
"${CMAKE_SOURCE_DIR}/src/process.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/process.h"
|
|
"${CMAKE_SOURCE_DIR}/src/network.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/network.h"
|
|
"${CMAKE_SOURCE_DIR}/src/move_by_copy.h"
|
|
"${CMAKE_SOURCE_DIR}/src/system_tray.cpp"
|
|
"${CMAKE_SOURCE_DIR}/src/system_tray.h"
|
|
"${CMAKE_SOURCE_DIR}/src/task_pool.h"
|
|
"${CMAKE_SOURCE_DIR}/src/thread_pool.h"
|
|
"${CMAKE_SOURCE_DIR}/src/thread_safe.h"
|
|
"${CMAKE_SOURCE_DIR}/src/sync.h"
|
|
"${CMAKE_SOURCE_DIR}/src/round_robin.h"
|
|
"${CMAKE_SOURCE_DIR}/src/stat_trackers.h"
|
|
"${CMAKE_SOURCE_DIR}/src/stat_trackers.cpp"
|
|
${PLATFORM_TARGET_FILES})
|
|
|
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/upnp.cpp" PROPERTIES COMPILE_FLAGS -Wno-pedantic)
|
|
|
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/third-party/nanors/rs.c"
|
|
PROPERTIES COMPILE_FLAGS "-include deps/obl/autoshim.h -ftree-vectorize")
|
|
|
|
if(NOT SUNSHINE_ASSETS_DIR_DEF)
|
|
set(SUNSHINE_ASSETS_DIR_DEF "${SUNSHINE_ASSETS_DIR}")
|
|
endif()
|
|
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR_DEF}")
|
|
|
|
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_TRAY=${SUNSHINE_TRAY})
|
|
|
|
include_directories("${CMAKE_SOURCE_DIR}")
|
|
|
|
include_directories(
|
|
SYSTEM
|
|
"${CMAKE_SOURCE_DIR}/third-party"
|
|
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/enet/include"
|
|
"${CMAKE_SOURCE_DIR}/third-party/nanors"
|
|
"${CMAKE_SOURCE_DIR}/third-party/nanors/deps/obl"
|
|
${FFMPEG_INCLUDE_DIRS}
|
|
${PLATFORM_INCLUDE_DIRS}
|
|
)
|
|
|
|
string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
|
|
if("${BUILD_TYPE}" STREQUAL "XDEBUG")
|
|
if(WIN32)
|
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/nvhttp.cpp" PROPERTIES COMPILE_FLAGS -O2)
|
|
endif()
|
|
else()
|
|
add_definitions(-DNDEBUG)
|
|
endif()
|
|
|
|
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
|
${MINIUPNP_LIBRARIES}
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
enet
|
|
opus
|
|
${FFMPEG_LIBRARIES}
|
|
${Boost_LIBRARIES}
|
|
${OPENSSL_LIBRARIES}
|
|
${CURL_LIBRARIES}
|
|
${PLATFORM_LIBRARIES}
|
|
nlohmann_json::nlohmann_json)
|