mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-14 18:40:53 +03:00
Use cmds_cmake (#9)
* Use cmds_cmake * Added libsharpyuv * Combine meson into libavif install script * Simplified condition --------- Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
This commit is contained in:
parent
a56acd86c4
commit
f5dc957079
4
.github/workflows/test-windows.yml
vendored
4
.github/workflows/test-windows.yml
vendored
|
@ -139,10 +139,6 @@ jobs:
|
||||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
run: "& winbuild\\build\\build_dep_libpng.cmd"
|
run: "& winbuild\\build\\build_dep_libpng.cmd"
|
||||||
|
|
||||||
- name: Build dependencies / meson
|
|
||||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
|
||||||
run: "& winbuild\\build\\install_meson.cmd"
|
|
||||||
|
|
||||||
- name: Build dependencies / libavif
|
- name: Build dependencies / libavif
|
||||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
run: "& winbuild\\build\\build_dep_libavif.cmd"
|
run: "& winbuild\\build\\build_dep_libavif.cmd"
|
||||||
|
|
2
.github/workflows/wheels-dependencies.sh
vendored
2
.github/workflows/wheels-dependencies.sh
vendored
|
@ -100,7 +100,7 @@ function build_harfbuzz {
|
||||||
function build_libavif {
|
function build_libavif {
|
||||||
if [ -e libavif-stamp ]; then return; fi
|
if [ -e libavif-stamp ]; then return; fi
|
||||||
|
|
||||||
if [[ -z "$IS_MACOS" ]] && ([[ "$MB_ML_VER" == 2014 ]] || [[ "$PLAT" == "aarch64" ]]); then
|
if [[ "$MB_ML_VER" == 2014 ]] || [[ "$PLAT" == "aarch64" ]]; then
|
||||||
# Once Amazon 2 is EOL on 30 June 2025, manylinux2014 will no longer be needed
|
# Once Amazon 2 is EOL on 30 June 2025, manylinux2014 will no longer be needed
|
||||||
# Once GitHub Actions supports aarch64 without emulation, this will no longer needed as building will be faster
|
# Once GitHub Actions supports aarch64 without emulation, this will no longer needed as building will be faster
|
||||||
if [[ "$PLAT" == "aarch64" ]]; then
|
if [[ "$PLAT" == "aarch64" ]]; then
|
||||||
|
|
|
@ -51,6 +51,7 @@ fi
|
||||||
|
|
||||||
cmake -G Ninja -S . -B build \
|
cmake -G Ninja -S . -B build \
|
||||||
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
||||||
|
-DAVIF_LIBSHARPYUV=LOCAL \
|
||||||
-DAVIF_LIBYUV=LOCAL \
|
-DAVIF_LIBYUV=LOCAL \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DCMAKE_INSTALL_NAME_DIR=$PREFIX/lib \
|
-DCMAKE_INSTALL_NAME_DIR=$PREFIX/lib \
|
||||||
|
|
|
@ -122,7 +122,6 @@ V = {
|
||||||
"TIFF": "4.6.0",
|
"TIFF": "4.6.0",
|
||||||
"XZ": "5.6.3",
|
"XZ": "5.6.3",
|
||||||
"ZLIB": "1.3.1",
|
"ZLIB": "1.3.1",
|
||||||
"MESON": "1.6.0",
|
|
||||||
"LIBAVIF": "1.1.1",
|
"LIBAVIF": "1.1.1",
|
||||||
}
|
}
|
||||||
V["LIBPNG_DOTLESS"] = V["LIBPNG"].replace(".", "")
|
V["LIBPNG_DOTLESS"] = V["LIBPNG"].replace(".", "")
|
||||||
|
@ -405,35 +404,20 @@ DEPS: dict[str, dict[str, Any]] = {
|
||||||
"dir": f"libavif-{V['LIBAVIF']}",
|
"dir": f"libavif-{V['LIBAVIF']}",
|
||||||
"license": "LICENSE",
|
"license": "LICENSE",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_mkdir("build.pillow"),
|
f"{sys.executable} -m pip install meson",
|
||||||
cmd_cd("build.pillow"),
|
*cmds_cmake(
|
||||||
" ".join(
|
"avif_static",
|
||||||
[
|
"-DBUILD_SHARED_LIBS=OFF",
|
||||||
"{cmake}",
|
"-DAVIF_CODEC_AOM=LOCAL",
|
||||||
"-DCMAKE_BUILD_TYPE=Release",
|
"-DAVIF_LIBYUV=LOCAL",
|
||||||
"-DCMAKE_VERBOSE_MAKEFILE=ON",
|
"-DAVIF_LIBSHARPYUV=LOCAL",
|
||||||
"-DCMAKE_RULE_MESSAGES:BOOL=OFF",
|
"-DAVIF_CODEC_RAV1E=LOCAL",
|
||||||
"-DCMAKE_C_COMPILER=cl.exe",
|
"-DAVIF_CODEC_DAV1D=LOCAL",
|
||||||
"-DCMAKE_CXX_COMPILER=cl.exe",
|
"-DAVIF_CODEC_SVT=LOCAL",
|
||||||
"-DCMAKE_C_FLAGS=-nologo",
|
|
||||||
"-DCMAKE_CXX_FLAGS=-nologo",
|
|
||||||
"-DBUILD_SHARED_LIBS=OFF",
|
|
||||||
"-DAVIF_CODEC_AOM=LOCAL",
|
|
||||||
"-DAVIF_LIBYUV=LOCAL",
|
|
||||||
"-DAVIF_LIBSHARPYUV=LOCAL",
|
|
||||||
"-DAVIF_CODEC_RAV1E=LOCAL",
|
|
||||||
"-DCMAKE_MODULE_PATH={winbuild_dir_cmake}",
|
|
||||||
"-DAVIF_CODEC_DAV1D=LOCAL",
|
|
||||||
"-DAVIF_CODEC_SVT=LOCAL",
|
|
||||||
'-G "Ninja"',
|
|
||||||
"..",
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
"ninja -v",
|
|
||||||
cmd_cd(".."),
|
|
||||||
cmd_xcopy("include", "{inc_dir}"),
|
cmd_xcopy("include", "{inc_dir}"),
|
||||||
],
|
],
|
||||||
"libs": [r"build.pillow\avif.lib"],
|
"libs": ["avif.lib"],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,19 +647,13 @@ def build_dep_all(disabled: list[str], prefs: dict[str, str], verbose: bool) ->
|
||||||
if dep_name in disabled:
|
if dep_name in disabled:
|
||||||
print(f"Skipping disabled dependency {dep_name}")
|
print(f"Skipping disabled dependency {dep_name}")
|
||||||
continue
|
continue
|
||||||
|
script = build_dep(dep_name, prefs, verbose)
|
||||||
scripts = []
|
if gha_groups:
|
||||||
if dep_name == "libavif":
|
lines.append(f"@echo ::group::Running {script}")
|
||||||
scripts.append("install_meson.cmd")
|
lines.append(rf'cmd.exe /c "{{build_dir}}\{script}"')
|
||||||
scripts.append(build_dep(dep_name, prefs, verbose))
|
lines.append("if errorlevel 1 echo Build failed! && exit /B 1")
|
||||||
|
if gha_groups:
|
||||||
for script in scripts:
|
lines.append("@echo ::endgroup::")
|
||||||
if gha_groups:
|
|
||||||
lines.append(f"@echo ::group::Running {script}")
|
|
||||||
lines.append(rf'cmd.exe /c "{{build_dir}}\{script}"')
|
|
||||||
lines.append("if errorlevel 1 echo Build failed! && exit /B 1")
|
|
||||||
if gha_groups:
|
|
||||||
lines.append("@echo ::endgroup::")
|
|
||||||
print()
|
print()
|
||||||
lines.append("@echo All Pillow dependencies built successfully!")
|
lines.append("@echo All Pillow dependencies built successfully!")
|
||||||
write_script("build_dep_all.cmd", lines, prefs, verbose)
|
write_script("build_dep_all.cmd", lines, prefs, verbose)
|
||||||
|
@ -796,7 +774,6 @@ def main() -> None:
|
||||||
**arch_prefs,
|
**arch_prefs,
|
||||||
# Pillow paths
|
# Pillow paths
|
||||||
"winbuild_dir": winbuild_dir,
|
"winbuild_dir": winbuild_dir,
|
||||||
"winbuild_dir_cmake": winbuild_dir.replace("\\", "/"),
|
|
||||||
# Build paths
|
# Build paths
|
||||||
"bin_dir": bin_dir,
|
"bin_dir": bin_dir,
|
||||||
"build_dir": args.build_dir,
|
"build_dir": args.build_dir,
|
||||||
|
@ -818,19 +795,6 @@ def main() -> None:
|
||||||
print()
|
print()
|
||||||
|
|
||||||
write_script(".gitignore", ["*"], prefs, args.verbose)
|
write_script(".gitignore", ["*"], prefs, args.verbose)
|
||||||
if "libavif" not in disabled:
|
|
||||||
write_script(
|
|
||||||
"install_meson.cmd",
|
|
||||||
[
|
|
||||||
r'call "{build_dir}\build_env.cmd"',
|
|
||||||
"@echo " + ("=" * 70),
|
|
||||||
f"@echo ==== {'Building meson':<60} ====",
|
|
||||||
"@echo " + ("=" * 70),
|
|
||||||
f"{sys.executable} -m pip install meson=={V['MESON']}",
|
|
||||||
],
|
|
||||||
prefs,
|
|
||||||
args.verbose,
|
|
||||||
)
|
|
||||||
build_env(prefs, args.verbose)
|
build_env(prefs, args.verbose)
|
||||||
build_dep_all(disabled, prefs, args.verbose)
|
build_dep_all(disabled, prefs, args.verbose)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user