msvc: add support for converting cflags too

feature/tap-sh
William Pitcock 2018-01-05 18:05:47 -06:00
parent 4a09efe070
commit d1618ece3a
2 changed files with 21 additions and 6 deletions

View File

@ -67,7 +67,7 @@ fragment_len(const pkgconf_fragment_t *frag)
static inline bool static inline bool
allowed_fragment(const pkgconf_fragment_t *frag) allowed_fragment(const pkgconf_fragment_t *frag)
{ {
return !(!frag->type || frag->data == NULL || strchr("Ll", frag->type) == NULL); return !(!frag->type || frag->data == NULL || strchr("DILl", frag->type) == NULL);
} }
static size_t static size_t
@ -123,11 +123,17 @@ msvc_renderer_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, b
if (fragment_len(frag) > buf_remaining) if (fragment_len(frag) > buf_remaining)
break; break;
if (frag->type == 'L') switch(frag->type) {
{ case 'D':
size_t cnt = pkgconf_strlcpy(bptr, "/libpath:", buf_remaining); case 'I':
*bptr++ = '/';
*bptr++ = frag->type;
break;
case 'L':
cnt = pkgconf_strlcpy(bptr, "/libpath:", buf_remaining);
bptr += cnt; bptr += cnt;
buf_remaining -= cnt; buf_remaining -= cnt;
break;
} }
escape = fragment_should_quote(frag); escape = fragment_should_quote(frag);
@ -141,7 +147,7 @@ msvc_renderer_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, b
if (frag->type == 'l') if (frag->type == 'l')
{ {
size_t cnt = pkgconf_strlcpy(bptr, ".lib", buf_remaining); cnt = pkgconf_strlcpy(bptr, ".lib", buf_remaining);
bptr += cnt; bptr += cnt;
buf_remaining -= cnt; buf_remaining -= cnt;
} }

View File

@ -28,7 +28,8 @@ tests_init \
fragment_quoting_3 \ fragment_quoting_3 \
fragment_quoting_5 \ fragment_quoting_5 \
fragment_quoting_7 \ fragment_quoting_7 \
msvc_fragment_quoting msvc_fragment_quoting \
msvc_fragment_render_cflags
comments_body() comments_body()
{ {
@ -257,3 +258,11 @@ msvc_fragment_quoting_body()
-o inline:'/libpath:"C:\D E" E.lib \n' \ -o inline:'/libpath:"C:\D E" E.lib \n' \
pkgconf --libs --msvc-syntax fragment-escaping-1 pkgconf --libs --msvc-syntax fragment-escaping-1
} }
msvc_fragment_render_cflags_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:'/I/test/include/foo /DFOO_STATIC \n' \
pkgconf --cflags --static --msvc-syntax foo
}