Skip to content

Commit d0c84c5

Browse files
committed
Added github actions to automatically build Telemetry Viewer across platforms both in Debug and Release flavours and as a side effect also cleaned up the project itself quite a bit
1 parent 2d991f2 commit d0c84c5

File tree

8 files changed

+160
-35
lines changed

8 files changed

+160
-35
lines changed

.github/workflows/build-ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI build
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
workflow_dispatch:
9+
10+
env:
11+
BUILD_TYPE: Debug
12+
13+
jobs:
14+
build:
15+
strategy:
16+
matrix:
17+
os: [ windows-2022, ubuntu-24.04, macos-14 ]
18+
fail-fast: false
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: seanmiddleditch/gha-setup-ninja@master
25+
- uses: jurplel/install-qt-action@v4
26+
with:
27+
version: '6.8.0'
28+
modules: 'qtcharts'
29+
cache: 'true'
30+
31+
- name: Configure
32+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_PREFIX_PATH=${{env.QT_ROOT_DIR}}
33+
34+
- name: Build
35+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target tlm-viewer --parallel
36+

.github/workflows/build-release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release build
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
BUILD_TYPE: Release
10+
11+
jobs:
12+
build:
13+
strategy:
14+
matrix:
15+
os: [ windows-2022, ubuntu-24.04, macos-14 ]
16+
fail-fast: false
17+
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: seanmiddleditch/gha-setup-ninja@master
23+
- uses: jurplel/install-qt-action@v4
24+
with:
25+
version: '6.8.0'
26+
modules: 'qtcharts'
27+
cache: 'true'
28+
29+
- name: Configure
30+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_PREFIX_PATH=${{env.QT_ROOT_DIR}}
31+
32+
- name: Build
33+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target tlm-viewer --parallel
34+
35+
- name: Install
36+
run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install
37+
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: ${{matrix.os}}-artifacts
41+
path: ${{github.workspace}}/install/bin
42+
if-no-files-found: error

CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
cmake_minimum_required(VERSION 3.20)
2-
project(Telemetry-Studio)
2+
project(X-Telemetry-Utils)
33

44
if(UNIX AND NOT APPLE)
5-
set(LINUX TRUE)
6-
75
set(IS_WIN32 0)
86
set(IS_MACOS 0)
97
set(IS_LINUX 1)
108
elseif(APPLE)
11-
set(MACOS TRUE)
12-
139
set(IS_WIN32 0)
1410
set(IS_MACOS 1)
1511
set(IS_LINUX 0)
12+
13+
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
1614
else()
1715
set(IS_WIN32 1)
1816
set(IS_MACOS 0)
1917
set(IS_LINUX 0)
18+
19+
add_compile_options(/MP)
2020
endif()
2121

2222
set(CMAKE_CXX_STANDARD 20)
23+
2324
cmake_policy(SET CMP0042 NEW)
2425

2526
add_subdirectory(source)

source/CMakeLists.txt

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
cmake_minimum_required(VERSION 3.20)
2-
project(tlm-viewer)
2+
project(Telemetry-Viewer)
3+
4+
set(VIEWER_VERSION_MAJOR 0)
5+
set(VIEWER_VERSION_MINOR 5)
6+
set(VIEWER_VERSION_PATCH 0)
37

48
set(CMAKE_AUTORCC ON)
59
set(CMAKE_AUTOMOC ON)
@@ -17,6 +21,8 @@ find_package(Qt6 6.7.0 REQUIRED COMPONENTS ${QT_COMPONENTS})
1721

1822
list(TRANSFORM QT_COMPONENTS PREPEND "Qt6::")
1923

