Skip to content

Commit 0e79d59

Browse files
committed
make built-in resource
1 parent dce460a commit 0e79d59

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

CM_Config/LibraryHandler.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
set(CMAKE_AUTOMOC ON)
2+
set(CMAKE_AUTORCC ON)
23

34
find_package(PkgConfig REQUIRED)
45
find_package(Qt6 REQUIRED COMPONENTS Widgets Gui Core)
56

7+
qt_standard_project_setup()
8+
69
pkg_check_modules(LIBPCI REQUIRED libpci)
710
include_directories(${LIBPCI_INCLUDE_DIRS})
811
link_directories(${LIBPCI_LIBRARY_DIRS})
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!DOCTYPE RCC>
2+
<RCC version="1.0">
3+
<qresource prefix="/">
4+
<file>AppIcon.png</file>
5+
</qresource>
6+
</RCC>

Sources/AppGUI/SourceInfo.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ CollectSources(${PROJECT_MODULE_ROOT} ModSources)
22

33
include_directories("${PROJECT_MODULE_ROOT}/SharedData")
44

5-
add_executable(RunAsGPU ${ModSources})
5+
add_executable(RunAsGPU ${ModSources} ${PROJECT_MODULE_ROOT}/Resources/resources.qrc)
66

7-
target_link_libraries(RunAsGPU PRIVATE RunAsGPU-shared Qt6::Widgets Qt6::Gui Qt6::Core)
8-
9-
qt_standard_project_setup()
7+
message(STATUS "GUI Resources: ${GUI_RESOURCES}")
8+
target_link_libraries(RunAsGPU PRIVATE RunAsGPU-shared Qt6::Widgets Qt6::Gui Qt6::Core)

Sources/AppGUI/UI/MainWindow.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ void Ui_MainWindow::performLogic(QMainWindow* window) const {
122122

123123
labelUnitSelected->setText("Selected GPU: " + QString::fromStdString(gpu_list[gpuUnit].fullName));
124124

125-
std::string iconPath = GetExecutablePath().parent_path().string() + "/AppIcon.png";
126-
if (fs::exists(iconPath))
127-
window->setWindowIcon(QIcon(QString::fromStdString(iconPath)));
125+
window->setWindowIcon(QIcon(":/AppIcon.png"));
128126

129127
model = new AppListModel(appList);
130128
delegate = new AppListDelegate(appList);

0 commit comments

Comments
 (0)