frang75 / nappgui_src

SDK for building cross-platform desktop apps in ANSI-C
https://www.nappgui.com
MIT License
448 stars 45 forks source link

Compilation success with MSYS2/MinGW #5

Closed tenko closed 3 weeks ago

tenko commented 2 years ago

I was able to build the DLL with Rochus Keller's project files with MinGW on 64bit Windows 10 version with some changes:

Probably misspelling in MinGW headers:
+++ b/src/draw2d/win/dctx_win.cpp
-            ctx->lbrush->RotateTransform(ctx->gradient_angle);
+            ctx->lbrush->RotateTranform(ctx->gradient_angle);
Did not find headers:
+++ b/src/draw2d/win/draw2d_win.ixx
-#include <gdiplus.h>
-#include <gdipluspixelformats.h>
+#include <gdiplus/gdiplus.h>
+#include <gdiplus/gdipluspixelformats.h>
Not sure why this failed. Commented out for now:
+++ b/src/draw2d/win/osimage.cpp
-    status = bitmap->Save(stream, &clsid);
+    //status = bitmap->Save(stream, &clsid);
i64 prefix is a Microsoft extension. Replaced with LL:
+++ b/src/osbs/win/btime.c
-#define EPOCHFILETIME (116444736000000000i64)
+#define EPOCHFILETIME (116444736000000000LL)
Error due to encoding:
+++ b/src/osgui/win/osedit.c
-        SendMessage(edit->control.hwnd, EM_SETPASSWORDCHAR, (WPARAM)L'•', (LPARAM)0);
+        SendMessage(edit->control.hwnd, EM_SETPASSWORDCHAR, (WPARAM)L'#', (LPARAM)0);
Not sure why this failed. Edit fixed the problem:
+++ b/src/osgui/win/oswindow.c
-    enum gui_role_t role;
+    gui_role_t role;
Processor type not picked up. Temporary work around:
+++ b/src/sewer/arch.hxx
-        #error Unknown processor
+        #define __x64__
Compiler not supported. Temporary work around:
+++ b/src/sewer/win/bmem_win.c
 #if !defined (_MSC_VER)
-#error Unknow compiler
 #endif

The DLL built fine and worked with the ported Oberon+ examples. The edits here are minor and it look feasible to to support MinGW in the future.

frang75 commented 2 years ago

Hi @tenko! thank you very much for the feedback and use NAppGUI.

At the moment, MinGW is not "officially" supported by the project. However, looking at your comments, I don't think will be very expensive to add this support. I'll keep it in mind for future reviews of the build system.

tenko commented 2 years ago

Great. For information MSYS2 gcc version is up to date: gcc version 11.2.0 (Rev5, Built by MSYS2 project)

DiegoJArg commented 1 year ago

Hi @tenko, I am interested on testing NAppGUI on MinGW. Can you provide those project files?

After running cmake -S ./src -B ./build I am getting the following which is not mentioned in your post.

-- Ninja
CMake Error at C:/msys64/home/Note13/_myGitHub/_synclist_public_/nappgui_src/prj/CMakeCompilers.cmak
e:113 (message):
  Unknown compiler
Call Stack (most recent call first):
  C:/msys64/home/Note13/_myGitHub/_synclist_public_/nappgui_src/prj/CMakeNAppGUI.cmake:35 (include)
  CMakeLists.txt:9 (include)
frang75 commented 3 weeks ago

The support for MinGW has been added in NAppGUI 1.4.2. Doc: https://nappgui.com/en/guide/win_mac_linux.html#h4 Commit: https://github.com/frang75/nappgui_src/commit/5f638074231f028a5eb8a07c2f0d232edad408c6 Thanks for the patience.