From 896844edae1f60b3300ae257e8679f08c85952b7 Mon Sep 17 00:00:00 2001 From: 30hours Date: Mon, 1 Jan 2024 16:58:20 +0000 Subject: [PATCH] Starting to compile with CMake but can't find rapidjson lib --- CMakeLists.txt | 9 ++++++--- Dockerfile | 30 ++++++++++++++++++++---------- lib/vcpkg.json | 21 +++++++++++++++++++++ 3 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 lib/vcpkg.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 1521ca6..144c4fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,10 +9,11 @@ include(CTest) find_package(Threads 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(httplib REQUIRED) -find_package(Armadillo REQUIRED) +find_package(httplib CONFIG REQUIRED) +find_package(Armadillo CONFIG REQUIRED) find_package(Catch2 CONFIG REQUIRED) # 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 ) + target_link_libraries(blah2 PRIVATE Threads::Threads rapidjson @@ -61,6 +63,7 @@ target_link_libraries(blah2 PRIVATE fftw3_threads sdrplay ) +#target_include_directories(main PRIVATE ${RAPIDJSON_INCLUDE_DIRS}) # unit tests add_executable(testAmbiguity diff --git a/Dockerfile b/Dockerfile index 4631ef5..6a0418d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,20 @@ FROM ubuntu:22.04 as blah2_env -MAINTAINER 30hours +LABEL maintainer="30hours " -WORKDIR blah2 +WORKDIR /blah2 ADD lib lib -RUN ls -lah && pwd -RUN apt-get update -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 -RUN cd lib && tar xf armadillo-12.0.1.tar.xz && cd armadillo-12.0.1 && cmake . && make install +RUN apt-get update \ + && apt-get install -y g++ make cmake git curl zip unzip doxygen graphviz \ + libfftw3-dev liblapack-dev xz-utils libusb-1.0.0-dev pkg-config gfortran +# 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 \ && /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 \ @@ -17,9 +24,12 @@ RUN chmod +x /blah2/lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run \ && ldconfig FROM blah2_env as blah2 -MAINTAINER 30hours +LABEL maintainer="30hours " -ADD . . -RUN ls -lah /usr/local/include -RUN rm -rf build && mkdir -p build && cd build && cmake .. && make +ADD src src +ADD test test +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 diff --git a/lib/vcpkg.json b/lib/vcpkg.json new file mode 100644 index 0000000..3b1b31c --- /dev/null +++ b/lib/vcpkg.json @@ -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" } + ] +} \ No newline at end of file