Code has been adjusted to suppress -Wunused-but-set-variable warnings.
DRAWEXE.wasm, compiler flags have been moved to linker flags
to eliminiate -Wunused-command-line-argument warnings.
echo Start building OCCT for %aPlatformAndCompiler%
echo Start building OCCT for %aPlatformAndCompiler%>> %aLogFile%
+echo --->> %aLogFile%
+call emcc --version >> %aLogFile%
+echo --->> %aLogFile%
+
pushd "%aWorkDir%"
set "aTimeZERO=%TIME%"
endif()
# customize build
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s MAX_WEBGL_VERSION=2")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --bind")
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s SAFE_HEAP=1")
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1")
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s TOTAL_MEMORY=16MB")
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ABORTING_MALLOC=0")
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FORCE_FILESYSTEM=1")
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --preload-file myFile")
if (NOT "${SOURCE_MAP_BASE}" STREQUAL "")
set(CMAKE_CXX_FLAGS_DEBUG "-g4 --source-map-base ${SOURCE_MAP_BASE}")
endif()
+
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM=1")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s MAX_WEBGL_VERSION=2")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s MODULARIZE=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORT_NAME='createOccViewerModule'")
+
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
+#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_MEMORY=16MB")
+
+#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --preload-file myFile")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --extern-post-js ${CMAKE_CURRENT_SOURCE_DIR}/occt-webgl-viewer.js")
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of the examples of the Open CASCADE Technology software library.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
+
#include <iostream>
#include "WasmOcctView.h"
Message::DefaultMessenger()->Printers().First()->SetTraceLevel (Message_Trace);
Handle(Message_PrinterSystemLog) aJSConsolePrinter = new Message_PrinterSystemLog ("webgl-sample", Message_Trace);
Message::DefaultMessenger()->AddPrinter (aJSConsolePrinter); // open JavaScript console within the Browser to see this output
- Message::DefaultMessenger()->Send (TCollection_AsciiString("NbLogicalProcessors: ") + OSD_Parallel::NbLogicalProcessors(), Message_Trace);
+ Message::SendTrace() << "Emscripten SDK " << __EMSCRIPTEN_major__ << "." << __EMSCRIPTEN_minor__ << "." << __EMSCRIPTEN_tiny__;
+#if defined(__LP64__)
+ Message::SendTrace() << "Architecture: WASM 64-bit";
+#else
+ Message::SendTrace() << "Architecture: WASM 32-bit";
+#endif
+ Message::SendTrace() << "NbLogicalProcessors: "
+ << OSD_Parallel::NbLogicalProcessors()
+#ifdef __EMSCRIPTEN_PTHREADS__
+ << " (pthreads ON)"
+#else
+ << " (pthreads OFF)"
+#endif
+ ;
// setup a dummy single-shot main loop callback just to shut up a useless Emscripten error message on calling eglSwapInterval()
emscripten_set_main_loop (onMainLoop, -1, 0);
/* READING OF THE LANGUAGE : */
/* Parameter adjustments */
ct -= ct_len;
+ (void )ct; // unused
+
--xt;
--it;
NCollection_Array1<gp_Pnt>& theFix)
{
Standard_Integer aMaxIter = 15;
- Standard_Integer j, i2;
NCollection_Array1<gp_Pnt> aTabP(1, Max (myNbP, 1)), aPrevP(1, Max (myNbP, 1));
NCollection_Array1<gp_Pnt2d> aTabP2d(1, Max (myNbP2d, 1)), aPrevP2d(1, Max (myNbP2d, 1));
Standard_Real aMult = ((theU - theU0) > (theU1 - theU)) ? 1.0: -1.0;
{
aCurrDist = 0.0;
- i2 = 1;
- for (j = 1; j <= myNbP; j++)
+ Standard_Integer i2 = 1;
+ for (Standard_Integer j = 1; j <= myNbP; j++)
{
aCurrDist += aTabP(j).Distance(aPrevP(j));
i2 += 3;
}
- for (j = 1; j <= myNbP2d; j++)
+ for (Standard_Integer j = 1; j <= myNbP2d; j++)
{
aCurrDist += aTabP2d(j).Distance(aPrevP2d(j));
i2 += 2;
}
+ (void )i2; // unused but set for debug
// from the third iteration
if (anIter > 2 && aCurrDist / aPrevDist > 10.0)
static Standard_Integer deform(Draw_Interpretor& di,Standard_Integer n,const char** a)
{
- if (n <= 1) return 1;
-
- Standard_Integer last = n;
-
+ if (n != 6)
+ {
+ di << "Syntax error: wrong number of arguments";
+ return 1;
+ }
+
gp_Trsf T;
gp_GTrsf GT(T);
-
+
// gp_Mat rot(Draw::Atof(a[last-3]),0,0,0,Draw::Atof(a[last-2]),0,0,0,Draw::Atof(a[last-1]));
gp_Mat rot(Draw::Atof(a[3]),0,0,0,Draw::Atof(a[4]),0,0,0,Draw::Atof(a[5]));
GT.SetVectorialPart(rot);
- last -= 3;
BRepBuilderAPI_GTransform gtrf(GT);
BRepBuilderAPI_NurbsConvert nbscv;
+ // Standard_Integer last = n - 3;
// for (Standard_Integer i = 1; i < last; i++) {
- // TopoDS_Shape S = DBRep::Get(a[i]);
- TopoDS_Shape S = DBRep::Get(a[2]);
- if (S.IsNull()) {
- //std::cout << a[2] << " is not a valid shape" << std::endl;
- di << a[2] << " is not a valid shape\n";
+ // TopoDS_Shape aShape = DBRep::Get(a[i]);
+ TopoDS_Shape aShape = DBRep::Get(a[2]);
+ if (aShape.IsNull())
+ {
+ di << "Syntax error: '" << a[2] << "' is not a valid shape";
+ return 1;
}
- else {
- gtrf.Perform(S);
- if (gtrf.IsDone()){
- DBRep::Set(a[1],gtrf.Shape());
- }
- else {
- return 1;
- }
+
+ gtrf.Perform (aShape);
+ if (!gtrf.IsDone())
+ {
+ di << "Error: transformation failed";
+ return 1;
}
-
+
+ DBRep::Set (a[1], gtrf.Shape());
return 0;
}
endif()
#message(STATUS "Tcl version: ${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}.${TCL_RELEASE_SERIAL}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s WASM=1")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s MAX_WEBGL_VERSION=2")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --bind")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s WASM=1")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s MAX_WEBGL_VERSION=2")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s MODULARIZE=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORT_NAME='createDRAWEXE'")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s \"EXTRA_EXPORTED_RUNTIME_METHODS=['FS']\"")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
+ #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s TOTAL_MEMORY=512MB")
+ if (EMSCRIPTEN_VERSION VERSION_GREATER_EQUAL "2.0.18")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s \"EXPORTED_RUNTIME_METHODS=['FS']\"")
+ else()
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s \"EXTRA_EXPORTED_RUNTIME_METHODS=['FS']\"")
+ endif()
# Embed Draw Harness .tcl scripts at recognizable location.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/../DrawResources@/DrawResources")
di << "Architecture: ARM 32-bit\n";
#endif
#elif defined(__EMSCRIPTEN__)
+ di << "Architecture: WASM "
#if defined(__LP64__)
- di << "Architecture: WASM 64-bit\n";
+ << "64-bit"
#else
- di << "Architecture: WASM 32-bit\n";
+ << "32-bit"
#endif
+ #if defined(__wasm_simd128__)
+ << " SIMD128"
+ #endif
+ << "\n";
#else
di << "Architecture: unrecognized\n";
#endif
#include <sys/param.h>
di << "OS: BSD (BSD = " << BSD << ")\n";
#elif defined(__EMSCRIPTEN__)
- di << "OS: WebAssembly (Emscripten SDK " << __EMSCRIPTEN_major__ << "." << __EMSCRIPTEN_minor__ << "." << __EMSCRIPTEN_tiny__ << ")\n";
+ di << "OS: WebAssembly (Emscripten SDK " << __EMSCRIPTEN_major__ << "." << __EMSCRIPTEN_minor__ << "." << __EMSCRIPTEN_tiny__
+ #ifdef __EMSCRIPTEN_PTHREADS__
+ << "; pthreads ON"
+ #else
+ << "; pthreads OFF"
+ #endif
+ << ")\n";
#else
di << "OS: unrecognized\n";
#endif
{ Standard_Integer NbPoint= (Standard_Integer )( NTPoint*(myLinCont->Value(i)->Length())/LenT);
if (NbPoint<10)
NbPoint=10;
- Npt+=NbPoint;
+
+ (void )Npt; // unused but set for debug
+ Npt += NbPoint;
}
// Table containing a cloud of points for calculation of the plane
Handle(TColgp_HArray1OfPnt) Pts = new TColgp_HArray1OfPnt(1,20*NTLinCont+NTPntCont);
EcartContraintesMil (i,tdist,tang,tcourb);
- Standard_Real diffDistMax=0,SdiffDist=0;
- Standard_Real diffAngMax=0,SdiffAng=0;
+ Standard_Real diffDistMax=0, diffAngMax=0;
+ //Standard_Real SdiffDist=0, SdiffAng=0;
Standard_Integer NdiffDist=0,NdiffAng=0;
diffDist = diffDist/LinCont->G0Criterion(U);
if (diffDist>diffDistMax)
diffDistMax = diffDist;
- SdiffDist+=diffDist;
+ //SdiffDist+=diffDist;
NdiffDist++;
#ifdef DRAW
if ((Affich) && (NbBoucle == myNbIter)) {
diffAng=diffAng/myLinCont->Value(i)->G1Criterion(U);
if (diffAng>diffAngMax)
diffAngMax = diffAng;
- SdiffAng+=diffAng;
+ //SdiffAng+=diffAng;
NdiffAng++;
#ifdef DRAW
if ((Affich) && (NbBoucle == myNbIter)) {
else if(Pos2 == IntRes2d_End) PosSegment|=8;
}
}
+ (void )PosSegment;
}
//======================================================================
Standard_Integer startp = (IsFirst) ? 2 : (Line->NbPoints() - NbTestPnts - 2);
Standard_Integer ip = 0;
- Standard_Real Uc = 0., Vc = 0., Un = 0., Vn = 0., DDU = 0., DDV = 0.;
+ Standard_Real Uc = 0., Vc = 0., Un = 0., Vn = 0., DDU = 0.;
+ //Standard_Real DDV = 0.;
for(ip = startp; ip <= NbTestPnts; ip++) {
if(IsReversed) {
Line->Value(ip+1).ParametersOnS1(Un,Vn);
}
DDU += fabs(fabs(Uc)-fabs(Un));
- DDV += fabs(fabs(Vc)-fabs(Vn));
+ //DDV += fabs(fabs(Vc)-fabs(Vn));
if(ip > startp) {
Standard_Real DP = Line->Value(ip).Value().Distance(Line->Value(ip-1).Value());
}
DDU /= (Standard_Real) NbTestPnts + 1;
- DDV /= (Standard_Real) NbTestPnts + 1;
+ //DDV /= (Standard_Real) NbTestPnts + 1;
D3D /= (Standard_Real) NbTestPnts + 1;
Standard_Integer aNbFacePrimitives = 0;
Standard_Integer aNbVolmPrimitives = 0;
Standard_Integer aNbEdgePrimitives = 0;
- Standard_Integer aNbLinkPrimitives = 0;
+ //Standard_Integer aNbLinkPrimitives = 0;
for (it.Reset(); it.More(); it.Next())
{
}
else if (aType == MeshVS_ET_Link)
{
- aNbLinkPrimitives += aNbNodes - 1; // add link segments
+ //aNbLinkPrimitives += aNbNodes - 1; // add link segments
}
else if (aType == MeshVS_ET_Face)
{
return Handle(Geom2d_BSplineCurve)();
}
-
-
- Standard_Real iinter, ip1inter;
- Standard_Integer nbK2d, deg;
- nbK2d = BSC2d->NbKnots(); deg = BSC2d->Degree();
+ Standard_Integer nbK2d = BSC2d->NbKnots();
+ Standard_Integer deg = BSC2d->Degree();
for(i = 2;i <= nbInter;i++) {
- iinter = Inter.Value(i);
- ip1inter = Inter.Value(i+1);
+ Standard_Real iinter = Inter.Value(i);
+ Standard_Real ip1inter = Inter.Value(i+1);
// general case 3d
GTC->SetTrim(iinter, ip1inter);
AHC = new GeomAdaptor_Curve(GTC);
return Handle(Geom2d_BSplineCurve)();
}
LOfBSpline2d.Append(BSC2d);
+
+ (void )nbK2d; // unused but set for debug
nbK2d += BSC2d->NbKnots() - 1;
deg = Max(deg, BSC2d->Degree());
}
aNextPool = * (Standard_Size **) aNextPool; // get next pool
}
const Standard_Integer iLast = iPool - 1;
+
+ (void )nPool; // unused but set for debug
nPool += iPool;
// scan free blocks, find corresponding pools and increment
aPrevPool = (aFreePools[iLastFree] == iLast
? aPrev
: aPools[iLast]);
+ (void )nPoolFreed; // unused but set for debug
nPoolFreed += iLastFree + 1;
}
// check for error
if (subcount < 0)
return Standard_False;
+
+ (void )count; // unused but set for debug
count += subcount;
}
//anElem = (const XmlObjMgt_Element &) anElem.getNextSibling();