Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
k-morozov committed Aug 6, 2020
2 parents d106f95 + 3a44214 commit 5bc325c
Show file tree
Hide file tree
Showing 27 changed files with 502 additions and 458 deletions.
77 changes: 40 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,75 @@ dist: bionic
language: cpp
compiler: gcc
sudo: required
compiler:
- gcc
os:
- linux
addons:
apt:
packages:

matrix:
include:
# works on Precise and Trusty
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
- graphviz
- doxygen
- libgtest-dev
- sqlite3 libsqlite3-dev
- libboost-test-dev
- qt5-default
# cache:
# directories:
# - $HOME/boost_1_67_0/boost
# - $HOME/boost_1_67_0/stage/lib
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- BUILD_DIR=build
- PROJECT_NAME=AppChat

before_install:
- eval "${MATRIX_EVAL}"

before_script:
- if [ $TRAVIS_OS_NAME == linux ]; then sudo ./scripts/install_env.sh; fi
#gtest
- sudo apt-get install libgtest-dev -y
- sudo chmod 777 /usr/src/gtest
- cd /usr/src/gtest
- cmake .
- make
- sudo cp *.a /usr/lib/
- cd "${TRAVIS_BUILD_DIR}"
# end gtest

script:
- mkdir ${TRAVIS_BUILD_DIR}/build
- cd ${TRAVIS_BUILD_DIR}/build
- mkdir ${BUILD_DIR}
- cd ${BUILD_DIR}
- cmake ..
- cmake --build .
- cmake --build . --target test
- cd ${TRAVIS_BUILD_DIR}/build/bin
- tar -cf AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar server client
#- cmake --build . --target package
- cmake --build . --target package

after_success:
# Generate the docs only if master, and the TRAVIS_BUILD_DOCS is not zero
- >-
- cd ${TRAVIS_BUILD_DIR}/${BUILD_DIR}/bin
- tar -cf AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar server client
- >-
if [[ "$TRAVIS_BRANCH" = "master" && -n "$TRAVIS_BUILD_DOCS" ]] ; then
cd $TRAVIS_BUILD_DIR
echo 'Generating Doxygen code documentation...'
# Redirect both stderr and stdout to the log file AND the console.
doxygen doc/Doxyfile 2>&1 | tee doxygen.log
fi
deploy:
- provider: script
skip_cleanup: true
script:
- curl -T ${TRAVIS_BUILD_DIR}/build/bin/AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar -uk-morozov:$BINTRAY_API_KEY https://api.bintray.com/content/k-morozov/AppChat/Download/0.7.$TRAVIS_BUILD_NUMBER/AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar
on:
branch: master
if [[ "$TRAVIS_BRANCH" = "master" ]] ; then
curl -T ${TRAVIS_BUILD_DIR}/build/bin/AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar -uk-morozov:$BINTRAY_API_KEY https://api.bintray.com/content/k-morozov/AppChat/Download/0.7.$TRAVIS_BUILD_NUMBER/AppChat-0.7.$TRAVIS_BUILD_NUMBER-Linux.tar
curl -T ${TRAVIS_BUILD_DIR}/${BUILD_DIR}/${PROJECT_NAME}-0.0.$TRAVIS_BUILD_NUMBER-Linux.deb -uk-morozov:$BINTRAY_API_KEY "https://api.bintray.com/content/k-morozov/AppChat/Install-Linux/0.7.$TRAVIS_BUILD_NUMBER/${PROJECT_NAME}-0.0.$TRAVIS_BUILD_NUMBER-Linux.deb;deb_distribution=bionic;deb_component=main;deb_architecture=amd64;publish=1"
fi
- provider: pages
skip-cleanup: true
github-token: $GITHUB_API_KEY
keep-history: true
local-dir: docs/html
on:
branch: master
deploy:
# - provider: pages
# skip-cleanup: true
# github-token: $GITHUB_API_KEY
# keep-history: true
# local-dir: docs/html
# on:
# branch: master

