Compile on Windows

This commit is contained in:
loki 2020-01-01 18:47:34 +01:00
parent b5fe713848
commit 1129aa6dfd
9 changed files with 57 additions and 61 deletions

View File

@ -4,62 +4,50 @@ project(Sunshine)
# set up include-directories # set up include-directories
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(FFMpeg REQUIRED)
find_package(Boost COMPONENTS filesystem REQUIRED)
add_subdirectory(Simple-Web-Server) add_subdirectory(Simple-Web-Server)
add_subdirectory(moonlight-common-c/enet) add_subdirectory(moonlight-common-c/enet)
find_package(X11 REQUIRED) if(WIN32)
set(PLATFORM_TARGET_FILES set(PLATFORM_TARGET_FILES
sunshine/platform/linux.cpp sunshine/platform/windows.cpp)
sunshine/platform/linux_evdev.cpp) set(PLATFORM_LIBRARIES
winmm
set(PLATFORM_LIBRARIES wsock32
Xfixes ws2_32)
Xtst else()
xcb find_package(X11 REQUIRED)
xcb-shm set(PLATFORM_TARGET_FILES
xcb-xfixes sunshine/platform/linux.cpp
${X11_LIBRARIES} sunshine/platform/linux_evdev.cpp)
evdev
pulse set(PLATFORM_LIBRARIES
pulse-simple) Xfixes
Xtst
set(PLATFORM_INCLUDE_DIRS xcb
${X11_INCLUDE_DIR} xcb-shm
/usr/include/libevdev-1.0) xcb-xfixes
${X11_LIBRARIES}
evdev
pulse
pulse-simple)
set(PLATFORM_INCLUDE_DIRS
${X11_INCLUDE_DIR}
/usr/include/libevdev-1.0)
endif()
set(SUNSHINE_TARGET_FILES set(SUNSHINE_TARGET_FILES
moonlight-common-c/reedsolomon/rs.c moonlight-common-c/reedsolomon/rs.c
moonlight-common-c/reedsolomon/rs.h moonlight-common-c/reedsolomon/rs.h
moonlight-common-c/src/AudioStream.c
moonlight-common-c/src/ByteBuffer.c
moonlight-common-c/src/ByteBuffer.h
moonlight-common-c/src/Connection.c
moonlight-common-c/src/ControlStream.c
moonlight-common-c/src/FakeCallbacks.c
moonlight-common-c/src/Input.h moonlight-common-c/src/Input.h
moonlight-common-c/src/InputStream.c
moonlight-common-c/src/Limelight.h
moonlight-common-c/src/Limelight-internal.h
moonlight-common-c/src/LinkedBlockingQueue.c
moonlight-common-c/src/LinkedBlockingQueue.h
moonlight-common-c/src/Misc.c
moonlight-common-c/src/Platform.c
moonlight-common-c/src/Platform.h
moonlight-common-c/src/PlatformSockets.c
moonlight-common-c/src/PlatformSockets.h
moonlight-common-c/src/PlatformThreads.h
moonlight-common-c/src/RtpFecQueue.c
moonlight-common-c/src/RtpFecQueue.h
moonlight-common-c/src/RtpReorderQueue.c
moonlight-common-c/src/RtpReorderQueue.h
moonlight-common-c/src/RtspConnection.c
moonlight-common-c/src/Rtsp.h moonlight-common-c/src/Rtsp.h
moonlight-common-c/src/RtspParser.c moonlight-common-c/src/RtspParser.c
moonlight-common-c/src/SdpGenerator.c
moonlight-common-c/src/SimpleStun.c
moonlight-common-c/src/VideoDepacketizer.c
moonlight-common-c/src/Video.h moonlight-common-c/src/Video.h
moonlight-common-c/src/VideoStream.c
sunshine/utility.h sunshine/utility.h
sunshine/uuid.h sunshine/uuid.h
sunshine/config.h sunshine/config.h
@ -98,14 +86,11 @@ include_directories(
${PLATFORM_INCLUDE_DIRS} ${PLATFORM_INCLUDE_DIRS}
) )
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(FFmpeg REQUIRED)
list(APPEND SUNSHINE_COMPILE_OPTIONS -fPIC -Wall -Wno-missing-braces -Wno-maybe-uninitialized -Wno-sign-compare) list(APPEND SUNSHINE_COMPILE_OPTIONS -fPIC -Wall -Wno-missing-braces -Wno-maybe-uninitialized -Wno-sign-compare)
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE) string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
if("x${BUILD_TYPE}" STREQUAL "xDEBUG") if("x${BUILD_TYPE}" STREQUAL "xDEBUG")
list(APPEND SUNSHINE_COMPILE_OPTIONS -O0 -pedantic -ggdb3) #list(APPEND SUNSHINE_COMPILE_OPTIONS -O0 -pedantic -ggdb3)
list(APPEND SUNSHINE_COMPILE_OPTIONS -O0)
else() else()
add_definitions(-DNDEBUG) add_definitions(-DNDEBUG)
list(APPEND SUNSHINE_COMPILE_OPTIONS -O3) list(APPEND SUNSHINE_COMPILE_OPTIONS -O3)
@ -117,6 +102,7 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
enet enet
opus opus
${FFMPEG_LIBRARIES} ${FFMPEG_LIBRARIES}
${Boost_LIBRARIES}
${PLATFORM_LIBRARIES}) ${PLATFORM_LIBRARIES})
add_definitions(-DSUNSHINE_ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets") add_definitions(-DSUNSHINE_ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets")

