-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
159 lines (141 loc) · 4.85 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
cmake_minimum_required(VERSION 3.5)
set(PROJECT_NAME "Ghazal")
project(${PROJECT_NAME} LANGUAGES C CXX)
if(UNIX AND NOT APPLE)
set(OUTPUT_FILE_NAME "ghazal")
else()
set(OUTPUT_FILE_NAME "Ghazal")
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt5 QUIET COMPONENTS Core)
if(QT_FOUND)
set(QT_VERSION_MAJOR 5)
else()
find_package(QT NAMES Qt6 QUIET COMPONENTS Core)
if(QT_FOUND)
set(QT_VERSION_MAJOR 6)
else()
set(QT_VERSION_MAJOR 5) # If neither 5 nor 6 are found, we default to 5. The setup will fail further down.
endif()
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
if(QT_VERSION_MAJOR EQUAL 5)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Sql Concurrent Xml Network)
if(UNIX AND NOT APPLE)
set(QUAZIP_LIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/unix/quazip/libquazip1-qt5.so")
set(ZLIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/unix/quazip/libz.so")
elseif(WIN32)
set(QUAZIP_LIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/win/quazip/libquazip1-qt5.dll")
set(ZLIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/win/quazip/zlib1.dll")
elseif(APPLE)
set(QUAZIP_LIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/mac/quazip/libquazip1-qt5.dylib")
set(ZLIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/mac/quazip/libz.dylib")
endif()
set(GHAZAL_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Sql Qt5::Concurrent Qt5::Xml Qt5::Network ${QUAZIP_LIB})
elseif(QT_VERSION_MAJOR EQUAL 6)
find_package(Qt6 REQUIRED COMPONENTS Core Core5Compat Gui Widgets Sql Concurrent Xml Network)
if(UNIX AND NOT APPLE)
set(QUAZIP_LIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/unix/quazip/libquazip1-qt6.so")
set(ZLIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/unix/quazip/libz.so")
elseif(WIN32)
set(QUAZIP_LIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/win/quazip/libquazip1-qt6.dll")
set(ZLIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/win/quazip/zlib1.dll")
elseif(APPLE)
set(QUAZIP_LIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/mac/quazip/libquazip1-qt6.dylib")
set(ZLIB "${CMAKE_CURRENT_SOURCE_DIR}/libraries/mac/quazip/libz.dylib")
endif()
set(GHAZAL_LIBRARIES Qt6::Core Qt6::Core5Compat Qt6::Gui Qt6::Widgets Qt6::Sql Qt6::Concurrent Qt6::Xml Qt6::Network ${QUAZIP_LIB})
endif()
set(HEADERS
src/abjad_class.h
src/abjadform.h
src/abjadformmini.h
src/aboutauthorform.h
src/aboutform.h
src/appthemes.h
src/common_functions.h
src/databaseform.h
src/date_converter.h
src/downloadform.h
src/event_functions.h
src/filedownloader.h
src/mainwindow.h
src/searchexamplesform.h
src/searchform.h
src/settingsform.h
src/tabform.h
src/updatecheckform.h
src/version.h
src/wordsearchform.h
src/worker.h
)
set(SOURCES
src/abjad_class.cpp
src/abjadform.cpp
src/abjadformmini.cpp
src/aboutauthorform.cpp
src/aboutform.cpp
src/appthemes.cpp
src/common_functions.cpp
src/common_search.cpp
src/databaseform.cpp
src/date_converter.c
src/downloadform.cpp
src/event_functions.cpp
src/filedownloader.cpp
src/main.cpp
src/mainwindow.cpp
src/mainwindow_action_menu.cpp
src/mainwindow_app_setting.cpp
src/mainwindow_search_form.cpp
src/searchexamplesform.cpp
src/searchform.cpp
src/settingsform.cpp
src/tabform.cpp
src/tabform_context_menu.cpp
src/updatecheckform.cpp
src/wordsearchform.cpp
src/worker.cpp
)
set(FORMS
src/abjadform.ui
src/abjadformmini.ui
src/aboutauthorform.ui
src/aboutform.ui
src/databaseform.ui
src/downloadform.ui
src/mainwindow.ui
src/searchexamplesform.ui
src/searchform.ui
src/settingsform.ui
src/tabform.ui
src/updatecheckform.ui
src/wordsearchform.ui
)
set(RESOURCES
resources/themes/darkstyle.qrc
resources/resource.qrc
)
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Release")
enable_language(RC)
set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/resources/resource_win.rc")
add_executable(${PROJECT_NAME} WIN32 ${HEADERS} ${SOURCES} ${FORMS} ${RESOURCES} ${APP_ICON_RESOURCE_WINDOWS})
else()
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES} ${FORMS} ${RESOURCES})
endif()
#include_directories("${CMAKE_CURRENT_SOURCE_DIR}/libraries/include")
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/libraries/include")
target_link_libraries(${PROJECT_NAME} ${GHAZAL_LIBRARIES})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${OUTPUT_FILE_NAME})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${QUAZIP_LIB}
${ZLIB}
"${CMAKE_BINARY_DIR}")