Skip to content

Commit

Permalink
Merge pull request #4 from Unity-Technologies/unity-main-embedding-api
Browse files Browse the repository at this point in the history
Unity Embedding API
  • Loading branch information
joncham authored Mar 1, 2022
2 parents 7d2fc50 + 0aeccd2 commit 0d250cd
Show file tree
Hide file tree
Showing 55 changed files with 21,336 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .yamato/build_linux_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ commands:
cmake --build .
- ./build.sh -subset clr+libs+libs -a x64 -c release -ci -ninja
- cp unity/unitygc/release/libunitygc.so artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64/native
- artifacts/7za-linux-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64
- artifacts/7za-linux-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.linux-x64/Release/runtimes/linux-x64/*

artifacts:
linux-x64-7z:
Expand Down
33 changes: 33 additions & 0 deletions .yamato/build_osx_arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% metadata_file .yamato/Globals.metafile %}
---
name: Build OSX ARM64

agent:
type: Unity::VM::osx
image: platform-foundation/mac-10.15-bokken:latest
flavor: m1.mac

variables:
ARTIFACT_FILENAME: {{globals.artifact_base_name}}-osx-arm64.7z

commands:
- mkdir artifacts
- curl https://public-stevedore.unity3d.com/r/public/7za-mac-x64/e6c75fb7ffda_5bd76652986a0e3756d1cfd7e84ce056a9e1dbfc5f70f0514a001f724c0fbad2.zip --output artifacts/7za-mac-x64.zip
- unzip artifacts/7za-mac-x64.zip -d artifacts/7za-mac-x64
- |
cd unity/unitygc
mkdir release
cd release
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
- LD_LIBRARY_PATH=/usr/local/opt/openssl/lib ./build.sh -subset clr+libs -a arm64 -c release -cross -ci -ninja /p:CrossBuild=true
- cp unity/unitygc/release/libunitygc.dylib artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Release/runtimes/osx-arm64/native
- artifacts/7za-mac-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Release/runtimes/osx-arm64/*

artifacts:
osx-arm64-7z:
paths:
- artifacts/unity/**
osx-arm64:
paths:
- artifacts/bin/**
2 changes: 1 addition & 1 deletion .yamato/build_osx_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ commands:
cmake --build .
- LD_LIBRARY_PATH=/usr/local/opt/openssl/lib ./build.sh -subset clr+libs -a x64 -c release -ci -ninja
- cp unity/unitygc/release/libunitygc.dylib artifacts/bin/microsoft.netcore.app.runtime.osx-x64/Release/runtimes/osx-x64/native
- artifacts/7za-mac-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.osx-x64/Release/runtimes/osx-x64
- artifacts/7za-mac-x64/7za a artifacts/unity/$ARTIFACT_FILENAME ./artifacts/bin/microsoft.netcore.app.runtime.osx-x64/Release/runtimes/osx-x64/*

artifacts:
osx-x64-7z:
Expand Down
2 changes: 1 addition & 1 deletion .yamato/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ commands:
- build.cmd -subset clr+libs -a x86 -c release -ci
- copy unity\unitygc\Release\unitygc.dll artifacts\bin\microsoft.netcore.app.runtime.win-x86\Release\runtimes\win-x86\native
- powershell .yamato\scripts\download_7z.ps1
- artifacts\7za-win-x64\7za.exe a artifacts\unity\%ARTIFACT_FILENAME% .\artifacts\bin\microsoft.netcore.app.runtime.win-x86\Release\runtimes\win-x86
- artifacts\7za-win-x64\7za.exe a artifacts\unity\%ARTIFACT_FILENAME% .\artifacts\bin\microsoft.netcore.app.runtime.win-x86\Release\runtimes\win-x86\*

artifacts:
win-x86-7z:
Expand Down
2 changes: 1 addition & 1 deletion .yamato/build_windows_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ commands:
- build.cmd -subset clr+libs -a x64 -c release -ci
- copy unity\unitygc\Release\unitygc.dll artifacts\bin\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\native
- powershell .yamato\scripts\download_7z.ps1
- artifacts\7za-win-x64\7za.exe a artifacts\unity\%ARTIFACT_FILENAME% .\artifacts\bin\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64
- artifacts\7za-win-x64\7za.exe a artifacts\unity\%ARTIFACT_FILENAME% .\artifacts\bin\microsoft.netcore.app.runtime.win-x64\Release\runtimes\win-x64\*

artifacts:
win-x64-7z:
Expand Down
6 changes: 6 additions & 0 deletions .yamato/test_linux_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ dependencies:

commands:
# build/run tests
# - dotnet build unity/managed.sln -c Release
# - |
# cd unity/embed_api_tests
# cmake -DCMAKE_BUILD_TYPE=Release .
# cmake --build .
# ./mono_test_app
- ./build.sh -subset libs.tests -test -a x64 -c release -ci -ninja
- command: ./src/tests/build.sh x64 release ci
retries: 1
Expand Down
32 changes: 32 additions & 0 deletions .yamato/test_osx_arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% metadata_file .yamato/Globals.metafile %}
---
name: Test OSX ARM64

agent:
type: Unity::VM::osx
image: platform-foundation/mac-bokken:v0.1.8-972754
flavor: m1.mac

dependencies:
- path: .yamato/build_osx_arm64.yml

commands:
# build/run tests
- dotnet build unity/managed.sln -c Release
- |
cd unity/embed_api_tests
cmake -DCMAKE_BUILD_TYPE=Release .
cmake --build .
./mono_test_app
- LD_LIBRARY_PATH=/usr/local/opt/openssl/lib ./build.sh -subset libs.tests -test -a arm64 -c release -ci -ninja
- ./src/tests/build.sh arm64 release ci
- ./src/tests/run.sh arm64 release
- ./build.sh clr.paltests
- ./artifacts/bin/coreclr/OSX.arm64.Debug/paltests/runpaltests.sh $(pwd)/artifacts/bin/coreclr/OSX.arm64.Debug/paltests

## Don't run OSX ARM64 tests for PRs until we have hardware to actually run it
# triggers:
# pull_requests:
# - targets:
# only:
# - "unity-main"
6 changes: 6 additions & 0 deletions .yamato/test_osx_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ dependencies:

commands:
# build/run tests
- dotnet build unity/managed.sln -c Release
- |
cd unity/embed_api_tests
cmake -DCMAKE_BUILD_TYPE=Release .
cmake --build .
./mono_test_app
- LD_LIBRARY_PATH=/usr/local/opt/openssl/lib ./build.sh -subset libs.tests -test -a x64 -c release -ci -ninja
- ./src/tests/build.sh x64 release ci
- ./src/tests/run.sh x64 release
Expand Down
6 changes: 6 additions & 0 deletions .yamato/test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ dependencies:

commands:
# build/run tests
- dotnet build unity\managed.sln -c Release
# - |
# cd unity\embed_api_tests
# cmake . -A Win32
# cmake --build . --config Release
# Release\mono_test_app.exe
- build.cmd libs.tests -test -a x86 -c release -ci
- src\tests\build.cmd x86 release ci
- src\tests\run.cmd x86 release
Expand Down
6 changes: 6 additions & 0 deletions .yamato/test_windows_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ dependencies:

commands:
# build/run tests
- dotnet build unity\managed.sln -c Release
- |
cd unity\embed_api_tests
cmake .
cmake --build . --config Release
Release\mono_test_app.exe
- build.cmd libs.tests -test -a x64 -c release -ci
- src\tests\build.cmd x64 release ci
- src\tests\run.cmd x64 release
Expand Down
9 changes: 9 additions & 0 deletions src/coreclr/clrdefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ if(FEATURE_EVENT_TRACE)
else(FEATURE_EVENT_TRACE)
add_custom_target(eventing_headers) # add a dummy target to avoid checking for FEATURE_EVENT_TRACE in multiple places
endif(FEATURE_EVENT_TRACE)
if(FEATURE_UNITY_EMBEDDING_INTERFACE)
add_definitions(-DFEATURE_UNITY_EMBEDDING_INTERFACE)
add_definitions(-DFEATURE_UNITY_GCNAME_API)
add_definitions(-DFEATURE_UNITY_METHODTABLE_USER_DATA)
add_definitions(-DFEATURE_UNITY_ECALL_DYNAMIC_REGISTRATION)
add_definitions(-DFEATURE_UNITY_ASSEMBLY_MEMORY_PATH)
add_definitions(-DFEATURE_UNITY_MODULE_NUM_TYPEDEFS)
add_definitions(-DFEATURE_UNITY_EXPLICIT_LAYOUT_INHERITANCE)
endif()
if(FEATURE_GDBJIT)
add_definitions(-DFEATURE_GDBJIT)
endif()
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/clrfeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ endif()
if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
set(FEATURE_OBJCMARSHAL 1)
endif()

# should default this to 0 once we figure out how to enable in build scripting
if(NOT DEFINED FEATURE_UNITY_EMBEDDING_INTERFACE)
set(FEATURE_UNITY_EMBEDDING_INTERFACE 1)
endif(NOT DEFINED FEATURE_UNITY_EMBEDDING_INTERFACE)
8 changes: 8 additions & 0 deletions src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ set(CORECLR_LIBRARIES
coreclrminipal
)

if(FEATURE_UNITY_EMBEDDING_INTERFACE)
list(APPEND CORECLR_LIBRARIES
${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available
mono
${END_WHOLE_ARCHIVE}
)
endif(FEATURE_UNITY_EMBEDDING_INTERFACE)

if(CLR_CMAKE_TARGET_WIN32)
list(APPEND CORECLR_LIBRARIES
${STATIC_MT_CRT_LIB}
Expand Down
Loading

0 comments on commit 0d250cd

Please sign in to comment.