Skip to content

Commit

Permalink
[llvmpy] add py3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Jan 30, 2025
1 parent 927afc2 commit 8762f46
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build_test_release_eudsl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ on:
paths:
- ".github/workflows/build_test_release_eudsl.yml"
- "projects/eudsl-tblgen/**"
- "projects/eudsl-nbgen/**"
- "projects/eudsl-py/**"
- "projects/eudsl-llvmpy/**"
- "third_party/llvm-project"
merge_group:
push:
Expand Down Expand Up @@ -129,6 +131,10 @@ jobs:
if [[ "${{ matrix.os }}" == "ubuntu" ]] && [[ "${{ matrix.arch }}" == "aarch64" ]]; then
sudo apt-get install libarchive-dev antlr libxml2-dev libxslt-dev libcurl4-openssl-dev
fi
if [[ "${{ matrix.os }}" == "macos" ]]; then
brew install antlr boost
fi
$python3_command -m pip install -r requirements-dev.txt
- name: "Build eudsl-tblgen"
Expand All @@ -141,7 +147,6 @@ jobs:
$python3_command -m cibuildwheel "$PWD/projects/eudsl-tblgen" --output-dir wheelhouse
- name: "Build eudsl-llvmpy"
if: ${{ ! startsWith(matrix.os, 'windows') }}
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
Expand Down Expand Up @@ -350,7 +355,7 @@ jobs:
"ubuntu-22.04",
"ubuntu-22.04-arm",
"macos-14",
# "windows-2019"
"windows-2019"
]
python-version: [
# "3.10", "3.11",
Expand All @@ -360,7 +365,7 @@ jobs:
{runs-on: "ubuntu-22.04", name: "ubuntu_x86_64", os: "ubuntu"},
{runs-on: "ubuntu-22.04-arm", name: "ubuntu_aarch64", os: "ubuntu"},
# TODO(max): enable on windows by statically linking
# {runs-on: "windows-2019", name: "windows_x86_64", os: "windows"},
{runs-on: "windows-2019", name: "windows_x86_64", os: "windows"},
{runs-on: "macos-14", name: "macos_arm64", os: "macos"},
]

Expand Down
2 changes: 1 addition & 1 deletion projects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

if(NOT WIN32)
add_subdirectory(eudsl-py)
add_subdirectory(eudsl-llvmpy)
endif()
add_subdirectory(eudsl-llvmpy)
add_subdirectory(eudsl-nbgen)
add_subdirectory(eudsl-tblgen)
34 changes: 23 additions & 11 deletions projects/eudsl-llvmpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,34 @@ nanobind_add_module(eudslllvm_ext
src/eudslllvm_ext.cpp
${_gen_src}
)
target_link_libraries(eudslllvm_ext PRIVATE LLVM LTO)
set(eudslllvm_ext_libs
PRIVATE
LLVMCore
LLVMExecutionEngine
LLVMOrcJIT
LLVMOrcDebugging
LLVMInterpreter
LLVMMCDisassembler
LLVMMCJIT)
if(CMAKE_SYSTEM_PROCESSOR MATCHES x86_64)
list(APPEND eudslllvm_ext_libs
LLVMX86Info
LLVMX86CodeGen
LLVMX86AsmParser
LLVMX86Disassembler)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
list(APPEND eudslllvm_ext_libs
LLVMAArch64Info
LLVMAArch64Desc
LLVMAArch64AsmParser
LLVMAArch64Disassembler)
endif()
target_link_libraries(eudslllvm_ext PRIVATE ${eudslllvm_ext_libs})
set_target_properties(eudslllvm_ext
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${EUDSLLLVM_SRC_DIR}/llvm"
)

set(STANDALONE)
if(EUDSLLLVM_STANDALONE_BUILD OR EUDSL_STANDALONE_BUILD)
set(STANDALONE STANDALONE)
endif()
patch_llvm_rpath(LLVM ${STANDALONE})
patch_llvm_rpath(LTO ${STANDALONE})
set_install_rpath_origin(eudslllvm_ext)
# copy libLLVM into the ext dir for wheels
install(IMPORTED_RUNTIME_ARTIFACTS LLVM LTO LIBRARY DESTINATION llvm)

target_compile_options(eudslllvm_ext PRIVATE ${nanobind_options})
target_compile_options(nanobind-static PRIVATE ${nanobind_options})

Expand Down
2 changes: 2 additions & 0 deletions projects/eudsl-llvmpy/eudsl-llvmpy-generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ def generate_nb_bindings(header_root: Path, output_root: Path):
pp_dir = output_root / "pp"
pp_dir.mkdir(parents=True, exist_ok=True)
for header_f in header_root.rglob("*.h"):
if header_f.name == "lto.h":
continue
with open(header_f) as ff:
orig_code = ff.read()
pp_header_f = pp_dir / header_f.name
Expand Down
2 changes: 1 addition & 1 deletion projects/eudsl-llvmpy/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[project]
name = "eudsl-llvmpy"
version = "0.0.1"
requires-python = ">3.9"
requires-python = ">=3.10"
[project.urls]
Homepage = "https://github.com/llvm/eudsl"

Expand Down
2 changes: 0 additions & 2 deletions projects/eudsl-llvmpy/src/eudslllvm_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ NB_MODULE(eudslllvm_ext, m) {
populate_TargetMachine(m);
extern void populate_Error(nb::module_ & m);
populate_Error(m);
extern void populate_lto(nb::module_ & m);
populate_lto(m);
extern void populate_OrcEE(nb::module_ & m);
populate_OrcEE(m);
extern void populate_Core(nb::module_ & m);
Expand Down

0 comments on commit 8762f46

Please sign in to comment.