Skip to content

Commit 7fb6958

Browse files
committed
MinGW build fix.
Fixes kovacsv#14
1 parent 185a451 commit 7fb6958

15 files changed

+46
-10
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ if (WIN32)
211211
${WindowsAppSupportSourcesFolder}
212212
)
213213
target_link_libraries (WindowsReferenceApp NodeEngine NodeUIEngine BuiltInNodes WindowsAppSupport)
214+
target_link_libraries(
215+
WindowsReferenceApp
216+
gdiplus
217+
comctl32
218+
windowscodecs
219+
d2d1
220+
dwrite
221+
)
214222
SetCompilerOptions (WindowsReferenceApp)
215223

216224
# WindowsEmbeddingDemo

Sources/NodeEngine/NE_NodeEngineUtilities.hpp

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

44
#include <functional>
55
#include <vector>
6+
#include <cstddef>
67

78
namespace NE
89
{

Sources/NodeEngine/NE_ValueCombination.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "NE_Debug.hpp"
55

66
#include <algorithm>
7+
#include <limits>
78

89
namespace NE
910
{

Sources/NodeUIEngine/NUIE_NodeAlignment.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "NUIE_NodeAlignment.hpp"
22

33
#include <algorithm>
4+
#include <limits>
45

56
namespace NUIE
67
{

Sources/WindowsAppSupport/WAS_CustomControl.cpp

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

44
#include <vector>
5+
#include <algorithm>
56

67
namespace WAS
78
{

Sources/WindowsAppSupport/WAS_Direct2DContextBase.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "WAS_Direct2DContextBase.hpp"
22
#include "NE_Debug.hpp"
3+
#include <float.h>
34

45
namespace WAS
56
{
@@ -130,9 +131,9 @@ Direct2DContextBase::Direct2DContextBase () :
130131

131132
Direct2DContextBase::Direct2DContextBase (const Direct2DImageLoaderPtr& imageLoader) :
132133
NUIE::NativeDrawingContext (),
133-
direct2DHandler (),
134134
width (0),
135135
height (0),
136+
direct2DHandler (),
136137
imageLoader (imageLoader),
137138
renderTarget (nullptr)
138139
{
@@ -165,7 +166,7 @@ void Direct2DContextBase::BeginDraw ()
165166
void Direct2DContextBase::EndDraw ()
166167
{
167168
HRESULT result = renderTarget->EndDraw ();
168-
if (result == D2DERR_RECREATE_TARGET) {
169+
if ((unsigned int)result == D2DERR_RECREATE_TARGET) {
169170
InitRenderTarget ();
170171
}
171172
}

Sources/WindowsAppSupport/WAS_GdiOffscreenContext.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@
1212
namespace WAS
1313
{
1414

15+
#ifdef _MSC_VER
1516
template <typename KeyType>
1617
HANDLE CreateHandle (const KeyType& key);
18+
#else
19+
HANDLE CreateHandle (const NUIE::PenCacheKey& key);
20+
HANDLE CreateHandle (const NUIE::ColorCacheKey& key);
21+
HANDLE CreateHandle (const NUIE::FontCacheKey& key);
22+
#endif
1723

1824
template <typename KeyType>
1925
class HandleCache

Sources/WindowsAppSupport/WAS_InMemoryDialog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ INT_PTR InMemoryDialog::Show (HWND parentHwnd, DLGPROC dialogProc, LPARAM initPa
289289
return -1;
290290
}
291291

292-
NONCLIENTMETRICS metrics = { sizeof (NONCLIENTMETRICS) };
292+
NONCLIENTMETRICS metrics;
293+
metrics.cbSize = sizeof (NONCLIENTMETRICS);
293294
if (DBGERROR (!SystemParametersInfo (SPI_GETNONCLIENTMETRICS, 0, &metrics, 0))) {
294295
return -1;
295296
}

Sources/WindowsAppSupport/WAS_IncludeWindowsHeaders.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55
#include <windowsx.h>
66
#include <CommCtrl.h>
77

8+
#ifdef _MSC_VER
89
#pragma warning (push)
910
#pragma warning (disable : 4244)
1011
#pragma warning (disable : 4458)
12+
#endif
13+
1114
#include <minmax.h> // for gdiplus
1215
#include <gdiplus.h>
16+
17+
#ifdef _MSC_VER
1318
#pragma warning (pop)
19+
#endif
1420

1521
#endif

Sources/WindowsAppSupport/WAS_NodeEditorHwndControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static LRESULT CALLBACK NodeEditorStaticWindowProc (HWND hwnd, UINT msg, WPARAM
1111
LPCREATESTRUCT createStruct = LPCREATESTRUCT (lParam);
1212
SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) createStruct->lpCreateParams);
1313
} else if (msg == WM_DESTROY) {
14-
SetWindowLongPtr (hwnd, GWLP_USERDATA, NULL);
14+
SetWindowLongPtr (hwnd, GWLP_USERDATA, 0);
1515
}
1616

1717
NodeEditorHwndControl* control = (NodeEditorHwndControl*) GetWindowLongPtr (hwnd, GWLP_USERDATA);

Sources/WindowsAppSupport/WAS_NodeEditorNodeTreeHwndControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static LRESULT CALLBACK NodeEditorNodeListStaticWindowProc (HWND hwnd, UINT msg,
1414
LPCREATESTRUCT createStruct = LPCREATESTRUCT (lParam);
1515
SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) createStruct->lpCreateParams);
1616
} else if (msg == WM_DESTROY) {
17-
SetWindowLongPtr (hwnd, GWLP_USERDATA, NULL);
17+
SetWindowLongPtr (hwnd, GWLP_USERDATA, 0);
1818
}
1919

2020
NodeEditorNodeTreeHwndControl* control = (NodeEditorNodeTreeHwndControl*) GetWindowLongPtr (hwnd, GWLP_USERDATA);

Sources/WindowsEmbeddingDemo/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,11 @@ LRESULT CALLBACK ApplicationWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPAR
382382
return DefWindowProc (hwnd, msg, wParam, lParam);
383383
}
384384

385+
#ifdef _MSC_VER
385386
int wWinMain (HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, int /*nCmdShow*/)
387+
#else
388+
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE, LPSTR, int)
389+
#endif
386390
{
387391
WNDCLASSEX windowClass;
388392
ZeroMemory (&windowClass, sizeof (WNDCLASSEX));

Sources/WindowsReferenceApp/Application.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void Application::InitFileMenu (HWND hwnd)
117117
{
118118
HMENU file = fileMenu.AddPopupMenu (L"File");
119119
fileMenu.AddPopupMenuItem (file, FILE_NEW, L"New");
120-
fileMenu.AddPopupMenuItem (file, FILE_OPEN, L"Open");
120+
fileMenu.AddPopupMenuItem (file, OPEN_FILE, L"Open");
121121
fileMenu.AddPopupMenuItem (file, FILE_SAVE, L"Save");
122122
fileMenu.AddPopupMenuSeparator (file);
123123
fileMenu.AddPopupMenuItem (file, FILE_QUIT, L"Quit");
@@ -142,7 +142,7 @@ void Application::InitToolbar (HWND hwnd)
142142
toolbar.Init (hwnd);
143143

144144
AddToolbarItem (TOOLBAR_ENABLED_NEW_ICON, FILE_NEW);
145-
AddToolbarItem (TOOLBAR_ENABLED_OPEN_ICON, FILE_OPEN);
145+
AddToolbarItem (TOOLBAR_ENABLED_OPEN_ICON, OPEN_FILE);
146146
AddToolbarItem (TOOLBAR_ENABLED_SAVE_ICON, FILE_SAVE);
147147
toolbar.AddSeparator ();
148148

Sources/WindowsReferenceApp/CommandIds.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define COMMANDIDS_HPP
33

44
#define FILE_NEW 1101
5-
#define FILE_OPEN 1102
5+
#define OPEN_FILE 1102
66
#define FILE_SAVE 1103
77
#define FILE_QUIT 1104
88
#define EDIT_UNDO 1201

Sources/WindowsReferenceApp/main.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
#include "ResourceIds.hpp"
55
#include "CommandIds.hpp"
66

7+
#ifdef _MSC_VER
78
#pragma comment (lib, "gdiplus.lib")
89
#pragma comment (lib, "comctl32.lib")
910
#pragma comment (lib, "windowscodecs.lib")
1011
#pragma comment (lib, "d2d1.lib")
1112
#pragma comment (lib, "dwrite.lib")
1213
#pragma comment (linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
14+
#endif
1315

1416
LRESULT CALLBACK ApplicationWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
1517
{
1618
if (msg == WM_CREATE) {
1719
LPCREATESTRUCT createStruct = LPCREATESTRUCT (lParam);
1820
SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR) createStruct->lpCreateParams);
1921
} else if (msg == WM_DESTROY) {
20-
SetWindowLongPtr (hwnd, GWLP_USERDATA, NULL);
22+
SetWindowLongPtr (hwnd, GWLP_USERDATA, 0);
2123
PostQuitMessage (0);
2224
}
2325

@@ -70,7 +72,7 @@ LRESULT CALLBACK ApplicationWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPAR
7072
case FILE_NEW:
7173
application->New (hwnd);
7274
break;
73-
case FILE_OPEN:
75+
case OPEN_FILE:
7476
application->Open (hwnd);
7577
break;
7678
case FILE_SAVE:
@@ -111,7 +113,11 @@ LRESULT CALLBACK ApplicationWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPAR
111113
return DefWindowProc (hwnd, msg, wParam, lParam);
112114
}
113115

116+
#ifdef _MSC_VER
114117
int wWinMain (HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, int /*nCmdShow*/)
118+
#else
119+
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE, LPSTR, int)
120+
#endif
115121
{
116122
EnableLeakDetection ();
117123
InitCommonControls ();

0 commit comments

Comments
 (0)