Skip to content

Commit 6574e20

Browse files
committed
Add support for sdl12-compat and sdl2-compat
1 parent 0b4058b commit 6574e20

File tree

4 files changed

+97
-3
lines changed

4 files changed

+97
-3
lines changed

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ inputs:
2020
version-sdl-ttf:
2121
description: "Version of SDL_ttf (2.x.y, 2-any, 2-latest, 2-head, 3-head), git hash, or <empty>"
2222
required: false
23+
version-sdl2-compat:
24+
description: "Version of sdl2-compat (2.x.y, 2-any, 2-latest, 2-head), git hash, or <empty>"
25+
required: false
26+
version-sdl12-compat:
27+
description: "Version of sdl12-compat (1.x.y, 1-any, 1-latest, 1-head), git hash, or <empty>"
28+
required: false
2329
pre-release:
2430
description: "Allow pre-releases"
2531
default: "true"

packed/index.js

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,15 @@ function run() {
572572
core.debug("proj=".concat(proj));
573573
core.debug("build_order=".concat(build_order));
574574
core.debug("proj in build_order=".concat(proj in build_order));
575+
if (proj == version_2.Project.SDL12_compat &&
576+
(build_order.indexOf(version_2.Project.SDL) >= 0 ||
577+
build_order.indexOf(version_2.Project.SDL2_compat) >= 0)) {
578+
return 1;
579+
}
580+
if (proj == version_2.Project.SDL2_compat &&
581+
build_order.indexOf(version_2.Project.SDL) >= 0) {
582+
return 1;
583+
}
575584
return build_order.findIndex(function (e) { return e == proj; }) >= 0;
576585
})) {
577586
build_order.push(project_left);
@@ -590,7 +599,7 @@ function run() {
590599
package_dirs = {};
591600
project_versions = {};
592601
_loop_1 = function (project) {
593-
var project_description, req_step_version, git_branch_hash, git_hash, project_cmake_arguments, dependency_hashes, project_hash, package_dir, cache_key, cache_paths, was_in_cache, project_packages, source_dir, build_dir, cmake_configure_args, CMAKE_GENERATOR, version_extractor, project_version, cmake_export_name;
602+
var project_description, req_step_version, git_branch_hash, git_hash, project_cmake_arguments, dependency_hashes, project_hash, package_dir, cache_key, cache_paths, was_in_cache, project_packages, source_dir, build_dir, cmake_configure_args, CMAKE_GENERATOR, version_extractor, project_version, infix, cmake_export_name;
594603
return __generator(this, function (_c) {
595604
switch (_c.label) {
596605
case 0:
@@ -756,7 +765,8 @@ function run() {
756765
project_version = version_extractor.extract_from_install_prefix(package_dir);
757766
project_versions[project] = project_version;
758767
core.info("".concat(project, " version is ").concat(project_version.toString()));
759-
cmake_export_name = "".concat(project_description.cmake_var_out_prefix).concat(project_version.major).concat(project_description.cmake_var_out_suffix);
768+
infix = project_version.major == 1 ? "" : "".concat(project_version.major);
769+
cmake_export_name = "".concat(project_description.cmake_var_out_prefix).concat(infix).concat(project_description.cmake_var_out_suffix);
760770
core.exportVariable(cmake_export_name, package_dir);
761771
return [2 /*return*/];
762772
}
@@ -1525,6 +1535,8 @@ exports.Version = Version;
15251535
var Project;
15261536
(function (Project) {
15271537
Project["SDL"] = "SDL";
1538+
Project["SDL2_compat"] = "SDL2_compat";
1539+
Project["SDL12_compat"] = "SDL12_compat";
15281540
Project["SDL_image"] = "SDL_image";
15291541
Project["SDL_mixer"] = "SDL_mixer";
15301542
Project["SDL_net"] = "SDL_net";
@@ -1760,6 +1772,36 @@ exports.project_descriptions = (_a = {},
17601772
},
17611773
_c),
17621774
},
1775+
_a[Project.SDL2_compat] = {
1776+
option_name: "version-sdl2-compat",
1777+
cmake_var_out_prefix: "SDL2",
1778+
cmake_var_out_suffix: "_ROOT",
1779+
deps: [Project.SDL],
1780+
major_define: "SDL_MAJOR_VERSION",
1781+
minor_define: "SDL_MINOR_VERSION",
1782+
patch_define: "SDL_PATCHLEVEL",
1783+
header_paths: ["include/SDL2"],
1784+
header_filenames: ["SDL_version.h"],
1785+
git_url: "https://github.com/libsdl-org/sdl2-compat.git",
1786+
repo_owner: "libsdl-org",
1787+
repo_name: "sdl2-compat",
1788+
version_branch_map: { 2: "main" },
1789+
},
1790+
_a[Project.SDL12_compat] = {
1791+
option_name: "version-sdl12-compat",
1792+
cmake_var_out_prefix: "SDL",
1793+
cmake_var_out_suffix: "_ROOT",
1794+
deps: [Project.SDL2_compat],
1795+
major_define: "SDL_MAJOR_VERSION",
1796+
minor_define: "SDL_MINOR_VERSION",
1797+
patch_define: "SDL_PATCHLEVEL",
1798+
header_paths: ["include/SDL"],
1799+
header_filenames: ["SDL_version.h"],
1800+
git_url: "https://github.com/libsdl-org/sdl12-compat.git",
1801+
repo_owner: "libsdl-org",
1802+
repo_name: "sdl12-compat",
1803+
version_branch_map: { 1: "main" },
1804+
},
17631805
_a);
17641806
var ReleaseType;
17651807
(function (ReleaseType) {

src/main.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,19 @@ async function run() {
535535
core.debug(`proj=${proj}`);
536536
core.debug(`build_order=${build_order}`);
537537
core.debug(`proj in build_order=${proj in build_order}`);
538+
if (
539+
proj == Project.SDL12_compat &&
540+
(build_order.indexOf(Project.SDL) >= 0 ||
541+
build_order.indexOf(Project.SDL2_compat) >= 0)
542+
) {
543+
return 1;
544+
}
545+
if (
546+
proj == Project.SDL2_compat &&
547+
build_order.indexOf(Project.SDL) >= 0
548+
) {
549+
return 1;
550+
}
538551
return build_order.findIndex((e) => e == proj) >= 0;
539552
})
540553
) {
@@ -742,7 +755,8 @@ async function run() {
742755
core.info(`${project} version is ${project_version.toString()}`);
743756

744757
// Set environment variable (e.g. SDL3_ROOT)
745-
const cmake_export_name = `${project_description.cmake_var_out_prefix}${project_version.major}${project_description.cmake_var_out_suffix}`;
758+
const infix = project_version.major == 1 ? "" : `${project_version.major}`;
759+
const cmake_export_name = `${project_description.cmake_var_out_prefix}${infix}${project_description.cmake_var_out_suffix}`;
746760
core.exportVariable(cmake_export_name, package_dir);
747761
}
748762

src/version.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ export class Version {
110110

111111
export enum Project {
112112
SDL = "SDL",
113+
SDL2_compat = "SDL2_compat",
114+
SDL12_compat = "SDL12_compat",
113115
SDL_image = "SDL_image",
114116
SDL_mixer = "SDL_mixer",
115117
SDL_net = "SDL_net",
@@ -379,6 +381,36 @@ export const project_descriptions: { [key in Project]: ProjectDescription } = {
379381
},
380382
},
381383
},
384+
[Project.SDL2_compat]: {
385+
option_name: "version-sdl2-compat",
386+
cmake_var_out_prefix: "SDL2",
387+
cmake_var_out_suffix: "_ROOT",
388+
deps: [Project.SDL],
389+
major_define: "SDL_MAJOR_VERSION",
390+
minor_define: "SDL_MINOR_VERSION",
391+
patch_define: "SDL_PATCHLEVEL",
392+
header_paths: ["include/SDL2"],
393+
header_filenames: ["SDL_version.h"],
394+
git_url: "https://github.com/libsdl-org/sdl2-compat.git",
395+
repo_owner: "libsdl-org",
396+
repo_name: "sdl2-compat",
397+
version_branch_map: { 2: "main" },
398+
},
399+
[Project.SDL12_compat]: {
400+
option_name: "version-sdl12-compat",
401+
cmake_var_out_prefix: "SDL",
402+
cmake_var_out_suffix: "_ROOT",
403+
deps: [Project.SDL2_compat],
404+
major_define: "SDL_MAJOR_VERSION",
405+
minor_define: "SDL_MINOR_VERSION",
406+
patch_define: "SDL_PATCHLEVEL",
407+
header_paths: ["include/SDL"],
408+
header_filenames: ["SDL_version.h"],
409+
git_url: "https://github.com/libsdl-org/sdl12-compat.git",
410+
repo_owner: "libsdl-org",
411+
repo_name: "sdl12-compat",
412+
version_branch_map: { 1: "main" },
413+
},
382414
};
383415

384416
export enum ReleaseType {

0 commit comments

Comments
 (0)