lc-soft / LCUI

C library for building user interfaces
https://lcui-dev.github.io
MIT License
4.13k stars 356 forks source link

Add support for xp #234

Closed felixmaker closed 3 years ago

felixmaker commented 3 years ago

would it be possible to support xp?

lc-soft commented 3 years ago

This is possible if VCPkg supports compilation of dependent libraries for Windows XP. Otherwise, you need to manually use the XP compilation toolchain to compile LCUI and its dependent libraries.

felixmaker commented 3 years ago

I tried to build LCUI using /MT option, but it failed. Link error 2001 @_BrotliDecoderDecompress (freetype).

lc-soft commented 3 years ago

You need to link to the Brotli library because FreeType depends on it.

felixmaker commented 3 years ago

Thank you! I have built the dll, but when I replace the dll in my project, the program run failed, it does not show in screen and needs to kill in the task manager. Have you met with this situation?

lc-soft commented 3 years ago

You didn't provide your build environment and build methods, so I couldn't give a solution.

Maybe you can run the program with debugging tools.

felixmaker commented 3 years ago

Sorry, I use VS2019 and MSVC V142 (both are the latest version) to build LCUI.dll etc and use lcpkg to install all dependcies. The first time I built the program, the compiler can not include some header files. So I change those lines. In platform.h, before

#if defined(WINAPI_PARTITION_APP)
    #define LCUI_APP_H <LCUI/platform/windows/uwp.h>
#else
    #define LCUI_EVENTS_H <LCUI/platform/windows/windows_events.h>
    #define LCUI_MOUSE_H <LCUI/platform/windows/windows_mouse.h>
    #define LCUI_KEYBOARD_H <LCUI/platform/windows/windows_keyboard.h>
    #define LCUI_DISPLAY_H <LCUI/platform/windows/windows_display.h>
#endif

after

#define LCUI_EVENTS_H <LCUI/platform/windows/windows_events.h>
#define LCUI_MOUSE_H <LCUI/platform/windows/windows_mouse.h>
#define LCUI_KEYBOARD_H <LCUI/platform/windows/windows_keyboard.h>
#define LCUI_DISPLAY_H <LCUI/platform/windows/windows_display.h>

Then I built the program, but when I replace it in my project, it doesn't work.

lc-soft commented 3 years ago

I use VS2019 and MSVC V142 (both are the latest version) to build LCUI.dll etc

v142? Why not use v142_xp? You said you want to support windows XP, then you should use v142_xp.

In the solution configuration of LCUI, the platform toolset has selected v141_xp, you can switch to v142_xp, so you don't need to modify the platform.h file.

image

the program run failed, it does not show in screen and needs to kill in the task manager. ... Then I built the program, but when I replace it in my project, it doesn't work.

Are you using VS2019 to build your project? If so, please use vs2019 to debug it. The general steps are as follows:

  1. Add a breakpoint on the line of code below LCUI_Init(). image
  2. Click "Local windows debugger". image
  3. Check local variables. image
  4. Click "Continue". image
  5. If nothing is displayed, click “Break All”. image
  6. Check Threads and Call stack. image
felixmaker commented 3 years ago

Thank you! I switch to v141_xp toolchain and build the program successful. I checked my project, maybe when I test the program in XP, I forgot to move the .xml file at the same time, so the window do not show.

👍 I have tested the program, it just works fine! 👍

run in xp

PS: If we want to support XP, we need to disable the touch support first in config.h (maybe XP do not support touch!) and then use v141_xp toolchain to build.

lc-soft commented 3 years ago

It seems that the problem has been solved and this issue can be closed.