1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0027197: Configuration - fix compilation issues when using mingw

AIS_ColorScale, AIS_Dimension - the protected method DrawText()
has been renamed to drawText() to avoid name collisions with macros.

_MSC_VER/_WIN32 misuse has been fixed in several places.
Header <malloc.h> is now included where alloca() is used.
Draw_Window - dllimport flag has been dropped from inline methods.

TKernel - mandatory dependencies Winspool.lib and Psapi.lib
are now linked explicitly (instead of msvc-specific pragma syntax).

CMake scripts - the option -std=c++0x has been replaced by -std=gnu++0x
for mingw to allow extensions (like _wfopen() and others).
The minimum Windows version has been set to _WIN32_WINNT=0x0501.
Invalid options "-z defs" and "-lm" have been dropped for mingw.
Flag --export-all-symbols has been added to CMAKE_SHARED_LINKER_FLAGS
to workaround missing vtable symbols when using mingw.
FreeType is now linked explicitly on Windows.

Draw::Load() - "lib" suffix is now prepended on mingw as well.

Drop redundant declaration of _TINT from OSD_WNT_1.hxx.
NCollection_UtfString::FromLocale() - platform-specific code has been moved to .cxx file.
Draw_BasicCommands - fixed incorrect mingw64 version macros.

genproj, cbp - added workaround for process argument list limits on Windows.
TKSTEP linkage is failing on this platform due to too long list of files.
The list of object files to link is now stored in dedicated file which is passed to gcc.

Option "-z defs" removed from CMake linker options to avoid problems when building with different configurations of VTK on Linux

Some MinGW-specific compiler warnings (potentially uninitialized vars, use of NULL, parentheses in conditional expressions) are fixed (speculatively)
This commit is contained in:
kgv
2016-02-28 02:07:27 +03:00
committed by abv
parent 8582eb08cc
commit 7c65581dd3
69 changed files with 624 additions and 422 deletions

View File

@@ -84,7 +84,7 @@ Standard_MMgrFactory::Standard_MMgrFactory()
aVar = getenv ("MMGT_OPT");
Standard_Integer anAllocId = (aVar ? atoi (aVar): OCCT_MMGT_OPT_DEFAULT);
#if defined(_WIN32) && !defined(_WIN64)
#if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__)
static const DWORD _SSE2_FEATURE_BIT(0x04000000);
if ( anAllocId == 2 )
{

View File

@@ -72,7 +72,7 @@ inline void Standard_ASSERT_DO_NOTHING() {}
// User messages are activated in debug mode only
#ifdef _DEBUG
#if (defined(_WIN32) || defined(__WIN32__))
#if defined(_MSC_VER)
#if defined(_MSC_VER) || defined(__MINGW64__)
// VS-specific intrinsic
#define Standard_ASSERT_DBGBREAK_() __debugbreak()
#else

View File

@@ -32,7 +32,7 @@ namespace
CLocalePtr()
#ifdef HAVE_XLOCALE_H
: myLocale (newlocale (LC_ALL_MASK, "C", NULL))
#elif defined(_WIN32)
#elif defined(_WIN32) && !defined(__MINGW32__)
: myLocale (_create_locale (LC_ALL, "C"))
#else
: myLocale (NULL)
@@ -43,7 +43,7 @@ namespace
{
#ifdef HAVE_XLOCALE_H
freelocale (myLocale);
#elif defined(_WIN32)
#elif defined(_WIN32) && !defined(__MINGW32__)
_free_locale (myLocale);
#endif
}

View File

@@ -65,7 +65,7 @@ public:
#ifdef HAVE_XLOCALE_H
typedef locale_t clocale_t;
#elif defined(_WIN32)
#elif defined(_WIN32) && !defined(__MINGW32__)
typedef _locale_t clocale_t;
#else
typedef void* clocale_t;

View File

@@ -63,7 +63,7 @@ Standard_Integer HashCodes (const Standard_CString Value,
#ifdef __APPLE__
// There are a lot of *_l functions availalbe on Mac OS X - we use them
#define SAVE_TL()
#elif defined(_WIN32)
#elif defined(_WIN32) && !defined(__MINGW32__)
// MSVCRT has equivalents with slightly different syntax
#define SAVE_TL()
#define strtod_l(thePtr, theNextPtr, theLocale) _strtod_l(thePtr, theNextPtr, theLocale)
@@ -80,7 +80,7 @@ Standard_Integer HashCodes (const Standard_CString Value,
// glibc version for android platform use locale-independent implementation of
// strtod, strtol, strtoll functions. For other system with locale-depended
// implementations problems may appear if "C" locale is not set explicitly.
#if !defined(__ANDROID__) && !defined(__QNX__)
#if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__MINGW32__)
#error System does not support xlocale. Import/export could be broken if C locale did not specified by application.
#endif
#define strtod_l(thePtr, theNextPtr, theLocale) strtod(thePtr, theNextPtr)

View File

@@ -17,7 +17,7 @@
#ifndef _Standard_values_HeaderFile
# define _Standard_values_HeaderFile
#ifdef _WIN32
#if defined(_MSC_VER)
# include <limits>
#else
# include <limits.h>