SDL_image: cmake: use AOM_TARGET_CPU + enable aom-av1 encoding when building shared libaom library

From abbf3a2addfe8ca9fdd3dd3e1551c14940f0f5e8 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 26 Jan 2024 01:26:18 +0100
Subject: [PATCH] cmake: use AOM_TARGET_CPU + enable aom-av1 encoding when
 building shared libaom library

---
 CMakeLists.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c37bcf6e..fb81ce4f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -434,17 +434,21 @@ if(SDL3IMAGE_AOM)
         set(ENABLE_TESTDATA OFF CACHE BOOL "")
         set(ENABLE_TESTS OFF CACHE BOOL "")
         set(ENABLE_TOOLS OFF CACHE BOOL "")
-        set(CONFIG_AV1_DECODER 0 CACHE BOOL "" FORCE)
+        if(SDL3IMAGE_AOM_SHARED)
+            set(CONFIG_AV1_DECODER 1 CACHE BOOL "" FORCE)
+        else()
+            set(CONFIG_AV1_DECODER 0 CACHE BOOL "" FORCE)
+        endif()
         set(CONFIG_AV1_ENCODER 1 CACHE BOOL "" FORCE)
         # aom detects cpu using CMAKE_SYSTEM_NAME
         if(SDL_CPU_X86)
-          set(CMAKE_SYSTEM_PROCESSOR "x86")
+          set(AOM_TARGET_CPU "x86")
         elseif(SDL_CPU_X64)
-          set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+          set(AOM_TARGET_CPU "x86_64")
         elseif(SDL_CPU_ARM32)
-          set(CMAKE_SYSTEM_PROCESSOR "arm")
+          set(AOM_TARGET_CPU "arm")
         elseif(SDL_CPU_ARM64)
-          set(CMAKE_SYSTEM_PROCESSOR "aarch64")
+          set(AOM_TARGET_CPU "aarch64")
         endif()
         add_subdirectory(external/aom EXCLUDE_FROM_ALL)
         set(AOM_LIBRARY aom)