This repository has been archived by the owner on Apr 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
173 lines (153 loc) · 5.23 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
cmake_minimum_required(VERSION 3.10)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
if (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
set(QT_HOMEBREW_PATH /usr/local/opt/qt)
elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
set(QT_HOMEBREW_PATH /opt/homebrew/opt/qt)
else ()
set(QT_HOMEBREW_PATH "")
endif ()
find_package(Qt6Widgets QUIET PATHS ${QT_HOMEBREW_PATH})
if (Qt6Widgets_FOUND)
find_package(Qt6 COMPONENTS Core5Compat Network Widgets Xml Gui REQUIRED PATHS ${QT_HOMEBREW_PATH})
set(QUAZIP_QT_MAJOR_VERSION 6 CACHE STRING "")
else ()
find_package(Qt5Widgets REQUIRED PATHS ${QT_HOMEBREW_PATH})
find_package(Qt5 COMPONENTS Network Widgets Xml Gui REQUIRED PATHS ${QT_HOMEBREW_PATH})
set(QUAZIP_QT_MAJOR_VERSION 5 CACHE STRING "")
endif ()
set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(QUAZIP_INSTALL OFF CACHE BOOL "")
add_subdirectory(quazip)
add_executable(hecl-gui WIN32 MACOSX_BUNDLE
#ArgumentEditor.cpp
#ArgumentEditor.hpp
#ArgumentEditor.ui
Common.cpp
Common.hpp
#CVarDialog.cpp
#CVarDialog.hpp
#CVarDialog.ui
DownloadManager.cpp
DownloadManager.hpp
ErrorLabel.hpp
EscapeSequenceParser.cpp
EscapeSequenceParser.hpp
ExtractZip.cpp
ExtractZip.hpp
FileDirDialog.hpp
FindBlender.cpp
FindBlender.hpp
MainWindow.cpp
MainWindow.hpp
MainWindow.ui
LayerDialog.cpp
LayerDialog.hpp
LayerDialog.ui
SysReqTableView.cpp
SysReqTableView.hpp
main.cpp
${QUAZIP_SRCS}
)
target_compile_definitions(hecl-gui PRIVATE
# Disable implicit conversions from ASCII to QString.
-DQT_NO_CAST_FROM_ASCII
-DQT_NO_CAST_TO_ASCII
# Disable implicit conversions of QByteArray to const char* or const void*
-DQT_NO_CAST_FROM_BYTEARRAY
# Disable narrowing conversions in signal/slot connect() calls.
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
# Disable unsafe overloads of QProcess' start() function.
-DQT_NO_PROCESS_COMBINED_ARGUMENT_START
# Disable implicit QString->QUrl conversions to enforce use of proper resolving functions.
-DQT_NO_URL_CAST_FROM_STRING
# Allows for more efficient string concatenation, resulting in less temporaries.
-DQT_USE_QSTRINGBUILDER
)
if (Qt6Widgets_FOUND)
set(Qt_LIBS
Qt6::Core
Qt6::Core5Compat
Qt6::Gui
Qt6::Network
Qt6::Widgets
Qt6::Xml)
else ()
set(Qt_LIBS
Qt5::Core
Qt5::Gui
Qt5::Network
Qt5::Widgets
Qt5::Xml)
# Check for static linking
if (WIN32)
get_target_property(HECL_RUNTIME_LIBRARY hecl-gui MSVC_RUNTIME_LIBRARY)
if (NOT "${HECL_RUNTIME_LIBRARY}" MATCHES "DLL$")
list(APPEND Qt_LIBS Qt5::QWindowsIntegrationPlugin)
endif ()
endif ()
endif ()
target_link_libraries(hecl-gui PRIVATE
${Qt_LIBS}
hecl-light
zeus
QuaZip::QuaZip)
target_include_directories(hecl-gui PRIVATE quazip/quazip)
target_compile_definitions(hecl-gui PRIVATE QUAZIP_STATIC=1)
if (APPLE)
target_sources(hecl-gui PRIVATE
MacOSSystemVersion.hpp
MacOSSystemVersion.mm
)
set_source_files_properties(MacOSSystemVersion.mm
PROPERTIES COMPILE_FLAGS -fobjc-arc
)
find_library(FOUNDATION_LIBRARY Foundation)
target_link_libraries(hecl-gui PRIVATE ${FOUNDATION_LIBRARY})
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
target_link_libraries(hecl-gui PRIVATE
dl
pthread
)
endif ()
if (WIN32)
target_sources(hecl-gui PRIVATE
platforms/win/hecl-gui.manifest
platforms/win/hecl-gui.rc
)
target_link_libraries(hecl-gui PRIVATE
Version)
elseif (APPLE)
set_target_properties(hecl-gui PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist"
)
target_sources(hecl-gui PRIVATE platforms/mac/mainicon.icns)
set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
add_custom_command(
TARGET hecl-gui POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:urde> $<TARGET_FILE_DIR:hecl-gui>
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:hecl> $<TARGET_FILE_DIR:hecl-gui>
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:visigen> $<TARGET_FILE_DIR:hecl-gui>
DEPENDS urde hecl visigen
)
if (NOT "${SENTRY_DSN}" STREQUAL "")
add_custom_command(
TARGET hecl-gui POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:crashpad_handler> $<TARGET_FILE_DIR:hecl-gui>
DEPENDS crashpad_handler
)
endif()
endif ()
add_subdirectory(platforms/freedesktop)
declare_qticon_target()
target_sources(hecl-gui PRIVATE mainicon_qt.cpp)
if (COMMAND add_sanitizers)
add_sanitizers(hecl-gui)
endif ()
if (NOT MSVC)
target_compile_options(hecl-gui PRIVATE -Wno-misleading-indentation)
endif ()