[vlc-commits] [Git][videolan/vlc][master] contrib: openapv: restore patches lost in update

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Aug 8 10:44:38 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
329ed313 by Steve Lhomme at 2026-08-08T09:54:43+00:00
contrib: openapv: restore patches lost in update

Lost in 4020effd176d44243028e109f7e0378ae50f4e3c.

- - - - -


5 changed files:

- + contrib/src/openapv/0002-CMake-use-CMake-way-of-selecting-strict-C99-support.patch
- + contrib/src/openapv/0003-CMake-don-t-add-pthread-for-Windows-builds.patch
- contrib/src/openapv/0002-CMake-check-compiler-flags-before-adding-them.patch → contrib/src/openapv/0004-CMake-check-compiler-flags-are-supported-before-addi.patch
- + contrib/src/openapv/0005-CMake-check-_mm256_setr_m128i-is-supported.patch
- contrib/src/openapv/rules.mak


Changes:

=====================================
contrib/src/openapv/0002-CMake-use-CMake-way-of-selecting-strict-C99-support.patch
=====================================
@@ -0,0 +1,35 @@
+From 5c955393404ea1c64ea81abdf5dd3207a216e566 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 14 Jan 2026 13:41:39 +0100
+Subject: [PATCH 2/5] CMake: use CMake way of selecting strict C99 support
+
+Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
+---
+ CMakeLists.txt | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f040c92..edd71d0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -122,7 +122,7 @@ elseif(UNIX OR MINGW)
+         set(OPT_DBG "-DNDEBUG") # disable assert
+     endif()
+ 
+-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_DBG} -${OPT_LV} -fomit-frame-pointer -pthread -std=c99")
++    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_DBG} -${OPT_LV} -fomit-frame-pointer -pthread")
+     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-function")
+     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lm")
+ 
+@@ -143,6 +143,8 @@ message ("linker Flags: " ${CMAKE_EXE_LINKER_FLAGS})
+ ########################################
+ 
+ set(CMAKE_C_STANDARD 99)
++set(CMAKE_C_STANDARD_REQUIRED ON)
++set(CMAKE_C_EXTENSIONS OFF)
+ cmake_policy(SET CMP0048 NEW)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ 
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/openapv/0003-CMake-don-t-add-pthread-for-Windows-builds.patch
=====================================
@@ -0,0 +1,53 @@
+From a20da69d31eaf0482276b2b49b5cff02e90167ba Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 14 Jan 2026 13:45:01 +0100
+Subject: [PATCH 3/5] CMake: don't add -pthread for Windows builds
+
+Add add -pthread to the pkg-config file.
+
+It can generate some warnings or compilations errors.
+
+The official CMake way of picking the thread library [^1] should probably be used for non-Windows targets.
+
+[^1]: https://cmake.org/cmake/help/latest/module/FindThreads.html
+
+Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
+---
+ CMakeLists.txt     | 5 ++++-
+ src/CMakeLists.txt | 3 +++
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index edd71d0..bc6cc44 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -122,8 +122,11 @@ elseif(UNIX OR MINGW)
+         set(OPT_DBG "-DNDEBUG") # disable assert
+     endif()
+ 
+-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_DBG} -${OPT_LV} -fomit-frame-pointer -pthread")
++    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_DBG} -${OPT_LV} -fomit-frame-pointer")
+     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-function")
++    if(NOT WIN32)
++      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
++    endif()
+     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lm")
+ 
+     if(ENABLE_COVERAGE)
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index d690068..29143cf 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -182,6 +182,9 @@ if(NOT MSVC)
+         set(EXTRA_CFLAGS "-DOAPV_STATIC_DEFINE")
+         set(EXTRA_CFLAGS_PRIVATE "")
+     endif()
++    if(NOT WIN32)
++        set(EXTRA_CFLAGS_PRIVATE "${EXTRA_CFLAGS_PRIVATE} -pthread")
++    endif()
+     configure_file(
+       "${CMAKE_SOURCE_DIR}/pkgconfig/${LIB_NAME_BASE}.pc.in"
+       "${CMAKE_BINARY_DIR}/${LIB_NAME_BASE}.pc" @ONLY)
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/openapv/0002-CMake-check-compiler-flags-before-adding-them.patch → contrib/src/openapv/0004-CMake-check-compiler-flags-are-supported-before-addi.patch
=====================================
@@ -1,17 +1,17 @@
-From 33243bab9848c6a06d12696bc34a0254d52a4db2 Mon Sep 17 00:00:00 2001
+From c7ca0edd02fc7a0f8e444898f375765ee6285979 Mon Sep 17 00:00:00 2001
 From: Steve Lhomme <robux4 at ycbcr.xyz>
