summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/vulkan/vulkan-samples/0001-vulkan-samples-Fix-reproducibility-issue.patch
blob: c16e05112f9a60505fef5bfde55b60c04b6950f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From d998c753254649c7cf7c64e3fed78e41c11ad7ed Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Wed, 23 Aug 2023 09:38:37 +0200
Subject: [PATCH] vulkan-samples: Fix reproducibility issue

There is code to remove the prefix CMAKE_SOURCE_DIR from __FILENAME__ paths
used for logging with LOGE() in the code. We need to make this match the value we use
in the debug source remapping from CFLAGS

We export the right path to use in the recipe with:

EXTRA_OECMAKE = "-DCMAKE_DEBUG_SRCDIR=${TARGET_DBGSRC_DIR}/"

and we then patch this into the code instead of the broken use
of CMAKE_SOURCE_DIR since __FILENAME__ will match our path prefix
changes.

This also breaks reproducibility since the path length of the build directory
will currently change the output!

Upstream-Status: Pending [needs to be discussed upstream]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
---
 bldsys/cmake/global_options.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bldsys/cmake/global_options.cmake b/bldsys/cmake/global_options.cmake
index b15c2da..d8952e5 100644
--- a/bldsys/cmake/global_options.cmake
+++ b/bldsys/cmake/global_options.cmake
@@ -62,7 +62,7 @@ set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_DISABLE_SOURCE_CHANGES ON)
 set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
 
-string(LENGTH "${CMAKE_SOURCE_DIR}/" ROOT_PATH_SIZE)
+string(LENGTH "${CMAKE_DEBUG_SRCDIR}/" ROOT_PATH_SIZE)
 add_definitions(-DROOT_PATH_SIZE=${ROOT_PATH_SIZE})
 
 set(CMAKE_C_FLAGS_DEBUG   "-DDEBUG=0 ${CMAKE_C_FLAGS_DEBUG}")
--
2.41.0