Skip to content

Commit 7c9883c

Browse files
committed
debug macos
1 parent 8148e6f commit 7c9883c

File tree

3 files changed

+56
-86
lines changed

3 files changed

+56
-86
lines changed

.github/workflows/workflow.yaml

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ${{matrix.os}}
1212
steps:
1313
- name: Download
14-
uses: actions/checkout@v4.1.7
14+
uses: actions/checkout@v4
1515

1616
- name: Update Ubuntu
1717
if: matrix.os == 'ubuntu-24.04'
@@ -37,11 +37,11 @@ jobs:
3737

3838
- name: Add MSVC to path on Windows
3939
if: matrix.os == 'windows-latest'
40-
uses: ilammy/msvc-dev-cmd@v1.12.1
40+
uses: ilammy/msvc-dev-cmd@v1
4141

4242
- name: Install cmake on Windows
4343
if: matrix.os == 'windows-latest'
44-
uses: lukka/get-cmake@v3.29.6
44+
uses: lukka/get-cmake@latest
4545

4646
- name: Install winget to get Windows packages
4747
if: matrix.os == 'windows-latest'
@@ -57,19 +57,19 @@ jobs:
5757

5858
- name: Install Qt on Windows
5959
if: matrix.os == 'windows-latest'
60-
uses: jurplel/install-qt-action@v4.0.0
60+
uses: jurplel/install-qt-action@v4
6161
with:
6262
version: "6.6.3"
6363
cache: true
6464

6565
- name: Install vcpkg packages
66-
uses: lukka/run-vcpkg@v11.5
66+
uses: lukka/run-vcpkg@v11
6767
with:
6868
vcpkgGitCommitId: '47364fbc300756f64f7876b549d9422d5f3ec0d3'
6969

7070
- name: Restore soundfont files from the cache if available
7171
id: soundfont_step
72-
uses: actions/cache@v4.0.2
72+
uses: actions/cache@v4
7373
with:
7474
path: share
7575
key: ${{matrix.os}}-soundfont_cache
@@ -86,53 +86,47 @@ jobs:
8686
curl "${{env.instruments_url}}/MuseScore_General_License.md"
8787
--output "share/MuseScore_General_License.md"
8888
89-
- name: Configure with tests on Ubuntu
90-
if: matrix.os == 'ubuntu-24.04'
89+
- name: Configure with tests on Unix
90+
if: matrix.os != 'windows-latest'
9191
run: >
9292
cmake -S . -B with_tests
9393
-DBUILD_TESTS=ON
94-
-DCMAKE_BUILD_TYPE=Release
94+
-DCMAKE_BUILD_TYPE=Debug
9595
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake
9696
-DNO_REALTIME_AUDIO=ON
9797
-DTRACK_COVERAGE=ON
9898
-DVCPKG_OVERLAY_PORTS=$(pwd)/overlays/fluidsynth
9999
100-
- name: Configure with tests on MacOS
101-
if: matrix.os == 'macos-latest'
102-
run: >
103-
cmake -S . -B with_tests
104-
-DBUILD_TESTS=ON
105-
-DCMAKE_BUILD_TYPE=Debug
106-
-DNO_REALTIME_AUDIO=ON
107-
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake
108-
-DVCPKG_OVERLAY_PORTS=$(pwd)/overlays/fluidsynth
109-
110100
- name: Configure with tests on Windows
111101
if: matrix.os == 'windows-latest'
112102
run: >
113103
cmake -S . -B with_tests
114104
-DBUILD_TESTS=ON
115-
-DCMAKE_BUILD_TYPE=Release
105+
-DCMAKE_BUILD_TYPE=Debug
116106
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake
117107
-DNO_REALTIME_AUDIO=ON
118108
119109
- name: Build with tests
120-
run: cmake --build with_tests --config Release
110+
run: cmake --build with_tests --config Debug
111+
112+
- name: Start fonts server on MacOS
113+
if: matrix.os == 'macos-latest'
114+
run: sudo launchctl load -w /System/Library/LaunchAgents/com.apple.fontd.useragent.plist
121115

122-
- name: Test on Linux TODO test on MacOS
123-
if: matrix.os == 'ubuntu-24.04'
124-
run: cd with_tests; QT_QPA_PLATFORM=offscreen ctest --build-config Release --verbose
116+
- name: Test on Unix
117+
if: matrix.os != 'windows-latest'
118+
run: cd with_tests; QT_QPA_PLATFORM=offscreen ctest --build-config Debug --verbose
125119

