|
@@ -10,13 +10,15 @@ using StringTools;
|
|
class Hl {
|
|
class Hl {
|
|
static final hlSrc = Path.join([getDownloadPath(), "hashlink"]);
|
|
static final hlSrc = Path.join([getDownloadPath(), "hashlink"]);
|
|
|
|
|
|
- static final hlBuild = Path.join([getInstallPath(), "hashlink_build"]);
|
|
|
|
|
|
+ static final hlBuild = Path.join([getDownloadPath(), "hashlink_build"]);
|
|
|
|
|
|
- static final hlBuildBinDir = Path.join([getInstallPath(), "hashlink_build", "bin"]);
|
|
|
|
|
|
+ static final hlInstallDir = Path.join([getInstallPath(), "hashlink"]);
|
|
|
|
+ static final hlInstallBinDir = if (systemName == "Windows") hlInstallDir else Path.join([hlInstallDir, "bin"]);
|
|
|
|
+ static final hlInstallLibDir = if (systemName == "Windows") hlInstallDir else Path.join([hlInstallDir, "lib"]);
|
|
|
|
|
|
static final hlBinary =
|
|
static final hlBinary =
|
|
if (isCi() || !commandSucceed("hl", ["--version"])){
|
|
if (isCi() || !commandSucceed("hl", ["--version"])){
|
|
- Path.join([hlBuildBinDir, "hl"]) + ((systemName == "Windows") ? ".exe" : "");
|
|
|
|
|
|
+ Path.join([hlInstallBinDir, "hl"]) + ((systemName == "Windows") ? ".exe" : "");
|
|
} else {
|
|
} else {
|
|
commandResult(if(systemName == "Windows") "where" else "which", ["hl"]).stdout.trim();
|
|
commandResult(if(systemName == "Windows") "where" else "which", ["hl"]).stdout.trim();
|
|
};
|
|
};
|
|
@@ -56,16 +58,18 @@ class Hl {
|
|
"-DWITH_UI=OFF",
|
|
"-DWITH_UI=OFF",
|
|
"-DWITH_UV=OFF",
|
|
"-DWITH_UV=OFF",
|
|
"-DWITH_VIDEO=OFF",
|
|
"-DWITH_VIDEO=OFF",
|
|
|
|
+ "-DCMAKE_INSTALL_PREFIX=" + hlInstallDir,
|
|
"-B" + hlBuild,
|
|
"-B" + hlBuild,
|
|
"-H" + hlSrc
|
|
"-H" + hlSrc
|
|
]));
|
|
]));
|
|
runCommand("cmake", [
|
|
runCommand("cmake", [
|
|
"--build", hlBuild
|
|
"--build", hlBuild
|
|
]);
|
|
]);
|
|
|
|
+ runCommand("cmake", ["--build", hlBuild, "--target", "install"]);
|
|
|
|
|
|
|
|
+ addToPATH(hlInstallBinDir);
|
|
|
|
+ addToLIBPATH(hlInstallLibDir);
|
|
runCommand(hlBinary, ["--version"]);
|
|
runCommand(hlBinary, ["--version"]);
|
|
- addToPATH(hlBuildBinDir);
|
|
|
|
- addToLIBPATH(hlBuildBinDir);
|
|
|
|
|
|
|
|
haxelibDev("hashlink", '$hlSrc/other/haxelib/');
|
|
haxelibDev("hashlink", '$hlSrc/other/haxelib/');
|
|
}
|
|
}
|
|
@@ -73,24 +77,26 @@ class Hl {
|
|
static function buildAndRunHlc(dir:String, filename:String, ?run) {
|
|
static function buildAndRunHlc(dir:String, filename:String, ?run) {
|
|
if (run == null) run = runCommand;
|
|
if (run == null) run = runCommand;
|
|
|
|
|
|
- switch (systemName) {
|
|
|
|
- case "Linux" if (isCi()):
|
|
|
|
- runCommand("gcc", [
|
|
|
|
- "-o", '$dir/$filename.exe',
|
|
|
|
- '$dir/$filename.c',
|
|
|
|
- '-I$dir',
|
|
|
|
- '-I$hlSrc/src',
|
|
|
|
- '$hlBuildBinDir/fmt.hdll',
|
|
|
|
- '$hlBuildBinDir/ssl.hdll',
|
|
|
|
- '$hlBuildBinDir/sqlite.hdll',
|
|
|
|
- "-lm",
|
|
|
|
- '-L$hlBuildBinDir', "-lhl"
|
|
|
|
- ]);
|
|
|
|
-
|
|
|
|
- run('$dir/$filename.exe', []);
|
|
|
|
-
|
|
|
|
- case _: // TODO hl/c for mac/windows
|
|
|
|
- }
|
|
|
|
|
|
+ if (!isCi())
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ final compiler = if (systemName == "Mac") "clang" else "gcc";
|
|
|
|
+ final extraCompilerFlags = if (systemName == "Windows") ["-ldbghelp", "-municode"] else [];
|
|
|
|
+
|
|
|
|
+ runCommand(compiler, [
|
|
|
|
+ "-o", '$dir/$filename.exe',
|
|
|
|
+ '$dir/$filename.c',
|
|
|
|
+ '-I$dir',
|
|
|
|
+ '-I$hlInstallDir/include',
|
|
|
|
+ '-L$hlInstallLibDir',
|
|
|
|
+ '$hlInstallLibDir/fmt.hdll',
|
|
|
|
+ '$hlInstallLibDir/ssl.hdll',
|
|
|
|
+ '$hlInstallLibDir/sqlite.hdll',
|
|
|
|
+ "-lm",
|
|
|
|
+ "-lhl"
|
|
|
|
+ ].concat(extraCompilerFlags));
|
|
|
|
+
|
|
|
|
+ run('$dir/$filename.exe', []);
|
|
}
|
|
}
|
|
|
|
|
|
static function buildAndRun(hxml:String, target:String, ?args:Array<String>) {
|
|
static function buildAndRun(hxml:String, target:String, ?args:Array<String>) {
|