Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chronoxor committed Dec 9, 2016
1 parent 5136f20 commit 55f95f7
Show file tree
Hide file tree
Showing 21 changed files with 3,080 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Specify version format
version: "1.0.0.{build}"

# Branches to build
branches:
only:
- master

# Clone depth
clone_depth: 5

# Cache files to speed up build
cache:
- C:\cache\cygwin -> .appveyor.yml
- C:\ProgramData\chocolatey\bin -> .appveyor.yml
- C:\ProgramData\chocolatey\lib -> .appveyor.yml

# Build matrix
environment:
matrix:
- type: Cygwin
build: C:\cygwin64\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER/build; exec 0</dev/null; ./cygwin.sh"
command: C:\cygwin64\bin\bash -lc
- type: MinGW
build: call mingw.bat
command: cmd /C
- type: VisualStudio
build: call vs.bat
command: cmd /C

# Allow to fail on first error in matrix
matrix:
fast_finish: true

# Scripts that run after cloning repository
install:
- choco install doxygen.portable
- choco install graphviz.portable
- ps: 'Start-FileDownload "http://cygwin.com/setup-x86_64.exe" -FileName "C:\cygwin64\setup-x86_64.exe"'
- 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
- if "%type%"=="MinGW" choco install --force mingw
- if "%type%"=="MinGW" set PATH=C:\tools\mingw64\bin;%PATH:C:\Program Files\Git\usr\bin;=%
- if "%type%"=="MinGW" set INCLUDE=C:\tools\mingw64\x86_64-w64-mingw32\include;%INCLUDE%
- if "%type%"=="VisualStudio" set INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um;%INCLUDE%
- if "%type%"=="VisualStudio" set LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x64;%LIB%
- '%command% "git config --global user.name "AppVeyor""'
- '%command% "git config --global user.email "[email protected]""'
- '%command% "git config --global push.default simple"'
- git submodule update --init --recursive --remote

# Build scripts
build_script:
- cd build
- '%build%'

# Test scripts
test: off
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Temporary directory
temp
73 changes: 73 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Programming language definition
language: cpp

# Build matrix (OS, compiler)
matrix:
include:
- os: linux
compiler: gcc
env: GCC_VERSION=6
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-6
- g++-6
- cmake
- doxygen
- graphviz
- libbfd-dev
- uuid-dev
- os: linux
compiler: clang
env: CLANG_VERSION=3.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
- libc++-dev
- cmake
- doxygen
- graphviz
- libbfd-dev
- uuid-dev
- os: osx
compiler: clang
osx_image: xcode8

# Using Trusty environment
sudo: required
dist: trusty

# Branches to build
branches:
only:
- master

# Clone depth
git:
depth: 5

# Scripts that run before install
before_install:
- git config --global user.name "Travis CI"
- git config --global user.email "[email protected]"
- git config --global push.default simple
- if [[ "$TRAVIS_OS_NAME" != "osx" ]] && [ "$CXX" = "g++" ]; then export CC="gcc-${GCC_VERSION}" CXX="g++-${GCC_VERSION}"; fi
- if [[ "$TRAVIS_OS_NAME" != "osx" ]] && [ "$CXX" = "clang++" ]; then export CC="clang-${CLANG_VERSION}" CXX="clang++-${CLANG_VERSION}"; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install doxygen; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install graphviz; fi

# Build scripts
script:
- cd build
- ./unix.sh

# Don't send notifications on success
notifications:
email:
on_success: never
104 changes: 104 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
cmake_minimum_required(VERSION 2.8)

# Global properties
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Project name
project(cppserver)

# Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(DOXYGEN "doxygen")
if(NOT TARGET ${DOXYGEN})
add_custom_command(OUTPUT "Doxyfile" COMMAND ${DOXYGEN_EXECUTABLE} "Doxyfile" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/documents")
add_custom_target(${DOXYGEN} DEPENDS "Doxyfile")
set_target_properties(${DOXYGEN} PROPERTIES FOLDER doxygen)
endif()
endif()

# CMake module path
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# Compiler features
include(SetCompilerFeatures)
include(SetCompilerWarnings)
include(SetPlatformFeatures)

# External packages
find_package(Threads REQUIRED)

# System link libraries
list(APPEND SYSTEM Threads::Threads)

# Modules
add_subdirectory("modules")

# Library
file(GLOB_RECURSE SOURCE_FILES "source/*.cpp")
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
add_library(cppserver ${SOURCE_FILES})
target_include_directories(cppserver PUBLIC "include")
target_link_libraries(cppserver)
set_target_properties(cppserver PROPERTIES FOLDER libraries)
list(APPEND INSTALL_TARGETS cppserver)

# Additional module components: examples, performance benchmarks, tests, tools and install
if(NOT CPPSERVER_MODULE)

# Examples
file(GLOB EXAMPLE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/examples" "examples/*.cpp")
foreach(EXAMPLE_FILE ${EXAMPLE_FILES})
string(REGEX REPLACE "(.*)\\.cpp" "\\1" EXAMPLE_NAME ${EXAMPLE_FILE})
set(EXAMPLE_TARGET "cppserver-example-${EXAMPLE_NAME}")
set_source_files_properties(examples/${EXAMPLE_FILE} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
add_executable(${EXAMPLE_TARGET} examples/${EXAMPLE_FILE})
target_include_directories(${EXAMPLE_TARGET} PUBLIC "include")
target_link_libraries(${EXAMPLE_TARGET} cppserver ${SYSTEM})
set_target_properties(${EXAMPLE_TARGET} PROPERTIES FOLDER examples)
list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET})
list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET})
endforeach()

# Performance benchmarks
file(GLOB BENCHMARK_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/performance" "performance/*.cpp")
foreach(BENCHMARK_FILE ${BENCHMARK_FILES})
string(REGEX REPLACE "(.*)\\.cpp" "\\1" BENCHMARK_NAME ${BENCHMARK_FILE})
set(BENCHMARK_TARGET "cppserver-performance-${BENCHMARK_NAME}")
set_source_files_properties(performance/${BENCHMARK_FILE} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
add_executable(${BENCHMARK_TARGET} performance/${BENCHMARK_FILE})
target_include_directories(${BENCHMARK_TARGET} PUBLIC "include" PRIVATE "modules/CppBenchmark/include")
target_link_libraries(${BENCHMARK_TARGET} cppserver cppbenchmark ${SYSTEM})
set_target_properties(${BENCHMARK_TARGET} PROPERTIES FOLDER performance)
list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET})
list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET})
endforeach()

# Tests
file(GLOB TESTS_SOURCE_FILES "tests/*.cpp")
set_source_files_properties(${TESTS_SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
add_executable(cppserver-tests ${CATCH} ${TESTS_SOURCE_FILES})
target_include_directories(cppserver-tests PUBLIC "include" PRIVATE "modules/catch/single_include")
target_link_libraries(cppserver-tests cppserver ${SYSTEM})
set_target_properties(cppserver-tests PROPERTIES FOLDER tests)
list(APPEND INSTALL_TARGETS cppserver-tests)
list(APPEND INSTALL_TARGETS_PDB cppserver-tests)

# CTest
enable_testing()
add_test(cppserver-tests cppserver-tests)

# Install
install(TARGETS ${INSTALL_TARGETS}
RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/bin"
LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/bin"
ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/bin")

# Install *.pdb files
if(MSVC)
foreach(INSTALL_TARGET_PDB ${INSTALL_TARGETS_PDB})
install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGET_PDB}> DESTINATION "${PROJECT_SOURCE_DIR}/bin")
endforeach()
endif()

endif()
85 changes: 84 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,85 @@
# CppServer
C++ Server Library

[![Linux build status](https://img.shields.io/travis/chronoxor/CppServer/master.svg?label=Linux)](https://travis-ci.org/chronoxor/CppServer)
[![OSX build status](https://img.shields.io/travis/chronoxor/CppServer/master.svg?label=OSX)](https://travis-ci.org/chronoxor/CppServer)
[![Cygwin build status](https://img.shields.io/appveyor/ci/chronoxor/CppServer/master.svg?label=Cygwin)](https://ci.appveyor.com/project/chronoxor/CppServer)
[![MinGW build status](https://img.shields.io/appveyor/ci/chronoxor/CppServer/master.svg?label=MinGW)](https://ci.appveyor.com/project/chronoxor/CppServer)
[![Windows build status](https://img.shields.io/appveyor/ci/chronoxor/CppServer/master.svg?label=Windows)](https://ci.appveyor.com/project/chronoxor/CppServer)

C++ Server Library provides functionality to create different kind of
client/server solutions.

[CppServer API reference](http://chronoxor.github.io/CppServer/index.html)

# Contents
* [Features](#features)
* [Requirements](#requirements)
* [How to build?](#how-to-build)
* [Clone repository with submodules](#clone-repository-with-submodules)
* [Linux](#linux)
* [OSX](#osx)
* [Windows (Cygwin)](#windows-cygwin)
* [Windows (MinGW)](#windows-mingw)
* [Windows (MinGW with MSYS)](#windows-mingw-with-msys)
* [Windows (Visaul Studio 2015)](#windows-visaul-studio-2015)

# Features
* Cross platform
* Benchmarks
* Examples
* Tests
* (Doxygen)[http://www.doxygen.org] API documentation
* Continuous integration ((Travis CI)[https://travis-ci.com], (AppVeyor)[https://www.appveyor.com])

# Requirements
* Linux
* OSX
* Windows 7 / Windows 10
* [CMake](http://www.cmake.org)
* [GIT](https://git-scm.com)
* [GCC](https://gcc.gnu.org)

Optional:
* [Clang](http://clang.llvm.org)
* [Clion](https://www.jetbrains.com/clion)
* [MinGW](http://mingw-w64.org/doku.php)
* [Visual Studio 2015](https://www.visualstudio.com)

#How to build?

## Clone repository with submodules
```
git clone https://github.com/chronoxor/CppServer.git CppServer
cd CppServer
git submodule update --init --recursive --remote
```

## Linux
```
cd build
./unix.sh
```

## OSX
```
cd build
./unix.sh
```

## Windows (Cygwin)
```
cd build
cygwin.bat
```

## Windows (MinGW)
```
cd build
mingw.bat
```

## Windows (Visaul Studio 2015)
```
cd build
vs.bat
```
9 changes: 9 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# CppTemplate todo

General
* Library
* Examples
* Performance
* Tests
* Documentation
* Release
4 changes: 4 additions & 0 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
Loading

0 comments on commit 55f95f7

Please sign in to comment.