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

Commit

Permalink
fix windows?
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed May 15, 2024
1 parent 3536701 commit 62f1da2
Show file tree
Hide file tree
Showing 14 changed files with 988 additions and 107 deletions.
48 changes: 45 additions & 3 deletions .github/workflows/base/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ inputs:
ARCH:
description: 'matrix.arch'
required: true
PY_VERSION:
description: 'matrix.py_version'
required: true

description: ''

outputs:
BOOST_ROOT:
description: ''
value: ${{ steps.install_boost.outputs.BOOST_ROOT }}
BOOST_VERSION:
description: ''
value: 1.74.0

runs:
using: "composite"
Expand All @@ -22,12 +28,16 @@ runs:
uses: aminya/setup-cpp@v1
with:
compiler: gcc
vcvarsall: ${{ contains(inputs.OS, 'windows') }}
vcvarsall: ${{ contains(inputs.OS, 'windows') }} # evaluate to the string 'true'
msvc: ${{ contains(inputs.OS, 'windows') }}
choco: ${{ contains(inputs.OS, 'windows') }}
cmake: true
ninja: true

- uses: actions/setup-python@v4
with:
python-version: ${{ inputs.PY_VERSION }}

- uses: makslevental/mlir-wheels/actions/setup_ccache@d77bf5dc69c46a8c2738b44528749768888eb361
id: setup_ccache
with:
Expand All @@ -36,8 +46,40 @@ runs:
WORKSPACE_ROOT: ${{ github.workspace }}

- name: Install boost for XRT
if: contains(inputs.OS, 'windows') || contains(inputs.OS, 'ubuntu')
uses: MarkusJx/install-boost@v2.4.5
id: install_boost
with:
boost_version: 1.73.0
boost_version: 1.74.0

- name: Build and install system deps
shell: bash
run: |
if [ ${{ inputs.OS }} == 'windows-2019' ]; then
choco install -y pkgconfiglite protoc
else
sudo apt install -y libdrm-dev ocl-icd-opencl-dev rapidjson-dev libprotobuf-dev systemtap-sdt-dev uuid-dev python3-dev
fi
- name: Full checkout
shell: bash
run: |
git sparse-checkout disable
git submodule update --init --recursive
- name: Remove path limit and export VCTOOLSVERSION
if: contains(inputs.OS, 'windows')
shell: pwsh
run: |
pwsh.exe .\util\remove_path_limit.ps1
VCTOOLSVERSION=${VCTOOLSVERSION:0:4}
echo "VCTOOLSVERSION=$VCTOOLSVERSION" >> $GITHUB_ENV
- name: Install python deps
shell: bash
run: |
ls -lah
pip install -r requirements-dev.txt
68 changes: 18 additions & 50 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,45 +28,30 @@ jobs:
shell: bash

steps:

- name: Checkout actions
uses: actions/checkout@v3
with:
submodules: true

- name: Get recursive submodules
run: |
git submodule update --init --recursive
sparse-checkout: .github/workflows/base/action.yml
sparse-checkout-cone-mode: false

- uses: ./.github/workflows/base
id: base
with:
OS: ${{ matrix.OS }}
ARCH: ${{ matrix.ARCH }}

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.PY_VERSION }}

- name: Build and install protoc
if: contains(matrix.OS, 'windows') || contains(matrix.OS, 'ubuntu')
run: |
if [ ${{ matrix.OS }} == 'windows-2019' ]; then
choco install -y pkgconfiglite protoc
else
sudo apt install -y libdrm-dev ocl-icd-opencl-dev rapidjson-dev libprotobuf-dev systemtap-sdt-dev uuid-dev python3-dev
fi
PY_VERSION: ${{ matrix.PY_VERSION }}

