Compare commits

..

No commits in common. "master" and "feature/fontrender" have entirely different histories.

24 changed files with 142 additions and 317 deletions

22
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM alpine:3.21.3
# Install tools required for building.
RUN apk update && \
apk add --no-cache \
autoconf \
bash \
boost-build \
build-base \
cmake \
gdb \
git \
libstdc++ \
libtool \
linux-headers \
ninja \
m4 \
perl \
python3 \
py3-pip && \
pip install --break-system-packages conan && \
conan profile detect

View File

@ -1,26 +1,19 @@
{ {
"name": "4beumer.nl C++", "name": "C++",
"build": { "build": {
"dockerfile": "../devcontainer.Dockerfile", "dockerfile": "Dockerfile"
}, },
"postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/postcreate.py --environment=${containerWorkspaceFolder}/dev-environment.json",
// Configure tool-specific properties. // Configure tool-specific properties.
"customizations": { "customizations": {
"vscode": { "vscode": {
"settings": { "settings": {},
"conan-extension.installArgs": [
"-of build",
"-s build_type=Debug",
"-s compiler.cppstd=23"
],
},
"extensions": [ "extensions": [
"ms-vscode.cpptools", "ms-vscode.cpptools",
"ms-python.python",
"twxs.cmake", "twxs.cmake",
"ms-vscode.cmake-tools", "ms-vscode.cmake-tools",
"konicy.conan-extension" "konicy.conan-extension"
] ]
} }
} }
} }

View File

@ -1,36 +0,0 @@
#! /usr/bin/python
import argparse
import json
import os
import subprocess
import sys
def runcmd(command):
print('RUN ' + command)
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
for line in iter(process.stdout.readline, b''): # b'' indicates EOF
print(line.decode('utf-8'), end='')
def load_environment(filename):
with open(filename) as f:
return json.load(f)
parser = argparse.ArgumentParser()
parser.add_argument('--environment')
args = parser.parse_args()
environment = load_environment(args.environment)
env_build_type = environment["build_type"]
env_cppstd = environment["cppstd"]
env_conan_remote_fallback = environment["conan_remote_fallback"]
env_conan_remote_upload = environment["conan_remote_upload"]
runcmd('conan remote remove conancenter')
runcmd('conan remote add conan-upload ' + env_conan_remote_upload)
runcmd('conan remote add conan-remote ' + env_conan_remote_fallback)
runcmd('conan install . -of build -s compiler.cppstd=' + env_cppstd + ' -s build_type=' + env_build_type + ' --build=never')
sys.exit(0)

View File

