build: adopt xo-cmake dependency

This commit is contained in:
Roland Conybeare 2023-09-27 09:29:47 -04:00
commit 870eb57aa7
3 changed files with 37 additions and 8 deletions

View file

@ -26,17 +26,34 @@ jobs:
# install catch2. see [[https://stackoverflow.com/questions/57982945/how-to-apt-get-install-in-a-github-actions-workflow]] # install catch2. see [[https://stackoverflow.com/questions/57982945/how-to-apt-get-install-in-a-github-actions-workflow]]
run: sudo apt-get install -y catch2 run: sudo apt-get install -y catch2
# ----------------------------------------------------------------
- name: Clone xo-cmake
uses: actions/checkout@v3
with:
repository: Rconybea/xo-cmake
path: repo/xo-cmake
- name: Configure xo-cmake
run: cmake -B ${{github.workspace}}/build_xo-cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/xo-cmake
- name: Build xo-cmake (trivial)
run: cmake --build ${{github.workspace}}/build_xo-cmake --config ${{env.BUILD_TYPE}}
- name: Install xo-cmake
run: cmake --install ${{github.workspace}}/build_xo-cmake
# ----------------------------------------------------------------
- name: Clone indentlog - name: Clone indentlog
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
repository: Rconybea/indentlog repository: Rconybea/indentlog
path: repo/indentlog path: repo/indentlog
- name: Configure indentlog - name: Configure indentlog
# configure cmake for indentlog in dedicated build directory. # configure cmake for indentlog in dedicated build directory.
run: cmake -B ${{github.workspace}}/build_indentlog -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/indentlog run: cmake -B ${{github.workspace}}/build_indentlog -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/indentlog
- name: Build indentlog - name: Build indentlog
run: cmake --build ${{github.workspace}}/build_indentlog --config ${{env.BUILD_TYPE}} run: cmake --build ${{github.workspace}}/build_indentlog --config ${{env.BUILD_TYPE}}
@ -45,12 +62,12 @@ jobs:
# install into ${{github.workspace}}/local # install into ${{github.workspace}}/local
run: cmake --install ${{github.workspace}}/build_indentlog run: cmake --install ${{github.workspace}}/build_indentlog
# ----------------------------------------------------------------
- name: Configure self (refcnt)
- name: Configure refcnt
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build_refcnt -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} --debug-find run: cmake -B ${{github.workspace}}/build_refcnt -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build refcnt - name: Build refcnt
# Build your program with the given configuration # Build your program with the given configuration

View file

@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.10)
project(refcnt VERSION 0.1) project(refcnt VERSION 0.1)
enable_language(CXX) enable_language(CXX)
# common XO cmake macros (see proj/xo-cmake)
include(xo_macros/xo_cxx)
include(cmake/cxx.cmake) include(cmake/cxx.cmake)
include(cmake/code-coverage.cmake) include(cmake/code-coverage.cmake)

View file

@ -12,7 +12,7 @@ Refcnt is a small shared library supplying intrusive reference counting.
### build + install `indentlog` dependency ### build + install `indentlog` dependency
see [github/rconybea/indentlog](https://github.com/Rconybea/indentlog) see [github/Rconybea/indentlog](https://github.com/Rconybea/indentlog)
### copy `refcnt` repository locally ### copy `refcnt` repository locally
``` ```
@ -26,11 +26,13 @@ refcnt
$ cd refcnt $ cd refcnt
$ mkdir build $ mkdir build
$ cd build $ cd build
$ cmake -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} .. $ cmake -DCMAKE_MODULE_PATH=${INSTALL_PREFIX}/share/cmake -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ..
$ make $ make
$ make install $ make install
``` ```
`CMAKE_PREFIX_PATH` should point to prefix where `indentlog` is installed
alternatively, if you're a nix user: alternatively, if you're a nix user:
``` ```
$ git clone git@github.com:rconybea/xo-nix.git $ git clone git@github.com:rconybea/xo-nix.git
@ -40,6 +42,14 @@ $ cd xo-nix
$ nix-build -A refcnt $ nix-build -A refcnt
``` ```
### build for unit test coverage
```
$ cd refcnt
$ mkdir ccov
$ cd ccov
$ cmake -DCMAKE_MODULE_PATH=${INSTALL_PREFIX}/share/cmake -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCODE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug ..
```
## Examples ## Examples
### 1 ### 1