Skip to content

Commit 55f95f7

Browse files
committed
Initial commit
1 parent 5136f20 commit 55f95f7

21 files changed

+3080
-1
lines changed

.appveyor.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Specify version format
2+
version: "1.0.0.{build}"
3+
4+
# Branches to build
5+
branches:
6+
only:
7+
- master
8+
9+
# Clone depth
10+
clone_depth: 5
11+
12+
# Cache files to speed up build
13+
cache:
14+
- C:\cache\cygwin -> .appveyor.yml
15+
- C:\ProgramData\chocolatey\bin -> .appveyor.yml
16+
- C:\ProgramData\chocolatey\lib -> .appveyor.yml
17+
18+
# Build matrix
19+
environment:
20+
matrix:
21+
- type: Cygwin
22+
build: C:\cygwin64\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER/build; exec 0</dev/null; ./cygwin.sh"
23+
command: C:\cygwin64\bin\bash -lc
24+
- type: MinGW
25+
build: call mingw.bat
26+
command: cmd /C
27+
- type: VisualStudio
28+
build: call vs.bat
29+
command: cmd /C
30+
31+
# Allow to fail on first error in matrix
32+
matrix:
33+
fast_finish: true
34+
35+
# Scripts that run after cloning repository
36+
install:
37+
- choco install doxygen.portable
38+
- choco install graphviz.portable
39+
- ps: 'Start-FileDownload "http://cygwin.com/setup-x86_64.exe" -FileName "C:\cygwin64\setup-x86_64.exe"'
40+
- if "%type%"=="Cygwin" C:\cygwin64\setup-x86_64.exe --quiet-mode --no-shortcuts --upgrade-also --root "C:\cygwin64" --local-package-dir "C:\cache\cygwin" --packages cmake,automake,make,gcc-core,gcc-g++,doxygen,graphviz
41+
- if "%type%"=="MinGW" choco install --force mingw
42+
- if "%type%"=="MinGW" set PATH=C:\tools\mingw64\bin;%PATH:C:\Program Files\Git\usr\bin;=%
43+
- if "%type%"=="MinGW" set INCLUDE=C:\tools\mingw64\x86_64-w64-mingw32\include;%INCLUDE%
44+
- if "%type%"=="VisualStudio" set INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um;%INCLUDE%
45+
- if "%type%"=="VisualStudio" set LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x64;%LIB%
46+
- '%command% "git config --global user.name "AppVeyor""'
47+
- '%command% "git config --global user.email "[email protected]""'
48+
- '%command% "git config --global push.default simple"'
49+
- git submodule update --init --recursive --remote
50+
51+
# Build scripts
52+
build_script:
53+
- cd build
54+
- '%build%'
55+
56+
# Test scripts
57+
test: off

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Temporary directory
2+
temp

.travis.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Programming language definition
2+
language: cpp
3+
4+
# Build matrix (OS, compiler)
5+
matrix:
6+
include:
7+
- os: linux
8+
compiler: gcc
9+
env: GCC_VERSION=6
10+
addons:
11+
apt:
12+
sources:
13+
- ubuntu-toolchain-r-test
14+
packages:
15+
- gcc-6
16+
- g++-6
17+
- cmake
18+
- doxygen
19+
- graphviz
20+
- libbfd-dev
21+
- uuid-dev
22+
- os: linux
23+
compiler: clang
24+
env: CLANG_VERSION=3.8
25+
addons:
26+
apt:
27+
sources:
28+
- ubuntu-toolchain-r-test
29+
- llvm-toolchain-precise-3.8
30+
packages:
31+
- clang-3.8
32+
- libc++-dev
33+
- cmake
34+
- doxygen
35+
- graphviz
36+
- libbfd-dev
37+
- uuid-dev
38+
- os: osx
39+
compiler: clang
40+
osx_image: xcode8
41+
42+
# Using Trusty environment
43+
sudo: required
44+
dist: trusty
45+
46+
# Branches to build
47+
branches:
48+
only:
49+
- master
50+
51+
# Clone depth
52+
git:
53+
depth: 5
54+
55+
# Scripts that run before install
56+
before_install:
57+
- git config --global user.name "Travis CI"
58+
- git config --global user.email "[email protected]"
59+
- git config --global push.default simple
60+
- if [[ "$TRAVIS_OS_NAME" != "osx" ]] && [ "$CXX" = "g++" ]; then export CC="gcc-${GCC_VERSION}" CXX="g++-${GCC_VERSION}"; fi
61+
- if [[ "$TRAVIS_OS_NAME" != "osx" ]] && [ "$CXX" = "clang++" ]; then export CC="clang-${CLANG_VERSION}" CXX="clang++-${CLANG_VERSION}"; fi
62+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install doxygen; fi
63+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install graphviz; fi
64+
65+
# Build scripts
66+
script:
67+
- cd build
68+
- ./unix.sh
69+
70+
# Don't send notifications on success
71+
notifications:
72+
email:
73+
on_success: never

