<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>> How broken was it?  </p>
<p><br>
</p>
<p>Not much.  My prefix commit <span>6d78391c04d9f35353891e665f5ca092ce670e91 happened to fix.   I pushed that change for MinGW sake too, which was not throwing an error. </span></p>
<p><span><br>
</span></p>
<p><span>It was throwing an warning:</span></p>
<p><span><br>
</span></p>
<p><span>  <span>warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]</span></span></p>
<p><span><span><br>
</span></span></p>
<p>maybe we should promote this to an error to catch it on Mingw too.</p>
<p><span><br>
</span></p>
<p><span>Anyway, I've now deleted the Jenkins job I had to build MSVC continuously.  So the next time MSVC would break, it would have stayed broken, and just accumulate brokenness.</span></p>
<p><br>
</p>
<p>> I never build Piglit with MSVC so I didn't notice.<br>
</p>
<div><br>
</div>
<div>From now on me too.  And I strongly suspect this means there are now zero people (or bots) building piglit with MSVC.  So might as well RIP.</div>
<div><br>
</div>
<div>>  <span style="font-size: 12pt;">You might want to note in the commit msg that building with MinGW is the </span><span style="font-size: 12pt;">way forward.</span></div>
<div><br>
</div>
<div>Right.  I updated the README but forgot the commit: that's indeed the expectation.  MinGW is not flawless and I would never recommend it for production, but for tests, it should be fine.</div>
<div><br>
</div>
<div>Jose</div>
<div><br>
</div>
<div>PS: It seems more likely that the future for those who want a cross-platform compiler is not GCC but rather Clang.  Chrome just switched to Clang by default on Windows -- <a href="https://news.ycombinator.com/item?id=14877963" class="OWAAutoLink">https://news.ycombinator.com/item?id=14877963</a> .
  Maybe one day we can switch Mesa too.</div>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Brian Paul<br>
