Skip to content

Commit 48f70ee

Browse files
committed
Script: Add build_depend.sh
1 parent 2f24d0f commit 48f70ee

File tree

12 files changed

+484
-191
lines changed

12 files changed

+484
-191
lines changed

.github/workflows/android.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ jobs:
3131

3232
env:
3333
artifact_name: build_android
34+
BUILD_DIR: ${{github.workspace}}/build
3435
SOURCE_DIR: ${{github.workspace}}/.cache/source
35-
TOOSL_DIR: ${{github.workspace}}/.cache/tools
36+
TOOLS_DIR: ${{github.workspace}}/.cache/tools
3637
INSTALL_DIR: ${{github.workspace}}/.cache/install
37-
SerialPortAssistant_VERSION: v0.5.29
3838
VCPKGGITCOMMITID: 59aeb8fe8fe1c980de6bd5ba634cf21024522d81
3939
VCPKG_TARGET_TRIPLET: ${{matrix.VCPKG_TARGET_TRIPLET}}
4040
VCPKG_DEFAULT_HOST_TRIPLET: x64-linux
4141
ANDROID_ABI: ${{matrix.ANDROID_ABI}}
4242
ANDROID_PLATFORM: android-35
4343
ANDROID_NATIVE_API_LEVEL: 35
4444
qt_modules: 'qtscxml qtserialport'
45+
SerialPortAssistant_VERSION: v0.5.29
4546

4647
# Map the job outputs to step outputs
4748
outputs:
@@ -56,9 +57,9 @@ jobs:
5657
- name: make directory
5758
run: |
5859
cmake -E make_directory ${{env.SOURCE_DIR}}
59-
cmake -E make_directory ${{env.TOOSL_DIR}}
60+
cmake -E make_directory ${{env.TOOLS_DIR}}
6061
cmake -E make_directory ${{env.INSTALL_DIR}}
61-
cmake -E make_directory ${{github.workspace}}/build
62+
cmake -E make_directory ${{env.BUILD_DIR}}
6263
6364
- name: Cache installed
6465
#if: false
@@ -72,7 +73,7 @@ jobs:
7273
- name: Install Qt of gcc_64
7374
uses: jurplel/install-qt-action@v3
7475
with:
75-
dir: '${{env.TOOSL_DIR}}' # optional
76+
dir: '${{env.TOOLS_DIR}}' # optional
7677
version: '${{matrix.qt_version}}'
7778
host: 'linux'
7879
target: 'desktop'
@@ -85,7 +86,7 @@ jobs:
8586
uses: jurplel/install-qt-action@v3
8687
with:
8788
# Directory to install Qt
88-
dir: '${{env.TOOSL_DIR}}' # optional
89+
dir: '${{env.TOOLS_DIR}}' # optional
8990
# Version of Qt to install
9091
version: '${{matrix.qt_version}}'
9192
# Host platform

.github/workflows/appimage.yml

Lines changed: 45 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Author: Kang Lin <kl222@126.com>
2+
13
name: appimage
24

35
on:
@@ -16,19 +18,27 @@ jobs:
1618
matrix:
1719
BUILD_TYPE: [Release]
1820
qt_version: [6.8.2]
19-
qt_arch: [linux_gcc_64]
20-
21-
# See: https://docs.github.com/zh/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
21+
os: [ubuntu-24.04, ubuntu-24.04-arm]
22+
include:
23+
- os: ubuntu-24.04
24+
qt_arch: "linux_gcc_64"
25+
- os: ubuntu-24.04-arm
26+
qt_arch: "linux_gcc_arm64"
27+
28+
# See: [About GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners)
29+
# See: [Choosing the runner for a job](https://docs.github.com/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job)
2230
# See: https://github.com/actions/runner-images/
23-
runs-on: ubuntu-24.04
31+
runs-on: ${{matrix.os}}
2432

2533
env:
2634
BUILD_TYPE: ${{matrix.BUILD_TYPE}}
35+
BUILD_DIR: ${{github.workspace}}/build
2736
SOURCE_DIR: ${{github.workspace}}/.cache/source
28-
TOOSL_DIR: ${{github.workspace}}/.cache/tools
29-
INSTALL_DIR: ${{github.workspace}}/.cache/install
37+
TOOLS_DIR: ${{github.workspace}}/.cache/tools
38+
INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.os}}_${{matrix.qt_arch}}_${{matrix.BUILD_TYPE}}
39+
artifact_name: build_appimage_${{matrix.os}}
40+
qt_modules: 'qtscxml'
3041
SerialPortAssistant_VERSION: v0.5.29
31-
artifact_name: build_appimage
3242