CMakeLists.txt

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
cmake_minimum_required(VERSION 2.8)
2+
3+
# Global properties
4+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
5+
6+
# Project name
7+
project(cppserver)
8+
9+
# Doxygen
10+
find_package(Doxygen)
11+
if(DOXYGEN_FOUND)
12+
set(DOXYGEN "doxygen")
13+
if(NOT TARGET ${DOXYGEN})
14+
add_custom_command(OUTPUT "Doxyfile" COMMAND ${DOXYGEN_EXECUTABLE} "Doxyfile" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/documents")
15+
add_custom_target(${DOXYGEN} DEPENDS "Doxyfile")
16+
set_target_properties(${DOXYGEN} PROPERTIES FOLDER doxygen)
17+
endif()
18+
endif()
19+
20+
# CMake module path
21+
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
22+
23+
# Compiler features
24+
include(SetCompilerFeatures)
25+
include(SetCompilerWarnings)
26+
include(SetPlatformFeatures)
27+
28+
# External packages
29+
find_package(Threads REQUIRED)
30+
31+
# System link libraries
32+
list(APPEND SYSTEM Threads::Threads)
33+
34+
# Modules
35+
add_subdirectory("modules")
36+
37+
# Library
38+
file(GLOB_RECURSE SOURCE_FILES "source/*.cpp")
39+
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
40+
add_library(cppserver ${SOURCE_FILES})
41+
target_include_directories(cppserver PUBLIC "include")
42+
target_link_libraries(cppserver)
43+
set_target_properties(cppserver PROPERTIES FOLDER libraries)
44+
list(APPEND INSTALL_TARGETS cppserver)
45+
46+
# Additional module components: examples, performance benchmarks, tests, tools and install
47+
if(NOT CPPSERVER_MODULE)
48+
49+
# Examples
50+
file(GLOB EXAMPLE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/examples" "examples/*.cpp")
51+
foreach(EXAMPLE_FILE ${EXAMPLE_FILES})
52+
string(REGEX REPLACE "(.*)\\.cpp" "\\1" EXAMPLE_NAME ${EXAMPLE_FILE})
53+
set(EXAMPLE_TARGET "cppserver-example-${EXAMPLE_NAME}")
54+
set_source_files_properties(examples/${EXAMPLE_FILE} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
55+
add_executable(${EXAMPLE_TARGET} examples/${EXAMPLE_FILE})
56+
target_include_directories(${EXAMPLE_TARGET} PUBLIC "include")
57+
target_link_libraries(${EXAMPLE_TARGET} cppserver ${SYSTEM})
58+
set_target_properties(${EXAMPLE_TARGET} PROPERTIES FOLDER examples)
59+
list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET})
60+
list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET})
61+
endforeach()
62+
63+
# Performance benchmarks
64+
file(GLOB BENCHMARK_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/performance" "performance/*.cpp")
65+
foreach(BENCHMARK_FILE ${BENCHMARK_FILES})
66+
string(REGEX REPLACE "(.*)\\.cpp" "\\1" BENCHMARK_NAME ${BENCHMARK_FILE})
67+
set(BENCHMARK_TARGET "cppserver-performance-${BENCHMARK_NAME}")
68+
set_source_files_properties(performance/${BENCHMARK_FILE} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
69+
add_executable(${BENCHMARK_TARGET} performance/${BENCHMARK_FILE})
70+
target_include_directories(${BENCHMARK_TARGET} PUBLIC "include" PRIVATE "modules/CppBenchmark/include")
71+
target_link_libraries(${BENCHMARK_TARGET} cppserver cppbenchmark ${SYSTEM})
72+
set_target_properties(${BENCHMARK_TARGET} PROPERTIES FOLDER performance)
73+
list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET})
74+
list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET})
75+
endforeach()
76+
77+
# Tests
78+
file(GLOB TESTS_SOURCE_FILES "tests/*.cpp")
79+
set_source_files_properties(${TESTS_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
80+
add_executable(cppserver-tests ${CATCH} ${TESTS_SOURCE_FILES})
81+
target_include_directories(cppserver-tests PUBLIC "include" PRIVATE "modules/catch/single_include")
82+
target_link_libraries(cppserver-tests cppserver ${SYSTEM})
83+
set_target_properties(cppserver-tests PROPERTIES FOLDER tests)
84+
list(APPEND INSTALL_TARGETS cppserver-tests)
85+
list(APPEND INSTALL_TARGETS_PDB cppserver-tests)
86+
87+
# CTest
88+
enable_testing()
89+
add_test(cppserver-tests cppserver-tests)
90+
91+
# Install
92+
install(TARGETS ${INSTALL_TARGETS}
93+
RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/bin"
94+
LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/bin"
95+
ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/bin")
96+
97+
# Install *.pdb files
98+
if(MSVC)
99+
foreach(INSTALL_TARGET_PDB ${INSTALL_TARGETS_PDB})
100+
install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGET_PDB}> DESTINATION "${PROJECT_SOURCE_DIR}/bin")
101+
endforeach()
102+
endif()
103+
104+
endif()

README.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,85 @@
11
# CppServer
2-
C++ Server Library
2+
3+
[![Linux build status](https://img.shields.io/travis/chronoxor/CppServer/master.svg?label=Linux)](https://travis-ci.org/chronoxor/CppServer)
4+
[![OSX build status](https://img.shields.io/travis/chronoxor/CppServer/master.svg?label=OSX)](https://travis-ci.org/chronoxor/CppServer)
5+
[![Cygwin build status](https://img.shields.io/appveyor/ci/chronoxor/CppServer/master.svg?label=Cygwin)](https://ci.appveyor.com/project/chronoxor/CppServer)
6+
[![MinGW build status](https://img.shields.io/appveyor/ci/chronoxor/CppServer/master.svg?label=MinGW)](https://ci.appveyor.com/project/chronoxor/CppServer)
7+
[![Windows build status](https://img.shields.io/appveyor/ci/chronoxor/CppServer/master.svg?label=Windows)](https://ci.appveyor.com/project/chronoxor/CppServer)
8+
9+
C++ Server Library provides functionality to create different kind of
10+
client/server solutions.
11+
12+
[CppServer API reference](http://chronoxor.github.io/CppServer/index.html)
13+
14+
# Contents
15+
* [Features](#features)
16+
* [Requirements](#requirements)
17+
* [How to build?](#how-to-build)
18+
* [Clone repository with submodules](#clone-repository-with-submodules)
19+
* [Linux](#linux)
20+
* [OSX](#osx)
21+
* [Windows (Cygwin)](#windows-cygwin)
22+
* [Windows (MinGW)](#windows-mingw)
23+
* [Windows (MinGW with MSYS)](#windows-mingw-with-msys)
24+
* [Windows (Visaul Studio 2015)](#windows-visaul-studio-2015)
25+
26+
# Features
27+
* Cross platform
28+
* Benchmarks
29+
* Examples
30+
* Tests
31+
* (Doxygen)[http://www.doxygen.org] API documentation
32+
* Continuous integration ((Travis CI)[https://travis-ci.com], (AppVeyor)[https://www.appveyor.com])
33+
34+
# Requirements
35+
* Linux
36+
* OSX
37+
* Windows 7 / Windows 10
38+
* [CMake](http://www.cmake.org)
39+
* [GIT](https://git-scm.com)
40+
* [GCC](https://gcc.gnu.org)
41+
42+
Optional:
43+
* [Clang](http://clang.llvm.org)
44+
* [Clion](https://www.jetbrains.com/clion)
45+
* [MinGW](http://mingw-w64.org/doku.php)
46+
* [Visual Studio 2015](https://www.visualstudio.com)
47+
48+
#How to build?
49+
50+
## Clone repository with submodules
51+
```
52+
git clone https://github.com/chronoxor/CppServer.git CppServer
53+
cd CppServer
54+
git submodule update --init --recursive --remote
55+
```
56+
57+
## Linux
58+
```
59+
cd build
60+
./unix.sh
61+
```
62+
63+
## OSX
64+
```
65+
cd build
66+
./unix.sh
67+
```
68+
69+
## Windows (Cygwin)
70+
```
71+
cd build
72+
cygwin.bat
73+
```
74+
75+
## Windows (MinGW)
76+
```
77+
cd build
78+
mingw.bat
79+
```
80+
81+
## Windows (Visaul Studio 2015)
82+
```
83+
cd build
84+
vs.bat
85+
```

TODO.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# CppTemplate todo
2+
3+
General
4+
* Library
5+
* Examples
6+
* Performance
7+
* Tests
8+
* Documentation
9+
* Release

bin/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ignore everything in this directory
2+
*
3+
# Except this file
4+
!.gitignore

0 commit comments

Comments
 (0)