-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
122 lines (102 loc) · 2.83 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
cmake_minimum_required(VERSION 3.5)
if (APPLE)
set(APP_EXE TinyImageFinder)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15.0)
set(APP_VERSION 1.0.0)
else()
set(APP_EXE image-finder)
set(APP_VERSION 0.1.2)
endif()
set(SUPPORTED_LANGUAGES CXX)
project(${APP_EXE} VERSION ${APP_VERSION} LANGUAGES ${SUPPORTED_LANGUAGES})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Concurrent Quick)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Concurrent Quick LinguistTools)
set(PROJECT_SOURCES
main.cpp
imagecache.cpp
imagecache.h
imagefinder.cpp
imagefinder.h
imagemodel.cpp
imagemodel.h
imageprovider.cpp
imageprovider.h
logging.cpp
logging.h
applicationcore.cpp
applicationcore.h
settings.cpp
settings.h
paths.cpp
paths.h
)
set(TS_FILES
i18n/image-finder_ru.ts
i18n/image-finder_nl.ts
)
set(ALL_RC "${CMAKE_CURRENT_SOURCE_DIR}/resources/resource.qrc")
if(WIN32)
set(WIN_RC "${CMAKE_CURRENT_SOURCE_DIR}/resources/win32_resource.rc")
endif()
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_lupdate(${APP_EXE} TS_FILES ${TS_FILES} SOURCES
${PROJECT_SOURCES}
qml/MainWindow.qml
qml/ImageView.qml
qml/SettingsView.qml
)
qt_add_executable(${APP_EXE}
MANUAL_FINALIZATION
${PROJECT_SOURCES}
${WIN_RC}
${ALL_RC}
)
else()
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
add_executable(${APP_EXE}
${PROJECT_SOURCES}
${WIN_RC}
${ALL_RC}
)
endif()
target_compile_definitions(${APP_EXE} PRIVATE
APP_VERSION="${APP_VERSION}"
)
if(APPLE)
find_library(
SSURL
libSecurityScopedURL.dylib
PATHS ../macos
)
endif()
target_link_libraries(${APP_EXE} PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Qml
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::Concurrent
${SSURL}
)
set_target_properties(${APP_EXE} PROPERTIES
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(${APP_EXE})
endif()
if(UNIX AND NOT APPLE)
set(APP_ID dev.levz.TinyImageFinder)
install(FILES package/${APP_ID}.desktop DESTINATION share/applications)
install(FILES package/${APP_ID}.metainfo.xml DESTINATION share/metainfo)
install(FILES package/app-info/icons/128x128/${APP_ID}.png DESTINATION share/icons/hicolor/128x128/apps)
install(DIRECTORY package/app-info DESTINATION share)
install(TARGETS ${APP_EXE}
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()