Skip to content

Commit e0db01f

Browse files
committed
Cleanup: Remove unused members and fix some minors
# Conflicts: # src/win32/Thread.h
1 parent c5b0654 commit e0db01f

13 files changed

Lines changed: 83 additions & 37 deletions

DesktopDuplicator.qbs

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,54 @@ Project {
1414
cpp.enableRtti: false // disable runtime type information for faster build and smaller object files and executable
1515

1616
cpp.minimumWindowsVersion: "10.0"
17-
cpp.generateManifestFile: false
18-
cpp.includePaths: 'src'
19-
cpp.cxxFlags: ['/analyze', '/Zc:char8_t-']
20-
cpp.defines: ['NOMINMAX']
2117
cpp.dynamicLibraries: ['d3d11', "User32", "Gdi32", "Shell32", "Ole32", "Comctl32"]
18+
cpp.includePaths: ['src']
2219

2320
Properties {
24-
condition: qbs.toolchain.contains('msvc')
25-
cpp.cxxFlags: outer.concat(
26-
"/permissive-", "/Zc:__cplusplus", // best C++ compatibilty
21+
condition: qbs.toolchainType == 'msvc'
22+
cpp.generateManifestFile: false
23+
cpp.defines: ['NOMINMAX']
24+
cpp.cxxFlags: [
25+
'/analyze', '/Zc:char8_t-',
26+
'/permissive-', '/Zc:__cplusplus', // best C++ compatibilty
2727
"/Zc:inline", // do not include inline code in object files
2828
"/Zc:throwingNew", // avoid redundant null checks after new
2929
"/diagnostics:caret", // better error postions
3030
"/W4", // enable all warnings
3131
"/experimental:external", "/external:anglebrackets", "/external:W0" // ignore warnings from external headers
32-
)
32+
]
33+
}
34+
Properties {
35+
condition: qbs.toolchainType == 'clang-cl'
36+
cpp.generateManifestFile: false
37+
cpp.defines: ['NOMINMAX']
38+
cpp.cxxFlags: [
39+
"/permissive-", "/Zc:__cplusplus", // best C++ compatibilty
40+
"/Zc:inline", // do not include inline code in object files
41+
"/diagnostics:caret", // better error postions
42+
"/W4", // enable all warnings
43+
]
44+
}
45+
Properties {
46+
condition: qbs.toolchain.contains('clang')
47+
// note: would require '--target=x86_64-pc-windows-msvc19.43.34808' to work
48+
// useful: to run third party clang based tools
49+
cpp.defines: [
50+
'_M_X64=100',
51+
'_M_AMD64=100',
52+
'_WIN64=1',
53+
'NOMINMAX'
54+
]
55+
cpp.cxxFlags: [
56+
'-fms-volatile',
57+
'-fms-extensions',
58+
'-fms-compatibility-version=19.43.34808',
59+
'-fms-compatibility',
60+
// "-###" // print cc1 subcommand arguments
61+
]
62+
cpp.systemIncludePaths: [
63+
// note: actually needs msvc include & windows kit includes
64+
]
3365
}
3466

3567
Depends { name: 'hlsl' }

qbs/modules/hlsl/hlsl.qbs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import qbs 1.0
22
import qbs.File
33
import qbs.FileInfo
4+
import qbs.TextFile
45
import qbs.WindowsUtils
56
import qbs.ModUtils
67
import qbs.Utilities
8+
import qbs.Process
9+
710

811
Module {
912
property string hlslName: "fxc.exe"
@@ -67,14 +70,28 @@ Module {
6770
}
6871
args = args.concat(ModUtils.moduleProperty(input, 'flags', 'hlsl'));
6972
args.push(FileInfo.toWindowsSeparators(input.filePath));
70-
var cmd = new Command(ModUtils.moduleProperty(product, "hlslPath"), args);
71-
cmd.description = "compiling shader " + input.fileName;
72-
cmd.inputFileName = input.fileName;
73-
cmd.stdoutFilterFunction = function(output) {
73+
var cmd = new JavaScriptCommand();
74+
cmd.args = args;
75+
cmd.outputPath = output.filePath;
76+
cmd.hlslPath = ModUtils.moduleProperty(product, "hlslPath");
77+
cmd.sourceCode = function() {
78+
var process = new Process();
79+
process.exec(hlslPath, args, true);
80+
var file = new TextFile(outputPath, TextFile.ReadWrite);
81+
var content = file.readAll();
82+
file.truncate();
83+
file.writeLine("#pragma once");
84+
file.writeLine("#include <windows.h>");
85+
file.write(content);
86+
file.close();
87+
var output = process.readStdOut();
7488
var lines = output.split("\r\n").filter(function (s) {
75-
return !s.endsWith(inputFileName); });
76-
return lines.join("\r\n");
89+
return !s.endsWith(inputFileName);
90+
});
91+
console.info(lines.join("\r\n"));
7792
};
93+
cmd.description = "compiling shader " + input.fileName;
94+
cmd.inputFileName = input.fileName;
7895
return cmd;
7996
}
8097
}

src/MainApplication.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ struct MainApplication final : private MainController {
5252

5353
using PowerRequest = win32::PowerRequest<PowerRequestDisplayRequired, PowerRequestSystemRequired>;
5454
PowerRequest m_powerRequest;
55-
bool m_hasPowerRequest{};
5655
};
5756

5857
} // namespace deskdup

src/TaskbarButtons.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ struct TaskbarButtons {
3737
win32::TaskbarList m_taskbarList{};
3838

3939
bool m_updatedButtons{};
40-
bool m_showsMaximized{};
41-
SystemStatus m_showsSystemStatus{};
42-
DuplicationStatus m_showsDuplicationStatus{};
43-
bool m_showsVisibleArea{};
4440
};
4541

4642
} // namespace deskdup

src/WindowRenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ void WindowRenderer::Resources::createRenderTarget() {
333333
if (IS_ERROR(result)) throw Error{result, "Failed to get backbuffer"};
334334

335335
static constexpr const D3D11_RENDER_TARGET_VIEW_DESC *render_target_description = nullptr;
336-
result = device()->CreateRenderTargetView(back_buffer.Get(), nullptr, &renderTarget);
336+
result = device()->CreateRenderTargetView(back_buffer.Get(), render_target_description, &renderTarget);
337337
if (IS_ERROR(result)) throw Error{result, "Failed to create render target for backbuffer"};
338338
}
339339

src/WindowRenderer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <dxgi1_3.h>
77

8+
#include <bit>
89
#include <optional>
910

1011
struct PointerBuffer;

src/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include "win32/Process.h"
44

5+
#include "stable.h" // note: ensure the file is compiled
6+
57
auto WINAPI WinMain(_In_ HINSTANCE instanceHandle, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int /*showCommand*/) -> int {
68
win32::Process::current_setDpiAwareness(win32::DpiAwareness::PerMonitorAwareV2);
79
{

src/meta/callback_adapter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#include <bit>
33
#include <memory>
4-
#include <winnt.h>
4+
#include <windows.h>
55

66
template<class Parameter = void *>
77
class UniqueCallbackAdapter final {

src/stable.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#pragma
21

32
#ifndef NOMINMAX
43
# define NOMINMAX

src/win32/DisplayMonitor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "Geometry.h"
33

44
#include <Windows.h>
5+
#include <bit>
56

67
namespace win32 {
78

0 commit comments

Comments
 (0)