diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index fed72ad..e41d5ce 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -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: @@ -38,6 +88,7 @@ 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 @@ -45,3 +96,9 @@ jobs: - 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c16e42..7a7cc41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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 diff --git a/myframe/actor.h b/myframe/actor.h index 4b14eee..dff57d0 100644 --- a/myframe/actor.h +++ b/myframe/actor.h @@ -10,7 +10,7 @@ Author: 李柯鹏 #include #include -#include +#include #include "myframe/export.h" #include "myframe/macros.h" diff --git a/myframe/actor_context.h b/myframe/actor_context.h index 339e8f7..0a0fde4 100644 --- a/myframe/actor_context.h +++ b/myframe/actor_context.h @@ -10,7 +10,7 @@ Author: 李柯鹏 #include #include -#include +#include #include "myframe/macros.h" #include "myframe/mailbox.h" diff --git a/myframe/app.h b/myframe/app.h index 47fbc0a..7563cf0 100644 --- a/myframe/app.h +++ b/myframe/app.h @@ -13,7 +13,7 @@ Author: 李柯鹏 #include #include -#include +#include #include "myframe/macros.h" #include "myframe/event.h" diff --git a/myframe/common.h b/myframe/common.h index 88db336..e799b94 100644 --- a/myframe/common.h +++ b/myframe/common.h @@ -17,7 +17,7 @@ namespace stdfs = std::filesystem; #error "no filesystem header" #endif -#include +#include #include "myframe/export.h" namespace myframe { diff --git a/myframe/log.cpp b/myframe/log.cpp index 46afa29..59c6189 100644 --- a/myframe/log.cpp +++ b/myframe/log.cpp @@ -14,7 +14,7 @@ Author: 李柯鹏 #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; diff --git a/myframe/mod_manager.cpp b/myframe/mod_manager.cpp index 7a0d055..467762d 100644 --- a/myframe/mod_manager.cpp +++ b/myframe/mod_manager.cpp @@ -8,7 +8,7 @@ Author: 李柯鹏 #include "myframe/mod_manager.h" #include -#include +#include #include "myframe/shared_library.h" #include "myframe/actor.h" diff --git a/myframe/worker.h b/myframe/worker.h index 7fd43df..00f8d31 100644 --- a/myframe/worker.h +++ b/myframe/worker.h @@ -8,7 +8,7 @@ Author: 李柯鹏 #include #include -#include +#include #include "myframe/export.h" #include "myframe/macros.h" diff --git a/myframe/worker_context.h b/myframe/worker_context.h index b6e45fe..109e6b8 100644 --- a/myframe/worker_context.h +++ b/myframe/worker_context.h @@ -12,7 +12,7 @@ Author: 李柯鹏 #include #include -#include +#include #include "myframe/macros.h" #include "myframe/event.h"