Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
* text=auto eol=lf

# Source and build files
*.c text eol=lf
*.cc text eol=lf
*.cpp text eol=lf
*.cxx text eol=lf
*.h text eol=lf
*.hh text eol=lf
*.hpp text eol=lf
*.hxx text eol=lf
*.inl text eol=lf
*.ipp text eol=lf
CMakeLists.txt text eol=lf
*.cmake text eol=lf
CMakePresets.json text eol=lf
CTestPresets.json text eol=lf

# Project and config files
*.txt text eol=lf
*.md text eol=lf
*.json text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.toml text eol=lf
*.ini text eol=lf
*.cfg text eol=lf
*.conf text eol=lf
*.clang-format text eol=lf
*.clang-tidy text eol=lf
*.clangd text eol=lf
.gitignore text eol=lf
.gitattributes text eol=lf
.gitmodules text eol=lf
.editorconfig text eol=lf
Dockerfile text eol=lf
Doxyfile.in text eol=lf

# Scripts
*.sh text eol=lf
*.bash text eol=lf
*.py text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf

# Binary assets
*.png binary
*.gif binary
*.jpg binary
*.jpeg binary
*.ico binary
*.zip binary
*.gz binary
*.7z binary
22 changes: 11 additions & 11 deletions .github/workflows/build-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
push:
branches: master

env:
EXTERNAL_ROOT: /home/runner/3party

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -22,25 +19,28 @@ jobs:
BUILD_TYPE: ${{ matrix.build_type }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Add Boost repository
shell: bash
run: sudo apt-add-repository ppa:mhier/libboost-latest
- name: Setup vcpkg (with binary caching)
uses: lukka/run-vcpkg@v11
with:
runVcpkgInstall: false
vcpkgDirectory: "${{ github.workspace }}/.vcpkg"
vcpkgGitCommitId: "58950f88544e4637524dbd6a01d0317cf4cb77fc"

- name: Install latest Boost
- name: Install dependencies
shell: bash
run: sudo apt install libboost1.74-dev
run: $VCPKG_ROOT/vcpkg install boost-asio

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/serverpp/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/serverpp/build
run: cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$EXTERNAL_ROOT
run: cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake

- name: Build
shell: bash
Expand All @@ -50,4 +50,4 @@ jobs:
- name: Test
working-directory: ${{runner.workspace}}/serverpp/build
shell: bash
run: ctest -C $BUILD_TYPE
run: ctest -C $BUILD_TYPE --output-on-failure
30 changes: 27 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,22 @@ endif()
add_library(serverpp)
add_library(KazDragon::serverpp ALIAS serverpp)

set(SERVERPP_GENERATED_INCLUDE_DIR
"${PROJECT_BINARY_DIR}/generated/include")
set(SERVERPP_GENERATED_EXPORT_HEADER
"${SERVERPP_GENERATED_INCLUDE_DIR}/serverpp/detail/export.hpp")
set(SERVERPP_GENERATED_VERSION_HEADER
"${SERVERPP_GENERATED_INCLUDE_DIR}/serverpp/version.hpp")

file(MAKE_DIRECTORY "${SERVERPP_GENERATED_INCLUDE_DIR}/serverpp/detail")

target_sources(serverpp
PRIVATE
src/tcp_server.cpp
src/tcp_socket.cpp
include/serverpp/tcp_server.hpp
include/serverpp/tcp_socket.hpp
include/serverpp/version.hpp
${SERVERPP_GENERATED_VERSION_HEADER}
)

target_link_libraries(serverpp
Expand All @@ -61,6 +70,7 @@ target_link_libraries(serverpp

target_include_directories(serverpp
PUBLIC
$<BUILD_INTERFACE:${SERVERPP_GENERATED_INCLUDE_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/serverpp-${SERVERPP_VERSION}>
)
Expand Down Expand Up @@ -90,12 +100,12 @@ target_compile_options(serverpp
target_compile_features(serverpp PUBLIC cxx_std_20)

generate_export_header(serverpp
EXPORT_FILE_NAME "${PROJECT_SOURCE_DIR}/include/serverpp/detail/export.hpp"
EXPORT_FILE_NAME "${SERVERPP_GENERATED_EXPORT_HEADER}"
)

configure_file(
${PROJECT_SOURCE_DIR}/include/serverpp/version.hpp.in
${PROJECT_SOURCE_DIR}/include/serverpp/version.hpp
${SERVERPP_GENERATED_VERSION_HEADER}
@ONLY)

include(GNUInstallDirs)
Expand Down Expand Up @@ -151,6 +161,20 @@ install(
include/serverpp-${SERVERPP_VERSION}
)

install(
FILES
"${SERVERPP_GENERATED_EXPORT_HEADER}"
DESTINATION
include/serverpp-${SERVERPP_VERSION}/serverpp/detail
)

install(
FILES
"${SERVERPP_GENERATED_VERSION_HEADER}"
DESTINATION
include/serverpp-${SERVERPP_VERSION}/serverpp
)

install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/serverpp-config.cmake"
Expand Down
5 changes: 5 additions & 0 deletions cmake/serverpp-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

find_dependency(Boost 1.69.0)
find_dependency(Threads)

include(${CMAKE_CURRENT_LIST_DIR}/serverpp-targets.cmake)
check_required_components(serverpp)
Loading