-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
122 lines (93 loc) · 3.18 KB
/
CMakeLists.txt
File metadata and controls
122 lines (93 loc) · 3.18 KB
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
cmake_minimum_required(VERSION 3.24)
# on windows, add a path to Qt
list(APPEND CMAKE_PREFIX_PATH C:/Users/brand/6.5.1/msvc2019_64)
project(Justly VERSION 0.8.1 LANGUAGES CXX)
# download https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General.sf2
# and put it into the share folder
# too big to commit to git
include(CTest)
include(InstallRequiredSystemLibraries)
option(BUILD_TESTS "Build tests" OFF)
option(NO_REALTIME_AUDIO "Do not start realtime audio" OFF)
option(INCLUDE_WHAT_YOU_USE "Run include-what-you-use" OFF)
option(TRACK_COVERAGE "Track coverage" OFF)
find_package(FluidSynth REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(Qt6Core REQUIRED)
find_package(Qt6Gui REQUIRED)
find_package(Qt6Svg REQUIRED)
find_package(Qt6Test REQUIRED)
find_package(Qt6Widgets REQUIRED)
qt_standard_project_setup()
if (INCLUDE_WHAT_YOU_USE)
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE
include-what-you-use
-Xiwyu
--mapping_file=${Justly_SOURCE_DIR}/map.imp
)
endif()
if (MSVC)
add_compile_options("/W4")
else()
add_compile_options("-Wall" "-Wextra" "-Wpedantic" "$<$<CONFIG:Debug>:-Og>")
endif()
if (TRACK_COVERAGE)
add_compile_options("--coverage")
add_link_options("--coverage")
endif()
qt_add_library(JustlyLibrary INTERFACE)
qt_add_executable(Justly)
if (BUILD_TESTS)
qt_add_executable(JustlyTests)
endif()
add_subdirectory("library")
add_subdirectory("executable")
install(TARGETS Justly)
if (WIN32)
set(MAYBE_D "$<$<CONFIG:Debug>:d>")
set(VCPKG_BIN_FOLDER "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin")
install(FILES
"${VCPKG_BIN_FOLDER}/glib-2.0-0.dll"
"${VCPKG_BIN_FOLDER}/iconv-2.dll"
"${VCPKG_BIN_FOLDER}/intl-8.dll"
"$<TARGET_FILE:FluidSynth::libfluidsynth>"
"$<TARGET_FILE:LibXml2::LibXml2>"
"${VCPKG_BIN_FOLDER}/pcre2-16${MAYBE_D}.dll"
"${VCPKG_BIN_FOLDER}/pcre2-8${MAYBE_D}.dll"
"$<TARGET_FILE:Qt6::Core>"
"$<TARGET_FILE:Qt6::Gui>"
"$<TARGET_FILE:Qt6::Svg>"
"$<TARGET_FILE:Qt6::Test>"
"$<TARGET_FILE:Qt6::Widgets>"
"${VCPKG_BIN_FOLDER}/zlib${MAYBE_D}1.dll"
TYPE BIN
)
install(FILES "share/qt.conf" TYPE BIN)
install(FILES
"$<TARGET_FILE:Qt6::QSvgPlugin>"
DESTINATION "plugins/imageformats"
)
install(FILES
"$<TARGET_FILE:Qt6::QWindowsIntegrationPlugin>"
DESTINATION "plugins/platforms"
)
install(FILES
"$<TARGET_FILE:Qt6::QWindowsVistaStylePlugin>"
DESTINATION "plugins/styles"
)
endif()
install(DIRECTORY "${Justly_SOURCE_DIR}/share/" TYPE DATA)
if (BUILD_TESTS)
add_subdirectory("tests")
install(TARGETS JustlyTests)
install(DIRECTORY "${Justly_SOURCE_DIR}/tests/share/" TYPE DATA)
set(test_install_folder "${Justly_SOURCE_DIR}/test_install")
add_custom_target(install_tests ALL
COMMAND cmake --install ${CMAKE_CURRENT_BINARY_DIR}
--prefix ${test_install_folder}
--config $<CONFIG>
)
add_dependencies(install_tests JustlyLibrary Justly JustlyTests)
add_test(NAME run_tests COMMAND "${test_install_folder}/bin/JustlyTests")
endif()
include(CPack)