Skip to content

Commit 1a9ac3c

Browse files
authored
Remove FetchContent from compiler (#9001)
CI changes: * Remove FetchContent from compiler build. * Attach vcpkg to GHA workflows * Install flatbuffers, pybind11, and wabt for clang-tidy build and testing * Drop openblas on macOS in vcpkg.json (Accelerate and eigen3 suffice). Code changes: * Use py::type::of instead of deprecated get_type * hexagon_remote: normalize CMAKE_BUILD_TYPE to Debug or Release
1 parent 3c1d47f commit 1a9ac3c

27 files changed

Lines changed: 142 additions & 337 deletions

.github/workflows/presubmit.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ jobs:
4040
runs-on: macos-14
4141
steps:
4242
- uses: actions/checkout@v4
43-
- name: Install clang-tidy
44-
run: brew install llvm@21 lld@21
43+
44+
# We intentionally don't use VCPKG here so that we get some
45+
# notification that the ecosystem is moving on without us.
46+
- name: Install clang-tidy & dependencies
47+
run: brew install flatbuffers llvm@21 lld@21 pybind11 wabt
48+
4549
- name: Run clang-tidy
4650
run: ./run-clang-tidy.sh
4751
env:

.github/workflows/testing-arm-linux.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,7 @@ jobs:
7878
run: echo "Halide_LLVM_ROOT=$(halide-llvm --prefix)" >> "$GITHUB_ENV"
7979

8080
- name: Configure CMake
81-
run: |
82-
TOOLCHAIN_ARGS=()
83-
if [[ "${{ matrix.bits }}" == "32" ]]; then
84-
TOOLCHAIN_ARGS+=("-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/cmake/toolchain.linux-arm32.cmake")
85-
fi
86-
87-
cmake -G Ninja -S . -B build \
88-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
89-
-DHalide_LLVM_ROOT="${Halide_LLVM_ROOT}" \
90-
-DWITH_PYTHON_BINDINGS=OFF \
91-
"${TOOLCHAIN_ARGS[@]}"
81+
run: cmake --preset ci-linux-arm-${{ matrix.bits }}
9282

9383
- name: Initial build
9484
run: cmake --build build

.github/workflows/testing-linux.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,7 @@ jobs:
7575
run: echo "Halide_LLVM_ROOT=$(halide-llvm --prefix)" >> "$GITHUB_ENV"
7676

7777
- name: Configure CMake
78-
run: |
79-
TOOLCHAIN_ARGS=()
80-
if [[ "${{ matrix.bits }}" == "32" ]]; then
81-
TOOLCHAIN_ARGS+=(
82-
"-DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/cmake/toolchain.linux-i386.cmake"
83-
"-DWITH_PYTHON_BINDINGS=OFF"
84-
)
85-
fi
86-
87-
cmake -G Ninja -S . -B build \
88-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
89-
-DHalide_LLVM_ROOT="${Halide_LLVM_ROOT}" \
90-
"${TOOLCHAIN_ARGS[@]}"
78+
run: cmake --preset ci-linux-x86-${{ matrix.bits }}
9179

9280
- name: Initial build
9381
run: cmake --build build

.github/workflows/testing-windows.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,7 @@ jobs:
6363
run: echo "Halide_LLVM_ROOT=$(halide-llvm --prefix)" >> "$GITHUB_ENV"
6464

6565
- name: Configure CMake
66-
run: |
67-
# NB: vcpkg docs use VCPKG_ROOT, but GHA runners use VCPKG_INSTALLATION_ROOT
68-
TOOLCHAIN_ARGS=(
69-
"-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
70-
"-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows"
71-
"-DVCPKG_MANIFEST_FEATURES=developer"
72-
)
73-
if [[ "${{ matrix.bits }}" == "32" ]]; then
74-
TOOLCHAIN_ARGS+=("-DWITH_PYTHON_BINDINGS=OFF")
75-
fi
76-
77-
cmake -G Ninja -S . -B build \
78-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
79-
-DHalide_LLVM_ROOT="${Halide_LLVM_ROOT}" \
80-
"${TOOLCHAIN_ARGS[@]}"
66+
run: cmake --preset ci-windows-x86-${{ matrix.bits }}
8167

8268
- name: Initial build
8369
run: cmake --build build

CMakeLists.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
11
cmake_minimum_required(VERSION 3.28)
2-
3-
# TODO: remove this after updating build bots.
4-
if (CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
5-
if (NOT DEFINED VCPKG_MANIFEST_FEATURES)
6-
set(VCPKG_MANIFEST_FEATURES developer)
7-
endif ()
8-
9-
# vcpkg and FetchContent are incompatible
10-
set(Halide_USE_FETCHCONTENT OFF)
11-
endif ()
12-
13-
option(Halide_USE_FETCHCONTENT "When Halide is top-level, use FetchContent for build-time dependencies." ON)
14-
if (Halide_USE_FETCHCONTENT)
15-
list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/cmake/dependencies.cmake")
16-
endif ()
17-
182
project(Halide
193
VERSION 22.0.0
204
DESCRIPTION "Halide compiler and libraries"

CMakePresets.json

Lines changed: 52 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,59 @@
1515
{
1616
"name": "ci",
1717
"hidden": true,
18-
"inherits": "base",
19-
"toolchainFile": "${sourceDir}/cmake/toolchain.${presetName}.cmake",
18+
"binaryDir": "build",
19+
"installDir": "local",
20+
"generator": "Ninja",
21+
"toolchainFile": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake",
2022
"cacheVariables": {
2123
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
22-
"Halide_LLVM_SHARED_LIBS": false
24+
"FETCHCONTENT_FULLY_DISCONNECTED": "ON",
25+
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/cmake/toolchain.${presetName}.cmake",
26+
"VCPKG_MANIFEST_FEATURES": "developer"
27+
}
28+
},
29+
{
30+
"name": "ci-linux-x86-64",
31+
"inherits": "ci"
32+
},
33+
{
34+
"name": "ci-linux-x86-32",
35+
"inherits": "ci",
36+
"cacheVariables": {
37+
"WITH_PYTHON_BINDINGS": "NO"
38+
}
39+
},
40+
{
41+
"name": "ci-linux-arm-64",
42+
"inherits": "ci",
43+
"cacheVariables": {
44+
"WITH_PYTHON_BINDINGS": "NO"
45+
}
46+
},
47+
{
48+
"name": "ci-linux-arm-32",
49+
"inherits": "ci",
50+
"cacheVariables": {
51+
"WITH_PYTHON_BINDINGS": "NO"
52+
}
53+
},
54+
{
55+
"name": "ci-macos-arm-64",
56+
"inherits": "ci"
57+
},
58+
{
59+
"name": "ci-macos-x86-64",
60+
"inherits": "ci"
61+
},
62+
{
63+
"name": "ci-windows-x86-64",
64+
"inherits": "ci"
65+
},
66+
{
67+
"name": "ci-windows-x86-32",
68+
"inherits": "ci",
69+
"cacheVariables": {
70+
"WITH_PYTHON_BINDINGS": "NO"
2371
}
2472
},
2573
{
@@ -30,7 +78,7 @@
3078
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
3179
"cacheVariables": {
3280
"VCPKG_MANIFEST_FEATURES": "developer",
33-
"Halide_USE_FETCHCONTENT": false
81+
"FETCHCONTENT_FULLY_DISCONNECTED": "ON"
3482
}
3583
},
3684
{
@@ -121,49 +169,6 @@
121169
"displayName": "macOS (vcpkg)",
122170
"description": "macOS build with vcpkg dependencies"
123171
},
124-
{
125-
"name": "package",
126-
"hidden": true,
127-
"cacheVariables": {
128-
"CMAKE_BUILD_TYPE": "Release",
129-
"LLVM_DIR": "$env{LLVM_DIR}",
130-
"Clang_DIR": "$env{Clang_DIR}",
131-
"LLD_DIR": "$env{LLD_DIR}",
132-
"WITH_TESTS": "NO",
133-
"WITH_TUTORIALS": "NO",
134-
"WITH_DOCS": "YES",
135-
"WITH_UTILS": "YES",
136-
"WITH_PYTHON_BINDINGS": "NO",
137-
"CMAKE_INSTALL_DATADIR": "share/Halide"
138-
}
139-
},
140-
{
141-
"name": "package-windows",
142-
"inherits": [
143-
"package",
144-
"vs2022"
145-
],
146-
"displayName": "Package ZIP for Windows",
147-
"description": "Build for packaging Windows shared libraries.",
148-
"binaryDir": "${sourceDir}/build",
149-
"cacheVariables": {
150-
"BUILD_SHARED_LIBS": "YES",
151-
"CMAKE_INSTALL_BINDIR": "bin/$<CONFIG>",
152-
"CMAKE_INSTALL_LIBDIR": "lib/$<CONFIG>",
153-
"Halide_INSTALL_CMAKEDIR": "lib/cmake/Halide",
154-
"Halide_INSTALL_HELPERSDIR": "lib/cmake/HalideHelpers"
155-
}
156-
},
157-
{
158-
"name": "package-unix",
159-
"inherits": "package",
160-
"displayName": "Package UNIX shared libs",
161-
"description": "Build for packaging UNIX shared libraries.",
162-
"binaryDir": "shared-Release",
163-
"cacheVariables": {
164-
"BUILD_SHARED_LIBS": "YES"
165-
}
166-
},
167172
{
168173
"name": "linux-x64-asan",
169174
"inherits": "ci",
@@ -195,72 +200,5 @@
195200
"BUILD_SHARED_LIBS": "NO"
196201
}
197202
}
198-
],
199-
"buildPresets": [
200-
{
201-
"name": "debug",
202-
"configurePreset": "debug",
203-
"displayName": "Debug",
204-
"description": "Debug build with no special settings"
205-
},
206-
{
207-
"name": "release",
208-
"configurePreset": "release",
209-
"displayName": "Release",
210-
"description": "Release build with no special settings"
211-
},
212-
{
213-
"name": "linux-x64-asan",
214-
"configurePreset": "linux-x64-asan",
215-
"displayName": "ASAN (Linux x64)",
216-
"description": "Build everything with ASAN enabled"
217-
},
218-
{
219-
"name": "linux-x64-fuzzer",
220-
"configurePreset": "linux-x64-fuzzer",
221-
"displayName": "Fuzzing (Linux x64)",
222-
"description": "Build everything with fuzzing enabled"
223-
}
224-
],
225-
"testPresets": [
226-
{
227-
"name": "debug",
228-
"configurePreset": "debug",
229-
"displayName": "Debug",
230-
"description": "Test everything with Debug build",
231-
"output": {
232-
"outputOnFailure": true
233-
}
234-
},
235-
{
236-
"name": "release",
237-
"configurePreset": "release",
238-
"displayName": "Release",
239-
"description": "Test everything with Release build",
240-
"output": {
241-
"outputOnFailure": true
242-
}
243-
},
244-
{
245-
"name": "linux-x64-asan",
246-
"configurePreset": "linux-x64-asan",
247-
"displayName": "ASAN (Linux x64)",
248-
"description": "Test everything with ASAN enabled",
249-
"environment": {
250-
"ASAN_OPTIONS": "detect_leaks=0:detect_container_overflow=0"
251-
},
252-
"output": {
253-
"outputOnFailure": true
254-
}
255-
},
256-
{
257-
"name": "linux-x64-fuzzer",
258-
"configurePreset": "linux-x64-fuzzer",
259-
"displayName": "Fuzzing (Linux x64)",
260-
"description": "Test everything with fuzzing enabled",
261-
"output": {
262-
"outputOnFailure": true
263-
}
264-
}
265203
]
266204
}

apps/vcpkg.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
"eigen3",
1313
"libjpeg-turbo",
1414
"libpng",
15-
"openblas",
15+
{
16+
"name": "openblas",
17+
"platform": "(windows & x64 & !uwp & !xbox) | (linux & x64) | (linux & arm64)"
18+
},
1619
{
1720
"name": "opencl",
1821
"platform": "(windows & x64 & !uwp & !xbox) | (linux & x64) | (linux & arm64)"

cmake/dependencies.cmake

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
set(CMAKE_SYSTEM_NAME Linux)
2+
set(CMAKE_SYSTEM_PROCESSOR arm)
3+
4+
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
5+
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
6+
7+
set(CMAKE_C_FLAGS_INIT "-mfp16-format=ieee -Wno-psabi")
8+
set(CMAKE_CXX_FLAGS_INIT "-mfp16-format=ieee -Wno-psabi")
9+
10+
set(VCPKG_TARGET_TRIPLET arm-linux)
11+
set(CMAKE_CROSSCOMPILING FALSE)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Native AArch64 Linux build. No toolchain configuration needed.

0 commit comments

Comments
 (0)