Skip to content

Commit

Permalink
[mono] Improve iOS sample Makefile (#105316)
Browse files Browse the repository at this point in the history
Fixes an issue where we were still harcoding the Debug config for tasks even though that changed with #84931.
Also align the Makfile to make it more similar to the iOS-NativeAOT one.
  • Loading branch information
akoeplinger authored Jul 24, 2024
1 parent d91d9a1 commit f6994c7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
8 changes: 4 additions & 4 deletions eng/pipelines/coreclr/templates/build-perf-sample-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ steps:
displayName: clean bindir

- ${{ if and(eq(parameters.osGroup, 'ios'), eq(parameters.nameSuffix, 'iOSMono')) }}:
- script: make build-appbundle TARGET=ios MONO_ARCH=arm64 MONO_CONFIG=Release AOT=True USE_LLVM=False DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=false HYBRID_GLOBALIZATION=${{ parameters.hybridGlobalization }}
- script: make build-appbundle TARGET_OS=ios TARGET_ARCH=arm64 BUILD_CONFIG=Release AOT=True USE_LLVM=False DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=false HYBRID_GLOBALIZATION=${{ parameters.hybridGlobalization }}
env:
DevTeamProvisioning: '-'
workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS
Expand All @@ -60,7 +60,7 @@ steps:
- script: rm -r -f $(Build.SourcesDirectory)/src/mono/sample/iOS/bin
workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS
displayName: Clean bindir
- script: make build-appbundle TARGET=ios MONO_ARCH=arm64 MONO_CONFIG=Release AOT=True USE_LLVM=False DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=true HYBRID_GLOBALIZATION=${{ parameters.hybridGlobalization }}
- script: make build-appbundle TARGET_OS=ios TARGET_ARCH=arm64 BUILD_CONFIG=Release AOT=True USE_LLVM=False DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=true HYBRID_GLOBALIZATION=${{ parameters.hybridGlobalization }}
env:
DevTeamProvisioning: '-'
workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS
Expand All @@ -82,7 +82,7 @@ steps:
- script: rm -r -f $(Build.SourcesDirectory)/src/mono/sample/iOS/bin
workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS
displayName: Clean bindir
- script: make build-appbundle TARGET=ios MONO_ARCH=arm64 MONO_CONFIG=Release AOT=True USE_LLVM=True DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=false HYBRID_GLOBALIZATION=${{ parameters.hybridGlobalization }}
- script: make build-appbundle TARGET_OS=ios TARGET_ARCH=arm64 BUILD_CONFIG=Release AOT=True USE_LLVM=True DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=false HYBRID_GLOBALIZATION=${{ parameters.hybridGlobalization }}
env:
DevTeamProvisioning: '-'
workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS
Expand All @@ -104,7 +104,7 @@ steps:
- script: rm -r -f $(Build.SourcesDirectory)/src/mono/sample/iOS/bin
workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS
displayName: Clean bindir
- script: make build-appbundle TARGET=ios MONO_ARCH=arm64 MONO_CONFIG=Release AOT=True USE_LLVM=True DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=true HYBRID_GLOBALIZATION=${{ parameters.hybridGlobalization }}
- script: make build-appbundle TARGET_OS=ios TARGET_ARCH=arm64 BUILD_CONFIG=Release AOT=True USE_LLVM=True DEPLOY_AND_RUN=false STRIP_DEBUG_SYMBOLS=true HYBRID_GLOBALIZATION=${{ parameters.hybridGlobalization }}
env:
DevTeamProvisioning: '-'
workingDirectory: $(Build.SourcesDirectory)/src/mono/sample/iOS
Expand Down
53 changes: 30 additions & 23 deletions src/mono/sample/iOS/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
MONO_CONFIG?=Debug
MONO_ARCH?=x64
DOTNET := ../../../../dotnet.sh
.DEFAULT_GOAL := all

TOP=../../../../

BUILD_CONFIG?=Debug
TARGET_ARCH?=$(shell . $(TOP)eng/common/native/init-os-and-arch.sh && echo $${arch})
TARGET_OS?=iossimulator
USE_LLVM=true
TARGET?=iossimulator
DEPLOY_AND_RUN?=true
APP_SANDBOX?=false
STRIP_DEBUG_SYMBOLS?=false # only used when measuring SOD via build-appbundle make target
Expand All @@ -15,22 +18,26 @@ HYBRID_GLOBALIZATION?=true
#DIAGNOSTIC_PORTS=127.0.0.1:9000,suspend
#DIAGNOSTIC_PORTS=$(DOTNET_DiagnosticPorts)

REPO_DIR=$(realpath $(TOP))
TASKS_DIR=$(REPO_DIR)/src/tasks
DOTNET=$(REPO_DIR)/dotnet.sh
BUILD_SCRIPT=$(REPO_DIR)/build.sh

all: runtimepack run

TOOLS_DIR=../../../tasks
appbuilder:
$(DOTNET) build -c Debug $(TOOLS_DIR)/AotCompilerTask/MonoAOTCompiler.csproj
$(DOTNET) build -c Debug $(TOOLS_DIR)/MonoTargetsTasks/MonoTargetsTasks.csproj
$(DOTNET) build -c Debug $(TOOLS_DIR)/AppleAppBuilder/AppleAppBuilder.csproj
$(DOTNET) build -c $(BUILD_CONFIG) $(TASKS_DIR)/AotCompilerTask/MonoAOTCompiler.csproj
$(DOTNET) build -c $(BUILD_CONFIG) $(TASKS_DIR)/MonoTargetsTasks/MonoTargetsTasks.csproj
$(DOTNET) build -c $(BUILD_CONFIG) $(TASKS_DIR)/AppleAppBuilder/AppleAppBuilder.csproj

runtimepack:
../../../../build.sh mono+libs -os $(TARGET) -arch $(MONO_ARCH) -c $(MONO_CONFIG)
$(BUILD_SCRIPT) mono+libs -os $(TARGET_OS) -arch $(TARGET_ARCH) -c $(BUILD_CONFIG)

build-appbundle: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
/p:TargetOS=$(TARGET) \
/p:TargetArchitecture=$(MONO_ARCH) \
-c $(BUILD_CONFIG) \
/p:TargetOS=$(TARGET_OS) \
/p:TargetArchitecture=$(TARGET_ARCH) \
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:StripDebugSymbols=$(STRIP_DEBUG_SYMBOLS) \
/p:DeployAndRun=false \
Expand All @@ -39,19 +46,19 @@ build-appbundle: clean appbuilder

run: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
-c $(BUILD_CONFIG) \
/p:TargetOS=ios \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:TargetArchitecture=$(TARGET_ARCH) \
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
'/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"' \
/bl

run-sim: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
-c $(BUILD_CONFIG) \
/p:TargetOS=iossimulator \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:TargetArchitecture=$(TARGET_ARCH) \
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:MonoForceInterpreter=false \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
Expand All @@ -60,9 +67,9 @@ run-sim: clean appbuilder

run-sim-interp: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
-c $(BUILD_CONFIG) \
/p:TargetOS=iossimulator \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:TargetArchitecture=$(TARGET_ARCH) \
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:MonoForceInterpreter=true \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
Expand All @@ -71,9 +78,9 @@ run-sim-interp: clean appbuilder

run-catalyst: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
-c $(BUILD_CONFIG) \
/p:TargetOS=maccatalyst \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:TargetArchitecture=$(TARGET_ARCH) \
/p:MonoEnableLLVM=false \
/p:MonoForceInterpreter=false \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
Expand All @@ -82,14 +89,14 @@ run-catalyst: clean appbuilder

run-catalyst-interp: clean appbuilder
$(DOTNET) publish \
-c $(MONO_CONFIG) \
-c $(BUILD_CONFIG) \
/p:TargetOS=maccatalyst \
/p:TargetArchitecture=$(MONO_ARCH) \
/p:TargetArchitecture=$(TARGET_ARCH) \
/p:MonoEnableLLVM=false \
/p:MonoForceInterpreter=true \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
/p:EnableAppSandbox=$(APP_SANDBOX) \
/bl

clean:
rm -rf bin
rm -rf obj bin *.binlog

0 comments on commit f6994c7

Please sign in to comment.