Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Update setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed May 8, 2024
1 parent 6789566 commit fa762cb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
cibuildwheel --output-dir wheelhouse
- name: test
if: ${{ matrix.OS != 'windows-2019' }}
run: |
pushd wheelhouse
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ add_library(xaie SHARED ${AIERT_SRCS})
set_target_properties(xaie PROPERTIES LINKER_LANGUAGE C)
target_compile_options(xaie PRIVATE -D__AIECDO__)
target_link_libraries(xaie cdo_driver)
target_include_directories(xaie PUBLIC ${AIERT_INCLUDE_DIRECTORIES} ${BOOTGEN_SRC_DIR})
target_include_directories(xaie PUBLIC ${AIERT_INCLUDE_DIRECTORIES})
target_include_directories(xaie PUBLIC SYSTEM ${BOOTGEN_SRC_DIR})
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ before-all = [
"rm -rf *egg*",
]
build-verbosity = 3
build = "cp38-* cp39-* cp310-* cp311-* cp312-*"
#build = "cp38-* cp39-* cp310-* cp311-* cp312-*"
build = "cp311-*"
skip = ["*-manylinux_i686", "*-musllinux*"]
manylinux-aarch64-image = "manylinux_2_28"
manylinux-x86_64-image = "manylinux_2_28"
Expand All @@ -26,4 +27,3 @@ before-build = [

[tool.cibuildwheel.windows]
skip = ["*-win32"]
build = "cp38-* cp39-* cp310-* cp311-* cp312-*"
16 changes: 12 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def print_loader(self):
EXCLUDED_HEADERS = {"xaie_interrupt.h"}


def generate(xaie_build_include_dir: Path, output: Path):
def generate(xaie_build_include_dir: Path, output: Path, bootgen_include_dir: Path):
headers = list(
filter(
lambda f: Path(f).name not in EXCLUDED_HEADERS,
Expand All @@ -266,7 +266,7 @@ def generate(xaie_build_include_dir: Path, output: Path):
allow_gnu_c=False,
builtin_symbols=False,
compile_libdirs=[str(Path(__file__).parent)],
cpp="gcc -E",
cpp=f"gcc -E -I {bootgen_include_dir}",
cpp_defines=[],
cpp_undefines=[],
debug_level=0,
Expand Down Expand Up @@ -334,10 +334,12 @@ def build_extension(self, ext: CMakeExtension) -> None:
CMAKE_MODULE_PATH = str(
Path(__file__).parent / "third_party" / "aie-rt" / "fal" / "cmake"
)
BOOTGEN_INCLUDE_PATH = str(Path(__file__).parent / "third_party" / "bootgen")
if platform.system() == "Windows":
PYTHON_EXECUTABLE = PYTHON_EXECUTABLE.replace("\\", "\\\\")
# i have no clue - cmake parses these at different points...?
CMAKE_MODULE_PATH = CMAKE_MODULE_PATH.replace("\\", "//")
BOOTGEN_INCLUDE_PATH = BOOTGEN_INCLUDE_PATH.replace("\\", "//")

cmake_args = [
f"-B{build_temp}",
Expand All @@ -349,6 +351,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
f"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY={extdir / PACKAGE_NAME}",
f"-DPython3_EXECUTABLE={PYTHON_EXECUTABLE}",
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
"-DCMAKE_C_VISIBILITY_PRESET=default",
]
if platform.system() == "Windows":
cmake_args += [
Expand All @@ -357,7 +360,8 @@ def build_extension(self, ext: CMakeExtension) -> None:
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded",
"-DCMAKE_C_FLAGS=/MT",
"-DCMAKE_CXX_FLAGS=/MT",
"-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=True"
"-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON",
"-DCMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS=ON",
]

if "CMAKE_ARGS" in os.environ:
Expand Down Expand Up @@ -415,7 +419,11 @@ def build_extension(self, ext: CMakeExtension) -> None:
cwd=build_temp,
check=True,
)
generate(build_temp / "include", extdir / PACKAGE_NAME / "_xaie.py")
generate(
build_temp / "include",
extdir / PACKAGE_NAME / "_xaie.py",
BOOTGEN_INCLUDE_PATH,
)


build_temp = Path.cwd() / "build" / "temp"
Expand Down

0 comments on commit fa762cb

Please sign in to comment.