3343
# Map the job outputs to step outputs
3444
outputs:
@@ -38,118 +48,72 @@ jobs:
3848
- name: Checkout Repository
3949
uses: actions/checkout@v3
4050
with:
41-
submodules: true
51+
submodules: recursive
4252

4353
- name: Make directories
4454
run: |
45-
cmake -E make_directory ${{github.workspace}}/build
55+
cmake -E make_directory ${{env.BUILD_DIR}}
4656
cmake -E make_directory ${{env.SOURCE_DIR}}
47-
cmake -E make_directory ${{env.TOOSL_DIR}}
57+
cmake -E make_directory ${{env.TOOLS_DIR}}
4858
cmake -E make_directory ${{env.INSTALL_DIR}}
4959
60+
- name: Cache installed
61+
uses: actions/cache@v3
62+
id: cache-installed
63+
with:
64+
path: |
65+
${{env.INSTALL_DIR}}
66+
${{env.TOOLS_DIR}}/linuxdeploy-*
67+
key: install_appimage
68+
5069
- name: git clone RabbitCommon
5170
working-directory: ${{env.SOURCE_DIR}}
5271
run: |
5372
git clone https://github.com/KangLin/RabbitCommon.git
5473
55-
- name: Install apt packages
74+
- name: Install base dependency libraries
5675
run: |
57-
sudo apt-get update -y
58-
sudo apt-get upgrade -y
59-
sudo apt install -y -q cmake build-essential xvfb xpra \
60-
libgl1-mesa-dev libglx-dev libglu1-mesa-dev libvulkan-dev \
61-
cmake debhelper fakeroot graphviz \
62-
libxkbcommon-dev libxkbcommon-x11-dev xorg-dev libx11-xcb-dev \
63-
libx11-dev libxfixes-dev libxcb-randr0-dev libxcb-shm0-dev \
64-
libxcb-xinerama0-dev libxcb-composite0-dev libxcomposite-dev \
65-
libxinerama-dev libxcb1-dev libx11-xcb-dev libxcb-xfixes0-dev \
66-
libxcb-cursor-dev libxcb-xkb-dev libxcb-keysyms1-dev \
67-
libxcb-* libxcb-cursor0 \
68-
libwayland-dev libwayland-egl-backend-dev waylandpp-dev \
69-
libxkbcommon-dev mesa-common-dev \
70-
libcmark-dev cmark libfuse-dev libfuse3-dev
76+
sudo ./Script/build_depend.sh --apt_update --base --default \
77+
--install ${{env.INSTALL_DIR}} \
78+
--source ${{env.SOURCE_DIR}} \
79+
--tools ${{env.TOOLS_DIR}} \
80+
--build ${{env.BUILD_DIR}}
7181
7282
- name: Install Qt
7383
uses: jurplel/install-qt-action@v3
84+
if: false
7485
with:
75-
dir: '${{env.TOOSL_DIR}}/qt'
76-
aqtversion: '==3.1.*'
86+
dir: '${{env.TOOLS_DIR}}/qt'
7787
version: ${{matrix.qt_version}}
78-
host: 'linux'
7988
target: 'desktop'
8089
arch: ${{matrix.qt_arch}}
8190
# See: https://ddalcino.github.io/aqt-list-server/
82-
modules: 'qtscxml qtmultimedia qtimageformats qtserialport qt5compat'
91+
modules: ${{env.qt_modules}}
8392
cache: true
84-
cache-key-prefix: cached-qt
85-
86-
- name: Cache installed
87-
uses: actions/cache@v3
88-
id: cache-installed
89-
with:
90-
path: |
91-
${{env.INSTALL_DIR}}
92-
${{env.TOOSL_DIR}}
93-
key: install_ubuntu_${{matrix.BUILD_TYPE}}
94-
95-
- name: linuxdeploy
96-
run: |
97-
cd ${{env.TOOSL_DIR}}
98-
if [ ! -f linuxdeploy-`uname -m`.AppImage ]; then
99-
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/2.0.0-alpha-1-20241106/linuxdeploy-`uname -m`.AppImage
100-
chmod u+x linuxdeploy-`uname -m`.AppImage
101-
fi
102-
if [ ! -f linuxdeploy-plugin-qt-`uname -m`.AppImage ]; then
103-
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/2.0.0-alpha-1-20241106/linuxdeploy-plugin-qt-`uname -m`.AppImage
104-
chmod u+x linuxdeploy-plugin-qt-`uname -m`.AppImage
105-
fi
93+
cache-key-prefix: cached-qt_${{matrix.qt_arch}}
10694