126120
- name: Test on Windows
127121
if: matrix.os == 'windows-latest'
128-
run: cd with_tests; ctest --build-config Release --verbose
122+
run: cd with_tests; ctest --build-config Debug --verbose
129123

130124
- name: Run gcovr
131125
if: matrix.os == 'ubuntu-24.04'
132126
run: gcovr --xml "coverage.xml" --filter "$(pwd)/src/"
133127

134128
- name: Upload code coverage
135-
uses: codecov/codecov-action@v4.5.0
129+
uses: codecov/codecov-action@v4
136130
if: matrix.os == 'ubuntu-24.04'
137131
with:
138132
files: ./coverage.xml
@@ -166,7 +160,6 @@ jobs:
166160
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake
167161
-DCPACK_GENERATOR=ZIP
168162
-DCPACK_PACKAGE_FILE_NAME=Justly-Windows
169-
-DCMAKE_VERBOSE_MAKEFILE=ON
170163
171164
- name: Build without tests
172165
run: cmake --build without_tests --config Release
@@ -176,9 +169,8 @@ jobs:
176169

177170
- name: Release on a new tag
178171
if: startsWith(github.ref, 'refs/tags/')
179-
uses: softprops/action-gh-release@v2.0.6
172+
uses: softprops/action-gh-release@v2
180173
with:
181174
files: |
182175
**/Justly-*.tar.gz
183176
**/Justly-*.zip
184-

CMakeLists.txt

Lines changed: 32 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@ find_package(Qt6Widgets REQUIRED)
2727

2828
qt_standard_project_setup()
2929