View File

@ -56,7 +56,7 @@ MACRO(FFMPEG_FIND varname shortname headername)
ELSE() ELSE()
MESSAGE(STATUS "Found ${shortname} include dirs: ${${varname}_INCLUDE_DIR}") MESSAGE(STATUS "Found ${shortname} include dirs: ${${varname}_INCLUDE_DIR}")
# GET_DIRECTORY_PROPERTY(FFMPEG_PARENT DIRECTORY ${${varname}_INCLUDE_DIR} PARENT_DIRECTORY) #GET_DIRECTORY_PROPERTY(FFMPEG_PARENT DIRECTORY ${${varname}_INCLUDE_DIR} PARENT_DIRECTORY)
GET_FILENAME_COMPONENT(FFMPEG_PARENT ${${varname}_INCLUDE_DIR} PATH) GET_FILENAME_COMPONENT(FFMPEG_PARENT ${${varname}_INCLUDE_DIR} PATH)
MESSAGE(STATUS "Using FFMpeg dir parent as hint: ${FFMPEG_PARENT}") MESSAGE(STATUS "Using FFMpeg dir parent as hint: ${FFMPEG_PARENT}")
@ -64,8 +64,8 @@ MACRO(FFMPEG_FIND varname shortname headername)
FIND_LIBRARY(${varname}_LIBRARIES NAMES ${shortname} FIND_LIBRARY(${varname}_LIBRARIES NAMES ${shortname}
HINTS ${PC_${varname}_LIBDIR} ${PC_${varname}_LIBRARY_DIR} ${FFMPEG_PARENT}) HINTS ${PC_${varname}_LIBDIR} ${PC_${varname}_LIBRARY_DIR} ${FFMPEG_PARENT})
ELSE() ELSE()
# FIND_PATH(${varname}_LIBRARIES "${shortname}.dll.a" HINTS ${FFMPEG_PARENT}) FIND_PATH(${varname}_LIBRARIES "${shortname}.dll.a" HINTS ${FFMPEG_PARENT})
FILE(GLOB_RECURSE ${varname}_LIBRARIES "${FFMPEG_PARENT}/*${shortname}.lib") # FILE(GLOB_RECURSE ${varname}_LIBRARIES "${FFMPEG_PARENT}/*${shortname}.lib")
# GLOBing is very bad... but windows sux, this is the only thing that works # GLOBing is very bad... but windows sux, this is the only thing that works
ENDIF() ENDIF()