10795
- name: build appimage
108-
working-directory: ${{github.workspace}}/build
10996
env:
11097
RabbitCommon_ROOT: ${{env.SOURCE_DIR}}/RabbitCommon
11198
run: |
112-
cmake ${{github.workspace}} \
113-
-DCMARK_SHARED=OFF \
114-
-DCMARK_TESTS=OFF \
115-
-DCMARK_STATIC=ON \
116-
-DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} \
117-
-DCMAKE_INSTALL_PREFIX=/usr
118-
cmake --build . --parallel $(nproc)
119-
cmake --install . --config Release --component DependLibraries --prefix AppDir/usr
120-
cmake --install . --config Release --component Runtime --prefix AppDir/usr
121-
cmake --install . --config Release --component Application --prefix AppDir/usr
122-
# See: https://github.com/linuxdeploy/linuxdeploy-plugin-qt
123-
export QMAKE=$Qt6_DIR/bin/qmake
124-
export EXTRA_PLATFORM_PLUGINS="libqxcb.so"
125-
# Icons from theme are not displayed in QtWidgets Application: https://github.com/linuxdeploy/linuxdeploy-plugin-qt/issues/17
126-
export EXTRA_QT_MODULES="svg"
127-
${{env.TOOSL_DIR}}/linuxdeploy-`uname -m`.AppImage --appdir=AppDir -v0 \
128-
--deploy-deps-only=AppDir/usr/lib/`uname -m`-linux-gnu \
129-
--plugin qt \
130-
--output appimage
131-
mv Serial_Port_Assistant-`uname -m`.AppImage ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage
132-
chmod a+x ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage
133-
md5sum ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage > ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage.md5sum
99+
export QMAKE=/usr/bin/qmake6
100+
${{github.workspace}}/Script/build_appimage.sh
101+
md5sum SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage > ../SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_`uname -m`.AppImage.md5sum
134102
135103
- name: update configure file
136104
if: ${{ matrix.BUILD_TYPE == 'Release'}}
137105
#continue-on-error: true
138106
run: |
139107
#sudo apt update -y -qq
140108
#sudo apt-get install -y -qq xvfb xpra
141-
sudo Xvfb :99 -ac &
142-
export DISPLAY=:99.0
109+
sudo Xvfb :96 -ac -screen 0 1200x900x24 &
110+
export DISPLAY=:96.0
143111
echo "Update update_linux.json ......"
144112
export QT_XCB_GL_INTEGRATION=none
145-
export QT_DEBUG_PLUGINS=1
113+
#export QT_DEBUG_PLUGINS=1
146114
ARCH=`uname -m`
147115
MD5SUM=`cat SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_$ARCH.AppImage.md5sum|awk '{print $1}'`
148116
echo "MD5SUM SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_$ARCH.AppImage: ${MD5SUM}"
149-
#echo "Enable core dump ......"
150-
#ulimit -c unlimited
151-
#echo "# sudo sysctl -w kernel.core_pattern=core"
152-
#sudo sysctl -w kernel.core_pattern=${{github.workspace}}/core
153117
echo "Generate update configure file ......"
154118
./SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_$ARCH.AppImage \
155119
-f "${{github.workspace}}/update_appimage_${{matrix.qt_arch}}_qt${{matrix.qt_version}}.json" \

.github/workflows/macos.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ jobs:
3636

