Skip to content

Commit b2e077f

Browse files
committed
Fix iOS wrong compilation target issue
1 parent dafb9b9 commit b2e077f

4 files changed

Lines changed: 28 additions & 33 deletions

File tree

common.gypi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -732,18 +732,19 @@
732732
'conditions': [
733733
['iossim!="true" and target_arch in "arm64 arm armv7s"', {
734734
'xcode_settings': {
735+
'SDKROOT': 'iphoneos',
736+
'ENABLE_BITCODE': 'YES',
735737
'OTHER_CFLAGS': [
736738
'-fembed-bitcode'
737739
],
738740
'OTHER_CPLUSPLUSFLAGS': [
739741
'-fembed-bitcode'
740742
],
741743
}
742-
}],
743-
['target_arch=="x64" or target_arch=="ia32" or (target_arch=="arm64" and iossim=="true")', {
744-
'xcode_settings': { 'SDKROOT': 'iphonesimulator' },
745744
}, {
746-
'xcode_settings': { 'SDKROOT': 'iphoneos', 'ENABLE_BITCODE': 'YES' },
745+
'xcode_settings': {
746+
'SDKROOT': 'iphonesimulator',
747+
}
747748
}],
748749
],
749750
}],

configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2420,4 +2420,4 @@ def make_bin_override():
24202420
if options.compile_commands_json and sys.platform == 'win32':
24212421
os.path.isfile('./compile_commands.json') and os.unlink('./compile_commands.json')
24222422
shutil.copy2('./out/' + config['BUILDTYPE'] + '/compile_commands.json', './compile_commands.json')
2423-
info('configure completed successfully')
2423+
info('configure completed successfully')

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
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+
if flavor in ("mac", "ios"):
70+
default_variables.setdefault("OS", flavor)
7171
default_variables.setdefault("SHARED_LIB_SUFFIX", ".dylib")
7272
default_variables.setdefault(
7373
"SHARED_LIB_DIR", generator_default_variables["PRODUCT_DIR"]
@@ -852,7 +852,7 @@ def Write(
852852
self.toolset = spec["toolset"]
853853

854854
self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec)
855-
if self.flavor == "mac":
855+
if self.flavor in ("mac", "ios"):
856856
self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec)
857857
else:
858858
self.xcode_settings = None
@@ -1047,7 +1047,7 @@ def WriteActions(
10471047

10481048
# Write the actual command.
10491049
action_commands = action["action"]
1050-
if self.flavor == "mac":
1050+
if self.flavor in ("mac", "ios"):
10511051
action_commands = [
10521052
gyp.xcode_emulation.ExpandEnvVars(command, env)
10531053
for command in action_commands
@@ -1231,7 +1231,7 @@ def WriteRules(
12311231
# action, cd_action, and mkdirs get written to a toplevel variable
12321232
# called cmd_foo. Toplevel variables can't handle things that change
12331233
# per makefile like $(TARGET), so hardcode the target.
1234-
if self.flavor == "mac":
1234+
if self.flavor in ("mac", "ios"):
12351235
action = [
12361236
gyp.xcode_emulation.ExpandEnvVars(command, env)
12371237
for command in action
@@ -1404,7 +1404,7 @@ def WriteSources(
14041404
quoter=EscapeCppDefine,
14051405
)
14061406

1407-
if self.flavor == "mac":
1407+
if self.flavor in ("mac", "ios"):
14081408
cflags = self.xcode_settings.GetCflags(
14091409
configname, arch=config.get("xcode_configuration_platform")
14101410
)
@@ -1423,7 +1423,7 @@ def WriteSources(
14231423
self.WriteList(cflags_c, "CFLAGS_C_%s" % configname)
14241424
self.WriteLn("# Flags passed to only C++ files.")
14251425
self.WriteList(cflags_cc, "CFLAGS_CC_%s" % configname)
1426-
if self.flavor == "mac":
1426+
if self.flavor in ("mac", "ios"):
14271427
self.WriteLn("# Flags passed to only ObjC files.")
14281428
self.WriteList(cflags_objc, "CFLAGS_OBJC_%s" % configname)
14291429
self.WriteLn("# Flags passed to only ObjC++ files.")
@@ -1493,7 +1493,7 @@ def WriteSources(
14931493
"%s " % precompiled_header.GetInclude("cc") + "$(CFLAGS_$(BUILDTYPE)) "
14941494
"$(CFLAGS_CC_$(BUILDTYPE))"
14951495
)
1496-
if self.flavor == "mac":
1496+
if self.flavor in ("mac", "ios"):
14971497
self.WriteLn(
14981498
"$(OBJS): GYP_OBJCFLAGS := "
14991499
"$(DEFS_$(BUILDTYPE)) "
@@ -1560,7 +1560,7 @@ def ComputeOutputBasename(self, spec):
15601560
"""
15611561
assert not self.is_mac_bundle
15621562

1563-
if self.flavor == "mac" and self.type in (
1563+
if self.flavor in ("mac", "ios") and self.type in (
15641564
"static_library",
15651565
"executable",
15661566
"shared_library",
@@ -1607,7 +1607,7 @@ def ComputeOutputBasename(self, spec):
16071607
def _InstallImmediately(self):
16081608
return (
16091609
self.toolset == "target"
1610-
and self.flavor == "mac"
1610+
and self.flavor in ("mac", "ios")
16111611
and self.type
16121612
in ("static_library", "executable", "shared_library", "loadable_module")
16131613
)
@@ -1705,7 +1705,7 @@ def WriteTarget(
17051705
if self.type != "none":
17061706
for configname in sorted(configs.keys()):
17071707
config = configs[configname]
1708-
if self.flavor == "mac":
1708+
if self.flavor in ("mac", "ios"):
17091709
ldflags = self.xcode_settings.GetLdflags(
17101710
configname,
17111711
generator_default_variables["PRODUCT_DIR"],
@@ -1740,7 +1740,7 @@ def WriteTarget(
17401740
library_dirs = [Sourceify(self.Absolutify(i)) for i in library_dirs]
17411741
ldflags += [("-L%s" % library_dir) for library_dir in library_dirs]
17421742
self.WriteList(ldflags, "LDFLAGS_%s" % configname)
1743-
if self.flavor == "mac":
1743+
if self.flavor in ("mac", "ios"):
17441744
self.WriteList(
17451745
self.xcode_settings.GetLibtoolflags(configname),
17461746
"LIBTOOLFLAGS_%s" % configname,
@@ -1749,7 +1749,7 @@ def WriteTarget(
17491749
if libraries:
17501750
# Remove duplicate entries
17511751
libraries = gyp.common.uniquer(libraries)
1752-
if self.flavor == "mac":
1752+
if self.flavor in ("mac", "ios"):
17531753
libraries = self.xcode_settings.AdjustLibraries(libraries)
17541754
self.WriteList(libraries, "LIBS")
17551755
self.WriteLn(
@@ -1758,7 +1758,7 @@ def WriteTarget(
17581758
)
17591759
self.WriteLn("%s: LIBS := $(LIBS)" % QuoteSpaces(self.output_binary))
17601760

1761-
if self.flavor == "mac":
1761+
if self.flavor in ("mac", "ios"):
17621762
self.WriteLn(
17631763
"%s: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))"
17641764
% QuoteSpaces(self.output_binary)
@@ -1767,7 +1767,7 @@ def WriteTarget(
17671767
# Postbuild actions. Like actions, but implicitly depend on the target's
17681768
# output.
17691769
postbuilds = []
1770-
if self.flavor == "mac":
1770+
if self.flavor in ("mac", "ios"):
17711771
if target_postbuilds:
17721772
postbuilds.append("$(TARGET_POSTBUILDS_$(BUILDTYPE))")
17731773
postbuilds.extend(gyp.xcode_emulation.GetSpecPostbuildCommands(spec))
@@ -1877,7 +1877,7 @@ def WriteTarget(
18771877
"Spaces in alink input filenames not supported (%s)" % link_dep
18781878
)
18791879
if (
1880-
self.flavor not in ("mac", "openbsd", "netbsd", "win")
1880+
self.flavor not in ("mac", "ios", "openbsd", "netbsd", "win")
18811881
and not self.is_standalone_static_library
18821882
):
18831883
if self.flavor in ("linux", "android"):
@@ -1995,7 +1995,7 @@ def WriteTarget(
19951995
if self.flavor != "zos":
19961996
installable_deps.append(self.output)
19971997
if (
1998-
self.flavor == "mac"
1998+
self.flavor in ("mac", "ios")
19991999
and "product_dir" not in spec
20002000
and self.toolset == "target"
20012001
):
@@ -2495,7 +2495,7 @@ def CalculateMakefilePath(build_file, base_name):
24952495
"LINK.host": LINK_host,
24962496
"PLI.host": PLI_host,
24972497
}
2498-
if flavor == "mac":
2498+
if flavor in ("mac", "ios"):
24992499
flock_command = "%s gyp-mac-tool flock" % sys.executable
25002500
header_params.update(
25012501
{
@@ -2673,7 +2673,7 @@ def CalculateMakefilePath(build_file, base_name):
26732673
spec = target_dicts[qualified_target]
26742674
configs = spec["configurations"]
26752675

2676-
if flavor == "mac":
2676+
if flavor in ("mac", "ios"):
26772677
gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec)
26782678

26792679
writer = MakefileWriter(generator_flags, flavor)

tools/ios_framework_prepare.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ build_for_arm64_device() {
6565
--with-intl=none \
6666
--cross-compiling \
6767
--enable-static \
68-
--use_clang \
69-
--ninja \
7068
--openssl-no-asm \
7169
--v8-options=--jitless \
7270
--without-sqlite \
7371
--without-node-code-cache \
7472
--without-node-snapshot
75-
JOBS=$(getconf _NPROCESSORS_ONLN) make -j$(getconf _NPROCESSORS_ONLN)
73+
make -j$(getconf _NPROCESSORS_ONLN)
7674

7775
# Move compilation outputs
7876
mkdir -p $TARGET_LIBRARY_PATH/arm64-device
@@ -91,15 +89,13 @@ build_for_arm64_simulator() {
9189
--with-intl=none \
9290
--cross-compiling \
9391
--enable-static \
94-
--use_clang \
95-
--ninja \
9692
--openssl-no-asm \
9793
--v8-options=--jitless \
9894
--without-sqlite \
9995
--without-node-code-cache \
10096
--without-node-snapshot \
10197
--ios-simulator
102-
JOBS=$(getconf _NPROCESSORS_ONLN) make -j$(getconf _NPROCESSORS_ONLN)
98+
make -j$(getconf _NPROCESSORS_ONLN)
10399

104100
# Move compilation outputs
105101
mkdir -p $TARGET_LIBRARY_PATH/arm64-simulator
@@ -118,14 +114,12 @@ build_for_x64_simulator() {
118114
--with-intl=none \
119115
--cross-compiling \
120116
--enable-static \
121-
--use_clang \
122-
--ninja \
123117
--openssl-no-asm \
124118
--v8-options=--jitless \
125119
--without-sqlite \
126120
--without-node-code-cache \
127121
--without-node-snapshot
128-
JOBS=$(getconf _NPROCESSORS_ONLN) arch -x86_64 make -j$(getconf _NPROCESSORS_ONLN)
122+
arch -x86_64 make -j$(getconf _NPROCESSORS_ONLN)
129123

130124
# Move compilation outputs
131125
mkdir -p $TARGET_LIBRARY_PATH/x64-simulator

0 commit comments

Comments
 (0)