@ -1,32 +0,0 @@
# Network experiment
This repository mostly contains personal experiments related to C++, CMake, conan, and some stuff that might end up on a raspberry pi. I have tried to rely mostly on development containers and almost no tools on the host. This should make it possible to build/develop/use this code on any machine that runs dev container, including ARM systems and Windows.
## How to use:
### Start developing
1. Clone the repository to a location of your liking.
2. Have an IDE that supports dev containers. I have used Visual studio code.
3. Open the project in your IDE, it should offer to open the project in a dev container.
Also take into consideration the following files:
1. ``dev-environment.json``
This file contains information about the type of build, the C++ version to use, and conan remotes used to retrieve packages.
2. ``.devcontainer/devcontainer.json``
Also contains configuration on plugins used (and some duplicated config on build type and C++ version).
### Building conan dependencies
Available in this repository is a ``dev-pre-conan-pkgs.Dockerfile`` that can be used to build all the conan dependencies and upload them to a remote.
1. Use dev-environment.json to configure the remotes (Where retrieve info, where to upload binaries).
2. Build the docker image using the following command:
``docker build -t tmp_bldconan -f dev-prep-conan-pkgs.Dockerfile .``
3. Run using the image to build & upload packages:
``docker run -ti tmp_bldconan``
- While running a username and password will be required to login.
- Do not forget to remove the image if you do not need it anymore.
Building conan packages for other architectures is also possible using "buildx". See external documentation on how to setup this feature. When setup, the following commands can be used to build for 32 bit ARM (useful for raspberry pi).
- ``docker buildx build -t tmp_bldconan_arm32 -f dev-prep-conan-pkgs.Dockerfile . --load --platform=linux/arm``
- ``docker run -ti --platform linux/arm tmp_bldconan_arm32``

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
find_package(Boost 1.90.0 REQUIRED COMPONENTS program_options headers CONFIG) find_package(Boost 1.84.0 REQUIRED COMPONENTS program_options headers CONFIG)
find_package(JPEG REQUIRED) find_package(JPEG REQUIRED)
project(text2image) project(text2image)
@ -11,7 +11,7 @@ add_executable(
set_property( set_property(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
PROPERTY CXX_STANDARD 23 PROPERTY CXX_STANDARD 20
) )
target_link_libraries( target_link_libraries(

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
find_package(freetype REQUIRED) find_package(freetype REQUIRED)
find_package(Boost 1.90.0 REQUIRED COMPONENTS headers CONFIG) find_package(Boost 1.84.0 REQUIRED COMPONENTS headers CONFIG)
project(bmrshared-freetype) project(bmrshared-freetype)
@ -14,7 +14,7 @@ add_library(
set_property( set_property(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
PROPERTY CXX_STANDARD 23 PROPERTY CXX_STANDARD 20
) )
target_include_directories( target_include_directories(

View File

@ -7,44 +7,51 @@
// //
#pragma once #pragma once
#include <memory>
#include <functional>
#include <string>
#include <boost/gil/image.hpp> #include <boost/gil/image.hpp>
#include <ft2build.h> #include <ft2build.h>
#include <functional>
#include <memory>
#include <string>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include FT_BITMAP_H #include FT_BITMAP_H
namespace bmrshared namespace bmrshared
{ {
class freetype_lib; class freetype_lib;
class freetype_face final : public std::enable_shared_from_this<freetype_face> class freetype_face final : public std::enable_shared_from_this<freetype_face>
{ {
using character_index = FT_ULong; using character_index = FT_ULong;
using pixel_size = FT_UInt; using pixel_size = FT_UInt;
public: public:
freetype_face(std::shared_ptr<freetype_lib> lib, freetype_face(std::shared_ptr<freetype_lib> lib,
const std::string& font_path, const std::string& font_path,
pixel_size pixel_width, pixel_size pixel_width,
pixel_size pixel_height, pixel_size pixel_height,
bool render_monochrome); bool render_monochrome
);
~freetype_face(); ~freetype_face();
FT_BBox get_boundbox() const; FT_BBox get_boundbox() const;
FT_Glyph_Metrics get_dimensions(character_index character_index) const; FT_Glyph_Metrics get_dimensions(character_index character_index) const;
void render(character_index character_index, std::function<void(int x, int y, const uint8_t level)> painter); void render(
character_index character_index,
private: std::function<void(int x,
FT_Int32 get_load_flags() const; int y,
FT_Render_Mode get_render_mode() const; const uint8_t level
)> painter);
private:
std::shared_ptr<freetype_lib> m_lib; private:
FT_Face m_face; FT_Int32 get_load_flags() const;
bool m_renderMonochrome; FT_Render_Mode get_render_mode() const;
};
} // namespace bmrshared private:
std::shared_ptr<freetype_lib> m_lib;
FT_Face m_face;
bool m_renderMonochrome;
};
}

View File

@ -6,21 +6,21 @@
// the Free Software Foundation. // the Free Software Foundation.
// //
#pragma once #pragma once
#include <ft2build.h>
#include <memory> #include <memory>
#include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
namespace bmrshared namespace bmrshared
{ {
class freetype_lib final : public std::enable_shared_from_this<freetype_lib> class freetype_lib final : public std::enable_shared_from_this<freetype_lib>
{ {
public: public:
freetype_lib(); freetype_lib();
~freetype_lib(); ~freetype_lib();
FT_Library get_ft_library(); FT_Library get_ft_library();
private: private:
FT_Library m_library; FT_Library m_library;
}; };
} // namespace bmrshared }

View File

@ -11,15 +11,13 @@
namespace bmrshared namespace bmrshared
{ {
struct dimensions final struct dimensions final
{ {
FT_Pos width; FT_Pos width;
FT_Pos height; FT_Pos height;
FT_Pos vertOriginOffsetY; FT_Pos vertOriginOffsetY;
}; };
dimensions freetype_calculate_dimensions(freetype_face& face, std::string_view text); dimensions freetype_calculate_dimensions(freetype_face& face, std::string_view text);
void freetype_paint(freetype_face& face, void freetype_paint(freetype_face& face, std::string_view text, const std::function<void(int x, int y, uint8_t level)>& paintfn);
std::string_view text, }
const std::function<void(int x, int y, uint8_t level)>& paintfn);
} // namespace bmrshared

View File

@ -5,23 +5,31 @@
// under the terms of the GNU Lesser General Public License v3.0 as published by // under the terms of the GNU Lesser General Public License v3.0 as published by
// the Free Software Foundation. // the Free Software Foundation.
// //
#include <algorithm>
#include <bmrshared/freetype_face.hpp> #include <bmrshared/freetype_face.hpp>
#include <bmrshared/freetype_lib.hpp> #include <bmrshared/freetype_lib.hpp>
#include <algorithm>
using namespace bmrshared; using namespace bmrshared;
freetype_face::freetype_face(std::shared_ptr<freetype_lib> lib, freetype_face::freetype_face(
const std::string& font_path, std::shared_ptr<freetype_lib> lib,
pixel_size pixel_width, const std::string& font_path,
pixel_size pixel_height, pixel_size pixel_width,
bool render_monochrome) pixel_size pixel_height,
bool render_monochrome)
: m_lib(lib) : m_lib(lib)
, m_renderMonochrome(render_monochrome) , m_renderMonochrome(render_monochrome)
{ {
FT_New_Face(m_lib->get_ft_library(), font_path.c_str(), 0, &m_face); FT_New_Face(
m_lib->get_ft_library(),
font_path.c_str(),
0,
&m_face);
FT_Set_Pixel_Sizes(m_face, pixel_width, pixel_height); FT_Set_Pixel_Sizes(
m_face,
pixel_width,
pixel_height);
} }
freetype_face::~freetype_face() freetype_face::~freetype_face()
@ -34,18 +42,24 @@ FT_BBox freetype_face::get_boundbox() const
return m_face->bbox; return m_face->bbox;
} }
FT_Glyph_Metrics freetype_face::get_dimensions(character_index character_index) const FT_Glyph_Metrics freetype_face::get_dimensions(
character_index character_index) const
{ {
// Load glyph and retrieve metrics. // Load glyph and retrieve metrics.
const auto glyph_index = FT_Get_Char_Index(m_face, character_index); const auto glyph_index = FT_Get_Char_Index(m_face, character_index);
FT_Load_Glyph(m_face, glyph_index, get_load_flags()); FT_Load_Glyph(m_face, glyph_index, get_load_flags());
FT_GlyphSlot& glyphSlot = m_face->glyph; FT_GlyphSlot& glyphSlot = m_face->glyph;
return glyphSlot->metrics; return glyphSlot->metrics;
} }
void freetype_face::render(FT_ULong character_index, std::function<void(int x, int y, uint8_t level)> painter) void freetype_face::render(
FT_ULong character_index,
std::function<void(int x,
int y,
uint8_t level
)> painter)
{ {
// Load glyph and retrieve metrics. // Load glyph and retrieve metrics.
const auto glyph_index = FT_Get_Char_Index(m_face, character_index); const auto glyph_index = FT_Get_Char_Index(m_face, character_index);
@ -60,12 +74,12 @@ void freetype_face::render(FT_ULong character_index, std::function<void(int x, i
FT_Bitmap_Init(&target); FT_Bitmap_Init(&target);
FT_Bitmap_Convert(m_lib->get_ft_library(), &bitmap, &target, 1); FT_Bitmap_Convert(m_lib->get_ft_library(), &bitmap, &target, 1);
for (unsigned int x = 0; x < target.width; ++x) for(unsigned int x = 0; x < target.width; ++x)
{ {
for (unsigned int y = 0; y < target.rows; ++y) for(unsigned int y = 0; y < target.rows; ++y)
{ {
const uint8_t& value = 0xff * target.buffer[x + target.width * y]; const uint8_t& value = 0xff * target.buffer[x + target.width * y];
painter(x, y, value); painter(x,y,value);
} }
} }

View File

@ -5,8 +5,8 @@
// under the terms of the GNU Lesser General Public License v3.0 as published by // under the terms of the GNU Lesser General Public License v3.0 as published by
// the Free Software Foundation. // the Free Software Foundation.
// //
#include <algorithm>
#include <bmrshared/freetype_utils.hpp> #include <bmrshared/freetype_utils.hpp>
#include <algorithm>
#include <functional> #include <functional>
namespace bmrshared namespace bmrshared
@ -21,7 +21,7 @@ dimensions freetype_calculate_dimensions(freetype_face& face, std::string_view t
for (const char& c : text) for (const char& c : text)
{ {
const FT_Glyph_Metrics& dim = face.get_dimensions(c); const FT_Glyph_Metrics& dim = face.get_dimensions(c);
line_width += dim.horiAdvance; line_width += dim.horiAdvance;
const auto char_above_origin = dim.horiBearingY; const auto char_above_origin = dim.horiBearingY;
const auto char_below_origin = dim.height - dim.horiBearingY; const auto char_below_origin = dim.height - dim.horiBearingY;
@ -29,14 +29,10 @@ dimensions freetype_calculate_dimensions(freetype_face& face, std::string_view t
line_above_origin = std::max(line_above_origin, char_above_origin); line_above_origin = std::max(line_above_origin, char_above_origin);
line_below_origin = std::max(line_below_origin, char_below_origin); line_below_origin = std::max(line_below_origin, char_below_origin);
} }
return {.width = line_width, return {.width = line_width, .height = (line_above_origin + line_below_origin), .vertOriginOffsetY = line_above_origin};
.height = (line_above_origin + line_below_origin),
.vertOriginOffsetY = line_above_origin};
} }
void freetype_paint(freetype_face& face, void freetype_paint(freetype_face& face, std::string_view text, const std::function<void(int x, int y, uint8_t level)>& paintfn)
std::string_view text,
const std::function<void(int x, int y, uint8_t level)>& paintfn)
{ {
FT_Pos line_x = 0; FT_Pos line_x = 0;
FT_Pos char_offset_x = 0; FT_Pos char_offset_x = 0;
@ -46,15 +42,15 @@ void freetype_paint(freetype_face& face,
paintfn((char_offset_x + x), (y - char_offset_y), level); paintfn((char_offset_x + x), (y - char_offset_y), level);
}; };
for (const char& c : text) for( const char& c : text)
{ {
const FT_Glyph_Metrics& dim = face.get_dimensions(c); const FT_Glyph_Metrics& dim = face.get_dimensions(c);
char_offset_x = (line_x + (dim.horiAdvance - dim.width) / 2) / 64; char_offset_x = (line_x + (dim.horiAdvance - dim.width)/2)/64;
char_offset_y = dim.horiBearingY / 64; char_offset_y = dim.horiBearingY/64;
face.render(c, painter_char); face.render(c, painter_char);
line_x += dim.horiAdvance; line_x += dim.horiAdvance;
} }
} }
} // namespace bmrshared }

View File

@ -11,7 +11,7 @@ add_library(
set_property( set_property(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
PROPERTY CXX_STANDARD 23 PROPERTY CXX_STANDARD 20
) )
target_include_directories( target_include_directories(
@ -26,6 +26,6 @@ target_link_libraries(
) )
install( install(
FILES ${BLDENV_LIBMAGIC_PACKAGE_FOLDER}/res/magic.mgc FILES ${CONAN_LIBMAGIC_PACKAGE_FOLDER}/res/magic.mgc
DESTINATION bin DESTINATION bin
) )

View File

@ -13,7 +13,7 @@ add_executable(
set_property( set_property(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
PROPERTY CXX_STANDARD 23 PROPERTY CXX_STANDARD 20
) )
target_link_libraries( target_link_libraries(

View File

@ -10,7 +10,7 @@
namespace namespace
{ {
constexpr std::string_view magic_file_location = "/usr/local/bin/magic.mgc"; constexpr std::string_view magic_file_location = "/usr/local/bin/magic.mgc";
} }
TEST(test_magic, no_throw_on_query) TEST(test_magic, no_throw_on_query)

View File

@ -29,7 +29,7 @@ struct function_wrapper<T, TExtraArguments...>
using wrapper_type = std::function<flexible_value(const T&, const IDataSource&, TExtraArguments...)>; using wrapper_type = std::function<flexible_value(const T&, const IDataSource&, TExtraArguments...)>;
template<typename M, typename... TSourceParams> template<typename M, typename... TSourceParams>
static wrapper_type Wrap(M T::* callableFn, TSourceParams... paramNames) static wrapper_type Wrap(M T::*callableFn, TSourceParams... paramNames)
{ {
std::array<std::string, sizeof...(TSourceParams)> names{paramNames...}; std::array<std::string, sizeof...(TSourceParams)> names{paramNames...};
return [callableFn, names](const T& obj, const IDataSource& source, TExtraArguments... args) return [callableFn, names](const T& obj, const IDataSource& source, TExtraArguments... args)
@ -47,7 +47,7 @@ struct function_wrapper<T, TExtraArguments...>
using wrapper_type = std::function<flexible_value(T&, const IDataSource&, TExtraArguments...)>; using wrapper_type = std::function<flexible_value(T&, const IDataSource&, TExtraArguments...)>;
template<typename M, typename... TSourceParams> template<typename M, typename... TSourceParams>
static wrapper_type Wrap(M T::* callableFn, TSourceParams... paramNames) static wrapper_type Wrap(M T::*callableFn, TSourceParams... paramNames)
{ {
std::array<std::string, sizeof...(TSourceParams)> names{paramNames...}; std::array<std::string, sizeof...(TSourceParams)> names{paramNames...};
return [callableFn, names](T& obj, const IDataSource& source, TExtraArguments... args) return [callableFn, names](T& obj, const IDataSource& source, TExtraArguments... args)

View File

@ -29,9 +29,9 @@ namespace detail
}; };
template<typename FirstTupleType, typename... TupleTypes, std::size_t NTypesToKeep, typename... TypesToKeep> template<typename FirstTupleType, typename... TupleTypes, std::size_t NTypesToKeep, typename... TypesToKeep>
requires(NTypesToKeep > 0) requires(NTypesToKeep > 0)
struct tuple_keepelemsfront<std::tuple<FirstTupleType, TupleTypes...>, NTypesToKeep, TypesToKeep...> struct tuple_keepelemsfront<std::tuple<FirstTupleType, TupleTypes...>, NTypesToKeep, TypesToKeep...>
{ {
using tuple = typename tuple_keepelemsfront<std::tuple<TupleTypes...>, using tuple = typename tuple_keepelemsfront<std::tuple<TupleTypes...>,
(NTypesToKeep - 1), (NTypesToKeep - 1),
@ -52,10 +52,10 @@ namespace detail
} // namespace detail } // namespace detail
template<typename M, typename T, std::size_t TParameterCount, typename... TExtraArguments> template<typename M, typename T, std::size_t TParameterCount, typename... TExtraArguments>
requires(function_info<M T::*>::is_const_member == false) requires(function_info<M T::*>::is_const_member == false)
flexible_value invoke(T& callableObj, flexible_value invoke(T& callableObj,
M T::* callableFn, M T::*callableFn,
std::array<std::string, TParameterCount> names, std::array<std::string, TParameterCount> names,
const IDataSource& source, const IDataSource& source,
TExtraArguments&&... arguments) TExtraArguments&&... arguments)
@ -72,10 +72,10 @@ flexible_value invoke(T& callableObj,
} }
template<typename M, typename T, std::size_t TParameterCount, typename... TExtraArguments> template<typename M, typename T, std::size_t TParameterCount, typename... TExtraArguments>
requires(function_info<M T::*>::is_const_member == true) requires(function_info<M T::*>::is_const_member == true)
flexible_value invoke(const T& callableObj, flexible_value invoke(const T& callableObj,
M T::* callableFn, M T::*callableFn,
std::array<std::string, TParameterCount> names, std::array<std::string, TParameterCount> names,
const IDataSource& source, const IDataSource& source,
TExtraArguments&&... arguments) TExtraArguments&&... arguments)

View File

@ -11,7 +11,7 @@ add_library(
set_property( set_property(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
PROPERTY CXX_STANDARD 23 PROPERTY CXX_STANDARD 20
) )
target_include_directories( target_include_directories(

View File

@ -15,7 +15,7 @@ add_executable(
set_property( set_property(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
PROPERTY CXX_STANDARD 23 PROPERTY CXX_STANDARD 20
) )
target_link_libraries( target_link_libraries(

View File

@ -3,30 +3,18 @@ from conan import ConanFile
from conan.tools.files import copy from conan.tools.files import copy
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
class BmrConan(ConanFile): class HelloConan(ConanFile):
settings = "os", "compiler", "build_type", "arch" settings = "os", "compiler", "build_type", "arch"
requires = "boost/1.84.0", "gtest/1.14.0", "libmagic/5.45", "freetype/2.13.3", "libjpeg/9f"
generators = "CMakeDeps" generators = "CMakeDeps"
build_policy = "never" build_policy = "*"
def configure(self):
self.options["boost"].without_cobalt = True
if self.settings.arch == "armv7":
self.options["libpng"].neon = False
def requirements(self):
self.requires("boost/1.90.0")
self.requires("gtest/1.16.0")
self.requires("libmagic/5.45")
self.requires("freetype/2.14.1")
self.requires("libjpeg/9f")
self.requires("libpng/1.6.54")
def generate(self): def generate(self):
# We need to find the folder of libmagic and supply it to cmake so that # We need to find the folder of libmagic and supply it to cmake so that
# we can deploy the magic file. # we can deploy the magic file.
libmagic = self.dependencies["libmagic"] libmagic = self.dependencies["libmagic"]
tc = CMakeToolchain(self) tc = CMakeToolchain(self)
tc.variables["BLDENV_LIBMAGIC_PACKAGE_FOLDER"] = libmagic.package_folder tc.variables["CONAN_LIBMAGIC_PACKAGE_FOLDER"] = libmagic.package_folder
tc.generate() tc.generate()

View File

@ -1,6 +0,0 @@
{
"build_type": "Debug",
"cppstd" : "23",
"conan_remote_fallback" : "https://artifacts.4beumer.nl/repository/conan-center-proxy/",
"conan_remote_upload" : "https://artifacts.4beumer.nl/repository/conan-bmrdev/"
}

View File

@ -1,43 +0,0 @@
FROM alpine:3.22.2
# Install packages needed in both building and running.
RUN apk update && \
apk add --no-cache \
libstdc++
# Install tools required for building.
RUN mkdir -p /root/.local/bin
ENV PATH="${PATH}:/root/.local/bin"
RUN apk add --no-cache \
autoconf \
bash \
binutils \
build-base \
cmake \
clang \
clang-extra-tools \
gdb \
git \
libtool \
linux-headers \
ninja \
m4 \
perl \
python3 \
pipx
RUN pipx ensurepath \
&& pipx install conan \
&& conan profile detect
RUN mkdir -p /tmpdev
WORKDIR /tmpdev
ADD conanfile.py .
ADD dev-environment.json .
ADD --chmod=544 ./scripts/dev-prep-conan-pkgs/dev-prep-conan-pkgs.py .
ADD --chmod=544 ./scripts/dev-prep-conan-pkgs/entrypoint.sh .
ENTRYPOINT ["./entrypoint.sh"]

View File

@ -1,32 +0,0 @@
FROM alpine:3.22.2
# Install packages needed in both building and running.
RUN apk update && \
apk add --no-cache \
libstdc++
# Install tools required for building.
RUN mkdir -p /root/.local/bin
ENV PATH="${PATH}:/root/.local/bin"
RUN apk add --no-cache \
autoconf \
bash \
binutils \
build-base \
cmake \
clang \
clang-extra-tools \
gdb \
git \
libtool \
linux-headers \
ninja \
m4 \
perl \
python3 \
pipx
RUN pipx ensurepath \
&& pipx install conan \
&& conan profile detect

View File

@ -1,39 +0,0 @@
#! /usr/bin/python
import argparse
import json
import os
import subprocess
import sys
def runcmd(command):
print('RUN ' + command)
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
for line in iter(process.stdout.readline, b''): # b'' indicates EOF
print(line.decode('utf-8'), end='')
def load_environment(filename):
with open(filename) as f:
return json.load(f)
parser = argparse.ArgumentParser()
parser.add_argument('--environment')
args = parser.parse_args()
environment = load_environment(args.environment)
env_build_type = environment["build_type"]
env_cppstd = environment["cppstd"]
env_conan_remote_fallback = environment["conan_remote_fallback"]
env_conan_remote_upload = environment["conan_remote_upload"]
with open('CMakeLists.txt', 'w') as fp:
pass
runcmd('conan remote remove conancenter')
runcmd('conan remote add conan-upload ' + env_conan_remote_upload)
runcmd('conan remote add conan-remote ' + env_conan_remote_fallback)
runcmd('conan install . -of build -s compiler.cppstd=' + env_cppstd + ' -s build_type=' + env_build_type + ' --build=*')
sys.exit(0)

View File

@ -1,5 +0,0 @@
#!/bin/bash
./dev-prep-conan-pkgs.py --environment=dev-environment.json
conan upload -r conan-upload "*/*" --check -c