Welcome to mirror list, hosted at ThFree Co, Russian Federation.

update.sh « generate_tracy_header « contrib - github.com/dosbox-staging/dosbox-staging.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 15ede2c2a30bf72ec14b296640d06b2fb78b60f2 (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
#!/bin/bash

# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright (C) 2022-2022  DOSBox Staging Team

# This script exists only to easily update the Tracy header wrapper if/when
# more Tracy zone definitions are added.

set -euo pipefail

source=$(ls ../../subprojects/tracy-*/Tracy.hpp)

if [[ ! -f "$source" ]]; then
  echo "Tracy's source header could not be found."
  echo "Rerun 'meson setup -Dtracy=true' to fetch the subproject."
  exit 1
fi

target=../../include/tracy.h

if [[ ! -f "$target" ]]; then
  echo "The project's existing wrapper header could not be found."
  echo "Please change directories to where this script is, and try again."
  exit 1
fi


echo "Reading content from:   $source"
echo "Writing updated header: $target"

# Top
cat header_top.txt > "$target"

# Body
sed -n "/^#ifndef TRACY_ENABLE/,\${p;/^#else/q}" "$source" >> "$target"

# Bottom
cat header_bottom.txt >> "$target"

echo "Done"