Skip to content

Commit 904d10c

Browse files
committed
update cmake files
1 parent 469abdf commit 904d10c

File tree

12 files changed

+187
-156
lines changed

12 files changed

+187
-156
lines changed

SharpsenBox/CMakeLists.txt

+11-8
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,23 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CmakeModules")
1515
set(CMAKE_CXX_STANDARD 20)
1616
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1717

18+
19+
set(CMAKE_AUTOMOC ON)
1820
include(Config)
1921
include(CMakeDependentOption)
2022
include(GNUInstallDirs)
2123

2224

2325
find_package(Qt6 REQUIRED COMPONENTS
24-
Core
25-
Widgets
26-
Gui
27-
Quick
28-
Qml
29-
Test
30-
QuickControls2
31-
Network)
26+
Core
27+
Widgets
28+
Gui
29+
Quick
30+
Qml
31+
Test
32+
QtWebEngine
33+
QuickControls2
34+
Network)
3235
qt_standard_project_setup()
3336

3437
add_subdirectory(Source)

SharpsenBox/CmakeModules/Config.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ endif()
6565

6666
if(AUTO_QT_LIBS)
6767
add_custom_target(deploy ALL
68-
WORKING_DIRECTORY ${QtLib}/bin
68+
WORKING_DIRECTORY ${QtLib}/bin
6969
COMMAND ${platform}deployqt --qmldir ${CMAKE_SOURCE_DIR}/Gui --${type} --quick ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
7070
COMMAND ${platform}deployqt --qmldir ${CMAKE_SOURCE_DIR}/Gui --${type} --quick ${UpdaterPath}
71-
COMMENT "========= Deploying Aplication ========="
71+
COMMENT "========= Deploying Aplication ========="
7272
USES_TERMINAL)
7373
add_dependencies(deploy SharpsenBox)
7474
endif()

SharpsenBox/Gui/SharpsenBox.qml

+32-29
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import QtQuick 2.0
22
import QtQuick.Controls 2.14
33
import QtQuick.Window 2.12
4-
import QtWebEngine 1.8
54

