1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2# vim: set filetype=python:
3# This Source Code Form is subject to the terms of the Mozilla Public
4# License, v. 2.0. If a copy of the MPL was not distributed with this
5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7FINAL_LIBRARY = "mozglue"
8
9EXPORTS.mozilla += [
10    "AutoProfilerLabel.h",
11    "AwakeTimeStamp.h",
12    "decimal/Decimal.h",
13    "decimal/DoubleConversion.h",
14    "IntegerPrintfMacros.h",
15    "MmapFaultHandler.h",
16    "PlatformConditionVariable.h",
17    "PlatformMutex.h",
18    "Printf.h",
19    "Sprintf.h",
20    "StackWalk.h",
21    "TimeStamp.h",
22    "Uptime.h",
23]
24
25EXPORTS.mozilla.glue += [
26    "Debug.h",
27    "WinUtils.h",
28]
29
30if CONFIG["OS_ARCH"] == "WINNT":
31    EXPORTS.mozilla += [
32        "GetKnownFolderPath.h",
33        "PreXULSkeletonUI.h",
34        "StackWalk_windows.h",
35        "StackWalkThread.h",
36        "TimeStamp_windows.h",
37        "WindowsDpiAwareness.h",
38    ]
39
40SOURCES += [
41    "AutoProfilerLabel.cpp",
42    "AwakeTimeStamp.cpp",
43    "MmapFaultHandler.cpp",
44    "Printf.cpp",
45    "StackWalk.cpp",
46    "TimeStamp.cpp",
47    "Uptime.cpp",
48]
49
50OS_LIBS += CONFIG["REALTIME_LIBS"]
51
52if CONFIG["OS_ARCH"] == "WINNT":
53    DIRS += [
54        "interceptor",
55    ]
56    EXPORTS += [
57        "nsWindowsDllInterceptor.h",
58    ]
59    EXPORTS.mozilla += [
60        "DynamicallyLinkedFunctionPtr.h",
61        "ImportDir.h",
62        "NativeNt.h",
63        "WindowsDpiInitialization.h",
64        "WindowsEnumProcessModules.h",
65        "WindowsMapRemoteView.h",
66        "WindowsProcessMitigations.h",
67    ]
68    EXPORTS.mozilla.glue += [
69        "WindowsUnicode.h",
70    ]
71    SOURCES += [
72        "GetKnownFolderPath.cpp",
73        "TimeStamp_windows.cpp",
74        "WindowsDpiInitialization.cpp",
75        "WindowsMapRemoteView.cpp",
76        "WindowsProcessMitigations.cpp",
77        "WindowsUnicode.cpp",
78    ]
79
80    OS_LIBS += [
81        "dbghelp",
82        "oleaut32",
83        "ole32",
84    ]
85
86    if not CONFIG["JS_STANDALONE"]:
87        SOURCES += [
88            "PreXULSkeletonUI.cpp",
89        ]
90
91    if CONFIG["ACCESSIBILITY"]:
92        SOURCES += [
93            "/ipc/mscom/ActivationContext.cpp",
94            "/ipc/mscom/ProcessRuntime.cpp",
95        ]
96elif CONFIG["HAVE_CLOCK_MONOTONIC"]:
97    SOURCES += [
98        "TimeStamp_posix.cpp",
99    ]
100elif CONFIG["OS_ARCH"] == "Darwin":
101    SOURCES += [
102        "TimeStamp_darwin.cpp",
103    ]
104elif CONFIG["COMPILE_ENVIRONMENT"]:
105    error("No TimeStamp implementation on this platform.  Build will not succeed")
106
107if CONFIG["OS_ARCH"] == "WINNT":
108    SOURCES += [
109        "ConditionVariable_windows.cpp",
110        "Mutex_windows.cpp",
111    ]
112# WASI hasn't supported cond vars and mutexes yet so noop implementation is used.
113elif CONFIG["OS_ARCH"] == "WASI":
114    SOURCES += [
115        "ConditionVariable_noop.cpp",
116        "Mutex_noop.cpp",
117    ]
118else:
119    SOURCES += [
120        "ConditionVariable_posix.cpp",
121        "Mutex_posix.cpp",
122    ]
123
124if CONFIG["MOZ_LINKER"] and CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
125    LOCAL_INCLUDES += [
126        "/mozglue/linker",
127    ]
128
129SOURCES += [
130    "decimal/Decimal.cpp",
131]
132
133if CONFIG["CC_TYPE"] == "clang":
134    # Suppress warnings from third-party V8 Decimal code.
135    SOURCES["decimal/Decimal.cpp"].flags += ["-Wno-implicit-fallthrough"]
136
137for var in ("MOZ_APP_BASENAME", "MOZ_APP_VENDOR"):
138    DEFINES[var] = '"%s"' % CONFIG[var]
139