mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-26 16:03:08 +03:00
extract remaining libs
This commit is contained in:
parent
7b70265e69
commit
9784874dc6
94
.github/workflows/test-windows.yml
vendored
94
.github/workflows/test-windows.yml
vendored
|
@ -61,11 +61,9 @@ jobs:
|
||||||
- name: Fetch dependencies
|
- name: Fetch dependencies
|
||||||
run: |
|
run: |
|
||||||
7z x ..\pillow-depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\"
|
7z x ..\pillow-depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\"
|
||||||
Write-Host "`#`#[add-path]$env:RUNNER_WORKSPACE\nasm-2.14.02"
|
|
||||||
Write-Host "::add-path::$env:RUNNER_WORKSPACE\nasm-2.14.02"
|
Write-Host "::add-path::$env:RUNNER_WORKSPACE\nasm-2.14.02"
|
||||||
|
|
||||||
..\pillow-depends\gs950w32.exe /S
|
..\pillow-depends\gs950w32.exe /S
|
||||||
Write-Host "`#`#[add-path]C:\Program Files (x86)\gs\gs9.50\bin"
|
|
||||||
Write-Host "::add-path::C:\Program Files (x86)\gs\gs9.50\bin"
|
Write-Host "::add-path::C:\Program Files (x86)\gs\gs9.50\bin"
|
||||||
|
|
||||||
$env:PYTHON=$env:pythonLocation
|
$env:PYTHON=$env:pythonLocation
|
||||||
|
@ -76,7 +74,7 @@ jobs:
|
||||||
cd $env:GITHUB_WORKSPACE/winbuild/
|
cd $env:GITHUB_WORKSPACE/winbuild/
|
||||||
# reg query "HKLM\Software\Microsoft\Microsoft SDKs\Windows" /s
|
# reg query "HKLM\Software\Microsoft\Microsoft SDKs\Windows" /s
|
||||||
ls 'C:\Program Files (x86)\Microsoft SDKs\Windows\'
|
ls 'C:\Program Files (x86)\Microsoft SDKs\Windows\'
|
||||||
python.exe $env:GITHUB_WORKSPACE\winbuild\build_prepare.py
|
& python.exe $env:GITHUB_WORKSPACE\winbuild\build_prepare.py
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
- name: Build dependencies / libjpeg
|
- name: Build dependencies / libjpeg
|
||||||
|
@ -97,84 +95,15 @@ jobs:
|
||||||
# GPL licensed; skip if building wheels
|
# GPL licensed; skip if building wheels
|
||||||
- name: Build dependencies / libimagequant
|
- name: Build dependencies / libimagequant
|
||||||
if: "github.event_name != 'push' || contains(matrix.python-version, 'pypy')"
|
if: "github.event_name != 'push' || contains(matrix.python-version, 'pypy')"
|
||||||
run: |
|
run: "& .\\winbuild\\build_dep_libimagequant.cmd"
|
||||||
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
|
|
||||||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
|
||||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
|
||||||
rem e5d454b: Merge tag '2.12.6' into msvc
|
|
||||||
cd /D %BUILD%\libimagequant-e5d454bc7f5eb63ee50c84a83a7fa5ac94f68ec4
|
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
|
|
||||||
echo on
|
|
||||||
echo (gc CMakeLists.txt) -replace 'add_library', "add_compile_options(-openmp-)`r`nadd_library" ^| Out-File -encoding ASCII CMakeLists.txt > patch.ps1
|
|
||||||
echo (gc CMakeLists.txt) -replace ' SHARED', ' STATIC' ^| Out-File -encoding ASCII CMakeLists.txt >> patch.ps1
|
|
||||||
powershell .\patch.ps1
|
|
||||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
|
||||||
set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release
|
|
||||||
%CMAKE% -G "NMake Makefiles" .
|
|
||||||
nmake -nologo -f Makefile clean
|
|
||||||
nmake -nologo -f Makefile
|
|
||||||
copy /Y /B *.h %INCLIB%
|
|
||||||
copy /Y /B *.lib %INCLIB%
|
|
||||||
shell: cmd
|
|
||||||
|
|
||||||
# for Raqm
|
# Raqm dependencies
|
||||||
- name: Build dependencies / HarfBuzz
|
- name: Build dependencies / HarfBuzz
|
||||||
run: |
|
run: "& .\\winbuild\\build_dep_harfbuzz.cmd"
|
||||||
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
|
|
||||||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
|
||||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
|
||||||
set INCLUDE=%INCLUDE%;%INCLIB%
|
|
||||||
set LIB=%LIB%;%INCLIB%
|
|
||||||
cd /D %BUILD%\harfbuzz-2.6.4
|
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
|
|
||||||
echo on
|
|
||||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
|
||||||
set CMAKE=%CMAKE% -DHB_HAVE_FREETYPE:BOOL=ON -DCMAKE_BUILD_TYPE=Release
|
|
||||||
%CMAKE% -G "NMake Makefiles" .
|
|
||||||
nmake -nologo -f Makefile clean
|
|
||||||
nmake -nologo -f Makefile harfbuzz
|
|
||||||
copy /Y /B src\*.h %INCLIB%
|
|
||||||
copy /Y /B *.lib %INCLIB%
|
|
||||||
shell: cmd
|
|
||||||
|
|
||||||
# for Raqm
|
|
||||||
- name: Build dependencies / FriBidi
|
- name: Build dependencies / FriBidi
|
||||||
run: |
|
run: "& .\\winbuild\\build_dep_fribidi.cmd"
|
||||||
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
|
|
||||||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
|
||||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
|
||||||
cd /D %BUILD%\fribidi-1.0.9
|
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
|
|
||||||
echo on
|
|
||||||
copy /Y /B %GITHUB_WORKSPACE%\winbuild\fribidi.cmake CMakeLists.txt
|
|
||||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
|
||||||
set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release
|
|
||||||
%CMAKE% -G "NMake Makefiles" .
|
|
||||||
nmake -nologo -f Makefile clean
|
|
||||||
nmake -nologo -f Makefile fribidi
|
|
||||||
copy /Y /B lib\*.h %INCLIB%
|
|
||||||
copy /Y /B *.lib %INCLIB%
|
|
||||||
shell: cmd
|
|
||||||
|
|
||||||
- name: Build dependencies / Raqm
|
- name: Build dependencies / Raqm
|
||||||
run: |
|
run: "& .\\winbuild\\build_dep_libraqm.cmd"
|
||||||
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
|
|
||||||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
|
||||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
|
||||||
set INCLUDE=%INCLUDE%;%INCLIB%
|
|
||||||
set LIB=%LIB%;%INCLIB%
|
|
||||||
cd /D %BUILD%\libraqm-0.7.0
|
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
|
|
||||||
echo on
|
|
||||||
copy /Y /B %GITHUB_WORKSPACE%\winbuild\raqm.cmake CMakeLists.txt
|
|
||||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
|
||||||
set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release
|
|
||||||
%CMAKE% -G "NMake Makefiles" .
|
|
||||||
nmake -nologo -f Makefile clean
|
|
||||||
nmake -nologo -f Makefile libraqm
|
|
||||||
copy /Y /B src\*.h %INCLIB%
|
|
||||||
copy /Y /B libraqm.dll %INCLIB%
|
|
||||||
shell: cmd
|
|
||||||
|
|
||||||
- name: Build Pillow
|
- name: Build Pillow
|
||||||
run: |
|
run: |
|
||||||
|
@ -188,9 +117,7 @@ jobs:
|
||||||
# failing with PyPy3
|
# failing with PyPy3
|
||||||
- name: Enable heap verification
|
- name: Enable heap verification
|
||||||
if: "!contains(matrix.python-version, 'pypy')"
|
if: "!contains(matrix.python-version, 'pypy')"
|
||||||
run: |
|
run: "& 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x86\\gflags.exe' /p /enable $env:pythonLocation\\python.exe"
|
||||||
c:\"Program Files (x86)"\"Windows Kits"\10\Debuggers\x86\gflags.exe /p /enable %PYTHON%\python.exe
|
|
||||||
shell: cmd
|
|
||||||
|
|
||||||
- name: Test Pillow
|
- name: Test Pillow
|
||||||
run: |
|
run: |
|
||||||
|
@ -226,12 +153,15 @@ jobs:
|
||||||
- name: Build wheel
|
- name: Build wheel
|
||||||
id: wheel
|
id: wheel
|
||||||
if: "github.event_name == 'push' && !contains(matrix.python-version, 'pypy')"
|
if: "github.event_name == 'push' && !contains(matrix.python-version, 'pypy')"
|
||||||
run: "%GITHUB_WORKSPACE%\\winbuild\\build_pillow.cmd bdist_wheel"
|
run: |
|
||||||
|
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ::set-output name=dist::dist-%%a
|
||||||
|
%GITHUB_WORKSPACE%\\winbuild\\build_pillow.cmd bdist_wheel"
|
||||||
|
shell: cmd
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v1
|
- uses: actions/upload-artifact@v1
|
||||||
if: "github.event_name == 'push' && !contains(matrix.python-version, 'pypy')"
|
if: "github.event_name == 'push' && !contains(matrix.python-version, 'pypy')"
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: ${{ steps.wheel.outputs.dist }}
|
||||||
path: dist
|
path: dist
|
||||||
|
|
||||||
# - uses: actions/upload-artifact@v1
|
# - uses: actions/upload-artifact@v1
|
||||||
|
|
|
@ -15,36 +15,15 @@ architectures = {
|
||||||
"x64": {"vcvars_arch": "x86_amd64", "msbuild_arch": "x64"},
|
"x64": {"vcvars_arch": "x86_amd64", "msbuild_arch": "x64"},
|
||||||
}
|
}
|
||||||
|
|
||||||
# use PYTHON + architecture to select config
|
|
||||||
pythons = {
|
|
||||||
"pypy3.6": {"config-x86": "3.5"},
|
|
||||||
"3.5": {"config-x86": "3.5", "config-x64": "3.5"},
|
|
||||||
"3.6": {"config-x86": "3.6", "config-x64": "3.6"},
|
|
||||||
"3.7": {"config-x86": "3.6", "config-x64": "3.6"},
|
|
||||||
}
|
|
||||||
|
|
||||||
# select preferred compiler
|
# select preferred compiler
|
||||||
configs = {
|
pythons = {
|
||||||
"3.5": {
|
"pypy3.6": {"vs_ver": "2015", "vcvars_ver": "14.0"},
|
||||||
"vcvars_ver": "14.0",
|
"3.5": {"vs_ver": "2015", "vcvars_ver": "14.0"},
|
||||||
"vs_ver": "2015",
|
"3.6": {"vs_ver": "2017"},
|
||||||
},
|
"3.7": {"vs_ver": "2017"},
|
||||||
"3.6": {
|
"3.8": {"vs_ver": "2017"}, # TODO check
|
||||||
"vs_ver": "2017",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# selected dependencies
|
|
||||||
deps_list = [
|
|
||||||
"libjpeg-turbo-2.0.3",
|
|
||||||
"zlib-1.2.11",
|
|
||||||
"tiff-4.0.10",
|
|
||||||
"libwebp-1.0.3",
|
|
||||||
"freetype-2.10.1",
|
|
||||||
"lcms2-2.9",
|
|
||||||
"openjpeg-2.3.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
header = [
|
header = [
|
||||||
cmd_set("BUILD", "{build_dir}"),
|
cmd_set("BUILD", "{build_dir}"),
|
||||||
cmd_set("INCLUDE", "{inc_dir}"),
|
cmd_set("INCLUDE", "{inc_dir}"),
|
||||||
|
@ -55,16 +34,18 @@ header = [
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
deps = {
|
deps = {
|
||||||
"libjpeg-turbo-2.0.3": {
|
"libjpeg": {
|
||||||
"name": "libjpeg",
|
|
||||||
"url": SF_MIRROR + "/project/libjpeg-turbo/2.0.3/libjpeg-turbo-2.0.3.tar.gz",
|
"url": SF_MIRROR + "/project/libjpeg-turbo/2.0.3/libjpeg-turbo-2.0.3.tar.gz",
|
||||||
"filename": "libjpeg-turbo-2.0.3.tar.gz",
|
"filename": "libjpeg-turbo-2.0.3.tar.gz",
|
||||||
|
"dir": "libjpeg-turbo-2.0.3",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_cmake([
|
cmd_cmake(
|
||||||
|
[
|
||||||
"-DENABLE_SHARED:BOOL=FALSE",
|
"-DENABLE_SHARED:BOOL=FALSE",
|
||||||
"-DWITH_JPEG8:BOOL=TRUE",
|
"-DWITH_JPEG8:BOOL=TRUE",
|
||||||
"-DWITH_CRT_DLL:BOOL=TRUE",
|
"-DWITH_CRT_DLL:BOOL=TRUE",
|
||||||
]),
|
]
|
||||||
|
),
|
||||||
cmd_nmake(target="clean"),
|
cmd_nmake(target="clean"),
|
||||||
cmd_nmake(target="jpeg-static"),
|
cmd_nmake(target="jpeg-static"),
|
||||||
cmd_copy("jpeg-static.lib", "libjpeg.lib"),
|
cmd_copy("jpeg-static.lib", "libjpeg.lib"),
|
||||||
|
@ -77,10 +58,10 @@ deps = {
|
||||||
"libs": ["libjpeg.lib"],
|
"libs": ["libjpeg.lib"],
|
||||||
"bins": ["cjpeg.exe", "djpeg.exe"],
|
"bins": ["cjpeg.exe", "djpeg.exe"],
|
||||||
},
|
},
|
||||||
"zlib-1.2.11": {
|
"zlib": {
|
||||||
"name": "zlib",
|
|
||||||
"url": "http://zlib.net/zlib1211.zip",
|
"url": "http://zlib.net/zlib1211.zip",
|
||||||
"filename": "zlib1211.zip",
|
"filename": "zlib1211.zip",
|
||||||
|
"dir": "zlib-1.2.11",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_nmake(r"win32\Makefile.msc", "clean"),
|
cmd_nmake(r"win32\Makefile.msc", "clean"),
|
||||||
cmd_nmake(r"win32\Makefile.msc", "zlib.lib"),
|
cmd_nmake(r"win32\Makefile.msc", "zlib.lib"),
|
||||||
|
@ -89,82 +70,90 @@ deps = {
|
||||||
"headers": [r"z*.h"],
|
"headers": [r"z*.h"],
|
||||||
"libs": [r"*.lib"],
|
"libs": [r"*.lib"],
|
||||||
},
|
},
|
||||||
"tiff-4.0.10": {
|
"libtiff": {
|
||||||
"name": "libtiff",
|
|
||||||
# FIXME FTP timeout
|
# FIXME FTP timeout
|
||||||
"url": "ftp://download.osgeo.org/libtiff/tiff-4.0.10.tar.gz",
|
"url": "ftp://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz",
|
||||||
"filename": "tiff-4.0.10.tar.gz",
|
"filename": "tiff-4.1.0.tar.gz",
|
||||||
|
"dir": "tiff-4.1.0",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_copy(r"{script_dir}\tiff.opt", "nmake.opt"),
|
cmd_copy(r"{script_dir}\tiff.opt", "nmake.opt"),
|
||||||
cmd_nmake("makefile.vc", "clean"),
|
cmd_nmake("makefile.vc", "clean"),
|
||||||
cmd_nmake("makefile.vc", "lib", "RuntimeLibrary=-MT"),
|
cmd_nmake("makefile.vc", "lib"),
|
||||||
],
|
],
|
||||||
"headers": [r"libtiff\tiff*.h"],
|
"headers": [r"libtiff\tiff*.h"],
|
||||||
"libs": [r"libtiff\*.lib"],
|
"libs": [r"libtiff\*.lib"],
|
||||||
# "bins": [r"libtiff\*.dll"],
|
# "bins": [r"libtiff\*.dll"],
|
||||||
},
|
},
|
||||||
"libwebp-1.0.3": {
|
"libwebp": {
|
||||||
"name": "libwebp",
|
|
||||||
"url": "http://downloads.webmproject.org/releases/webp/libwebp-1.0.3.tar.gz", # noqa: E501
|
"url": "http://downloads.webmproject.org/releases/webp/libwebp-1.0.3.tar.gz", # noqa: E501
|
||||||
"filename": "libwebp-1.0.3.tar.gz",
|
"filename": "libwebp-1.0.3.tar.gz",
|
||||||
|
"dir": "libwebp-1.0.3",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_rmdir(r"output\release-static"), # clean
|
cmd_rmdir(r"output\release-static"), # clean
|
||||||
cmd_nmake(
|
cmd_nmake(
|
||||||
"Makefile.vc",
|
"Makefile.vc",
|
||||||
"all",
|
"all",
|
||||||
["CFG=release-static", "OBJDIR=output", "ARCH={architecture}"]
|
["CFG=release-static", "OBJDIR=output", "ARCH={architecture}"],
|
||||||
),
|
),
|
||||||
cmd_mkdir(r"{inc_dir}\webp"),
|
cmd_mkdir(r"{inc_dir}\webp"),
|
||||||
cmd_copy(r"src\webp\*.h", r"{inc_dir}\webp"),
|
cmd_copy(r"src\webp\*.h", r"{inc_dir}\webp"),
|
||||||
],
|
],
|
||||||
"libs": [r"output\release-static\{architecture}\lib\*.lib"],
|
"libs": [r"output\release-static\{architecture}\lib\*.lib"],
|
||||||
},
|
},
|
||||||
"freetype-2.10.1": {
|
"freetype": {
|
||||||
"name": "freetype",
|
|
||||||
"url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz", # noqa: E501
|
"url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz", # noqa: E501
|
||||||
"filename": "freetype-2.10.1.tar.gz",
|
"filename": "freetype-2.10.1.tar.gz",
|
||||||
|
"dir": "freetype-2.10.1",
|
||||||
"patch": {
|
"patch": {
|
||||||
r"builds\windows\vc2010\freetype.vcxproj": {
|
r"builds\windows\vc2010\freetype.vcxproj": {
|
||||||
# freetype setting is /MD for .dll and /MT for .lib, we need /MD
|
# freetype setting is /MD for .dll and /MT for .lib, we need /MD
|
||||||
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>": "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>",
|
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>":
|
||||||
},
|
"<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"build": [
|
"build": [
|
||||||
cmd_rmdir("objs"),
|
cmd_rmdir("objs"),
|
||||||
cmd_msbuild(r"builds\windows\vc2010\freetype.sln", "Release Static", "Clean"), # TODO failing on GHA # noqa: E501
|
cmd_msbuild(
|
||||||
cmd_msbuild(r"builds\windows\vc2010\freetype.sln", "Release Static", "Build"),
|
r"builds\windows\vc2010\freetype.sln", "Release Static", "Clean"
|
||||||
|
),
|
||||||
|
cmd_msbuild(
|
||||||
|
r"builds\windows\vc2010\freetype.sln", "Release Static", "Build"
|
||||||
|
),
|
||||||
cmd_xcopy("include", "{inc_dir}"),
|
cmd_xcopy("include", "{inc_dir}"),
|
||||||
],
|
],
|
||||||
"libs": [r"objs\{msbuild_arch}\Release Static\freetype.lib"],
|
"libs": [r"objs\{msbuild_arch}\Release Static\freetype.lib"],
|
||||||
# "bins": [r"objs\{msbuild_arch}\Release\freetype.dll"],
|
# "bins": [r"objs\{msbuild_arch}\Release\freetype.dll"],
|
||||||
},
|
},
|
||||||
"lcms2-2.9": {
|
"lcms2": {
|
||||||
"name": "lcms2",
|
|
||||||
"url": SF_MIRROR + "/project/lcms/lcms/2.9/lcms2-2.9.tar.gz",
|
"url": SF_MIRROR + "/project/lcms/lcms/2.9/lcms2-2.9.tar.gz",
|
||||||
"filename": "lcms2-2.9.tar.gz",
|
"filename": "lcms2-2.9.tar.gz",
|
||||||
|
"dir": "lcms2-2.9",
|
||||||
"patch": {
|
"patch": {
|
||||||
r"Projects\VC2017\lcms2_static\lcms2_static.vcxproj": {
|
r"Projects\VC2017\lcms2_static\lcms2_static.vcxproj": {
|
||||||
# lcms2-2.8\VC2015 setting is /MD for x86 and /MT for x64, we need /MD always
|
# default is /MD for x86 and /MT for x64, we need /MD always
|
||||||
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>": "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>",
|
"<RuntimeLibrary>MultiThreaded</RuntimeLibrary>":
|
||||||
# retarget to default msvc
|
"<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>",
|
||||||
"<PlatformToolset>v141</PlatformToolset>": "<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>",
|
# retarget to default toolset (selected by vcvarsall.bat)
|
||||||
# retarget to latest SDK 10.0
|
"<PlatformToolset>v141</PlatformToolset>":
|
||||||
"<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>": "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>",
|
"<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>",
|
||||||
},
|
# retarget to latest (selected by vcvarsall.bat)
|
||||||
|
"<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>":
|
||||||
|
"<WindowsTargetPlatformVersion>$(WindowsSDKVersion)</WindowsTargetPlatformVersion>", # noqa E501
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"build": [
|
"build": [
|
||||||
cmd_rmdir("Lib"),
|
cmd_rmdir("Lib"),
|
||||||
cmd_rmdir(r"Projects\VC{vs_ver}\Release"),
|
cmd_rmdir(r"Projects\VC2017\Release"),
|
||||||
cmd_msbuild(r"Projects\VC{vs_ver}\lcms2.sln", "Release", "Clean"),
|
cmd_msbuild(r"Projects\VC2017\lcms2.sln", "Release", "Clean"),
|
||||||
cmd_msbuild(r"Projects\VC{vs_ver}\lcms2.sln", "Release", "lcms2_static"),
|
cmd_msbuild(r"Projects\VC2017\lcms2.sln", "Release", "lcms2_static"),
|
||||||
cmd_xcopy("include", "{inc_dir}"),
|
cmd_xcopy("include", "{inc_dir}"),
|
||||||
],
|
],
|
||||||
"libs": [r"Lib\MS\*.lib"],
|
"libs": [r"Lib\MS\*.lib"],
|
||||||
},
|
},
|
||||||
"openjpeg-2.3.1": {
|
"openjpeg": {
|
||||||
"name": "openjpeg",
|
|
||||||
"url": "https://github.com/uclouvain/openjpeg/archive/v2.3.1.tar.gz",
|
"url": "https://github.com/uclouvain/openjpeg/archive/v2.3.1.tar.gz",
|
||||||
"filename": "openjpeg-2.3.1.tar.gz",
|
"filename": "openjpeg-2.3.1.tar.gz",
|
||||||
|
"dir": "openjpeg-2.3.1",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_cmake(("-DBUILD_THIRDPARTY:BOOL=OFF", "-DBUILD_SHARED_LIBS:BOOL=OFF")),
|
cmd_cmake(("-DBUILD_THIRDPARTY:BOOL=OFF", "-DBUILD_SHARED_LIBS:BOOL=OFF")),
|
||||||
cmd_nmake(target="clean"),
|
cmd_nmake(target="clean"),
|
||||||
|
@ -174,6 +163,64 @@ deps = {
|
||||||
],
|
],
|
||||||
"libs": [r"bin\*.lib"],
|
"libs": [r"bin\*.lib"],
|
||||||
},
|
},
|
||||||
|
"libimagequant": {
|
||||||
|
# ba653c8: Merge tag '2.12.5' into msvc
|
||||||
|
"url": "https://github.com/ImageOptim/libimagequant/archive/ba653c8ccb34dde4e21c6076d85a72d21ed9d971.zip", # noqa: E501
|
||||||
|
"filename": "libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971.zip",
|
||||||
|
"dir": "libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971",
|
||||||
|
"patch": {
|
||||||
|
"CMakeLists.txt": {
|
||||||
|
"add_library": "add_compile_options(-openmp-)\r\nadd_library",
|
||||||
|
" SHARED": " STATIC",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"build": [
|
||||||
|
# lint: do not inline
|
||||||
|
cmd_cmake(),
|
||||||
|
cmd_nmake(target="clean"),
|
||||||
|
cmd_nmake(),
|
||||||
|
],
|
||||||
|
"headers": [r"*.h"],
|
||||||
|
"libs": [r"*.lib"],
|
||||||
|
},
|
||||||
|
"harfbuzz": {
|
||||||
|
"url": "https://github.com/harfbuzz/harfbuzz/archive/2.6.1.zip",
|
||||||
|
"filename": "harfbuzz-2.6.1.zip",
|
||||||
|
"dir": "harfbuzz-2.6.1",
|
||||||
|
"build": [
|
||||||
|
cmd_cmake("-DHB_HAVE_FREETYPE:BOOL=TRUE"),
|
||||||
|
cmd_nmake(target="clean"),
|
||||||
|
cmd_nmake(target="harfbuzz"),
|
||||||
|
],
|
||||||
|
"headers": [r"src\*.h"],
|
||||||
|
"libs": [r"*.lib"],
|
||||||
|
},
|
||||||
|
"fribidi": {
|
||||||
|
"url": "https://github.com/fribidi/fribidi/archive/v1.0.7.zip",
|
||||||
|
"filename": "fribidi-1.0.7.zip",
|
||||||
|
"dir": "fribidi-1.0.7",
|
||||||
|
"build": [
|
||||||
|
cmd_copy(r"{script_dir}\fribidi.cmake", r"CMakeLists.txt"),
|
||||||
|
cmd_cmake(),
|
||||||
|
cmd_nmake(target="clean"),
|
||||||
|
cmd_nmake(target="fribidi"),
|
||||||
|
],
|
||||||
|
"headers": [r"lib\*.h"],
|
||||||
|
"libs": [r"*.lib"],
|
||||||
|
},
|
||||||
|
"libraqm": {
|
||||||
|
"url": "https://github.com/HOST-Oman/libraqm/archive/v0.7.0.zip",
|
||||||
|
"filename": "libraqm-0.7.0.zip",
|
||||||
|
"dir": "libraqm-0.7.0",
|
||||||
|
"build": [
|
||||||
|
cmd_copy(r"{script_dir}\raqm.cmake", r"CMakeLists.txt"),
|
||||||
|
cmd_cmake(),
|
||||||
|
cmd_nmake(target="clean"),
|
||||||
|
cmd_nmake(target="libraqm"),
|
||||||
|
],
|
||||||
|
"headers": [r"src\*.h"],
|
||||||
|
"bins": [r"libraqm.dll"],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,14 +232,25 @@ def find_vs2017(config):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
vspath = subprocess.check_output([
|
vspath = (
|
||||||
os.path.join(root, "Microsoft Visual Studio", "Installer", "vswhere.exe"),
|
subprocess.check_output(
|
||||||
|
[
|
||||||
|
os.path.join(
|
||||||
|
root, "Microsoft Visual Studio", "Installer", "vswhere.exe"
|
||||||
|
),
|
||||||
"-latest",
|
"-latest",
|
||||||
"-prerelease",
|
"-prerelease",
|
||||||
"-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
"-requires",
|
||||||
"-property", "installationPath",
|
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||||
"-products", "*",
|
"-property",
|
||||||
]).decode(encoding="mbcs").strip()
|
"installationPath",
|
||||||
|
"-products",
|
||||||
|
"*",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
.decode(encoding="mbcs")
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
except (subprocess.CalledProcessError, OSError, UnicodeDecodeError):
|
except (subprocess.CalledProcessError, OSError, UnicodeDecodeError):
|
||||||
print("vswhere not found")
|
print("vswhere not found")
|
||||||
return None
|
return None
|
||||||
|
@ -211,13 +269,13 @@ def find_vs2017(config):
|
||||||
# vs2017
|
# vs2017
|
||||||
msbuild = os.path.join(vspath, "MSBuild", "15.0", "Bin", "MSBuild.exe")
|
msbuild = os.path.join(vspath, "MSBuild", "15.0", "Bin", "MSBuild.exe")
|
||||||
if os.path.isfile(msbuild):
|
if os.path.isfile(msbuild):
|
||||||
default_platform_toolset = "v140"
|
# default_platform_toolset = "v140"
|
||||||
vs["msbuild"] = '"{}"'.format(msbuild)
|
vs["msbuild"] = '"{}"'.format(msbuild)
|
||||||
else:
|
else:
|
||||||
# vs2019
|
# vs2019
|
||||||
msbuild = os.path.join(vspath, "MSBuild", "Current", "Bin", "MSBuild.exe")
|
msbuild = os.path.join(vspath, "MSBuild", "Current", "Bin", "MSBuild.exe")
|
||||||
if os.path.isfile(msbuild):
|
if os.path.isfile(msbuild):
|
||||||
default_platform_toolset = "v142"
|
# default_platform_toolset = "v142"
|
||||||
vs["msbuild"] = '"{}"'.format(msbuild)
|
vs["msbuild"] = '"{}"'.format(msbuild)
|
||||||
else:
|
else:
|
||||||
print("Visual Studio MSBuild not found")
|
print("Visual Studio MSBuild not found")
|
||||||
|
@ -228,7 +286,9 @@ def find_vs2017(config):
|
||||||
if not os.path.isfile(vcvarsall):
|
if not os.path.isfile(vcvarsall):
|
||||||
print("Visual Studio vcvarsall not found")
|
print("Visual Studio vcvarsall not found")
|
||||||
return None
|
return None
|
||||||
vcvars_ver = "-vcvars_ver={}".format(config["vcvars_ver"]) if "vcvars_ver" in config else ""
|
vcvars_ver = (
|
||||||
|
"-vcvars_ver={}".format(config["vcvars_ver"]) if "vcvars_ver" in config else ""
|
||||||
|
)
|
||||||
vs["header"].append('call "{}" {{vcvars_arch}} {}'.format(vcvarsall, vcvars_ver))
|
vs["header"].append('call "{}" {{vcvars_arch}} {}'.format(vcvarsall, vcvars_ver))
|
||||||
|
|
||||||
return vs
|
return vs
|
||||||
|
@ -338,22 +398,23 @@ def get_footer(dep):
|
||||||
|
|
||||||
def build_dep(name):
|
def build_dep(name):
|
||||||
dep = deps[name]
|
dep = deps[name]
|
||||||
file = "build_dep_{name}.cmd".format(name=dep["name"])
|
dir = dep["dir"]
|
||||||
|
file = "build_dep_{name}.cmd".format(**locals())
|
||||||
|
|
||||||
extract_dep(dep["url"], dep["filename"])
|
extract_dep(dep["url"], dep["filename"])
|
||||||
|
|
||||||
for patch_file, patch_list in dep.get("patch", {}).items():
|
for patch_file, patch_list in dep.get("patch", {}).items():
|
||||||
patch_file = os.path.join(build_dir, name, patch_file)
|
patch_file = os.path.join(build_dir, dir, patch_file.format(**prefs))
|
||||||
with open(patch_file, "r") as f:
|
with open(patch_file, "r") as f:
|
||||||
text = f.read()
|
text = f.read()
|
||||||
for patch_from, patch_to in patch_list.items():
|
for patch_from, patch_to in patch_list.items():
|
||||||
text = text.replace(patch_from, patch_to)
|
text = text.replace(patch_from.format(**prefs), patch_to.format(**prefs))
|
||||||
with open(patch_file, "w") as f:
|
with open(patch_file, "w") as f:
|
||||||
f.write(text)
|
f.write(text)
|
||||||
|
|
||||||
lines = [
|
lines = [
|
||||||
"@echo Building {name} ({dir})...".format(name=dep["name"], dir=name),
|
"@echo ---- Building {name} ({dir}) ----".format(**locals()),
|
||||||
"cd /D %s" % os.path.join(build_dir, name),
|
"cd /D %s" % os.path.join(build_dir, dir),
|
||||||
*prefs["header"],
|
*prefs["header"],
|
||||||
*dep.get("build", []),
|
*dep.get("build", []),
|
||||||
*get_footer(dep),
|
*get_footer(dep),
|
||||||
|
@ -368,7 +429,7 @@ def build_dep_all():
|
||||||
"$ErrorActionPreference = 'stop'",
|
"$ErrorActionPreference = 'stop'",
|
||||||
"cd {script_dir}",
|
"cd {script_dir}",
|
||||||
]
|
]
|
||||||
for dep_name in deps_list:
|
for dep_name in deps:
|
||||||
lines.append('cmd.exe /c "%s"' % build_dep(dep_name))
|
lines.append('cmd.exe /c "%s"' % build_dep(dep_name))
|
||||||
write_script("build_dep_all.ps1", lines)
|
write_script("build_dep_all.ps1", lines)
|
||||||
|
|
||||||
|
@ -380,10 +441,13 @@ def build_pillow(wheel=False):
|
||||||
lines.extend(prefs["header"])
|
lines.extend(prefs["header"])
|
||||||
lines.extend(
|
lines.extend(
|
||||||
[
|
[
|
||||||
|
"@echo ---- Building Pillow (%s) ----",
|
||||||
cmd_cd("{pillow_dir}"),
|
cmd_cd("{pillow_dir}"),
|
||||||
cmd_append("LIB", r"{python_dir}\tcl"),
|
cmd_append("LIB", r"{python_dir}\tcl"),
|
||||||
r'"{{python_dir}}\python.exe" setup.py build_ext %*',
|
cmd_set("MSSdk", "1"),
|
||||||
# r"""%PYTHON%\python.exe selftest.py --installed""",
|
cmd_set("DISTUTILS_USE_SDK", "1"),
|
||||||
|
cmd_set("py_vcruntime_redist", "true"),
|
||||||
|
r'"{python_dir}\python.exe" setup.py build_ext %*',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -393,7 +457,9 @@ def build_pillow(wheel=False):
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
depends_dir = os.path.join(script_dir, "depends")
|
depends_dir = os.path.join(script_dir, "depends")
|
||||||
python_dir = os.environ.get("PYTHON", os.path.dirname(os.path.realpath(sys.executable)))
|
python_dir = os.environ.get(
|
||||||
|
"PYTHON", os.path.dirname(os.path.realpath(sys.executable))
|
||||||
|
)
|
||||||
|
|
||||||
# copy binaries to this directory
|
# copy binaries to this directory
|
||||||
path_dir = os.environ.get("PILLOW_BIN")
|
path_dir = os.environ.get("PILLOW_BIN")
|
||||||
|
@ -410,15 +476,17 @@ if __name__ == "__main__":
|
||||||
# use PYTHON to select python version
|
# use PYTHON to select python version
|
||||||
python_prefs = match(pythons, python_dir)
|
python_prefs = match(pythons, python_dir)
|
||||||
if python_prefs is None:
|
if python_prefs is None:
|
||||||
raise KeyError("Failed to determine Python version from PYTHON: " + python_dir)
|
raise KeyError("Failed to determine Python version for {}".format(python_dir))
|
||||||
|
|
||||||
print("Target: Python {python_version} {architecture} at: {python_dir}".format(python_version=python_prefs["name"], architecture=architecture, python_dir=python_dir))
|
print(
|
||||||
|
"Target: Python {python_version} {architecture} at: {python_dir}".format(
|
||||||
|
python_version=python_prefs["name"],
|
||||||
|
architecture=architecture,
|
||||||
|
python_dir=python_dir,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# use python version + architecture to select build config
|
vs2017 = find_vs2017(python_prefs)
|
||||||
config_name = python_prefs["config-" + architecture]
|
|
||||||
config = configs[config_name]
|
|
||||||
|
|
||||||
vs2017 = find_vs2017(config)
|
|
||||||
if vs2017 is None:
|
if vs2017 is None:
|
||||||
raise RuntimeError("Visual Studio 2017 not found")
|
raise RuntimeError("Visual Studio 2017 not found")
|
||||||
|
|
||||||
|
@ -430,13 +498,12 @@ if __name__ == "__main__":
|
||||||
#
|
#
|
||||||
# print("Found Windows SDK 7.1A at: {}".format(sdk71a["sdk_dir"]))
|
# print("Found Windows SDK 7.1A at: {}".format(sdk71a["sdk_dir"]))
|
||||||
|
|
||||||
build_dir = os.path.join(script_dir, "build", config_name, architecture)
|
build_dir = os.path.join(script_dir, "build", python_prefs["name"], architecture)
|
||||||
lib_dir = os.path.join(build_dir, "lib")
|
lib_dir = os.path.join(build_dir, "lib")
|
||||||
inc_dir = os.path.join(build_dir, "inc")
|
inc_dir = os.path.join(build_dir, "inc")
|
||||||
bin_dir = os.path.join(build_dir, "bin")
|
bin_dir = os.path.join(build_dir, "bin")
|
||||||
|
|
||||||
# for path in [lib_dir, inc_dir, bin_dir]:
|
# shutil.rmtree(build_dir)
|
||||||
# shutil.rmtree(path)
|
|
||||||
for path in [depends_dir, build_dir, lib_dir, inc_dir, bin_dir]:
|
for path in [depends_dir, build_dir, lib_dir, inc_dir, bin_dir]:
|
||||||
os.makedirs(path, exist_ok=True)
|
os.makedirs(path, exist_ok=True)
|
||||||
|
|
||||||
|
@ -455,7 +522,7 @@ if __name__ == "__main__":
|
||||||
"cmake": "cmake.exe",
|
"cmake": "cmake.exe",
|
||||||
}
|
}
|
||||||
|
|
||||||
dicts = [vs2017, arch_prefs, python_prefs, config]
|
dicts = [vs2017, arch_prefs, python_prefs]
|
||||||
for x in dicts:
|
for x in dicts:
|
||||||
prefs.update(x)
|
prefs.update(x)
|
||||||
prefs["header"] = sum((x.get("header", []) for x in dicts), header) + ["@echo on"]
|
prefs["header"] = sum((x.get("header", []) for x in dicts), header) + ["@echo on"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user