microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.29k stars 6.43k forks source link

pdcurses: header does not match library #31674

Open GitMensch opened 1 year ago

GitMensch commented 1 year ago

Describe the bug All PDCurses headers but the one from the xcurses port are "static" and not adjusted when installed.

The PDCurses header has:

Define before inclusion (only those needed):

    XCURSES         True if compiling for X11.
    PDC_RGB         True if you want to use RGB color definitions
                    (Red = 1, Green = 2, Blue = 4) instead of BGR.
    PDC_WIDE        True if building wide-character support.
    PDC_DLL_BUILD   True if building a Windows DLL.
    PDC_NCMOUSE     Use the ncurses mouse API instead
                    of PDCurses' traditional mouse API.

but for a port that is highly bad (upstream is to blame), because all but the PDC_NCMOUSE must match the actual build (XCURSES is defined in the generated header for that port), and when just using the port you don't know up-front how this build was done.

To Reproduce Steps to reproduce the behavior:

  1. ./vcpkg install pdcurses
  2. use a test program to #include <curses.h>, then output PDC_WIDE, PDC_DLL_BUILD, PDC_RGB (all not set) and the flags that PDC_get_version returns (the build has WIDE + UTF8 + DLL flags set).

Expected behavior inclusion of the header should set the flags that are "inbuilt" and must match the built

Suggestion Either directly patch the hard-wired three entries in curses.h, or (which would also allow to install both the ncurses and the pdcurses port together) install curses.h into a subfolder "pdcurses" and install a wrapper "pdcurses.h":

#define PDC_DLL_BUILD
#define PDC_WIDE
#define PDC_FORCE_UTF8
#include <pdcurses/curses.h>

@LilyWangLL Any thoughts?

LilyWangLL commented 1 year ago

Thanks for your issue. I will investigate this issue and fix it.

LilyWangLL commented 1 year ago

Sorry for the late reply, I check the codes of pdcurses, not its build has been defined the following macros.

PDC_DLL_BUILD
PDC_WIDE
PDC_FORCE_UTF8

Its build compile the file Makefile.vc, and the following codes defined these macros.

!ifdef WIDE
WIDEOPT     = -DPDC_WIDE
!endif

!ifdef UTF8
UTF8OPT     = -DPDC_FORCE_UTF8
!endif

!ifdef DLL
DLLOPT      = -DPDC_DLL_BUILD
PDCLIBS     = $(CURSESDLL)
!else
PDCLIBS     = $(LIBCURSES)
!endif
github-actions[bot] commented 1 year ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

GitMensch commented 1 year ago

@LilyWangLL this issue is about placing the defines that were used to built into the distributed curses.h (likely a wrapper that includes the real header from a subdirectory). You've found the definitions to use, so do you plan to add that wrapper manually once or have it generated, too?

github-actions[bot] commented 1 year ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

GitMensch commented 1 year ago

Does the category "question" is really correct? There's an actual TODO behind this issue.

github-actions[bot] commented 1 year ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

github-actions[bot] commented 1 year ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.