Skip to content

Commit 0d250cd

Browse files
authored
Merge pull request #4 from Unity-Technologies/unity-main-embedding-api
Unity Embedding API
2 parents 7d2fc50 + 0aeccd2 commit 0d250cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+21336
-57
lines changed

.yamato/build_linux_x64.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ commands:
2222
cmake --build .
2323
- ./build.sh -subset clr+libs+libs -a x64 -c release -ci -ninja
2424
- cp unity/unitygc/release/libunitygc.so artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64/native
25-
- artifacts/7za-linux-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64
25+
- artifacts/7za-linux-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64/*
2626

2727
artifacts:
2828
linux-x64-7z:

.yamato/build_osx_arm64.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{% metadata_file .yamato/Globals.metafile %}
2+
---
3+
name: Build OSX ARM64
4+
5+
agent:
6+
type: Unity::VM::osx
7+
image: platform-foundation/mac-10.15-bokken:latest
8+
flavor: m1.mac
9+
10+
variables:
11+
ARTIFACT_FILENAME: {{globals.artifact_base_name}}-osx-arm64.7z
12+
13+
commands:
14+
- mkdir artifacts
15+
- curl https://public-stevedore.unity3d.com/r/public/7za-mac-x64/e6c75fb7ffda_5bd76652986a0e3756d1cfd7e84ce056a9e1dbfc5f70f0514a001f724c0fbad2.zip --output artifacts/7za-mac-x64.zip
16+
- unzip artifacts/7za-mac-x64.zip -d artifacts/7za-mac-x64
17+
- |
18+
cd unity/unitygc
19+
mkdir release
20+
cd release
21+
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release ..
22+
cmake --build .
23+
- LD_LIBRARY_PATH=/usr/local/opt/openssl/lib ./build.sh -subset clr+libs -a arm64 -c release -cross -ci -ninja /p:CrossBuild=true
24+
- cp unity/unitygc/release/libunitygc.dylib artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Release/runtimes/osx-arm64/native
25+
- artifacts/7za-mac-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Release/runtimes/osx-arm64/*
26+
27+
artifacts:
28+
osx-arm64-7z:
29+
paths:
30+
- artifacts/unity/**
31+
osx-arm64:
32+
paths:
33+
- artifacts/bin/**

.yamato/build_osx_x64.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ commands:
2222
cmake --build .
2323
- LD_LIBRARY_PATH=/usr/local/opt/openssl/lib ./build.sh -subset clr+libs -a x64 -c release -ci -ninja
2424
- cp unity/unitygc/release/libunitygc.dylib artifacts/bin/microsoft.netcore.app.runtime.osx-x64/Release/runtimes/osx-x64/native
25-
- artifacts/7za-mac-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.osx-x64/Release/runtimes/osx-x64
25+
- artifacts/7za-mac-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.osx-x64/Release/runtimes/osx-x64/*
2626

2727
artifacts:
2828
osx-x64-7z:

.yamato/build_windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ commands:
1818
- build.cmd -subset clr+libs -a x86 -c release -ci
1919
- copy unity\unitygc\Release\unitygc.dll artifacts\bin\microsoft.netcore.app.runtime.win-x86\Release\runtimes\win-x86\native
2020
- powershell .yamato\scripts\download_7z.ps1
21-
- artifacts\7za-win-x64\7za.exe a artifacts\unity\%ARTIFACT_FILENAME% .\artifacts\bin\microsoft.netcore.app.runtime.win-x86\Release\runtimes\win-x86
21+
- artifacts\7za-win-x64\7za.exe a artifacts\unity\%ARTIFACT_FILENAME% .\artifacts\bin\microsoft.netcore.app.runtime.win-x86\Release\runtimes\win-x86\*
2222

2323
artifacts:
2424
win-x86-7z:

.yamato/build_windows_x64.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ commands:
1818
- build.cmd -subset clr+libs -a x64 -c release -ci
1919
- copy unity\unitygc\Release\unitygc.dll artifacts\bin\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\native
2020
- powershell .yamato\scripts\download_7z.ps1
21-
- artifacts\7za-win-x64\7za.exe a artifacts\unity\%ARTIFACT_FILENAME% .\artifacts\bin\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64
21+
- artifacts\7za-win-x64\7za.exe a artifacts\unity\%ARTIFACT_FILENAME% .\artifacts\bin\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\*
2222

2323
artifacts:
2424
win-x64-7z:

.yamato/test_linux_x64.yml

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ dependencies:
1212

1313
commands:
1414
# build/run tests
15+
# - dotnet build unity/managed.sln -c Release
16+
# - |
17+
# cd unity/embed_api_tests
18+
# cmake -DCMAKE_BUILD_TYPE=Release .
19+
# cmake --build .
20+
# ./mono_test_app
1521
- ./build.sh -subset libs.tests -test -a x64 -c release -ci -ninja
1622
- command: ./src/tests/build.sh x64 release ci
1723
retries: 1

.yamato/test_osx_arm64.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{% metadata_file .yamato/Globals.metafile %}
2+
---
3+
name: Test OSX ARM64
4+
5+
agent:
6+
type: Unity::VM::osx
7+
image: platform-foundation/mac-bokken:v0.1.8-972754
8+
flavor: m1.mac
9+
10+
dependencies:
11+
- path: .yamato/build_osx_arm64.yml
12+
13+
commands:
14+
# build/run tests
15+
- dotnet build unity/managed.sln -c Release
16+
- |
17+
cd unity/embed_api_tests
18+
cmake -DCMAKE_BUILD_TYPE=Release .
19+
cmake --build .
20+
./mono_test_app
21+
- LD_LIBRARY_PATH=/usr/local/opt/openssl/lib ./build.sh -subset libs.tests -test -a arm64 -c release -ci -ninja
22+
- ./src/tests/build.sh arm64 release ci
23+
- ./src/tests/run.sh arm64 release
24+
- ./build.sh clr.paltests
25+
- ./artifacts/bin/coreclr/OSX.arm64.Debug/paltests/runpaltests.sh $(pwd)/artifacts/bin/coreclr/OSX.arm64.Debug/paltests
26+
27+
## Don't run OSX ARM64 tests for PRs until we have hardware to actually run it
28+
# triggers:
29+
# pull_requests:
30+
# - targets:
31+
# only:
32+
# - "unity-main"

.yamato/test_osx_x64.yml

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ dependencies:
1212

1313
commands:
1414
# build/run tests
15+
- dotnet build unity/managed.sln -c Release
16+
- |
17+
cd unity/embed_api_tests
18+
cmake -DCMAKE_BUILD_TYPE=Release .
19+
cmake --build .
20+
./mono_test_app
1521
- LD_LIBRARY_PATH=/usr/local/opt/openssl/lib ./build.sh -subset libs.tests -test -a x64 -c release -ci -ninja
1622
- ./src/tests/build.sh x64 release ci
1723
- ./src/tests/run.sh x64 release

.yamato/test_windows.yml

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ dependencies:
1212

1313
commands:
1414
# build/run tests
15+
- dotnet build unity\managed.sln -c Release
16+
# - |
17+
# cd unity\embed_api_tests
18+
# cmake . -A Win32
19+
# cmake --build . --config Release
20+
# Release\mono_test_app.exe
1521
- build.cmd libs.tests -test -a x86 -c release -ci
1622
- src\tests\build.cmd x86 release ci
1723
- src\tests\run.cmd x86 release

.yamato/test_windows_x64.yml

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ dependencies:
1212

1313
commands:
1414
# build/run tests
15+
- dotnet build unity\managed.sln -c Release
16+
- |
17+
cd unity\embed_api_tests
18+
cmake .
19+
cmake --build . --config Release
20+
Release\mono_test_app.exe
1521
- build.cmd libs.tests -test -a x64 -c release -ci
1622
- src\tests\build.cmd x64 release ci
1723
- src\tests\run.cmd x64 release

src/coreclr/clrdefinitions.cmake

+9
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ if(FEATURE_EVENT_TRACE)
103103
else(FEATURE_EVENT_TRACE)
104104
add_custom_target(eventing_headers) # add a dummy target to avoid checking for FEATURE_EVENT_TRACE in multiple places
105105
endif(FEATURE_EVENT_TRACE)
106+
if(FEATURE_UNITY_EMBEDDING_INTERFACE)
107+
add_definitions(-DFEATURE_UNITY_EMBEDDING_INTERFACE)
108+
add_definitions(-DFEATURE_UNITY_GCNAME_API)
109+
add_definitions(-DFEATURE_UNITY_METHODTABLE_USER_DATA)
110+
add_definitions(-DFEATURE_UNITY_ECALL_DYNAMIC_REGISTRATION)
111+
add_definitions(-DFEATURE_UNITY_ASSEMBLY_MEMORY_PATH)
112+
add_definitions(-DFEATURE_UNITY_MODULE_NUM_TYPEDEFS)
113+
add_definitions(-DFEATURE_UNITY_EXPLICIT_LAYOUT_INHERITANCE)
114+
endif()
106115
if(FEATURE_GDBJIT)
107116
add_definitions(-DFEATURE_GDBJIT)
108117
endif()

src/coreclr/clrfeatures.cmake

+5
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ endif()
3939
if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
4040
set(FEATURE_OBJCMARSHAL 1)
4141
endif()
42+
43+
# should default this to 0 once we figure out how to enable in build scripting
44+
if(NOT DEFINED FEATURE_UNITY_EMBEDDING_INTERFACE)
45+
set(FEATURE_UNITY_EMBEDDING_INTERFACE 1)
46+
endif(NOT DEFINED FEATURE_UNITY_EMBEDDING_INTERFACE)

src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ set(CORECLR_LIBRARIES
110110
coreclrminipal
111111
)
112112

113+
if(FEATURE_UNITY_EMBEDDING_INTERFACE)
114+
list(APPEND CORECLR_LIBRARIES
115+
${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available
116+
mono
117+
${END_WHOLE_ARCHIVE}
118+
)
119+
endif(FEATURE_UNITY_EMBEDDING_INTERFACE)
120+
113121
if(CLR_CMAKE_TARGET_WIN32)
114122
list(APPEND CORECLR_LIBRARIES
115123
${STATIC_MT_CRT_LIB}

0 commit comments

Comments
 (0)