Skip to content

Commit a053730

Browse files
authored
Merge pull request #25 from lkpworkspace/dev
v0.8.3
2 parents 536e8cc + a3399cc commit a053730

11 files changed

+74
-14
lines changed

.github/workflows/linux.yml

+58-1
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,63 @@ jobs:
1919
- uses: actions/checkout@v3
2020
- run: sudo apt update
2121
- run: sudo apt install build-essential cmake ninja-build
22-
- run: sudo apt install libjsoncpp-dev libgoogle-glog-dev libunwind-dev
22+
- run: sudo apt install libunwind-dev libgflags-dev
2323

2424
- name: Setup Ninja
2525
uses: ashutoshvarma/setup-ninja@master
2626
with:
2727
version: 1.10.0
2828

29+
- name: Cache jsoncpp
30+
id: cache-jsoncpp
31+
uses: actions/cache@v2
32+
with:
33+
path: jsoncpp/
34+
key: ${{runner.os}}-jsoncpp-1.9.5
35+
36+
- name: Download jsoncpp
37+
if: steps.cache-jsoncpp.outputs.cache-hit != 'true'
38+
run: |
39+
wget https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz
40+
tar xvf 1.9.5.tar.gz
41+
42+
- name: Build jsoncpp
43+
if: steps.cache-jsoncpp.outputs.cache-hit != 'true'
44+
run: |
45+
cmake -S jsoncpp-1.9.5 -B build-jsoncpp \
46+
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
47+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/jsoncpp \
48+
-DBUILD_OBJECT_LIBS=OFF \
49+
-DJSONCPP_WITH_TESTS=OFF \
50+
-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF \
51+
-DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF \
52+
-G Ninja
53+
cmake --build build-jsoncpp --target install
54+
55+
- name: Cache glog
56+
id: cache-glog
57+
uses: actions/cache@v2
58+
with:
59+
path: glog/
60+
key: ${{runner.os}}-glog-0.6.0
61+
62+
- name: Download glog
63+
if: steps.cache-glog.outputs.cache-hit != 'true'
64+
run: |
65+
wget https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz
66+
tar xvf v0.6.0.tar.gz
67+
68+
- name: Build glog
69+
if: steps.cache-glog.outputs.cache-hit != 'true'
70+
run: |
71+
cmake -S glog-0.6.0 -B build-glog \
72+
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
73+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/glog \
74+
-DWITH_PKGCONFIG=OFF \
75+
-DWITH_GTEST=OFF \
76+
-G Ninja
77+
cmake --build build-glog --target install
78+
2979
- name: Configure CMake
3080
env:
3181
# unit test option:
@@ -38,10 +88,17 @@ jobs:
3888
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
3989
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
4090
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
91+
-DCMAKE_PREFIX_PATH="${{github.workspace}}/jsoncpp;${{github.workspace}}/glog" \
4192
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
4293
-G Ninja \
4394
-Werror
4495
4596
- name: Build
4697
# Build your program with the given configuration
4798
run: cmake --build ${{github.workspace}}/build_${{matrix.build_type}} --config ${{matrix.build_type}}
99+
100+
- name: Install
101+
run: |
102+
cmake --build build_${{matrix.build_type}} \
103+
--config ${{matrix.build_type}} \
104+
--target install

CMakeLists.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.10)
2-
project(myframe VERSION 0.8.2)
2+
project(myframe VERSION 0.8.3)
33

44
### option
55
option(MYFRAME_USE_CV "Using conditional variables for thread communication" OFF)
@@ -43,12 +43,13 @@ set(MYFRAME_CONF_DIR "conf")
4343
### deps libs
4444
find_package(Threads REQUIRED)
4545
find_package(jsoncpp REQUIRED)
46+
find_package(glog REQUIRED)
4647

4748
link_libraries(
4849
Threads::Threads
4950
${CMAKE_DL_LIBS}
50-
glog
51-
jsoncpp
51+
glog::glog
52+
jsoncpp_lib
5253
)
5354

5455
### include dir
@@ -108,8 +109,8 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
108109
# generate the version file for the config file
109110
write_basic_package_version_file(
110111
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
111-
VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}"
112-
COMPATIBILITY AnyNewerVersion
112+
VERSION "${PROJECT_VERSION}"
113+
COMPATIBILITY SameMajorVersion
113114
)
114115

115116
# install the configuration file

myframe/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ target_include_directories(${PROJECT_NAME}
1313
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
1414
$<INSTALL_INTERFACE:include>
1515
)
16+
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
17+
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
1618

1719
# export file
1820
include (GenerateExportHeader)

myframe/actor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Author: 李柯鹏 <[email protected]>
1010
#include <memory>
1111
#include <string>
1212

13-
#include <jsoncpp/json/json.h>
13+
#include <json/json.h>
1414

1515
#include "myframe/export.h"
1616
#include "myframe/macros.h"

myframe/actor_context.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Author: 李柯鹏 <[email protected]>
1010
#include <memory>
1111
#include <string>
1212

13-
#include <jsoncpp/json/json.h>
13+
#include <json/json.h>
1414

1515
#include "myframe/macros.h"
1616
#include "myframe/mailbox.h"

myframe/app.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Author: 李柯鹏 <[email protected]>
1313
#include <vector>
1414
#include <string>
1515

16-
#include <jsoncpp/json/json.h>
16+
#include <json/json.h>
1717

1818
#include "myframe/macros.h"
1919
#include "myframe/event.h"

myframe/common.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace stdfs = std::filesystem;
1717
#error "no filesystem header"
1818
#endif
1919

20-
#include <jsoncpp/json/json.h>
20+
#include <json/json.h>
2121
#include "myframe/export.h"
2222

2323
namespace myframe {

myframe/log.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Author: 李柯鹏 <[email protected]>
1414

1515
#include "myframe/common.h"
1616

17-
static void signal_handler(const char *data, int size) {
17+
static void signal_handler(const char *data, size_t size) {
1818
std::string str = std::string(data, size);
1919
std::cerr << str;
2020
LOG(ERROR) << "\n" << str;

myframe/mod_manager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Author: 李柯鹏 <[email protected]>
88
#include "myframe/mod_manager.h"
99

1010
#include <glog/logging.h>
11-
#include <jsoncpp/json/json.h>
11+
#include <json/json.h>
1212

1313
#include "myframe/shared_library.h"
1414
#include "myframe/actor.h"

myframe/worker.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Author: 李柯鹏 <[email protected]>
88
#include <memory>
99
#include <string>
1010

11-
#include <jsoncpp/json/json.h>
11+
#include <json/json.h>
1212

1313
#include "myframe/export.h"
1414
#include "myframe/macros.h"

myframe/worker_context.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Author: 李柯鹏 <[email protected]>
1212
#include <string>
1313
#include <thread>
1414

15-
#include <jsoncpp/json/json.h>
15+
#include <json/json.h>
1616

1717
#include "myframe/macros.h"
1818
#include "myframe/event.h"

0 commit comments

Comments
 (0)