From 1395f2f2769f291b9d8819c2d0d8ccfce39907c3 Mon Sep 17 00:00:00 2001 From: Guillaume Fieni Date: Tue, 23 Apr 2024 08:21:09 +0200 Subject: [PATCH] build: Add `json-c` dependency --- .github/workflows/build.yml | 2 +- CMakeLists.txt | 5 +++-- Dockerfile | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6bce67..5e44029 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y libczmq-dev libpfm4-dev libmongoc-dev + sudo apt-get install -y libczmq-dev libpfm4-dev libjson-c-dev libmongoc-dev - name: Configure CMake run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=${{matrix.compiler}} -DCMAKE_C_CLANG_TIDY=clang-tidy diff --git a/CMakeLists.txt b/CMakeLists.txt index 7769e7e..4aa7a81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ set(SENSOR_SOURCES find_package(LibPFM REQUIRED) find_package(PkgConfig) pkg_check_modules(CZMQ REQUIRED libczmq) +pkg_check_modules(JSONC REQUIRED json-c) if(WITH_MONGODB) pkg_check_modules(MONGOC REQUIRED libmongoc-1.0) @@ -48,5 +49,5 @@ if(DEFINED ENV{GIT_TAG} AND DEFINED ENV{GIT_REV}) endif() add_executable(hwpc-sensor "${SENSOR_SOURCES}") -target_include_directories(hwpc-sensor SYSTEM PRIVATE "${LIBPFM_INCLUDE_DIRS}" "${CZMQ_INCLUDE_DIRS}" "${MONGOC_INCLUDE_DIRS}") -target_link_libraries(hwpc-sensor "${LIBPFM_LIBRARIES}" "${CZMQ_LIBRARIES}" "${MONGOC_LIBRARIES}") +target_include_directories(hwpc-sensor SYSTEM PRIVATE "${LIBPFM_INCLUDE_DIRS}" "${CZMQ_INCLUDE_DIRS}" "${JSONC_INCLUDE_DIRS}" "${MONGOC_INCLUDE_DIRS}") +target_link_libraries(hwpc-sensor "${LIBPFM_LIBRARIES}" "${CZMQ_LIBRARIES}" "${JSONC_LIBRARIES}" "${MONGOC_LIBRARIES}") diff --git a/Dockerfile b/Dockerfile index 7bd7cc2..49994cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ ENV DEBIAN_FRONTEND=noninteractive ARG BUILD_TYPE=Debug ARG MONGODB_SUPPORT=ON RUN apt update && \ - apt install -y build-essential git clang-tidy cmake pkg-config libczmq-dev libsystemd-dev uuid-dev && \ + apt install -y build-essential git clang-tidy cmake pkg-config libczmq-dev libjson-c-dev libsystemd-dev uuid-dev && \ echo "${MONGODB_SUPPORT}" |grep -iq "on" && apt install -y libmongoc-dev || true COPY --from=libpfm-builder /root/libpfm4*.deb /tmp/ RUN dpkg -i /tmp/libpfm4_*.deb /tmp/libpfm4-dev_*.deb && \ @@ -34,7 +34,7 @@ ARG MONGODB_SUPPORT=ON ARG FILE_CAPABILITY=CAP_SYS_ADMIN RUN useradd -d /opt/powerapi -m powerapi && \ apt update && \ - apt install -y libczmq4 libcap2-bin && \ + apt install -y libczmq4 libjson-c5 libcap2-bin && \ echo "${MONGODB_SUPPORT}" |grep -iq "on" && apt install -y libmongoc-1.0-0 || true && \ echo "${BUILD_TYPE}" |grep -iq "debug" && apt install -y libasan6 libubsan1 || true && \ rm -rf /var/lib/apt/lists/*