30+
function(qt_deploy executable_name)
31+
if (WIN32)
32+
qt_generate_deploy_app_script(TARGET ${executable_name}
33+
OUTPUT_SCRIPT script_file
34+
)
35+
install(SCRIPT ${script_file})
36+
endif()
37+
endfunction()
38+
39+
function(install_executable executable_name)
40+
install(TARGETS ${executable_name})
41+
qt_deploy(${executable_name})
42+
if (LINUX)
43+
set_target_properties(${executable_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
44+
endif()
45+
if (APPLE)
46+
set_target_properties(${executable_name} PROPERTIES INSTALL_RPATH "@loader_path/../lib")
47+
endif()
48+
endfunction()
49+
3050
if (INCLUDE_WHAT_YOU_USE)
3151
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE
3252
include-what-you-use
@@ -38,57 +58,45 @@ endif()
3858
if (MSVC)
3959
add_compile_options(/W4)
4060
else()
41-
add_compile_options(-Wall -Wextra -Wpedantic)
61+
add_compile_options(-Wall -Wextra -Wpedantic $<$<CONFIG:Debug>:-Og>)
4262
endif()
4363

4464
if (TRACK_COVERAGE)
45-
add_compile_options(-Og)
4665
add_compile_options(--coverage)
4766
add_link_options(--coverage)
4867
endif()
4968

5069
qt_add_library(JustlyLibrary SHARED)
5170

52-
# disable assertions for release
5371
target_compile_features(JustlyLibrary PRIVATE cxx_std_20)
54-
add_compile_definitions(JustlyLibrary PUBLIC $<$<CONFIG:Release>:QT_NO_DEBUG=1>)
72+
target_link_libraries(JustlyLibrary PUBLIC Qt6::Core)
73+
target_link_libraries(JustlyLibrary PRIVATE
74+
FluidSynth::libfluidsynth
75+
nlohmann_json::nlohmann_json
76+
nlohmann_json_schema_validator::validator
77+
Qt6::Gui
78+
Qt6::Widgets
79+
)
5580

81+
add_compile_definitions(JustlyLibrary PUBLIC $<$<CONFIG:Release>:QT_NO_DEBUG=1>)
82+
target_compile_definitions(JustlyLibrary PRIVATE JUSTLY_LIBRARY)
5683
if (NO_REALTIME_AUDIO)
5784
target_compile_definitions(JustlyLibrary PRIVATE NO_REALTIME_AUDIO)
5885
endif()
5986

6087
add_subdirectory(include)
61-
62-
target_sources(JustlyLibrary PRIVATE "src/justly.cpp")
63-
64-
target_include_directories(JustlyLibrary PRIVATE src)
65-
66-
# add source dir for build but not install interface
6788
target_include_directories(JustlyLibrary PUBLIC
6889
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
6990
$<INSTALL_INTERFACE:include>
7091
)
7192

72-
target_link_libraries(JustlyLibrary PUBLIC Qt6::Core)
73-
74-
target_link_libraries(JustlyLibrary PRIVATE
75-
FluidSynth::libfluidsynth
76-
nlohmann_json::nlohmann_json
77-
nlohmann_json_schema_validator::validator
78-
Qt6::Gui
79-
Qt6::Widgets
80-
)
81-
82-
# for dllexport instead of dllimport
83-
target_compile_definitions(JustlyLibrary PRIVATE JUSTLY_LIBRARY)
93+
target_sources(JustlyLibrary PRIVATE "src/justly.cpp")
8494

8595
install(TARGETS JustlyLibrary
8696
RUNTIME_DEPENDENCY_SET runtime_dependencies
8797
FILE_SET justly_public_headers
8898
)
89-
9099
if (WIN32)
91-
# on other platforms, these should be system libraries
92100
install(RUNTIME_DEPENDENCY_SET runtime_dependencies
93101
PRE_INCLUDE_REGEXES
94102
glib
@@ -106,43 +114,18 @@ if (WIN32)
106114
vorbisenc
107115
PRE_EXCLUDE_REGEXES .
108116
DIRECTORIES
109-
# vcpkg libraries
110117
${_VCPKG_INSTALLED_DIR}/{VCPKG_TARGET_TRIPLET}/lib
111118
)
112-
# not getting picked up as a runtime dependency?
113119
find_package(FLAC REQUIRED)
114120
install(FILES $<TARGET_FILE:FLAC::FLAC> TYPE BIN)
115121
endif()
116-
117-
function(qt_deploy executable_name)
118-
if (WIN32)
119-
qt_generate_deploy_app_script(TARGET ${executable_name}
120-
OUTPUT_SCRIPT script_file
121-
)
122-
install(SCRIPT ${script_file})
123-
endif()
124-
endfunction()
125-
126122
qt_deploy(JustlyLibrary)
127123
install(DIRECTORY ${Justly_SOURCE_DIR}/share/ TYPE DATA)
128124

129-
function(install_executable executable_name)
130-
install(TARGETS ${executable_name})
131-
132-
qt_deploy(${executable_name})
133-
if (LINUX)
134-
set_target_properties(${executable_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
135-
endif()
136-
if (APPLE)
137-
set_target_properties(${executable_name} PROPERTIES INSTALL_RPATH "@loader_path/../lib")
138-
endif()
139-
endfunction()
140-
141125
qt_add_executable(Justly)
142126
target_sources(Justly PRIVATE bin/main.cpp)
143127
target_link_libraries(Justly PRIVATE JustlyLibrary Qt6::Core Qt6::Widgets)
144128
if (WIN32)
145-
# suppress console window
146129
set_target_properties(Justly PROPERTIES WIN32_EXECUTABLE ON)
147130
endif()
148131
install_executable(Justly)
@@ -151,7 +134,6 @@ if (BUILD_TESTS)
151134
qt_add_executable(JustlyTests)
152135
target_sources(JustlyTests PRIVATE tests/test.cpp)
153136
target_include_directories(JustlyTests PRIVATE ${Justly_SOURCE_DIR})
154-
155137
target_link_libraries(JustlyTests PRIVATE
156138
JustlyLibrary
157139
Qt6::Core
@@ -160,17 +142,13 @@ if (BUILD_TESTS)
160142
Qt6::Widgets
161143
)
162144
install_executable(JustlyTests)
163-
164145
set(test_install_folder ${Justly_SOURCE_DIR}/test_install)
165-
166146
add_custom_target(install_tests ALL
167147
COMMAND cmake --install ${CMAKE_CURRENT_BINARY_DIR}
168148
--prefix ${test_install_folder}
169149
--config $<CONFIG>
170150
)
171151
add_dependencies(install_tests JustlyLibrary Justly JustlyTests)
172-
173-
# test the installed app
174152
add_test(NAME run_tests COMMAND ${test_install_folder}/bin/JustlyTests)
175153
endif()
176154

src/justly.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3382,9 +3382,9 @@ void set_up() {
33823382
auto icon_file = QDir(QCoreApplication::applicationDirPath())
33833383
.filePath("../share/Justly.svg");
33843384
Q_ASSERT(QFile::exists(icon_file));
3385-
QIcon icon(icon_file);
3386-
if (!icon.isNull()) {
3387-
QApplication::setWindowIcon(icon);
3385+
QPixmap pixmap(icon_file);
3386+
if (!pixmap.isNull()) {
3387+
QApplication::setWindowIcon(QIcon(pixmap));
33883388
}
33893389

33903390
QMetaType::registerConverter<Rational, QString>([](const Rational &rational) {

0 commit comments

Comments
 (0)