source: trunk/qt/CMakeLists.txt @ 14621

Last change on this file since 14621 was 14621, checked in by mikedld, 7 years ago

Refactor DBus IPC to allow for further extensibility

File size: 4.8 KB
Line 
1project(trqt)
2
3if(USE_QT5)
4    macro(tr_qt_wrap_ui)
5        qt5_wrap_ui(${ARGN})
6    endmacro()
7    macro(tr_qt_add_resources)
8        qt5_add_resources(${ARGN})
9    endmacro()
10    macro(tr_qt_add_translation)
11        qt5_add_translation(${ARGN})
12    endmacro()
13else()
14    include(${QT_USE_FILE})
15
16    macro(tr_qt_wrap_ui)
17        qt4_wrap_ui(${ARGN})
18    endmacro()
19    macro(tr_qt_add_resources)
20        qt4_add_resources(${ARGN})
21    endmacro()
22    macro(tr_qt_add_translation)
23        qt4_add_translation(${ARGN})
24    endmacro()
25endif()
26
27set(${PROJECT_NAME}_SOURCES
28    AboutDialog.cc
29    AddData.cc
30    Application.cc
31    ColumnResizer.cc
32    DBusInteropHelper.cc
33    DetailsDialog.cc
34    FaviconCache.cc
35    FileTreeDelegate.cc
36    FileTreeItem.cc
37    FileTreeModel.cc
38    FileTreeView.cc
39    FilterBar.cc
40    FilterBarComboBox.cc
41    FilterBarComboBoxDelegate.cc
42    FilterBarLineEdit.cc
43    Filters.cc
44    Formatter.cc
45    FreeSpaceLabel.cc
46    IconToolButton.cc
47    InteropObject.cc
48    LicenseDialog.cc
49    MainWindow.cc
50    MakeDialog.cc
51    OptionsDialog.cc
52    PathButton.cc
53    Prefs.cc
54    PrefsDialog.cc
55    RelocateDialog.cc
56    RpcClient.cc
57    Session.cc
58    SessionDialog.cc
59    SqueezeLabel.cc
60    StatsDialog.cc
61    Torrent.cc
62    TorrentDelegate.cc
63    TorrentDelegateMin.cc
64    TorrentFilter.cc
65    TorrentModel.cc
66    TorrentView.cc
67    TrackerDelegate.cc
68    TrackerModel.cc
69    TrackerModelFilter.cc
70    Utils.cc
71    WatchDir.cc
72)
73
74set(${PROJECT_NAME}_HEADERS
75    AboutDialog.h
76    AddData.h
77    Application.h
78    BaseDialog.h
79    ColumnResizer.h
80    CustomVariantType.h
81    DBusInteropHelper.h
82    DetailsDialog.h
83    FaviconCache.h
84    FileTreeDelegate.h
85    FileTreeItem.h
86    FileTreeModel.h
87    FileTreeView.h
88    FilterBar.h
89    FilterBarComboBox.h
90    FilterBarComboBoxDelegate.h
91    FilterBarLineEdit.h
92    Filters.h
93    Formatter.h
94    FreeSpaceLabel.h
95    IconToolButton.h
96    InteropObject.h
97    LicenseDialog.h
98    MainWindow.h
99    MakeDialog.h
100    OptionsDialog.h
101    PathButton.h
102    Prefs.h
103    PrefsDialog.h
104    RelocateDialog.h
105    RpcClient.h
106    Session.h
107    SessionDialog.h
108    Speed.h
109    SqueezeLabel.h
110    StatsDialog.h
111    Torrent.h
112    TorrentDelegate.h
113    TorrentDelegateMin.h
114    TorrentFilter.h
115    TorrentModel.h
116    TorrentView.h
117    TrackerDelegate.h
118    TrackerModel.h
119    TrackerModelFilter.h
120    Utils.h
121    WatchDir.h
122)
123
124tr_qt_wrap_ui(${PROJECT_NAME}_UI_SOURCES
125    AboutDialog.ui
126    DetailsDialog.ui
127    LicenseDialog.ui
128    MainWindow.ui
129    MakeDialog.ui
130    MakeProgressDialog.ui
131    OptionsDialog.ui
132    PrefsDialog.ui
133    RelocateDialog.ui
134    SessionDialog.ui
135    StatsDialog.ui
136)
137
138set(${PROJECT_NAME}_QRC_FILES application.qrc)
139if(WIN32 OR APPLE)
140    list(APPEND ${PROJECT_NAME}_QRC_FILES icons/Faenza/Faenza.qrc)
141endif()
142
143tr_qt_add_resources(${PROJECT_NAME}_QRC_SOURCES ${${PROJECT_NAME}_QRC_FILES})
144
145set(${PROJECT_NAME}_LINGUAS
146    de
147    en
148    es
149    eu
150    fr
151    hu
152    id
153    it_IT
154    kk
155    ko
156    lt
157    pl_PL
158    pt_BR
159    ru
160    uk
161    zh_CN
162)
163
164if(ENABLE_NLS)
165    set(${PROJECT_NAME}_ENABLED_LINGUAS ${${PROJECT_NAME}_LINGUAS})
166else()
167    set(${PROJECT_NAME}_ENABLED_LINGUAS)
168endif()
169
170set(${PROJECT_NAME}_TS_FILES)
171foreach(LANG ${${PROJECT_NAME}_ENABLED_LINGUAS})
172    list(APPEND ${PROJECT_NAME}_TS_FILES translations/transmission_${LANG}.ts)
173endforeach()
174
175if(${PROJECT_NAME}_TS_FILES)
176    tr_qt_add_translation(${PROJECT_NAME}_QM_FILES ${${PROJECT_NAME}_TS_FILES})
177endif()
178
179include_directories(
180    ${CMAKE_SOURCE_DIR}
181    ${PROJECT_SOURCE_DIR}
182    ${PROJECT_BINARY_DIR}
183    ${CURL_INCLUDE_DIRS}
184    ${EVENT2_INCLUDE_DIRS}
185)
186
187add_definitions(
188    "-DTRANSLATIONS_DIR=\"${CMAKE_INSTALL_FULL_DATADIR}/${TR_NAME}/translations\""
189    -DQT_NO_CAST_FROM_ASCII
190)
191
192tr_win32_app_info(${PROJECT_NAME}_WIN32_RC_FILE
193    "Transmission Qt Client"
194    "transmission-qt"
195    "transmission-qt.exe"
196    "qtr.ico")
197
198add_executable(${TR_NAME}-qt WIN32
199    ${${PROJECT_NAME}_SOURCES}
200    ${${PROJECT_NAME}_UI_SOURCES}
201    ${${PROJECT_NAME}_QRC_SOURCES}
202    ${${PROJECT_NAME}_HEADERS}
203    ${${PROJECT_NAME}_QM_FILES}
204    ${${PROJECT_NAME}_WIN32_RC_FILE}
205)
206
207target_link_libraries(${TR_NAME}-qt
208    ${TR_NAME}
209    ${QT_LIBRARIES}
210    ${CURL_LIBRARIES}
211    ${EVENT2_LIBRARIES}
212)
213
214if(MSVC)
215    tr_append_target_property(${TR_NAME}-qt LINK_FLAGS "/ENTRY:mainCRTStartup")
216endif()
217
218if(USE_QT5)
219    qt5_use_modules(${TR_NAME}-qt ${TR_QT5_MODULES})
220endif()
221
222set_target_properties(${TR_NAME}-qt PROPERTIES AUTOMOC TRUE)
223
224install(TARGETS ${TR_NAME}-qt DESTINATION ${CMAKE_INSTALL_BINDIR})
225
226if(INSTALL_DOC)
227    install(FILES ${TR_NAME}-qt.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
228endif()
229
230install(FILES transmission-qt.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
231
232if(ENABLE_NLS)
233    install(FILES ${${PROJECT_NAME}_QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/${TR_NAME}/translations)
234endif()
Note: See TracBrowser for help on using the repository browser.