before_deploy:
- git config --local user.name "k-morozov"
- git config --local user.email "[email protected]"
#- export TRAVIS_TAG=${TRAVIS_TAG:-$(date +'%d%m')-$TRAVIS_BUILD_NUMBER-Linux}
- git tag 0.7.$TRAVIS_BUILD_NUMBER-Linux
deploy:
- provider: releases
Expand Down
68 changes: 44 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,57 @@
cmake_minimum_required(VERSION 3.5)
project(AppChat)

if (DEFINED ENV{TRAVIS_BUILD_NUMBER})
project(AppChat VERSION 0.0.$ENV{TRAVIS_BUILD_NUMBER})
else ()
project(AppChat VERSION 0.0.1)
endif ()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED ON)

#****************************************************************************************************
set(SRC src)
set(LIB lib)
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)

set(PROTOCOL_LIB_NAME protocol_lib)
set(LOGGER_LIB_NAME logger_lib)
set(STORAGE_LIB_NAME sqlite_db)
set(BACKTRACE_LIB_NAME backtrace)
set(TRACEDEXCEPTION_LIB_NAME tracedexception_lib)
set(PROTOCOL_LIB_NAME protocol_lib)
set(LOGGER_LIB_NAME logger_lib)
set(STORAGE_LIB_NAME sqlite_db)

#****************************************************************************************************
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
#****************************************************************************************************
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/lib)

find_package(Threads REQUIRED)
find_package(Boost REQUIRED COMPONENTS system date_time unit_test_framework REQUIRED)

include_directories(
${Boost_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/lib/protocol
${CMAKE_SOURCE_DIR}/lib/log
${CMAKE_SOURCE_DIR}/lib/storage
${CMAKE_SOURCE_DIR}/src/server
${CMAKE_SOURCE_DIR}/src/client
)

add_subdirectory(${CMAKE_SOURCE_DIR}/lib/protocol)
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/log)
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/storage)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/server)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/client)

enable_testing()
add_subdirectory(${CMAKE_SOURCE_DIR}/src/tests)

set(CPACK_GENERATOR DEB)

set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")

add_subdirectory(${SRC}/server)
add_subdirectory(${SRC}/client)
add_subdirectory(${LIB}/protocol)
add_subdirectory(${LIB}/log)
add_subdirectory(${LIB}/storage)
add_subdirectory(${LIB}/libbacktrace)
add_subdirectory(${LIB}/traced_exception)
add_subdirectory(${SRC}/tests)
set(CPACK_PACKAGE_CONTACT [email protected])
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)

include(CPack)

#****************************************************************************************************
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYFILE ${CMAKE_SOURCE_DIR}/Doxyfile)
Expand All @@ -40,4 +61,3 @@ if (DOXYGEN_FOUND)
COMMENT "Generating API documentation with Doxygen")
unset(DOXYFILE)
endif()

4 changes: 3 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,9 @@ RECURSIVE = TRUE
# Note that relative paths are relative to the directory from which doxygen is
# run.

EXCLUDE = "lib/log/log4cplus"
EXCLUDE = "lib/log/log4cplus"
EXCLUDE += "lib/libbacktrace"


# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down
25 changes: 10 additions & 15 deletions lib/log/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
cmake_minimum_required(VERSION 3.5)
project(Logger)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# use if you have log4cplus
# find_library(LOGGER_CPLUS log4cplus)

add_subdirectory(log4cplus/)
set(LOGGER_SRC
logger.h
logger.cpp
)

# set(LOGGER_LIB_NAME logger_lib)
#****************************************************************************************************
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
add_library(${LOGGER_LIB_NAME} SHARED STATIC
${LOGGER_SRC})

add_library(${LOGGER_LIB_NAME} ${LOGGER_SRC})
target_include_directories(${LOGGER_LIB_NAME} PUBLIC .)
set_target_properties(${LOGGER_LIB_NAME} PROPERTIES
CMAKE_CXX_STANDARD 17
CMAKE_CXX_STANDARD_REQUIRED ON
)

