Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions flags/cxx23.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2025, tipi.build by EngFlow
# All rights reserved.

if(DEFINED POLLY_FLAGS_CXX23_CMAKE)
return()
else()
set(POLLY_FLAGS_CXX23_CMAKE 1)
endif()

include(polly_add_cache_flag)
include(polly_fatal_error)

string(COMPARE EQUAL "${ANDROID_NDK_VERSION}" "" _not_android)

# TODO: test other platfroms, CMAKE_CXX_FLAGS_INIT should work for all
if(HUNTER_CMAKE_GENERATOR MATCHES "^Visual Studio.*$")
polly_fatal_error("Use flags/vs-cxx23.cmake instead")
elseif(_not_android)
polly_add_cache_flag(CMAKE_CXX_FLAGS "-std=c++23")
else()
polly_add_cache_flag(CMAKE_CXX_FLAGS_INIT "-std=c++23")
endif()

# Set CMAKE_CXX_STANDARD to cache to override project local value if present.
# FORCE added in case CMAKE_CXX_STANDARD already set in cache
# (e.g. set before 'project' by user).
set(CMAKE_CXX_STANDARD 23 CACHE STRING "C++ Standard (toolchain)" FORCE)
set(CMAKE_CXX_STANDARD_REQUIRED YES CACHE BOOL "C++ Standard required" FORCE)
set(CMAKE_CXX_EXTENSIONS NO CACHE BOOL "C++ Standard extensions" FORCE)
13 changes: 13 additions & 0 deletions flags/gsplit-dwarf.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2025, tipi.build by EngFlow
# All rights reserved.

include_guard()

set(CMAKE_C_FLAGS_DEBUG_INIT "${CMAKE_C_FLAGS_Debug_INIT} -g -gsplit-dwarf")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "${CMAKE_CXX_FLAGS_Debug_INIT} -g -gsplit-dwarf")

set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "${CMAKE_C_FLAGS_Debug_INIT} -g -gsplit-dwarf")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "${CMAKE_CXX_FLAGS_Debug_INIT} -g -gsplit-dwarf")

set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_Release_INIT} -g -gsplit-dwarf")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_Release_INIT} -g -gsplit-dwarf")
12 changes: 12 additions & 0 deletions linux-ubuntu-2404-clang20-asan-ubsan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_init.cmake")

polly_init(
"clang 20 / C++ 23 MSAN"
"Ninja"
)
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/compiler/clang.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/cxx23.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sanitizers/asan.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sanitizers/ubsan.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/gsplit-dwarf.cmake")
2 changes: 2 additions & 0 deletions linux-ubuntu-2404-clang20-asan-ubsan.container.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Generated File DO NOT MANUALLY EDIT, this file SHOULD be commited to version control system
{"image_base_name":"tipibuild/tipi-ubuntu-2404-clang20","manifest_digest":"sha256:a71bcf0207c62e24ec4ce142356270a4c9458ca58fce908510412971eafd04f4","platform":"linux/amd64","raw_envzip_hash":"9050e5ddb8c06f558f7ca1837f8e446446165347"}
11 changes: 11 additions & 0 deletions linux-ubuntu-2404-clang20-msan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_init.cmake")

polly_init(
"clang 20 / C++ 23 MSAN"
"Ninja"
)
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/compiler/clang.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/cxx23.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sanitizers/msan.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/gsplit-dwarf.cmake")
5 changes: 5 additions & 0 deletions linux-ubuntu-2404-clang20-msan.cmake.layers
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
"!linux-*/**",
"linux-ubuntu2404*",
"!linux-ubuntu2404-clang20-prebuilt/**"
]
2 changes: 2 additions & 0 deletions linux-ubuntu-2404-clang20-msan.container.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Generated File DO NOT MANUALLY EDIT, this file SHOULD be commited to version control system
{"image_base_name":"tipibuild/tipi-ubuntu-2404-clang20","manifest_digest":"sha256:a71bcf0207c62e24ec4ce142356270a4c9458ca58fce908510412971eafd04f4","platform":"linux/amd64","raw_envzip_hash":"9050e5ddb8c06f558f7ca1837f8e446446165347"}
15 changes: 15 additions & 0 deletions linux-ubuntu-2404-clang20-prebuilt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_init.cmake")

