-
Notifications
You must be signed in to change notification settings - Fork 29
124 lines (114 loc) · 5.08 KB
/
build-macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: build-macos
on:
push:
branches:
- master
env:
QT_VERSION: 5.15.2
jobs:
build:
name: ${{ matrix.config.name }}
strategy:
matrix:
config:
- {
name: "macOS-10.13-x64", artifact: "macOS-10.13-x64.zip",
os: macos-latest
}
runs-on: ${{ matrix.config.os }}
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Download Qt
id: qt
shell: cmake -P {0}
run: |
set(qt_version $ENV{QT_VERSION})
string(REPLACE "." "" qt_version_dotless "${qt_version}")
if ("${{ runner.os }}" STREQUAL "Linux")
set(url_os "linux_x64")
set(qt_package_name "qt.qt5.${qt_version_dotless}.gcc_64")
set(qt_dir_prefix "${qt_version}/gcc_64")
elseif ("${{ runner.os }}" STREQUAL "macOS")
set(url_os "mac_x64")
set(qt_package_name "qt.qt5.${qt_version_dotless}.clang_64")
set(qt_dir_prefix "${qt_version}/clang_64")
elseif ("${{ runner.os }}" STREQUAL "Windows")
set(url_os "windows_x86")
if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
set(qt_package_name "qt.qt5.${qt_version_dotless}.win64_msvc2017_64")
set(qt_dir_prefix "${qt_version}/msvc2017_64")
elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
set(qt_package_name "qt.qt5.${qt_version_dotless}.win32_msvc2017")
set(qt_dir_prefix "${qt_version}/msvc2017")
else()
endif()
endif()
set(qt_base_url "https://download.qt.io/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}")
file(DOWNLOAD "${qt_base_url}/Updates.xml" ./Updates.xml SHOW_PROGRESS)
file(READ ./Updates.xml updates_xml)
string(REGEX MATCH "<Name>${qt_package_name}.*<Version>([0-9+-.]+)</Version>.*<DownloadableArchives>qtbase([a-zA-Z0-9_-]+).7z"
updates_xml_output "${updates_xml}")
set(package_version ${CMAKE_MATCH_1})
set(package_suffix ${CMAKE_MATCH_2})
string(REPLACE "-debug-symbols" "" package_suffix "${package_suffix}")
# Workaround for CMake's greedy regex
if ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
string(REPLACE "X86_64" "X86" package_suffix "${package_suffix}")
endif()
file(MAKE_DIRECTORY qt5)
# Save the path for other steps
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt5/${qt_dir_prefix}" qt_dir)
message("::set-output name=qt_dir::${qt_dir}")
foreach(package qtbase qtdeclarative qttools qtsvg qtquickcontrols2 qtgraphicaleffects qttranslations qtsensors qtlocation)
file(DOWNLOAD
"${qt_base_url}/${qt_package_name}/${package_version}${package}${package_suffix}.7z" ./${package}.7z
SHOW_PROGRESS
)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${package}.7z WORKING_DIRECTORY qt5)
endforeach()
file(READ "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig)
string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}")
string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}")
string(REPLACE "licheck64" "" qtconfig "${qtconfig}")
string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}")
file(WRITE "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}")
- name: Configure
run: |
git submodule init && git submodule update
find ${{ steps.qt.outputs.qt_dir }}/lib/cmake -maxdepth 1
mkdir -p build
cd build
cmake .. \
-DBUILD_DEPENDENCIES=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" \
-DCMAKE_PREFIX_PATH=${{ steps.qt.outputs.qt_dir }} \
-DQt5Core_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Core \
-DQt5Gui_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Gui \
-DQt5Qml_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Qml \
-DQt5Network_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Network \
-DQt5Quick_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Quick \
-DQt5QuickControls2_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5QuickControls2 \
-DQt5Xml_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Xml \
-DQt5Svg_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Svg \
-DQt5Widgets_DIR=${{ steps.qt.outputs.qt_dir }}/lib/cmake/Qt5Widgets
- name: Build from sources
run: |
cd build
make
- name: Build package
run: |
export QT_DIR=${{ steps.qt.outputs.qt_dir }}
export SOURCE_DIR=${{ github.workspace }}
export BUILD_DIR=${{ github.workspace }}/build
cd ${BUILD_DIR}
${SOURCE_DIR}/macosx/bundle.sh icon
${SOURCE_DIR}/macosx/bundle.sh bundle
${SOURCE_DIR}/macosx/bundle.sh archive
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.config.name }}
path: ${{ github.workspace }}/build/noson-MacOSX_*.tar.gz
retention-days: 5