forked from NJUPT-SAST-Cpp/sast-music
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
126 lines (101 loc) · 3.34 KB
/
CMakeLists.txt
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
124
125
126
cmake_minimum_required(VERSION 3.16)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake/)
include(GetGitRevisionDescription)
project(sast_music VERSION 0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
else()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
endif()
find_package(Qt6 6.5 REQUIRED COMPONENTS Quick Multimedia)
add_subdirectory(libs/mbedtls)
qt_standard_project_setup(REQUIRES 6.5)
set(CMAKE_AUTORCC ON)
set(FLUENTUI_BUILD_EXAMPLES OFF)
if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND LINUX)
set(FLUENTUI_QML_PLUGIN_DIRECTORY /usr/lib/qt6/qml/FluentUI)
endif()
add_subdirectory(libs/FluentUI)
file(GLOB_RECURSE SOURCE_FILES
${CMAKE_SOURCE_DIR}/src/*.cpp
${CMAKE_SOURCE_DIR}/src/*.h
${CMAKE_SOURCE_DIR}/src/*.hpp
)
file(GLOB_RECURSE SOURCE_IMPORT_PATHS
${CMAKE_SOURCE_DIR}/src/Service/NeteaseCloudMusic/*.h
${CMAKE_SOURCE_DIR}/src/Service/NeteaseCloudMusic/*.cpp
${CMAKE_SOURCE_DIR}/src/ViewModel/*.h
${CMAKE_SOURCE_DIR}/src/ViewModel/*.cpp
)
foreach(filepath ${SOURCE_IMPORT_PATHS})
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" filename ${filepath})
list(APPEND SOURCE_IMPORT_FILES ${filename})
endforeach(filepath)
set(VERSION_RC_PATH "")
set(WIN32_MANIFEST_PATH "")
if(WIN32)
set(VERSION_RC_PATH ${CMAKE_SOURCE_DIR}/SAST_Evento.rc)
configure_file(
${CMAKE_SOURCE_DIR}/.cmake/version_exe.rc.in
${VERSION_RC_PATH}
)
configure_file(
${CMAKE_SOURCE_DIR}/.cmake/InstallerScript.iss.in
${CMAKE_SOURCE_DIR}/action-cli/InstallerScript.iss
)
set(WIN32_MANIFEST_PATH ${CMAKE_SOURCE_DIR}/app.manifest)
endif()
if(APPLE)
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${IDENTIFIER})
set(MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME})
set(MACOSX_BUNDLE_COPYRIGHT ${COPYRIGHT})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${spectral_VERSION})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${spectral_VERSION})
set(ICON_NAME "app.icns")
set(${PROJECT_NAME}_MAC_ICON "${CMAKE_SOURCE_DIR}/${ICON_NAME}")
set(MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
set_property(SOURCE "${${PROJECT_NAME}_MAC_ICON}" PROPERTY
MACOSX_PACKAGE_LOCATION Resources)
endif()
qt_add_executable(sast_music MACOSX_BUNDLE
${${PROJECT_NAME}_MAC_ICON}
${SOURCE_FILES}
${VERSION_RC_PATH}
${WIN32_MANIFEST_PATH}
${SOURCE_FILES}
)
qt_add_qml_module(sast_music
URI sast_music
VERSION 1.0
SOURCES ${SOURCE_IMPORT_FILES}
RESOURCES res.qrc
RESOURCES qml.qrc
)
target_include_directories(sast_music
PRIVATE
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/ViewModel
)
set_target_properties(sast_music PROPERTIES
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/.cmake/Info.plist.in"
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
target_link_libraries(sast_music
PRIVATE
Qt6::Quick
Qt6::Multimedia
MbedTLS::mbedcrypto
)
include(GNUInstallDirs)
install(TARGETS sast_music
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)