|
| 1 | +import sys.io.File; |
| 2 | +import sys.io.Process; |
| 3 | + |
| 4 | +using StringTools; |
| 5 | +using Lambda; |
| 6 | + |
| 7 | +class Run { |
| 8 | + public static function main() { |
| 9 | + final args = Sys.args(); |
| 10 | + final c = Sys.getCwd(); |
| 11 | + if (args[0] == "rebuild") { |
| 12 | + rebuild(args.pop()); |
| 13 | + } |
| 14 | + Sys.setCwd(c); |
| 15 | + } |
| 16 | + |
| 17 | + static function rebuild(thispath:String) { |
| 18 | + var hxcpp_path:String; |
| 19 | + { |
| 20 | + final proc = new sys.io.Process("haxelib", ["libpath", "hxcpp"]); |
| 21 | + proc.exitCode(); |
| 22 | + hxcpp_path = proc.stdout.readAll().toString(); |
| 23 | + proc.close(); |
| 24 | + } |
| 25 | + Sys.setCwd(thispath + "LuaJIT/src"); |
| 26 | + if (Sys.systemName() == "Windows") { |
| 27 | + setupVS(); |
| 28 | + // Sys.command(hxcpp_path.replace("/", "\\") + "msvc64-setup.bat"); |
| 29 | + Sys.command("msvcbuild.bat"); |
| 30 | + File.copy("lua51.dll", "../../lib/Windows64/lua51.dll"); |
| 31 | + File.copy("lua51.dll", "../../lib/Windows64/lua51.dll"); |
| 32 | + } else { |
| 33 | + Sys.command("make"); |
| 34 | + if (Sys.systemName() == "Linux") |
| 35 | + File.copy("libluajit-5.1.so", "../../lib/Linux64/libluajit-5.1.so"); |
| 36 | + else |
| 37 | + File.copy("libluajit-5.1.dylib", "../../lib/Mac64/libluajit-5.1.dylib"); |
| 38 | + } |
| 39 | + Sys.setCwd(thispath); |
| 40 | + } |
| 41 | + |
| 42 | + static function setupVS() { |
| 43 | + // var proc = new sys.io.Process("C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe", [ |
| 44 | + // "-latest", |
| 45 | + // "-products", |
| 46 | + // "*", |
| 47 | + // "-requires", |
| 48 | + // "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", |
| 49 | + // "-property", |
| 50 | + // "installationPath" |
| 51 | + // ]); |
| 52 | + // proc.exitCode(); |
| 53 | + // var p = proc.stdout.readAll().toString().split("\n"); |
| 54 | + // p.pop(); |
| 55 | + // var path = p.pop(); |
| 56 | + // trace(path); |
| 57 | + // Sys.command(path + "\\VC\\Auxiliary\\Build\\vcvars64.bat",[]); |
| 58 | + // proc.close(); |
| 59 | + } |
| 60 | +} |
0 commit comments