Skip to content

Commit

Permalink
Merge pull request #25 from lkpworkspace/dev
Browse files Browse the repository at this point in the history
v0.8.3
  • Loading branch information
lkpworkspace authored Oct 23, 2023
2 parents 536e8cc + a3399cc commit a053730
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 14 deletions.
59 changes: 58 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,63 @@ jobs:
- uses: actions/checkout@v3
- run: sudo apt update
- run: sudo apt install build-essential cmake ninja-build
- run: sudo apt install libjsoncpp-dev libgoogle-glog-dev libunwind-dev
- run: sudo apt install libunwind-dev libgflags-dev

- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.0

- name: Cache jsoncpp
id: cache-jsoncpp
uses: actions/cache@v2
with:
path: jsoncpp/
key: ${{runner.os}}-jsoncpp-1.9.5

- name: Download jsoncpp
if: steps.cache-jsoncpp.outputs.cache-hit != 'true'
run: |
wget https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz
tar xvf 1.9.5.tar.gz
- name: Build jsoncpp
if: steps.cache-jsoncpp.outputs.cache-hit != 'true'
run: |
cmake -S jsoncpp-1.9.5 -B build-jsoncpp \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/jsoncpp \
-DBUILD_OBJECT_LIBS=OFF \
-DJSONCPP_WITH_TESTS=OFF \
-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF \
-DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF \
-G Ninja
cmake --build build-jsoncpp --target install
- name: Cache glog
id: cache-glog
uses: actions/cache@v2
with:
path: glog/
key: ${{runner.os}}-glog-0.6.0

- name: Download glog
if: steps.cache-glog.outputs.cache-hit != 'true'
run: |
wget https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz
tar xvf v0.6.0.tar.gz
- name: Build glog
if: steps.cache-glog.outputs.cache-hit != 'true'
run: |
cmake -S glog-0.6.0 -B build-glog \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/glog \
-DWITH_PKGCONFIG=OFF \
-DWITH_GTEST=OFF \
-G Ninja
cmake --build build-glog --target install
- name: Configure CMake
env:
# unit test option:
Expand All @@ -38,10 +88,17 @@ jobs:
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_PREFIX_PATH="${{github.workspace}}/jsoncpp;${{github.workspace}}/glog" \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
-G Ninja \
-Werror
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build_${{matrix.build_type}} --config ${{matrix.build_type}}

- name: Install
run: |
cmake --build build_${{matrix.build_type}} \
--config ${{matrix.build_type}} \
--target install
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(myframe VERSION 0.8.2)
project(myframe VERSION 0.8.3)

### option
option(MYFRAME_USE_CV "Using conditional variables for thread communication" OFF)
Expand Down Expand Up @@ -43,12 +43,13 @@ set(MYFRAME_CONF_DIR "conf")
### deps libs
find_package(Threads REQUIRED)
find_package(jsoncpp REQUIRED)
find_package(glog REQUIRED)

link_libraries(
Threads::Threads
${CMAKE_DL_LIBS}
glog
jsoncpp
glog::glog
jsoncpp_lib
)

### include dir
Expand Down Expand Up @@ -108,8 +109,8 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
# generate the version file for the config file
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}"
COMPATIBILITY AnyNewerVersion
VERSION "${PROJECT_VERSION}"
COMPATIBILITY SameMajorVersion
)

# install the configuration file
Expand Down
2 changes: 2 additions & 0 deletions myframe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ target_include_directories(${PROJECT_NAME}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})

# export file
include (GenerateExportHeader)
Expand Down
2 changes: 1 addition & 1 deletion myframe/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Author: 李柯鹏 <[email protected]>
#include <memory>
#include <string>

#include <jsoncpp/json/json.h>
#include <json/json.h>

#include "myframe/export.h"
#include "myframe/macros.h"
Expand Down
2 changes: 1 addition & 1 deletion myframe/actor_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Author: 李柯鹏 <[email protected]>
#include <memory>
#include <string>

#include <jsoncpp/json/json.h>
#include <json/json.h>

#include "myframe/macros.h"
#include "myframe/mailbox.h"
Expand Down
2 changes: 1 addition & 1 deletion myframe/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Author: 李柯鹏 <[email protected]>
#include <vector>
#include <string>

#include <jsoncpp/json/json.h>
#include <json/json.h>

#include "myframe/macros.h"
#include "myframe/event.h"
Expand Down
2 changes: 1 addition & 1 deletion myframe/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace stdfs = std::filesystem;
#error "no filesystem header"
#endif

#include <jsoncpp/json/json.h>
#include <json/json.h>
#include "myframe/export.h"

namespace myframe {
Expand Down
2 changes: 1 addition & 1 deletion myframe/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Author: 李柯鹏 <[email protected]>

#include "myframe/common.h"

static void signal_handler(const char *data, int size) {
static void signal_handler(const char *data, size_t size) {
std::string str = std::string(data, size);
std::cerr << str;
LOG(ERROR) << "\n" << str;
Expand Down
2 changes: 1 addition & 1 deletion myframe/mod_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Author: 李柯鹏 <[email protected]>
#include "myframe/mod_manager.h"

#include <glog/logging.h>
#include <jsoncpp/json/json.h>
#include <json/json.h>

#include "myframe/shared_library.h"
#include "myframe/actor.h"
Expand Down
2 changes: 1 addition & 1 deletion myframe/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Author: 李柯鹏 <[email protected]>
#include <memory>
#include <string>

#include <jsoncpp/json/json.h>
#include <json/json.h>

#include "myframe/export.h"
#include "myframe/macros.h"
Expand Down
2 changes: 1 addition & 1 deletion myframe/worker_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Author: 李柯鹏 <[email protected]>
#include <string>
#include <thread>

#include <jsoncpp/json/json.h>
#include <json/json.h>

#include "myframe/macros.h"
#include "myframe/event.h"
Expand Down

0 comments on commit a053730

Please sign in to comment.