WIP C++23

This commit is contained in:
Bart Beumer 2025-12-09 23:05:44 +01:00
parent 3f22f888d6
commit ab58369caf
12 changed files with 27 additions and 20 deletions

View File

@ -3,10 +3,11 @@
"build": { "build": {
"dockerfile": "../devcontainer.Dockerfile", "dockerfile": "../devcontainer.Dockerfile",
"args": { "args": {
"BUILD_TYPE": "Debug" "BUILD_TYPE": "Debug",
"COMPILER_CPPSTD": "23"
} }
}, },
"postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/postcreate.py --build_type=Debug", "postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/postcreate.py --build_type=Debug --cppstd=23",
// Configure tool-specific properties. // Configure tool-specific properties.
"customizations": { "customizations": {
"vscode": { "vscode": {
@ -14,6 +15,7 @@
"conan-extension.installArgs": [ "conan-extension.installArgs": [
"-of build", "-of build",
"-s build_type=Debug" "-s build_type=Debug"
"-s compiler.cppstd=23"
], ],
}, },
"extensions": [ "extensions": [

View File

@ -4,7 +4,8 @@ import os
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--build_type') parser.add_argument('--build_type')
parser.add_argument('--cppstd')
args = parser.parse_args() args = parser.parse_args()
print ('Executing post-create steps. Build type ', args.build_type) print ('Executing post-create steps. Build type ', args.build_type. ' C++ standard ' + arg.cppstd)
os.system('conan install /workspaces/network-experiment -of /workspaces/build -s build_type=' + args.build_type) os.system('conan install /workspaces/network-experiment -of /workspaces/build -s compiler.cppstd= ' + arg.cppstd + ' -s build_type=' + args.build_type)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,9 @@ class HelloConan(ConanFile):
requires = "boost/1.89.0", "gtest/1.14.0", "libmagic/5.45", "freetype/2.14.1", "libjpeg/9f" requires = "boost/1.89.0", "gtest/1.14.0", "libmagic/5.45", "freetype/2.14.1", "libjpeg/9f"
generators = "CMakeDeps" generators = "CMakeDeps"
build_policy = "*" build_policy = "*"
default_options = {
"boost/1.89.0:without_cobalt": True
}
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

View File

@ -1,7 +1,8 @@
FROM alpine:3.21.3 FROM alpine:3.21.3
# Build type used by conan. "Debug" and "Release" are supported. # Build type used by conan. "Debug" and "Release" are supported.
ARG BUILD_TYPE=Debug ARG BUILD_TYPE
ARG COMPILER_CPPSTD
RUN mkdir -p /root/.local/bin RUN mkdir -p /root/.local/bin
ENV PATH="${PATH}:/root/.local/bin" ENV PATH="${PATH}:/root/.local/bin"
@ -29,18 +30,18 @@ RUN apk add --no-cache \
python3 \ python3 \
pipx && \ pipx && \
pipx ensurepath pipx ensurepath
RUN pipx install conan && \ RUN pipx install conan
conan profile detect RUN conan profile detect
# Pre-build some conan packages we require and take a lot of time to build. This to # Pre-build some conan packages we require and take a lot of time to build. This to
# avoid expensive rebuilding everytime we need a fresh dev container.. # avoid expensive rebuilding everytime we need a fresh dev container..
RUN mkdir -p /workspaces/tmp RUN mkdir -p /workspaces/tmp
WORKDIR /workspaces/tmp WORKDIR /workspaces/tmp
RUN conan install -s build_type=${BUILD_TYPE} -b=* --requires=boost/1.89.0 RUN conan install -s build_type=$BUILD_TYPE -s compiler.cppstd=$COMPILER_CPPSTD -b=* --requires=boost/1.89.0 -o without_cobalt=True
RUN conan install -s build_type=${BUILD_TYPE} -b=* --requires=libmagic/5.45 RUN conan install -s build_type=$BUILD_TYPE -s compiler.cppstd=$COMPILER_CPPSTD -b=* --requires=libmagic/5.45
RUN conan install -s build_type=${BUILD_TYPE} -b=* --requires=freetype/2.14.1 RUN conan install -s build_type=$BUILD_TYPE -s compiler.cppstd=$COMPILER_CPPSTD -b=* --requires=freetype/2.14.1
RUN conan install -s build_type=${BUILD_TYPE} -b=missing --requires=gtest/1.14.0 RUN conan install -s build_type=$BUILD_TYPE -s compiler.cppstd=$COMPILER_CPPSTD -b=missing --requires=gtest/1.14.0
RUN conan install -s build_type=${BUILD_TYPE} -b=missing --requires=libjpeg/9f RUN conan install -s build_type=$BUILD_TYPE -s compiler.cppstd=$COMPILER_CPPSTD -b=missing --requires=libjpeg/9f
WORKDIR /workspaces WORKDIR /workspaces
RUN rm -rf tmp RUN rm -rf tmp