1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-31 23:33:03 +00:00

Improve package reproducibility

Packages using CMake often use file(GLOB ...) to retrieve a list of
source files. As this is based on readdir(), the resulting file list
is unsorted. A common use case is to pass this list directly to
add_executable or add_library. But as the order is unpredictable, the
binaries are not reproducible (because the order in which the objects
are linked will vary).

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824263
This commit is contained in:
Carles Fernandez
2016-05-23 19:51:59 +02:00
parent 7bbffc3b4f
commit 5a73b4e047
34 changed files with 43 additions and 2 deletions

View File

@@ -65,6 +65,7 @@ if(OPENCL_FOUND)
endif(OPENCL_FOUND)
file(GLOB GNSS_SPLIBS_HEADERS "*.h")
list(SORT GNSS_SPLIBS_HEADERS)
add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES} ${GNSS_SPLIBS_HEADERS})
source_group(Headers FILES ${GNSS_SPLIBS_HEADERS})

View File

@@ -328,8 +328,11 @@ message(STATUS "Available machines: ${available_machines}")
#dependencies are all python, xml, and header implementation files
file(GLOB xml_files ${PROJECT_SOURCE_DIR}/gen/*.xml)
list(SORT xml_files)
file(GLOB py_files ${PROJECT_SOURCE_DIR}/gen/*.py)
list(SORT py_files)
file(GLOB h_files ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/*.h)
list(SORT h_files)
macro(gen_template tmpl output)
list(APPEND volk_gnsssdr_gen_sources ${output})
@@ -437,6 +440,7 @@ if(${CMAKE_VERSION} VERSION_GREATER "2.8.9")
# then add the files
include_directories(${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/neon)
file(GLOB asm_files ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/neon/*.s)
list(SORT asm_files)
foreach(asm_file ${asm_files})
list(APPEND volk_gnsssdr_sources ${asm_file})
message(STATUS "Adding source file: ${asm_file}")
@@ -469,6 +473,7 @@ if(ORC_FOUND)
#setup orc functions
file(GLOB orc_files ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/orc/*.orc)
list(SORT orc_files)
foreach(orc_file ${orc_files})
#extract the name for the generated c source from the orc file
@@ -539,6 +544,7 @@ if(CMAKE_VERSION VERSION_GREATER "2.8.7")
#Add dynamic library
file(GLOB orc ${PROJECT_SOURCE_DIR}/kernels/volk_gnsssdr/asm/orc/*.orc)
list(SORT orc)
if(ENABLE_STATIC_LIBS)
add_library(volk_gnsssdr STATIC $<TARGET_OBJECTS:volk_gnsssdr_obj> ${orc})