Skip to content

Commit

Permalink
Add server side structure
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenke committed Apr 3, 2024
1 parent 3fcdd57 commit a734173
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ add_subdirectory(common)
if (${BUILD_CLIENT})
add_subdirectory(client)
endif ()

if (${BUILD_SERVER})
add_subdirectory(server)
endif ()
86 changes: 86 additions & 0 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

add_library(
mumble_server
SHARED
lib/server.cpp
lib/server.hpp
)
generate_export_header(mumble_server)

set_target_properties(
mumble_server
PROPERTIES
CXX_STANDARD 23
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
POSITION_INDEPENDENT_CODE ON
INTERPROCEDURAL_OPTIMIZATION ${LTO_SUPPORTED}
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
SOVERSION 0
)

target_include_directories(
mumble_server
PUBLIC lib
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
)

target_compile_definitions(
mumble_server
PUBLIC ASIO_NO_DEPRECATED
)

# enable extra warnings for our code
target_compile_options(
mumble_server
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic>
)

find_package(asio CONFIG REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(Threads REQUIRED)

target_link_libraries(
mumble_server
PUBLIC mumble_protocol_common
PRIVATE asio::asio
PRIVATE OpenSSL::SSL
PRIVATE OpenSSL::Crypto
PRIVATE spdlog::spdlog
PRIVATE Threads::Threads
)

add_executable(
mumble_server_app
app/main.cpp
)
if (WIN32)
target_sources(
mumble_server_app
PUBLIC
app/application.manifest
)
endif ()

set_target_properties(
mumble_server_app
PROPERTIES
CXX_STANDARD 23
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)

find_package(Boost ${BOOST_REQUIRED_VERSION} REQUIRED COMPONENTS program_options)
target_link_libraries(
mumble_server_app
PRIVATE mumble_server
PRIVATE Boost::boost
PRIVATE Boost::program_options
PRIVATE spdlog::spdlog
)
9 changes: 9 additions & 0 deletions server/app/application.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity type="win32" name="mumble_server_app" version="6.0.0.0"/>
<application>
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>
16 changes: 16 additions & 0 deletions server/app/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by JanHe on 03.04.2024.
//

#include <cstdlib>

#include <server.hpp>

int main(int argc, char *argv[]) {
(void) argc;
(void) argv;

libmumble_protocol::server::MumbleServer mumble_server;

return EXIT_SUCCESS;
}
17 changes: 17 additions & 0 deletions server/lib/server.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Created by JanHe on 03.04.2024.
//

#include "server.hpp"

#include <pimpl_impl.hpp>

namespace libmumble_protocol::server {

struct MumbleServer::Impl final {};

MumbleServer::MumbleServer() = default;

MumbleServer::~MumbleServer() = default;

}// namespace libmumble_protocol::server
26 changes: 26 additions & 0 deletions server/lib/server.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Created by JanHe on 03.04.2024.
//

#ifndef LIBMUMBLE_PROTOCOL_SERVER_LIB_SERVER_HPP
#define LIBMUMBLE_PROTOCOL_SERVER_LIB_SERVER_HPP

#include "mumble_server_export.h"

#include <pimpl.hpp>

namespace libmumble_protocol::server {

class MUMBLE_SERVER_EXPORT MumbleServer final {
public:
MumbleServer();
~MumbleServer();

private:
struct Impl;
libmumble_protocol::common::Pimpl<Impl> pimpl_;
};

}// namespace libmumble_protocol::server

#endif//LIBMUMBLE_PROTOCOL_SERVER_LIB_SERVER_HPP

0 comments on commit a734173

Please sign in to comment.