3737
env:
3838
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
39+
BUILD_DIR: ${{github.workspace}}/build
3940
SOURCE_DIR: ${{github.workspace}}/.cache/source
40-
TOOSL_DIR: ${{github.workspace}}/.cache/tools
41+
TOOLS_DIR: ${{github.workspace}}/.cache/tools
4142
INSTALL_DIR: ${{github.workspace}}/.cache/install_macos
4243
qt_modules: ${{matrix.qt_modules}}
43-
SerialPortAssistant_VERSION: 0.5.29
4444
artifact_name: build_macos
4545
VCPKGGITCOMMITID: 59aeb8fe8fe1c980de6bd5ba634cf21024522d81
46+
SerialPortAssistant_VERSION: 0.5.29
4647

4748
# Map the job outputs to step outputs
4849
outputs:
@@ -57,9 +58,9 @@ jobs:
5758
- name: Make directories
5859
run: |
5960
cmake -E make_directory ${{env.SOURCE_DIR}}
60-
cmake -E make_directory ${{env.TOOSL_DIR}}
61+
cmake -E make_directory ${{env.TOOLS_DIR}}
6162
cmake -E make_directory ${{env.INSTALL_DIR}}
62-
cmake -E make_directory ${{github.workspace}}/build
63+
cmake -E make_directory ${{env.BUILD_DIR}}
6364
6465
- name: Cache installed
6566
uses: actions/cache@v3
@@ -78,7 +79,7 @@ jobs:
7879
- name: Install Qt
7980
uses: jurplel/install-qt-action@v3
8081
with:
81-
dir: '${{env.TOOSL_DIR}}/qt' # optional
82+
dir: '${{env.TOOLS_DIR}}/qt' # optional
8283
version: '${{matrix.qt_version}}' # optional, default is 5.15.2
8384
arch: '${{matrix.qt_arch}}' # optional
8485
modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/

.github/workflows/mingw.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
env:
3030
SOURCE_DIR: ${{github.workspace}}\.cache\source
31-
TOOSL_DIR: ${{github.workspace}}\.cache\tools
31+
TOOLS_DIR: ${{github.workspace}}\.cache\tools
3232
INSTALL_DIR: ${{github.workspace}}\.cache\install_mingw
3333
SerialPortAssistant_VERSION: v0.5.29
3434
artifact_name: build_mingw
@@ -46,7 +46,7 @@ jobs:
4646
- name: Make directories
4747
run: |
4848
cmake -E make_directory ${{env.SOURCE_DIR}}
49-
cmake -E make_directory ${{env.TOOSL_DIR}}
49+
cmake -E make_directory ${{env.TOOLS_DIR}}
5050
cmake -E make_directory ${{env.INSTALL_DIR}}
5151
cmake -E make_directory ${{github.workspace}}/build
5252

.github/workflows/msvc.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ jobs:
4343

4444
env:
4545
SerialPortAssistant_VERSION: v0.5.29
46+
BUILD_DIR: ${{github.workspace}}/build
4647
SOURCE_DIR: ${{github.workspace}}\.cache\source
47-
TOOSL_DIR: ${{github.workspace}}\.cache\tools
48+
TOOLS_DIR: ${{github.workspace}}\.cache\tools
4849
INSTALL_DIR: ${{github.workspace}}\.cache\install_${{matrix.qt_arch}}_${{matrix.BUILD_TYPE}}
4950
CMAKE_GENERATOR: "Visual Studio 17 2022"
5051
CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}}
@@ -71,9 +72,9 @@ jobs:
7172

7273
- name: Make directories
7374
run: |
74-
cmake -E make_directory ${{github.workspace}}/build
75+
cmake -E make_directory ${{env.BUILD_DIR}}
7576
cmake -E make_directory ${{env.SOURCE_DIR}}
76-
cmake -E make_directory ${{env.TOOSL_DIR}}
77+
cmake -E make_directory ${{env.TOOLS_DIR}}
7778
cmake -E make_directory ${{env.INSTALL_DIR}}
7879
7980
- name: Cache installed
@@ -93,7 +94,7 @@ jobs:
9394
- name: Install Qt
9495
uses: jurplel/install-qt-action@v3
9596
with:
96-
dir: '${{env.TOOSL_DIR}}/qt' # optional
97+
dir: '${{env.TOOLS_DIR}}/qt' # optional
9798
version: '${{matrix.qt_version}}' # optional, default is 5.15.2
9899
arch: '${{matrix.qt_arch}}' # optional
99100
modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/

0 commit comments

Comments
 (0)