mirror of https://github.com/mono/CppSharp.git
Browse Source
* Fixes to QuickJS marshaling. * Handle more primitive types in `GetInfo`. * Fix generator kind CLI option matching. * Alias QuickJS generator kind to `quickjs`. * General CLI code cleanups. * Default to x64 platform over x86 for the CLI. * Implement new Lua bindings file and commands for CLI tool. * Fix QuickJS primitive type marshaling to take target sizes into account. * Minor code cleanup. * Avoid generating includes to units when generating the QuickJS module. * Update file generation naming pattern for QuickJS files. * Update QuickJS JS_GetOpaque and JS_GetAnyOpaque references to work with latest upstream. * Update QuickJS runtime and support code to work with latest upstream. * Avoid generating properties when generating QuickJS register code. * Update QuickJS test suite to bootstrap its own QuickJS runtime. * Update QuickJS test suite to use a Lua bindings definition file. * Minor fixes to test header files. * Fix C++ warning about return values for event invokes. * Disable some non working tests for QuickJS. * Enable QuickJS testing on CI. * Fix shell color attributes for test scripts when under CI. * WIP CI fixes. * Fix warnings in QuickJS support runtime code. * Use C99 designated initializers for all QuickJS class def members. * Disable QuickJS CI steps on Windows. * Clean up error handling for `JS_ToBool`. * More QuickJS support code fixes. * Rename Signal.cpp to QuickJS nomenclature. * Fix QuickJS JS_ToBigUint call. * Remove QuickJS test script verbosity. * More CI fixes. * Verbose build. * Extension fix.pull/1714/head
32 changed files with 415 additions and 200 deletions
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using CppSharp; |
||||
using MoonSharp.Interpreter; |
||||
|
||||
class LuaContext |
||||
{ |
||||
public Script script; |
||||
public Options options; |
||||
public List<string> errorMessages; |
||||
|
||||
public string CurrentModule; |
||||
|
||||
public LuaContext(Options options, List<string> errorMessages) |
||||
{ |
||||
this.options = options; |
||||
this.errorMessages = errorMessages; |
||||
|
||||
script = new Script(CoreModules.Basic | CoreModules.String | |
||||
CoreModules.Table | CoreModules.TableIterators); |
||||
|
||||
script.Globals["generator"] = (string kind) => |
||||
{ |
||||
CLI.GetGeneratorKind(kind, errorMessages); |
||||
}; |
||||
|
||||
script.Globals["platform"] = (string platform) => |
||||
{ |
||||
CLI.GetDestinationPlatform(platform, errorMessages); |
||||
}; |
||||
|
||||
script.Globals["architecture"] = (string arch) => |
||||
{ |
||||
CLI.GetDestinationArchitecture(arch, errorMessages); |
||||
}; |
||||
|
||||
script.Globals["output"] = script.Globals["location"] = (string dir) => |
||||
{ |
||||
options.OutputDir = dir; |
||||
}; |
||||
|
||||
script.Globals["includedirs"] = (List<string> dirs) => |
||||
{ |
||||
foreach (var dir in dirs) |
||||
{ |
||||
options.IncludeDirs.Add(dir); |
||||
} |
||||
}; |
||||
|
||||
script.Globals["module"] = (string name) => |
||||
{ |
||||
CurrentModule = name; |
||||
options.OutputFileName = name; |
||||
}; |
||||
|
||||
script.Globals["namespace"] = (string name) => |
||||
{ |
||||
options.OutputNamespace = name; |
||||
}; |
||||
|
||||
script.Globals["headers"] = (List<string> files) => |
||||
{ |
||||
foreach (var file in files) |
||||
{ |
||||
options.HeaderFiles.Add(file); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
public DynValue LoadFile(string luaFile) |
||||
{ |
||||
var code = script.LoadFile(luaFile); |
||||
|
||||
try |
||||
{ |
||||
return code.Function.Call(); |
||||
} |
||||
catch (Exception ex) |
||||
{ |
||||
Console.Error.WriteLine($"Error running {Path.GetFileName(luaFile)}:\n{ex.Message}"); |
||||
return null; |
||||
} |
||||
} |
||||
} |
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
||||
gen |
||||
runtime/ |
||||
gen/ |
||||
*.so |
||||
*.dylib |
||||
*.dll |
||||
|
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
generator "quickjs" |
||||
architecture "x64" |
||||
|
||||
includedirs |
||||
{ |
||||
"..", |
||||
"../../include", |
||||
} |
||||
|
||||
output "gen" |
||||
|
||||
module "test" |
||||
namespace "test" |
||||
headers |
||||
{ |
||||
"Builtins.h", |
||||
"Classes.h", |
||||
"Classes2.h", |
||||
"Delegates.h", |
||||
"Enums.h", |
||||
"Overloads.h" |
||||
} |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash |
||||
set -e |
||||
dir=$(cd "$(dirname "$0")"; pwd) |
||||
rootdir="$dir/../.." |
||||
|
||||
cd $dir |
||||
|
||||
if [ ! -d runtime ]; then |
||||
git clone https://github.com/quickjs-ng/quickjs.git runtime |
||||
git -C runtime reset --hard 0e5e9c2c49db15ab9579edeb4d90e610c8b8463f |
||||
fi |
||||
|
||||
if [ ! -f runtime/build/qjs ]; then |
||||
make -C runtime/ |
||||
fi |
Loading…
Reference in new issue