Skip to content

Commit df3a31c

Browse files
authored
Merge pull request #16 from Unity-Technologies/embeddelinux_support
EmbeddedLinux support
2 parents cebe85a + 58f5255 commit df3a31c

File tree

7 files changed

+17
-5
lines changed

7 files changed

+17
-5
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REM UNITY_ROOT should be set to folder with Unity repository
2+
"%UNITY_ROOT%/build/EmbeddedLinux/llvm/bin/clang++" --sysroot="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-arm32/arm-embedded-linux-gnueabihf/sysroot" -DUNITY_EMBEDDED_LINUX=1 -O2 -fPIC -shared -rdynamic -o libRenderingPlugin.so -fuse-ld=lld.exe -Wl,-soname,RenderingPlugin -Wl,-lGLESv2 --gcc-toolchain="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-arm32" -target arm-embedded-linux-gnueabihf ../../source/RenderingPlugin.cpp ../../source/RenderAPI_OpenGLCoreES.cpp ../../source/RenderAPI.cpp
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REM UNITY_ROOT should be set to folder with Unity repository
2+
"%UNITY_ROOT%/build/EmbeddedLinux/llvm/bin/clang++" --sysroot="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-arm64/aarch64-embedded-linux-gnu/sysroot" -DUNITY_EMBEDDED_LINUX=1 -O2 -fPIC -shared -rdynamic -o libRenderingPlugin.so -fuse-ld=lld.exe -Wl,-soname,RenderingPlugin -Wl,-lGLESv2 --gcc-toolchain="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-arm64" -target aarch64-embedded-linux-gnu ../../source/RenderingPlugin.cpp ../../source/RenderAPI_OpenGLCoreES.cpp ../../source/RenderAPI.cpp
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REM UNITY_ROOT should be set to folder with Unity repository
2+
"%UNITY_ROOT%/build/EmbeddedLinux/llvm/bin/clang++" --sysroot="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-x64/x86_64-embedded-linux-gnu/sysroot" -DUNITY_EMBEDDED_LINUX_GL=1 -O2 -fPIC -shared -rdynamic -o libRenderingPlugin.so -fuse-ld=lld.exe -Wl,-soname,RenderingPlugin -Wl,-lGL --gcc-toolchain="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-x64" -target x86_64-embedded-linux-gnu ../../source/RenderingPlugin.cpp ../../source/RenderAPI_OpenGLCoreES.cpp ../../source/RenderAPI.cpp
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REM UNITY_ROOT should be set to folder with Unity repository
2+
"%UNITY_ROOT%/build/EmbeddedLinux/llvm/bin/clang++" --sysroot="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-x86/i686-embedded-linux-gnu/sysroot" -DUNITY_EMBEDDED_LINUX_GL=1 -O2 -fPIC -shared -rdynamic -o libRenderingPlugin.so -fuse-ld=lld.exe -Wl,-soname,RenderingPlugin -Wl,-lGL --gcc-toolchain="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-x86" -target i686-embedded-linux-gnu ../../source/RenderingPlugin.cpp ../../source/RenderAPI_OpenGLCoreES.cpp ../../source/RenderAPI.cpp

PluginSource/source/PlatformBase.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// UNITY_ANDROID - Android
1515
// UNITY_METRO - WSA or UWP
1616
// UNITY_WEBGL - WebGL
17+
// UNITY_EMBEDDED_LINUX - EmbeddedLinux OpenGLES
18+
// UNITY_EMBEDDED_LINUX_GL - EmbeddedLinux OpenGLCore
1719
#if _MSC_VER
1820
#define UNITY_WIN 1
1921
#elif defined(__APPLE__)
@@ -26,7 +28,7 @@
2628
#endif
2729
#elif defined(__ANDROID__)
2830
#define UNITY_ANDROID 1
29-
#elif defined(UNITY_METRO) || defined(UNITY_LINUX) || defined(UNITY_WEBGL)
31+
#elif defined(UNITY_METRO) || defined(UNITY_LINUX) || defined(UNITY_WEBGL) || defined (UNITY_EMBEDDED_LINUX) || defined (UNITY_EMBEDDED_LINUX_GL)
3032
// these are defined externally
3133
#elif defined(__EMSCRIPTEN__)
3234
// this is already defined in Unity 5.6
@@ -49,15 +51,15 @@
4951
#define SUPPORT_OPENGL_UNIFIED 1
5052
#define SUPPORT_OPENGL_CORE 1
5153
#define SUPPORT_VULKAN 0 // Requires Vulkan SDK to be installed
52-
#elif UNITY_IOS || UNITY_TVOS || UNITY_ANDROID || UNITY_WEBGL
54+
#elif UNITY_IOS || UNITY_TVOS || UNITY_ANDROID || UNITY_WEBGL || UNITY_EMBEDDED_LINUX
5355
#ifndef SUPPORT_OPENGL_ES
5456
#define SUPPORT_OPENGL_ES 1
5557
#endif
5658
#define SUPPORT_OPENGL_UNIFIED SUPPORT_OPENGL_ES
5759
#ifndef SUPPORT_VULKAN
5860
#define SUPPORT_VULKAN 0
5961
#endif
60-
#elif UNITY_OSX || UNITY_LINUX
62+
#elif UNITY_OSX || UNITY_LINUX || UNITY_EMBEDDED_LINUX_GL
6163
#define SUPPORT_OPENGL_UNIFIED 1
6264
#define SUPPORT_OPENGL_CORE 1
6365
#endif

PluginSource/source/RenderAPI_OpenGLCoreES.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <assert.h>
1212
#if UNITY_IOS || UNITY_TVOS
1313
# include <OpenGLES/ES2/gl.h>
14-
#elif UNITY_ANDROID || UNITY_WEBGL
14+
#elif UNITY_ANDROID || UNITY_WEBGL || UNITY_EMBEDDED_LINUX
1515
# include <GLES2/gl2.h>
1616
#elif UNITY_OSX
1717
# include <OpenGL/gl3.h>
@@ -20,7 +20,7 @@
2020
// library (like GLEW, GLFW etc.) can be used; here we use gl3w since it's simple and
2121
// straightforward.
2222
# include "gl3w/gl3w.h"
23-
#elif UNITY_LINUX
23+
#elif UNITY_LINUX || UNITY_EMBEDDED_LINUX_GL
2424
# define GL_GLEXT_PROTOTYPES
2525
# include <GL/gl.h>
2626
#else

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Native code rendering is implemented for several platforms and graphics APIs:
3030
* WebGL (OpenGL ES)
3131
* Android (OpenGL ES, Vulkan)
3232
* iOS/tvOS (Metal; Simulator is supported if you use unity 2020+ and XCode 11+)
33+
* EmbeddedLinux (OpenGL, Open GLES)
3334
* ...more platforms might be coming soon, we just did not get around to adding project files yet.
3435

3536
Code is organized as follows:
@@ -40,6 +41,7 @@ Code is organized as follows:
4041
* `projects/UWPVisualStudio2015`: Visual Studio 2015 project files for Windows Store (UWP - Win10) plugin
4142
* `projects/Xcode`: Apple Xcode project file for Mac OS X plugin, Xcode 10.3 on macOS 10.14 was tested
4243
* `projects/GNUMake`: Makefile for Linux
44+
* `projects/EmbeddedLinux`: Windows .bat files to build plugins for different architectures
4345
* `UnityProject` is the Unity (2018.3.9 was tested) project.
4446
* Single `scene` that contains the plugin sample scene.
4547

0 commit comments

Comments
 (0)