Skip to content

Commit bbead1c

Browse files
committed
wip
1 parent b850356 commit bbead1c

File tree

4 files changed

+139
-0
lines changed

4 files changed

+139
-0
lines changed

.github/workflows/toolchain.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build toolchain
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
tags: ["**"]
7+
pull_request:
8+
branches: ["main"]
9+
jobs:
10+
macos:
11+
name: macOS toolchain
12+
runs-on: macos-latest
13+
steps:
14+
- uses: actions/checkout@v5
15+
- name: Run CI task
16+
run: |
17+
echo "Hello"
18+
echo "foo" > foo.tar.gz
19+
echo "bar" > bar.tar.xz
20+
- name: Attach package to the tag
21+
uses: svenstaro/upload-release-action@v2
22+
with:
23+
repo_token: ${{ secrets.GITHUB_TOKEN }}
24+
file: "*.tar.*"
25+
tag: ${{ github.run_id }}
26+
overwrite: true
27+
file_glob: true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build.dir
2+
*.toolchain
3+
*.tar.gz
4+
*.tar.xz
5+

ToolchainCache-stage2.cmake

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Based on clang/cmake/caches/DistributionExample-stage2.cmake
2+
3+
# This file sets up a CMakeCache for the second stage of a simple distribution
4+
# bootstrap build.
5+
6+
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
7+
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
8+
9+
set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
10+
11+
set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
12+
set(LLVM_CCACHE_BUILD ON CACHE BOOL "")
13+
set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "")
14+
set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
15+
set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
16+
17+
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
18+
19+
if(APPLE)
20+
set(libtool_darwin llvm-libtool-darwin)
21+
endif()
22+
23+
# setup toolchain
24+
set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
25+
set(LLVM_TOOLCHAIN_TOOLS
26+
${libtool_darwin}
27+
clang-format
28+
clang-tidy
29+
llvm-ar
30+
llvm-dwp
31+
llvm-nm
32+
llvm-objcopy
33+
llvm-objdump
34+
llvm-profdata
35+
llvm-ranlib
36+
llvm-strip
37+
llvm-symbolizer
38+
39+
CACHE STRING "")
40+
41+
set(LLVM_DISTRIBUTION_COMPONENTS
42+
clang
43+
LTO
44+
lld
45+
clang-format
46+
clang-resource-headers
47+
builtins
48+
runtimes
49+
${LLVM_TOOLCHAIN_TOOLS}
50+
CACHE STRING "")

ToolchainCache.cmake

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Based on clang/cmake/caches/DistributionExample.cmake
2+
# This file sets up a CMakeCache for a simple distribution bootstrap build.
3+
4+
# Enable LLVM projects and runtimes
5+
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
6+
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
7+
8+
set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
9+
set(LLVM_CCACHE_BUILD ON CACHE BOOL "")
10+
set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "")
11+
set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
12+
set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
13+
14+
# Only build the native target in stage1 since it is a throwaway build.
15+
set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
16+
17+
# Optimize the stage1 compiler, but don't LTO it because that wastes time.
18+
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
19+
20+
# Setup vendor-specific settings.
21+
set(PACKAGE_VENDOR LLVM.org CACHE STRING "")
22+
23+
# Setting up the stage2 LTO option needs to be done on the stage1 build so that
24+
# the proper LTO library dependencies can be connected.
25+
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
26+
27+
if(NOT APPLE)
28+
# Since LLVM_ENABLE_LTO is ON we need a LTO capable linker
29+
set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
30+
endif()
31+
32+
# Expose stage2 targets through the stage1 build configuration.
33+
set(CLANG_BOOTSTRAP_TARGETS
34+
check-all
35+
check-llvm
36+
check-clang
37+
llvm-config
38+
test-suite
39+
test-depends
40+
llvm-test-depends
41+
clang-test-depends
42+
distribution
43+
install-distribution
44+
clang CACHE STRING "")
45+
46+
# Setup the bootstrap build.
47+
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
48+
49+
if(STAGE2_CACHE_FILE)
50+
set(CLANG_BOOTSTRAP_CMAKE_ARGS
51+
-C ${STAGE2_CACHE_FILE}
52+
CACHE STRING "")
53+
else()
54+
set(CLANG_BOOTSTRAP_CMAKE_ARGS
55+
-C ${CMAKE_CURRENT_LIST_DIR}/ToolchainCache-stage2.cmake
56+
CACHE STRING "")
57+
endif()

0 commit comments

Comments
 (0)