-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
151 lines (133 loc) · 4.17 KB
/
CMakeLists.txt
File metadata and controls
151 lines (133 loc) · 4.17 KB
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
cmake_minimum_required(VERSION 3.16)
project(LuaPatcher VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# Option for static build
option(BUILD_STATIC "Build with static Qt libraries" OFF)
# Server access token - passed via macro during compilation
if(DEFINED ENV{SERVER_ACCESS_TOKEN})
set(ACCESS_TOKEN "$ENV{SERVER_ACCESS_TOKEN}" CACHE STRING "Access token for the server" FORCE)
else()
set(ACCESS_TOKEN "dev-token-replace-in-prod" CACHE STRING "Access token for the server")
endif()
add_definitions(-DSERVER_ACCESS_TOKEN="${ACCESS_TOKEN}")
# Find Qt6 - Core components + optional Svg
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Network)
find_package(Qt6 QUIET COMPONENTS Svg)
# Application icon resource (optional)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/app.rc")
set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/app.rc")
else()
set(APP_ICON_RESOURCE_WINDOWS "")
endif()
# Copy logo.ico to the build directory so it can be found at runtime
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/logo.ico" "${CMAKE_BINARY_DIR}/logo.ico" COPYONLY)
# Source files
set(SOURCES
src/main.cpp
src/mainwindow.cpp
src/glassbutton.cpp
src/gamecard.cpp
src/gamedetailspage.cpp
src/addfrienddialog.cpp
src/loadingspinner.cpp
src/workers/indexdownloadworker.cpp
src/workers/luadownloadworker.cpp
src/workers/generatorworker.cpp
src/workers/restartworker.cpp
src/utils/paths.cpp
src/utils/colors.cpp
src/terminaldialog.cpp
src/onboardingdialog.cpp
src/customtitlebar.cpp
src/socialpage.cpp
src/profilecard.cpp
src/notificationdialog.cpp
)
set(HEADERS
src/mainwindow.h
src/glassbutton.h
src/gamecard.h
src/gamedetailspage.h
src/loadingspinner.h
src/workers/indexdownloadworker.h
src/workers/luadownloadworker.h
src/workers/generatorworker.h
src/workers/restartworker.h
src/utils/paths.h
src/utils/colors.h
src/config.h
src/terminaldialog.h
src/onboardingdialog.h
src/customtitlebar.h
src/socialpage.h
src/profilecard.h
src/notificationdialog.h
)
# Add static plugin initialization for static builds
if(BUILD_STATIC)
list(APPEND SOURCES src/static_plugins.cpp)
endif()
# Create executable
if(WIN32 AND APP_ICON_RESOURCE_WINDOWS)
# Compile icon resource separately to avoid autogen include issues
add_library(AppIcon OBJECT "${APP_ICON_RESOURCE_WINDOWS}")
set_target_properties(AppIcon PROPERTIES
AUTOMOC OFF
AUTOUIC OFF
AUTORCC OFF
)
add_executable(LuaPatcher WIN32 ${SOURCES} ${HEADERS} $<TARGET_OBJECTS:AppIcon>)
else()
add_executable(LuaPatcher ${SOURCES} ${HEADERS})
endif()
# Link Qt libraries
target_link_libraries(LuaPatcher PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Widgets
Qt6::Network
dwmapi
)
# Optionally link Qt6Svg if available
if(TARGET Qt6::Svg)
target_link_libraries(LuaPatcher PRIVATE Qt6::Svg)
target_compile_definitions(LuaPatcher PRIVATE HAS_QT_SVG=1)
message(STATUS "Qt6Svg found - using SVG icon engine")
else()
message(STATUS "Qt6Svg NOT found - using fallback QPainterPath icons")
endif()
# Static build configuration
if(BUILD_STATIC)
# Link static Qt plugins (only core plugins available in qtbase)
target_link_libraries(LuaPatcher PRIVATE
Qt6::QWindowsIntegrationPlugin
Qt6::QGifPlugin
Qt6::QJpegPlugin
Qt6::QICOPlugin
Qt6::QWindowsVistaStylePlugin
)
# Windows static linking flags for MSVC
if(MSVC)
set_property(TARGET LuaPatcher PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded")
endif()
# Windows static linking flags for MinGW
if(MINGW)
target_link_options(LuaPatcher PRIVATE -static -static-libgcc -static-libstdc++)
endif()
# Define static build macro
target_compile_definitions(LuaPatcher PRIVATE QT_STATIC_BUILD)
endif()
# Windows-specific settings
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Release")
set_target_properties(LuaPatcher PROPERTIES
WIN32_EXECUTABLE TRUE
)
endif()
# Install
install(TARGETS LuaPatcher
RUNTIME DESTINATION bin
)