Skip to content

Commit b7385ba

Browse files
authored
[sdks] Add targets for the watch cross compiler. (mono#7061)
* [offsets-tool] Add an '--output' argument to specify the output file directly instead of generating it from the target triple. * [sdks] Add targets for the watch cross compiler.
1 parent fc7bda6 commit b7385ba

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

sdks/builds/ios.mk

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ clean-ios-llvm:
275275
# $(1): target (cross32 or cross64)
276276
# $(2): arch (arm or aarch64)
277277
# $(3): llvm (llvm32 or llvm64)
278+
# $(4): configure target arch
279+
# $(5): offsets tool --abi argument
278280
#
279281
# Flags:
280282
# ios_$(1)_AC_VARS
@@ -284,6 +286,8 @@ clean-ios-llvm:
284286
# ios_$(1)_CONFIGURE_FLAGS
285287
define iOSCrossTemplate
286288

289+
_ios_$(1)_OFFSET_TOOL_ABI=$(5)
290+
287291
_ios_$(1)_CC=$$(CCACHE) $$(PLATFORM_BIN)/clang
288292
_ios_$(1)_CXX=$$(CCACHE) $$(PLATFORM_BIN)/clang++
289293

@@ -310,7 +314,7 @@ _ios_$(1)_LDFLAGS= \
310314

311315
_ios_$(1)_CONFIGURE_FLAGS= \
312316
$$(ios_$(1)_CONFIGURE_FLAGS) \
313-
--target=$(2)-darwin \
317+
--target=$(4) \
314318
--cache-file=$$(TOP)/sdks/builds/ios-$(1).config.cache \
315319
--prefix=$$(TOP)/sdks/out/ios-$(1) \
316320
--disable-boehm \
@@ -322,7 +326,7 @@ _ios_$(1)_CONFIGURE_FLAGS= \
322326
--enable-dtrace=yes \
323327
--enable-icall-symbol-map \
324328
--enable-minimal=com,remoting \
325-
--with-cross-offsets=$(2)-apple-darwin10.h \
329+
--with-cross-offsets=$(4).h \
326330
--with-llvm=$$(TOP)/sdks/out/ios-$(3)
327331

328332
_ios_$(1)_CONFIGURE_ENVIRONMENT= \
@@ -343,13 +347,13 @@ _ios_$(1)_CONFIGURE_ENVIRONMENT= \
343347
$$(TOP)/sdks/builds/ios-$(1)/mono/utils/mono-dtrace.h: .stamp-ios-$(1)-configure
344348
$$(MAKE) -C $$(dir $$@) $$(notdir $$@)
345349

346-
$$(TOP)/sdks/builds/ios-$(1)/$(2)-apple-darwin10.h: .stamp-ios-$(1)-configure $$(TOP)/sdks/builds/ios-$(1)/mono/utils/mono-dtrace.h $$(TOP)/tools/offsets-tool/MonoAotOffsetsDumper.exe
350+
$$(TOP)/sdks/builds/ios-$(1)/$(4).h: .stamp-ios-$(1)-configure $$(TOP)/sdks/builds/ios-$(1)/mono/utils/mono-dtrace.h $$(TOP)/tools/offsets-tool/MonoAotOffsetsDumper.exe
347351
cd $$(TOP)/sdks/builds/ios-$(1) && \
348352
MONO_PATH=$(TOP)/tools/offsets-tool/CppSharp/osx_32 \
349353
mono --arch=32 --debug $$(TOP)/tools/offsets-tool/MonoAotOffsetsDumper.exe \
350-
--gen-ios --abi $(2)-apple-darwin10 --out $$(TOP)/sdks/builds/ios-$(1)/ --mono $$(TOP) --targetdir $$(TOP)/sdks/builds/ios-$(1)
354+
--gen-ios --abi $$(_ios_$(1)_OFFSET_TOOL_ABI) --outfile $$@ --mono $$(TOP) --targetdir $$(TOP)/sdks/builds/ios-$(1)
351355

352-
build-ios-$(1): $$(TOP)/sdks/builds/ios-$(1)/$(2)-apple-darwin10.h
356+
build-ios-$(1): $$(TOP)/sdks/builds/ios-$(1)/$(4).h
353357

354358
.PHONY: package-ios-$(1)
355359
package-ios-$(1):
@@ -364,7 +368,8 @@ TARGETS += ios-$(1)
364368
endef
365369

366370
ios_cross32_CONFIGURE_FLAGS=--build=i386-apple-darwin10
367-
$(eval $(call iOSCrossTemplate,cross32,arm,llvm32))
368-
$(eval $(call iOSCrossTemplate,cross64,aarch64,llvm64))
369-
371+
ios_crosswatch_CONFIGURE_FLAGS=--build=i386-apple-darwin10 --with-cooperative-gc=yes
372+
$(eval $(call iOSCrossTemplate,cross32,arm,llvm32,arm-darwin,arm-apple-darwin10))
373+
$(eval $(call iOSCrossTemplate,cross64,aarch64,llvm64,aarch64-darwin,aarch64-apple-darwin10))
374+
$(eval $(call iOSCrossTemplate,crosswatch,armv7k,llvm32,armv7k-unknown-darwin,armv7k-apple-darwin))
370375

tools/offsets-tool/MonoAotOffsetsDumper.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static class MonoAotOffsetsDumper
2323

2424
static List<string> Abis = new List<string> ();
2525
static string OutputDir;
26+
static string OutputFile;
2627

2728
static string MonodroidDir = @"";
2829
static string AndroidNdkPath = @"";
@@ -271,6 +272,7 @@ static void ParseCommandLineArgs(string[] args)
271272
var options = new Mono.Options.OptionSet () {
272273
{ "abi=", "ABI triple to generate", v => Abis.Add(v) },
273274
{ "o|out=", "output directory", v => OutputDir = v },
275+
{ "outfile=", "output directory", v => OutputFile = v },
274276
{ "maccore=", "include directory", v => MaccoreDir = v },
275277
{ "monodroid=", "top monodroid directory", v => MonodroidDir = v },
276278
{ "android-ndk=", "Path to Android NDK", v => AndroidNdkPath = v },
@@ -650,12 +652,18 @@ static string GetTargetPlatformDefine(TargetPlatform target)
650652

651653
static void Dump(ASTContext ctx, ParserTargetInfo targetInfo, Target target)
652654
{
653-
var targetFile = target.Triple;
655+
string targetFile;
654656

655-
if (!string.IsNullOrEmpty (OutputDir))
656-
targetFile = Path.Combine (OutputDir, targetFile);
657+
if (!string.IsNullOrEmpty (OutputFile)) {
658+
targetFile = OutputFile;
659+
} else {
660+
targetFile = target.Triple;
657661

658-
targetFile += ".h";
662+
if (!string.IsNullOrEmpty (OutputDir))
663+
targetFile = Path.Combine (OutputDir, targetFile);
664+
665+
targetFile += ".h";
666+
}
659667

660668
using (var writer = new StreamWriter(targetFile))
661669
//using (var writer = Console.Out)

0 commit comments

Comments
 (0)