<b>Sent:</b> Monday, July 31, 2017 15:33<br>
<b>To:</b> Jose Fonseca; piglit@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH] Remove MSVC build support.</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">How broken was it?  I never build Piglit with MSVC so I didn't notice.<br>
<br>
You might want to note in the commit msg that building with MinGW is the <br>
way forward.<br>
<br>
Reviewed-by: Brian Paul <brianp@vmware.com><br>
<br>
<br>
<br>
On 07/31/2017 07:38 AM, Jose Fonseca wrote:<br>
> MSVC build of Piglit was broken for over a month.  No point in<br>
> sustaining it.<br>
> ---<br>
>   CMakeLists.txt                  |  6 ++--<br>
>   HACKING                         | 10 ++----<br>
>   README                          | 68 +++++++++++------------------------------<br>
>   appveyor.yml                    |  8 -----<br>
>   tests/shaders/CMakeLists.gl.txt | 10 ++----<br>
>   tests/util/piglit-util.c        | 40 +++---------------------<br>
>   tests/util/piglit-util.h        | 53 --------------------------------<br>
>   7 files changed, 29 insertions(+), 166 deletions(-)<br>
><br>
> diff --git a/CMakeLists.txt b/CMakeLists.txt<br>
> index 76288b954..4259ec832 100644<br>
> --- a/CMakeLists.txt<br>
> +++ b/CMakeLists.txt<br>
> @@ -17,9 +17,9 @@ endif()<br>
><br>
>   project (piglit)<br>
><br>
> -# Require MSVC 2013 U4<br>
> -if (MSVC AND CMAKE_C_COMPILER_VERSION VERSION_LESS 18.00.31101.0)<br>
> -     message (FATAL_ERROR "Visual Studio 2013 Update 4 or later required")<br>
> +# Require MinGW<br>
> +if (MSVC)<br>
> +     message (FATAL_ERROR "Windows builds require MinGW")<br>
>   endif ()<br>
><br>
>   find_package(Threads)<br>
> diff --git a/HACKING b/HACKING<br>
> index 41565439d..7d7915603 100644<br>
> --- a/HACKING<br>
> +++ b/HACKING<br>
> @@ -101,14 +101,8 @@ Code conventions:<br>
>     e.g. libpiglitutil_gles2<br>
>   * Test names are '<lowercasegroupname>-<testname>.'  e.g. glsl-novertexdata<br>
>   * Use int, float, bool except when GL types (GLint, GLfloat) are really needed<br>
> -* Don't put declarations after code.  For example:<br>
> -      if (x < 3)<br>
> -         x = 0;<br>
> -      int y = x * x;<br>
> -  This will not compile with MSVC.  The 'int y' declaration must be at the<br>
> -  top of the brace-block.<br>
> -* Don't use named/designated initializers.  They don't compile with MSVC.<br>
> -<br>
> +* Always declare GL entrypoint pointer type with APIENTRY, or use piglit<br>
> +  dispatch typedef<br>
><br>
>   Test conventions:<br>
><br>
> diff --git a/README b/README<br>
> index 43bdfcae7..9d30bcc30 100644<br>
> --- a/README<br>
> +++ b/README<br>
> @@ -150,83 +150,51 @@ Configure and build.<br>
>   2.5 Windows<br>
>   -----------<br>
><br>
> -Install Python.<br>
> +Install Python 3.<br>
>   <a href="http://www.python.org/download">http://www.python.org/download</a><br>
><br>
> -Install NumPy.<br>
> -http://sourceforge.net/projects/numpy/files/NumPy<br>
> -<br>
>   Install CMake.<br>
>   <a href="http://cmake.org/cmake/resources/software.html">http://cmake.org/cmake/resources/software.html</a><br>
>   Download and install 'Windows' platform.<br>
><br>
> -Install Microsoft Visual Studio 2013 or later.<br>
> -Install 'Visual C++' feature.<br>
> +Download and install Ninja<br>
> +https://github.com/ninja-build/ninja/releases<br>
> +<br>
> +Install MinGW-w64<br>
> +https://mingw-w64.org/<br>
><br>
>   Download OpenGL Core API and Extension Header Files.<br>
>   <a href="http://www.opengl.org/registry/#headers">http://www.opengl.org/registry/#headers</a><br>
> -Copy header files to MSVC.<br>
> -C:\Program Files\Microsoft Visual Studio 12.0\VC\include\GL<br>
> -<br>
> -Install pip.<br>
> -http://www.pip-installer.org/en/latest/installing.html<br>
> +Pass -DGLEXT_INCLUDE_DIR=/path/to/headers<br>
><br>
>   Install python mako.<br>
> -  > c:\Python27\Scripts\pip.exe install mako<br>
> +> pip install mako<br>
> +<br>
> +Install NumPy.<br>
> +> pip install numpy<br>
><br>
><br>
>   2.5.1 GLUT<br>
>   ----------<br>
><br>
> -Download freeglut for MSVC.<br>
> -http://www.transmissionzero.co.uk/software/freeglut-devel<br>
> +Download freeglut for Mingw.<br>
> +http://www.transmissionzero.co.uk/software/freeglut-devel/<br>
><br>
> -Open Visual Studio Command Prompt.<br>
> -Start Menu->All Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x86 Native Tools Command Prompt<br>
> -CD to piglit directory.<br>
> +> cmake -H. -Bbuild -G "Ninja" -DGLEXT_INCLUDE_DIR=\path\to\glext -DGLUT_INCLUDE_DIR=\path\to\freeglut\include -DGLUT_glut_LIBRARY=\path\to\freeglut\lib\x64\libfreeglut.a -DGLEXT_INCLUDE_DIR=\path\to\glext<br>
> +> ninja -C build<br>
><br>
> -Run CMake GUI.<br>
> -  > C:\Program Files\CMake 2.8\bin\cmake-gui.exe .<br>
> -Configure<br>
> -  - NMake Makefiles<br>
> -  - Use default native compilers<br>
> -Set these variables in the Advanced view.<br>
> -  - GLUT_INCLUDE_DIR<br>
> -  - GLUT_glut_LIBRARY<br>
> -Configure<br>
> -Generate<br>
> -File->Exit<br>
> -<br>
> -Build from the Visual Studio Command Prompt.<br>
> -  > nmake<br>
><br>
>   2.5.2 Waffle<br>
>   ------------<br>
><br>
> -Download waffle for MSVC.<br>
> +Download and build waffle for MinGW.<br>
>   <a href="http://www.waffle-gl.org/">http://www.waffle-gl.org/</a><br>
><br>
>   Open the Command Prompt.<br>
>   CD to piglit directory.<br>
><br>
> -Run CMake GUI.<br>
> -  > C:\Program Files\CMake 2.8\bin\cmake-gui.exe .<br>
> -Configure<br>
> -  - 'Visual Studio 12 2013', or<br>
> -  - 'Visual Studio 12 2013 Win64'<br>
> -  - Use default native compilers<br>
> -Set these variables in the Advanced view.<br>
> -Note that the values provided are for reference purposed and may differ on your system.<br>
> -  - PIGLIT_USE_WAFFLE, BOOL, TRUE<br>
> -  - WAFFLE_INCLUDE_DIRS, PATH, ${waffle_root}\include\waffle<br>
> -  - WAFFLE_LDFLAGS, FILEPATH, ${waffle_root}\lib\waffle-1.lib<br>
> -  - GLEXT_INCLUDE_DIR, PATH, C:\Program Files\Microsoft Visual Studio 12.0\VC\include\GL<br>
> -Configure<br>
> -Generate<br>
> -File->Exit<br>
> -<br>
> -Build from the Command Prompt.<br>
> -  > cmake --build .<br>
> +> cmake -H. -Bbuild -G "Ninja" -DGLEXT_INCLUDE_DIR=\path\to\glext -DPIGLIT_USE_WAFFLE=TRUE -DWAFFLE_INCLUDE_DIRS=\path\to\waffle\include\waffle WAFFLE_LDFLAGS=\path\to\waffle\lib\libwaffle-1.a<br>
> +<br>
><br>
>   3. How to run tests<br>
>   -------------------<br>
> diff --git a/appveyor.yml b/appveyor.yml<br>
> index 302308599..5f6faec85 100644<br>
> --- a/appveyor.yml<br>
> +++ b/appveyor.yml<br>
> @@ -49,12 +49,6 @@ environment:<br>
>     - MINGW_HOME: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64<br>
>       FREEGLUT_ARCHIVE: freeglut-MinGW-3.0.0-1.mp.zip<br>
>       FREEGLUT_LIB: lib\x64\libfreeglut.a<br>
> -# - MSVC_ARCH: x86<br>
> -#   FREEGLUT_ARCHIVE: freeglut-MSVC-3.0.0-2.mp.zip<br>
> -#   FREEGLUT_LIB: lib\freeglut.lib<br>
> -# - MSVC_ARCH: x86_amd64<br>
> -#   FREEGLUT_ARCHIVE: freeglut-MSVC-3.0.0-2.mp.zip<br>
> -#   FREEGLUT_LIB: lib\x64\freeglut.lib<br>
><br>
>   matrix:<br>
>     fast_finish: true<br>
> @@ -76,8 +70,6 @@ install:<br>
>   - ninja --version<br>
>   # Setup MinGW<br>
>   - if not "%MINGW_HOME%"=="" set Path=%MINGW_HOME%\bin;%Path%<br>
> -# Setup MSVC<br>
> -- if not "%MSVC_ARCH%"=="" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %MSVC_ARCH%<br>
>   # Install FreeGlut<br>
>   - if not exist "%FREEGLUT_ARCHIVE%" appveyor DownloadFile "<a href="http://files.transmissionzero.co.uk/software/development/GLUT/%FREEGLUT_ARCHIVE%">http://files.transmissionzero.co.uk/software/development/GLUT/%FREEGLUT_ARCHIVE%</a>"<br>
>   - 7z x -y "%FREEGLUT_ARCHIVE%" > nul<br>
> diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt<br>
> index 7f786eed1..1dbd953e5 100644<br>
> --- a/tests/shaders/CMakeLists.gl.txt<br>
> +++ b/tests/shaders/CMakeLists.gl.txt<br>
> @@ -79,10 +79,7 @@ piglit_add_executable (glsl-fs-fragcoord-zw-ortho glsl-fs-fragcoord-zw-ortho.c)<br>
>   piglit_add_executable (glsl-fs-fragcoord-zw-perspective glsl-fs-fragcoord-zw-perspective.c)<br>
>   piglit_add_executable (glsl-fs-loop glsl-fs-loop.c)<br>
>   piglit_add_executable (glsl-fs-loop-nested glsl-fs-loop-nested.c)<br>
> -# MSVC fails with "string exceeds 65535 bytes in length" error<br>
> -IF (NOT MSVC)<br>
> -     piglit_add_executable (glsl-fs-raytrace-bug27060 glsl-fs-raytrace-bug27060.c)<br>
> -ENDIF ()<br>
> +piglit_add_executable (glsl-fs-raytrace-bug27060 glsl-fs-raytrace-bug27060.c)<br>
>   piglit_add_executable (glsl-fs-sampler-numbering glsl-fs-sampler-numbering.c)<br>
>   piglit_add_executable (glsl-fs-shader-stencil-export glsl-fs-shader-stencil-export.c)<br>
>   piglit_add_executable (glsl-fs-sqrt-branch glsl-fs-sqrt-branch.c)<br>
> @@ -102,10 +99,7 @@ piglit_add_executable (glsl-fs-pointcoord glsl-fs-pointcoord.c)<br>
>   piglit_add_executable (glsl-vs-if-bool glsl-vs-if-bool.c)<br>
>   piglit_add_executable (glsl-vs-loop glsl-vs-loop.c)<br>
>   piglit_add_executable (glsl-vs-loop-nested glsl-vs-loop-nested.c)<br>
> -# MSVC fails with "string exceeds 65535 bytes in length" error<br>
> -IF (NOT MSVC)<br>
> -     piglit_add_executable (glsl-vs-raytrace-bug26691 glsl-vs-raytrace-bug26691.c)<br>
> -ENDIF ()<br>
> +piglit_add_executable (glsl-vs-raytrace-bug26691 glsl-vs-raytrace-bug26691.c)<br>
>   piglit_add_executable (glsl-vs-statechange-1 glsl-vs-statechange-1.c)<br>
>   piglit_add_executable (glsl-vs-user-varying-ff glsl-vs-user-varying-ff.c)<br>
>   piglit_add_executable (glsl-light-model glsl-light-model.c)<br>
> diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c<br>
> index 15a178b08..e33d055f2 100644<br>
> --- a/tests/util/piglit-util.c<br>
> +++ b/tests/util/piglit-util.c<br>
> @@ -29,7 +29,6 @@<br>
>   #endif<br>
><br>
>   #ifdef __linux__<br>
> -#include <unistd.h><br>
>   #include <sys/types.h><br>
>   #include <sys/syscall.h><br>
>   #endif<br>
> @@ -64,6 +63,10 @@<br>
>   # define USE_STDIO<br>
>   #endif<br>
><br>
> +#if defined(HAVE_UNISTD_H)<br>
> +#include <unistd.h>  // for usleep<br>
> +#endif<br>
> +<br>
>   #include "piglit-util.h"<br>
><br>
><br>
> @@ -116,35 +119,6 @@ int asprintf(char **strp, const char *fmt, ...)<br>
><br>
>   #endif /* HAVE_ASPRINTF */<br>
><br>
> -#ifdef _MSC_VER<br>
> -<br>
> -char *<br>
> -basename(char *path)<br>
> -{<br>
> -     char *res;<br>
> -<br>
> -     // Skip drive letter<br>
> -     if (path[0] != '\0' && path[1] == ':') {<br>
> -             path += 2;<br>
> -     }<br>
> -<br>
> -     // Return pointer to the char after the last directory separator<br>
> -     res = path;<br>
> -     while (true) {<br>
> -             char c = *path++;<br>
> -             switch (c) {<br>
> -             case '\0':<br>
> -                     return res;<br>
> -             case '\\':<br>
> -             case '/':<br>
> -                     res = ++path;<br>
> -                     break;<br>
> -             }<br>
> -     }<br>
> -}<br>
> -<br>
> -#endif /* _MSC_VER */<br>
> -<br>
>   /**<br>
>    * \brief Split \a string into an array of strings.<br>
>    *<br>
> @@ -343,12 +317,6 @@ piglit_disable_error_message_boxes(void)<br>
>                 * <a href="http://msdn.microsoft.com/en-us/library/sas1dkb2.aspx">
http://msdn.microsoft.com/en-us/library/sas1dkb2.aspx</a><br>
>                 */<br>
>                _set_error_mode(_OUT_TO_STDERR);<br>
> -#ifdef _MSC_VER<br>
> -             /* Disable abort message box.<br>
> -              * <a href="http://msdn.microsoft.com/en-us/library/e631wekh.aspx">
http://msdn.microsoft.com/en-us/library/e631wekh.aspx</a><br>
> -              */<br>
> -             _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);<br>
> -#endif<br>
>        }<br>
>   #endif /* _WIN32 */<br>
>   }<br>
> diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h<br>
> index ad00817a1..c4e781808 100644<br>
> --- a/tests/util/piglit-util.h<br>
> +++ b/tests/util/piglit-util.h<br>
> @@ -61,31 +61,6 @@ extern "C" {<br>
>   #define __has_attribute(x) 0<br>
>   #endif<br>
><br>
> -#if defined(_MSC_VER)<br>
> -<br>
> -/* windows.h won't define min/max macros if NOMINMAX is defined, however<br>
> - * stdlib.h will still define them for C files regardless... */<br>
> -#undef max<br>
> -#undef min<br>
> -<br>
> -#if !defined(__cplusplus) && !defined(inline)<br>
> -#define inline __inline<br>
> -#endif<br>
> -<br>
> -#if !defined(__func__)<br>
> -#define __func__ __FUNCTION__<br>
> -#endif<br>
> -<br>
> -#define snprintf _snprintf<br>
> -<br>
> -#define alloca _alloca<br>
> -<br>
> -#define usleep(__usec) Sleep(((__usec) + 999)/1000)<br>
> -<br>
> -char *basename(char *path);<br>
> -<br>
> -#endif /* defined(_MSC_VER) */<br>
> -<br>
>   #if (__GNUC__ >= 3)<br>
>   #define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))<br>
>   #else<br>
> @@ -94,8 +69,6 @@ char *basename(char *path);<br>
><br>
>   #if defined(__GNUC__) || __has_attribute(noreturn)<br>
>   #define NORETURN __attribute__((noreturn))<br>
> -#elif defined(_MSC_VER)<br>
> -#define NORETURN __declspec(noreturn)<br>
>   #else<br>
>   #define NORETURN<br>
>   #endif<br>
> @@ -253,28 +226,6 @@ streq(const char *a, const char *b)<br>
>   static inline double<br>
>   strtod_inf(const char *nptr, char **endptr)<br>
>   {<br>
> -#if defined(_MSC_VER)<br>
> -     /* skip spaces and tabs */<br>
> -     while (*nptr == ' ' || *nptr == '\t')<br>
> -             nptr++;<br>
> -<br>
> -#pragma warning( push )<br>
> -#pragma warning( disable : 4056 ) // overflow in floating-point constant arithmetic<br>
> -#pragma warning( disable : 4756 ) // overflow in constant arithmetic<br>
> -     if (nptr[0] == 'i' && nptr[1] == 'n' && nptr[2] == 'f') {<br>
> -             /* +infinity */<br>
> -             *endptr = (char *) (nptr + 3);<br>
> -             return INFINITY;<br>
> -     }<br>
> -     else if (nptr[0] == '-' && nptr[1] == 'i' && nptr[2] == 'n' && nptr[3] == 'f') {<br>
> -             /* -infinity */<br>
> -             *endptr = (char *) (nptr + 4);<br>
> -             return -INFINITY;<br>
> -     }<br>
> -#pragma warning( pop )<br>
> -<br>
> -     /* fall-through */<br>
> -#endif<br>
>        return strtod(nptr, endptr);<br>
>   }<br>
><br>
> @@ -354,11 +305,7 @@ strtol_hex(const char *nptr, char **endptr)<br>
>   static inline char *<br>
>   strchrnul(const char *s, int c)<br>
>   {<br>
> -#if defined(_MSC_VER) && defined(__cplusplus)<br>
> -     char *t = strchr((char *)s, c);<br>
> -#else<br>
>        char *t = strchr(s, c);<br>
> -#endif<br>
><br>
>        return (t == NULL) ? ((char *) s + strlen(s)) : t;<br>
>   }<br>
><br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>