Commit Graph

16 Commits

Author SHA1 Message Date
James Zern
327ef24fbd cpu.cmake: fix compiler flag detection w/3.17.0+
Between 3.17.0 and 3.18.2 check_cxx_compiler_flag() sets a normal
variable at parent scope while check_cxx_source_compiles() continues to
set an internal cache variable, so we unset both to avoid the failure /
success state persisting between checks.

This was fixed in 3.18.3 [1], but regressed shortly afterward [2];
currently seen with 3.20.0 installed via homebrew.

[1] https://gitlab.kitware.com/cmake/cmake/-/issues/21207
[2]
90dead024c CheckCompilerFlag: unified way to check compiler flags per language

Change-Id: I57282f89b07a9cfd85aca7569380f7d115c0b3cf
2021-07-05 18:16:55 -07:00
James Zern
7e58a1a260 *.cmake: add license header
this syncs the files with CMakeLists.txt

Change-Id: I94d45ef61d33ee9e43973b5d4e85fab007941f67
2021-04-12 17:28:15 -07:00
James Zern
96099a79a8 cmake: fix per-file assembly flags
Since
a376e7b9 Fix compilation on windows and clang-cl+ninja.
the highest level assembly flag (/arch:AVX / -msse4.1) would be applied
to all assembly files. This could result in higher level instructions
being used which would defeat the runtime cpu detection check and could
result in a crash.

With this change -m style flags are used with clang-cl as it supports
them and allows the correct level to be set. With at least Visual
Studio 12 (2013)+ /arch is not necessary to build SSE2 or SSE4 code
unless a lesser /arch is forced so these flags are avoided. This matches
the nmake build.

For emscripten only sse2 and sse4.1 are tested (NEON will succeed in
being enabled, but fail to build). This is consistent with
the current behavior added in:
commit 36c81ff6a9

    WASM-SIMD: port 2 patches from rreverser@'s tree

    * Stop on first found SIMD version
    * Imply lower SSE version when higher is found

Bug: webp:488
Change-Id: I34d01274e5204a477b6b9f35ed566048a62b4c57
Tested: msvc 2013-2019 debug win32/x64 builds; clang-cl under 2019
2020-11-23 17:31:48 -08:00
Ingvar Stepanyan
36c81ff6a9 WASM-SIMD: port 2 patches from rreverser@'s tree
* Stop on first found SIMD version
* Imply lower SSE version when higher is found

Change-Id: I9a4bf24eeebf6c87b6b50f5c969e7e36429b691d
2020-11-20 11:58:39 +01:00
Ingvar Stepanyan
52273943c6 Couple of fixes to allow SIMD on Emscripten
- Add `-msimd128` to flags to actually enable WebAssembly SIMD
   when performing SIMD detection. It's currently required in
   addition to `-msse*` / `-mfpu=neon` flags which only perform
   translation of corresponding intrinsics to Wasm SIMD ones.
   See a discussion at emscripten-core/emscripten#12714 for
   automating this and making easier in the future.
 - Remove compilation branch that prevented definitions of
   `WEBP_USE_SSE` and `WEBP_USE_NEON` on Emscripten even when
   SIMD support was detected at compile-time.
 - Add an implementation of `VP8GetCPUInfo` for Emscripten which
   uses static `WEBP_USE_*` flags to determine if a corresponding
   SIMD instruction is supported. This is because Wasm doesn't
   have proper feature detection (yet) and requires making separate
   build for SIMD version anyway.

Change-Id: I77592081b91fd0e4cbc9242f5600ce905184f506
2020-11-18 21:51:41 +00:00
Vincent Rabaud
a376e7b96a Fix compilation on windows and clang-cl+ninja.
Change-Id: I4e468519e1bcb99da5057f3b6646b077a1e0e7f1
2018-10-16 16:20:47 +02:00
Vincent Rabaud
cbf82cc04d Remove AVX2 files.
There is only enc_avx2.c and we never managed to get
something fast enough.

Change-Id: I7465b5d8ccf47d9aa612173b8f80f96060cdb366
2018-10-16 14:12:03 +02:00
Yannis Guyon
5c395f1d71 libwebp: cmake-format all
https://github.com/cheshirekow/cmake_format
A complete row of # is replaced by only one,
so add a space after the first one to keep it.

Change-Id: I367749353a555c89c717f1939220699e43ecab2c
2018-10-05 14:23:06 +02:00
James Zern
a439972175 WIP: list includes as descendants of the project dir
#include "(.|..)/..." -> #include "src/..."

Change-Id: I772880aa097a770722043c8a4393552ba38a89b6
2017-10-10 23:04:05 -07:00
Vincent Rabaud
1b526638b8 Clean-up some CMake
- some image libraries define _INCLUDE_DIR and not INCLUDE_DIRS.
- CMakePushCheckState is a non-destructive way of changing the
CMAKE_REQUIRED_* variables.

Change-Id: I7d318a0ddf9754a5c047f47ba1713f9f94e1ec1c
2017-07-10 16:29:33 +02:00
James Zern
d67555809f cpu.cmake: use unique flag to test simd disable flags
this avoids the result being cached in a common variable causing
potentially incorrect results in future tests and improves the logging
output

BUG=webp:351

Change-Id: I4b3110beec38f505fc8f835c3ea689a7d81a36bb
2017-06-28 19:13:34 -07:00
Vincent Rabaud
3226325016 Add a flag to disable SIMD optimizations.
Change-Id: I83c33076e8afd1b20de1e9b191bdad6669998a0b
2017-02-03 16:56:37 +01:00
Vincent Rabaud
abb5482731 remove Clang warnings with unused arch arguments.
This is duplicating code from compiler flag checking that was once
added (then reverted to CMake) as the problem seem to be on the
clang side as detailed in:
http://public.kitware.com/Bug/view.php?id=13194

I also tried to remove a similar warning with pthreads but there
is also an issue on the clang side:
https://llvm.org/bugs/show_bug.cgi?id=7798

Change-Id: I5b0061f0f71e49b493c5ee0c98f70533c28164bd
2016-12-20 10:03:55 +01:00
James Zern
ee1057e3b1 cpu.cmake: improve webp_check_compiler_flag output
WEBP_HAVE_FLAG_LOCAL -> WEBP_HAVE_FLAG_${WEBP_SIMD_FLAG} this will
include the flag being tested in the output:
-- Performing Test WEBP_HAVE_FLAG_NEON

Change-Id: I1c0a143a857b16e4eb1fcf8b23c176380a5fef29
2016-08-03 19:55:18 -07:00
Vincent Rabaud
a80e8cfdf2 Provide support for CMake on Android studio 2.2.
Change-Id: Ib3508c20a220b29d42f963cf154cd9ab5236ed6e
2016-07-08 01:57:02 +02:00
Vincent Rabaud
6c62841076 Split the main CMake file.
This will well isolate contributions for original code,
generated code and SIMD (especially for Android).

Change-Id: Ie47664decc7f43c2f57260a72cab951c347281a7
2016-07-07 21:25:01 +02:00