- name: build wheel
env:
BOOST_ROOT: ${{ steps.base.outputs.BOOST_ROOT }}
BOOST_VERSION: 1.73.0
BOOST_VERSION: ${{ steps.base.outputs.BOOST_VERSION }}
run: |
REPO_SRC_DIR=$PWD bash patches/apply_patches.sh
pip install -r requirements-dev.txt
pip wheel . -v -w wheelhouse --no-build-isolation
CIBW_BUILD=${{ matrix.PY_VERSION }}
CIBW_BUILD="cp${CIBW_BUILD//./}-*"
echo "CIBW_BUILD=$CIBW_BUILD" | tee -a $GITHUB_OUTPUT
cibuildwheel --output-dir wheelhouse
- name: test
run: |
Expand Down Expand Up @@ -99,52 +84,35 @@ jobs:
PY_VERSION: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]

steps:

- name: Checkout actions
uses: actions/checkout@v3
with:
submodules: true

- name: Get recursive submodules
run: |
git submodule update --init --recursive
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: gcc
cmake: true
ninja: true
sparse-checkout: .github/workflows/base/action.yml
sparse-checkout-cone-mode: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: aarch64

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.PY_VERSION }}

- uses: ./.github/workflows/base
id: base
with:
OS: ${{ matrix.OS }}
ARCH: ${{ matrix.ARCH }}

- name: Install XRT deps
run: |
sudo apt install -y libdrm-dev ocl-icd-opencl-dev rapidjson-dev libprotobuf-dev systemtap-sdt-dev uuid-dev python3-dev
PY_VERSION: ${{ matrix.PY_VERSION }}

- name: build wheel
env:
BOOST_ROOT: ${{ steps.base.outputs.BOOST_ROOT }}
BOOST_VERSION: 1.73.0
BOOST_VERSION: ${{ steps.base.outputs.BOOST_VERSION }}
run: |
REPO_SRC_DIR=$PWD bash patches/apply_patches.sh
pip install -r requirements-dev.txt
pip wheel . -v -w wheelhouse --no-build-isolation
CIBW_BUILD=${{ matrix.PY_VERSION }}
CIBW_BUILD="cp${CIBW_BUILD//./}-*"
echo "CIBW_BUILD=$CIBW_BUILD" | tee -a $GITHUB_OUTPUT
cibuildwheel --output-dir wheelhouse
- name: test
run: |
Expand Down
43 changes: 17 additions & 26 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,24 @@ jobs:
- name: Checkout actions
uses: actions/checkout@v3
with:
submodules: true

- name: Get recursive submodules
run: |
git submodule update --init --recursive
sparse-checkout: .github/workflows/base/action.yml
sparse-checkout-cone-mode: false

- uses: ./.github/workflows/base
if: contains(matrix.OS, 'windows')
id: base
with:
OS: ${{ matrix.OS }}
ARCH: ${{ matrix.ARCH }}

- name: Build and install protoc
if: contains(matrix.OS, 'windows')
run: |
choco install -y pkgconfiglite protoc
PY_VERSION: '3.10'

# build

- name: cibuildwheel python bindings
env:
BOOST_ROOT: ${{ steps.base.outputs.BOOST_ROOT }}
BOOST_VERSION: 1.73.0
BOOST_VERSION: ${{ steps.base.outputs.BOOST_VERSION }}
run: |
pip install cibuildwheel
cibuildwheel --output-dir wheelhouse
# done
Expand All @@ -85,30 +74,32 @@ jobs:

steps:

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: aarch64

- name: Checkout actions
uses: actions/checkout@v3
with:
submodules: true
sparse-checkout: .github/workflows/base/action.yml
sparse-checkout-cone-mode: false

- name: Get recursive submodules
run: |
git submodule update --init --recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- uses: ./.github/workflows/base
id: base
with:
platforms: aarch64
OS: ubuntu-20.04
ARCH: aarch64
PY_VERSION: '3.10'

# build