polly_init(
"clang 20 / C++ 23"
"Ninja"
)
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/compiler/clang.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/cxx23.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sanitizers/msan.cmake")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
5 changes: 5 additions & 0 deletions linux-ubuntu-2404-clang20-prebuilt.cmake.layers
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
"!linux-*/**",
"linux-ubuntu2404*",
"!linux-ubuntu2404-clang20/**"
]
2 changes: 2 additions & 0 deletions linux-ubuntu-2404-clang20-prebuilt.container.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Generated File DO NOT MANUALLY EDIT, this file SHOULD be commited to version control system
{"image_base_name":"tipibuild/tipi-ubuntu-2404-clang20-prebuilt","manifest_digest":"sha256:df20e500eeedded08e9ed4d0299ed9a50407d437f2ef836f28594a76575b849e","platform":"linux/amd64","raw_envzip_hash":"f83c0336b21f36512591ac5c013a5b38ecced9e6"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG TIPI_UBUNTU_CLANG20_24_04="tipibuild/tipi-ubuntu-2404-clang20@sha256:a71bcf0207c62e24ec4ce142356270a4c9458ca58fce908510412971eafd04f4"
FROM ${TIPI_UBUNTU_CLANG20_24_04}
MAINTAINER tipi.build by EngFlow

# Preinstall dependencies
RUN mkdir -p /compute_array_sum && \
git clone --depth 1 https://github.com/tipibuild/unittest-compute_array_sum.git /compute_array_sum && \
PATH=`tipi run printenv PATH` cmake -DCMAKE_BUILD_TYPE=Release \
-G Ninja \
-S /compute_array_sum \
-B /compute_array_sum/build \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
-DCMAKE_C_COMPILER=/usr/bin/clang \
-DCMAKE_INSTALL_PREFIX=/usr/ && \
PATH=`tipi run printenv PATH` cmake --build /compute_array_sum/build --target install && \
rm -rf /compute_array_sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"variables": { },
"builders": [
{
"type": "docker",
"image": "tipibuild/tipi-ubuntu-2404-clang20-prebuilt:{{cmake_re_source_hash}}",
"commit": true
}
]
}
11 changes: 11 additions & 0 deletions linux-ubuntu-2404-clang20-tidy.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_init.cmake")

polly_init(
"clang 20 / C++ 23 MSAN"
"Ninja"
)
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/compiler/clang.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/cxx23.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/gsplit-dwarf.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/clang-tidy.cmake")
2 changes: 2 additions & 0 deletions linux-ubuntu-2404-clang20-tidy.container.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Generated File DO NOT MANUALLY EDIT, this file SHOULD be commited to version control system
{"image_base_name":"tipibuild/tipi-ubuntu-2404-clang20","manifest_digest":"sha256:a71bcf0207c62e24ec4ce142356270a4c9458ca58fce908510412971eafd04f4","platform":"linux/amd64","raw_envzip_hash":"9050e5ddb8c06f558f7ca1837f8e446446165347"}
11 changes: 11 additions & 0 deletions linux-ubuntu-2404-clang20-tsan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_init.cmake")

polly_init(
"clang 20 / C++ 23 MSAN"
"Ninja"
)
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/compiler/clang.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/cxx23.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/sanitizers/tsan.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/gsplit-dwarf.cmake")
2 changes: 2 additions & 0 deletions linux-ubuntu-2404-clang20-tsan.container.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Generated File DO NOT MANUALLY EDIT, this file SHOULD be commited to version control system
{"image_base_name":"tipibuild/tipi-ubuntu-2404-clang20","manifest_digest":"sha256:a71bcf0207c62e24ec4ce142356270a4c9458ca58fce908510412971eafd04f4","platform":"linux/amd64","raw_envzip_hash":"9050e5ddb8c06f558f7ca1837f8e446446165347"}
10 changes: 10 additions & 0 deletions linux-ubuntu-2404-clang20.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_init.cmake")

