This repository has been archived by the owner on Dec 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmdu_linux.pro
195 lines (166 loc) · 5.02 KB
/
mdu_linux.pro
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# Basic configuration
TARGET = mdu
TEMPLATE = app
VERSION = 2024.12.15
# Print out the detected LibTorch path (useful for debugging)
message("Using LibTorch from: $$PYTORCH_DIR")
# Qt configuration
QT += core gui quick quickcontrols2 gui-private quickwidgets widgets concurrent
CONFIG += c++17 skip_target_version_ext
CONFIG -= debug_and_release debug_and_release_target
# Define version
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
# Dynamically find and link .lib files for Windows
win32 {
# Find all .lib files in the library directory
PYTORCH_LIBS = $$files($$PYTORCH_DIR/lib/*.lib)
# Add all found .lib files to LIBS
LIBS += $$PYTORCH_LIBS
# Print out the libraries being linked
!isEmpty(PYTORCH_LIBS) {
message("Linking PyTorch libraries:")
for(lib, PYTORCH_LIBS) {
message($$lib)
}
}
}
# Fallback library linking
isEmpty(PYTORCH_LIBS) {
LIBS += \
-ltorch \
-lc10 \
-lprotobuf-lite
}
# Compiler flags for LibTorch
QMAKE_CXXFLAGS += \
-D_GLIBCXX_USE_CXX11_ABI=1 \
# Source files
SOURCES += \
src/core/stemextractor/stemextractor.cpp \
src/core/ytdlphelper.cpp \
src/gui/aboutqt.cpp \
src/gui/windowcontroller.cpp \
src/main.cpp \
src/gui/mainwindow.cpp \
src/gui/framelesshelper.cpp \
src/gui/winnativeeventfilter.cpp \
src/core/downloadmanager.cpp \
src/utils/devicesmanager.cpp
# Header files
HEADERS += \
src/core/downloadmanager.hpp \
src/core/stemextractor/stemextractor.hpp \
src/core/ytdlphelper.hpp \
src/gui/aboutqt.hpp \
src/gui/mainwindow.hpp \
src/gui/framelesshelper.hpp \
src/gui/windowcontroller.hpp \
src/gui/winnativeeventfilter.hpp \
src/utils/devicesmanager.hpp
# Resources
RESOURCES += resources/shared.qrc
# Include paths
INCLUDEPATH += \
src \
src/gui \
src/core
# Windows specific configuration
win32 {
# Windows libraries
LIBS += \
-luser32 \
-ldwmapi \
-lshcore \
-ld2d1 \
-luxtheme \
-lgdi32 \
-lshell32 \
-ldxgi \
-ld3d11
# Windows version definitions
DEFINES += \
WINVER=0x0601 \
_WIN32_WINNT=0x0601 \
_CRT_SECURE_NO_WARNINGS
# Icon
RC_ICONS = resources/icons/ap2.ico
}
# Compiler settings
msvc {
# MSVC specific flags
QMAKE_CXXFLAGS_WARN_ON = -W3
QMAKE_CXXFLAGS -= -W4
QMAKE_CXXFLAGS += -W3 /MP
# Optimization flags for release
QMAKE_CXXFLAGS_RELEASE += /O2 /GL /Zi
QMAKE_LFLAGS_RELEASE += /LTCG /DEBUG
# Additional MSVC settings
QMAKE_LFLAGS += /SUBSYSTEM:WINDOWS
CONFIG += embed_manifest_exe
QMAKE_LFLAGS += /MANIFEST:NO
}
gcc {
QMAKE_CXXFLAGS += -Wall -Wextra -Wpedantic
QMAKE_CXXFLAGS_RELEASE += -O2
}
# Output directories
CONFIG(debug, debug|release) {
DESTDIR = $$PWD/build/debug
OBJECTS_DIR = $$PWD/build/debug/.obj
MOC_DIR = $$PWD/build/debug/.moc
RCC_DIR = $$PWD/build/debug/.rcc
UI_DIR = $$PWD/build/debug/.ui
} else {
DESTDIR = $$PWD/build/release
OBJECTS_DIR = $$PWD/build/release/.obj
MOC_DIR = $$PWD/build/release/.moc
RCC_DIR = $$PWD/build/release/.rcc
UI_DIR = $$PWD/build/release/.ui
}
# Default rules for deployment
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
# Qt deployment configuration for Windows
win32 {
CONFIG(release, debug|release) {
# Define deployment paths
DEPLOY_TARGET = $$shell_path($$DESTDIR/$$TARGET.exe)
DEPLOY_DIR = $$shell_path($$DESTDIR/deploy)
# Deploy commands
deploy.commands = \
@echo Creating deployment directory... && \
@if not exist \"$$DEPLOY_DIR\" mkdir \"$$DEPLOY_DIR\" && \
@echo Copying application... && \
$(COPY_FILE) \"$$DEPLOY_TARGET\" \"$$DEPLOY_DIR\" && \
@echo Running windeployqt... && \
windeployqt --release --no-translations --no-system-d3d-compiler \"$$DEPLOY_DIR/$$TARGET.exe\" && \
@echo Copying LibTorch dependencies... && \
$(COPY_FILE) \"$$PYTORCH_DIR/lib/*.dll\" \"$$DEPLOY_DIR\" && \
@echo Copying additional files... && \
$(COPY_FILE) \"$$PWD/README.md\" \"$$DEPLOY_DIR\" && \
$(COPY_FILE) \"$$PWD/LICENSE\" \"$$DEPLOY_DIR\" && \
@echo Creating version file... && \
@echo $$VERSION > \"$$DEPLOY_DIR/version.txt\" && \
@echo Deployment complete!
# Clean deployment
deployclean.commands = \
@if exist \"$$DEPLOY_DIR\" \
(@echo Cleaning deployment directory... && \
rmdir /S /Q \"$$DEPLOY_DIR\")
# Make deploy a dependency
first.depends = $(first) deploy
QMAKE_EXTRA_TARGETS += first deploy deployclean
}
}
# Additional Qt settings
DEFINES += \
QT_DEPRECATED_WARNINGS \
QT_MESSAGELOGCONTEXT \
QT_USE_QSTRINGBUILDER \
QT_ENABLE_HIGHDPI_SCALING
# Project files
DISTFILES += \
.gitignore \
README.md \
LICENSE