65
ApplicationWindow {
76
id: window
@@ -10,7 +9,7 @@ ApplicationWindow {
109
height: 500
1110
color: "#202020"
1211
flags: Qt.Window | Qt.FramelessWindowHint | Qt.WindowMinimizeButtonHint
13-
| Qt.WindowMaximizeButtonHint
12+
| Qt.WindowMaximizeButtonHint
1413
minimumWidth: 1000
1514
minimumHeight: 600
1615
// for window movement
@@ -25,11 +24,13 @@ ApplicationWindow {
2524

2625
function absoluteMousePos(mouseArea) {
2726
var windowAbs = mouseArea.mapToItem(null, mouseArea.mouseX,
28-
mouseArea.mouseY)
27+
mouseArea.mouseY)
2928
return Qt.point(windowAbs.x + window.x, windowAbs.y + window.y)
3029
}
3130

32-
FontLoader { id: latoFont; source: "Font/Lato-Regular.ttf" }
31+
FontLoader {
32+
id: latoFont; source: "Font/Lato-Regular.ttf"
33+
}
3334

3435
TopBar {
3536
id: topBar
@@ -68,38 +69,40 @@ ApplicationWindow {
6869

6970
onStageChanged: {
7071
switch (stage) {
71-
case 0:
72-
if(source != ""){
73-
hide()
74-
} else {
75-
active = false
76-
source = ""
77-
}
78-
break
79-
case 1:
80-
active = true
81-
source = "PopOutInfo.qml"
82-
show()
83-
break
84-
case 2:
85-
active = true
86-
source = "InstallPopOut.qml"
87-
show()
88-
break
89-
case 3:
90-
active = true
91-
source = "PopOutDialog.qml"
92-
show()
93-
break
72+
case 0:
73+
if (source != "") {
74+
hide()
75+
} else {
76+
active = false
77+
source = ""
78+
}
79+
break
80+
case 1:
81+
active = true
82+
source = "PopOutInfo.qml"
83+
show()
84+
break
85+
case 2:
86+
active = true
87+
source = "InstallPopOut.qml"
88+
show()
89+
break
90+
case 3:
91+
active = true
92+
source = "PopOutDialog.qml"
93+
show()
94+
break
9495
}
9596
}
9697
active: false
9798
source: ""
98-
function show(){
99+
100+
function show() {
99101
showAnim.stop()
100102
showAnim.start()
101103
}
102-
function hide(){
104+
105+
function hide() {
103106
hideAnim.stop()
104107
hideAnim.start()
105108
}
+43-36
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,54 @@
11

2-
qt6_add_resources(
3-
RESOURCES
4-
"../../../Gui/SharpsenBox.qrc")
2+
qt_add_resources(
3+
RESOURCES
4+
"../../../Gui/SharpsenBox.qrc")
55

66
qt_add_executable(SharpsenBox
7-
main.cpp
8-
Backend.cpp
9-
${RESOURCES})
7+
main.cpp
8+
Backend.cpp
9+
${RESOURCES})
1010

1111
message(${WIN} AND ${RELEASE} asfa ${64BIT})
1212

13-
if(WIN AND RELEASE)
13+
if (WIN AND RELEASE)
1414
set_target_properties(SharpsenBox PROPERTIES WIN32_EXECUTABLE TRUE)
15-
endif()
15+
endif ()
1616

1717
target_link_libraries(SharpsenBox PUBLIC
18-
ComponentRegister
19-
Dialog
20-
GameManager
21-
LoadingBar
22-
Config
23-
Qt6::Widgets
24-
Qt6::Gui
25-
Qt6::Core
26-
Qt6::Quick
27-
Qt6::Qml
28-
Qt6::QuickControls2
29-
${CURL_LIBRARY})
30-
31-
target_include_directories(SharpsenBox PUBLIC
32-
"../../Component"
33-
"../../Component/h"
34-
"../../QConfig"
35-
"../../QConfig/h"
36-
"../../UpdateManager"
37-
"../../UpdateManager/h"
38-
"../QDialog"
39-
"../QDialog/h"
40-
"../QGameManager"
41-
"../QGameManager/h"
42-
"../QLoadingBar"
43-
"../QLoadingBar/h")
44-
45-
file( COPY ${CMAKE_SOURCE_DIR}/orbit2.ico DESTINATION ${CMAKE_BINARY_DIR} )
18+
ComponentRegister
19+
Dialog
20+
GameManager
21+
LoadingBar
22+
Config
23+
Qt6::Widgets
24+
Qt6::Gui
25+
Qt6::Core
26+
Qt6::Quick
27+
Qt6::Qml
28+
Qt6::QuickControls2
29+
${CURL_LIBRARY})
30+
31+
target_include_directories(SharpsenBox PUBLIC
32+
"../../Component"
33+
"../../Component/h"
34+
"../../QConfig"
35+
"../../QConfig/h"
36+
"../../UpdateManager"
37+
"../../UpdateManager/h"
38+
"../QDialog"
39+
"../QDialog/h"
40+
"../QGameManager"
41+
"../QGameManager/h"
42+
"../QLoadingBar"
43+
"../QLoadingBar/h")
44+
45+
file(COPY ${CMAKE_SOURCE_DIR}/orbit2.ico DESTINATION ${CMAKE_BINARY_DIR})
46+
47+
qt_generate_deploy_app_script(
48+
TARGET SharpsenBox
49+
OUTPUT_SCRIPT deploy_script
50+
NO_UNSUPPORTED_PLATFORM_ERROR
51+
)
52+
install(SCRIPT ${deploy_script})
4653

4754
install(TARGETS SharpsenBox DESTINATION ${SharpsenBoxPath}/bin)

SharpsenBox/Source/App/App/main.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
#include <QIcon>
66
#include "Backend.hpp"
77

8-
int main(int argc, char** argv) {
8+
int main(int argc, char** argv)
9+
{
910
//responsible is more efficient but animations are too fast
1011
//QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
1112
QGuiApplication app(argc, argv);
1213
app.setWindowIcon(QIcon("orbit2.ico"));
1314
QQmlApplicationEngine engine;
15+
engine.addImportPath(".");
16+
engine.addImportPath("qrc:/");
1417

1518
sb::Backend backend(&engine);
1619
backend.RegisterComponents();
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11

22
qt_add_library(Dialog STATIC
3-
Dialog.cpp)
3+
Dialog.cpp)
44

55
target_include_directories(Dialog PUBLIC
6-
"../../Component/h"
7-
"../QGameManager/h"
8-
"../QConfig/h"
9-
"h")
6+
"../../Component/h"
7+
"../QGameManager/h"
8+
"../QConfig/h"
9+
"h")
1010

1111
target_link_libraries(Dialog
12-
Qt6::Widgets
13-
Qt6::Gui
14-
Qt6::Core)
12+
Qt6::Widgets
13+
Qt6::Gui
14+
Qt6::Qml
15+
Qt6::Core)
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11

22
qt_add_library(LoadingBar STATIC
3-
LoadingBar.cpp)
3+
LoadingBar.cpp)
44

55
target_include_directories(LoadingBar PUBLIC
6-
"../JsonParsers"
7-
"../AppUpdater"
8-
"../QDialog/h"
9-
"../QGameManager/h"
10-
"../../UpdateManager/h"
11-
"../../QConfig/h"
12-
"../../Component/h"
13-
"h")
6+
"../JsonParsers"
7+
"../AppUpdater"
8+
"../QDialog/h"
9+
"../QGameManager/h"
10+
"../../UpdateManager/h"
11+
"../../QConfig/h"
12+
"../../Component/h"
13+
"h")
1414

1515
target_link_libraries(LoadingBar
16-
Qt6::Widgets
17-
Qt6::Gui
18-
Qt6::Core)
16+
Qt6::Widgets
17+
Qt6::Gui
18+
Qt6::Qml
19+
Qt6::Core)
+7-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11

22
qt_add_library(ComponentRegister STATIC
3-
ComponentRegister.cpp)
3+
ComponentRegister.cpp)
44

5-
target_include_directories(ComponentRegister PUBLIC
6-
"h")
5+
target_include_directories(ComponentRegister PUBLIC
6+
"h")
77

88
target_link_libraries(ComponentRegister
9-
Qt6::Widgets
10-
Qt6::Gui
11-
Qt6::Core)
9+
Qt6::Widgets
10+
Qt6::Gui
11+
Qt6::Qml
12+
Qt6::Core)
+9-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11

22
qt_add_library(Config STATIC
3-
Config.cpp)
3+
Config.cpp)
44

55

66
target_include_directories(Config PUBLIC
7-
"../Component/h"
8-
"../UpdateManager/h"
9-
"h")
7+
"../Component/h"
8+
"../UpdateManager/h"
9+
"h")
1010

1111
target_link_libraries(Config
12-
Qt6::Widgets
13-
Qt6::Gui
14-
Qt6::Core
15-
Qt6::Widgets)
12+
Qt6::Widgets
13+
Qt6::Gui
14+
Qt6::Core
15+
Qt6::Qml
16+
Qt6::Widgets)

0 commit comments

Comments
 (0)