From a78a1a2f3c0b04727872d14a267075e8c02ce844 Mon Sep 17 00:00:00 2001 From: 30hours Date: Tue, 2 Jan 2024 02:52:58 +0000 Subject: [PATCH] Compiles and removed unnecessary deps in Dockerfile --- .devcontainer/Dockerfile | 2 + .devcontainer/README.md | 1 + CMakeLists.txt | 13 +- CMakePresets.json | 288 +++++++++++++++++++-------------------- Dockerfile | 9 +- 5 files changed, 158 insertions(+), 155 deletions(-) create mode 100644 .devcontainer/README.md diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1538acd..4df7510 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,3 +1,5 @@ +# TODO: update devcontainer with vcpkg manifest + # ubuntu-22.04 by default ARG VARIANT="jammy" FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT} diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..b44ff99 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1 @@ +# todo: write readme on using devcontainer with dev-release \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 144c4fd..412dfbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,21 +2,20 @@ cmake_minimum_required(VERSION 3.8) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) endif(COMMAND cmake_policy) - + project(blah2) include(CMakePrintHelpers) include(CTest) find_package(Threads REQUIRED) find_package(asio CONFIG REQUIRED) -#find_package(rapidjson CONFIG REQUIRED) find_path(RAPIDJSON_INCLUDE_DIRS "rapidjson/allocators.h") find_package(ryml CONFIG 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 +# TODO: when release CI is finished, don't use these dirs, install target should go to prod SET (PROJECT_ROOT "${PROJECT_SOURCE_DIR}") SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_ROOT}/bin") SET (PROJECT_BINARY_TEST_DIR "${PROJECT_ROOT}/bin/test") @@ -24,10 +23,10 @@ SET (PROJECT_BINARY_TEST_DIR "${PROJECT_ROOT}/bin/test") MESSAGE ("Binary path: ${PROJECT_BINARY_DIR}") MESSAGE ("Binary test path: ${PROJECT_BINARY_TEST_DIR}") -# Include from top-level src dir +# include from top-level src dir include_directories(src) -# TODO: Create FindSdrplay.cmake for this +# TODO: create FindSdrplay.cmake for this add_library(sdrplay /usr/local/include/sdrplay_api.h) set_target_properties(sdrplay PROPERTIES LINKER_LANGUAGE C) target_link_libraries(sdrplay PUBLIC /usr/local/lib/libsdrplay_api.so.3.07) @@ -51,10 +50,8 @@ add_executable(blah2 src/data/meta/Timing.cpp ) - target_link_libraries(blah2 PRIVATE Threads::Threads - rapidjson asio::asio ryml::ryml httplib::httplib @@ -63,7 +60,7 @@ target_link_libraries(blah2 PRIVATE fftw3_threads sdrplay ) -#target_include_directories(main PRIVATE ${RAPIDJSON_INCLUDE_DIRS}) +target_include_directories(blah2 PRIVATE RAPIDJSON_INCLUDE_DIRS "rapidjson/allocators.h") # unit tests add_executable(testAmbiguity diff --git a/CMakePresets.json b/CMakePresets.json index b4dabe9..38e2808 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,145 +1,145 @@ { - "version": 3, - "cmakeMinimumRequired": { - "major": 3, - "minor": 21, - "patch": 0 - }, - "configurePresets": [ - { - "name": "cmake-pedantic", - "hidden": true, - "warnings": { - "dev": true, - "deprecated": true, - "unusedCli": true, - "systemVars": false - }, - "errors": { - "dev": true, - "deprecated": true - } - }, - { - "name": "cppcheck", - "hidden": true, - "cacheVariables": { - "CMAKE_CXX_CPPCHECK": "cppcheck;--inline-suppr" - } - }, - { - "name": "clang-tidy", - "hidden": true, - "cacheVariables": { - "CMAKE_CXX_CLANG_TIDY": "clang-tidy", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" - } - }, - { - "name": "ci-std", - "description": "This preset makes sure the project actually builds with at least the specified standard", - "hidden": true, - "cacheVariables": { - "CMAKE_CXX_EXTENSIONS": "OFF", - "CMAKE_CXX_STANDARD": "20", - "CMAKE_CXX_STANDARD_REQUIRED": "ON" - } - }, - { - "name": "ci-vcpkg", - "hidden": true, - "description": "Bootstrap the toolchain with vcpkg installed paths", - "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" - }, - { - "name": "ci-build", - "binaryDir": "${sourceDir}/build/${presetName}", - "inherits": ["cmake-pedantic"], - "hidden": true - }, - { - "name": "ci-unix", - "generator": "Unix Makefiles", - "hidden": true, - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Linux" - }, - "inherits": [ - "ci-std", - "ci-build", - "ci-vcpkg" - ] - }, - { - "name": "ci-release", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } - }, - { - "name": "ci-debug", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - }, - { - "name": "dev-unix-release", - "installDir": "$env{HOME}/.local", - "inherits": [ - "ci-unix", - "ci-release" - ] - }, - { - "name": "dev-unix-debug", - "inherits": [ - "ci-unix", - "ci-debug" - ] - }, - { - "name": "dev-unix-release-sa", - "inherits": [ - "ci-unix", - "ci-release", - "clang-tidy" - ] - } - ], - "buildPresets": [ - { - "name": "dev-unix-debug", - "configurePreset": "dev-unix-debug", - "configuration": "Debug", - "jobs": 4 - }, - { - "name": "dev-unix-release", - "configurePreset": "dev-unix-release", - "configuration": "Release", - "jobs": 4 - }, - { - "name": "dev-unix-release-sa", - "configurePreset": "dev-unix-release-sa", - "configuration": "Release", - "jobs": 4 - } - ], - "testPresets": [ - { - "name": "test-all-unix-release", - "configurePreset": "dev-unix-release", - "output": { - "outputOnFailure": true - }, - "execution": { - "jobs": 1 - } - } - ] -} + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "configurePresets": [ + { + "name": "cmake-pedantic", + "hidden": true, + "warnings": { + "dev": true, + "deprecated": true, + "unusedCli": true, + "systemVars": false + }, + "errors": { + "dev": true, + "deprecated": true + } + }, + { + "name": "cppcheck", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_CPPCHECK": "cppcheck;--inline-suppr" + } + }, + { + "name": "clang-tidy", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_CLANG_TIDY": "clang-tidy", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + }, + { + "name": "ci-std", + "description": "This preset makes sure the project actually builds with at least the specified standard", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_EXTENSIONS": "OFF", + "CMAKE_CXX_STANDARD": "20", + "CMAKE_CXX_STANDARD_REQUIRED": "ON" + } + }, + { + "name": "ci-vcpkg", + "hidden": true, + "description": "Bootstrap the toolchain with vcpkg installed paths", + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + }, + { + "name": "ci-build", + "binaryDir": "${sourceDir}/build/${presetName}", + "inherits": ["cmake-pedantic"], + "hidden": true + }, + { + "name": "ci-unix", + "generator": "Unix Makefiles", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + }, + "inherits": [ + "ci-std", + "ci-build", + "ci-vcpkg" + ] + }, + { + "name": "ci-release", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "ci-debug", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "dev-debug", + "inherits": [ + "ci-unix", + "ci-debug" + ] + }, + { + "name": "dev-release", + "inherits": [ + "ci-unix", + "ci-release", + "clang-tidy" + ] + }, + { + "name": "prod-release", + "installDir": "$env{HOME}/.local", + "inherits": [ + "ci-unix", + "ci-release" + ] + } + ], + "buildPresets": [ + { + "name": "dev-debug", + "configurePreset": "dev-debug", + "configuration": "Debug", + "jobs": 4 + }, + { + "name": "dev-release", + "configurePreset": "dev-release", + "configuration": "Release", + "jobs": 4 + }, + { + "name": "prod-release", + "configurePreset": "prod-release", + "configuration": "Release", + "jobs": 4 + } + ], + "testPresets": [ + { + "name": "test-all-unix-release", + "configurePreset": "prod-release", + "output": { + "outputOnFailure": true + }, + "execution": { + "jobs": 1 + } + } + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6a0418d..27d419e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,10 @@ WORKDIR /blah2 ADD lib lib 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 + libfftw3-dev pkg-config gfortran \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* # install dependencies from vcpkg RUN git clone https://github.com/microsoft/vcpkg /opt/vcpkg \ @@ -29,7 +32,7 @@ LABEL maintainer="30hours " ADD src src ADD test test ADD CMakeLists.txt CMakePresets.json /blah2/ -RUN mkdir -p build && cd build && cmake -S . --preset dev-unix-release \ +RUN mkdir -p build && cd build && cmake -S . --preset prod-release \ -DCMAKE_PREFIX_PATH=/blah2/lib/vcpkg_installed/x64-linux/share .. \ - && cd dev-unix-release && make + && cd prod-release && make RUN chmod +x bin/blah2