Skip to content

Commit

Permalink
Migrate package build to python-build
Browse files Browse the repository at this point in the history
  • Loading branch information
ZzEeKkAa committed Apr 30, 2024
1 parent 86056f6 commit 7f338b1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 111 deletions.
68 changes: 0 additions & 68 deletions .github/workflows/Windows-IntelLLVM_3.26.cmake

This file was deleted.

47 changes: 15 additions & 32 deletions conda-recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,29 @@ set "DPBENCH_SYCL=1"
set "CMAKE_GENERATOR=Ninja"
set "CC=icx"
set "CXX=icx"
:: Make CMake verbose
set "VERBOSE=1"

"%PYTHON%" setup.py clean --all

FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @(
REM set DIR_HINT if directory exists
IF EXIST "%BUILD_PREFIX%\Library\lib\clang\%%V\" (
SET "SYCL_INCLUDE_DIR_HINT=%BUILD_PREFIX%\Library\lib\clang\%%V"
)
%PYTHON% -m build -w -n -x
if %ERRORLEVEL% neq 0 exit 1

:: `pip install dist\numpy*.whl` does not work on windows,
:: so use a loop; there's only one wheel in dist/ anyway
for /f %%f in ('dir /b /S .\dist') do (
%PYTHON% -m wheel tags --remove --build %GIT_DESCRIBE_NUMBER% %%f
if %ERRORLEVEL% neq 0 exit 1
)

set "PATCHED_CMAKE_VERSION=3.26"
set "PLATFORM_DIR=%PREFIX%\Library\share\cmake-%PATCHED_CMAKE_VERSION%\Modules\Platform"
set "FN=Windows-IntelLLVM.cmake"

rem Save the original file, and copy patched file to
rem fix the issue with IntelLLVM integration with cmake on Windows
if EXIST "%PLATFORM_DIR%" (
dir "%PLATFORM_DIR%\%FN%"
copy /Y "%PLATFORM_DIR%\%FN%" .
if errorlevel 1 exit 1
copy /Y ".github\workflows\Windows-IntelLLVM_%PATCHED_CMAKE_VERSION%.cmake" "%PLATFORM_DIR%\%FN%"
if errorlevel 1 exit 1
:: wheel file was renamed
for /f %%f in ('dir /b /S .\dist') do (
%PYTHON% -m pip install %%f
if %ERRORLEVEL% neq 0 exit 1
)

@REM TODO: switch to pip build. Currently results in broken binary
@REM %PYTHON% -m pip install --no-index --no-deps --no-build-isolation . -v
:: Copy wheel package
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
rem Install and assemble wheel package from the build bits
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt bdist_wheel --build-number %GIT_DESCRIBE_NUMBER%
if errorlevel 1 exit 1
copy dist\dpbench*.whl %WHEELS_OUTPUT_FOLDER%
if errorlevel 1 exit 1
) ELSE (
rem Only install
"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt
if errorlevel 1 exit 1
)

rem copy back
if EXIST "%PLATFORM_DIR%" (
copy /Y "%FN%" "%PLATFORM_DIR%\%FN%"
if errorlevel 1 exit 1
)
20 changes: 9 additions & 11 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ export CMAKE_GENERATOR="Ninja"
export CC=icx
export CXX=icpx

if [ -e "_skbuild" ]; then
${PYTHON} setup.py clean --all
fi

# TODO: switch to pip build. Currently results in broken binary on Windows
# $PYTHON -m pip install --no-index --no-deps --no-build-isolation . -v

# Build wheel package
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
$PYTHON setup.py install --single-version-externally-managed --record=record.txt bdist_wheel -p manylinux2014_x86_64 --build-number $GIT_DESCRIBE_NUMBER
mkdir -p ${WHEELS_OUTPUT_FOLDER}
cp dist/dpbench*.whl ${WHEELS_OUTPUT_FOLDER}
else
$PYTHON setup.py install --single-version-externally-managed --record=record.txt
# -wnx flags mean: --wheel --no-isolation --skip-dependency-check
${PYTHON} -m build -w -n -x
${PYTHON} -m wheel tags --remove --build "$GIT_DESCRIBE_NUMBER" \
--platform-tag manylinux2014_x86_64 dist/dpbench*.whl
${PYTHON} -m pip install dist/dpbench*.whl

# Copy wheel package
if [[ -v WHEELS_OUTPUT_FOLDER ]]; then
cp dist/dpbench*.whl "${WHEELS_OUTPUT_FOLDER[@]}"
fi
3 changes: 3 additions & 0 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ requirements:
- sysroot_linux-64 >=2.28 # [linux]
host:
- python
- pip
{% for dep in py_build_deps %}
{% if dep.startswith('ninja') %}
- {{ dep.split(';')[0] }} # [not win]
{% elif dep.startswith('build>=') %}
- {{ 'python-' ~ dep }}
{% else %}
- {{ dep|replace('_','-') }}
{% endif %}
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ dpbench = "dpbench.console.entry:main"
# TODO: make it optional for no sycl build. Workaround: `--no-deps`.
# https://github.com/scikit-build/scikit-build/issues/981
requires = [
"wheel>=0.43",
"build>=1.1",
"setuptools>=63.0.0",
"scikit-build>=0.17.0", # sycl build dep
"ninja>=1.11.1; platform_system!='Windows'", # sycl build dep
Expand Down

0 comments on commit 7f338b1

Please sign in to comment.