Starting to compile with CMake but can't find rapidjson lib

This commit is contained in:
30hours 2024-01-01 16:58:20 +00:00
parent 1cd5097f56
commit 896844edae
3 changed files with 47 additions and 13 deletions

View file

@ -9,10 +9,11 @@ include(CTest)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(asio CONFIG REQUIRED) find_package(asio CONFIG REQUIRED)
find_package(RapidJSON REQUIRED) #find_package(rapidjson CONFIG REQUIRED)
find_path(RAPIDJSON_INCLUDE_DIRS "rapidjson/allocators.h")
find_package(ryml CONFIG REQUIRED) find_package(ryml CONFIG REQUIRED)
find_package(httplib REQUIRED) find_package(httplib CONFIG REQUIRED)
find_package(Armadillo REQUIRED) find_package(Armadillo CONFIG REQUIRED)
find_package(Catch2 CONFIG REQUIRED) find_package(Catch2 CONFIG REQUIRED)
# TODO: When release CI is finished, don't use these dirs, install target should go to prod # TODO: When release CI is finished, don't use these dirs, install target should go to prod
@ -50,6 +51,7 @@ add_executable(blah2
src/data/meta/Timing.cpp src/data/meta/Timing.cpp
) )
target_link_libraries(blah2 PRIVATE target_link_libraries(blah2 PRIVATE
Threads::Threads Threads::Threads
rapidjson rapidjson
@ -61,6 +63,7 @@ target_link_libraries(blah2 PRIVATE
fftw3_threads fftw3_threads
sdrplay sdrplay
) )
#target_include_directories(main PRIVATE ${RAPIDJSON_INCLUDE_DIRS})
# unit tests # unit tests
add_executable(testAmbiguity add_executable(testAmbiguity

View file

@ -1,13 +1,20 @@
FROM ubuntu:22.04 as blah2_env FROM ubuntu:22.04 as blah2_env
MAINTAINER 30hours <nathan@30hours.dev> LABEL maintainer="30hours <nathan@30hours.dev>"
WORKDIR blah2 WORKDIR /blah2
ADD lib lib ADD lib lib
RUN ls -lah && pwd RUN apt-get update \
RUN apt-get update && apt-get install -y g++ make cmake git curl zip unzip doxygen graphviz \
RUN apt-get install -y g++ make cmake libfftw3-dev liblapack-dev libopenblas-dev xz-utils libudev-dev libusb-1.0.0-dev sudo systemd doxygen graphviz libfftw3-dev liblapack-dev xz-utils libusb-1.0.0-dev pkg-config gfortran
RUN cd lib && tar xf armadillo-12.0.1.tar.xz && cd armadillo-12.0.1 && cmake . && make install
# install dependencies from vcpkg
RUN git clone https://github.com/microsoft/vcpkg /opt/vcpkg \
&& /opt/vcpkg/bootstrap-vcpkg.sh
ENV PATH="/opt/vcpkg:${PATH}" VCPKG_ROOT=/opt/vcpkg
RUN cd /blah2/lib && vcpkg integrate install \
&& vcpkg install --clean-after-build
# install SDRplay API
RUN chmod +x /blah2/lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run \ RUN chmod +x /blah2/lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run \
&& /blah2/lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run --tar -xvf -C /blah2/lib/sdrplay-3.0.7 \ && /blah2/lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run --tar -xvf -C /blah2/lib/sdrplay-3.0.7 \
&& cp /blah2/lib/sdrplay-3.0.7/x86_64/libsdrplay_api.so.3.07 /usr/local/lib/libsdrplay_api.so \ && cp /blah2/lib/sdrplay-3.0.7/x86_64/libsdrplay_api.so.3.07 /usr/local/lib/libsdrplay_api.so \
@ -17,9 +24,12 @@ RUN chmod +x /blah2/lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run \
&& ldconfig && ldconfig
FROM blah2_env as blah2 FROM blah2_env as blah2
MAINTAINER 30hours <nathan@30hours.dev> LABEL maintainer="30hours <nathan@30hours.dev>"
ADD . . ADD src src
RUN ls -lah /usr/local/include ADD test test
RUN rm -rf build && mkdir -p build && cd build && cmake .. && make ADD CMakeLists.txt CMakePresets.json /blah2/
RUN mkdir -p build && cd build && cmake -S . --preset dev-unix-release \
-DCMAKE_PREFIX_PATH=/blah2/lib/vcpkg_installed/x64-linux/share .. \
&& cd dev-unix-release && make
RUN chmod +x bin/blah2 RUN chmod +x bin/blah2

21
lib/vcpkg.json Normal file
View file

@ -0,0 +1,21 @@
{
"name": "blah2",
"version": "1.0.0",
"dependencies": [
{ "name": "catch2", "version>=": "3.4.0" },
{ "name": "rapidjson", "version>=": "1.1.0" },
{ "name": "asio", "version>=": "1.28.0" },
{ "name": "cpp-httplib", "version>=": "0.12.2" },
{ "name": "armadillo", "version>=": "12.0.1" },
{ "name": "ryml", "version>=": "0.5.0" }
],
"builtin-baseline": "c8696863d371ab7f46e213d8f5ca923c4aef2a00",
"overrides": [
{ "name": "catch2", "version": "3.4.0" },
{ "name": "rapidjson", "version": "1.1.0" },
{ "name": "asio", "version": "1.28.0" },
{ "name": "cpp-httplib", "version": "0.12.2" },
{ "name": "armadillo", "version": "12.0.1" },
{ "name": "ryml", "version": "0.5.0" }
]
}