-Date: Wed, 14 Jan 2026 13:41:39 +0100
-Subject: [PATCH] CMake: check compiler flags before adding them
+Date: Wed, 14 Jan 2026 13:45:35 +0100
+Subject: [PATCH 4/5] CMake: check compiler flags are supported before adding
+ them
 
 Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
 ---
- CMakeLists.txt        | 22 +++++++++++++++++++---
- src/CMakeLists.txt    | 34 ++++++++++++++++++++++++++++++----
- src/avx/oapv_tq_avx.c |  5 +++++
- 3 files changed, 54 insertions(+), 7 deletions(-)
+ CMakeLists.txt     | 17 +++++++++++++++--
+ src/CMakeLists.txt | 18 ++++++++++++++----
+ 2 files changed, 29 insertions(+), 6 deletions(-)
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 4df8794..a6bcf2e 100644
+index bc6cc44..57ad02b 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -102,6 +102,8 @@ endif()
@@ -23,11 +23,11 @@ index 4df8794..a6bcf2e 100644
  # Set compiler flags and options.
  if(MSVC)
    message("Not supported yet!")
-@@ -122,8 +124,22 @@ elseif(UNIX OR MINGW)
+@@ -122,8 +124,19 @@ elseif(UNIX OR MINGW)
          set(OPT_DBG "-DNDEBUG") # disable assert
      endif()
  
--    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_DBG} -${OPT_LV} -fomit-frame-pointer -pthread -std=c99")
+-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_DBG} -${OPT_LV} -fomit-frame-pointer")
 -    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-function")
 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_DBG} -${OPT_LV}")
 +    check_c_compiler_flag("-fomit-frame-pointer" HAS_FLAG_OMIT_FRAME_POINTER)
@@ -42,26 +42,14 @@ index 4df8794..a6bcf2e 100644
 +    if(HAS_FLAG_NO_UNUSED_FUNCTION)
 +      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
 +    endif()
-+    if(NOT WIN32)
-+      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
-+    endif()
-     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lm")
- 
-     if(ENABLE_COVERAGE)
-@@ -143,6 +159,8 @@ endif()
- ########################################
- 
- set(CMAKE_C_STANDARD 99)
-+set(CMAKE_C_STANDARD_REQUIRED ON)
-+set(CMAKE_C_EXTENSIONS OFF)
- cmake_policy(SET CMP0048 NEW)
- set_property(GLOBAL PROPERTY USE_FOLDERS ON)
- 
+     if(NOT WIN32)
+       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
+     endif()
 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 708e898..8a143f8 100644
+index 29143cf..e442e7f 100644
 --- a/src/CMakeLists.txt
 +++ b/src/CMakeLists.txt
-@@ -14,6 +14,11 @@ file(GLOB LIB_AVX_INC "../src/avx/oapv_*.h" )
+@@ -14,6 +14,10 @@ file(GLOB LIB_AVX_INC "../src/avx/oapv_*.h" )
  include(GenerateExportHeader)
  include_directories("${CMAKE_BINARY_DIR}/include")
  
@@ -69,11 +57,10 @@ index 708e898..8a143f8 100644
 +check_c_compiler_flag("-flax-vector-conversions" HAS_ARM_VECTOR_CONVERSION)
 +check_c_compiler_flag("-msse4.1" HAS_SSE41)
 +check_c_compiler_flag("-mavx2" HAS_AVX2)