View File

@ -8,7 +8,7 @@
# cert = /dir/cert.pem # cert = /dir/cert.pem
# The name displayed by Moonlight # The name displayed by Moonlight
# sunshine_name = sunshine sunshine_name = Sunshine
# The origin of the remote endpoint address that is not denied for HTTP method /pin # The origin of the remote endpoint address that is not denied for HTTP method /pin
# Could be any of the following values: # Could be any of the following values:

View File

@ -2,6 +2,8 @@
// Created by loki on 5/30/19. // Created by loki on 5/30/19.
// //
#include "process.h"
#include <thread> #include <thread>
#include <filesystem> #include <filesystem>
#include <iostream> #include <iostream>
@ -9,7 +11,6 @@
#include "nvhttp.h" #include "nvhttp.h"
#include "stream.h" #include "stream.h"
#include "config.h" #include "config.h"
#include "process.h"
#include "thread_pool.h" #include "thread_pool.h"
extern "C" { extern "C" {

View File

@ -2,6 +2,8 @@
// Created by loki on 6/3/19. // Created by loki on 6/3/19.
// //
#include "process.h"
#include <iostream> #include <iostream>
#include <filesystem> #include <filesystem>
@ -21,7 +23,6 @@
#include "stream.h" #include "stream.h"
#include "nvhttp.h" #include "nvhttp.h"
#include "platform/common.h" #include "platform/common.h"
#include "process.h"
#include "network.h" #include "network.h"

View File

@ -2,6 +2,8 @@
// Created by loki on 12/14/19. // Created by loki on 12/14/19.
// //
#include "process.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <iostream> #include <iostream>
@ -9,7 +11,6 @@
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp> #include <boost/property_tree/json_parser.hpp>
#include "process.h"
#include "config.h" #include "config.h"
#include "utility.h" #include "utility.h"
#include "platform/common.h" #include "platform/common.h"
@ -295,4 +296,4 @@ void refresh(const std::string &file_name) {
proc = std::move(*proc_opt); proc = std::move(*proc_opt);
} }
} }
} }

View File

@ -5,6 +5,10 @@
#ifndef SUNSHINE_PROCESS_H #ifndef SUNSHINE_PROCESS_H
#define SUNSHINE_PROCESS_H #define SUNSHINE_PROCESS_H
#ifndef __kernel_entry
#define __kernel_entry
#endif
#include <unordered_map> #include <unordered_map>
#include <optional> #include <optional>

View File

@ -1,6 +1,9 @@
// //
// Created by loki on 6/5/19. // Created by loki on 6/5/19.
// //
#include "process.h"
#include <boost/version.hpp> #include <boost/version.hpp>
#if ((BOOST_VERSION / 1000) >= 107) #if ((BOOST_VERSION / 1000) >= 107)
#define EXECUTOR(x) (x->get_executor()) #define EXECUTOR(x) (x->get_executor())
@ -32,7 +35,6 @@ extern "C" {
#include "thread_safe.h" #include "thread_safe.h"
#include "crypto.h" #include "crypto.h"
#include "input.h" #include "input.h"
#include "process.h"
#define IDX_START_A 0 #define IDX_START_A 0
#define IDX_REQUEST_IDR_FRAME 0 #define IDX_REQUEST_IDR_FRAME 0

View File

@ -568,7 +568,8 @@ struct endianness {
defined(__ARMEB__) || \ defined(__ARMEB__) || \
defined(__THUMBEB__) || \ defined(__THUMBEB__) || \
defined(__AARCH64EB__) || \ defined(__AARCH64EB__) || \
defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__) defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__) || \
defined(WIN32)
// It's a big-endian target architecture // It's a big-endian target architecture
little = false, little = false,
#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \ #elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \