mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0031070: Configuration - fix building issues when using Emscripten toolchain
Handled __EMSCRIPTEN__ macros to: - Workaround atomics (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 is undefined, but GCC atomics are provided). - Suppress non-standard header <sys/signal.h> warning. - Return OSD_LinuxREDHAT. - Avoid inclusion of XLib headers. - Skip fontconfig library. - Enable EGL+GLES path (translated by Emscripten into WebGL). - Skip eglCreatePbufferSurface() not implemented by Emscripten EGL. Fixed Graphic3d_Vec4.hxx usage within Quantity_ColorRGBA.hxx. OpenGl_ShaderManager::defaultGlslVersion() now prefers GLSL 300 es when WebGL 2.0 is available, as there no any OpenGL ES greater than 3.0 emulation so far. Shaders_Declarations.glsl - added workaround for GLSL compilation on WebGL 1.0 by defining Light properties accessors as macros instead of functions ('[]' : Index expression must be constant). OpenGl_FrameBuffer::Init() - added workaround for initialization of GL_DEPTH24_STENCIL8 depth-stencil attachment on WebGL 1.0 + GL_WEBGL_depth_texture extension. OpenGl_Context::Vec4FromQuantityColor() now considers myIsSRgbActive flag to handle use case, when Immediate Layer is drawn directly into window buffer, which is not sRGB-ready. Added new sample - OCCT WebGL viewer.
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
void OSD_Chronometer::GetProcessCPU (Standard_Real& theUserSeconds,
|
||||
Standard_Real& theSystemSeconds)
|
||||
{
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__ANDROID__) || defined(__QNX__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
|
||||
static const long aCLK_TCK = sysconf(_SC_CLK_TCK);
|
||||
#else
|
||||
static const long aCLK_TCK = CLK_TCK;
|
||||
|
@@ -116,7 +116,15 @@ void OSD_MemInfo::Update()
|
||||
myCounters[MemHeapUsage] += hinfo._size;
|
||||
}
|
||||
|
||||
#elif (defined(__linux__) || defined(__linux))
|
||||
#elif (defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__))
|
||||
const struct mallinfo aMI = mallinfo();
|
||||
myCounters[MemHeapUsage] = aMI.uordblks;
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
// /proc/%d/status is not emulated - get more info from mallinfo()
|
||||
myCounters[MemWorkingSet] = aMI.uordblks;
|
||||
myCounters[MemWorkingSetPeak] = aMI.usmblks;
|
||||
#endif
|
||||
|
||||
// use procfs on Linux
|
||||
char aBuff[4096];
|
||||
snprintf (aBuff, sizeof(aBuff), "/proc/%d/status", getpid());
|
||||
@@ -162,10 +170,6 @@ void OSD_MemInfo::Update()
|
||||
}
|
||||
}
|
||||
aFile.close();
|
||||
|
||||
struct mallinfo aMI = mallinfo();
|
||||
myCounters[MemHeapUsage] = aMI.uordblks;
|
||||
|
||||
#elif (defined(__APPLE__))
|
||||
struct task_basic_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_BASIC_INFO_COUNT;
|
||||
|
@@ -39,6 +39,8 @@ static OSD_SysType whereAmI()
|
||||
return OSD_VMS;
|
||||
#elif defined(__linux__) || defined(__linux)
|
||||
return OSD_LinuxREDHAT;
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
return OSD_LinuxREDHAT;
|
||||
#elif defined(_AIX) || defined(AIX)
|
||||
return OSD_Aix;
|
||||
#else
|
||||
|
@@ -703,7 +703,7 @@ typedef void (* SIG_PFV) (int);
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#if !defined(__ANDROID__) && !defined(__QNX__)
|
||||
#if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
#include <sys/signal.h>
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user