Compiles and removed unnecessary deps in Dockerfile

This commit is contained in:
30hours 2024-01-02 02:52:58 +00:00
parent 896844edae
commit a78a1a2f3c
5 changed files with 158 additions and 155 deletions

View file

@ -1,3 +1,5 @@
# TODO: update devcontainer with vcpkg manifest
# ubuntu-22.04 by default # ubuntu-22.04 by default
ARG VARIANT="jammy" ARG VARIANT="jammy"
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT} FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}

1
.devcontainer/README.md Normal file
View file

@ -0,0 +1 @@
# todo: write readme on using devcontainer with dev-release

View file

@ -9,14 +9,13 @@ include(CTest)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(asio CONFIG REQUIRED) find_package(asio CONFIG REQUIRED)
#find_package(rapidjson CONFIG REQUIRED)
find_path(RAPIDJSON_INCLUDE_DIRS "rapidjson/allocators.h") find_path(RAPIDJSON_INCLUDE_DIRS "rapidjson/allocators.h")
find_package(ryml CONFIG REQUIRED) find_package(ryml CONFIG REQUIRED)
find_package(httplib CONFIG REQUIRED) find_package(httplib CONFIG REQUIRED)
find_package(Armadillo CONFIG 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
SET (PROJECT_ROOT "${PROJECT_SOURCE_DIR}") SET (PROJECT_ROOT "${PROJECT_SOURCE_DIR}")
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_ROOT}/bin") SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_ROOT}/bin")
SET (PROJECT_BINARY_TEST_DIR "${PROJECT_ROOT}/bin/test") 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 path: ${PROJECT_BINARY_DIR}")
MESSAGE ("Binary test path: ${PROJECT_BINARY_TEST_DIR}") MESSAGE ("Binary test path: ${PROJECT_BINARY_TEST_DIR}")
# Include from top-level src dir # include from top-level src dir
include_directories(src) include_directories(src)
# TODO: Create FindSdrplay.cmake for this # TODO: create FindSdrplay.cmake for this
add_library(sdrplay /usr/local/include/sdrplay_api.h) add_library(sdrplay /usr/local/include/sdrplay_api.h)
set_target_properties(sdrplay PROPERTIES LINKER_LANGUAGE C) set_target_properties(sdrplay PROPERTIES LINKER_LANGUAGE C)
target_link_libraries(sdrplay PUBLIC /usr/local/lib/libsdrplay_api.so.3.07) 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 src/data/meta/Timing.cpp
) )
target_link_libraries(blah2 PRIVATE target_link_libraries(blah2 PRIVATE
Threads::Threads Threads::Threads
rapidjson
asio::asio asio::asio
ryml::ryml ryml::ryml
httplib::httplib httplib::httplib
@ -63,7 +60,7 @@ target_link_libraries(blah2 PRIVATE
fftw3_threads fftw3_threads
sdrplay sdrplay
) )
#target_include_directories(main PRIVATE ${RAPIDJSON_INCLUDE_DIRS}) target_include_directories(blah2 PRIVATE RAPIDJSON_INCLUDE_DIRS "rapidjson/allocators.h")
# unit tests # unit tests
add_executable(testAmbiguity add_executable(testAmbiguity

View file

@ -1,145 +1,145 @@
{ {
"version": 3, "version": 3,
"cmakeMinimumRequired": { "cmakeMinimumRequired": {
"major": 3, "major": 3,
"minor": 21, "minor": 21,
"patch": 0 "patch": 0
}, },
"configurePresets": [ "configurePresets": [
{ {
"name": "cmake-pedantic", "name": "cmake-pedantic",
"hidden": true, "hidden": true,
"warnings": { "warnings": {
"dev": true, "dev": true,
"deprecated": true, "deprecated": true,
"unusedCli": true, "unusedCli": true,
"systemVars": false "systemVars": false
}, },
"errors": { "errors": {
"dev": true, "dev": true,
"deprecated": true "deprecated": true
} }
}, },
{ {
"name": "cppcheck", "name": "cppcheck",
"hidden": true, "hidden": true,
"cacheVariables": { "cacheVariables": {
"CMAKE_CXX_CPPCHECK": "cppcheck;--inline-suppr" "CMAKE_CXX_CPPCHECK": "cppcheck;--inline-suppr"
} }
}, },
{ {
"name": "clang-tidy", "name": "clang-tidy",
"hidden": true, "hidden": true,
"cacheVariables": { "cacheVariables": {
"CMAKE_CXX_CLANG_TIDY": "clang-tidy", "CMAKE_CXX_CLANG_TIDY": "clang-tidy",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON" "CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
} }
}, },
{ {
"name": "ci-std", "name": "ci-std",
"description": "This preset makes sure the project actually builds with at least the specified standard", "description": "This preset makes sure the project actually builds with at least the specified standard",
"hidden": true, "hidden": true,
"cacheVariables": { "cacheVariables": {
"CMAKE_CXX_EXTENSIONS": "OFF", "CMAKE_CXX_EXTENSIONS": "OFF",
"CMAKE_CXX_STANDARD": "20", "CMAKE_CXX_STANDARD": "20",
"CMAKE_CXX_STANDARD_REQUIRED": "ON" "CMAKE_CXX_STANDARD_REQUIRED": "ON"
} }
}, },
{ {
"name": "ci-vcpkg", "name": "ci-vcpkg",
"hidden": true, "hidden": true,
"description": "Bootstrap the toolchain with vcpkg installed paths", "description": "Bootstrap the toolchain with vcpkg installed paths",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}, },
{ {
"name": "ci-build", "name": "ci-build",
"binaryDir": "${sourceDir}/build/${presetName}", "binaryDir": "${sourceDir}/build/${presetName}",
"inherits": ["cmake-pedantic"], "inherits": ["cmake-pedantic"],
"hidden": true "hidden": true
}, },
{ {
"name": "ci-unix", "name": "ci-unix",
"generator": "Unix Makefiles", "generator": "Unix Makefiles",
"hidden": true, "hidden": true,
"condition": { "condition": {
"type": "equals", "type": "equals",
"lhs": "${hostSystemName}", "lhs": "${hostSystemName}",
"rhs": "Linux" "rhs": "Linux"
}, },
"inherits": [ "inherits": [
"ci-std", "ci-std",
"ci-build", "ci-build",
"ci-vcpkg" "ci-vcpkg"
] ]
}, },
{ {
"name": "ci-release", "name": "ci-release",
"hidden": true, "hidden": true,
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Release" "CMAKE_BUILD_TYPE": "Release"
} }
}, },
{ {
"name": "ci-debug", "name": "ci-debug",
"hidden": true, "hidden": true,
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug" "CMAKE_BUILD_TYPE": "Debug"
} }
}, },
{ {
"name": "dev-unix-release", "name": "dev-debug",
"installDir": "$env{HOME}/.local", "inherits": [
"inherits": [ "ci-unix",
"ci-unix", "ci-debug"
"ci-release" ]
] },
}, {
{ "name": "dev-release",
"name": "dev-unix-debug", "inherits": [
"inherits": [ "ci-unix",
"ci-unix", "ci-release",
"ci-debug" "clang-tidy"
] ]
}, },
{ {
"name": "dev-unix-release-sa", "name": "prod-release",
"inherits": [ "installDir": "$env{HOME}/.local",
"ci-unix", "inherits": [
"ci-release", "ci-unix",
"clang-tidy" "ci-release"
] ]
} }
], ],
"buildPresets": [ "buildPresets": [
{ {
"name": "dev-unix-debug", "name": "dev-debug",
"configurePreset": "dev-unix-debug", "configurePreset": "dev-debug",
"configuration": "Debug", "configuration": "Debug",
"jobs": 4 "jobs": 4
}, },
{ {
"name": "dev-unix-release", "name": "dev-release",
"configurePreset": "dev-unix-release", "configurePreset": "dev-release",
"configuration": "Release", "configuration": "Release",
"jobs": 4 "jobs": 4
}, },
{ {
"name": "dev-unix-release-sa", "name": "prod-release",
"configurePreset": "dev-unix-release-sa", "configurePreset": "prod-release",
"configuration": "Release", "configuration": "Release",
"jobs": 4 "jobs": 4
} }
], ],
"testPresets": [ "testPresets": [
{ {
"name": "test-all-unix-release", "name": "test-all-unix-release",
"configurePreset": "dev-unix-release", "configurePreset": "prod-release",
"output": { "output": {
"outputOnFailure": true "outputOnFailure": true
}, },
"execution": { "execution": {
"jobs": 1 "jobs": 1
} }
} }
] ]
} }

View file

@ -5,7 +5,10 @@ WORKDIR /blah2
ADD lib lib ADD lib lib
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y g++ make cmake git curl zip unzip doxygen graphviz \ && 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 # install dependencies from vcpkg
RUN git clone https://github.com/microsoft/vcpkg /opt/vcpkg \ RUN git clone https://github.com/microsoft/vcpkg /opt/vcpkg \
@ -29,7 +32,7 @@ LABEL maintainer="30hours <nathan@30hours.dev>"
ADD src src ADD src src
ADD test test ADD test test
ADD CMakeLists.txt CMakePresets.json /blah2/ 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 .. \ -DCMAKE_PREFIX_PATH=/blah2/lib/vcpkg_installed/x64-linux/share .. \
&& cd dev-unix-release && make && cd prod-release && make
RUN chmod +x bin/blah2 RUN chmod +x bin/blah2