Skip to content

Commit

Permalink
BLD: Update CI jobs to the newer LLVM git hash (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsokol authored Feb 3, 2025
1 parent 879760f commit 9e9f2cb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: llvm/llvm-project
ref: '4091bc61e315f187829dca877dd908a07ba9cb91' # Latest commit as of 2024-10-17
ref: 'bb59eb8ed534da2bd03117cfde594321add4d60c' # Latest commit as of 2025-01-22
path: 'llvm-project'

- name: Setup Developer Command Prompt
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")

# https://github.com/iree-org/iree/blob/c96372348654eea8548509d38df5c8e8b179aef3/CMakeLists.txt#L275-L280
find_package(Python3 COMPONENTS Interpreter Development)
find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED)
find_package(Python3 COMPONENTS Interpreter Development NumPy)
find_package(Python3 COMPONENTS Interpreter Development.Module NumPy REQUIRED)
# nanobind uses Python_EXECUTABLE
find_package(Python COMPONENTS Interpreter Development.Module NumPy REQUIRED)


if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
find_package(MLIR REQUIRED CONFIG)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ requires = [
"pybind11>=2.10.4",
"numpy",
"PyYAML",
"nanobind",
]

[tool.cibuildwheel]
Expand Down
1 change: 1 addition & 0 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ cmake>=3.12
pybind11>=2.10.4
numpy
PyYAML
nanobind
25 changes: 23 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import subprocess
from pathlib import Path
from sysconfig import get_paths

import ninja
from setuptools import Extension, setup
Expand All @@ -29,9 +30,14 @@ def build_extension(self, ext: CMakeExtension) -> None:
install_dir = extdir
ninja_executable_path = Path(ninja.BIN_DIR) / "ninja"
PYTHON_EXECUTABLE = str(Path(sys.executable))
include_path = get_paths()["include"]


extra_flags = []
extra_flags = [
# pybind11 and nanobind use different names
f"-DPython_INCLUDE_DIR={include_path}",
f"-DPython3_INCLUDE_DIR={include_path}",
f"-DPYTHON_INCLUDE_DIR={include_path}",
]
if sys.platform.startswith("darwin"):
extra_flags.append("-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0")
elif platform.system() == "Windows":
Expand All @@ -42,6 +48,13 @@ def build_extension(self, ext: CMakeExtension) -> None:
"-DCMAKE_C_FLAGS=/MT",
"-DCMAKE_CXX_FLAGS=/MT",
]
libs_path = Path(include_path).parent / "libs"
library_path = libs_path / f"python3{sys.version_info.minor}.lib"
for python_name in ["Python", "Python3", "PYTHON"]:
extra_flags += [
f"-D{python_name}_LIBRARY={library_path}",
f"-D{python_name}_LIBRARY_DIRS={libs_path}",
]

# BUILD LLVM
llvm_cmake_args = [
Expand All @@ -51,6 +64,10 @@ def build_extension(self, ext: CMakeExtension) -> None:
"-DLLVM_TARGETS_TO_BUILD=Native",
"-DMLIR_ENABLE_BINDINGS_PYTHON=ON",
f"-DPython3_EXECUTABLE={PYTHON_EXECUTABLE}",
f"-DPython_EXECUTABLE={PYTHON_EXECUTABLE}",
f"-DPYTHON_EXECUTABLE={PYTHON_EXECUTABLE}",
f"-UNB_SUFFIX",
f"-UNB_SUFFIX_S",
"-DLLVM_INSTALL_UTILS=ON",
"-DLLVM_CCACHE_BUILD=ON",
"-DCMAKE_BUILD_TYPE=Release",
Expand Down Expand Up @@ -86,6 +103,10 @@ def build_extension(self, ext: CMakeExtension) -> None:
"-DLLVM_ENABLE_ZLIB=OFF",
"-DLLVM_ENABLE_ZSTD=OFF",
f"-DPython3_EXECUTABLE={PYTHON_EXECUTABLE}",
f"-DPython_EXECUTABLE={PYTHON_EXECUTABLE}",
f"-DPYTHON_EXECUTABLE={PYTHON_EXECUTABLE}",
f"-UNB_SUFFIX",
f"-UNB_SUFFIX_S",
*extra_flags,
]

Expand Down

0 comments on commit 9e9f2cb

Please # to comment.