For cross-compiling, we can't assume that "vkd3d_windows.h" or <windows.h> pulls in <stddef.h>. Fixes compilation errors related to using offsetof(3).
Signed-off-by: Chip Davis cdavis@codeweavers.com --- tests/d3d12_crosstest.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h index 7b59471..ff44324 100644 --- a/tests/d3d12_crosstest.h +++ b/tests/d3d12_crosstest.h @@ -50,6 +50,7 @@ typedef int HRESULT; #include <inttypes.h> #include <limits.h> #include <math.h> +#include <stddef.h> #include <time.h>
#ifdef _WIN32
Signed-off-by: Chip Davis cdavis@codeweavers.com --- m4/check-mingw-prog.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/m4/check-mingw-prog.m4 b/m4/check-mingw-prog.m4 index ac3e07d..94fe795 100644 --- a/m4/check-mingw-prog.m4 +++ b/m4/check-mingw-prog.m4 @@ -15,7 +15,7 @@ AS_VAR_IF([vkd3d_cross_cc], [$3], AC_MSG_CHECKING([whether $CC works]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]) - $2=`expr "$CC" : '(.*)-gcc'`], + $2=`expr "$CC" : '(.*)-gcc' | "$CC" : '(.*)-clang'`], [AC_MSG_RESULT([no])]) CC="$vkd3d_cc_saved"]) AS_VAR_POPDEF([vkd3d_cross_cc])dnl @@ -34,7 +34,7 @@ AS_VAR_IF([vkd3d_cross_cc], [$3], AC_MSG_CHECKING([whether $CC works]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes]) - $2=`expr "$CC" : '(.*)-gcc'`], + $2=`expr "$CC" : '(.*)-gcc' | "$CC" : '(.*)-clang'`], [AC_MSG_RESULT([no])]) CC="$vkd3d_cc_saved"]) AS_VAR_POPDEF([vkd3d_cross_cc])dnl
This is used when cross-compiling tests.
Signed-off-by: Chip Davis cdavis@codeweavers.com --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am index c9c7265..ef1cb31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -245,7 +245,7 @@ $(CROSS32_IMPLIBS): %.cross32.a: %.cross32.def
$(CROSS32_EXEFILES): %.cross32.exe: %.c $(CROSS32_IMPLIBS) $(widl_headers) $(AM_V_CCLD)depbase=`echo $@ | $(SED) 's![^/]*$$!$(DEPDIR)/&!;s!.exe$$!!'`; \ - $(CROSS32_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $< $(CROSS32_IMPLIBS) -ldxgi -lgdi32 && \ + $(CROSS32_CC) $(CROSS_CFLAGS) $(CROSS_LDFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $< $(CROSS32_IMPLIBS) -ldxgi -lgdi32 && \ $(am__mv) $$depbase.Tpo $$depbase.Po else crosstest32: @@ -270,7 +270,7 @@ $(CROSS64_IMPLIBS): %.cross64.a: %.cross64.def
$(CROSS64_EXEFILES): %.cross64.exe: %.c $(CROSS64_IMPLIBS) $(widl_headers) $(AM_V_CCLD)depbase=`echo $@ | sed 's![^/]*$$!$(DEPDIR)/&!;s!.exe$$!!'`; \ - $(CROSS64_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $< $(CROSS64_IMPLIBS) -ldxgi -lgdi32 && \ + $(CROSS64_CC) $(CROSS_CFLAGS) $(CROSS_LDFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $< $(CROSS64_IMPLIBS) -ldxgi -lgdi32 && \ $(am__mv) $$depbase.Tpo $$depbase.Po else crosstest64:
Signed-off-by: Chip Davis cdavis@codeweavers.com --- tests/d3d12.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c index c4ec41a..6de062a 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -96,7 +96,9 @@ static bool compare_uint16(uint16_t a, uint16_t b, unsigned int max_diff)
static bool compare_uint64(uint64_t a, uint64_t b, unsigned int max_diff) { - return llabs(a - b) <= max_diff; + uint64_t diff = a > b ? a - b : b - a; + + return diff <= max_diff; }
static ULONG get_refcount(void *iface)
On Fri, 29 May 2020 at 05:40, Chip Davis cdavis@codeweavers.com wrote:
This is used when cross-compiling tests.
Not unless you set it; I.e., what is the use-case here?
May 29, 2020 2:36 AM, "Henri Verbeet" hverbeet@gmail.com wrote:
On Fri, 29 May 2020 at 05:40, Chip Davis cdavis@codeweavers.com wrote:
This is used when cross-compiling tests.
Not unless you set it; I.e., what is the use-case here?
Passing -fuse-ld=lld to the compiler.
Chip
On Fri, 29 May 2020 at 20:51, Chip Davis cdavis@codeweavers.com wrote:
May 29, 2020 2:36 AM, "Henri Verbeet" hverbeet@gmail.com wrote:
On Fri, 29 May 2020 at 05:40, Chip Davis cdavis@codeweavers.com wrote:
This is used when cross-compiling tests.
Not unless you set it; I.e., what is the use-case here?
Passing -fuse-ld=lld to the compiler.
But why would you want to do that? I'm guessing you're trying to do some Clang[1] thing, but it's not clear to me how it benefits vkd3d.
[1] For the record, the recommended way to build vkd3d on macOS is to use our Conservancy[2] sister project Homebrew[3] to install mingw-w64, gcc, pkg-config, etc., and then pass appropriate CC etc. arguments to configure. I suppose it would be helpful to explicitly describe building for non-Linux platforms on the wiki, but we haven't traditionally had a lot of demand from users building things themselves on those platforms. [2] https://sfconservancy.org/ [3] https://brew.sh/