Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support using vcpkg to build dependencies on all platforms #8387

Merged
merged 1 commit into from
Aug 12, 2024
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ install_manifest.txt
# Ninja files
*.ninja*

# Package managers
vcpkg_installed/

################################################################################
## IDE directories and metadata

Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ if (Halide_USE_FETCHCONTENT)
list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES "${CMAKE_CURRENT_LIST_DIR}/cmake/dependencies.cmake")
endif ()

# TODO: remove this after updating build bots.
if (NOT DEFINED VCPKG_OVERLAY_PORTS)
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/cmake/vcpkg")
endif ()

# TODO: remove this after updating build bots.
if (NOT DEFINED VCPKG_MANIFEST_FEATURES)
set(VCPKG_MANIFEST_FEATURES developer)
endif ()

project(Halide
VERSION 19.0.0
DESCRIPTION "Halide compiler and libraries"
Expand Down
147 changes: 109 additions & 38 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": 3,
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 22,
"minor": 28,
"patch": 0
},
"configurePresets": [
Expand All @@ -18,30 +18,42 @@
"inherits": "base",
"toolchainFile": "${sourceDir}/cmake/toolchain.${presetName}.cmake",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"Halide_LLVM_SHARED_LIBS": false
}
},
{
"name": "windows-only",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
"name": "vcpkg",
"inherits": "base",
"displayName": "vcpkg deps",
"description": "Build dependencies (with Halide exclusions) with vcpkg",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"cacheVariables": {
"VCPKG_MANIFEST_FEATURES": "developer",
"VCPKG_OVERLAY_PORTS": "${sourceDir}/cmake/vcpkg",
"Halide_USE_FETCHCONTENT": false
}
},
{
"name": "vcpkg",
"hidden": true,
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
"name": "vcpkg-full",
"inherits": "vcpkg",
"displayName": "vcpkg deps (all dependencies)",
"description": "Build ALL dependencies with vcpkg",
"cacheVariables": {
"VCPKG_OVERLAY_PORTS": ""
}
},
{
"name": "vs2022",
"hidden": true,
"inherits": [
"vcpkg",
"windows-only"
"vcpkg"
],
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Visual Studio 17 2022",
"toolset": "host=x64"
},
Expand All @@ -64,52 +76,112 @@
}
},
{
"name": "debian-debug",
"inherits": "debug",
"displayName": "Debian (Debug)",
"description": "Debug build assuming Debian-provided dependencies",
"cacheVariables": {
"Halide_LLVM_SHARED_LIBS": "ON"
}
"name": "debug-vcpkg",
"inherits": [
"debug",
"vcpkg"
],
"displayName": "Debug (vcpkg)",
"description": "Debug build for a single-config generator, vcpkg dependencies"
},
{
"name": "debian-release",
"inherits": "debian-debug",
"displayName": "Debian (Release)",
"description": "Release build assuming Debian-provided dependencies",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
"name": "release-vcpkg",
"inherits": [
"release",
"vcpkg"
],
"displayName": "Release (vcpkg)",
"description": "Release build for a single-config generator, vcpkg dependencies"
},
{
"name": "win32",
"name": "debug-vcpkg-full",
"inherits": [
"debug",
"vcpkg-full"
],
"displayName": "Debug (vcpkg-full)",
"description": "Debug build for a single-config generator, vcpkg-full dependencies"
},
{
"name": "release-vcpkg-full",
"inherits": [
"vs2022",
"base"
"release",
"vcpkg-full"
],
"displayName": "Release (vcpkg-full)",
"description": "Release build for a single-config generator, vcpkg-full dependencies"
},
{
"name": "win32",
"inherits": "vs2022",
"displayName": "Win32 (Visual Studio)",
"description": "Visual Studio-based Win32 build with vcpkg dependencies.",
"architecture": "Win32"
},
{
"name": "win64",
"inherits": [
"vs2022",
"base"
],
"inherits": "vs2022",
"displayName": "Win64 (Visual Studio)",
"description": "Visual Studio-based x64 build with vcpkg dependencies.",
"architecture": "x64"
},
{
"name": "win32-vcpkg-full",
"inherits": [
"vcpkg-full",
"vs2022"
],
"displayName": "Win32 (Visual Studio/vcpkg-full)",
"description": "Visual Studio-based Win32 build with vcpkg-full dependencies.",
"architecture": "Win32"
},
{
"name": "win64-vcpkg-full",
"inherits": [
"vcpkg-full",
"vs2022"
],
"displayName": "Win64 (Visual Studio/vcpkg-full)",
"description": "Visual Studio-based x64 build with vcpkg-full dependencies.",
"architecture": "x64"
},
{
"name": "macOS",
"displayName": "macOS (Apple Clang)",
"description": "macOS build using Apple Clang and Homebrew LLVM",
"generator": "Ninja",
"inherits": "release",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"cacheVariables": {
"CMAKE_PREFIX_PATH": "/opt/homebrew;/opt/homebrew/opt/llvm;/opt/homebrew/opt/jpeg"
}
},
{
"name": "macOS-vcpkg",
"inherits": [
"macOS",
"vcpkg"
],
"displayName": "macOS (vcpkg)",
"description": "macOS build with vcpkg dependencies",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "/opt/homebrew/opt/llvm"
}
},
{
"name": "macOS-vcpkg-full",
"inherits": [
"macOS",
"vcpkg-full"
],
"displayName": "macOS (vcpkg-full)",
"description": "macOS build with vcpkg-full dependencies",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "/opt/homebrew;/opt/homebrew/opt/llvm;/opt/homebrew/opt/jpeg",
"Halide_LLVM_SHARED_LIBS": "YES"
"CMAKE_PREFIX_PATH": ""
}
},
{
Expand Down Expand Up @@ -182,7 +254,6 @@
"description": "Build everything with fuzzing enabled",
"cacheVariables": {
"LLVM_ROOT": "$penv{LLVM_ROOT}",
"TARGET_WEBASSEMBLY": "NO",
"WITH_TUTORIALS": "NO",
"WITH_UTILS": "NO",
"WITH_PYTHON_BINDINGS": "NO",
Expand Down
3 changes: 3 additions & 0 deletions cmake/vcpkg/llvm/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This instructs vcpkg to do nothing, which causes find_package
# to search the system for LLVM, rather than the vcpkg trees.
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Loading