add_subdirectory(log4cplus/)
target_link_libraries(${LOGGER_LIB_NAME} log4cplus)

# use if you have log4cplus
# target_link_libraries(${LOGGER_LIB_NAME} ${LOGGER_CPLUS})
install(TARGETS ${LOGGER_LIB_NAME} DESTINATION /usr/local/bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/logger.h DESTINATION /usr/local/include/appchat/)
20 changes: 11 additions & 9 deletions lib/protocol/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
cmake_minimum_required(VERSION 3.5)
project(Protocol)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(PROTOCOL_SRC
protocol.h protocol.cpp
Expand All @@ -17,11 +13,17 @@ set(PROTOCOL_SRC
response/response.h
response/input_response.h response/input_response.cpp
response/transport_response.h

)
#****************************************************************************************************

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -fPIC")
add_library(${PROTOCOL_LIB_NAME} SHARED STATIC
${PROTOCOL_SRC})

set_target_properties(${PROTOCOL_LIB_NAME} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
LINK_LIBRARIES pthread
COMPILE_OPTIONS "-std=c++17;-O2;-Wall;-Wextra;-Wpedantic;-fPIC"
)

add_library(${PROTOCOL_LIB_NAME} ${PROTOCOL_SRC})
target_include_directories(${PROTOCOL_LIB_NAME} PUBLIC .)
install(TARGETS ${PROTOCOL_LIB_NAME} DESTINATION /usr/local/bin)
install(TARGETS ${PROTOCOL_LIB_NAME} DESTINATION lib)
22 changes: 9 additions & 13 deletions lib/storage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
cmake_minimum_required(VERSION 3.5)
project(Storage)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)

set(Storage_dir storage)

#****************************************************************************************************
set(STORAGE_SRC
database.h
database.cpp
)

#****************************************************************************************************
add_library(${STORAGE_LIB_NAME} SHARED STATIC
${STORAGE_SRC})

add_library(${STORAGE_LIB_NAME} ${STORAGE_SRC})
target_include_directories(${STORAGE_LIB_NAME} PUBLIC .)
set_target_properties(${STORAGE_LIB_NAME} PROPERTIES
CMAKE_CXX_STANDARD 17
CMAKE_CXX_STANDARD_REQUIRED ON
)

#****************************************************************************************************
find_library(SQLITE3_LIBRARY NAMES sqlite3)
find_package(Boost REQUIRED)
target_link_libraries (${STORAGE_LIB_NAME} ${PROTOCOL_LIB_NAME} ${LOGGER_LIB_NAME} ${SQLITE3_LIBRARY} ${Boost_LIBRARIES})

install(TARGETS ${STORAGE_LIB_NAME} DESTINATION /usr/local/bin)
install(TARGETS ${STORAGE_LIB_NAME} DESTINATION lib)
8 changes: 5 additions & 3 deletions lib/traced_exception/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ set(TRACEDEXCEPTION_SRC
traced_exception.cpp
)

add_library(${TRACEDEXCEPTION_LIB_NAME} ${TRACEDEXCEPTION_SRC})
target_include_directories(${TRACEDEXCEPTION_LIB_NAME} PUBLIC .)
install(TARGETS ${BACKTRACE_LIB_NAME})

add_library(${TRACEDEXCEPTION_LIB_NAME} SHARED ${TRACEDEXCEPTION_SRC})
target_include_directories(${TRACEDEXCEPTION_LIB_NAME} PUBLIC .)
find_package(Boost REQUIRED)
target_link_libraries(${TRACEDEXCEPTION_LIB_NAME} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} ${BACKTRACE_LIB_NAME})


target_link_libraries(${TRACEDEXCEPTION_LIB_NAME} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
Loading

0 comments on commit 5bc325c

Please sign in to comment.