From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alex Myczko <tar@debian.org>
Date: May, 14 2026 20:28:29 +0000
Subject: [PATCH] <short summary of the patch>

TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.

Bug-Debian: https://bugs.debian.org/1131229
---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-<Vendor>: <vendor-bugtracker-url>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>

--- colmap-4.0.4.orig/src/thirdparty/SiftGPU/CMakeLists.txt
+++ colmap-4.0.4/src/thirdparty/SiftGPU/CMakeLists.txt
@@ -1,7 +1,25 @@
 add_compile_definitions(SIFTGPU_NO_DEVIL)
 
 if(SIMD_ENABLED AND IS_X86)
-    add_compile_definitions(SIFTGPU_USE_SSE_FOR)
+    if(MSVC)
+        set(SIFTGPU_USE_SSE_FOR TRUE)
+    else()
+        include(CheckCXXSourceCompiles)
+        check_cxx_source_compiles("
+            #ifndef __SSE__
+            #error SSE is not enabled for this compiler target.
+            #endif
+            #include <xmmintrin.h>
+            int main() {
+                __m128 value = _mm_setzero_ps();
+                return static_cast<int>(_mm_cvtss_f32(value));
+            }" SIFTGPU_HAS_TARGET_SSE)
+        set(SIFTGPU_USE_SSE_FOR ${SIFTGPU_HAS_TARGET_SSE})
+    endif()
+
+    if(SIFTGPU_USE_SSE_FOR)
+        add_compile_definitions(SIFTGPU_USE_SSE_FOR)
+    endif()
     if(MSVC)
         add_compile_definitions(__SSE__)
     endif()
