Improve RPi support

This commit is contained in:
Joshua Granick
2015-09-02 23:53:14 -07:00
parent c6ed35b493
commit 34d4b9cc13
11 changed files with 42 additions and 24 deletions

View File

@@ -43,6 +43,10 @@ class LinuxPlatform extends PlatformTarget {
is64 = true;
} else if (architecture == Architecture.ARMV7) {
isRaspberryPi = true;
}
}
@@ -52,21 +56,6 @@ class LinuxPlatform extends PlatformTarget {
isRaspberryPi = true;
is64 = false;
} else if (PlatformHelper.hostPlatform == Platform.LINUX) {
var process = new Process ("uname", [ "-a" ]);
var output = process.stdout.readAll ().toString ();
var error = process.stderr.readAll ().toString ();
process.exitCode ();
process.close ();
if (output.toLowerCase ().indexOf ("raspberrypi") > -1) {
isRaspberryPi = true;
is64 = true;
}
}
if (project.targetFlags.exists ("neko") || project.target != PlatformHelper.hostPlatform) {
@@ -129,8 +118,18 @@ class LinuxPlatform extends PlatformTarget {
if (targetType == "neko") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);
if (isRaspberryPi) {
NekoHelper.createExecutable (project.templatePaths, "rpi", targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries (project.templatePaths, "rpi", applicationDirectory);
} else {
NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);
}
} else if (targetType == "nodejs") {
@@ -249,7 +248,7 @@ class LinuxPlatform extends PlatformTarget {
if (targetFlags.exists ("rpi")) {
commands.push ([ "-Dlinux", "-Drpi", "-DCXX=arm-linux-gnueabihf-g++", "-DHXCPP_M32", "-DHXCPP_STRIP=arm-linux-gnueabihf-strip", "-DHXCPP_AR=arm-linux-gnueabihf-ar", "-DHXCPP_RANLIB=arm-linux-gnueabihf-ranlib" ]);
commands.push ([ "-Dlinux", "-Drpi", "-Dtoolchain=linux", "-DBINDIR=RPi", "-DCXX=arm-linux-gnueabihf-g++", "-DHXCPP_M32", "-DHXCPP_STRIP=arm-linux-gnueabihf-strip", "-DHXCPP_AR=arm-linux-gnueabihf-ar", "-DHXCPP_RANLIB=arm-linux-gnueabihf-ranlib" ]);
} else {

View File

@@ -8,7 +8,7 @@
<set name="lime-legacy" value="1" if="legacy || lime_legacy" />
<set name="ios" value="1" if="iphone" />
<set name="LIME_CAIRO" value="1" />
<set name="LIME_CURL" value="1" unless="emscripten" />
<set name="LIME_JPEG" value="1" />
@@ -173,10 +173,12 @@
<section unless="emscripten">
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/sdl/include/" />
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/sdl/include/configs/default/" unless="windows || mac || linux"/>
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/sdl/include/configs/linux/" if="linux"/>
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/sdl/include/configs/default/" unless="windows || mac || linux || rpi"/>
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/sdl/include/configs/linux/" if="linux" unless="rpi"/>
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/sdl/include/configs/windows/" if="windows"/>
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/sdl/include/configs/mac/" if="mac"/>
<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/sdl/include/configs/rpi/" if="rpi"/>
<compilerflag value="-DHAVE_LIBC" />
</section>
@@ -336,6 +338,16 @@
</section>
<section if="rpi">
<lib name="-lbcm_host" />
<lib name="-ldl" />
<lib name="-lm" />
<lib name="-lGLESv2" />
<lib name="-lEGL" />
</section>
</section>
</target>

View File

@@ -34,6 +34,13 @@ namespace lime {
SDL_SetHint (SDL_HINT_VIDEO_WIN_D3DCOMPILER, "d3dcompiler_47.dll");
#endif
#if defined (RASPBERRYPI)
SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_SetHint (SDL_HINT_RENDER_DRIVER, "opengles2");
#endif
if (flags & WINDOW_FLAG_DEPTH_BUFFER) {
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 32 - (flags & WINDOW_FLAG_STENCIL_BUFFER) ? 8 : 0);
@@ -309,4 +316,4 @@ namespace lime {
}
}
}

View File

@@ -2,7 +2,7 @@
#define LIME_GRAPHICS_OPENGL_OPENGL_H
#if defined (BLACKBERRY) || defined (ANDROID) || defined (WEBOS) || defined (GPH) || defined (EMSCRIPTEN)
#if defined (BLACKBERRY) || defined (ANDROID) || defined (WEBOS) || defined (GPH) || defined (EMSCRIPTEN) || defined (RASPBERRYPI)
#define LIME_GLES
#include <GLES2/gl2.h>

BIN
templates/neko/bin/neko-rpi Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
templates/neko/ndll/rpi/std.ndll Executable file

Binary file not shown.

BIN
templates/neko/ndll/rpi/zlib.ndll Executable file

Binary file not shown.