mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
don't build avx2 if we don't have it
This commit is contained in:
parent
7204d277b4
commit
14b822a185
@ -29,13 +29,17 @@ trait libjxl
|
||||
);
|
||||
|
||||
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
$cmake->addConfigureArgs(
|
||||
'-DCXX_MAVX512F_SUPPORTED:BOOL=FALSE',
|
||||
'-DCXX_MAVX512DQ_SUPPORTED:BOOL=FALSE',
|
||||
'-DCXX_MAVX512CD_SUPPORTED:BOOL=FALSE',
|
||||
'-DCXX_MAVX512BW_SUPPORTED:BOOL=FALSE',
|
||||
'-DCXX_MAVX512VL_SUPPORTED:BOOL=FALSE'
|
||||
);
|
||||
$cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: '';
|
||||
$has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4');
|
||||
if (!$has_avx512) {
|
||||
$cmake->addConfigureArgs(
|
||||
'-DCXX_MAVX512F_SUPPORTED:BOOL=FALSE',
|
||||
'-DCXX_MAVX512DQ_SUPPORTED:BOOL=FALSE',
|
||||
'-DCXX_MAVX512CD_SUPPORTED:BOOL=FALSE',
|
||||
'-DCXX_MAVX512BW_SUPPORTED:BOOL=FALSE',
|
||||
'-DCXX_MAVX512VL_SUPPORTED:BOOL=FALSE'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$cmake->build();
|
||||
|
||||
@ -10,8 +10,13 @@ trait libwebp
|
||||
{
|
||||
protected function build(): void
|
||||
{
|
||||
$cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: '';
|
||||
$has_avx2 = str_contains($cflags, '-mavx2') || str_contains($cflags, '-march=x86-64-v2') || str_contains($cflags, '-march=x86-64-v3');
|
||||
UnixCMakeExecutor::create($this)
|
||||
->addConfigureArgs('-DWEBP_BUILD_EXTRAS=ON')
|
||||
->addConfigureArgs(
|
||||
'-DWEBP_BUILD_EXTRAS=ON',
|
||||
'-DWEBP_ENABLE_SIMD=' . ($has_avx2 ? 'ON' : 'OFF'),
|
||||
)
|
||||
->build();
|
||||
// patch pkgconfig
|
||||
$this->patchPkgconfPrefix(patch_option: PKGCONF_PATCH_PREFIX | PKGCONF_PATCH_LIBDIR);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user