Skip to content

Commit 0083219

Browse files
committed
Use clang and ninja for iOS, include iOS in make and ninja builds
1 parent ddc75b1 commit 0083219

4 files changed

Lines changed: 96 additions & 51 deletions

File tree

tools/gyp/pylib/gyp/generator/make.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@
6666
def CalculateVariables(default_variables, params):
6767
"""Calculate additional variables for use in the build (called by gyp)."""
6868
flavor = gyp.common.GetFlavor(params)
69-
if flavor == "mac":
70-
default_variables.setdefault("OS", "mac")
69+
# nodejs-mobile patch: add ios
70+
if flavor in ("mac", "ios"):
71+
default_variables.setdefault("OS", flavor)
7172
default_variables.setdefault("SHARED_LIB_SUFFIX", ".dylib")
7273
default_variables.setdefault(
7374
"SHARED_LIB_DIR", generator_default_variables["PRODUCT_DIR"]
@@ -852,7 +853,8 @@ def Write(
852853
self.toolset = spec["toolset"]
853854

854855
self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec)
855-
if self.flavor == "mac":
856+
# nodejs-mobile patch: add ios
857+
if self.flavor in ("mac", "ios"):
856858
self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec)
857859
else:
858860
self.xcode_settings = None
@@ -1047,7 +1049,8 @@ def WriteActions(
10471049

10481050
# Write the actual command.
10491051
action_commands = action["action"]
1050-
if self.flavor == "mac":
1052+
# nodejs-mobile patch: add ios
1053+
if self.flavor in ("mac", "ios"):
10511054
action_commands = [
10521055
gyp.xcode_emulation.ExpandEnvVars(command, env)
10531056
for command in action_commands
@@ -1231,7 +1234,8 @@ def WriteRules(
12311234
# action, cd_action, and mkdirs get written to a toplevel variable
12321235
# called cmd_foo. Toplevel variables can't handle things that change
12331236
# per makefile like $(TARGET), so hardcode the target.
1234-
if self.flavor == "mac":
1237+
# nodejs-mobile patch: add ios
1238+
if self.flavor in ("mac", "ios"):
12351239
action = [
12361240
gyp.xcode_emulation.ExpandEnvVars(command, env)
12371241
for command in action
@@ -1404,7 +1408,8 @@ def WriteSources(
14041408
quoter=EscapeCppDefine,
14051409
)
14061410

1407-
if self.flavor == "mac":
1411+
# nodejs-mobile patch: add ios
1412+
if self.flavor in ("mac", "ios"):
14081413
cflags = self.xcode_settings.GetCflags(
14091414
configname, arch=config.get("xcode_configuration_platform")
14101415
)
@@ -1423,7 +1428,8 @@ def WriteSources(
14231428
self.WriteList(cflags_c, "CFLAGS_C_%s" % configname)
14241429
self.WriteLn("# Flags passed to only C++ files.")
14251430
self.WriteList(cflags_cc, "CFLAGS_CC_%s" % configname)
1426-
if self.flavor == "mac":
1431+
# nodejs-mobile patch: add ios
1432+
if self.flavor in ("mac", "ios"):
14271433
self.WriteLn("# Flags passed to only ObjC files.")
14281434
self.WriteList(cflags_objc, "CFLAGS_OBJC_%s" % configname)
14291435
self.WriteLn("# Flags passed to only ObjC++ files.")
@@ -1493,7 +1499,8 @@ def WriteSources(
14931499
"%s " % precompiled_header.GetInclude("cc") + "$(CFLAGS_$(BUILDTYPE)) "
14941500
"$(CFLAGS_CC_$(BUILDTYPE))"
14951501
)
1496-
if self.flavor == "mac":
1502+
# nodejs-mobile patch: add ios
1503+
if self.flavor in ("mac", "ios"):
14971504
self.WriteLn(
14981505
"$(OBJS): GYP_OBJCFLAGS := "
14991506
"$(DEFS_$(BUILDTYPE)) "
@@ -1560,7 +1567,8 @@ def ComputeOutputBasename(self, spec):
15601567
"""
15611568
assert not self.is_mac_bundle
15621569

1563-
if self.flavor == "mac" and self.type in (
1570+
# nodejs-mobile patch: add ios
1571+
if self.flavor in ("mac", "ios") and self.type in (
15641572
"static_library",
15651573
"executable",
15661574
"shared_library",
@@ -1607,7 +1615,7 @@ def ComputeOutputBasename(self, spec):
16071615
def _InstallImmediately(self):
16081616
return (
16091617
self.toolset == "target"
1610-
and self.flavor == "mac"
1618+
and self.flavor in ("mac", "ios") # nodejs-mobile patch: add ios
16111619
and self.type
16121620
in ("static_library", "executable", "shared_library", "loadable_module")
16131621
)
@@ -1705,7 +1713,8 @@ def WriteTarget(
17051713
if self.type != "none":
17061714
for configname in sorted(configs.keys()):
17071715
config = configs[configname]
1708-
if self.flavor == "mac":
1716+
# nodejs-mobile patch: add ios
1717+
if self.flavor in ("mac", "ios"):
17091718
ldflags = self.xcode_settings.GetLdflags(
17101719
configname,
17111720
generator_default_variables["PRODUCT_DIR"],
@@ -1740,7 +1749,8 @@ def WriteTarget(
17401749
library_dirs = [Sourceify(self.Absolutify(i)) for i in library_dirs]
17411750
ldflags += [("-L%s" % library_dir) for library_dir in library_dirs]
17421751
self.WriteList(ldflags, "LDFLAGS_%s" % configname)
1743-
if self.flavor == "mac":
1752+
# nodejs-mobile patch: add ios
1753+
if self.flavor in ("mac", "ios"):
17441754
self.WriteList(
17451755
self.xcode_settings.GetLibtoolflags(configname),
17461756
"LIBTOOLFLAGS_%s" % configname,
@@ -1749,7 +1759,8 @@ def WriteTarget(
17491759
if libraries:
17501760
# Remove duplicate entries
17511761
libraries = gyp.common.uniquer(libraries)
1752-
if self.flavor == "mac":
1762+
# nodejs-mobile patch: add ios
1763+
if self.flavor in ("mac", "ios"):
17531764
libraries = self.xcode_settings.AdjustLibraries(libraries)
17541765
self.WriteList(libraries, "LIBS")
17551766
self.WriteLn(
@@ -1758,7 +1769,8 @@ def WriteTarget(
17581769
)
17591770
self.WriteLn("%s: LIBS := $(LIBS)" % QuoteSpaces(self.output_binary))
17601771

1761-
if self.flavor == "mac":
1772+
# nodejs-mobile patch: add ios
1773+
if self.flavor in ("mac", "ios"):
17621774
self.WriteLn(
17631775
"%s: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))"
17641776
% QuoteSpaces(self.output_binary)
@@ -1767,7 +1779,8 @@ def WriteTarget(
17671779
# Postbuild actions. Like actions, but implicitly depend on the target's
17681780
# output.
17691781
postbuilds = []
1770-
if self.flavor == "mac":
1782+
# nodejs-mobile patch: add ios
1783+
if self.flavor in ("mac", "ios"):
17711784
if target_postbuilds:
17721785
postbuilds.append("$(TARGET_POSTBUILDS_$(BUILDTYPE))")
17731786
postbuilds.extend(gyp.xcode_emulation.GetSpecPostbuildCommands(spec))
@@ -1877,7 +1890,7 @@ def WriteTarget(
18771890
"Spaces in alink input filenames not supported (%s)" % link_dep
18781891
)
18791892
if (
1880-
self.flavor not in ("mac", "openbsd", "netbsd", "win")
1893+
self.flavor not in ("mac", "ios", "openbsd", "netbsd", "win") # nodejs-mobile patch: add ios
18811894
and not self.is_standalone_static_library
18821895
):
18831896
if self.flavor in ("linux", "android"):
@@ -1995,7 +2008,8 @@ def WriteTarget(
19952008
if self.flavor != "zos":
19962009
installable_deps.append(self.output)
19972010
if (
1998-
self.flavor == "mac"
2011+
# nodejs-mobile patch: add ios
2012+
self.flavor in ("mac", "ios")
19992013
and "product_dir" not in spec
20002014
and self.toolset == "target"
20012015
):
@@ -2495,7 +2509,8 @@ def CalculateMakefilePath(build_file, base_name):
24952509
"LINK.host": LINK_host,
24962510
"PLI.host": PLI_host,
24972511
}
2498-
if flavor == "mac":
2512+
# nodejs-mobile patch: add ios
2513+
if flavor in ("mac", "ios"):
24992514
flock_command = "%s gyp-mac-tool flock" % sys.executable
25002515
header_params.update(
25012516
{
@@ -2673,7 +2688,8 @@ def CalculateMakefilePath(build_file, base_name):
26732688
spec = target_dicts[qualified_target]
26742689
configs = spec["configurations"]
26752690

2676-
if flavor == "mac":
2691+
# nodejs-mobile patch: add ios
2692+
if flavor in ("mac", "ios"):
26772693
gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec)
26782694

26792695
writer = MakefileWriter(generator_flags, flavor)

0 commit comments

Comments
 (0)