polly_init(
"clang 20 / C++ 23"
"Ninja"
)
include("${CMAKE_CURRENT_LIST_DIR}/utilities/polly_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/compiler/clang.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/cxx23.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/flags/gsplit-dwarf.cmake")
5 changes: 5 additions & 0 deletions linux-ubuntu-2404-clang20.cmake.layers
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
"!linux-*/**",
"linux-ubuntu2404*",
"!linux-ubuntu2404-clang20-prebuilt/**"
]
2 changes: 2 additions & 0 deletions linux-ubuntu-2404-clang20.container.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Generated File DO NOT MANUALLY EDIT, this file SHOULD be commited to version control system
{"image_base_name":"tipibuild/tipi-ubuntu-2404-clang20","manifest_digest":"sha256:a71bcf0207c62e24ec4ce142356270a4c9458ca58fce908510412971eafd04f4","platform":"linux/amd64","raw_envzip_hash":"9050e5ddb8c06f558f7ca1837f8e446446165347"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
ARG UBUNTU_24_04="ubuntu@sha256:04f510bf1f2528604dc2ff46b517dbdbb85c262d62eacc4aa4d3629783036096"
FROM ${UBUNTU_24_04}
MAINTAINER tipi.build by EngFlow

# Install base tooling
RUN apt-get update -y && apt-get install -y gcc g++ make unzip curl wget build-essential gettext autoconf libbz2-dev xz-utils zlib1g-dev libzstd-dev

# Install tipi and cmake-re
ENV TIPI_INSTALL_VERSION=v0.0.77
# dfb217a08ced7143d9e6603f565d7d1ce3d9f26d == v0.0.77
RUN curl -fsSL https://github.com/tipi-build/cli/raw/dfb217a08ced7143d9e6603f565d7d1ce3d9f26d/install/container/ubuntu.sh -o ubuntu.sh && /bin/bash ubuntu.sh

RUN chmod 777 /usr/local/share/.tipi/.distro.mode \
&& chmod -R 777 /usr/local/share/.tipi

EXPOSE 22


# Standard Clang 20
RUN mkdir -p /llvm-project && \
git clone --branch llvmorg-20.1.2 --depth 1 https://github.com/llvm/llvm-project.git /llvm-project && \
PATH=`tipi run printenv PATH` cmake \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLLVM_ENABLE_ZLIB=FORCE_ON \
-DLLVM_ENABLE_ZSTD=FORCE_ON \
-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;polly;compiler-rt' \
-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' \
-DLIBCXXABI_USE_LLVM_UNWINDER=YES \
-DCLANG_DEFAULT_CXX_STDLIB=libc++ \
-DLIBCXX_CXX_ABI=libcxxabi \
-S /llvm-project/llvm \
-B /llvm-project/build && \
PATH=`tipi run printenv PATH` cmake --build /llvm-project/build --target install && \
echo "/usr/lib/x86_64-unknown-linux-gnu" > /etc/ld.so.conf.d/clang.conf && \
ldconfig && \
rm -rf /llvm-project/

RUN apt-get remove -y g++

# MSAN Clang 20 libcxx
# Installs instrumented libc++.so alongside non-instrumented one (in /usr/local) so that the compiler can run at full speed with MSAN instrumentation
#
# To enable binary instrumentation, link them with /usr/local/lib/libc++.so
#
RUN mkdir -p /llvm-project && \
git clone --branch llvmorg-20.1.2 --depth 1 https://github.com/llvm/llvm-project.git /llvm-project && \
PATH=`tipi run printenv PATH` cmake \
-DCMAKE_BUILD_TYPE=Release \
-G Ninja \
-S /llvm-project/runtimes \
-B /llvm-project/build-msan \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
-DCMAKE_C_COMPILER=/usr/bin/clang \
-DCMAKE_INSTALL_PREFIX=/usr/local/instrumented/msan \
-DLLVM_USE_SANITIZER=MemoryWithOrigins \
-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi' \
-DLIBCXXABI_USE_LLVM_UNWINDER=Off && \
PATH=`tipi run printenv PATH` cmake --build /llvm-project/build-msan --target install && \
rm -rf /llvm-project/

ENV MSAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer

RUN sudo apt-get update -y && sudo apt-get install -y valgrind
10 changes: 10 additions & 0 deletions linux-ubuntu-2404-clang20.pkr.js/linux-ubuntu-2404-clang20.pkr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"variables": { },
"builders": [
{
"type": "docker",
"image": "tipibuild/tipi-ubuntu-2404-clang20:{{cmake_re_source_hash}}",
"commit": true
}
]
}
1 change: 0 additions & 1 deletion linux-ubuntu-2404.cmake
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
include("${CMAKE_CURRENT_LIST_DIR}/linux-cxx17.cmake")
14 changes: 14 additions & 0 deletions sanitizers/asan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Compilation and linker flags to ensure proper sanitizer support
set (CMAKE_POSITION_INDEPENDENT_CODE ON)

