Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] Enable hlc tests on windows and mac #11768

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/runci/System.hx
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,13 @@ class System {
}

static public function addToLIBPATH(path:String):Void {
infoMsg('Prepending $path to LD_LIBRARY_PATH.');
infoMsg('Prepending $path to loader path.');
switch (systemName) {
case "Windows": // pass
case "Mac", "Linux":
case "Linux":
Sys.putEnv("LD_LIBRARY_PATH", path + ":" + Sys.getEnv("LD_LIBRARY_PATH"));
case "Mac":
Sys.putEnv("DYLD_LIBRARY_PATH", path + ":" + Sys.getEnv("DYLD_LIBRARY_PATH"));
}
}

Expand Down
52 changes: 29 additions & 23 deletions tests/runci/targets/Hl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ using StringTools;
class Hl {
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 =
if (isCi() || !commandSucceed("hl", ["--version"])){
Path.join([hlBuildBinDir, "hl"]) + ((systemName == "Windows") ? ".exe" : "");
Path.join([hlInstallBinDir, "hl"]) + ((systemName == "Windows") ? ".exe" : "");
} else {
commandResult(if(systemName == "Windows") "where" else "which", ["hl"]).stdout.trim();
};
Expand Down Expand Up @@ -56,41 +58,45 @@ class Hl {
"-DWITH_UI=OFF",
"-DWITH_UV=OFF",
"-DWITH_VIDEO=OFF",
"-DCMAKE_INSTALL_PREFIX=" + hlInstallDir,
"-B" + hlBuild,
"-H" + hlSrc
]));
runCommand("cmake", [
"--build", hlBuild
]);
runCommand("cmake", ["--build", hlBuild, "--target", "install"]);

addToPATH(hlInstallBinDir);
addToLIBPATH(hlInstallLibDir);
runCommand(hlBinary, ["--version"]);
addToPATH(hlBuildBinDir);
addToLIBPATH(hlBuildBinDir);

haxelibDev("hashlink", '$hlSrc/other/haxelib/');
}

static function buildAndRunHlc(dir:String, filename:String, ?run) {
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>) {
Expand Down
Loading