Skip to content

Commit 39343b9

Browse files
committed
Add sw gui stub.
1 parent 9f2ca12 commit 39343b9

5 files changed

Lines changed: 66 additions & 4 deletions

File tree

src/sw/driver/build_self.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ DECLARE_STATIC_LOGGER(logger, "build.self");
2222

2323
using TargetEntryPointMap = std::unordered_map<sw::PackageId, std::shared_ptr<sw::NativeBuiltinTargetEntryPoint>>;
2424

25+
#define SW_DRIVER_ADD_SELF
2526
#include <build_self.generated.h>
2627

2728
namespace sw

src/sw/gui/main.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include "mainwindow.h"
2+
3+
#include <qapplication.h>
4+
#include <qglobal.h>
5+
#include <qthread.h>
6+
7+
#ifdef QT_STATIC
8+
#include <QtPlugin>
9+
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
10+
Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
11+
#endif
12+
13+
#include <time.h>
14+
15+
#ifdef WIN32
16+
#include <Windows.h>
17+
#endif
18+
19+
void win32_hacks();
20+
21+
int main(int argc, char *argv[])
22+
{
23+
win32_hacks();
24+
qsrand(time(0));
25+
26+
QThread t(0);
27+
QApplication a(argc, argv);
28+
MainWindow w;
29+
w.show();
30+
31+
return a.exec();
32+
}
33+
34+
void win32_hacks()
35+
{
36+
#ifdef WIN32
37+
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
38+
#endif
39+
}

src/sw/gui/mainwindow.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "mainwindow.h"
2+
3+
MainWindow::MainWindow(QWidget *parent)
4+
: QMainWindow(parent)
5+
{
6+
}

src/sw/gui/mainwindow.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#pragma once
2+
3+
#include <qmainwindow.h>
4+
5+
class MainWindow : public QMainWindow
6+
{
7+
Q_OBJECT
8+
public:
9+
MainWindow(QWidget *parent = 0);
10+
};

sw.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ void build(Solution &s)
232232
}
233233
}
234234

235+
#ifndef SW_DRIVER_ADD_SELF
235236
auto &client = p.addTarget<ExecutableTarget>("sw");
236237
{
237238
client.PackageDefinitions = true;
@@ -280,7 +281,7 @@ void build(Solution &s)
280281
}
281282
}
282283

283-
/*auto &gui = client.addTarget<ExecutableTarget>("gui");
284+
auto &gui = client.addTarget<ExecutableTarget>("gui");
284285
{
285286
gui.PackageDefinitions = true;
286287
gui.SwDefinitions = true;
@@ -290,11 +291,16 @@ void build(Solution &s)
290291
gui += "org.sw.demo.qtproject.qt.base.winmain-*"_dep;
291292
gui += "org.sw.demo.qtproject.qt.base.plugins.platforms.windows-*"_dep;
292293
gui += "org.sw.demo.qtproject.qt.base.plugins.styles.windowsvista-*"_dep;
293-
294-
if (auto L = gui.getSelectedTool()->as<VisualStudioLinker>(); L)
294+
295+
#ifdef SW_CPP_DRIVER_API_VERSION
296+
if (auto L = gui.getSelectedTool()->as<VisualStudioLinker*>(); L)
297+
#else
298+
if (auto L = gui.getSelectedTool()->as<VisualStudioLinker>(); L)
299+
#endif
295300
L->Subsystem = vs::Subsystem::Windows;
296301

297302
qt_moc_rcc_uic("org.sw.demo.qtproject.qt-*"_dep, gui);
298303
qt_tr("org.sw.demo.qtproject.qt-*"_dep, gui);
299-
}*/
304+
}
305+
#endif
300306
}

0 commit comments

Comments
 (0)