Skip to content

Commit

Permalink
refactor: move server files, split input types
Browse files Browse the repository at this point in the history
chore: fix weird imports

chore: fix sys tray import error

chore: fix clang code style

refactor: mouse, keyboard and touch now on their own namespaces

fix: make platf_input a singleton

refactor: better isolation

lint: remove import and space

lint: import order

docs: refactor docs too

lint: new line at the end

build: glob linking input/server

build: full src glob

chore: rebase fixes
  • Loading branch information
Hazer committed Jun 21, 2024
1 parent f3abf59 commit 5e1d3b1
Show file tree
Hide file tree
Showing 71 changed files with 2,503 additions and 1,925 deletions.
57 changes: 5 additions & 52 deletions cmake/compile_definitions/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ 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}") # required for importing version.h

file(GLOB_RECURSE COMMON_SOURCES
${CMAKE_SOURCE_DIR}/src/**)
list(FILTER COMMON_SOURCES EXCLUDE REGEX "${CMAKE_SOURCE_DIR}/src/platform/.*")

set(SUNSHINE_TARGET_FILES
"${CMAKE_SOURCE_DIR}/third-party/nanors/rs.c"
"${CMAKE_SOURCE_DIR}/third-party/nanors/rs.h"
Expand All @@ -56,58 +60,7 @@ set(SUNSHINE_TARGET_FILES
"${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/src/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/entry_handler.cpp"
"${CMAKE_SOURCE_DIR}/src/entry_handler.h"
"${CMAKE_SOURCE_DIR}/src/file_handler.cpp"
"${CMAKE_SOURCE_DIR}/src/file_handler.h"
"${CMAKE_SOURCE_DIR}/src/globals.cpp"
"${CMAKE_SOURCE_DIR}/src/globals.h"
"${CMAKE_SOURCE_DIR}/src/logging.cpp"
"${CMAKE_SOURCE_DIR}/src/logging.h"
"${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"
${COMMON_SOURCES}
${PLATFORM_TARGET_FILES})

if(NOT SUNSHINE_ASSETS_DIR_DEF)
Expand Down
4 changes: 2 additions & 2 deletions cmake/targets/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ else()
endif()

# src/upnp
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/upnp.cpp"
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/server/upnp.cpp"
DIRECTORY "${CMAKE_SOURCE_DIR}" "${TEST_DIR}"
PROPERTIES COMPILE_FLAGS -Wno-pedantic)

Expand All @@ -101,7 +101,7 @@ set_source_files_properties("${CMAKE_SOURCE_DIR}/third-party/ViGEmClient/src/ViG
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"
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/server/nvhttp.cpp"
DIRECTORY "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests"
PROPERTIES COMPILE_FLAGS -O2)
endif()
Expand Down
14 changes: 14 additions & 0 deletions docs/source/source_code/source_code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ Source

src/*

.. toctree::
:caption: src/input
:maxdepth: 1
:glob:

src/input/*

.. toctree::
:caption: src/platform
:maxdepth: 1
Expand Down Expand Up @@ -89,3 +96,10 @@ Source
:glob:

src/platform/windows/*

.. toctree::
:caption: src/server
:maxdepth: 1
:glob:

src/server/*
5 changes: 0 additions & 5 deletions docs/source/source_code/src/input.rst

This file was deleted.

6 changes: 6 additions & 0 deletions docs/source/source_code/src/input/common.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
input/common
============

.. cpp:namespace:: common
.. doxygenfile:: input/common.h
:allow-dot-graphs:
6 changes: 6 additions & 0 deletions docs/source/source_code/src/input/gamepad.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
input/gamepad
=============

.. cpp:namespace:: gamepad
.. doxygenfile:: input/gamepad.h
:allow-dot-graphs:
6 changes: 6 additions & 0 deletions docs/source/source_code/src/input/init.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
input/init
==========

.. cpp:namespace:: init
.. doxygenfile:: input/init.h
:allow-dot-graphs:
6 changes: 6 additions & 0 deletions docs/source/source_code/src/input/keyboard.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
input/keyboard
==============

.. cpp:namespace:: keyboard
.. doxygenfile:: input/keyboard.h
:allow-dot-graphs:
6 changes: 6 additions & 0 deletions docs/source/source_code/src/input/mouse.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
input/mouse
===========

.. cpp:namespace:: mouse
.. doxygenfile:: input/mouse.h
:allow-dot-graphs:
6 changes: 6 additions & 0 deletions docs/source/source_code/src/input/pen.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
input/pen
=========

.. cpp:namespace:: pen
.. doxygenfile:: input/pen.h
:allow-dot-graphs:
5 changes: 5 additions & 0 deletions docs/source/source_code/src/input/platform_input.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
input/platform_input
====================

.. doxygenfile:: input/platform_input.h
:allow-dot-graphs:
5 changes: 5 additions & 0 deletions docs/source/source_code/src/input/processor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
input/processor
===============

.. doxygenfile:: input/processor.h
:allow-dot-graphs:
6 changes: 6 additions & 0 deletions docs/source/source_code/src/input/touch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
input/touch
===========

.. cpp:namespace:: touch
.. doxygenfile:: input/touch.h
:allow-dot-graphs:
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
confighttp
==========

.. doxygenfile:: confighttp.h
.. doxygenfile:: server/confighttp.h
:allow-dot-graphs:
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
crypto
======

.. doxygenfile:: crypto.h
.. doxygenfile:: server/crypto.h
:allow-dot-graphs:
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
httpcommon
==========

.. doxygenfile:: httpcommon.h
.. doxygenfile:: server/httpcommon.h
:allow-dot-graphs:
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
network
=======

.. doxygenfile:: network.h
.. doxygenfile:: server/network.h
:allow-dot-graphs:
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nvhttp
======

.. doxygenfile:: nvhttp.h
.. doxygenfile:: server/nvhttp.h
:allow-dot-graphs:
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rtsp
====

.. doxygenfile:: rtsp.h
.. doxygenfile:: server/rtsp.h
:allow-dot-graphs:
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
upnp
====

.. doxygenfile:: upnp.h
.. doxygenfile:: server/upnp.h
:allow-dot-graphs:
1 change: 1 addition & 0 deletions src/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "thread_safe.h"
#include "utility.h"

namespace audio {
enum stream_config_e : int {
STEREO,
Expand Down
4 changes: 2 additions & 2 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "entry_handler.h"
#include "file_handler.h"
#include "logging.h"
#include "nvhttp.h"
#include "rtsp.h"
#include "server/nvhttp.h"
#include "server/rtsp.h"
#include "utility.h"

#include "platform/common.h"
Expand Down
6 changes: 3 additions & 3 deletions src/entry_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

// local includes
#include "config.h"
#include "confighttp.h"
#include "entry_handler.h"
#include "globals.h"
#include "httpcommon.h"
#include "logging.h"
#include "network.h"
#include "platform/common.h"
#include "server/confighttp.h"
#include "server/httpcommon.h"
#include "server/network.h"
#include "version.h"

extern "C" {
Expand Down
Loading

0 comments on commit 5e1d3b1

Please sign in to comment.