24+
set(QT_PLATFORMS_DIR "${Qt6_DIR}/../../../plugins/platforms")
25+
2026
set(SOURCES
2127
main.cpp
2228
model/generic_tree_item.cpp
@@ -55,37 +61,79 @@ set(SOURCES
5561
set(DEFINITIONS
5662
WIN=${IS_WIN32}
5763
LIN=${IS_LINUX}
58-
APL=${IS_MACOS})
64+
APL=${IS_MACOS}
65+
VERSION_MAJOR=${VIEWER_VERSION_MAJOR}
66+
VERSION_MINOR=${VIEWER_VERSION_MINOR}
67+
VERSION_PATCH=${VIEWER_VERSION_PATCH})
5968

60-
add_executable(tlm-viewer ${SOURCES})
61-
62-
set_target_properties(tlm-viewer PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON)
63-
set_target_properties(tlm-viewer PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
69+
add_executable(tlm-viewer WIN32 MACOSX_BUNDLE ${SOURCES})
6470
set_target_properties(tlm-viewer PROPERTIES OUTPUT_NAME "Telemetry Viewer")
6571

66-
target_compile_definitions(tlm-viewer PRIVATE ${DEFINITIONS})
6772
target_link_libraries(tlm-viewer ${QT_COMPONENTS})
68-
target_include_directories(tlm-viewer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/widgets)
69-
70-
add_custom_command(TARGET tlm-viewer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "$<TARGET_FILE_DIR:Qt6::Core>/../plugins/platforms" "$<TARGET_FILE_DIR:tlm-viewer>/platforms")
73+
target_compile_definitions(tlm-viewer PRIVATE ${DEFINITIONS})
74+
target_include_directories(tlm-viewer SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
7175

7276
if(IS_WIN32)
73-
add_custom_target(copy-resources ALL)
77+
78+
set(QT_PLATFORM_PLUGIN "${QT_PLATFORMS_DIR}/qwindows$<$<CONFIG:Debug>:d>.dll")
79+
80+
add_custom_target(tlm-viewer-resources ALL)
81+
82+
add_custom_command(TARGET tlm-viewer-resources POST_BUILD
83+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:tlm-viewer>/platforms/"
84+
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${QT_PLATFORM_PLUGIN}" "$<TARGET_FILE_DIR:tlm-viewer>/platforms/")
85+
86+
install(FILES "${QT_PLATFORM_PLUGIN}" DESTINATION bin/platforms)
7487

7588
foreach(QT_COMPONENT ${QT_COMPONENTS})
7689

77-
add_custom_command(
78-
TARGET copy-resources POST_BUILD
79-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
80-
$<TARGET_FILE:${QT_COMPONENT}>
81-
$<TARGET_FILE_DIR:tlm-viewer>
82-
COMMENT "Copying ${QT_COMPONENT} from $<TARGET_FILE:${QT_COMPONENT}> to $<TARGET_FILE_DIR:tlm-viewer>")
90+
add_custom_command(TARGET tlm-viewer-resources POST_BUILD
91+
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:${QT_COMPONENT}>" "$<TARGET_FILE_DIR:tlm-viewer>")
92+
93+
install(FILES "$<TARGET_FILE:${QT_COMPONENT}>" DESTINATION bin)
8394

8495
endforeach()
8596

86-
add_dependencies(tlm-viewer copy-resources)
97+
add_dependencies(tlm-viewer tlm-viewer-resources)
98+
99+
endif()
100+
101+
if(IS_MACOS)
102+
add_custom_target(tlm-viewer-resources ALL)
103+
104+
set(QT_PLATFORM_PLUGIN "${QT_PLATFORMS_DIR}/libqcocoa.dylib")
105+
106+
add_custom_command(TARGET tlm-viewer-resources POST_BUILD
107+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_BUNDLE_DIR:tlm-viewer>/Contents/Frameworks"
108+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_BUNDLE_DIR:tlm-viewer>/Contents/plugins/platforms/"
109+
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_BUNDLE_DIR:tlm-viewer>/Contents/plugins/platforms/../../lib")
110+
111+
add_custom_command(
112+
TARGET tlm-viewer-resources POST_BUILD
113+
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${QT_PLATFORM_PLUGIN}" "$<TARGET_BUNDLE_DIR:tlm-viewer>/Contents/plugins/platforms/")
114+
115+
add_dependencies(tlm-viewer tlm-viewer-resources)
116+
117+
install(CODE "
118+
include(BundleUtilities)
119+
fixup_bundle(\"$<TARGET_BUNDLE_DIR:tlm-viewer>\" \"\" \"\")
120+
execute_process(
121+
COMMAND install_name_tool -change @rpath/QtGui.framework/Versions/A/QtGui @rpath/../Frameworks/QtGui.framework/Versions/A/QtGui \"$<TARGET_BUNDLE_DIR:tlm-viewer>/Contents/plugins/platforms/libqcocoa.dylib\")
122+
execute_process(
123+
COMMAND install_name_tool -change @rpath/QtCore.framework/Versions/A/QtCore @rpath/../Frameworks/QtCore.framework/Versions/A/QtCore \"$<TARGET_BUNDLE_DIR:tlm-viewer>/Contents/plugins/platforms/libqcocoa.dylib\")
124+
")
87125
endif()
88126

89127
if(IS_LINUX)
90128
target_link_libraries(tlm-viewer stdc++ m)
129+
130+
foreach(QT_COMPONENT ${QT_COMPONENTS})
131+
132+
install(FILES $<TARGET_FILE:${QT_COMPONENT}> DESTINATION lib)
133+
134+
endforeach()
135+
91136
endif()
137+
138+
install(TARGETS tlm-viewer
139+
BUNDLE DESTINATION bin)

source/main.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ QString apply_dark_theme()
2828

2929
int main(int argc, char *argv[])
3030
{
31-
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
32-
3331
QCoreApplication::setApplicationName("Telemetry Viewer");
3432
QCoreApplication::setOrganizationName("Laminar Research");
35-
QCoreApplication::setApplicationVersion("0.4");
33+
QCoreApplication::setApplicationVersion(QString::number(VERSION_MAJOR) % "." % QString::number(VERSION_MINOR) % "." % QString::number(VERSION_PATCH));
3634

3735
#if !LIN
3836
QString style_sheet = apply_dark_theme();

source/utilities/xplane_installations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void parse_install_executables(xplane_installation &installation)
125125
}
126126
}
127127
#else
128-
if(file.isFile() && file.fileName().startsWith("X-Plane") && file.fileName().endsWith("_x86_64"))
128+
if(file.isFile() && file.fileName().startsWith("X-Plane") && file.fileName().endsWith("-x86_64"))
129129
{
130130
installation.executables.push_back(file.fileName());
131131
}

source/widgets/document_window.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ void document_window::set_time_range(int32_t start, int32_t end)
253253
};
254254

255255
const std::array perf_series = {
256-
perf_set("P1", 0.01f),
257-
perf_set("P5", 0.05f),
258-
perf_set("Average", -1.0f),
259-
perf_set("P95", 0.95f),
260-
perf_set("P99", 0.99f)
256+
perf_set{ "P1", 0.01f },
257+
perf_set{ "P5", 0.05f },
258+
perf_set{ "Average", -1.0f },
259+
perf_set{ "P95", 0.95f },
260+
perf_set{ "P99", 0.99f }
261261
};
262262

263263
auto build_bar_set = [&](time_domain domain) -> QBarSet * {

source/widgets/document_window.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,13 @@
473473
<customwidget>
474474
<class>time_picker_widget</class>
475475
<extends>QWidget</extends>
476-
<header>time_picker_widget.h</header>
476+
<header>widgets/time_picker_widget.h</header>
477477
<container>1</container>
478478
</customwidget>
479479
<customwidget>
480480
<class>timeline_widget</class>
481481
<extends>QGraphicsView</extends>
482-
<header>timeline_widget.h</header>
482+
<header>widgets/timeline_widget.h</header>
483483
<slots>
484484
<slot>zoomIn()</slot>
485485
<slot>zoomOut()</slot>
@@ -493,7 +493,7 @@
493493
<customwidget>
494494
<class>chart_widget</class>
495495
<extends>QGraphicsView</extends>
496-
<header>chart_widget.h</header>
496+
<header>widgets/chart_widget.h</header>
497497
</customwidget>
498498
</customwidgets>
499499
<resources/>

0 commit comments

Comments
 (0)