summaryrefslogtreecommitdiffstats
path: root/mozglue/baseprofiler/moz.build
blob: bbefe9582e9bda2d499753ec94c1d58f043ea0aa (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# This is pretty much a copy from tools/profiler, cut down to exclude anything
# that cannot work in mozglue (because they are totally dependent on libxul-
# specific code).
# All exported headers now prefixed with "Base" to avoid #include name clashes.

if CONFIG["MOZ_GECKO_PROFILER"]:
    DEFINES["IMPL_MFBT"] = True
    EXPORTS += [
        "public/BaseProfilerSharedLibraries.h",
        "public/BaseProfilingStack.h",
    ]
    UNIFIED_SOURCES += [
        "core/PageInformation.cpp",
        "core/platform.cpp",
        "core/ProfileBuffer.cpp",
        "core/ProfileBufferEntry.cpp",
        "core/ProfiledThreadData.cpp",
        "core/ProfileJSONWriter.cpp",
        "core/ProfilerBacktrace.cpp",
        "core/ProfilerMarkers.cpp",
        "core/ProfilingCategory.cpp",
        "core/ProfilingStack.cpp",
        "core/RegisteredThread.cpp",
    ]

    if CONFIG["OS_TARGET"] in ("Android", "Linux", "FreeBSD"):
        if CONFIG["CPU_ARCH"] in ("arm", "aarch64", "x86", "x86_64", "mips64"):
            UNIFIED_SOURCES += [
                "lul/AutoObjectMapper.cpp",
                "lul/LulCommon.cpp",
                "lul/LulDwarf.cpp",
                "lul/LulDwarfSummariser.cpp",
                "lul/LulElf.cpp",
                "lul/LulMain.cpp",
                "lul/platform-linux-lul.cpp",
            ]
        # These files cannot be built in unified mode because of name clashes with mozglue headers on Android.
        SOURCES += [
            "core/shared-libraries-linux.cc",
        ]
        if CONFIG["CPU_ARCH"] == "arm" and CONFIG["OS_TARGET"] != "FreeBSD":
            SOURCES += [
                "core/EHABIStackWalk.cpp",
            ]
    elif CONFIG["OS_TARGET"] == "Darwin":
        UNIFIED_SOURCES += [
            "core/shared-libraries-macos.cc",
        ]
    elif CONFIG["OS_TARGET"] == "WINNT":
        SOURCES += [
            "core/shared-libraries-win32.cc",
        ]

    LOCAL_INCLUDES += [
        "/mozglue/baseprofiler/core/",
        "/mozglue/linker",
    ]

    if CONFIG["OS_TARGET"] == "Android":
        DEFINES["ANDROID_NDK_MAJOR_VERSION"] = CONFIG["ANDROID_NDK_MAJOR_VERSION"]
        DEFINES["ANDROID_NDK_MINOR_VERSION"] = CONFIG["ANDROID_NDK_MINOR_VERSION"]

GeneratedFile(
    "public/ProfilingCategoryList.h",
    script="build/generate_profiling_categories.py",
    entry_point="generate_macro_header",
    inputs=["build/profiling_categories.yaml"],
)

EXPORTS += [
    "!public/ProfilingCategoryList.h",
    "public/BaseProfiler.h",
    "public/BaseProfilingCategory.h",
]

EXPORTS.mozilla += [
    "public/BaseAndGeckoProfilerDetail.h",
    "public/BaseProfileJSONWriter.h",
    "public/BaseProfilerCounts.h",
    "public/BaseProfilerDetail.h",
    "public/BaseProfilerLabels.h",
    "public/BaseProfilerMarkers.h",
    "public/BaseProfilerMarkersDetail.h",
    "public/BaseProfilerMarkersPrerequisites.h",
    "public/BaseProfilerMarkerTypes.h",
    "public/BaseProfilerRAIIMacro.h",
    "public/BaseProfilerState.h",
    "public/BaseProfilerUtils.h",
    "public/BlocksRingBuffer.h",
    "public/FailureLatch.h",
    "public/leb128iterator.h",
    "public/ModuloBuffer.h",
    "public/PowerOfTwo.h",
    "public/ProfileBufferChunk.h",
    "public/ProfileBufferChunkManager.h",
    "public/ProfileBufferChunkManagerSingle.h",
    "public/ProfileBufferChunkManagerWithLocalLimit.h",
    "public/ProfileBufferControlledChunkManager.h",
    "public/ProfileBufferEntryKinds.h",
    "public/ProfileBufferEntrySerialization.h",
    "public/ProfileBufferIndex.h",
    "public/ProfileChunkedBuffer.h",
    "public/ProfileChunkedBufferDetail.h",
    "public/ProgressLogger.h",
    "public/ProportionValue.h",
]

UNIFIED_SOURCES += [
    "core/BaseAndGeckoProfilerDetail.cpp",
    "core/ProfilerUtils.cpp",
]

if CONFIG["MOZ_VTUNE"]:
    DEFINES["MOZ_VTUNE_INSTRUMENTATION"] = True
    UNIFIED_SOURCES += [
        "core/VTuneProfiler.cpp",
    ]

FINAL_LIBRARY = "mozglue"

if CONFIG["CC_TYPE"] in ("clang", "gcc"):
    CXXFLAGS += [
        "-Wno-ignored-qualifiers",  # due to use of breakpad headers
    ]

with Files("**"):
    BUG_COMPONENT = ("Core", "Gecko Profiler")