Skip to content

Commit

Permalink
[build] Add optional build-id
Browse files Browse the repository at this point in the history
Build-ids are required for doing certain kinds of performance tracing.
For example build-ids let Linux perf find the correct objects and
transfer them to other machines via "perf archive".

This adds an option to add -Wl,--build-id to the linker. It can be
enabled by passing -Dbuild_id=true to meson or --build-id to
package-release.sh.

Signed-off-by: Nicholas Fraser <[email protected]>
  • Loading branch information
Nicholas Fraser authored and doitsujin committed Feb 18, 2021
1 parent fe5e215 commit cd49d03
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ if dxvk_compiler.get_id() == 'clang'
endif
endif

if get_option('build_id') and dxvk_compiler.get_id() != 'msvc'
if dxvk_compiler.has_link_argument('-Wl,--build-id')
add_global_link_arguments('-Wl,--build-id', language: 'cpp')
endif
endif

dxvk_include_path = include_directories('./include')

if (cpu_family == 'x86_64')
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ option('enable_dxgi', type : 'boolean', value : true, description: 'Build DXGI'
option('enable_d3d9', type : 'boolean', value : true, description: 'Build D3D9')
option('enable_d3d10', type : 'boolean', value : true, description: 'Build D3D10')
option('enable_d3d11', type : 'boolean', value : true, description: 'Build D3D11')
option('build_id', type : 'boolean', value : false)
5 changes: 5 additions & 0 deletions package-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ shift 2

opt_nopackage=0
opt_devbuild=0
opt_buildid=false

crossfile="build-win"

Expand All @@ -35,6 +36,9 @@ while [ $# -gt 0 ]; do
opt_nopackage=1
opt_devbuild=1
;;
"--build-id")
opt_buildid=true
;;
*)
echo "Unrecognized option: $1" >&2
exit 1
Expand All @@ -55,6 +59,7 @@ function build_arch {
--bindir "x$1" \
--libdir "x$1" \
-Denable_tests=false \
-Dbuild_id=$opt_buildid \
"$DXVK_BUILD_DIR/build.$1"

cd "$DXVK_BUILD_DIR/build.$1"
Expand Down

0 comments on commit cd49d03

Please sign in to comment.