- name: cibuildwheel python bindings aarch64
env:
BOOST_ROOT: ${{ steps.base.outputs.BOOST_ROOT }}
BOOST_VERSION: 1.73.0
BOOST_VERSION: ${{ steps.base.outputs.BOOST_VERSION }}
run: |
pip install cibuildwheel
cibuildwheel --output-dir wheelhouse
# done
Expand Down
18 changes: 15 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
cmake-build-debug
cmake-build-release
.envrc
cmake-build-*
.envrc
*.whl
*.zip
*.ilk
*.pyd
*.lib
*.exp
*.pdb
*.dll
*.json
*.pdi
*.bif
*.bin
*.xclbin
47 changes: 40 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,43 @@ if(POLICY CMP0148)
cmake_policy(SET CMP0148 NEW)
endif()

option(OUTPUT_DIR "Output directory" ${CMAKE_CURRENT_BINARY_DIR})
if(WIN32)
# see util/remove_path_limit.ps1
set(CMAKE_OBJECT_PATH_MAX 4096)
endif()

include(util/helpers.cmake)
set(OUTPUT_DIR
${CMAKE_CURRENT_BINARY_DIR}
CACHE STRING "Output directory")

if(NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
# if you open up the wrong developer shell in windows...
message(
FATAL_ERROR
"Something has gone terribly wrong: CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}"
)
endif()
# can delete after this is all worked out
# https://gitlab.kitware.com/cmake/cmake/-/issues/25702
find_package(OpenSSL)
if(NOT DEFINED OPENSSL_FOUND OR NOT ${OPENSSL_FOUND})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/util")
find_package(OpenSSL)
if(NOT DEFINED USE_OUR_FIND_OPENSSL OR NOT ${USE_OUR_FIND_OPENSSL})
message(FATAL_ERROR "Didn't pickup our FindOpenSSL.cmake")
endif()
if(NOT DEFINED OPENSSL_FOUND OR NOT ${OPENSSL_FOUND})
message(FATAL_ERROR "OpenSSL not found")
endif()
endif()
message(STATUS "OpenSSL include directories:" ${OPENSSL_INCLUDE_DIR})

include(util/helpers.cmake)
configure_python_dev_packages()
find_package(OpenSSL REQUIRED)

find_package(Threads REQUIRED)
find_package(Boost REQUIRED COMPONENTS system program_options filesystem)
message(STATUS "Boost include directories:" ${Boost_INCLUDE_DIRS})

# ##############################################################################
# bootgen
Expand Down Expand Up @@ -69,7 +98,6 @@ if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
set(XAIE_DEBUG "XAIE_DEBUG")
endif()

target_compile_options(aienginev2 PRIVATE -Wall -Wextra -D__AIECDO__)
target_compile_definitions(aienginev2 PUBLIC ${XAIE_DEBUG})
get_target_property(AIERT_SRCS aienginev2 SOURCES)
list(TRANSFORM AIERT_SRCS PREPEND ${AIERT_SRC_DIR}/)
Expand Down Expand Up @@ -135,17 +163,22 @@ if(NOT WIN32)
target_compile_definitions(xclbinutil-lib
PUBLIC ENABLE_JSON_SCHEMA_VALIDATION)
target_link_libraries(xclbinutil-lib PUBLIC transformcdo)
else()
target_compile_options(xclbinutil-lib PUBLIC "/EHsc")
# LINK : fatal error LNK1104: cannot open file
# 'libboost_filesystem-vc142-mt-gd-x64-1_74.lib'
target_compile_definitions(xclbinutil-lib PUBLIC BOOST_ALL_DYN_LINK)
endif()

set(THREADS_PREFER_PTHREAD_FLAG ON)
target_link_libraries(xclbinutil-lib PUBLIC ${Boost_LIBRARIES} Threads::Threads)
target_include_directories(xclbinutil-lib PUBLIC ${XRT_BINARY_DIR}/gen)
target_include_directories(xclbinutil-lib PUBLIC ${XRT_BINARY_DIR}/gen
${Boost_INCLUDE_DIRS})
set_target_properties(
xclbinutil-lib
PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIR}
ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIR}
RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})

pybind11_add_module(_xclbinutil xaiepy/xclbinutil.cpp)
target_include_directories(_xclbinutil PRIVATE ${XCLBINUTIL_SOURCE_DIR})
Expand Down
Loading

0 comments on commit 62f1da2

Please sign in to comment.