Skip to content

Commit

Permalink
build: Add json-c dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
gfieni committed Apr 23, 2024
1 parent 18cf133 commit 1395f2f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}")
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand All @@ -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/*
Expand Down

0 comments on commit 1395f2f

Please sign in to comment.