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
ARG VARIANT="jammy"
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(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

View file

@ -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
}
}
]
}

View file

@ -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 <nathan@30hours.dev>"
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