Skip to content

Commit

Permalink
[sdks] Add targets for the watch cross compiler. (mono#7061)
Browse files Browse the repository at this point in the history
* [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.
  • Loading branch information
vargaz committed Feb 15, 2018
1 parent fc7bda6 commit b7385ba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
21 changes: 13 additions & 8 deletions sdks/builds/ios.mk
Expand Up @@ -275,6 +275,8 @@ clean-ios-llvm:
# $(1): target (cross32 or cross64)
# $(2): arch (arm or aarch64)
# $(3): llvm (llvm32 or llvm64)
# $(4): configure target arch
# $(5): offsets tool --abi argument
#
# Flags:
# ios_$(1)_AC_VARS
Expand All @@ -284,6 +286,8 @@ clean-ios-llvm:
# ios_$(1)_CONFIGURE_FLAGS
define iOSCrossTemplate

_ios_$(1)_OFFSET_TOOL_ABI=$(5)

_ios_$(1)_CC=$$(CCACHE) $$(PLATFORM_BIN)/clang
_ios_$(1)_CXX=$$(CCACHE) $$(PLATFORM_BIN)/clang++

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

_ios_$(1)_CONFIGURE_FLAGS= \
$$(ios_$(1)_CONFIGURE_FLAGS) \
--target=$(2)-darwin \
--target=$(4) \
--cache-file=$$(TOP)/sdks/builds/ios-$(1).config.cache \
--prefix=$$(TOP)/sdks/out/ios-$(1) \
--disable-boehm \
Expand All @@ -322,7 +326,7 @@ _ios_$(1)_CONFIGURE_FLAGS= \
--enable-dtrace=yes \
--enable-icall-symbol-map \
--enable-minimal=com,remoting \
--with-cross-offsets=$(2)-apple-darwin10.h \
--with-cross-offsets=$(4).h \
--with-llvm=$$(TOP)/sdks/out/ios-$(3)

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

$$(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
$$(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
cd $$(TOP)/sdks/builds/ios-$(1) && \
MONO_PATH=$(TOP)/tools/offsets-tool/CppSharp/osx_32 \
mono --arch=32 --debug $$(TOP)/tools/offsets-tool/MonoAotOffsetsDumper.exe \
--gen-ios --abi $(2)-apple-darwin10 --out $$(TOP)/sdks/builds/ios-$(1)/ --mono $$(TOP) --targetdir $$(TOP)/sdks/builds/ios-$(1)
--gen-ios --abi $$(_ios_$(1)_OFFSET_TOOL_ABI) --outfile $$@ --mono $$(TOP) --targetdir $$(TOP)/sdks/builds/ios-$(1)

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

.PHONY: package-ios-$(1)
package-ios-$(1):
Expand All @@ -364,7 +368,8 @@ TARGETS += ios-$(1)
endef

ios_cross32_CONFIGURE_FLAGS=--build=i386-apple-darwin10
$(eval $(call iOSCrossTemplate,cross32,arm,llvm32))
$(eval $(call iOSCrossTemplate,cross64,aarch64,llvm64))

ios_crosswatch_CONFIGURE_FLAGS=--build=i386-apple-darwin10 --with-cooperative-gc=yes
$(eval $(call iOSCrossTemplate,cross32,arm,llvm32,arm-darwin,arm-apple-darwin10))
$(eval $(call iOSCrossTemplate,cross64,aarch64,llvm64,aarch64-darwin,aarch64-apple-darwin10))
$(eval $(call iOSCrossTemplate,crosswatch,armv7k,llvm32,armv7k-unknown-darwin,armv7k-apple-darwin))

16 changes: 12 additions & 4 deletions tools/offsets-tool/MonoAotOffsetsDumper.cs
Expand Up @@ -23,6 +23,7 @@ static class MonoAotOffsetsDumper

static List<string> Abis = new List<string> ();
static string OutputDir;
static string OutputFile;

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

static void Dump(ASTContext ctx, ParserTargetInfo targetInfo, Target target)
{
var targetFile = target.Triple;
string targetFile;

if (!string.IsNullOrEmpty (OutputDir))
targetFile = Path.Combine (OutputDir, targetFile);
if (!string.IsNullOrEmpty (OutputFile)) {
targetFile = OutputFile;
} else {
targetFile = target.Triple;

targetFile += ".h";
if (!string.IsNullOrEmpty (OutputDir))
targetFile = Path.Combine (OutputDir, targetFile);

targetFile += ".h";
}

using (var writer = new StreamWriter(targetFile))
//using (var writer = Console.Out)
Expand Down

0 comments on commit b7385ba

Please sign in to comment.