Bläddra i källkod

cmake : avoid -march=native when reproducible build is wanted (#11366)

See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

Without this patch, compiling on different machines produced different binaries, which made verification of results difficult.

Fixes: #11317

This patch was done while working on reproducible builds for openSUSE.
Bernhard M. Wiedemann 11 månader sedan
förälder
incheckning
1af6945eb0
1 ändrade filer med 2 tillägg och 1 borttagningar
  1. 2 1
      ggml/CMakeLists.txt

+ 2 - 1
ggml/CMakeLists.txt

@@ -58,7 +58,8 @@ else()
     set(GGML_BLAS_VENDOR_DEFAULT "Generic")
     set(GGML_BLAS_VENDOR_DEFAULT "Generic")
 endif()
 endif()
 
 
-if (CMAKE_CROSSCOMPILING)
+if (CMAKE_CROSSCOMPILING OR DEFINED ENV{SOURCE_DATE_EPOCH})
+    message(STATUS "Setting GGML_NATIVE_DEFAULT to OFF")
     set(GGML_NATIVE_DEFAULT OFF)
     set(GGML_NATIVE_DEFAULT OFF)
 else()
 else()
     set(GGML_NATIVE_DEFAULT ON)
     set(GGML_NATIVE_DEFAULT ON)