-+
  
  message("SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
  
-@@ -107,10 +112,34 @@ if(MSVC)
+@@ -107,10 +111,16 @@ if(MSVC)
    endif()
  elseif(UNIX OR MINGW)
    if (ARM)
@@ -90,41 +77,10 @@ index 708e898..8a143f8 100644
 +    endif()
 +    if(HAS_AVX2)
 +      set_property(SOURCE ${AVX} APPEND PROPERTY COMPILE_FLAGS "-mavx2")
-+      include(CheckCSourceCompiles)
-+      include(CMakePushCheckState)
-+
-+      cmake_push_check_state(RESET)
-+      set(CMAKE_REQUIRED_FLAGS "-mavx2")
-+      check_c_source_compiles("
-+      #include <immintrin.h>
-+      int main(void)
-+      {
-+        __m128i a, b;
-+        _mm256_setr_m128i(a, b);
-+        return 0;
-+      }
-+      " HAVE_MM256_SETR)
-+      cmake_pop_check_state()
-+      if(HAVE_MM256_SETR)
-+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_MM256_SETR")
-+      endif()
 +    endif()
    endif()
  
    if(OAPV_BUILD_SHARED_LIB)
-diff --git a/src/avx/oapv_tq_avx.c b/src/avx/oapv_tq_avx.c
-index c3fdd50..3d0afb0 100644
---- a/src/avx/oapv_tq_avx.c
-+++ b/src/avx/oapv_tq_avx.c
-@@ -32,6 +32,11 @@
- #include "oapv_def.h"
- #include "oapv_tq_avx.h"
- 
-+#ifndef HAVE_MM256_SETR
-+#define _mm256_set_m128i(v0, v1)  _mm256_insertf128_si256(_mm256_castsi128_si256(v1), (v0), 1)
-+#define _mm256_setr_m128i(v0, v1) _mm256_set_m128i((v1), (v0))
-+#endif
-+
- #if X86_SSE
- #ifndef _mm256_set_m128i
- #define _mm256_set_m128i(/* __m128i */ hi, /* __m128i */ lo) \
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/openapv/0005-CMake-check-_mm256_setr_m128i-is-supported.patch
=====================================
@@ -0,0 +1,65 @@
+From 034251a4c5f7e6195010259d781bbfe5ab7d7942 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 14 Jan 2026 14:16:08 +0100
+Subject: [PATCH 5/5] CMake: check _mm256_setr_m128i is supported
+
+Some older AVX2 compilers don't have it, but it's possible to use a macro instead [^1].
+
+[^1]: https://stackoverflow.com/a/32630658/1266123
+
+Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
+---
+ src/CMakeLists.txt    | 19 +++++++++++++++++++
+ src/avx/oapv_tq_avx.c |  6 ++++++
+ 2 files changed, 25 insertions(+)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index e442e7f..35dfb89 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -120,6 +120,25 @@ elseif(UNIX OR MINGW)
+     endif()
+     if(HAS_AVX2)
+       set_property(SOURCE ${AVX} APPEND PROPERTY COMPILE_FLAGS "-mavx2")
++      # check _mm256_setr_m128i is supported
++      include(CheckCSourceCompiles)
++      include(CMakePushCheckState)
++
++      cmake_push_check_state(RESET)
++      set(CMAKE_REQUIRED_FLAGS "-mavx2")
++      check_c_source_compiles("
++      #include <immintrin.h>
++      int main(void)
++      {
++        __m128i a, b;
++        _mm256_setr_m128i(a, b);
++        return 0;
++      }
++      " HAVE_MM256_SETR)
++      cmake_pop_check_state()
++      if(HAVE_MM256_SETR)
++        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_MM256_SETR")
++      endif(HAVE_MM256_SETR)
+     endif()
+   endif()
+ 
+diff --git a/src/avx/oapv_tq_avx.c b/src/avx/oapv_tq_avx.c
+index 5939986..4332783 100644
+--- a/src/avx/oapv_tq_avx.c
++++ b/src/avx/oapv_tq_avx.c
+@@ -32,6 +32,12 @@
+ #include "oapv_def.h"
+ #include "oapv_tq_avx.h"
+ 
++#ifndef HAVE_MM256_SETR
++#define _mm256_set_m128i(v0, v1)  _mm256_insertf128_si256(_mm256_castsi128_si256(v1), (v0), 1)
++#define _mm256_setr_m128i(v0, v1) _mm256_set_m128i((v1), (v0))
++#endif
++
++
+ #if X86_SSE
+ #ifndef _mm256_set_m128i
+ #define _mm256_set_m128i(/* __m128i */ hi, /* __m128i */ lo) \
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/openapv/rules.mak
=====================================
@@ -21,7 +21,10 @@ openapv: openapv-$(OPENAPV_VERSION).tar.gz .sum-openapv
 	# install the library in the usual <prefix>/lib place to match the .pc file
 	sed -i.orig 's,$${CMAKE_INSTALL_LIBDIR}/$${LIB_NAME_BASE},$${CMAKE_INSTALL_LIBDIR},g' $(UNPACK_DIR)/src/CMakeLists.txt
 	$(APPLY) $(SRC)/openapv/0001-detect-Windows-builds-with-_WIN32.patch
-	$(APPLY) $(SRC)/openapv/0002-CMake-check-compiler-flags-before-adding-them.patch
+	$(APPLY) $(SRC)/openapv/0002-CMake-use-CMake-way-of-selecting-strict-C99-support.patch
+	$(APPLY) $(SRC)/openapv/0003-CMake-don-t-add-pthread-for-Windows-builds.patch
+	$(APPLY) $(SRC)/openapv/0004-CMake-check-compiler-flags-are-supported-before-addi.patch
+	$(APPLY) $(SRC)/openapv/0005-CMake-check-_mm256_setr_m128i-is-supported.patch
 	$(MOVE)
 
 .openapv: openapv toolchain.cmake



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/329ed3135eeabd85d2f190b8e3388e7a7e441d0f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/329ed3135eeabd85d2f190b8e3388e7a7e441d0f
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list