Skip to content

Commit

Permalink
Switch to scikit-build-core.
Browse files Browse the repository at this point in the history
  • Loading branch information
hameerabbasi committed Feb 6, 2025
1 parent 295b2bb commit 42519cb
Show file tree
Hide file tree
Showing 10 changed files with 339 additions and 195 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Set env variables
run: |
echo "HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"" >> $GITHUB_ENV
- name: set env variables - macos
if: contains(matrix.os, 'macos')
shell: bash
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@
build/
*.egg-info
dist/
finch_mlir-*/

# pixi environments
.pixi
*.egg-info

# Log files
*.log

/wheelhouse/
41 changes: 23 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
cmake_minimum_required(VERSION 3.20.0)
project(finch-dialect LANGUAGES CXX C)
project(finch LANGUAGES CXX C)

set(FINCH_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(FINCH_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")

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 NumPy)
find_package(Python3 COMPONENTS Interpreter Development.Module NumPy REQUIRED)
# nanobind uses Python_EXECUTABLE
find_package(Python COMPONENTS Interpreter Development.Module NumPy REQUIRED)
if(MLIR_ENABLE_BINDINGS_PYTHON)
find_package(Python3 COMPONENTS Interpreter Development)
find_package(Python3 COMPONENTS Interpreter Development.Module NumPy REQUIRED)
# nanobind uses Python_EXECUTABLE
find_package(Python COMPONENTS Interpreter Development.Module NumPy REQUIRED)
endif()

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
find_package(MLIR REQUIRED CONFIG)

message(STATUS "Using MLIRConfig.cmake in: ${MLIR_DIR}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")

set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib)
set(LLVM_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/bin")
set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/lib")
set(MLIR_BINARY_DIR ${CMAKE_BINARY_DIR})

list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")
Expand All @@ -30,32 +35,32 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
include(HandleLLVMOptions)
else()
# Build via external projects mechanism
set(MLIR_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR}/../mlir)
set(MLIR_INCLUDE_DIR ${MLIR_MAIN_SRC_DIR}/include)
set(MLIR_GENERATED_INCLUDE_DIR ${LLVM_BINARY_DIR}/tools/mlir/include)
set(MLIR_MAIN_SRC_DIR "${LLVM_MAIN_SRC_DIR}/../mlir")
set(MLIR_INCLUDE_DIR "${MLIR_MAIN_SRC_DIR}/include")
set(MLIR_BINARY_DIR "${CMAKE_BINARY_DIR}")
set(MLIR_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/tools/mlir/include")
set(MLIR_INCLUDE_DIRS "${MLIR_INCLUDE_DIR};${MLIR_GENERATED_INCLUDE_DIR}")
list(APPEND CMAKE_MODULE_PATH "${MLIR_MAIN_SRC_DIR}/cmake/modules")
endif()

if(MLIR_ENABLE_BINDINGS_PYTHON)
include(MLIRDetectPythonEnv)
mlir_configure_python_dev_packages()
endif()

set(FINCH_SOURCE_DIR ${PROJECT_SOURCE_DIR})
set(FINCH_BINARY_DIR ${PROJECT_BINARY_DIR})
include_directories(${LLVM_INCLUDE_DIRS})
include_directories(${MLIR_INCLUDE_DIRS})
include_directories(${FINCH_SOURCE_DIR}/include)
include_directories(${FINCH_BINARY_DIR}/include)
link_directories(${LLVM_BUILD_LIBRARY_DIR})
add_definitions(${LLVM_DEFINITIONS})
include_directories("${FINCH_SOURCE_DIR}/include")
include_directories("${FINCH_BINARY_DIR}/include")
include_directories("${MLIR_INCLUDE_DIRS}")
link_directories("${LLVM_BUILD_LIBRARY_DIR}")
add_definitions("${LLVM_DEFINITIONS}")

add_subdirectory(include)
add_subdirectory(lib)
if(MLIR_ENABLE_BINDINGS_PYTHON)
message(STATUS "Enabling Python API")
add_subdirectory(python)
endif()

if(UNIX)
add_subdirectory(test)
add_subdirectory(finch-opt)
Expand Down
4 changes: 2 additions & 2 deletions include/Finch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ add_mlir_doc(FinchOps FinchOps Finch/ -gen-op-doc)

set(LLVM_TARGET_DEFINITIONS FinchPasses.td)
mlir_tablegen(FinchPasses.h.inc --gen-pass-decls)
#mlir_tablegen(FinchOpsTypes.h.inc -gen-typedef-decls -typedefs-dialect=finch)
#mlir_tablegen(FinchOpsTypes.cpp.inc -gen-typedef-defs -typedefs-dialect=finch)
# mlir_tablegen(FinchOpsTypes.h.inc -gen-typedef-decls -typedefs-dialect=finch)
# mlir_tablegen(FinchOpsTypes.cpp.inc -gen-typedef-defs -typedefs-dialect=finch)
add_public_tablegen_target(MLIRFinchPassesIncGen)

set(LLVM_TARGET_DEFINITIONS FinchTypes.td)
Expand Down
247 changes: 247 additions & 0 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[project]
authors = ["Hameer Abbasi <[email protected]>"]
channels = ["conda-forge"]
description = "Add a short description here"
name = "Finch-mlir"
platforms = ["osx-arm64"]
version = "0.1.0"

[tasks]

[dependencies]
python = ">=3.10"
python-build = "*"
Loading

0 comments on commit 42519cb

Please sign in to comment.