Skip to content

Commit c8e8114

Browse files
authored
Add debian-11+ support for axmol-2.x (#2956)
1 parent 1c724cd commit c8e8114

File tree

14 files changed

+313
-160
lines changed

14 files changed

+313
-160
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- '**/*.md.in'
1111
- 'docs/**'
1212
- '.github/workflows/publish.yml'
13+
- '.github/workflows/debian.yml'
1314
- 'tools/ci/make-pkg.ps1'
1415
pull_request:
1516
types: [opened, synchronize, reopened]

.github/workflows/debian.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow require self-hosted by @halx99 personal machine, so only support trigger manually
2+
name: debian
3+
4+
on:
5+
push:
6+
branches:
7+
- dev
8+
- release/*
9+
paths:
10+
- '.github/workflows/debian.yml'
11+
workflow_dispatch:
12+
inputs:
13+
cxxstd:
14+
# actions run ID
15+
description: 'Please input cxxstd, example: 20'
16+
# Default value if no value is explicitly provided
17+
default: '20'
18+
# Input has to be provided for the workflow to run
19+
required: false
20+
21+
env:
22+
__1K_CXXSTD: '${{ inputs.cxxstd }}'
23+
24+
run-name: 'build@c++${{ inputs.cxxstd || 20 }}'
25+
26+
jobs:
27+
debian-ogl:
28+
runs-on: debian-11
29+
steps:
30+
- uses: actions/checkout@v6
31+
32+
- name: Install dependencies
33+
run: |
34+
AX_ROOT=`pwd`
35+
echo -e "y" | pwsh $AX_ROOT/setup.ps1
36+
37+
- name: Build
38+
shell: pwsh
39+
run: ./tools/cmdline/axmol -p linux -a x64 -t 'cpp-tests,lua-tests' && ./tools/cmdline/axmol run -p linux -a x64 -t unit-tests -wait

.github/workflows/genbindings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- 'docs/**'
1212
- '.github/workflows/publish.yml'
1313
- 'tools/ci/make-pkg.ps1'
14+
- '.github/workflows/debian.yml'
1415

1516
workflow_dispatch:
1617
jobs:

.github/workflows/publish.yml

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,21 @@ jobs:
2828
steps:
2929
- uses: actions/checkout@v6
3030

31-
- name: Check release ver from input
32-
if: ${{ github.event.inputs.version != '' }}
31+
- name: Check release version
3332
id: check_ver
3433
shell: pwsh
3534
run: |
36-
$release_ver = '${{ github.event.inputs.version }}'
37-
echo "release_ver=$release_ver" >> ${env:GITHUB_OUTPUT}
38-
echo "release_ver=$release_ver" >> ${env:GITHUB_ENV}
39-
40-
- name: Check release ver from commits
41-
if: ${{ steps.check_ver.outputs.release_ver == '' }}
42-
shell: pwsh
43-
run: |
44-
# commit message template: Version 2.7.0
35+
# commit message template: Version 1.8.0
4536
$commit_msg = "$(git show -s --format=%s)"
46-
echo "commit_msg: $commit_msg"
47-
$matchInfo = [Regex]::Match($commit_msg, 'Version\s(\d+\.)+(-)?(\*|\d+)')
48-
if ($matchInfo.Success) { $matchInfo = [Regex]::Match($matchInfo.Value, '(\d+\.)+(-)?(\*|\d+)') }
49-
$release_ver = if($matchInfo.Success) { $matchInfo.Value.TrimStart('Version ') }
50-
echo "release_ver=$release_ver" >> ${env:GITHUB_ENV}
51-
52-
- name: Forward release ver to step make_pkg
53-
id: forward_ver
54-
shell: pwsh
55-
run: |
56-
echo "Forwarding release_ver=$env:release_ver ..."
57-
echo "release_ver=$env:release_ver" >> ${env:GITHUB_OUTPUT}
37+
echo "Parsing release version from commit message: $commit_msg"
38+
$matchInfo = [Regex]::Match($commit_msg, '^Version\s+(?<ver>\d+\.\d+\.\d+)$')
39+
if(!$matchInfo.Success) { $matchInfo = [Regex]::Match('${{github.event.inputs.version}}', '^(?<ver>\d+\.\d+\.\d+(-\w+)?)$') }
40+
if($matchInfo.Success) { $release_ver = $matchInfo.Groups['ver'].Value } else { $release_ver='' }
41+
echo "release_ver=$release_ver"
42+
echo "release_ver=$release_ver" >> ${env:GITHUB_OUTPUT}
5843
5944
- name: Make package
60-
if: ${{ steps.forward_ver.outputs.release_ver != '' }}
45+
if: ${{ steps.check_ver.outputs.release_ver != '' }}
6146
id: make_pkg
6247
# Some projects don't allow in-source building, so create a separate build directory
6348
# We'll use this as our working directory for all subsequent commands
@@ -69,7 +54,7 @@ jobs:
6954
axmol -xc '-DAX_WITH_LZ4=ON,-DAX_WITH_CARES=ON,-DAX_WITH_YAML_CPP=ON,-DAX_WITH_KCP=ON' -c
7055
$input_commitish = "${{ github.event.inputs.commitish }}"
7156
if (!$input_commitish) { $input_commitish = $(git -C $AX_ROOT branch --show-current) }
72-
./tools/ci/publish.ps1 -version "${{ steps.forward_ver.outputs.release_ver }}" -commitish $input_commitish
57+
./tools/ci/publish.ps1 -version "${{ steps.check_ver.outputs.release_ver }}" -commitish $input_commitish
7358
echo "commitish=$input_commitish" >> ${env:GITHUB_OUTPUT}
7459
7560
- name: Publish to github release page

1k/1kiss.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ $HOST_LINUX = 1 # targets: linux,android
6868
$HOST_MAC = 2 # targets: android,ios,osx(macos),tvos,watchos
6969

7070
# 0: windows, 1: linux, 2: macos
71-
$Global:IsWin = $IsWindows -or ("$env:OS" -eq 'Windows_NT')
72-
if ($Global:IsWin) { $HOST_OS_INT = $HOST_WIN }
71+
72+
# import VersionEx and others
73+
. (Join-Path $PSScriptRoot 'extensions.ps1')
74+
75+
if ($IsWin) { $HOST_OS_INT = $HOST_WIN }
7376
else {
7477
if ($IsLinux) { $HOST_OS_INT = $HOST_LINUX }
7578
elseif ($IsMacOS) { $HOST_OS_INT = $HOST_MAC }
@@ -99,9 +102,6 @@ if ($Global:IsWin) {
99102
}
100103
$ErrorActionPreference = @('Stop', 'Continue')[$is_pwsh_ise]
101104

102-
# import VersionEx and others
103-
. (Join-Path $PSScriptRoot 'extensions.ps1')
104-
105105
class _1kiss {
106106
[void] println($msg) {
107107
Write-Host "1kiss: $msg"
@@ -335,7 +335,7 @@ if ([VersionEx]$pwsh_ver -lt [VersionEx]"7.0") {
335335
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
336336
}
337337

338-
$osVer = if ($IsWin) { "Microsoft Windows $([System.Environment]::OSVersion.Version.ToString())" } else { $PSVersionTable.OS }
338+
$osVerString = if ($IsWin) { "Microsoft Windows $($NtOSVersion.ToString())" } else { $PSVersionTable.OS }
339339

340340
# arm64,x64
341341
# uname -m: arm64/aarch64,x86_64
@@ -347,7 +347,7 @@ if ($IsWin) {
347347
$HOST_CPU = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLower()
348348
}
349349

350-
$1k.println("PowerShell $pwsh_ver on $osVer")
350+
$1k.println("PowerShell $pwsh_ver on $osVerString")
351351

352352
# determine build target os
353353
$TARGET_OS = $options.p
@@ -1674,7 +1674,7 @@ function preprocess_win() {
16741674
function preprocess_linux() {
16751675
$outputOptions = @()
16761676
if ($Global:is_clang) {
1677-
$outputOptions += '-DCMAKE_C_COMPILER=clang', '-DCMAKE_CXX_COMPILER=clang++'
1677+
$outputOptions += "-DCMAKE_TOOLCHAIN_FILE=$PSScriptRoot/clang.cmake"
16781678
}
16791679
return , $outputOptions
16801680
}

1k/build.profiles

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# --- region platfom:common
77

88
# The axmol shader compiler, legacy name is 'glslcc' before axmol-2.3.0
9-
axslcc=1.9.6
9+
axslcc=1.14.0
1010

1111
# The cmake, @gradle @axmol-cmdline
1212
# as latest as possible

1k/clang.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# The clang toolchain on linux
2+
set(CMAKE_C_COMPILER clang)
3+
set(CMAKE_CXX_COMPILER clang++)
4+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
5+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++ -lc++abi")

1k/extensions.ps1

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# PowerShell 5.x No builtin variable: $IsWindows
2+
if ($Global:__1k_ext_imported) { return }
3+
4+
$Global:__1k_ext_imported = $true
5+
6+
$Global:IsWin = $IsWindows -or ("$env:OS" -eq 'Windows_NT')
7+
8+
if ($Global:IsWin) {
9+
$Global:NtOSVersion = [System.Environment]::OSVersion.Version
10+
}
11+
112
# The System.Version compare not relex: [Version]'1.0' -eq [Version]'1.0.0' == false
213
# So provide a spec VersionEx make [VersionEx]'1.0' -eq [VersionEx]'1.0.0' == true available
314
if (-not ([System.Management.Automation.PSTypeName]'System.VersionEx').Type) {
@@ -22,7 +33,7 @@ namespace System
2233
public int Revision { get { return _Revision; } }
2334
2435
int DefaultFormatFieldCount { get { return (_Build > 0 || _Revision > 0) ? (_Revision > 0 ? 4 : 3) : 2; } }
25-
36+
2637
public VersionEx() { }
2738
2839
public VersionEx(string version)
@@ -34,7 +45,7 @@ namespace System
3445
_Revision = v.Revision;
3546
}
3647
37-
public VersionEx(System.Version version) {
48+
public VersionEx(System.Version version) {
3849
_Major = version.Major;
3950
_Minor = version.Minor;
4051
_Build = Math.Max(version.Build, 0);
@@ -222,15 +233,15 @@ namespace System
222233
}
223234

224235

225-
function ConvertFrom-Props {
236+
function Global:ConvertFrom-Props {
226237
param(
227-
[Parameter(Mandatory=$true)]
238+
[Parameter(Mandatory = $true)]
228239
$InputObject
229240
)
230241

231242
$props = @{}
232243

233-
foreach($_ in $InputObject) {
244+
foreach ($_ in $InputObject) {
234245
if ($_ -match "^#.*$") {
235246
continue
236247
}
@@ -244,9 +255,9 @@ function ConvertFrom-Props {
244255
return $props
245256
}
246257

247-
function ConvertTo-Props {
258+
function Global:ConvertTo-Props {
248259
param(
249-
[Parameter(Mandatory=$true)]
260+
[Parameter(Mandatory = $true)]
250261
$InputObject
251262
)
252263

1k/install-pwsh.sh

Lines changed: 0 additions & 98 deletions
This file was deleted.

1k/ios.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ if(ARCHS MATCHES "((arm64|arm64e|x86_64)(^|;|, )?)+")
150150
endif()
151151
endif()
152152

153-
# This little function lets you set any XCode specific property, refer to: ios.toolchain.cmake
153+
# This little function lets you set any Xcode specific property, refer to: ios.toolchain.cmake
154154
function(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
155155
if(ARGC LESS 4 OR ARGV3 STREQUAL "All")
156156
set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})

0 commit comments

Comments
 (0)