I was thrilled to hear that also the official version of Open CASCADE will support MinGW-w64 from version 7.0.0 on. Since we do software development both on Windows and on Linux computers, it is useful to use the same compiler on both systems (up to now we have used the Open CASCADE Community Edition to achieve this). I have been able to compile OCCT with MinGW-w64, also when the additional libraries FreeImage and Gl2Ps are enabled and I would like to share some of my experiences.
Our software source code was the same for both compilers. It uses OpenMP, therefore OpenMP has been activated for both compilers.
I have used Visual Studio 2015 which seems to be named also "Microsoft Visual Studio 14.0" and the compiler prints the version number 19.00.23506. I have compiled 64 bit executables by using "vcvarsall.bat amd64" before project setup and compilation. For compiling OCCT I have created NMake make files with CMake and I have stuck to the default compilation flags. Our code I have compiled with the compile flags proposed by qmake (the most important being probably "-O2").
I have used MinGW-w64 4.2.0 (at least this is written in the file build-info.txt) which used g++ 5.2.0 as compiler. I have compiled OCCT with CMake and MSys Makefiles. Again I have stuck to the default compilation flags ("-O3") for OCCT and our code, but I have also checked the alternative "-O2".
Algorithm 1: Solve a second order ordinary differential equation of a B-Spline surface (many D2 evaluations).
Algorithm 2: Compute special curves over a B-Spline surface (projections, intersection computations and D0, D1, D2 evaluations).
I have ensured that the programs are really 64-bit programs by looking at the task manager. Then I have executed the algorithms times for each configuration, measured the execution time with std::chrono and computed the average execution time. Compilation times I have just measured once.
OCCT Compilation Times:
MSVC: 104 minutes
MinGW-w64 with "-O3": 137 minutes
Algorithm 1 Execution Time on a Flat Surface:
MSVC: 0.47 s
MinGW-w64 with "-O2": 0.31 s
MinGW-w64 with "-O3": 0.32 s
Algorithm 2 Execution Time on a Flat Surface:
MSVC: 2.50 s
MinGW-w64 with "-O2": 1.79 s
MinGW-w64 with "-O3": 1.78 s
Algorithm 1 Execution Time on a Curved Surface:
MSVC: 8.55 s
MinGW-w64 with "-O2": 7.77 s
MinGW-w64 with "-O3": 7.35 s
Algorithm 2 Execution Time on a Curved Surface:
MinGW-w64 with "-O2": 29.76 s
MinGW-w64 with "-O3": 29.43 s
OCCT DLL Sizes:
MSVC: 55.126.016 Bytes
MinGW-w64 with "-O2": 55.881.216 Bytes
MinGW-w64 with "-O3": 59.709.952 Bytes
MSVC is doing the compilation job significantly faster than MinGW-w64. The DLL sizes are comparable, if optimization is set to "-O2" for MinGW-w64, with "-O3" the DLLs from MinGW-w64 are larger. Binary files compiled with MinGW-w64 are performing significantly better than those compiled with MSVC.
I have tried to use link-time optimization with MinGW-w64, but I have failed. If anyone knows how to do that, I would greatly appreciate any hint.