set(ASAN_FLAGS
-fsanitize=address
)

add_compile_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>
${ASAN_FLAGS})

add_link_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>
${ASAN_FLAGS})
23 changes: 23 additions & 0 deletions sanitizers/msan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Link to MSAN instrumented libc++
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-nostdlib++>)
add_link_options($<$<COMPILE_LANGUAGE:C,CXX>:-nostdlib++>)
link_libraries("/usr/local/instrumented/msan/lib/libc++.so.1.0")
link_libraries("/usr/local/instrumented/msan/lib/libc++abi.so.1.0")
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-stdlib=libc++>)
add_link_options($<$<COMPILE_LANGUAGE:C,CXX>:-stdlib=libc++>)

# Compilation and linker flags to ensure proper sanitizer support
set (CMAKE_POSITION_INDEPENDENT_CODE ON)

set(MSAN_FLAGS
-fsanitize=memory
-fsanitize-memory-track-origins
)

add_compile_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>
${MSAN_FLAGS})

add_link_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>
${MSAN_FLAGS})
12 changes: 12 additions & 0 deletions sanitizers/tsan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Compilation and linker flags to ensure proper sanitizer support
set (CMAKE_POSITION_INDEPENDENT_CODE ON)

add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-fsanitize=thread>)
add_link_options($<$<COMPILE_LANGUAGE:C,CXX>:-fsanitize=thread>)

add_compile_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>
)
add_link_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>
)
15 changes: 15 additions & 0 deletions sanitizers/ubsan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Compilation and linker flags to ensure proper sanitizer support
set (CMAKE_POSITION_INDEPENDENT_CODE ON)

set(UBSAN_FLAGS
-fsanitize=undefined
-fno-sanitize-merge
)

add_compile_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>
${UBSAN_FLAGS})

add_link_options(
$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>
${UBSAN_FLAGS})
3 changes: 2 additions & 1 deletion utilities/polly_init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ else()
endif()

include("${CMAKE_CURRENT_LIST_DIR}/polly_fatal_error.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/polly_status_print.cmake")

macro(polly_init name generator)
set(POLLY_TOOLCHAIN_NAME "${name}")
Expand All @@ -17,7 +18,7 @@ macro(polly_init name generator)

string(COMPARE EQUAL "${CMAKE_GENERATOR}" "${generator}" _polly_correct)
if(NOT _polly_correct)
polly_fatal_error(
polly_status_print(
"Please change generator to: ${generator}\n"
"(Current generator: ${CMAKE_GENERATOR})"
)
Expand Down