Add support for HL libraries
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
<set name="lime" />
|
||||
|
||||
<define name="native" if="cpp || neko || nodejs || cs || java" />
|
||||
<define name="native" if="cpp || neko || nodejs || cs || java || hl" />
|
||||
<define name="howlerjs" if="html5" />
|
||||
|
||||
<define name="lime-html5" if="html5" />
|
||||
@@ -52,7 +52,7 @@
|
||||
<ndll name="zlib" haxelib="hxcpp" unless="emscripten || ios || tvos" />
|
||||
</section>
|
||||
|
||||
<ndll name="lime" if="cpp || neko || nodejs || java" unless="lime-console static_link || lime-switch static_link" />
|
||||
<ndll name="lime" if="native" unless="lime-console static_link || lime-switch static_link" />
|
||||
|
||||
<dependency name="extension-api" path="dependencies/extension-api" if="android" />
|
||||
<dependency path="dependencies/howler.min.js" if="html5 howlerjs" />
|
||||
|
||||
@@ -450,20 +450,22 @@ class NativeCFFI {
|
||||
@:cffi private static function lime_alc_resume_device (device:CFFIPointer):Void;
|
||||
@:cffi private static function lime_alc_suspend_context (context:CFFIPointer):Void;
|
||||
|
||||
#if hl
|
||||
@:hlNative("lime", "hl_lime_alc_open_device") private static function hl_lime_alc_open_device (devicename:hl.Bytes):lime.media.openal.ALDevice { return null; };
|
||||
#end
|
||||
|
||||
@:cffi private static function lime_al_gen_filter():CFFIPointer;
|
||||
@:cffi private static function lime_al_filteri(filter:CFFIPointer, param:Int, value:Dynamic):Void;
|
||||
@:cffi private static function lime_al_filterf(filter:CFFIPointer, param:Int, value:Float32):Void;
|
||||
@:cffi private static function lime_al_remove_direct_filter(source:CFFIPointer):Void;
|
||||
@:cffi private static function lime_al_is_filter (filter:CFFIPointer):Bool;
|
||||
@:cffi private static function lime_al_get_filteri(filter:CFFIPointer, param:Int):Int;
|
||||
|
||||
@:cffi private static function lime_al_gen_effect():CFFIPointer;
|
||||
@:cffi private static function lime_al_effectf(effect:CFFIPointer, param:Int, value:Float32):Void;
|
||||
@:cffi private static function lime_al_effectfv(effect:CFFIPointer, param:Int, values:Array<Float>):Void;
|
||||
@:cffi private static function lime_al_effecti(effect:CFFIPointer, param:Int, value:Int):Void;
|
||||
@:cffi private static function lime_al_effectiv(effect:CFFIPointer, param:Int, values:Array<Int>):Void;
|
||||
@:cffi private static function lime_al_is_effect(effect:CFFIPointer):Bool;
|
||||
|
||||
@:cffi private static function lime_al_gen_aux():CFFIPointer;
|
||||
@:cffi private static function lime_al_auxf(aux:CFFIPointer, param:Int, value:Float32):Void;
|
||||
@:cffi private static function lime_al_auxfv(aux:CFFIPointer, param:Int, values:Array<Float>):Void;
|
||||
|
||||
@@ -77,7 +77,7 @@ class ALC {
|
||||
|
||||
public static function getContextsDevice (context:ALContext):ALDevice {
|
||||
|
||||
#if (lime_cffi && lime_openal && !macro)
|
||||
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||
var handle:Dynamic = NativeCFFI.lime_alc_get_contexts_device (context);
|
||||
|
||||
if (handle != null) {
|
||||
@@ -85,6 +85,9 @@ class ALC {
|
||||
return new ALDevice (handle);
|
||||
|
||||
}
|
||||
#else
|
||||
|
||||
#end
|
||||
#end
|
||||
|
||||
return null;
|
||||
@@ -171,7 +174,7 @@ class ALC {
|
||||
|
||||
public static function openDevice (deviceName:String = null):ALDevice {
|
||||
|
||||
#if (lime_cffi && lime_openal && !macro)
|
||||
#if (lime_cffi && lime_openal && !macro) #if !hl
|
||||
var handle:Dynamic = NativeCFFI.lime_alc_open_device (deviceName);
|
||||
|
||||
if (handle != null) {
|
||||
@@ -179,7 +182,10 @@ class ALC {
|
||||
return new ALDevice (handle);
|
||||
|
||||
}
|
||||
#end
|
||||
#else
|
||||
var deviceName = (deviceName != null ? hl.Bytes.fromValue (deviceName, null) : null);
|
||||
return NativeCFFI.hl_lime_alc_open_device (deviceName);
|
||||
#end #end
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package lime.media.openal;
|
||||
package lime.media.openal; #if !hl
|
||||
|
||||
|
||||
import lime.system.CFFIPointer;
|
||||
@@ -17,4 +17,9 @@ abstract ALDevice(CFFIPointer) from CFFIPointer to CFFIPointer {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
typedef ALDevice = hl.Abstract<"alc_device">;
|
||||
#end
|
||||
@@ -98,15 +98,17 @@ class LinuxPlatform extends PlatformTarget {
|
||||
|
||||
if (!project.targetFlags.exists ("static") || targetType != "cpp") {
|
||||
|
||||
var targetSuffix = (targetType == "hl") ? ".hdll" : null;
|
||||
|
||||
for (ndll in project.ndlls) {
|
||||
|
||||
if (isRaspberryPi) {
|
||||
|
||||
FileHelper.copyLibrary (project, ndll, "RPi", "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug);
|
||||
FileHelper.copyLibrary (project, ndll, "RPi", "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug, targetSuffix);
|
||||
|
||||
} else {
|
||||
|
||||
FileHelper.copyLibrary (project, ndll, "Linux" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug);
|
||||
FileHelper.copyLibrary (project, ndll, "Linux" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug, targetSuffix);
|
||||
|
||||
}
|
||||
|
||||
@@ -139,13 +141,12 @@ class LinuxPlatform extends PlatformTarget {
|
||||
if (noOutput) return;
|
||||
|
||||
FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl", PathHelper.combine (applicationDirectory, project.app.file + ".hl"));
|
||||
NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);
|
||||
|
||||
} else if (targetType == "nodejs") {
|
||||
|
||||
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
|
||||
//NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
|
||||
NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);
|
||||
//NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);
|
||||
|
||||
} else if (targetType == "java") {
|
||||
|
||||
|
||||
@@ -98,9 +98,11 @@ class MacPlatform extends PlatformTarget {
|
||||
|
||||
if (!project.targetFlags.exists ("static") || targetType != "cpp") {
|
||||
|
||||
var targetSuffix = (targetType == "hl") ? ".hdll" : null;
|
||||
|
||||
for (ndll in project.ndlls) {
|
||||
|
||||
FileHelper.copyLibrary (project, ndll, "Mac" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dylib" : ".ndll", executableDirectory, project.debug);
|
||||
FileHelper.copyLibrary (project, ndll, "Mac" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dylib" : ".ndll", executableDirectory, project.debug, targetSuffix);
|
||||
|
||||
}
|
||||
|
||||
@@ -122,7 +124,6 @@ class MacPlatform extends PlatformTarget {
|
||||
if (noOutput) return;
|
||||
|
||||
FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl", PathHelper.combine (executableDirectory, project.app.file + ".hl"));
|
||||
NekoHelper.copyLibraries (project.templatePaths, "mac" + (is64 ? "64" : ""), executableDirectory);
|
||||
|
||||
} else if (targetType == "java") {
|
||||
|
||||
@@ -144,7 +145,7 @@ class MacPlatform extends PlatformTarget {
|
||||
if (noOutput) return;
|
||||
|
||||
//NekoHelper.createExecutable (project.templatePaths, "Mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
|
||||
NekoHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory);
|
||||
//NekoHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory);
|
||||
|
||||
} else if (targetType == "cs") {
|
||||
|
||||
|
||||
@@ -165,9 +165,11 @@ class WindowsPlatform extends PlatformTarget {
|
||||
|
||||
if (!project.targetFlags.exists ("static") || targetType != "cpp") {
|
||||
|
||||
var targetSuffix = (targetType == "hl") ? ".hdll" : null;
|
||||
|
||||
for (ndll in project.ndlls) {
|
||||
|
||||
FileHelper.copyLibrary (project, ndll, "Windows" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug);
|
||||
FileHelper.copyLibrary (project, ndll, "Windows" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug, targetSuffix);
|
||||
|
||||
}
|
||||
|
||||
@@ -199,7 +201,6 @@ class WindowsPlatform extends PlatformTarget {
|
||||
if (noOutput) return;
|
||||
|
||||
FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl", PathHelper.combine (applicationDirectory, project.app.file + ".hl"));
|
||||
NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory);
|
||||
|
||||
} else if (targetType == "nodejs") {
|
||||
|
||||
@@ -208,7 +209,7 @@ class WindowsPlatform extends PlatformTarget {
|
||||
if (noOutput) return;
|
||||
|
||||
//NekoHelper.createExecutable (project.templatePaths, "windows" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
|
||||
NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory);
|
||||
//NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory);
|
||||
|
||||
} else if (targetType == "cs") {
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<files id="lime">
|
||||
|
||||
<compilerflag value="-Iinclude" />
|
||||
<compilerflag value="-DLIBHL_EXPORTS" />
|
||||
|
||||
<file name="src/ExternalInterface.cpp" />
|
||||
|
||||
@@ -426,7 +427,7 @@
|
||||
<lib name="-lm" if="LIME_NEKO" />
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section if="android">
|
||||
|
||||
<lib name="-L../ndll/Android" />
|
||||
|
||||
@@ -1889,8 +1889,20 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
HL_PRIM ALCdevice* HL_NAME (alc_open_device) (vbyte *devicename) {
|
||||
|
||||
ALCdevice* alcDevice = alcOpenDevice ((char*)devicename);
|
||||
atexit (lime_al_atexit);
|
||||
|
||||
// TODO: GC
|
||||
|
||||
return alcDevice;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_alc_pause_device (value device) {
|
||||
|
||||
|
||||
#ifdef LIME_OPENALSOFT
|
||||
ALCdevice* alcDevice = (ALCdevice*)val_data (device);
|
||||
alcDevicePauseSOFT (alcDevice);
|
||||
@@ -2041,6 +2053,12 @@ namespace lime {
|
||||
DEFINE_PRIME1v (lime_alc_resume_device);
|
||||
DEFINE_PRIME1v (lime_alc_suspend_context);
|
||||
|
||||
#define TDEVICE _ABSTRACT (alc_device)
|
||||
#define TCONTEXT _ABSTRACT (alc_context)
|
||||
|
||||
DEFINE_HL_PRIM (TDEVICE, hl_lime_alc_open_device, _BYTES);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user