mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +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:
@@ -193,7 +193,7 @@ LRESULT APIENTRY EditProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
char buffer[COMMANDSIZE];
|
||||
POINT pos;
|
||||
BOOL rep;
|
||||
BOOL rep = 0;
|
||||
static LRESULT nbline; // Process the buffer of the edit window
|
||||
LRESULT index;
|
||||
|
||||
|
@@ -491,7 +491,7 @@ void Draw::Load(Draw_Interpretor& theDI, const TCollection_AsciiString& theKey,
|
||||
}
|
||||
|
||||
TCollection_AsciiString aPluginLibrary("");
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) || defined(__MINGW32__)
|
||||
aPluginLibrary += "lib";
|
||||
#endif
|
||||
aPluginLibrary += aPluginResource->Value(theKey.ToCString());
|
||||
|
@@ -14,7 +14,7 @@
|
||||
commercial license or contractual agreement.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
|
@@ -334,7 +334,7 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
|
||||
di << "Cygwin\n";
|
||||
#endif
|
||||
#if defined(__MINGW64__)
|
||||
di << "MinGW 64 " << __MINGW64_MAJOR_VERSION << "." << __MINGW64_MINOR_VERSION << "\n";
|
||||
di << "MinGW 64 " << __MINGW64_VERSION_MAJOR << "." << __MINGW64_VERSION_MINOR << "\n";
|
||||
#elif defined(__MINGW32__)
|
||||
di << "MinGW 32 " << __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION << "\n";
|
||||
#endif
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
// for capturing of cout and cerr (dup(), dup2())
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
@@ -86,8 +86,13 @@ namespace {
|
||||
return;
|
||||
|
||||
// restore normal descriptors of console stream
|
||||
#ifdef _WIN32
|
||||
_dup2(save_fd, std_fd);
|
||||
_close(save_fd);
|
||||
#else
|
||||
dup2(save_fd, std_fd);
|
||||
close(save_fd);
|
||||
#endif
|
||||
|
||||
// extract all output and copy it to log and optionally to cout
|
||||
const int BUFSIZE = 2048;
|
||||
|
@@ -63,13 +63,6 @@
|
||||
|
||||
extern Draw_Viewer dout;
|
||||
|
||||
static char* ColorNames[MAXCOLOR] = {
|
||||
"White","Red","Green","Blue","Cyan","Gold","Magenta",
|
||||
"Maroon","Orange","Pink","Salmon","Violet","Yellow","Khaki","Coral"
|
||||
};
|
||||
|
||||
static Standard_Boolean XLoop;
|
||||
|
||||
// extern Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C21
|
||||
Standard_IMPORT Standard_Boolean Draw_Interprete(const char* command); //for C30
|
||||
// true if complete command
|
||||
|
@@ -1430,7 +1430,7 @@ DrawWindow::DrawWindow() :
|
||||
}
|
||||
|
||||
//________________________
|
||||
DrawWindow::DrawWindow(char* title,
|
||||
DrawWindow::DrawWindow(const char* title,
|
||||
Standard_Integer X, Standard_Integer Y,
|
||||
Standard_Integer dX,Standard_Integer dY) :
|
||||
win(0), next(firstWindow), previous(NULL), myMemHbm(NULL), myUseBuffer(Standard_False)
|
||||
@@ -1440,7 +1440,7 @@ DrawWindow::DrawWindow(char* title,
|
||||
Init(X, Y, dX, dY);
|
||||
SetTitle(title);
|
||||
}
|
||||
DrawWindow::DrawWindow(char* title,
|
||||
DrawWindow::DrawWindow(const char* title,
|
||||
Standard_Integer X, Standard_Integer Y,
|
||||
Standard_Integer dX,Standard_Integer dY,
|
||||
HWND theWin) :
|
||||
@@ -1657,7 +1657,7 @@ Standard_Integer DrawWindow::WidthWin() const
|
||||
/*--------------------------------------------------------*\
|
||||
| SetTitle
|
||||
\*--------------------------------------------------------*/
|
||||
void DrawWindow::SetTitle(char* title)
|
||||
void DrawWindow::SetTitle(const char* title)
|
||||
{
|
||||
SetWindowText(win, title);
|
||||
}
|
||||
|
@@ -417,12 +417,12 @@ public:
|
||||
Standard_EXPORT static void RemoveCallbackBeforeTerminate(FCallbackBeforeTerminate theCB);
|
||||
|
||||
__Draw_API DrawWindow();
|
||||
__Draw_API DrawWindow(char*, Standard_Integer, Standard_Integer,
|
||||
__Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer,
|
||||
Standard_Integer, Standard_Integer);
|
||||
__Draw_API DrawWindow(char*, Standard_Integer, Standard_Integer,
|
||||
__Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer,
|
||||
Standard_Integer, Standard_Integer, HWND);
|
||||
//destructeur
|
||||
__Draw_API ~DrawWindow();
|
||||
__Draw_API virtual ~DrawWindow();
|
||||
|
||||
//methods
|
||||
public:
|
||||
@@ -432,7 +432,7 @@ public:
|
||||
__Draw_API void SetUseBuffer(Standard_Boolean);
|
||||
// Turns on/off usage of off-screen image buffer (can be used for redrawing optimization)
|
||||
|
||||
__Draw_API Standard_Boolean GetUseBuffer() const { return myUseBuffer; }
|
||||
Standard_Boolean GetUseBuffer() const { return myUseBuffer; }
|
||||
// Returns Standard_True if off-screen image buffer is being used
|
||||
|
||||
//taille et position
|
||||
@@ -443,7 +443,7 @@ public:
|
||||
__Draw_API Standard_Integer WidthWin() const;
|
||||
|
||||
//Title
|
||||
__Draw_API void SetTitle(char*);
|
||||
__Draw_API void SetTitle(const char*);
|
||||
__Draw_API char* GetTitle();
|
||||
|
||||
//Affichage
|
||||
@@ -451,7 +451,7 @@ public:
|
||||
__Draw_API void Hide();
|
||||
__Draw_API void Destroy();
|
||||
__Draw_API void Clear();
|
||||
__Draw_API static void Flush() {} ;
|
||||
static void Flush() {} ;
|
||||
|
||||
// save snapshot
|
||||
__Draw_API Standard_Boolean Save(const char* theFileName) const;
|
||||
|
Reference in New Issue
Block a user