1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

492 Commits

Author SHA1 Message Date
dpasukhi
656b0d217f 0033557: Coding - Cocoa compilation problem
Fixed extern relation for VisTest component on MacOS
2023-12-26 08:37:59 +00:00
dpasukhi
83bb2a329d 0033555: Foundation Classes - DEBUG macro leads to compile error
Removed incorrect parameter call when DEBUG macro is active
2023-12-15 19:53:17 +00:00
dpasukhi
5b0f5b52b9 0033554: Foundation Classes - Missed hash specialization for enumerations
Fixed problem with missed hash specialization
2023-12-15 19:53:06 +00:00
dpasukhi
06282d9c7c 0033553: Foundation Classes - HashUtils compilation problem
Updated OptimalSeed template
2023-12-15 19:52:56 +00:00
Xu Zhongxing
60792f26f0 0033552: Foundation Classes - NCollection_BaseMap move ctor clears wrong pointer
Replaced correct class member to clear
2023-12-15 19:51:57 +00:00
rodrlyra
6ef56849a5 0033542: Visualization, AIS_ViewController - New AIS_DragAction for when drag interaction is confirmed
Added AIS_DragAction_Confirmed drag action, which will be called by AIS_ViewController when the drag interaction is confirmed (mouse moved more than click threshold).
2023-12-15 19:51:25 +00:00
dpasukhi
e8605596c9 0033548: Tests - VC142 internal problem for Chamfer functionality
Update test cases for Jenkins old compiler. Mark as BAD
2023-12-12 17:28:20 +00:00
dpasukhi
ffd7a3aa4f 0033544: Foundation Classes - Fixing compiler problems [HotFix]
Fixed problem with Clang-16
Fixed problem with SWIG-4
Fixed genproj procedure
2023-12-06 13:00:13 +00:00
dpasukhi
8147976d9f Update OCCT version to 7.8.0 2023-12-04 15:53:08 +00:00
dpasukhi
40b80d8d66 0033300: Data Exchange, DE Wrapper - Specialize WS for each transfer process
Updated STEP and IGES to personalize own work session
2023-12-04 15:53:07 +00:00
dpasukhi
7036facf10 0033399: Configuration - Research into opportunities to increase performance
Implement CMake profiles to modify compiler and linker flags
2023-12-04 15:53:07 +00:00
ichesnok
a6e425d0a6 0033540: Data Exchange - Segmentation fault on loading model
Implemented workaround to avoid crash on out-of-ISO files
2023-12-04 15:53:07 +00:00
ichesnok
b9fbc699b5 0033483: Data Exchange - Static_Interface local instance for the model
StepData_StepParameters class created and used instead of Interface_Static
2023-12-04 15:53:06 +00:00
ichesnok
0435edfe54 0033474: Data Exchange - Implement stream reading into RWMesh interface
Stream usage as parameter
2023-12-04 15:53:05 +00:00
dpasukhi
bd651bbbd9 0033531: Configuration - Rework DataExchange ToolKits organization
Integrated DE plugin functionality.
Reworked DE components:
 - TKDESTEP: Handling STEP file format.
 - TKDEOBJ: Handling OBJ file format.
 - TKDEIGES: Handling IGES file format.
 - TKDEGLTF: Handling GLTF file format.
 - TKDEVRML: Handling VRML file format.
 - TKDEPLY: Handling PLY file format.
 - TKDESTL: Handling STL file format.
Reworked DE DRAW components:
  TKXSDRAWSTEP: Container for DE command to work with STEP.
  TKXSDRAWOBJ: Container for DE command to work with OBJ.
  TKXSDRAWIGES: Container for DE command to work with IGES.
  TKXSDRAWGLTF: Container for DE command to work with GLTF.
  TKXSDRAWVRML: Container for DE command to work with VRML.
  TKXSDRAWPLY: Container for DE command to work with PLY.
  TKXSDRAWSTL: Container for DE command to work with STL.
TKXSDRAW rework to be base DRAW plugin to keep DE session and utils.
Updated documentation
Updated samples
2023-12-04 15:52:47 +00:00
dpasukhi
3aeea1e96e 0033425: Configuration - Implement JeMalloc memory manager
Integrated CMake procedure to choose MMGR
Default MMGE is Native
2023-12-04 13:38:51 +00:00
dpasukhi
ed85665b55 0033529: Data Exchange, Step - Move on IncAllocator functionality
Update allocation mechanism for StepParser
Decrease the table size for parsing
2023-12-04 13:37:10 +00:00
dpasukhi
1103eb60af 0033370: Foundation Classes - Moving into STL and Boost functionality
NCollection containers update:
  - NCollection_Array1 - updated functionality
  - NCollection_Array2 - NCollection_Array1 as a wrapper for 2array
  - NCollection_Vector -> NCollection_DynamicArray was renamed and reworked.
TCollection:
  - Use static empty string to avoid allocations on empty string
 NCollection allocators update:
  - NCollection_Allocator - allocator that used Standard::Allocate
  - NCollection_OccAllocator - allocator-wrapper that used OCC BaseAllocator objects
  - NCollection_IncAllocator - rework to increase performance
Standard:
  - Rework functionality to use different allocation libs
  - Implement basic of new way to wrap allocations tools
  - Define 4 ways to allocation (defines in configure stage)
 Additional changes:
  - Hash function uses std::hash functionality
   - size_t as a hash value
  - New HashUtils with Murmur and FVN hash algo for x32 and x64
  - Deprecated _0.cxx and .gxx DE classes reorganized
  - Create own utility for std memory
  - Update Standard_Transient to be more platform-independent
 Math TK changes:
  - math_Vector -> match_BaseVector<>
    - Buffer decreased to cash 32 elements instead of 512
2023-12-04 13:37:09 +00:00
rodrlyra
6dbfade692 0033521: Visualization - possibility to redefine rotation persistence in Graphic3d_TransformPers
Added virtual function to Graphic3d_TransformPers that allows overriding rotation persistence behavior on application level.
2023-11-28 13:33:19 +00:00
ichesnok
588ee924e4 0033491: Data Exchange, Step Import - Incorrect import of ComplexTriangulatedFace
Reading and writing of triangle_strips and triangle_fans has been corrected in RWStepVisual_RWComplexTriangulatedFace.cxx file. And corresponding corrections have been added to other files.
2023-11-09 15:05:29 +00:00
akaftasev
f0c6e6fc8d 0033515: Modeling Algorithm - BRepExtrema_DistShapeShape poduces wrong result
Changed redundant square operation
2023-11-03 14:21:37 +00:00
dorlov
58390c4eb1 0032666: Data Exchange - Cannot write STEP file from an XCAF document containing only triangulations in the faces
Added support of reading and writing of the triangulated_surface_set.
Prevented creation of tesselated geometry under the schemas different from AP242DIS.
test step_read corrected, switched parameter write.step.schema to AP242DIS in begin and back to AP214CD at the end
2023-10-18 12:39:00 +01:00
ika
38581280d0 0033486: Data Exchange - Mistake in processing of the oriented dimensions
Remove using the array member's number instead of array member.
2023-09-23 14:41:46 +01:00
ika
4ce99d9697 0033470: Application Framework - TDataStd_NamedData HasSmth() methods return true for empty containers.
Add checks for empty containers.
2023-09-22 14:35:53 +01:00
anv
2b5ee7c791 0033484: Data Exchange, Step Import - Pretessellated geometry is translated incompletely
Added proper translation for TessellatedCurveSet and ComplexTriangulatedSurfaceSet.
2023-09-22 05:57:01 +01:00
ichesnok
06f2625c35 0033426: Data Exchange, VRML - Impossible to import VRML V1
VrmlData_ShapeNode creating (for vrml v1 case) was added
2023-09-14 08:16:45 +01:00
ichesnok
28b505b27b 0033351: Data Exchange, Step - Improvement for thread safety of the STEP translator
Local StepData_Factors object usage for each session
Static variables isolated
2023-09-08 11:28:53 +01:00
ichesnok
a948803521 0033183: Data Exchange - Lose texture after saving XBF file
Texture reading and writing changed in VisMaterial drivers
2023-09-08 11:28:27 +01:00
akaftasev
e7bcf415c3 0033450: Modeling algorithm - HLR algorightm stucks
Selecting the middle point between XInf and XSup leads situation, where X values almost does not change.
To prevent this situation, select shifted point instead of middle.
2023-09-05 23:52:02 +01:00
akaftasev
0e6977d668 0033449: Modeling Algorithm - Crash in BRepTools_GTrsfModification::NewTriangulation() method
Changed iteration limits from theTriangulation->NbTriangles() to theTriangulation->NbNodes()
Provided modification of the normals only with rotation (gp_GTrsf::Form() == gp_Other  leads to crash)
2023-08-29 13:18:39 +01:00
akaftasev
0e97c80e6a 0033446: Modeling Alghorithms - Creating offset with one of the degenerated edge leads to crash
Added condition to prevent out of range error
2023-08-24 15:11:57 +01:00
akaftasev
73914537d1 0033445: Coding - Changing binary XOR in boolean expression
Changed binary XOR to the ternary operator.
2023-08-10 20:33:23 +01:00
akaftasev
ae1683705e 0033420: Modeling Algorithm - Missing inner part after offset operation
Added condition to not remove face image, consisting only of invalid edges for artifactically invalid face.
This face image should be connected with other image faces minimum through the edge.
2023-08-07 11:32:08 +01:00
oan
f3a66dd7c0 0033436: Data Exchange, DE_Wrapper - DEXCAFCascade_ConfigurationNode::BuildProvider() not initialize provider
Pass pointer to DEXCAFCascade_ConfigurationNode to DEXCAFCascade_Provider;
Remove forcible manual reset of Provider's node in DE_Wrapper::FindProvider() to verify that all specializations of configuration node work properly without necessity of workarounds.
2023-08-07 11:30:06 +01:00
akaftasev
eb2be8bb46 0033421: Modeling Algorithms - ShapeUpgrade_UnifySameDomain throws exception
In method ShapeUpgrade_UnifySameDomain::IntUnifyFaces() the searched edge is finally checked that it is not empty before accessing it.
2023-08-07 11:26:07 +01:00
akaftasev
b32425859a 0031217: Modeling Algorithms - Exception is raised in GeomFill_SectionPlacement when parallel path and SectionAxis
Added protection from crashes when IsParallel
2023-08-07 11:23:54 +01:00
akaftasev
96d1fe2b05 0033398: Modeling Algorithms - ShapeUpgrade_UnifySameDomain throws exception on specific STEP model
Added additional checking in static method FindCoordBounds to avoid processing null pcurves
2023-08-07 11:21:47 +01:00
akaftasev
5e53920228 0026578: Modeling Algorithm - Exceptions in offset operation with intersection
Added test cases
2023-08-07 11:19:24 +01:00
ichesnok
2a0420be1d 0032681: Data Exchange - Missed dimension after STEP export
Changed level of detalisation (TopAbs_EDGE -> TopAbs_VERTEX by default)
2023-08-02 10:24:47 +01:00
sshutina
3421323164 0032879: Visualization, AIS_ViewController - define separate gesture mappings for dragging
Fixed problem of usage of objects dragging during zoom and pan
Added new draw command to change gesture for muse buttons
Added test
2023-07-18 16:20:12 +01:00
dkulikov
1dad584450 0033419: Tests - Updating test case data
Filenames in bug33414 are updated.
2023-07-05 13:01:49 +01:00
btokarev
a958a3377e 33343: Documentation, Overview - Incorrect doxygen syntax
Removed inclusions of empathized *text* from the titles
Text empathizers re-implemented
Reverted to no empathize style
2023-07-05 12:58:03 +01:00
dkulikov
afccc8d019 0033414: Modeling Algorithms - Access violation during executing BRepAlgoAPI_Section::Build()
Crush occurred due to the fields
IntTools_SurfaceRangeLocalizeData::myUParams,
IntTools_SurfaceRangeLocalizeData::myVParams
and IntTools_SurfaceRangeLocalizeData::myGridPoints not being checked
for NULL in some cases.
Missing checks are added.
2023-06-30 19:22:48 +01:00
mzernova
b47b7e69f7 0031956: Visualization - provide Image_AlienPixMap::Save() writing into a memory buffer instead of a file
Added two new Image_AlienPixMap::Save() overloads, taking std::ostream or memory buffer arguments.
2023-06-12 11:20:44 +01:00
dpasukhi
6aa053ae00 0033391: Coding - Clearing old definition way for strcasecmp
Removed artifacts for strcasecmp definitions
2023-05-31 20:17:31 +01:00
dpasukhi
54ed243582 0033372: Visualization - Compilation of git master fails against vtk 9.2.6
Fixed compilation on vtk 9.2.6.
Resolved name collisions with X11 headers
2023-05-31 20:07:16 +01:00
akaftasev
8748042259 0033390: Coding - Debug version of OCCT does not compile
Deleted code for OCCT_DEBUG was returned and added under macros OCCT_DEBUG
2023-05-22 12:00:32 +01:00
dpasukhi
92e0a76a50 0033379: Coding - Processing Clang-15 warnings
Fixed warning generated by Clang++-15
2023-05-19 19:34:37 +01:00
dpasukhi
b2fedee6a1 0033375: Coding - Static Analyzing processing. Performance
Performance update applied:
  - moving to const reference as much as possible
Result of CLANG_TIDY (static analyzing filter: perform*)
2023-05-19 19:33:59 +01:00
akaftasev
c28dd7f1cf 0033361: Modeling Algorithm - Fuse operation generates incomplete result
Added additional check of Face-Face intersection to avoid missing section edges because of sequence of Face-Face interference processing
2023-05-18 22:48:45 +01:00
dpasukhi
c36205a05e 0033378: Configuration - Moving ExpToCas into separate module
Moved ExpToCasExe and its DLL to new module - DETools
Created new module - DETools to keep tools to DE
Changed definition of main of ExpToCasExe to not const parameter
FlexLexer.h moved to general location into TKernel
2023-05-18 22:48:02 +01:00
ichesnok
945e309564 0030066: Data Exchange - Fail to load VRML from ArcGIS
Fixed VrmlData_Scene::readHeader method
2023-05-17 21:47:01 +01:00
ichesnok
e3841f9ffe 0033318: Data Exchange - Modifying the BRep flag after exporting the shape
Fixed condition for setting 'checked' flag
2023-05-17 21:46:06 +01:00
anv
bcfc5f0d5a 0033369: Modeling Algorithms - BRepBuilderAPI_Transform makes invalid shape after transformation
Added check to avoid setting parametric boundaries to infinity.
2023-05-17 21:45:13 +01:00
dpasukhi
c3f6267d24 0033382: Configuration - Installation issue for debug mode for static build
Updated install command to handle BUILD_SHARED_LIBS configuration
2023-05-16 13:48:11 +01:00
dpasukhi
5d8b1a4076 0033350: Data Exchange, Step Import - Improving parsing performance
Improved performance of parser by disable checking for eof (20% parsing time)
Changed step parser's record to keep last one to fast insert into end.
2023-05-14 21:40:28 +01:00
dpasukhi
e4f00dbb7e 0033377: Data Exchange - STEPCAFControl_Reader crash in OCC 7.7.0
Added checking for null object for STEPCAFControl_Reader::SettleShapeData
2023-05-10 19:29:14 +01:00
msmediasofts
359edc7d8a 0033366: Documentation - Add description of BRepAlgoAPI_Algo::Shape()
Added description of BRepAlgoAPI_Algo::Shape()
2023-04-19 18:04:52 +01:00
mzernova
f9998f03ad 0031777: Visualization - improve SelectMgr_EntityOwner to process selection scheme
The selection scheme has been propagated to Owner object interface, and the
AIS_Selection::Select() method has been replaced to unify the logic.
2023-04-05 17:20:33 +01:00
dorlov
c479c4f6d8 0023638: Data Exchange - Reading IGES file produced invalid shape
Removed double healing of Iges group entities
Added ShapeBuild_ReShape member to the IGESData_IGESModel class, shapes which are registered in ShapeBuild_ReShape class does not process to healing
2023-03-28 01:00:42 +01:00
dpasukhi
c51df6bfd2 0033327: Data Exchange, IGES Import - SubfigureDef can't read string
Fixed problem with texted types
Added checking for null string for subfigure via XCAF transferring
2023-03-20 23:11:36 +00:00
dpasukhi
5e43274280 0033337: DRAW - Can't load plugins on Linux OS
WSL 2 have windows FileSystem and as a result we have \r symbols before \n
For this cases we can just remove \r\n (\n is a last symbol) for the node value.
2023-03-20 23:11:35 +00:00
dpasukhi
efe960751c 0033331: Data Exchange, Step Import - Unsupported Representation Items
Fixed problem with iteration on Null RI
2023-03-20 23:11:27 +00:00
anv
6b9e0dc3f8 0033345: Coding - Memory allocation operators got inaccessible
Macros was moved back to public.
2023-03-19 20:53:54 +00:00
akaftasev
2ef94c994e 0033340: Modeling Algorithm - Improve memory management performance in the PaveFiller
Changed NCollection_BaseAllocator to NCollection_IncAllocator in BOPAlgo_PaveFiller::MakeBlocks()
2023-03-19 20:53:53 +00:00
dpasukhi
1dd4b902c0 0033092: Data Exchange, Documentation - Implementation of DE_Wrapper documentation
Implement new user-guide documentation for DE Wrapper
2023-03-19 20:53:53 +00:00
akaftasev
a846d36326 0033264: Modeling Algorithms - Result of section operation is incomplete
Test case added.
2023-03-19 20:53:53 +00:00
akaftasev
86e352849d 0033263: Modeling Algorithms - BRepFilletAPI_MakeFillet doesn't work for current parameters
Do not calculate edge state if there are more than 4 G1 connections for currect vertex.
2023-02-10 15:35:41 +00:00
akaftasev
6d140acb14 0030292: Modeling Algorithms - BRepBndLib should avoid using Poly_Polygon3D when called with useTriangulation set to false
BRepBndLib.cxx : treatment of useTriangulation is modified according to specified behavior of algorithm
BRepTest_CurveCommands.cxx : creation edge from polygon3d is added in Draw command mkedge.
2023-02-06 17:51:52 +00:00
akaftasev
44be123039 0030055: BRepOffset_MakeOffset throws "TopoDS_Vertex hasn't gp_Pnt" in intersection mode
Diagnostic of mixed connectivity of faces along common edge is added.
If algorithm finds such pair of faces, it stops working with special error code.
2023-02-06 14:15:35 +03:00
dpasukhi
47263fa6a3 0033317: Data Exchange, Step Export - Ignoring color attached to the reference shape label
Fixed problem with pure referencing.
  To export reference label to step we convert it to the assembly with one part.
  All attributes attached to the label should be moved to the new part.
  For working with it new map contains only pure reference labels, that converted to the part
  was implemented to the STEPCAFControl_Writer.
Updated code style of the STEPCAFControl_Writer
Improved ability to export labels from different documents
Removed OCCT_Debug macros to print in Trace gravity
2023-02-04 09:18:29 +00:00
mzernova
b0afa94d10 0027848: Visualization - sensitivity of lines is too high
Improved objects sorting by depth.

The sensitivity calculation for the manipulator has been changed.
Now the sensitivity of the elements of the manipulator depends on its size.

Also fixed the problem of erroneous selection of unfilled circles (SelectMgr_Frustum<N>::hasCircleOverlap() function).

Test case vselect/bugs/bug27848 added.
2023-02-04 09:17:58 +00:00
dorlov
c772c6caa4 0030828: Data Exchange - The commands getting shapes from XCAF document should be available in C++
Added two new overloaded methods XCAFDoc_ShapeTool::GetOneShape: one returns TopoDS_Shape from TDF_LabelSequence and the other from a sequence of all top-level shapes which are free
2023-02-02 15:04:50 +00:00
mzernova
53eae1a935 0032570: Visualization, AIS_AnimationObject - define rotation around axis
When using AIS_AnimationObject, linear interpolation is performed from one gp_Trsf transformation to another.
But when an object rotates around a specific axis, the object moves not along a linear trajectory,
but along a circle. Therefore, a separate class AIS_AnimationAxisRotation was created that
allows to animate rotation around a specific axis.

Test case tests/v3d/bugs/bug32570 was added.
2023-02-01 23:26:46 +00:00
dpasukhi
d22b135217 0033307: Data Exchange, Step Import - Crash after reading empty edge loop
Fixed problem with empty edge list in the edge loop, mark as a fail entity in this case
2023-02-01 00:09:26 +00:00
vro
3c7c705d77 0033320: Data Exchange - Reading of a VRML file with a long line fails
Implement rolling back input stream to split on possible logical parts by comma or space.
2023-01-24 22:38:57 +00:00
dorlov
fc72568ba9 0033312: Data Exchange - NULL-dereference in StepToTopoDS_TranslateShell::Init()
The condition "if" was changed to opposite
2023-01-20 03:10:45 +00:00
akaftasev
107b57a955 0033311: Modeling Algorithm - No results of thrusection algorithm
Changed default value of myPercent
2023-01-17 20:47:54 +00:00
oan
8b301eb865 0033315: Mesh - BRepMesh_IncrementalMesh takes forever to finish (ends up with system memory, etc)
Added test case
2023-01-16 22:00:35 +00:00
rodrlyra
1f469e3781 0033305: Coding - BOPTools_PairSelector::Clear method uses "Clear" instead of "clear" on std::vector 2023-01-16 15:22:08 +00:00
akaftasev
ce4d294074 0033306: Modeling Algorithm - Crash in TrimEdge() method
Added condition to not cut the edges by closely located parameters
2023-01-09 21:44:11 +00:00
akaftasev
9f338a00a1 0033298: Modeling Algorithm - Offset operation gives wrong result
Process only those images of the faces, if one if them has anInsideEdges/anInsideVertices and the other is not.
2023-01-03 18:01:14 +00:00
akaftasev
a011359b8a 0033227: Modeling Algorithm - BOPAlgo_BuilderSolid generates incomplete result
Deleted outer loop for shells.
Added additional check of edges orientation for RefineShell().
2023-01-03 18:01:05 +00:00
msv
42e4ae96ae 0033304: Modeling Data - Floating point signal when converting a B-spline curve to analytical form
Protect the static function ConicDefinition from calling sqrt with negative argument.
2023-01-03 18:00:55 +00:00
akaftasev
686926c0a9 0033247: Modeling Algorithm - BOP report small edges problem and produce empty result
Build shifted pcurve for ellipse and circle cases.
2022-12-22 16:20:54 +00:00
akaftasev
a638dd6224 0033265: Modeling Algorithms - Boolean operation hangs on the attached shapes
Added test case.
2022-12-16 14:28:08 +00:00
ifv
961a306dc4 0033244: Modeling Algorithms - Surface-surface intersection produces the double curves
IntAna_QuadQuadGeo.cxx - estimation of angular tolerance is added for case cone-cone

tests/lowalgos/intss/bug33244 - new test case added
2022-12-12 10:27:10 +03:00
ifv
195a068c4f 0030781: Sweep algorithm creates non-planar edges (orig. BOPAlgo_MakerVolume fails to build a solid)
BRepFill/BRepFill_AdvancedEvolved.cxx - estimation of angular tolerance is added in method GetLids()

tests/evolved/voluved/bug30781 - new test added
2022-12-10 14:04:53 +00:00
dpasukhi
669e0dfc17 0033246: Data Exchange, DE Wrapper - Checking license leads to performance problem
ReWork UpdateLoad functionality:
UpdateLoad calls only if provider is found.
UpdateLoad calls only for chosen type of translation (read/write)
Add new method to UpdateLoad all registered nodes.
2022-12-10 14:02:56 +00:00
nunomsil
74cb5673a5 0031919: Modeling Algorithms - General Fuse raises exception on attempt to imprint a contour to a shell
Exception no longer occurs in current version. However, fuzzyvalue should be set to 1 for the result of the operation to make sense (result of common is 1 wire). Test case added
2022-12-07 14:45:36 +00:00
dpasukhi
768f3a4a19 0033235: Configuration - Solving the problem with static building of ExpToCasExe
Added new dependency to ExpToCasExe - CSF_wsock32 (on Win only)
2022-12-04 13:49:06 +03:00
dpasukhi
2a8c5ad46c 0033250: Configuration - Missing Limits header file
Added new include limits to fix build problem
2022-12-04 13:48:24 +03:00
stv
7ea3eff4f8 0033218: Data Exchange - XCAFPrs_Texture not allow to use classes inherited from Image_Texture
Type of field XCAFPrs_Texture::myImageSource was changed from Image_Texture to Handle(Image_Texture)
2022-12-04 13:47:36 +03:00
dpasukhi
c07f4ee70d 0033232: Data Exchange, DE_Wrapper - Implement ability to change global session
Add ability to set/get global session
2022-12-04 13:46:38 +03:00
dpasukhi
6cc679d81c 0033230: Data Exchange, DE Wrapper - Update API to find CAD provider
Moved FindProvider method to public section
Made FindProvider as virtual to make it possible to overwrite.
2022-12-04 13:46:38 +03:00
dpasukhi
62f554bc3f 0033228: Data Exchange, DE Wrapper - Make the document argument of the method Read const handle
Rewrite document argument for DE_Wrapper Read method
2022-12-04 13:46:37 +03:00
sshutina
7eeb5d5fbf 0032965: PMIVis - PMIVis_TOT_Vectorized text regressions
Added the ability to draw a shaded shape in the required group.
2022-12-04 13:44:52 +03:00
oan
9b7f1aea28 0031865: Mesh - triangulation fails with large deflection values due to unhandled Standard_OutOfRange, BRepMesh_PairOfIndex::Append()
Define minimum number of points for specific types of curves like it was done for circular edges.
2022-12-04 13:43:52 +03:00
knosulko
1e96cf65fa 0033156: Modeling Algorithms - Planar face creation problem
BRepLib_MakeFace::BRepLib_MakeFace: deleted degenerative edges from the input wire;
add test tests\mkface\mkplane\bug33156.
2022-12-04 13:42:28 +03:00
ddzama
03275c0be1 0022821: Crash with BRepFilletAPI_MakeFillet
test bugs modalg_7 bug22821 failed on fillet shape with 5-th edge.
Experimentally has been found that reducing of parameter
ChFi3d_Builder::tolesp for this task solves the issue.

So, as soluton it is proposed to link parameter toleps with parameter range of
spine curve. So, production coefficient has been set to pass all tests and
2 teset was extended: tests/blend/complex/A6, tests/bugs/modalg_7/bug22821

first has been extended to test different scaling factors,
second has been extended to make fillet on all edges from 12.

Additionally:
 - fixed misusage of tolesp in contexts where tolerance of point in 3d is excepted;
     In some context usage of tol_esp is irrelevant, because its essentiality - tolerance of the parameter on the 3d curve.
     So, in such context it has been replaced with new parameter tol3d (with fix value 1.0e-4).
     Get rid of tolapp3d duplication constant - tol_3d
 - tolesp = 5.0e-5 * (umax - umin)
 - tolesp replaced by tolpoint2d/tolpoint3d in several classes.
     Blend_Walking
     BRepBlend_SurfRstLineBuilder
     BRepBlend_RstRstLineBuilder
     Blend_CSWalking
     Instead `tolesp` - `tolgui` is employed in contexts where tolerance of guide curve parameter is excepted.
     Instead `tolesp` - `tolpoint2d` or `tolpoint3d` is employed in contexts where tolerance of point in 2d or 3d space is excepted.
 - Replace tolesp with tolpoint2d/tolpoint3d in BBPP function argument.
 - Use tolapp3d instead tolesp in BonVoisin function,
2022-12-04 13:41:29 +03:00
ddzama
2f33e34038 0032934: Modelling Algorithms - BRepExtrema_DistShapeShape returns two solutions instead of one
distmini of two edges returns two solution points instead one.
Second unneeded solution point is the same as first.

The problem was in fact that second edge has continuity C0.
In this case additional extremas analysis performed in special procedure

PERFORM_C0

And second point found in this procedure.
Folowing code of

BRepExtrema_DistanceSS::Perform (variant for Edge/Edge)

we should this additional solution extremas set
to be object of test TRI_SOLUTION before pushing
into main list of solution.
This solves the problem.
Corresponding test and compound with edges has been created.

Additionally, in the function

PERFORM_C0

an obvious error has fixed.
2022-12-04 13:39:35 +03:00
akaftasev
3eb891ec49 0033180: We had a problem calling the OCC library at the customer site, and the program crashed
Added status for thrusection operations and changed throw constructions to set of the status and break the function.
2022-12-04 13:35:24 +03:00
smoskvin
057dcfddf7 0033225: Changing the status of tests on Ubuntu 20.04 and Windows 64 VC142 2022-11-28 00:04:06 +03:00
atereshi
3837b3bf28 0033217: DRAW - Missed Standard_EXPORT attribute in DrawTrSurf_Set* functions 2022-11-25 13:03:27 +03:00
gelin
db2bfd1e83 0032818: Modeling Algorithms - Result of sweep operation is invalid
BRepFill_TrimShellCorner.cxx - setting correct orientation for NewEdge
tests/pipe/bugs/bug32818 - new test case added
2022-11-21 20:13:47 +03:00
ika
a855215141 0030256: ACIS Import - crash while importing SAT file on constructing a pipe
Fix for thin section with both first and last parameters located in one segment.
2022-11-21 20:11:13 +03:00
ifv
195aac3a42 0033193: Modeling Algorithms - Regression: UnifySameDomain raises SIGSEGV
ShapeUpgrade_UnifySameDomain.cxx - method ReconstructMissedSeam is improved.

tests/bugs/heal/bug33193 - new test case added
2022-11-21 20:10:06 +03:00
atereshi
f706dd34b3 0027122: Data Exchange - invalid shapes are produced during model translation due to huge face tolerance
Problem: The shape has two faces that dimensions are less than tolerance in the specified STEP file. This situation produces the invalid shape.
Change: Shape process has operator FixFaceSize, that is exactly suitable for this shape. The only option of FixFaceSize operator was added to InterfaceStatic, to manage the operator from DRAW command.
Result: The shape without artifacts can be reproduced from STEP file with an extra healing procedure.
2022-11-21 20:06:04 +03:00
ifv
c325231de6 0033179: Modeling Algorithms - Crash in ShapeFix_Shape with the attached object, when healing for fixing SameParameterFlag
BSplCLib_2.cxx - method MergeBSplineKnots is modified in order to have always not empty result.
Geom2dConvert.cxx - in static function MultNumandDenom tolerance for comparing knots is decreased.

tests/bugs/modalg_8/bug33179 test case added
2022-11-21 20:03:35 +03:00
ifv
91a2f58f8f 0026441: Modeling Algorithms - BRepOffset_MakeOffset affects original shape
BRepOffset_MakeOffset.cxx - tolerance control for building planar faces is implemented,
                            updating tolerance for initial entities is avoided

BRepAlgo_Loop.cxx - "total" setting tolerance 0.001 is removing

BRepLib.cxx - checking of "locked" for vertex is removing in static function UpdShTol

QABugs_20.cxx - add new command OCC26441 for checking tolerance differenses between two "identical" shapes

tests/bugs/modalg_7/bug30054 - case now is "BAD", because really result shape is invalid: many faces has not closed wires with huge gaps between ends of edges. Result was "OK" only because tolerances of vertices were increased by algorithm to cover all gaps.

tests/bugs/modalg_8/bug26441 - new test case added

Other test: B3, C8, A7, C8: they were "BAD" and now are "BAD", only some problems are changed.
2022-11-21 20:00:23 +03:00
ifv
8175a70c4e 0033173: Modeling Algorithms - Regression in BRepExtrema_DistShapeShape causing Standard_OutOfRange exception
Extrema/Extrema_ExtCC.cxx - checking number of solutions is added

tests/bugs/modalg_8/bug33173 - test case added
2022-11-21 19:57:45 +03:00
atereshi
f9990707fe 0033187: Modeling Algorithms - Crash in postprocessing of imported shape
Problem: Desynchronization of behaviors of GeomAdaptor_Curve::NbIntervals and
 GeomAdaptor_Curve::Intervals functions. First calculates number of intervals, then
 array is created and second fills the array. In some cases the size of array
 is less than need for filling.

Change:
1. Added function BSplCLib::Intervals that calculates number of interval and fills
 the array with its (if needed).
2. Simplified the algorithm of intervals calculation.
3. GeomAdaptor_Curve::NbIntervals/Intervals and Geom2dAdaptor_Curve::NbIntervals/Intervals
 use BSplCLib::Intervals.
4. When creating an adapter for the base curve, the boundaries of the adapter for the offset curve are applied.
5. Test for problem shape was created: bugs modalg_8 bug33187.

Result: The new approach eliminates the problem of writing outside the array bounds.
2022-11-21 19:53:59 +03:00
knosulko
aba5c241c6 0033144: Modeling Algorithms - Wrong result of Shape Proximity
Added step of refinement the coarser of the two shapes meshes to produce two meshes with approximately the same density.
Added tests lowalgos/proximity.

Fixed accounting of parameters to adjust number of initial sample points
2022-11-21 19:50:40 +03:00
ifv
cc164fd7dc 0033170: Modeling Algorithms - Checking for canonical geometry: plane detection problems
GeomLib_IsPlanarSurface.cxx - using poles for checking BSpline, Bezier curves and surface changed
                              on checking by curve, surface points.

BRepOffset_MakeOffset.cxx - set normal of plane surface according to normal of initial face surface

tests/cr/bugs/bug33170 - new test case added
2022-11-21 19:44:10 +03:00
ona
d7d89acb39 0032977: OCC V7.5, V7.6 cannot read STEP color correctly for the root label, but v6.8 can
- color overriding mechanism is implemented for assembles, parts and instances
2022-11-21 19:41:08 +03:00
Eugeny Maltchikov
d444cc35c6 0033171: Modeling Algorithms - Invalid result of faces unification
Avoid unification of the faces belonging to the different shells.
2022-11-21 19:38:22 +03:00
smoskvin
eeba62cbd3 Increment OCCT version up to 7.8.0dev 2022-11-12 01:20:10 +03:00
dpasukhi
185d29b92f 0033198: Using a third-party Draco to compile in DEBUG mode
Added new CMake variables to build using DRACO
Windows OS works with Debug and Release configuration DRACO
Linux works with Release configuration DRACO
2022-11-12 01:19:44 +03:00
smoskvin
2923ef0df8 fixed compilation by the genproj tool 2022-11-11 11:26:00 +03:00
atychini
402ad27743 0033190: Error on de_wrapper/configuration/A3
Removing provider.VRML.OCC.read.memory.limit from the test because this parameter doesn't exist inside the Vrml_ConfigurationNode class
2022-11-02 22:22:09 +03:00
aba
f8d4cfbb80 0027142: Data Exchange - add possibility to set location in XCAFDoc_ShapeTool interface 2022-10-31 19:19:33 +03:00
azv
aaacd83510 0033032: Samples - Warning on Ubuntu 20.04
Fix warnings:
* catching polymorphic type 'class Standard_Failure' by value [-Wcatch-value=]
* this 'if' clause does not guard... [-Wmisleading-indentation]
2022-10-31 19:18:08 +03:00
mahaidong
3e06b70623 0032350: Data Exchange - STEPControl_Writer.writeStream(std::ostream)
STEPCAFControl_Writer::WriteStream(), STEPControl_Writer::WriteStream() - added interface for writing into stream.
STEPCAFControl_Reader::ReadStream() - added stream reading method (similar to STEPControl_Reader::ReadStream()).

Added option -stream to commands ReadStep, WriteStep, and testwritestep.
2022-10-31 19:18:08 +03:00
oan
b77de43fb0 0032053: Mesh - Invalid mesh after shape scaling
Added test case
2022-10-31 19:18:08 +03:00
oan
59223e118d 0031926: Shape Healing - ShapeAnalysis::OuterWire() considers next iteration element always to be a wire causing skipping of primal one
ShapeAnalysis::OuterWire(): fixed missed logic when TopoDS_Iterator notifies about more objects to iterate, but there are only vertices and no additional wires at all.
2022-10-31 19:18:07 +03:00
oan
3b5a94a165 0033050: [Regression to OCCT 7.3.0] Mesh - meshing deflection is not reached
Add parameter EnableControlSurfaceDeflectionAllSurfaces to IMeshTools_Parameters enabling possibility to optimize mesh even on analytical surfaces;
Add corresponding parameter -surf_def_all to incmesh Draw command.
2022-10-31 19:18:07 +03:00
akaftasev
5cbd98a5be 0029093: BOP PaveFiller hungs and constantly consumes memory
Method IntWalk_PWalking::ExtendLineInCommonZone(...) now is not called if the already found intersection point is on surface boundary.
As result, the intersection line going along any boundary will never be extended. It is appropriate for high-level OCCT-algorithm because they will take the boundary (not computed line) as intersection result.
2022-10-31 19:18:07 +03:00
akaftasev
25b5e83a4c 0032691: Modeling Algorithms - Exception when trying to build solid during sweep algorithm
Changed the condition for checking the correctness of the sweep algorithm. Exception is no longer raised, algorithm finishes with "Not done" status.
2022-10-31 19:18:06 +03:00
vmigunov
3c9178dd5c 0033165: Data exchange - Instance name is not saved during writing step file
Instance name is saved also with identity location transformation
2022-10-31 18:22:37 +03:00
oan
f73592edf0 0028500: Artifact in shaded view of the shape
Increase minimum number of discretization points by one explicitly on each iteration of model healer to cover cases degenerated to line (for cases when face consists of 2 edges only).
2022-10-31 18:21:44 +03:00
oan
a24391a133 0033163: Bad definition of values in IMeshData_Status
Corrected value of status enum
2022-10-31 18:21:08 +03:00
oan
3a24514d48 0031476: Wrong shading of a toroidal face from a SAT file
Added test case
2022-10-31 18:20:29 +03:00
kgv
3453354ee1 0033141: BVH_BaseBox<T, 3, BVH_Box>::Transformed() returns empty box for identity matrix 2022-10-31 18:19:37 +03:00
Eugeny Maltchikov
9218d04b9a 0033138: [Foundation Classes] - NCollection_IncAllocator- Decrease the default block size
Set default memory block size for IncAllocator to 12KB to make sure the Low Fragmentation Heap is used for memory allocations on Windows platform.
2022-10-31 18:18:21 +03:00
abulyche
259b930379 0023954: Modeling Algorithms - BRepPrimAPI_MakeRevol fails to recognize a torus case
Fixed the Toroidal surface recognition;
The test case bugs/moddata_1/bug22296: the result is a torus with parameters: u [0, 2*PI], v [PI, 3*PI];
The test case bugs/modalg_5/bug23954: BAD -> OK.
2022-10-31 18:17:37 +03:00
ddzama
3536158f11 0033153: Configuration: Linker error when building from source for VS2022 x64.
With enabled flag BUILD_USE_PCH we get an error of compilation of TKService:

1>Image_VideoRecorder.obj :
  error LNK2019:
    unresolved external symbol
      "int __cdecl av_strerror(int,char *,unsigned __int64)"
      (?av_strerror@@YAHHPEAD_K@Z) referenced in function
      "protected: class TCollection_AsciiString __cdecl Image_VideoRecorder::formatAvError(int)const "
      (?formatAvError@Image_VideoRecorder@@IEBA?AVTCollection_AsciiString@@H@Z)
1>Media_FormatContext.obj :
  error LNK2001:
    unresolved external symbol
      "int __cdecl av_strerror(int,char *,unsigned __int64)" (?av_strerror@@YAHHPEAD_K@Z)

And many other similar errors. Similar errors occures in some other projects too:

TKService
TKOpenGl
TKOpenGles
TKXCAF
TKXDEDRAW
TKDFBrowser
TKMessageModel
TKMessageView
TKShapeView
TKTInspector
TKTreeModel
TKVInspector
TKView

Proposed solution: turn off cotire from targets, whose compilation cause error while applying cotire tool.
In this ticket migration to cotire 1.8.1 (from 1.7.9) is done.

COTIRE_PREFIX_HEADER_IGNORE_PATH does not apply here, because its employing
causes some errors in 3rdparty libraries (for example, in TKService project).

Projects (TKDFBrowser TKMessageModel TKMessageView TKShapeView TKTInspector TKTreeModel TKVInspector TKView)
which use Qt may be proceeded by cotire tool, but after fixing a bug of cotire:

https://gitlab.kitware.com/cmake/cmake/-/issues/18353

0033153: Fix cotire bug, causing impossibility of compilation targets depending from Qt.

Solution is proposed in:
https://gitlab.kitware.com/cmake/cmake/-/issues/18353
2022-10-31 18:16:19 +03:00
ddzama
cb77bfc4f0 0033155: Regression [0033117] Coding, relocation R_X86_64_PC32 against symbol `TT_RunIns' can not be used.
After emploing intel oneTBB of version 2021.5 on NEXT platforms arises error on OCC Pr.:

`
*/ld: */libfreetype.a(truetype.o): relocation R_X86_64_PC32 against symbol `TT_RunIns' can not be used when making a shared object; recompile with -fPIC
*/ld: final link failed: bad value
`

Proposed solution: linking with shared object of libfreetype, rather than with archive library.
Despite that error occurred only in OCC Pr., it is worth to accept changes for OCCT too.
2022-10-31 18:14:31 +03:00
ddzama
92f1875fc0 0033147: [Regression to 7.6.3] Coding, Configuration - CMake Error TBB "Directory is not set".
Previous approach do not taking into account, that oneTBB library may be installed in the system folder
on Linux. So, solve the problem it is proposed to employ find_package utility, that works great
as on Windows, as on Linux.
2022-10-31 18:13:44 +03:00
atereshi
a453f9d128 0028414: Data Exchange, STEP - Face on a closed surface with single inner wire and without natural bound not correctly read
Problem: From the point of view of the STEP format (and others), it is allowed
to describe a face on a surface with natural boundaries (torus, sphere) without
specifying these boundaries. Thus, a face on a closed surface and containing
an inner wire (or several) is correctly defined and describes a face with a
cutout defined by this wire. At the same time, there is a function
(ShapeFix_Face::FixOrientation) in the ShapeHealing procedure that corrects the
orientation of the wires, and it starts before the function of adding natural
boundaries (ShapeFix_Face::FixAddNaturalBound). There are many shapes that have
incorrectly oriented wires and this procedure successfully heals them, but on a
correctly specified face with single inner wire on closed surface, we do not get
the entire surface with a cutout, but a part of the surface defined by the wire.
This fix is intended to resolve this ambiguity.

Change:
1. Added function isNeedAddNaturalBound that returns TRUE if face needs to add
 natural bounds.
2. Corrected condition in FixOrientation to ignoring faces that needs to add
 natural bounds.
3. For tests in which one wire was incorrectly oriented on a closed surface,
flag AddNaturalBound was disabled.
5. Test with cutout from torus was created: bugs step bug28414.

Result: By default, it is correct to add natural boundaries, because this case
 is correct from the point of view of the STEP format and others.
2022-10-31 18:10:55 +03:00
gelin
492b09dcae 0032850: Modeling Algorithms - Surface Surface Intersect Lost one line
IntStart_SearchOnBoundaries.gxx - improving tangent criteria
2022-10-31 18:09:15 +03:00
kgv
f55fe3b3f7 0033149: Mesh - misprint in BRepMesh_NURBSRangeSplitter::computeGrainAndFilterParameters() 2022-10-31 18:08:24 +03:00
atereshi
51329afcef 0028024: Data Exchange - create a convenient mechanism for managing shape healing options when reading STEP or IGES file
Problem: There is no possibility to change shape healing options from DRAW without rewriting resource file.
Change: Shape healing parameters from STEP and IGES resource files were duplicated to InterfaceStatic. Resource manager initialize from InterfaceStatic if resource file name is empty.
Result: User can operationally change shape healing parameters from DRAW command using "param" command.
2022-10-31 18:06:02 +03:00
ddzama
13f5da81ad 0033152: Fix searching tbb in 3rdparty directory.
Currently directory containing tbb 3rdparty installation should match the template tbb*.
But after using oneTbb of version 2021.5 standard installation directory is onetbb*.
So, for this 3rdparty modify searching template.
2022-10-31 18:01:27 +03:00
nmanchen
f0049a9599 0028640: Modeling Algorithms - BRepBuilderAPI_Transform builds invalid shape
Adapt test case, the problem is not reproduced any more.
Problem is fixed by the commit: 46478ffe32 (0030008: BRepMesh does not respect angular deflection in internal area of bspline surface)
2022-09-30 10:35:34 +03:00
smoskvin
0b4962a7f0 Update version up to 7.7.0 2022-09-26 20:06:01 +03:00
ddzama
b3284f3ba9 0033117: migration to intel oneTBB 2021.5.0 (c++20 ready)
MSVC 2022/c++20.

After employed c++20 language standard errors of compilation in intel oneTBB occurred.
To get rid of compilation errors proposed moving on actual (2021.5.0) intel oneTBB occ products and occt.

After migration errors of compilation of TKernel and TMath have been occurred...
...Error occurred if using c++20 standard with new oneTBB 2021.5.0.
The error was:
   Error C2672 'tbb::v1::parallel_for_each': no matching overloaded function found TKernel
   could be 'void tbb::detail::d2::parallel_for_each(Iterator,Iterator,const Body &)' TKernel
   'tbb::detail::d2::parallel_for_each': the associated constraints are not satisfied TKernel
Note, that if we use c++14 or c++17, all ok, error does not occures.
To solve the problem, i have to modify `UniversalIterator` class:
`value_type` instead `UniversalIterator` converted to `IteratorInterface*`
`pointer` = `reference` = `value_type`
Method `DownCast` moved into `FunctorInterface` abstract class.
argument `UniversalIterator& item` of the unary fuctions converted to `IteratorInterface*`.
The proposed solution removes compilation error.

Affected projects: TKernel, TMath
Affected sources: src/OSD/OSD_Parallel.hxx, src/OSD/OSD_Parallel_Threads.cxx
Affected classes: class OSD_Parallel, OSD_Parallel::UniversalIterator, OSD_Parallel::FunctorInterface, OSD_Parallel::FunctorWrapperIter, OSD_Parallel:;FunctorWrapperInt.
2022-09-25 01:09:12 +03:00
jgv
b95eefe1c2 0031992: Modeling Algorithms - Offset of closed B-spline edge fails
1. Increase the tolerance of approximation.
2. Update auxiliary Draw command "topoload" for usage of option "-approx".

Add missing comment
2022-09-23 18:31:02 +03:00
atychini
5bde4773f9 0032820: Data Exchange - add VRML reader to XCAF document
Implementing VRML reader into XCAF document.
Updating DE_Wrapper according to VRML Reader.
2022-09-23 18:30:08 +03:00
ona
b0f92d3d5c 0032239: Data Exchange, STEP import - bounding box is too large
- ShapeFix_Face::FixMissingSeam method is fixed in order to handle degenerated torus
- Calculation of degenerated torus bounding box is fixed
- Test reference data is changed
2022-09-21 23:09:17 +03:00
mzernova
b9f787f180 0033114: Visualization - AIS_Animation returns 0 elapsed time after finishing playback
Added -elapsedTime option to DRAW vanim command
2022-09-20 12:03:58 +03:00
oan
a939fd40eb 0031853: Mesh - holes in triangulation with large linear deflection
0030442: Mesh - broken triangulation on pipe shape

Scale down min size parameter for NURBS taking into account its U and V resolution in order to prevent comparison of 2d parameters with 3d value involved in filtering process.
2022-09-16 18:35:32 +03:00
oan
c4ea4ca3d1 0032241: Mesh - wrong shading display of thrusections [regression since OCCT 7.4.0]
0032422: Mesh - Weird rendering
0029641: Mesher produce 'bad' result for extruded spline with given deviation coefficient

Added method BRepMesh_NURBSRangeSplitter::getUndefinedInterval() intended to compute checkpoint parameters for those NURBS surfaces which have no intervals at all. In this case number of poles is used to produce artificial regular grid which can be refined further. Add at least one midpoint for surfaces with one interval and only two poles.

Added BRepMesh_ExtrusionRangeSplitter and BRepMesh_UndefinedRangeSplitter derivatives from BRepMesh_NURBSRangeSplitter intended to handle special cases of extrusion surfaces and general surfaces with undefined parameters.
2022-09-16 18:34:44 +03:00
oan
f3573fb54b 0031449: Mesh - BRepMesh works too long and produces many free nodes on a valid face
Added test cases
2022-09-13 23:30:33 +03:00
knosulko
78aade7569 0033017: Implement an algorithm to find a proximity between a pair of shapes
Extend "proximity" command to be able to compute the proximity value;
Implement classes for calculate proximity value between two shapes;
Add possibility to set up the number of sample points for the input shapes;
Add tests lowalgos/proximity.
2022-09-13 23:29:39 +03:00
kgv
03b0ca59cb 0033142: Configuration, genproj - ExpToCasExe building fails with generated VS projects
Generate executable single MSVC project per-Unit instead of per-source file.
2022-09-13 23:28:49 +03:00
ddzama
d6baf70a93 0032960: Wrong result of BRepExtrema_DistShapeShape after translation.
Add corresponding test.
2022-09-13 10:57:29 +03:00
ifv
526c506cb0 0032859: Modeling Algorithms - BRepLib_FindSurface not return an expect plane
BRepLib/BRepLib_FindSurface.cxx = removing very small values from coordinate of normal
bug32859 - test case added
2022-09-10 17:14:05 +03:00
ddzama
2949b238c1 0033137: Updating minimal supported Microsoft Visual Studio version up to 2015 (VC140).
Microsoft Visual C++ compiler of version 2015 or higher should used to compile OCCT and Products on Windows.
2022-09-10 17:14:05 +03:00
oan
dfb5aebd35 0032982: [Regression to 7.3.0] Mesh - Meshing the shape takes too long and visualization is bad
New formula to calculate number of points along V axis of a cone depending on ratio of its size along V and U.
2022-09-08 22:06:40 +03:00
atychini
8da2801496 0033058: JT Import - perform XT translation in multiple threads
Creating mutex for proper parallel processing.
2022-09-06 20:10:58 +03:00
ddzama
e92d322d40 0032921: Configuration, CMake - allow selecting C++ standard.
Make C++ standard to be enable from cmake settings:

User will be able choosing C++ language standard by selecting cmake variable BUILD_CPP_STANDARD.
For correct working, CMAKE_CXX_STANDARD cmake built-in variable should be available.
To enable CMAKE_CXX_STANDARD, minimum CMAKE version has been updated to 3.1.

Available next standard items:
C++11
C++14
C++17
C++20
C++23

This issue consists from several steps to achive main goal:
1) Configuratiuon, CMake - allow selecting C++ standard.
2) Require minimum CMAKE version 3.1 (for enabling CMAKE_CXX_STANDARD).
3) More flexible CMAKE_CXX_COMPILER_ID identification (fixups previous commit!)
4) Add description of new CMAKE variable `BUILD_CPP_STANDARD` into documentation.
5) Update CMAKE requirements in documentation.
6) Set C++11 standard for several projects.
2022-09-06 20:06:54 +03:00
jgv
b71cb85f67 0032214: Modeling Algorithms - 2d Offset produces wrong result
Add new option to convert input contours into ones consisting of 2D circular arcs and 2D linear segments only.

Update documentation
2022-09-06 20:04:21 +03:00
abv
05cfce4d83 0031481: Data Exchange - provide parser of STEP EXPRESS schema for generation of new STEP entities
Integration of ExpToCas tool ported to modern state of OCCT:
- new package Express and toolkit TKExpress for EXPRESS data structures and OCCT class generator
- executable ExpToCasExe including lax/yacc parsers, for parsing a Part 21 file and generating classes

Formatting added files from package Express following OCCT Coding Rules

Changes for correspondence generated files to OCCT Code Rules.

Add generation hxx files with declaration of arrays.
If field is a HArray1 method for get length of array and method for get element of array by its index are generated.

Changes for generation parser from Lex and YACC files.

Update description file ReadMe.md
2022-09-06 19:59:09 +03:00
ddzama
d7eefb11bf 0032986: Samples - csharp sample is crashed on compilation with VC++ 2022
While demanding c++ language standard c++20, the error of OCCTProxy compilation is occured:

warning C4857: C++/CLI mode does not support C++ versions newer than C++17; setting language to /std:c++17
error C7681: two-phase name lookup is not supported for C++/CLI or C++/CX; use /Zc:twoPhase-

Officially, C++/CLI mode does not support C++ version newer than C++17, so we should not demand C++20 to compile csharp samples.
Alternative solution - using /permissive (ConformanceMode = false), rather than default value /permissive- (ConformanceMode = true)
option to compile OCCTProxy. But alternative solution has been denied.
So, here is nothing to do to fix compilation of OCCTProxy project.

Nevertheless, error occures in IE_WPF_WinForms and IE_WinForms - if we trying to compile with VC++ 2022 (not demanding c++20):

warning MSB3274: The primary reference "*\OCCTProxy.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.7.2" framework.
This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0".

To solve the problem it is proposed to demand by default the highest version of NETFramework - 4.8.
So, demanding NETFramework v4.8 does not crashing compilation of csharp samples with VC++ 2015.
2022-09-06 19:57:24 +03:00
abulyche
80d4753574 0032876: Modeling algorithms - BRepClass_FaceClassifier issue
Modification of checking points for the state "ON" in BRepClass_Intersector.cxx;
Added the test for this ticket;
test case lowalgos/classifier/bug377: BAD -> OK
2022-09-06 19:48:57 +03:00
ifv
ed6a17ef6c 0033104: Modeling Algorithms - Checking for canonical geometry: surface, close to a cylinder, is not recognized
Adjusting parameters of algorithm for recognizing cylindrical surfaces.
Test case added
2022-09-05 19:24:03 +03:00
mzernova
2182812a5b 0033112: Visualization - AIS_InteractiveContext::RecomputeSelectionOnly() may should handle selection tolerance changes 2022-09-05 19:21:50 +03:00
akaftasev
92915edda8 0030955: [Regression to 7.3.0] Modeling Algorithms - Incorrect result of fuse operation
Added test case.
2022-09-01 21:55:21 +03:00
mzernova
06aa200142 0032172: Visualization, TKOpenGl - implement simple shadow mapping for a spot light source
added test: opengl/data/shadows/spotlight
2022-08-31 10:27:30 +03:00
dpasukhi
acac44d571 0033053: Data Exchange, Step Export - Compound with vertex is ignored
Fixed problem with deep compound including with vertex group.
2022-08-26 17:39:36 +03:00
mzernova
7aaed2ce3b 0032547: Visualization, Select3D_SensitiveCylinder - implement picking of a hollow cylinder
Select3D_SensitiveCircle now inherits directly from Select3D_SensitiveEntity.
The sensitive circle sector is created using the Select3D_SensitivePoly class directly.

Added appropriate methods for selecting sensitive circles.
Added parameter myIsHollow to Select3D_SensitiveCylinder class.
It allows you to search for intersections with cylinders without covers.

The Draw vcircle command has been extended with UStart and UEnd parameters
to create a sector of a circle.

Added tests: vselect/cone_cylinder/circle_sector
             vselect/cone_cylinder/circle_wire
             vselect/cone_cylinder/filled_circle
             vselect/cone_cylinder/transformed
             vselect/cone_cylinder/hollow_cone_cyl
2022-08-26 17:38:19 +03:00
ngavrilo
da76ea432b 0032782: Visualization, TKD3DHost - improve robustness of test case opengl/drivers/d3dhost 2022-08-23 18:35:39 +03:00
gka
53152e6dd9 0033101: Data Exchange - STEP reader makes unexpected enormous scaling of some parts
Modification to apply units scale factor for faces based on the triangulation
2022-08-23 18:34:10 +03:00
ddzama
1a1739b200 0032957: Add Standard_Noexcept definition
into Standard_Macro.hxx and
employ Standard_Noexcept.
2022-08-18 11:55:14 +03:00
msv
fd5c113a03 0033100: Modeling Algorithms - XCAFDoc_Editor::RescaleGeometry does not rescale triangulations
Make XCAFDoc_Editor::RescaleGeometry to pass the flag theCopyMesh==true
in call to BRepBuilderAPI_Transform::Perform.

Correct the help of the command XRescaleGeometry.
2022-08-13 13:53:14 +03:00
ichesnok
f74f684b16 0032979: Data Exchange, RWGltf_CafWriter - support multi-threaded Draco compression
'MultiThread' field was added to structure RWGltf_DracoParameters for using multithreading.
Class CafWriter_DracoEncodingFunctor was added for multithreaded compression.
2022-08-12 19:04:03 +03:00
dpasukhi
621ed3bc36 0033095: Data Exchange, Step Import - Wrong PMI values when loading a *.stp file in m
Fixed problem with dimension tolerance values (upper/lower)
 - Update supported type for tolerance measure unit, now we can handle base class
2022-08-11 10:43:32 +03:00
mzernova
81d569625e 0033084: Visualization - Cylindrical prism is selectable only by its base when extruded in some directions
Fixed bounding boxes for Select3D_SensitiveCylinder.

Added display of Select3D_SensitiveCylinder presentation using the "vsensdis" command.
Added test vselect/bugs/bug33084.
2022-08-04 17:50:46 +03:00
ngavrilo
6072d3093c 0032992: Visualization - Font_TextFormatter should wrap words when possible 2022-08-02 17:13:03 +03:00
jgv
e1b097eb67 0033006: Modelling Algorithms - UnifySameDomain raises exception
Correct processing cases where a group of faces lies on U-periodic and V-periodic (torus-like) surface.

Add comments according to the remarks
2022-07-29 19:11:52 +03:00
jgv
92d22d7d62 0033080: Wrong projection point from ShapeAnalysis_Surface
Correct Draw command "projface" so that it really finds only projection points belonging to the face.
2022-07-29 19:10:37 +03:00
dpasukhi
1b423e3287 0033068: Draw Harness, XDEDRAW - improve XGetProperties command to work with all document labels
Upgrade DRAW function XGetProperties to work with all document labels or sequence of labels
2022-07-24 22:33:24 +03:00
kgv
cb8519be19 0033074: Visualization, TKOpenGl - PBR shader compilation error on Mesa OpenGL 3.10033074
Graphic3d_ShaderManager::getPBREnvBakingProgram() - fix setting Graphic3d_ShaderProgram::SetPBR()
before defining GLSL version via defaultGlslVersion() that relies on this property.
2022-07-22 20:30:00 +03:00
kgv
617a2905a9 0033073: Coding Rules, RWGltf_CafWriter - suppress CLang warning coming from Draco library 2022-07-22 20:29:08 +03:00
kgv
18559e93cf 0033072: Configuration - ViewerTest_EventManager.cxx compilation error due to missing header on Emscripten
Added missing `#include <Message.hxx>`.
2022-07-22 20:28:01 +03:00
abulyche
c2e01cc5cc 0024049: Modeling Algorithms - crash in BRepOffsetAPI_MakePipe
Added the test for this ticket.
2022-07-22 20:27:15 +03:00
oan
0acc1ab47c 0033060: [Regression to 7.4.0] Mesh - Sub-precisional links provoke failure on face
Slightly increase exact resolution so to cover links with approximate length equal to resolution itself on sub-resolution differences.
2022-07-19 21:22:41 +03:00
ifv
b315a85dd7 0032940: Canonical Recognition: Some surfaces are not recognized as cylindrical surfaces
New method for recognizing cylindrical surfaces based on analysis Gaussian field of initial surface is added  in
class GeomConvert_SurfToAnaSurf
2022-07-19 21:20:53 +03:00
atychini
411ad1a819 0033055: Data Exchange, RWPly_Provider - remove dependency from BRepLib_PointCloudShape
Removing PointCloud writing feature from the RWPly_Provider class.
Getting rid of Pointcloud-related parameters in the RWPly_ConfigurationNode.
2022-07-18 07:32:54 +03:00
kgv
bbf49a300c 0033066: Visualization - null pointer dereference in MeshVS_ElementalColorPrsBuilder::Build() function
Added missing Boolean flag check.
2022-07-15 18:23:06 +03:00
ona
0bab2704ae 0031080: Data Exchange, STL reader - improve API for reading multi-domain STL files
reading of multidomain stl files into separate Poly_Triangulation objects
2022-07-15 18:22:10 +03:00
azv
33c8a72788 0031479: Modeling Algorithms - exception on geometry transformation of triangulation-only shapes (without geometry surface)
* Avoid crash in BRepBuilderAPI_GTransform algorithm. The crash in BRepBuilder_Transform has been solved by 0032716.
* Move copying modifier to BRepTools package.
* Implement copying of triangulation in BRepTools_NurbsConvertModification.
* Implement transformation of a triangulation in BRepTools_GTrsfModification.
* Update test case bugs/mesh/bug22778 to clean the triangulation after conversion to NURBS (reproduce the same behavior as before).
2022-07-08 19:30:13 +03:00
abulyche
315ed0be41 0032716: Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
* Implement methods for copying tessellation to BRepTools_TrsfModification to keep the triangulation during transformation.
* Add tests to reproduce the problem.
2022-07-08 19:30:13 +03:00
azv
d74b1e9dd3 0033049: Command 'tclean -geom' does not remove all geometric objects from the shape
Remove unused P-curves when cleaning the geometry
2022-07-08 19:30:12 +03:00
ifv
b47b075ac5 0032995: Modeling algorithms - Interface for checking canonical geometry
GeomConvert_CurveToAnaCurve, GeomConvert_SurfToAnaSurf - geometrical algorithms
for converting geometrical curve and surfaces in canonical geometry with given tolerance.

ShapeAnalysis_CanonicalRecognition - interface for checking canonical geometry.
2022-07-08 19:26:37 +03:00
kgv
7a52478f16 0032952: Coding Rules, Graphic3d_DisplayPriority - rename inconsistent Below2/Above1 enties
Below/Below2/Below3 triplet has been renamed to Below/Below1/Below2
for consistency with Above/Above1/Above2
2022-07-07 19:28:28 +03:00
kgv
9db675b3d6 0033056: Visualization - add front face culling option
Added Graphic3d_TypeOfBackfacingModel_FrontCulled enumeration value.
OpenGl_Context::SetFaceCulling() now supports GL_FRONT in addition to GL_BACK.

Added -faceCulling option to vaspects Draw command.
2022-07-07 19:27:17 +03:00
aml
e1d576bf31 0033046: Modeling algorithms - improve performance of per-facet shape construction
Add new class (BRepBuilderAPI_MakeShapeOnMesh) to reconstruct shape from triangulation on per-facet basis.
2022-07-07 19:26:22 +03:00
ifv
e1f7382910 0028243: Bad result of the canonical recognition
LProp/LProp_CLProps.gxx - minor modification to avoid floating overflow because of multiplication of large values
2022-07-07 19:23:55 +03:00
kgv
dee5eb82b5 0033054: Configuration - link errors due to missing references to new TKXDE toolkit
src/OS/DataExchange.tcl - added missing new toolkits.
TKRWMesh - added missing reference to TKTopAlgo (for using BRepLib_PointCloudShape).
Removed redundant dependency from TKBinXCAF.
DRAWEXE - added missing references for a static build.

THE_CONFIGURATION_SCOPE definition has been corrected to postpoine calling constructor till the first variable usage.
Fixed compiler warning at SelectMgr_Frustum<3>::DumpJson() due to misleading Standard_EXPORT for an inline template method definition.
2022-07-07 19:23:00 +03:00
aml
c2eed2a326 0033048: Foundation Classes - math_ComputeKronrodPointsAndWeights indexation goes beyond the limit
Add test and explanatory comment.
2022-07-06 19:16:55 +03:00
ichesnok
3a2ca49b6d 0032867: Data Exchange - Implement Draco compression for writing glTF
Draco compression added in RWGltf_CafWriter class.
2022-07-06 19:15:56 +03:00
dpasukhi
4f53e7b37c 0033011: Data Exchange - Backward compatibility XBF format
Fixed problem with moving the attribute position.
Made the same positions as version 7.5 with adding to the end.
2022-07-04 18:58:05 +03:00
ona
e01ce0cd52 0029854: XCAF GD&T: Clear contents of reserved labels only
Clear attributes from reserved child labels only
2022-06-30 19:33:37 +03:00
ona
34c407eb34 0029415: Data Exchange - Step reader cannot read the surfaces of the main body of the shape
Test for model reading check is added
2022-06-30 19:33:37 +03:00
aml
ef4e5e3bf1 0033040: Coding - get rid of unused headers [Storage to TopOpeBRepTool] 2022-06-30 19:33:36 +03:00
mgerus
ca1491f88b 0030398: Modeling Algorithms - thrusection produces twisted solid
Change FirstBary to PrevBary to correct Offset calculation relative prev wire instead of first wire
2022-06-30 19:33:35 +03:00
akaftasev
b284dc42dc 0032446: BRepOffsetAPI_MakePipeShell crash when using -DT mode and DT_ShapeDivide on the spine
Added test case
2022-06-30 19:33:35 +03:00
akaftasev
a0ffd4a521 0032445: BRepOffsetAPI_MakePipeShell crash when using -DT mode and DT_ShapeDivide on the spine
Added test case
2022-06-30 19:33:35 +03:00
jgv
07e803dee1 0032999: Modeling Algorithms - New option in ShapeUpgrade_ShapeDivide algorithm: splitting into N parts, into N*M parts
1. Multiple changes in ShapeUpgrade_ShapeDivideArea, ShapeUpgrade_FaceDivide, ShapeUpgrade_FaceDivideArea, ShapeUpgrade_SplitSurface, ShapeUpgrade_SplitSurfaceArea: new methods NbParts and SetSplittingByNumber, changes in ShapeUpgrade_FaceDivideArea::Perform and ShapeUpgrade_SplitSurfaceArea::Compute concerning new modes of splitting.
2. New Draw command "DT_SplitByNumber" for testing new modes of splitting.
3. New subgroups "split_number" and "split_two_numbers" in the group of tests "heal" for testing new modes of splitting.
2022-06-30 19:33:34 +03:00
aml
ec2d883e53 0033041: Coding - get rid of unused headers [TopTools to Xw] 2022-06-30 19:33:34 +03:00
oan
1593d38b13 0032692: Mesh - In BRepMesh_ModelPreProcessor avoid crashes with problematic topology
Improved the processing for the case where Failure flag for the meshing face is set. Specific tests added.
Check triangulation consistency even for shapes with problematic topology given that they are suitable for keeping it.
2022-06-29 21:32:45 +03:00
atychini
aaa03c1efb 0033029: Warning on Windows 32 and 64 with VC14 after the integration of ticket 32821
Warning has been fixed by adding condition.
2022-06-29 21:32:45 +03:00
aml
b2bce1d928 0033039: Coding - get rid of unused headers [StepData to StlAPI] 2022-06-28 20:23:23 +03:00
azv
581016faeb 0033028: Standard_ConstructionError while using ShapeUpgrade_UnifySameDomain
Additional check if the sequence of circular edges is a closed chain.
2022-06-28 20:22:28 +03:00
aml
6bf38f219b 0033025: Coding - get rid of unused Standard_TooManyUsers class 2022-06-27 07:02:50 +03:00
azv
63fa56bc83 0032915: Geom2dAPI_InterCurveCurve, The algorithm lost an intersection point.
Get rid of strange code: preliminary check of self-intersections is made on a polygonal representation of a curve, it is able to find possible intersections, but after that it filter out segments neighbor to the pair of non-intersected segments.

Test case de step_4 I1 has been marked BAD, because the self-intersection is treated correctly, but the projection algorithm generates such crooked 2D curve.

Reference data in test cases heal split_angle_advanced ZA5 and ZA6 has been updated, because those shapes have self-intersected edges, which are being detected now.
2022-06-23 20:40:07 +03:00
mgerus
a29bae45f9 0032877: Modeling algorithms - Sweeping issue
Add fix at sweeping algorithm: sweeping happens in the opposite direction as expected
Add test case tests/bugs/modalg_7/bug32877
2022-06-23 20:37:37 +03:00
atychini
6d1a049be7 0032821: DEWrapper - Implementation of a common toolkit for importing and exporting CAD files
Implementing DE_Wrapper and its formats
2022-06-23 20:29:00 +03:00
aml
b1970c8a47 0033022: Coding - get rid of unused headers [ShapeBuild to STEPControl] 2022-06-22 19:26:41 +03:00
mpv
f8c45c2f0d 0032894: Application Framework - Regressions on Ubuntu 20.04
Updated corrupted file reading error management, make memory unit-tests more stable.
2022-06-20 17:45:27 +03:00
aml
94748ad20e 0032653: Modeling Data - misprint in Geom2d_Conic.hxx api SetYAxis(const gp_Ax2d& theAY)
Fix misprint.
2022-06-17 19:28:07 +03:00
aml
2e0b684df3 0033019: Coding - get rid of unused classes 2022-06-15 20:46:16 +03:00
aml
a1f027b66e 0033018: Coding - get rid of unused headers [Plugin to ShapeAnalysis] 2022-06-15 20:41:12 +03:00
kgv
88ff1a3834 0033016: Documentation - Draw Harness User Guide mentions removed commands 'meshdispmode'
Updated description of MeshVS commands in User's Guide.
2022-06-14 21:52:44 +03:00
akondrat
fb30026cf1 0033009: Foundation Classes - Bnd_OBB::ReBuild() expects point array starting from 0
Add test. Update OBBTool constructor for any bounds of array of points.
2022-06-14 21:50:31 +03:00
snn
714fb6b516 0032954: Tool for applying transformation to OCAF document
New XCAFDoc classes:
- XCAFDoc_AssemblyIterator: iterator in depth along the assembly tree
- XCAFDoc_AssemblyGraph: assembly graph with iterator
- XCAFDoc_AssemblyTool: provides generic methods for traversing assembly tree and graph

A method for re-scaling (sub-)assembly geometry is added to XCAFDoc_Editor.

New DRAW commands:
- XDumpAssemblyTree: iterates through the assembly tree in depth up to the specified level, if any
- XDumpAssemblyGraph: prints assembly graph structure
- XDumpNomenclature: prints number of (sub-)assembly/part instances
- XRescaleGeometry: applies geometrical scale to (sub-)assembly
2022-06-10 18:56:40 +03:00
aml
bf8b7e08f1 0030492: Foundation Classes - math_BFGS fails if starting point is exactly the minimum
Fix affects BFGS optimization methods by checking convergence as the first step on each iteration. FRPR works well, but it is updated as well since its logic potentially dangerous.
2022-06-09 20:34:57 +03:00
Charlemagne Lasse
24e4b3c83b 0032929: Modeling Algorithms - Crash in PerformIntersectionAtEnd after deletion of surfdata
When creating a fillet, num is calculated via ChFi3d_IndexOfSurfData. If it
returns just the number of entries in surfdata, it can happen that this
value becomes invalid when handling the case "two faces common to the edge
are found". When both components are on an arc, there will be num removed
from the surfdata.

num would then be larger than the number of entries surfdata. The derived
num1 is therefore also incorrect. The subsequent usage of this
value will either:

* Debug build: cause an out of bounds exception in ChangeValue
  (`SeqFil.ChangeValue(num)`)
* Release build: cause a segfault when retrieving it via index num1
  (`SeqFil(num1)`)

num + num1 must be recalculated after the deletion happens to correctly
calculate the fillet.

Signed-off-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
2022-06-03 17:51:01 +03:00
Charlemagne Lasse
10a19b2a75 0032930: Modeling Algorithms - Crash in PerformIntersectionAtEnd when no face was found
The PerformIntersectionAtEnd code is currently not handling all the faces
correctly. If it retrieves Face[0] as F, it can happen that the previously
ran code didn't actually retrieve any faces in this array at all.

For example when:

* "if (nface==3)" is true
  - "if (!findonf1)" is true (doesn't assign any faces to this array)
  - "if (!findonf2)" is true (doesn't assign any faces to this array)
  - "if (state == ChFiDS_OnSame)" is not true (because it is
    ChFiDS_AllSame)
  - "if (findonf1 && !isOnSame1)" cannot be true (see above, but would
    handle faces)
  - "if (findonf2 && !isOnSame2)" cannot be true (see above, but would
    handle faces)
  - "if (isOnSame2)" is false (but would also handle faces)

Since no faces were assigned here, F would be a NULL face. As result, the
function will crash when trying to access the Surface behind the face via
`BRep_Tool::Surface(F);`.

While the best approach would be to identify the implementation bug in the
algorithm behind PerformIntersectionAtEnd, a check + exception is used
instead because the actual algorithm is not known.

Signed-off-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
2022-06-03 17:48:22 +03:00
Charlemagne Lasse
d30f25e6b1 0032931: Modeling Algorithms - Crash in ChFi3d_IsInFront when no face was found
The ChFi3d_IsInFront code is currently not handling all the combinations
correctly. For example, if `if(fd1->IndexOfS2() == fd2->IndexOfS2())` is
true, it can happen that the `TopoDS::Face(DStr.Shape(fd1->Index(jf1)))`
returns a Face with entity == NULL. The subsequent usage of this NULL face
in `BRep_Tool::Parameters( Vtx, face )` will then cause a segfault.

While the best approach would be to identify the implementation bug in the
algorithm behind PChFi3d_IsInFron, a check + exception is used instead
because the actual algorithm is not known.

Signed-off-by: Charlemagne Lasse <charlemagnelasse@gmail.com>
2022-06-03 17:46:28 +03:00
snn
cec41bb93d 0030024: Data Exchange - STEP, IGES export support of BRep shapes based on tessellated geometry
Support of reading and writing tessellated geometry is added for the following STEP entities:
- triangulated face
- complex triangulated face
- tessellated shell
- tessellated solid
- tessellated shape representation

Models without BRep geometry (mesh formats like STL, OBJ and so on) are supported for writing to STEP.

New parameters are added to enable/disable tessellated geometry reading and writing:
- read.step.tessellated (On/Off/OnNoBRep) (On by default)
- write.step.tessellated (On/Off/OnNoBRep) (OnNoBRep by default)

OnNoBRep - tessellation is read/written only for entities for which there is no BRep representation.

Faces with poly triangulation are written in STEP as triangulated face entities with one coordinates list per face.
Only one poly triangulation per face (returned by BRep_Tool::Triangulation) is written to STEP.
2022-06-03 17:44:17 +03:00
kgv
e9c43fee29 0032989: Data Exchange, RWGltf_CafReader - fill in metadata map from asset.extras 2022-05-31 19:26:25 +03:00
kgv
812afe4edb 0032991: Visualization, TKOpenGl - OpenGl_Window::Resize() ignores window virtual flag on macOS
Added handling of Aspect_Window::IsVirtual() flag on macOS platform.
2022-05-30 20:47:07 +03:00
kgv
48e4aad412 0032990: Configuration - compilation errors since Emscripten 3.1.11 due to time_t redefined long->int
Add std::is_same filter to IsEqual(time_t, time_t) definition.
2022-05-29 12:11:24 +03:00
afokin
23c56fc66a 0032974: Configuration - update environment for VS2022
removing a repeating condition in install.bat

add vc143 in .md files
2022-05-27 19:05:24 +03:00
akaftasev
795c0d5d73 0032447: BRepOffsetAPI_MakePipeShell result in inaccurate shape when using -DT mode and DT_ShapeDivide on the spine
Added new option '-C' with possibility to set value of Angular and linear tolerances to 'mksweep' command to correct input spine by merging smooth connected neighboring edges
2022-05-27 18:21:34 +03:00
akaftasev
fbf9efb8d5 0025309: Modeling Algorithms - Check of shape validity for BOP takes too long
Simplified condition to allow sampling for curve/surface data with depth == 0
Changed sorting method in MergeSolutions() method
2022-05-27 18:14:04 +03:00
atereshi
9b9aac4a7b 0032922: Data Exchange, STEP - The torus is stored incorrectly in STEP format
Problem: the complete surface of the torus is not stored correctly in STEP format due to the fact that the edges are not properly ordered.
Change: added a mode for reordering edges in the wire with simultaneous use of 2d and 3d information (ShapeAnalysis_WireOrder). The new mode is used for torus-like surfaces before saving to STEP format.
 Result: Torus correctly stored.
2022-05-27 18:14:03 +03:00
kgv
86d6c284c2 0032978: Visualization - AIS_ViewController::PickPoint() includes objects invisible in current View
SelectMgr_ViewerSelector::TraverseSensitives() now takes into account object's view affinity.
AIS_InteractiveContext::moveTo() - dropped code SelectMgr_AndOrFilter::SetDisabledObjects()
as filtering is now done by selector itself.

ViewAffinity property has been moved to PrsMgr_PresentableObject for simplicity.
Removed redundant map Graphic3d_CView::HiddenObjects().
2022-05-21 17:25:43 +03:00
ifv
84d39c06fa 0032973: Modeling Algorithms - Regression in BRepExtrema_DistShapeShape compared with 7.5
BRepExtrema/BRepExtrema_ExtCF.cxx - set correct using BRepAdaptor_Curve in Extrema
tests/bugs/modalg_8/bug32973 - new test case added
2022-05-18 19:18:52 +03:00
mgerus
df69c26472 0026697: BRepFeat_MakePrism returns empty compound
Add fix in direction of prism calculation
2022-05-18 19:14:43 +03:00
kgv
b56df3a60a 0032976: Visualization - AIS_InteractiveContext::FitSelected() includes objects invisible in current View 2022-05-17 20:15:55 +03:00
kgv
dcbd679c8b 0032975: Visualization, TKOpenGl - do not blit inactive Subview 2022-05-17 20:13:42 +03:00
aml
b9280b8b27 0032969: Coding - get rid of unused headers [IMeshData to PLib]
Removed unused exception classes OSD_Exception_FLT_DIVIDE_BY_ZERO, OSD_Exception_INT_DIVIDE_BY_ZERO, OSD_Exception_FLT_DENORMAL_OPERAND, OSD_Exception_FLT_INEXACT_RESULT, OSD_Exception_FLT_INVALID_OPERATION, OSD_Exception_FLT_OVERFLOW, OSD_Exception_FLT_STACK_CHECK, OSD_Exception_FLT_UNDERFLOW.
2022-05-17 20:09:12 +03:00
mgerus
2052b04e5b 0032807: Modeling Algorithms - Bad result of sweep operation when the UEdges has more than one intersect points
Add choosing the intersect point taking into account the tangentCross when prev UEdge and next UEdge has more than one intersect points;
Add exact correction of edge tolerance (it fix problems with edge tolerance on Linux);
Add exact check of edge tolerance in testcase
2022-05-16 21:08:21 +03:00
kgv
6036998511 0032970: Visualization, TKOpenGl - fix compilation on Linux: 'False' was not declared 2022-05-15 01:11:06 +03:00
ifv
33463eef63 0032942: Modeling Algorithms - Boolean operation Common has no result in specific example
IntTools/IntTools_BeanFaceIntersector.cxx - calculation of deflection for surface bnd box is added
tests/bugs/modalg_8/bug32942,bug32943,bug32944,bug32945 - new test cases added
2022-05-06 00:44:14 +03:00
abulyche
84f42008b7 0027081: BRepOffsetAPI_MakeOffsetShape fails on shapes with internal edges
Added the test for this problem.
Added new draw command "mkoffsetshape".
2022-05-06 00:43:27 +03:00
kgv
cb6c7c458c 0032955: Draw Harness, ViewerTest - extend vcolorconvert command to print color in hex format 2022-05-06 00:42:12 +03:00
aml
d2c11b791c 0032961: Coding - get rid of unused headers [IGESAppli to IGESToBRep] 2022-05-06 00:41:19 +03:00
ddzama
73035770f6 0032908: Coding Rules - fix E0349 MSVC compilation error on VS2019/C++20
Get rid of raw C strings in error code to avoid error 0349.
Use std::string instead.
2022-05-04 21:12:54 +03:00
ddzama
1966e6af07 0032919: Coding Rules - suppress useless MSVC warning C26812 on VS2019/C++20 (prefer 'enum class' over 'enum')
CMake and genproj scripts have been updated to suppress this misleading warning that cannot be fixed without breaking existing API.
2022-05-04 21:11:11 +03:00
aml
5dd4cb6e60 0032958: Coding - problem compile OCCT on Debian80-64 and MacOS-x86_64 with debugging mode
Add missing include.
2022-05-04 21:10:02 +03:00
aml
034d1403b1 0032953: Coding - add missing references where applicable 2022-05-04 21:08:16 +03:00
kgv
267738fc40 0032959: Visualization, OpenVR - add Oculus Touch controller bindings 2022-05-04 12:55:59 +03:00
ddzama
e976df2329 0032920: Coding - fix checking of std::stringstream buffer size on VS2019/C++20
Use tellp() instead of in_avail() for testing non-empty std::stringstream state.
2022-04-30 13:22:46 +03:00
aml
82598ec0f2 0032951: Coding - get rid of unused headers [GeomConvert to IGESBasic] 2022-04-29 18:09:58 +03:00
ddzama
7b3f255f23 0032917: Coding Rules - eliminate MSVS warning C26440 on VS2019/C++20 (If your function may not throw, declare it noexcept)
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of warning C26440: "If your function may not throw, declare it noexcept"

"If code is not supposed to cause any exceptions,
it should be marked as such by using the 'noexcept' specifier.
This would help to simplify error handling on the client code side,
as well as enable compiler to do additional optimizations."
2022-04-29 18:09:00 +03:00
ddzama
4e1b5fcbf0 0032903: Coding Rules - eliminate MSVC warning C26451 on VS2019/C++20
Put explicit type casting to avoid:
Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte
value and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
2022-04-27 00:59:45 +03:00
ddzama
9416ba5fb0 0032907: Coding Rules - eliminate MSVC warning C5054 on VS2019/C++20 (operator &,|: deprecated between enumerations of different types)
operator `&`,`|`: deprecated between enumerations of different types
2022-04-27 00:58:30 +03:00
snn
e9a13cf123 0032914: Data Exchange - Some parts of compound are lost while writing STEP in nonmanifold mode
Code related to supporting of single SDR for a non-manifold group, which prevents writing all translation results except the first one, is removed.
SDRs with null used representation object are excluded from writing.
2022-04-27 00:57:20 +03:00
ifv
a0b4fff17a 0028866: Modeling Data - Problem with GeomAPI_ProjectPointOnSurf
Extrema/Extrema_GenExtPS.cxx - adaptive setting of sample points is implemented
bugs/moddata_3/bug28866 - test case added
2022-04-22 18:51:27 +03:00
jgv
51db8cab7b 0032864: Modeling Algorithms - Normal projection of a wire on a cylinder produces wrong result
Minor correction in method BRepAlgo_NormalProjection::Build: correct mixed up first and last parameters of the projected curve.
2022-04-22 00:29:38 +03:00
ddzama
8af9bbd59a 0032906: Coding Rules - get rid of std::iterator inheritance (deprecated since C++17) 2022-04-22 00:27:47 +03:00
jgv
1f45f21358 0032721: Modeling Algorithms - BOP wrong results on a cone and an extrusion
1. Modify method IntPatch_ALineToWLine::MakeWLine: add correction of end points of each line on 2 surfaces if an end point is a pole on a surface.
2. Modify method IntPatch_WLine::ComputeVertexParameters: adjust a point on curve to corresponding vertex the following way: set 3D point as the point of the vertex and 2D points as the points of the point on curve.
2022-04-19 19:23:10 +03:00
ifv
d7f5072158 0032882: Modeling Data - Extrema curve/curve cannot find all solutions
Extrema/Extrema_GenExtCC.gxx - estimation of Lipchitz constant is improved
Extrema_GlobOptFuncCC.cxx - function value is changed

LocOpe/LocOpe_WiresOnShape.cxx - small correction to fix regression

lowalgos/extcc/bug32882 - new test case is added

some test were updated according new behavior of extrema algo
2022-04-19 19:20:12 +03:00
kgv
7090725e2b 0032935: Visualization, TKOpenGles - use size window within OpenGl_Window::init() 2022-04-19 19:18:42 +03:00
azv
d8bfee7b03 0031437: Modeling Data - Offset surface throws exception when trying to evaluate at singularity point
Add test case to prove the exception is avoided.
2022-04-16 22:29:47 +03:00
kgv
879768fbf2 0032886: Visualization, V3d_View - introduce interface for creating a subview
V3d_View/Graphic3d_CView pair has been extended to define subview within the other V3d_View instance.
The initialization is done in form of V3d_View::SetWindow() taking parent V3d_View instance on input.

Subview definition includes dimensions defined as a fraction of a parent view and offset from a corner.
This scheme allows splitting window into several subviews automatically occupying entire viewport,
like splitting window into two vertial subviews (100%x50% + 100%x50%),
three horizontal subviews (33%x100% + 30%x100% + 30%x100%),
1 + 2 stacked subviews (50%x100% + 50%x50% + 50%x50%),
as well as thumbnail-alike subviews displayed on top of another larger view.

OpenGl_View::Redraw() blits content of subviews into the window within immediate redraw step.

AIS_ViewController::FlushViewEvents() has been extended
to re-calculate mouse input into local subview coordinates.
AIS_ViewController::handleViewRedraw() first redraws subviews and then parent views.
Introduced new callback AIS_ViewController::OnSubviewChanged()
to switch input focus to another subview on mouse click,
implemented by ViewerTest_EventManager (has to be done at application level).

vinit command has been extended with parameters -subview and -parent to create a subview.
In addition, view dimension arguments now can be defined as a fraction of screen size instead of pixels.
2022-04-15 18:23:16 +03:00
atychini
179fb34661 0029435: Data Exchange - Exporting wires consisting of more than one edge results in loss of color data in IGES
Colors wasn't read correctly because of incorrect curve transfers in IGESToBRep_TopoCurve.cxx
I added new calls to SetShapeResult() at the necessary places.
Also in the IGESCAFControl_Writer.cxx I added new condition because of the possible NULL exception.
2022-04-15 18:21:46 +03:00
kgv
1caf5fd317 0032924: Configuration, CMake - export INTERFACE_INCLUDE_DIRECTORIES within targets
Add 'INCLUDES' property within INSTALL targets.
2022-04-15 18:20:01 +03:00
ifv
fc41d3b1c0 0032842: Modeling Data - a regression in conversion of a face to bspline
GeomConvert/GeomConvert_1.cxx - forbid using CheckAndSegment if trim is out of base period when converting
                                trimmed torus

tests/bugs/moddata_3/bug32842 - test case added
2022-04-12 20:50:29 +03:00
kgv
08d9c0ae45 0032926: Coding, StdPrs_ToolTriangulatedShape::Normal() - range of "for" not correspond to the NCollection index which run in "for"
Obsolete method has been removed.
2022-04-12 20:46:27 +03:00
ddzama
7021de2fe7 0032909: Coding Rules - replace (removed from C++17) std::random_shuffle with std::shuffle for random permutation algorithm
Since C++17 the accessible version of permutation function left the function:

template< class RandomIt, class URBG >
void shuffle( RandomIt first, RandomIt last, URBG&& g );

See details and example of use: https://en.cppreference.com/w/cpp/algorithm/random_shuffle
2022-04-08 19:04:34 +03:00
ddzama
e455c54bf0 0032918: Coding Rules - suppress MSVS warnings from 3rdparty rapidjson on VS2019/C++20
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Disable warning messages, occures in rapidjson library.
2022-04-08 19:02:14 +03:00
ddzama
d31e5dbbb4 0032916: Coding Rules - eliminate MSVS warning C26451 on VS2019/C++20 (Arithmetic overflow: Using operator '+' on a 4 byte value...)
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of `Warning C26451 Arithmetic overflow: Using operator '+' on a 4 byte value
and then casting the result to a 8 byte value.
Cast the value to the wider type before calling operator '+' to avoid overflow (io.2)`
2022-04-08 18:55:02 +03:00
ddzama
878ea8cd2b 0032910: Coding Rules - fix uninitialized class fields in constructor initialization block reported by VS2019/C++20
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of warnings about uninitialized class fields in constructor initialization block.
2022-04-08 18:52:41 +03:00
azv
ee6581adbe 0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0
Use precision depending on radii of participating circles.
2022-04-08 18:50:30 +03:00
mpv
1fff4ad5a7 0032870: Tests - bugs/caf/bug31918_1 is unstable
# Make the compared values more stable.
2022-04-07 19:21:40 +03:00
azv
a793b75e21 0032809: Sweep algorithm with Round Corner mode failed
Fix indentation within GeomFill_Sweep.cxx

0032809: Sweep algorithm with Round Corner mode failed

Add fix what repair shipping at corner after circle edge at path
Add fix test for bug 24909_3
2022-04-07 19:20:09 +03:00
kgv
5078d0d84e 0032912: Visualization - crash when displaying an OBJ file with missing texture file
Fix NULL dereference within Graphic3d_TextureRoot::convertToCompatible() due to wrong order of checks.
2022-04-06 22:58:16 +03:00
azv
ad3825f821 0030160: DBRep_IsoBuilder builds wrong isolines for planar faces
Add test case
2022-04-06 03:20:38 +03:00
AndreyLA
fe12f15cb4 0024657: 2dintersect returns different number of intersect points in curve intersecting the polygon points is never replaced by line
Test for 2d intersection is added
2022-04-06 03:19:45 +03:00
mgerus
b2ec2f5d42 0031361: Modeling algorithms - An exception arise when building tube
* Add status flag to GeomFill_Pipe
* Add myIsPerform flag to GeomFill_Pipe
* Add checking vectors in GeomFill_CorrectedFrenet
* Add boolean return to SetCurve virtual methods
* Add test case
2022-04-06 03:17:55 +03:00
sshutina
e3fd3d83da 0032861: Visualization - Separate rotate and move the object behavior in AIS_ViewController
Added the flag in Dragging structure that defines perform dragging (ToMove).
2022-04-06 03:16:12 +03:00
ifv
1f37f1d50a 0031661: Modeling Data - Exception when projecting parabola or hyperbola to plane
ProjLib/ProjLib_ProjectOnPlane.cxx - formatting

0031661: Modeling Data - Algorithm crashes when projecting parabola or hyperbola to plane

ProjLib/ProjLib_ProjectOnPlane.cxx - building of analytical parabola and hyperbola is added
bugs/moddata_3/bug31661_* - new test cases are added
2022-04-06 03:15:07 +03:00
AndreyLA
1f000e5974 0031009: Modeling Algorithms - leak reported by Clang address sanitizer in IntCurvesFace_ShapeIntersector
Refactor IntCurvesFace_ShapeIntersector. Use handles and std::unique_ptr instead of raw pointers.
2022-04-06 03:13:47 +03:00
kgv
2491eec38b 0032897: Tests - include elapsed time into test log
Added "ELAPSED TIME" to test case log.
Improved syntax of chrono/dchrono command:
added -elapsed, -userCPU, -sysCPU options printing individual values in seconds.

OSD_Chronometer::IsThisThreadOnly() - added missing accessors to the property.
2022-03-31 21:49:12 +03:00
abulyche
ab279b126b 0029745: Modeling Data - GeomAdaptor_Surface::VIntervals fails on periodic surfaces
Fixed GeomAdaptor_Curve::LocalContinuity() for periodic curves.
Fixed GeomAdaptor_Curve::NbIntervals() for periodic curves.
Fixed GeomAdaptor_Curve::Intervals() for periodic curves.
Improved definition of length in tests.
Update Geom2dAdaptor_Curve to the same behavior.
2022-03-31 21:47:58 +03:00
azv
e4753a7d16 0032863: Cone surface returns wrong v derivative
* Fix error on computing V first derivative on a cone (take into account the slope of the conical generatrix).
* Add DRAW command 'sderivative' to compute certain derivative on a surface.
2022-03-25 20:13:38 +03:00
knosulko
5ae6f08cc6 0024772: Modeling Algorithms - Intersection of cylinder and cone produces incorrect results
GeomInt/GeomInt_IntSS.cxx - handle flat cone case
IntPatch/IntPatch_Intersection.hxx, IntPatch/IntPatch_Intersection.cxx - method for preparing surfaces is added
bugs/lowalgos/intss/bug24772 - test case is changed according new behavior
2022-03-24 19:56:56 +03:00
azv
9b337ad8e5 0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0
Improve tolerance criteria to check values of extremas for equality: use multiplier, which depends on the value, instead of magic number
2022-03-21 19:11:50 +03:00
AndreiLA
3425e83f4b 0023820: Wrong result of projection algorithm when a polygon geometry is projected on a set of multiple faces
The tests are added to verify the correctness of the projection algorithm's work in two cases.
2022-03-21 19:08:57 +03:00
mpv
e720157864 0032442: Application Framework - Problems of testing on MacOS arm64 platform
Fixed the problem of reading XML files on MacOS. 'errno' was not reseted
even the 'strtol' function produced a good value. So, now it is erased
forcibly before the call.
2022-03-18 17:53:47 +03:00
atychini
452ba192d5 0032817: Data Exchange - Step export - writing untrimmed Curve
Incorrect curve handling.
If curve doesn't have trims and vertexes, we handle it such as trimmed curve, but it should be a simple curve.
Curves with only one vertex and one trim should handle by another way, such as a curve that has trims but doesn't have vertexes.
So I added conditions which handles these cases
2022-03-17 18:44:06 +03:00
azv
9140163ba8 0032066: Modeling Algorithms - Incorrect result of Boolean CUT operation
Do not limit the normalization factor of the highly anisotropic parametric space when filtering start points in the algorithm of walking line construction.
Additionally check the knots are in the increasing orders when merging two B-spline curves
2022-03-17 18:42:34 +03:00
mpv
7573a45deb 0032870: Tests - bugs/caf/bug31918_1 is unstable
Improved the test stability: created 10 iterations of measurements and take the minimum to
minimize the affect of other processes and threads; increased the compare range of
the quarter and the whole of the document load.
2022-03-14 19:25:14 +03:00
jgv
802180e1a5 0032719: Modelling Algorithms - UnifySameDomain result has incorrect triangulation
Correct method ShapeUpgrade_UnifySameDomain::UnionPCurves: reparametrize unified pcurves to fit the new range of 3D-curve.
2022-03-14 19:24:17 +03:00
kgv
8ca58a51a7 0032866: Visualization, TKOpenGles - FitAll() is broken when performance counters are displayed
OpenGl_View::MinMaxValues() - added missing theToIncludeAuxiliary check.
2022-03-07 02:13:22 +03:00
vro
acce2c1448 0032796: Modeling Data - Calculation of distance between two circles crashes
Modified:
- Extrema_ExtCC.cxx, the method PrepareParallelResult() - angular tolerance is increased.

Added:
- A test: lowalgos extcc bug32796
2022-03-05 17:33:56 +03:00
kgv
633084b809 0032862: Visualization, Graphic3d_TextureMap - add 3D texture definition
Image_PixMap has been extended to support definition of 3D bitmap (as an array of 2D slices).

Graphic3d_TypeOfTexture enumeration values have been renamed to include full enum prefix.
Added Graphic3d_TypeOfTexture_3D redirecting to GL_TEXTURE_3D.
OpenGl_Texture::Init() has been extended to allow initialization of 3D texture.

Graphic3d_Texture2Dmanual merged into Graphic3d_Texture2D and marked as deprecated alias.
Graphic3d_TOT_2D_MIPMAP has been deprecated in favor of dedicated Graphic3d_TextureRoot::SetMipMaps().

Added Graphic3d_Texture3D class.
vtexture - added argument -3d for uploading 3D texture.
2022-03-05 17:31:39 +03:00
kgv
a9e5f65041 0032837: Documentation, Geom_Surface - add references to GeomLib::NormEstim() for Normal computations
References to GeomLib::NormEstim() have been put to Geom_Surface, Adaptor3d_Surface and BRepAdaptor_Surface.
Improved documentation of GeomLib::NormEstim().
2022-03-03 20:09:35 +03:00
kgv
b9a372bbcd 0032841: Visualization - add 16-bit grayscale pixel format to Image_PixMap
Added Image_Format_Gray16 pixel format definition, which could be uploaded into GL_R16 texture.
Added Image_Format_GrayF_half mapped to GL_R16F texture.
2022-03-03 20:07:53 +03:00
kgv
b5204c6c37 0032860: Coding Rules, Extrema_GenExtPS - add exported destructor
Added eplicit destructors to classes Extrema_GenExtCS, Extrema_GenExtPS and Extrema_GenExtSS.
2022-03-03 20:06:50 +03:00
kgv
75e2ba1695 0032856: Configuration, CMake - SONAME should include minor version in addition to major to reflect ABI compatibility
Added option BUILD_SOVERSION_NUMBERS to manage SOVERSION length.
Default option value is set to 2 (major.minor) instead of previously used 1 (major),
excluding Android/Emscripten/Windows platforms that use 0 by default.
2022-03-01 19:22:48 +03:00
ifv
5c48956f8e 0032849: Modeling Algorithms - Intersection algorithm returns incomplete result.
GeomInt/GeomInt_IntSS.cxx, IntTools/IntTools_FaceFace.cxx - setting deflection 0.01
for case of two bspline surfaces
IntPolyh/IntPolyh_Intersection.cxx, IntPolyh/IntPolyh_Intersection.hxx - status IsParallel is added

BndLib/BndLib_Add3dCurve.cxx, IntTools/IntTools_TopolTool.cxx - fix small bugs

Correction of test scripts according to current behavior of algorithms

lowalgos/intss/bug32849 - test case added
2022-03-01 18:57:09 +03:00
kgv
b9184c2714 0032834: Configuration, CMake - DESTDIR ignored for OpenCASCADECompileDefinitionsAndFlags-${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake
Replace redundant configure_file() with normal file copy for installing OpenCASCADECompileDefinitionsAndFlags- files.
2022-02-26 21:52:21 +03:00
kgv
e61aa824db 0032854: Documentation - minor clean-up of User Guide for XDE module
Applied minor formatting improvements to `xde.md`.
Fixed small misprints and artifacts in text.
Removed redundant section "Working with XDE".
2022-02-25 18:10:52 +03:00
vro
5a846a5d2c 0029219: Application Framework - XML document is written with CRLF on Windows
The last symbol of a line is synchronized with external products.
Also, XML ends by LF now.

Modified:
XML: XmlLDrivers_DocumentStorageDriver::Write() ends by LF
BREP: BRepTools::Write(), Draw_VariableCommands::save() ends by LF
STEP: StepSelect_WorkLibrary::WriteFile() ends by LF
IGES: IGESSelect_WorkLibrary::WriteFile(), IGESControl_Writer::Write(), XSDRAWIGES::WriteShape() ends by LF
VRML: VrmlAPI_Writer::write_v2() ends by LF

0029219: Application Framework - XML document is written with CRLF on Windows

The last symbol of a line is synchronized with external products.
Also, XML ends by LF now.

Modified:
XML: XmlLDrivers_DocumentStorageDriver::Write() ends by LF
BREP: BRepTools::Write(), Draw_VariableCommands::save() ends by LF
STEP: StepSelect_WorkLibrary::WriteFile() ends by LF
IGES: IGESSelect_WorkLibrary::WriteFile(), IGESControl_Writer::Write(), XSDRAWIGES::WriteShape() ends by LF
VRML: VrmlAPI_Writer::write_v2() ends by LF
STL: RWStl::WriteAscii() ends by CR LF (to synchronize with Blender)

0029219: Application Framework - XML document is written with CRLF on Windows

The last symbol of a line is synchronized with external products.
Also, XML ends by LF now.

Modified:
XML: XmlLDrivers_DocumentStorageDriver::Write() ends by LF
BREP: BRepTools::Write(), Draw_VariableCommands::save() ends by LF
STEP: StepSelect_WorkLibrary::WriteFile() ends by LF
IGES: IGESSelect_WorkLibrary::WriteFile(), IGESControl_Writer::Write(), XSDRAWIGES::WriteShape() ends by LF
VRML: VrmlAPI_Writer::write_v2() ends by LF
2022-02-22 20:25:47 +03:00
vro
b91e601442 0032785: Application Framework - CDF_Store::SetFolder incorrectly processes relative paths on Linux
The code is simplified - it checks the last character and if it is a folder separator, it removes it.

Modified file:
- CDF_Store.cxx, the method SetFolder().

0032785: Application Framework - CDF_Store::SetFolder incorrectly processes relative paths on Linux

The code is simplified - it checks the last character and if it is a folder separator, it removes it.

Modified file:
- CDF_Store.cxx, the method SetFolder().

0032785: Application Framework - CDF_Store::SetFolder incorrectly processes relative paths on Linux

The code is simplified - it checks the last character and if it is a folder separator, it removes it.
// Also, variable 'l' is renamed to 'aLen'.
// And a check on the number of characters is added to avoid removal of the root folder ('/').

Modified file:
- CDF_Store.cxx, the method SetFolder().
2022-02-22 20:23:29 +03:00
knosulko
cfde7eebb3 0024418: Modeling Algorithms - Wrong section curves when intersecting analytical surfaces
IntPatch_ALineToWLine.cxx - setting minimal number of points in a WLine depending on step size
IntPatch_WLineTool.cxx - fix WLines connecting check condition
test cases has been changed according to new behavior
2022-02-22 20:07:12 +03:00
jgv
600ee85631 0032814: Modeling algorithms - Unifysamedom produces invalid result
Minor correction in ShapeUpgrade_UnifySameDomain::IntUnifyFaces: correct collecting splitting vertices in the new wire
2022-02-18 18:29:10 +03:00
vro
8dee83b0f3 0032840: Application Framework, copying of a scaled shape fails
A flag not to raise an exception is set for a copying shape. A reason: if a shape is already in the model, the user should have an opportunity to copy it.

Modified files:
TNaming_CopyShape.cxx, the method Translate(). A false-flag is used on copying of location of the shape.
2022-02-18 18:27:59 +03:00
jgv
2d0dd76414 0032715: Modelling Algorithms - UnifySameDomain does incomplete union
Add the case of closed, smooth but not periodic surface (unification of faces lying on it if the flag "myConcatBSplines" is true - modify the underlying surface to make it periodic).
2022-02-17 21:45:44 +03:00
aml
08984eda3d 0032838: Coding - get rid of unused forward declarations (misc) 2022-02-17 21:42:56 +03:00
aml
b66cf6dae5 0032832: Coding - get rid of unused headers [FairCurve to GeomAPI] 2022-02-14 22:07:15 +03:00
Chris Hennes
f91202f3ee 0031585: Access Violation while creating fillet - ChiFi3d_Builder::PerformIntersectionAtEnd
There is one case in PerformIntersectionAtEnd that did not test whether
an array access exceeded the length of the array, in rare cases
resulting in a segmentation fault. That error-handling behavior is
replaced by the exception code used elsewhere in the function. For
consistency, the code is copied exactly as implemented elsewhere. This
code has the same effect as that proposed by the bug submitter.
2022-02-14 22:02:07 +03:00
kgv
072b4d382d 0032831: Documentation - drop misleading "FreeType 2.4.10 - 2.5.3" version range
Removed duplicating information about supported versions of 3rdparty libraries from `building_3rdparty.md`.
2022-02-14 22:00:32 +03:00
kgv
3d21fe1aee 0032827: Configuration - compilation error on Emscripten SDK 2022-02-10 20:40:38 +03:00
kgv
2922a73ea7 0032826: Data Exchange - use OSD_FileSystem within RWStl::ReadAscii() and StepFile_Read() 2022-02-10 20:39:28 +03:00
gka
e2d60d0f7f 0029325: Modeling Algorithms - add tool BRepLib_PointCloudShape for generation point cloud for specified shape
Added PLY writing tools RWPly_CafWriter and RWPly_PlyWriterContext.

Added tool BRepLib_PointCloudShape generating point cloud from shape in two ways:
- random points on surface with specified density;
- points from triangulation nodes.

StdPrs_ToolTriangulatedShape::ComputeNormals() has been moved to
BRepLib_ToolTriangulatedShape for reusing outside of AIS.

Command vpointcloud has been extended to use new generation tool.
Command writeply has been added to write triangulation or point set into PLY format.
2022-02-08 22:15:24 +03:00
oan
ae38730d35 0032813: Units: ToSI and FromSI return cached dimension from previous request when parsing of unit sentence is failed
Cache value only if all necessary preparation steps are done.
2022-02-04 19:25:58 +03:00
dpasukhi
e1f5ac2c9b 0032731: Data Exchange, Step Import - Incorrect PMI text location
Added new complex Entity for representation of PMI
Added moving the presentation with new entity
2022-02-02 18:25:36 +03:00
knosulko
0b6a0adb3a 0032767: Mesh - incorrect splitting of edges of seams leading to hang [since OCCT 7.4.0]
- fix step by parameter of the edge while split curve in case of seam edges
2022-02-02 18:23:59 +03:00
aml
59cfb82b02 0032810: Coding - missing Standard_EXPORT in Standard_ErrorHandler 2022-02-02 18:22:18 +03:00
aml
1eed3c7873 0032812: Coding - problem after integration 32806 2022-01-31 07:01:49 +03:00
aml
7109a4ae58 0032806: Coding - get rid of unused headers [Contap to Extrema] 2022-01-28 18:30:32 +03:00
atychini
ff77ee8103 0032748: Data Exchange, Step Import - xstep.cascade.unit doesn't work [regression since OCCT 7.6.0]
Added new condition in STEPControl_ActorRead::Transfer: if StepData_StepModel is not an initialized Unit - we set unit to this step model
2022-01-28 18:29:12 +03:00
kgv
223ae699c7 0032795: Documentation - clarify indexation range within Poly_Triangulation/Graphic3d_ArrayOfPrimitives classes 2022-01-25 21:56:45 +03:00
ifv
9eee5ab7e4 0032701: Modeling Algorithms - 2d curve has bending near the degenerated edge of the face
ApproxInt_Approx, ApproxInt_KnotTools, BRepApprox_Approx,
GeomInt_IntSS, IntTools_FaceFace:
  Analysis of curvature is added for adjusting ParametrizationType

IntPatch_Intersection.cxx - adding methods for estimation of UV max step depending on used surfaces

GeomInt_IntSS.cxx, IntTools_FaceFace.cxx - using methods for max step estimation

Approx_SameParameter.cxx - adding control against big values.

BOPAlgo_PaveFiller_6.cxx - adjusting position of faces before intersection
2022-01-25 21:54:13 +03:00
kgv
5614b1369a 0032783: Documentation - Doxygen 1.9.3 generates corrupted HTML for dox/samples/ocaf.md
Fix incorrect/fragile Markdown syntax in samples/ocaf and user_guides/modeling_data.
2022-01-19 20:07:55 +03:00
aml
33a4d46b28 0032781: Coding - get rid of unused headers [BRepCheck to ChFiKPart] 2022-01-19 20:05:46 +03:00
Dzmitry Razmyslovich
d7dac7fc36 0032784: BinXCAF fails to load documents containing the shapes with scaled/mirrored location
A flag not to raise an exception is used on reading of an XCAF document. If such a shape with scaling transformation is stored in the document, it should be read.
2022-01-19 20:01:14 +03:00
kgv
ba9548c55b 0032668: Documentation - add tutorial for creating a custom AIS Interactive Object 2022-01-18 21:46:09 +03:00
kgv
2275caec09 0032780: Visualization, TKOpenGl - add smoothing to row interlaced stereoscopic output
Added new option Graphic3d_RenderingParams::ToSmoothInterlacing enabled by default.
Added -smooth   option to vstereo command.
Added -dpiAware option to vinit   command (Windows).
2022-01-17 20:04:30 +03:00
kgv
ddb9ed4810 0032779: Visualization, TKOpenGl - support using a wide color window buffer format (10bit per component / 30bit RGB)
Added new flag OpenGl_Caps::buffersDeepColor disabled by default.
OpenGl_Window now tries to find a RGB10_A2 pixel format using wglChoosePixelFormatARB().
OpenGl_TextureFormat::FindSizedFormat() - added handling of GL_RGB10_A2 internal format.
OpenGl_View::SetWindow() now selects preferred FBO color format basing on parameters.
OpenGl_Context::DiagnosticInformation()/OpenGl_View::DiagnosticInformation() now include
information about window pixel format / FBO texture format.
2022-01-17 20:03:28 +03:00
isn
7073768338 0028642: BRepOffsetAPI_ThruSections/BRepFill_Generator are modifying the input shape sections
1) BRepFill_Generator and BRepOffsetAPI_ThruSections now support 'non-destructive' mode for the input shapes (sections wires). The shape history of this algorithms also has been modified.
2) New test grids (based on the previous ones) have been added. These new cases use locked shapes as input arguments
3) The option '-safe' has been added to 'thrusections' command
2022-01-17 20:02:13 +03:00
achesnok
71943b31f8 0032722: Visualization, TKOpenGl - performance counters disappear at some camera viewpoints
Fixed OpenGl_FrameStatsPrs::Render() to enable depth clamping.
Fixed OpenGl_View::MinMaxValues() to take into account performance overlay.
2022-01-14 18:04:40 +03:00
emv
0101c6febe 0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode "Complete" join type "Intersection"
Add more faces for intersection in rebuilding process basing on the connection of the splits of offset faces (special treatment for the artificially invalid faces).
When rebuilding faces add vertices common for faces for trimming the new intersection edges.

Adjust existing and create new test cases.
2022-01-13 20:52:33 +03:00
kgv
dfa2a6719c 0032763: Coding Rules - eliminate CLang warning -Wbitwise-instead-of-logical in math_FunctionSetRoot.cxx 2022-01-13 20:51:37 +03:00
aml
9ff36dac47 0032768: Coding - get rid of unused headers [BopAlgo to BRepBuilderAPI] 2022-01-12 23:10:09 +03:00
kgv
7e524fcbe1 0032764: Coding Rules - missing include guard in BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx 2022-01-10 19:46:35 +03:00
kgv
d925497360 0032758: Visualization, TKOpenGl - disable shadow-map from transform-persistence objects
OpenGl_View::renderShadowMap() now skips transform-persistent objects.
OpenGl_ShadowMap::UpdateCamera() - removed redundant Z-range expansion for non-rendered objects.
Improved syntax of vdrawtext command.
2022-01-10 19:45:09 +03:00
vro
6cb968fd6f 0032757: Application Framework, scaling transformation - loading of an OCAF XML document fails
A flag not to raise an exception is used on reading of an OCAF document. If such a shape with scaling transformation is stored in the document, it should be read.

Modified files:
XmlMNaming\XmlMNaming_NamedShapeDriver.cxx: not checking of the type of transformation for a read shape
2022-01-10 19:43:48 +03:00
jgv
e2a956a633 0032747: Modeling Algorithms - Exact HLR algorithm gives wrong result
Modify the method IntWalk_IWalking::TestArretCadre: correct the value of scalar product of two vectors according to the tolerances in U and V.
2022-01-10 19:42:11 +03:00
achesnok
16a263dc17 0032606: Visualization - add a shader for sky V3d_View::BackgroundSkydome()
Introduced V3d_View::SkydomeAspect() property for generating skydome cubemap environment.
Skydome features: day/night cycle, 2 types of clouds, atmosphere, water surface, stars, fog.
2021-12-30 00:14:47 +03:00
asuraven
2ac4e1beee 0032744: Modeling Algorithms - Endless loop in GCPnts_UniformDeflection
fixed finish criteria in CPnts_UniformDeflection::Perform()
2021-12-28 19:23:48 +03:00
aml
2f23e4e3a5 0032751: Coding - get rid of unused headers [AppStd to BndLib] 2021-12-27 10:17:16 +03:00
emv
bcecb5832b 0032644: Modeling Algorithms - Empty result of section operation
Use distance criteria additionally to parameter criteria when verifying the extrema solution to belong to the edge boundary.
Refactor the BRepExtrema_DistanceSS class to remove the excessive methods with mirrored parameters.
2021-12-23 19:19:11 +03:00
aml
f32cb549d8 0032742: Coding - get rid of unused headers [Adaptor2d to Approx] 2021-12-20 18:11:59 +03:00
kgv
ce7fe22d97 0032743: Coding Rules - remove unused class friends of Package classes 2021-12-20 18:10:56 +03:00
kgv
1bc34debc1 0032740: Coding Rules, OpenGl_Context.cxx - new warning on macOS after integration fix for #32732 2021-12-19 12:29:47 +03:00
kgv
302ad26bff 0032739: Configuration, scripts - handle ABI list within macOS building script adm/scripts/macos_build.sh 2021-12-17 17:51:40 +03:00
kgv
90eac74988 0032738: Configuration, scripts - handle ABI list within iOS building script adm/scripts/ios_build.sh
Variables "toSimulator" and "anAbi" within "ios_custom.sh"
have been replaced by "anAbiList" which can be defined like "iPhoneOS|arm64 iPhoneSimulator|arm64".
Added "toPackFat" option packing multiple architectures into FAT archives.
2021-12-17 17:48:53 +03:00
kgv
4d476dd2ed 0032732: Visualization, TKOpenGl - do not include system headers within OpenGl_GlFunctions.hxx 2021-12-17 17:43:29 +03:00
kgv
f291ad2528 0032733: Coding Rules - fix misprints in Doxygen tags 2021-12-17 17:41:36 +03:00
ichesnok
468856bf4a 0032452: Data Exchange - IGES reader returns invalid shapes if xstep.cascade.unit property is changed from default
Fixed documentation in 'IGES Translator' and 'STEP Translator' sections (description of the read.maxprecision.val parameter).
2021-12-16 19:26:41 +03:00
kgv
2f195ab915 0032484: Configuration, CMake fails to find EGL and GLES2 include directory on iOS platform
Fixed configuration errors and compilation errors on iOS target due to unexpected EGL usage (non-existing on iOS).
2021-12-16 19:24:31 +03:00
ssafarov
6ba81a695f 0026174: Data Exchange, IGES - Loss of color after the second write of file
A copy of myface is made, where further on the copy the geometry changes. We connect the face, wire, edge of the original shape with the one whose geometry was changed. This is done in order to get the original shape in the TransferWire() and TransferEdge() methods.
2021-12-13 09:36:02 +03:00
kgv
e463b2f685 0032725: Visualization - Graphic3d_Structure::SetDisplayPriority() should use public enumeration Graphic3d_DisplayPriority
Added new enumeration Graphic3d_DisplayPriority.
Graphic3d_Layer now defines a fixed-length array of priorities.
Properties Graphic3d_CStructure::Id, Priority, PreviousPriority have been wrapped into methods.
2021-12-10 01:24:40 +03:00
kgv
e3dae4a9f3 0032723: Draw Harness, ViewerTest - sloppy animation in WebGL
Fixed emscripten_async_call() calls to use requestAnimationFrame() instead of setTimeout().
ViewerTest_EventManager::handleViewRedraw() - fixed queuing new onWasmRedrawView()
before previous one has been processed (leading to multiplying of pending redraws executed at the same time).
RWGltf_TriangulationReader::readDracoBuffer - suppressed CLang compilation warnings.
2021-12-10 01:23:40 +03:00
kgv
f4f9ce4b77 0032727: Coding Rules - eliminate CLang warning -Wshorten-64-to-32 in MessageView_ActionsTest.cxx 2021-12-09 01:28:36 +03:00
kgv
4af354e6ed 0032720: Coding Rules - rename glext.h to OpenGl_glext.h 2021-12-09 01:27:48 +03:00
kgv
8f7159cbaa 0032713: Visualization, OpenGl_GlFunctions - unify OpenGL and OpenGL ES function lists
Including system OpenGL headers has been moved from OpenGl_GlFunctions.hxx to OpenGl_GlNative.hxx.
Added OpenGl_GlTypes.hxx providing basic OpenGL 1.1 types.
Wrappers of system OpenGL 1.1 / OpenGL ES 2.0 functions have been moved to OpenGl_GlFunctions.cxx.
Avoided usage of global OpenGL functions in OpenGl package outside of OpenGl_GlFunctions.cxx.
2021-12-09 01:26:48 +03:00
kgv
bf2884afbe 0032724: Coding Rules, Graphic3d_Structure - remove unused property Graphic3d_Structure::ContainsFacet() 2021-12-09 01:25:41 +03:00
kgv
18c678759e 0032717: Modeling Algorithms - BRepBuilderAPI_Copy should not remove triangulation from surface-less faces
BRepBuilderAPI_Copy now ignores toCopyMesh flag for non-geometric shapes.
2021-12-09 01:22:28 +03:00
kgv
340b2327b6 0032718: Draw Harness, ViewerTest - fix misprint in vanim command description 2021-12-09 01:22:27 +03:00
kgv
7ce8fe052d 0032712: Visualization, OpenGl_Context.hxx - avoid including OpenGL headers 2021-12-07 22:32:15 +03:00
kgv
ccd3858e63 0032711: Coding Rules - new warning in AIS_Shape::Color() after integration fix for 0032704 2021-12-07 22:32:14 +03:00
knosulko
4ec4e4e8a8 0030272: Modeling Algorithms - Incorrect work of gproject
-fix TolU/V for approximation;
-fix cutting tool for approximation;
-add method Adaptor3d_HSurfaceTool::IsSurfG1.
-add test bugs/moddata_3/bug30272
2021-12-07 22:32:14 +03:00
kgv
90da038e9d 0032663: Coding - remove AIS_SequenceOfInteractive 2021-12-07 22:32:14 +03:00
kgv
9a52982920 0032678: Coding Rules, ApproxInt_SvSurfaces - eliminate GCC -fsanitize=undefined error
ApproxInt_SvSurfaces::myUseSolver is now initialized by default constructor.
2021-12-07 22:32:13 +03:00
kgv
68a8b15260 0032714: Documentation - drop VS2010 from minimal requirements 2021-12-07 22:32:13 +03:00
kgv
03eb96038e 0032709: Samples, MFC - remove samples Viewer2d, Viewer3d, Ocaf, Triangulation, Animation, Convert 2021-12-03 18:00:22 +03:00
kgv
44f6e8d5e8 0032694: Documentation, Draw Harness Guide - update ViewerTest commands
Draw Harness Guide now refers to ViewerTest commands description
via @snippet pointing to C++ source code instead of duplicating it.
"help" command now tries to beautify output of command's description.
2021-12-03 17:58:15 +03:00
kgv
4f5e934445 0032704: Visualization, Prs3d_Drawer - do not implicitly create aspects within getters
Prs3d_Drawer getters now return NULL instead of implicitly creating "default" aspects.
Added missing initialization of default properties in AIS_InteractiveContext.
AIS_InteractiveContext::setContextToObject() - added missing propagation of Context to child presentations.
2021-12-03 17:56:37 +03:00
kgv
65acdce54c 0032352: Coding Rules - clean up code from compatibility hacks with pre-C++11 compilers
Removed usage of std::auto_ptr.
opencascade::std workarounds for VS2008 have been dropped, when possible.
OCCT_NO_RVALUE_REFERENCE workaround for VS2008 has been removed.
2021-12-03 17:56:37 +03:00
kgv
30fa5f6713 0032705: Test - name clashes within temporary files within bugs/caf/bug23766_X
Several test cases writing temporary files have been corrected.
2021-12-02 21:14:57 +03:00
kgv
740833a6a8 0032697: Configuration - fix compilation errors with oneTBB 2021
Removed usage of no more existing tbb::task_scheduler_init and tbb::captured_exception.
2021-12-01 20:28:27 +03:00
aml
2009530611 0032696: Coding - get rid of unused forward declarations [StepSelect to Xw]
Packages starting with lower-case (gp and gce) are also processed.
2021-11-30 00:36:15 +03:00
dpasukhi
250ad34d90 0032683: Coding Rules, XCAFDoc_Editor::CloneMetaData() - unexpected bitwise operations
Fixed problem with incorrect bitwise operators.
Removed forced naming via cloning metadata
2021-11-30 00:36:15 +03:00
Dzmitry Razmyslovich
4a837ecec2 0031087: Configuration - make FreeType dependency optional [part 2] 2021-11-26 18:51:36 +03:00
isn
58c0958b50 0029406: Foundation Classes - gp_Ax3 fails setting direction
Avoid exception in gp_Ax3::SetDirection(), SetAxis(): check if XDir of Ax3 is parallel to newly given direction.
2021-11-26 18:50:18 +03:00
nbv
323e88ada7 0030365: Modeling Algorithms - Create tool to compute deviation between any 2D-curve and some its segment
Adds two new overloaded 'ComputeDeviation()' function (approx & exact) to GeomLib_Tool class to calculates the parameter in the curve where the maximum deviation is obtained between the curve and the line segment connecting its points with the specified parameters

Adds new '2ddeviation' DRAW command for 'ComputeDeviation()' functional testing
2021-11-26 18:49:17 +03:00
kgv
d0cf7e8f3c 0032684: Draw Harness - fix Draw_Interpretor::Add() misuse due to overloaded syntax 2021-11-25 19:56:06 +03:00
kgv
4e69a6ac05 0032685: Draw Harness - help output smashes command names without delimiter
"help" procedure now ensures to put space between listed commands.
2021-11-25 19:54:46 +03:00
kgv
b6b55c3d96 0032686: Visualization, Wasm_Window - filter out unexpected pressed buttons state within mouse move / up events
Wasm_Window::ProcessMouseEvent() now ignores not previously pressed mouse buttons within mouse move / up events.
Fixed -Wshorten-64-to-32 compiler warning within cpulimit command on 32-bit Linux.
2021-11-25 19:51:15 +03:00
msv
87b7b496ec 0032679: Data Exchange - STEP writer loses assembly instance name
In STEPCAFControl_Writer::WriteNames, write the names of components
even if the name of the assembly is absent.

In STEPControl_ActorWrite::TransferSubShape, move assembly structure
information to the beginning of the list of results, so that CDSR
information of this assembly became preceding CDSR of any sub shapes.
2021-11-25 00:35:25 +03:00
kgv
e1aa4ee31f 0032682: Draw Harness, ViewerTest - add -rotationMode and -navigationMode to vcamera 2021-11-25 00:35:25 +03:00
kgv
120dec9fb3 0032672: Coding Rules - eliminate GCC9 compiler warnings -Warray-bounds -fsantizize=undefined 2021-11-22 19:05:31 +03:00
kgv
3bbcf114f0 0032680: Visualization, AIS_TextLabel - Bold FontAspect doesn't work
Prs3d_TextAspect now sets Font_NOF_SERIF as default font
instead of confusig Font_NOF_ASCII_TRIPLEX (Times-Bold).
Therefore, default font now uses regular aspect, not bold.

Command vdrawtext does no more set "Courier" font by default.
2021-11-22 19:04:09 +03:00
kgv
d62df471b2 0032677: Coding Rules, Geom_BezierSurface - eliminate GCC warning -Wmaybe-uninitialized -fsanitize=undefined
Fixed initialization of TColStd_Array1OfReal for weights.
2021-11-22 19:02:55 +03:00
kgv
7ac3f543c7 0032675: Draw Harness, ViewerTest - remove command vr
Removed unused commands vr and Draft.
2021-11-22 19:01:19 +03:00
kgv
7c3daf20d1 0032676: Draw Harness, ViewerTest - fix NULL dereference on vanim -remove 2021-11-22 18:59:53 +03:00
aml
a81bd74a38 0032667: Coding - get rid of unused forward declarations [LibCtl to StepRepr] 2021-11-22 18:58:00 +03:00
kgv
c1e15aa538 0023398: Documentation, Shape Healing User's Guide - example does not compile
Fixed some misprints in the documentation.
Removed description of non-existing Message_TraceFile.
2021-11-21 12:42:10 +03:00
msv
519c84b43e 0030054: BRepOffset_MakeOffset fails to build joints in intersection mode
Test case has been added.
2021-11-21 12:42:10 +03:00
kgv
794b3d8936 0032652: Visualization - Select3D_SensitiveCylinder returns wrong 3D point on transformed shape
SelectMgr_RectangularFrustum::OverlapsCylinder() - added missing 3D point transformation.
StdSelect_BRepSelectionTool::ComputeSensitive() - fixed cylinder height computation on TopoDS_Shape with scale transformation.
SelectMgr_AxisIntersector::OverlapsCylinder(),::OverlapsSphere() - added missing computations of surface normal.
2021-11-21 12:42:10 +03:00
kgv
c8365a1c28 0032648: Visualization, TKOpenGles - support MSAA anti-aliasing within WebGL 2.0
OpenGl_FrameBuffer::Init() now creates MSAA render buffer in case if MSAA textures are unsupported.
In this case OpenGl_View::prepareFrameBuffers() creates MSAA render buffer for main content
and non-MSAA FBO for immediate content as blitting of MSAA render buffers into MSAA targets is unsupported by OpenGL ES 3.0.

env.bat.in has been corrected to include path to custom ANGLE (GLES2_DIR)
in front of Qt which might include its own older ANGLE build.
2021-11-21 12:42:10 +03:00
dipts
45143b7a24 0032662: Coding - Missing header file in AIS_DataMapOfSelStat.hxx
Removed obsolete header files AIS_DataMapOfSelStat.hxx and AIS_DataMapIteratorOfDataMapOfSelStat.hxx.
Removed obsolete types AIS_DataMapofIntegerListOfinteractive, AIS_ClearMode, AIS_ConnectStatus,
AIS_IndexedDataMapOfOwnerPrs, AIS_MapOfInteractive.
2021-11-21 12:42:09 +03:00
dipts
9eab1511b0 0032661: Coding - Forward class declaration in ProjLib collides with typeref
Removed redundant forward declarations from ProjLib.hxx.
2021-11-21 12:42:09 +03:00
akaftasev
0ffecc2fc7 0032448: Modeling Algorithms - Provide exact validating (as option) using GeomLib_CheckCurveOnSurface
Add '-exact' option to checkshape command to use exact method to validate edges using BRepLib_ValidateEdge class. Default mode is calculating in finite number of points.
2021-11-21 12:42:09 +03:00
kgv
6eddc28410 0032658: Documentation - add missing GLFW sample to dox/samples/samples.md 2021-11-21 12:42:09 +03:00
Xu Zhongxing
97e80b8c30 0032649: Bug in BRepLib::EnsureNormalConsistency()
Fix a typo in variable name.
2021-11-21 12:42:08 +03:00
rkv
57c5e9e895 0026171: Coding rules - eliminate -Wshorten-64-to-32 CLang warnings 2021-11-21 12:42:08 +03:00
kgv
2b40ee81d1 0032654: Data Exchange - fix misprint in RWGltf_TriangulationReader::readDracoBuffer()
Added missing break.
Fixes reading of glTF files with Normal attributes preceding Position
(and eliminates redundant / erroneous copy when Position attributes precede Normal).
2021-11-21 12:42:08 +03:00
ichesnok
62874fa199 0032096: Data Exchange - Extension for XCAFDimTolObjects_DimensionQualifier
Added XCAFDimTolObjects_AngularQualifier for angles. And added field and methods for dimensions.
2021-11-21 12:42:08 +03:00
kgv
e77bcb6b57 0032655: Configuration, qmake - add missing CSF_Draco
Added CSF_Draco to OccToolkit.pri.
Removed libXmu.so search from genconf.
2021-11-21 12:42:07 +03:00
inv
d4edeaed31 Increment OCCT version up to 7.7.0dev 2021-11-21 12:42:07 +03:00
inv
80ffc5f84d Update version up to 7.6.0 2021-11-01 18:12:14 +03:00
kgv
d1069cad4b 0032156: Documentation, gendoc.tcl - wrong processing of 'mathjax' option
Fixed handling of -s=<search_mode> option.
Fixed handling of -mathjax=<path> option.
2021-11-01 18:12:14 +03:00
akaftasev
0c4931e873 0032444: Modeling Algorithm - BRepOffsetAPI_MakePipeShell crash when using -DT mode and DT_ShapeDivide on the spine
Added checking for null edges in BRepFill_TrimShellCorner::ChooseSection()
2021-10-29 17:18:18 +03:00
btokarev
3ea347e562 0032551: Documentation - Novice user guide for OCCT Documentation
Added novice guide.
Improved structure of Tutorials & Samples.
2021-10-29 17:08:16 +03:00
dpasukhi
510d099d15 0028104: Data Exchange - Extract sub-assembly (XDE)
- Added getting and setting Material, VisMaterial and Props to XCAFDoc_Editor::Expand.
- Added XCAFDoc_Editor::Extract to transfer part to a new location
  - XCAFDoc_Editor::Extract allows to extract a part as a component or simply extract to an empty label with attached colors, layers, materials, vismaterials and props
- Added XCAFDoc_Editor::CloneMetaData to clone shape's attributes to new location
- Added XCAFDoc_Editor::CloneShapeLabel to clone shape to new document
- Added XCAFDoc_DocumentTool::Check*Tool methods to check an existing of an any tool
- Protected against creating a new label for non-existent tools via extract or expand process
2021-10-28 22:04:04 +03:00
ski
5bd54bef32 0024975: Improve of preprocessor directives in header files to be equal to the file name
Preprocessor directives were changed or created by function "check_headers" from script adm/upgrade.tcl (CR24816)
2021-10-27 21:00:02 +03:00
kgv
4f7ad5fb76 0032640: Coding Rules - fix misprints in GeomliteTest_API2dCommands.cxx 2021-10-27 20:58:18 +03:00
aml
f706c128c2 0032641: Coding - get rid of unused forward declarations [IGESAppli to LDOM] 2021-10-27 20:57:19 +03:00
asuraven
209ae313a5 0032031: Analyze Precise HLR behaviour in Draw/AIS
- Set "Algo" as default HLR algorithm in MFC HLR sample
2021-10-26 23:12:30 +03:00
knosulko
81f57d1135 0030046: Modeling Algorithms - Cannot find necessary projection of the curve
move algorithm of obtaining results from function gproject to method ProjLib_CompProjectedCurve::Perform;
fix tolerances in ProjLib_PrjResolve::ProjLib_PrjResolve;
new treatment of myMaxDist;
use extend bounds in approximation;
add test;
test case "bugs modalg_5 bug25980", "bugs modalg_7 bug24185" have been changed according to new behavior.
2021-10-26 23:10:34 +03:00
ifv
9923f08703 0032557: Modeling Data - Use of BRepBuilderAPI_NurbsConvert create 2d p-curves with gaps
GeomConvert/GeomConvert_1.cxx - method CheckAndSegment is added to adjust surface periodic boundaries
bug32557 - test is updated by new cases
2021-10-25 11:18:27 +03:00
aml
5b756182c2 0032630: Coding - get rid of unsused forward declarations [BinMDF to IFSelect] 2021-10-22 20:17:18 +03:00
kgv
5f69cfa70c 0032638: Draw Harness, ViewerTest - HTML input range misbehavior in WebAssembly
ViewerTest_EventManager - added tracking of EMSCRIPTEN_EVENT_FOCUSOUT event.
onWasmMouseCallback() has been adjusted to return FALSE for EMSCRIPTEN_EVENT_TARGET_WINDOW
target to avoid misbehavior of other HTML controls.

WNT_Window::ProcessMessage() now handles WM_SETFOCUS/WM_KILLFOCUS instead of WM_ACTIVATE to track focus changes.

AIS_ViewController::ProcessFocus() now redirects to AIS_ViewController::ResetViewInput() on focus loss.
This fixes issues when key action (like WASD navigation) keep working even after releasing key if window has been switched.
2021-10-22 19:58:16 +03:00
vro
19da974edc 0032632: Visualization, AIS_ViewCube - the class AIS_ViewCubeSensitive is hidden inside CXX file 2021-10-22 19:58:16 +03:00
kgv
bcb2a742a7 0032631: Draw Harness - add DRAWEXE.evalAsync() to WebAssembly 2021-10-22 19:58:16 +03:00
kgv
005caf39cf 0032633: Draw Harness - extend command incmesh to apply default visualization parameters
incmesh - added -prs option to use StdPrs_ToolTriangulatedShape::GetDeflection() as meshing parameters.
vdisplay, XDisplay - added -autoTriangulation option to manage meshing behavior before displaying a shape.
trinfo - added output of meshing parameters.
Fixed broken incmesh syntax usage in several test cases.
2021-10-22 19:58:15 +03:00
kgv
2c8c4b8086 0032629: Configuration, scripts - add USE_PTHREADS building option to wasm_build.bat 2021-10-22 19:58:15 +03:00
mpv
7e63845c9e 0026981: Application Framework - read a BinOcaf document from С++ stream sequentially
The current version of the document supports partial reading. So, as a result, the shapes section is dispersed into attributes and it becomes easy avoid any seekg call during the reading.
But this will work only in case whole document is opened. For partial reading seekg functions could be naturally called.
2021-10-22 19:58:15 +03:00
jgv
f8d8c3f2bc 0032623: [Regression] Modelling Algorithms - UnifySameDomain invalid result only in release mode
Correct local function ReconstructMissedSeam: use copy of existing pcurve for seam edge reconstruction to prevent possible corruption of another edges.
2021-10-20 20:06:30 +03:00
kgv
4e61131a1c 0032626: Samples - add Qt::WA_NativeWindow attribute to Qt IESample 2021-10-18 20:14:35 +03:00
kgv
4e2151f654 0032624: Configuration, genproj - add support for VS 2022 / vc143 2021-10-18 20:13:10 +03:00
dpasukhi
475da0f135 0032310: Data Exchange - Invalid STEP export/import of backslashes in names [Regression since OCCT 7.5.0]
Fixed a problem with handling slashes and apostrophes
Changed cleaning of the 'TEXT' fields of the step entity to direct order w/o removing operations
Changed converting text locale to covert before cleaning directives and specials symbols (all directives and sp. symbols encoded in ASCII[0-125] and haven't any differ with any locals)
Special case, when directives have two slashes before name changed to don't handle directives value and converts as is (combine two slashes as one and write, for example "\\X2\00C3" as "X2\00C3")
2021-10-15 19:52:25 +03:00
jgv
538700ffa2 0032619: [Regression] Modelling Algorithms - UnifySameDomain ignores shared face
Correct method ShapeUpgrade_UnifySameDomain::UnifyFaces: exclude free boundary edges from unification.
2021-10-15 19:50:25 +03:00
abulyche
eb78d737d4 0030747: Modeling Algorithms - 2d Curves concatenator doesn't properly process closed contours.
Corrected Geom2dConvert_CompCurveToBSplineCurve::Add in Geom2dConvert_CompCurveToBSplineCurve.cxx;
Added the test for this problem;
Corrected "gluing" curves in ProjLib_ProjectedCurve.cxx.
2021-10-14 20:19:22 +03:00
kgv
c1638a8db8 0032622: Draw Harness - writebrep "-version 3" is unrecognized
Fixed version range check.
Added description of -normals argument.
2021-10-14 20:17:11 +03:00
aml
0c9c466e9d CR32614 Coding - get rid of unsused forward declarations [Adaptor2d to GccAna]
Packages from Adaptor2d to GccAna are processed.
2021-10-12 20:11:16 +03:00
kgv
16f9b46dbb 0032612: Data Exchange, RWGltf_CafReader - lost hierarchy of two nested compounds
RWGltf_GltfJsonParser::gltfParseSceneNode() - prevent flattering of Scene nodes
(allow flattering only of Mesh nodes).

Added command XAutoNaming managing XCAFDoc_ShapeTool::SetAutoNaming().
Added comparisons with reference Xdump data to glTF tests.
2021-10-12 20:08:57 +03:00
kgv
34043fc845 0032613: Samples - glfw compilation error on Linux
GlfwOcctWindow - added cast to Aspect_XDisplay*.
Added auxiliary OCCT searching script as alternative to CMake config files.
2021-10-12 09:37:23 +03:00
ifv
56b495d93b 0032607: Modeling Algorithms - BOPAlgo_BOP returns incomplete result
IntPatch/IntPatch_ImpPrmIntersection.cxx - decreasing step for some conditions
tests/lowalgos/intss/bug32607 - test case added
2021-10-08 20:51:50 +03:00
vkuzin
96b92906de 0029405: Modeling Algorithms - Check normal define status in HLRBRep_Data
Fixed exception when trying to calculate line and edge normal in methods HLRBRep_Data::OrientOutLine and HLRBRep_Data::OrientOthEdge, added a check for the existence of the normal before subsequent calculations. A correct check for zero derivative, correction of floating point error and division by zero determinant directly in HLRBRep_EdgeFaceTool::CurvatureValue was set.
2021-10-08 20:51:13 +03:00
kgv
f1c209dc77 0032609: Visualization, Wasm_Window - handle mouse movements outside canvas element
Wasm_Window::ProcessMouseEvent() - removed redundant check on EMSCRIPTEN_EVENT_MOUSEUP event.
ViewerTest and WebGL sample - mouse movements are now tracked on window element
to allow tracking updates when mouse with clicked button is moved outside canvas element.
2021-10-08 20:26:22 +03:00
kgv
f9ae10ed21 0032604: Visualization, AIS_LightSource - improve dragging robustness 2021-10-08 20:24:43 +03:00
achesnok
956d91571c 0032591: Visualization, V3d_View - improve corner gradient
- Added new shader for correct Aspect_GradientFillMethod_Corner mode shading.
2021-10-08 20:22:22 +03:00
aml
c2064b60e7 0032603: Coding - get rid of unsused forward declarations
Packages from Adaptor2d to BRepMesh are processed.
2021-10-04 20:03:10 +03:00
kgv
eba0379cde 0032602: Configuration, genconf - reduce window height with empty error log
Font height is reduced to 1 for empty error labels is empty to win some space.
2021-10-04 19:54:22 +03:00
msv
41fc11b056 0032601: Foundation Classes - Poly_Connect hangs on the given incorrect triangulation 2021-10-04 19:53:12 +03:00
asuraven
0f05f21194 0032539: Modeling Algorithms - Parallelize BRepExtrema_DistShapeShape algorithm 2021-10-01 19:14:13 +03:00
dpasukhi
7d5e26eb2e 0032596: [REGRESSION] Data Exchange, STEP Reader - OCCT 7.6.0dev does not open file correctly
Fixed typo in the StepToTopoDS_TranslateFace.cxx after #29564 issue
2021-10-01 19:08:36 +03:00
btokarev
5c38397303 0032550: Documentation - Proofreading for "Tutorials and Samples -> Tutorial"
New images added for better representation of solid model;
Minor fixes for misprints and old classes;
Proofreading done.
2021-10-01 19:06:33 +03:00
jgv
ca65b1ae37 0032581: Modelling Algorithms - UnifySameDomain produces invalid result
1. Correct local function TransformPCurves of ShapeUpgrade_UnifySameDomain: take into account the case of seam edge.
2. Correct local function ReconstructMissedSeam of ShapeUpgrade_UnifySameDomain: use previously stored seam edge in some cases.
2021-09-30 19:43:06 +03:00
kgv
b4871a3b12 0032595: Documentation - revise "Build OCCT" structure to highlight CMake usage
"Building with CMake tool" subsection has been moved out from "Windows" to a dedicated top-level section.
genproj sections have been merged and restructured.
Added description of some new CMake configuration options.
Updated URL to 3rd-party components on Development Portal.
2021-09-30 19:41:47 +03:00
kgv
ff60d28357 0032597: Coding Rules, Wasm_Window - add missing setter for DevicePixelRatio property 2021-09-30 19:39:45 +03:00
aml
307fef1dcd 0032593: Documentation - get rid of unused file in the documentation. 2021-09-28 20:15:15 +03:00
abulyche
95c380d252 0030148: Modeling Algorithms - exception in BRepOffestAPI_MakePipe for some periodic BSpline spines
This problem was solved by fix for 0030597.
Added the non-regression test for this problem.
2021-09-28 20:12:06 +03:00
ifv
f277dcbbc0 0032557: Modeling Data - Use of BRepBuilderAPI_NurbsConvert create 2d p-curves with errors
BRepTools/BRepTools_NurbsConvertModification.cxx -
 Checking domain of 2dCurves if surfaces are periodic is improved

tests/bugs/moddata_3/bug32557 - test case added
2021-09-28 20:10:04 +03:00
ifv
af0cb16691 0032569: Modeling Algorithm - Section not found
IntPatch/IntPatch_WLineTool.cxx - adding control of maximal ratio of distances between 3 sequential points.
tests/bugs/modalg_7/bug32569 - new test case added
tests/lowalgos/intss/bug29972_1 test case is modified according new behavior of intersection algorithm
2021-09-28 20:06:09 +03:00
emv
f72c595119 0032578: Modeling Algorithms - Splitting face by set of edges fails
Update information about ON/IN sub-shapes for all touched faces when intersection with shapes of lower types (edges and vertices) complete.
Previously only the faces participating in the Face/Face intersection were updated.
2021-09-27 20:12:00 +03:00
kgv
3e9cb80644 0032590: Visualization, V3d_View - improve API for setting Image Based Lighting
Added method V3d_View::SetImageBasedLighting() for managing IBL.
OpenGl_View implementation has been revised to handle IBL updates in a more straightforward way,
2021-09-26 16:44:20 +03:00
achesnok
9af0d66b84 0031039: Visualization - add elliptical gradient background style
Added new elliptical gradient fill method and updated vbackground command.
Renamed enum values of Aspect_GradientFillMethod and defined aliases for old ones.
Changed draw mode in OpenGl_BackgroundArray from triangle-strip to GL_TRIANGLES.
2021-09-26 11:05:34 +03:00
kgv
3be25c1170 0032585: Data Exchange, RWGltf_CafWriter - include OCCT version 2021-09-24 18:34:45 +03:00
kgv
ea99d048d7 0032582: Configuration, genproj - make CSF_OPT_LIB64D configurable by genconf 2021-09-23 19:59:22 +03:00
kgv
c585f731eb 0032579: Draw Harness, ViewerTest - extend vbackground -cubemap syntax to configure sRGB flag
Command vbackground has been refactored to simplify logic and relax syntax.
Added -srgb argument to vbackground and vtexture commands.
2021-09-22 20:11:44 +03:00
kgv
c983176406 0032580: Data Exchange, STL - add option splitting nodes at sharp corners
Added Poly_MergeNodesTool tool for merging nodes within triangulation.
Added RWStl_Reader::MergeAngle() property managing merging behavior.
2021-09-22 20:09:48 +03:00
asemenov
5dd92c395a 0029478: Crash because bSplineSurfaceWithKnots is NULL.
Modified the method void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::ReadStep
Added processing B spline surface with knots and rational B spline surface with empty data in the name field
Added test
2021-09-20 20:03:49 +03:00
abulyche
296dbe8cc8 0031631: Modeling Algorithms - Invalid result of Pipe builder
Added the ability to operate the algorithm with different types of curves.
2021-09-18 17:07:06 +03:00
dpasukhi
812ee2c9be 0031388: Data Exchange - support kinematics data in STEP format
- add new STEP entities.
2021-09-17 20:08:51 +03:00
asuraven
92c1f9728e 0032552: Modeling Algorithms - BRepExtrema_DistShapeShape algorithm consumes too much memory
Used a new BRepExtrema_DistShapeShape::DistanceVertVert() function to replace DistanceMapMap() to calculate vertex/vertex distance
2021-09-17 20:07:40 +03:00
emv
b878139461 0032566: Modeling Algorithms - Incorrect result of offset operation in mode "Complete" join type "Intersection"
Before removal of the part make sure that it was not filled due to overlapping of opposite parts.
Improve procedure of checking for inverted edges by taking into account that the original edges may not be connected.

Correct test case offset/shape_type_i_c/YL5, as it was working incorrectly - some parts were missing.
2021-09-17 20:07:39 +03:00
kgv
5aa7b61083 0032236: Modeling Algorithms - Exception on calculation optimal bounding box
- BRepBndLib - added VOID box checks to AdjustFaceBox() method.
 - added the test
2021-09-17 20:07:39 +03:00
kgv
eee6a80a90 0032089: Visualization, TKOpenGl - support GL_EXT_sRGB extension to OpenGL ES 2.0 2021-09-17 20:07:39 +03:00
sshutina
58f2990bc5 0032461: Visualization - expensive call of glGetTexEnviv/glTexEnvi in each render of OpenGl_Text
- removed the call of glGetTexEnviv, glTexEnvi
 - replaced on the OpenGl_Sampler::applyGlobalTextureParams/resetGlobalTextureParams
 - added the method in OpenGl_Font returning first texture
2021-09-15 20:12:43 +03:00
akaftasev
7c6fecf9a8 0032330: Modeling Algorithms - Extend Offset algorithm with Progress Indicator and User Break
Add progress indicator to BRepOffset_MakeOffset::MakeOffsetShape().
2021-09-15 20:08:36 +03:00
kgv
13b36bb14f 0032567: Coding Rules - rename Graphic3d_TypeOfShadingModel values to include full enumeration name 2021-09-15 20:07:06 +03:00
ifv
e2421df543 0030422: Random behaviour of BRepAdaptor_CompCurve
BRepTools/BRepTools_WireExplorer.cxx - replace MapOfShape vmap by IndexedMapOfShape
to avoid random behavior of algorithm

bugs/moddata_3/bug30422 - new test case added
2021-09-15 20:07:06 +03:00
jgv
1e6b2065b5 0032561: Modelling Algorithms - UnifySameDomain does nothing while it is expected to union two pairs of faces
Correct method ShapeUpgrade_UnifySameDomain::UnifyFaces: when creating the Edge-Face map of initial shape, count each face only once.
2021-09-15 20:07:06 +03:00
kgv
e2d6f0e37a 0032423: Coding Rules - NSOpenGLContext deprecation warnings during compilation for macOS 10.14+
The warning has been suppressed for building TKOpenGl.
2021-09-15 20:07:05 +03:00
asuraven
9ae883970d 0032450: Modeling Algorithms - change BRepLib_CheckCurveOnSurface & GeomLib_CheckCurveOnSurface interfaces to adapters 2021-09-11 11:15:44 +03:00
asemenov
8019a482b5 0029233: Incorrect result of conversion to the STEP format.
Modified the method TopoDSToStep_MakeStepFace::Init
Added processing of degenerate toroidal surfaces, which are the base surfaces of offset surfaces
Added test
2021-09-10 20:24:53 +03:00
kgv
36d21f1a1a 0032565: Foundation Classes, OSD_FileSystem - expose interface for registering global protocols
Added methods OSD_FileSystem::AddDefaultProtocol()/::RemoveDefaultProtocol()
and fixed misleading description of OSD_FileSystemSelector::AddProtocol().
2021-09-10 20:24:52 +03:00
kgv
8a17a8bb45 0032540: RWGltf_CafReader - optional "scene" parameter encoded as mandatory
First scene is now loaded when default one is undefined.
2021-09-10 20:24:52 +03:00
sshutina
8dcb81ac82 0031337: Inspectors - user guide update
- Modifyed 3D view:
     Added the trihedron, view cube
     Removed the scene manipulation actions (Fit all isn't removed)
 - Added the new MessageView plugin to display content of Message_Report
 - DFBrowser plugin improvements:
     Added the  button to switch ON DumpJson in DFBrowser(OFF by default, for better performance)
     Renamed in DFBrowser "Property Panel" into "Property Panel (custom)
     Removed the selection controls
 - ShapeView plugin improvements:
     Property View content based on DumpJson (columns in tree view for properties are removed),
     Properties for TopoDS_Shape are displayed
 - VInspector plugin imrovements:
      Property View content based on DumpJson (columns in tree view for properties are removed),
      Properties for AIS_InteractiveContext and AIS_InteractiveObject are displayed
      Removed History panel in VInspector as not used
      Implemented the item and actions in VInspector for setting Lights in the view
2021-09-10 20:24:52 +03:00
kgv
cd4977383d 0032092: Visualization, TKService - Image_VideoRecorder writes garbage from Grayscale image
Image_VideoRecorder::writeVideoFrame(), added protection from API misuse.
2021-09-10 20:24:51 +03:00
kgv
801e67bc7b 0032564: Foundation Classes, OSD_CachedFileSystem - allow referring to non-default File System
Linked file system can be now customized within OSD_CachedFileSystem.
2021-09-10 20:24:51 +03:00
sshutina
7d7541ceeb 0032507: Visualization, TKOpenGl - topmost text disappears with Graphic3d_RTM_DEPTH_PEELING_OIT enabled 2021-09-10 20:24:51 +03:00
vro
e8ae1c42a8 0032531: Application Framework - There should be methods to get explanations of PCDM_StoreStatus and PCDM_ReaderStatus values
Documentation is added for PCDM_ReaderStatus enumeration.

Modified:
- PCDM_ReaderStatus.hxx: each value received a short explanation.
2021-09-10 20:24:51 +03:00
emv
74a53b82dc 0030206: Improve API of commands bbop and bapibop
0030620: Tests - perf/bop/buildfaces does not match description (broken)

Allow using meaningful parameters for the commands bbop and bapibop:
* common - for Common operation
* fuse - for Fuse operation
* cut - for Cut operation
* tuc/cut21 - for Cut21 operation
* section - for Section operation

Add description for the commands dealing with Boolean/GF/Split operations.
Validate arguments of these commands.

Correct test case perf/bop/buildfaces to perform GF execution in parallel and serial modes - compare the results.
2021-09-10 20:24:50 +03:00
emv
efac173377 0030151: Modeling Algorithms - Removal of the API level of old Boolean operations algorithm (BRepAlgo_BooleanOperation)
The following classes have been removed as obsolete:
- BRepAlgo_BooleanOperation
- BRepAlgo_Fuse
- BRepAlgo_Cut
- BRepAlgo_Common
- BRepAlgo_Section

The corresponding classes from BRepAlgoAPI package have to be used instead.

Draw commands:
- fuse
- cut
- common
- section/psection
have also been removed as obsolete.

The corresponding commands for modern Boolean operations algorithm (bfuse/bcut/bcommon/bsection) have to be used instead.

Adjustment of the test cases to use the commands for modern algorithm.
2021-09-10 20:24:50 +03:00
kgv
35ad04e78b 0032107: Data Exchange, RWGltf_CafReader - reading glTF document back loses sharing
RWGltf_CafWriter has been fixed to write shared Faces having a different style.
RWGltf_GltfJsonParser::gltfParsePrimArray() now tries to create a shared TopoDS_Face
from the same primitive array definition.

RWGltf_CafReader - improved name generation.
2021-09-10 20:22:59 +03:00
akaftasev
8ab0b859df 0030788: Modeling Algorithms - BRepAlgoAPI_Defeaturing does not propagate progress indicator to underlying algorithms
Added progress indicator to BRepAlgoAPI_Defeaturing
2021-09-08 19:14:11 +03:00
kgv
5e76328243 0032328: Missing include of TopoDS_Edge.hxx in ShapeUpgrade_UnifySameDomain.hxx 2021-09-07 20:03:29 +03:00
abulyche
41e2eed0fc 0030722: Modeling Algorithms - BRepExtrema_DistShapeShape computes wrong distances
Updated the math_DirectPolynomialRoots.cxx
Added the test case "bug30722"
Updated the command "b2dclassify" in the BOPTest_LowCommands.cxx
2021-09-07 20:01:40 +03:00
msv
a1ae05e173 0018170: Modeling Data - crash in TopExp_Explorer::Init if Clear was called after empty constructor
TopExp_Explorer::Clear() now sets myTop=-1 with align to TopExp_Explorer::Init() logic.
2021-09-05 23:13:27 +03:00
10542 changed files with 172975 additions and 109310 deletions

View File

@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake") set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
@@ -6,6 +6,26 @@ set (CMAKE_SUPPRESS_REGENERATION TRUE)
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE) set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
# set using C++ standard
set (BUILD_CPP_STANDARD "C++11" CACHE STRING "Select using c++ standard.")
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++11" "C++14" "C++17" "C++20" "C++23")
# Set desired C++ standard
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++11")
set (CMAKE_CXX_STANDARD 11)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++14")
set (CMAKE_CXX_STANDARD 14)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
set (CMAKE_CXX_STANDARD 17)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++20")
set (CMAKE_CXX_STANDARD 20)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++23")
set (CMAKE_CXX_STANDARD 23)
else ()
message (FATAL_ERROR, "misprint in c++ standard name")
endif()
set (CMAKE_CXX_STANDARD_REQUIRED ON)
# macro: include patched file if it exists # macro: include patched file if it exists
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE) macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake") if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
@@ -15,6 +35,14 @@ macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
endif() endif()
endmacro() endmacro()
# set using memory manager option for TKernel
set (USE_MMGR_TYPE "NATIVE" CACHE STRING "Select using memory manager tool.")
set_property(CACHE USE_MMGR_TYPE PROPERTY STRINGS "NATIVE" "FLEXIBLE" "TBB" "JEMALLOC")
# set profile for C++ compiler and linker
set (BUILD_OPT_PROFILE "Default" CACHE STRING "Select profile for compiler and linker.")
set_property(CACHE BUILD_OPT_PROFILE PROPERTY STRINGS "Default" "Production")
# include variable description # include variable description
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vardescr") OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vardescr")
@@ -56,6 +84,20 @@ set_property (GLOBAL PROPERTY OCC_VERSION_MAJOR ${OCC_VERSION_MAJOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR}) set_property (GLOBAL PROPERTY OCC_VERSION_MINOR ${OCC_VERSION_MINOR})
set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE}) set_property (GLOBAL PROPERTY OCC_VERSION_MAINTENANCE ${OCC_VERSION_MAINTENANCE})
# set soversion variable determining compatibility version on platforms with symlinks
# 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance
if (NOT BUILD_SOVERSION_NUMBERS)
set (BUILD_SOVERSION_NUMBERS "0" CACHE STRING "${BUILD_SOVERSION_NUMBERS_DESCR}" FORCE)
SET_PROPERTY(CACHE BUILD_SOVERSION_NUMBERS PROPERTY STRINGS 0 1 2 3)
# update default state of soversion on different platforms
if (WIN32 OR ANDROID OR EMSCRIPTEN)
set (BUILD_SOVERSION_NUMBERS 0)
else()
set (BUILD_SOVERSION_NUMBERS 2)
endif()
endif()
set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}") set (INSTALL_TEST_CASES OFF CACHE BOOL "${INSTALL_TEST_CASES_DESCR}")
# Regeneration of OCCT resource files # Regeneration of OCCT resource files
@@ -661,8 +703,10 @@ endif()
if (CAN_USE_GLES2) if (CAN_USE_GLES2)
if (USE_GLES2) if (USE_GLES2)
add_definitions (-DHAVE_GLES2_EXT) add_definitions (-DHAVE_GLES2_EXT)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl") if (NOT IOS)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2") OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
endif()
else() else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL") OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2") OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
@@ -798,6 +842,14 @@ else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE") OCCT_CHECK_AND_UNSET ("3RDPARTY_FLEX_EXECUTABLE")
endif() endif()
# Jemalloc
if ("${USE_MMGR_TYPE}" STREQUAL "JEMALLOC")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/jemalloc")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_JEMALLOC")
OCCT_CHECK_AND_UNSET ("INSTALL_JEMALLOC")
endif()
# qt for inspector and samples # qt for inspector and samples
if (BUILD_Inspector OR BUILD_SAMPLES_QT) if (BUILD_Inspector OR BUILD_SAMPLES_QT)
# check qt 3rdparty path # check qt 3rdparty path
@@ -1124,14 +1176,8 @@ if (BUILD_SAMPLES_MFC)
add_subdirectory(samples/mfc/standard/mfcsample) add_subdirectory(samples/mfc/standard/mfcsample)
add_subdirectory(samples/mfc/standard/01_Geometry) add_subdirectory(samples/mfc/standard/01_Geometry)
add_subdirectory(samples/mfc/standard/02_Modeling) add_subdirectory(samples/mfc/standard/02_Modeling)
add_subdirectory(samples/mfc/standard/03_Viewer2d) add_subdirectory(samples/mfc/standard/03_ImportExport)
add_subdirectory(samples/mfc/standard/04_Viewer3d) add_subdirectory(samples/mfc/standard/04_HLR)
add_subdirectory(samples/mfc/standard/05_ImportExport)
add_subdirectory(samples/mfc/standard/06_Ocaf)
add_subdirectory(samples/mfc/standard/07_Triangulation)
add_subdirectory(samples/mfc/standard/08_HLR)
add_subdirectory(samples/mfc/standard/09_Animation)
add_subdirectory(samples/mfc/standard/10_Convert)
message (STATUS "Info: \(${CURRENT_TIME}\) MFC Sample projects added") message (STATUS "Info: \(${CURRENT_TIME}\) MFC Sample projects added")
endif() endif()
@@ -1229,7 +1275,7 @@ foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
endforeach() endforeach()
# install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration # install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)") install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)") install (CODE "file(INSTALL FILES \"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" DESTINATION \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/\" TYPE FILE)")
foreach (OCCT_MODULE ${OCCT_MODULES}) foreach (OCCT_MODULE ${OCCT_MODULES})
if (BUILD_MODULE_${OCCT_MODULE}) if (BUILD_MODULE_${OCCT_MODULE})

View File

@@ -3,5 +3,6 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh DataExchange TKDE TKXSBase TKDESTEP TKDEIGES TKDESTL TKDEVRML TKDECascade TKDEOBJ TKDEGLTF TKDEPLY TKXCAF TKXmlXCAF TKBinXCAF TKRWMesh
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE DETools TKExpress ExpToCasExe
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE TKXSDRAWDE TKXSDRAWGLTF TKXSDRAWIGES TKXSDRAWOBJ TKXSDRAWPLY TKXSDRAWSTEP TKXSDRAWSTL TKXSDRAWVRML

View File

@@ -32,6 +32,7 @@ n UnitsAPI
n gp n gp
n math n math
r OS r OS
n FlexLexer
t TKMath t TKMath
t TKernel t TKernel
n Adaptor2d n Adaptor2d
@@ -328,6 +329,7 @@ n RWStepDimTol
n RWStepElement n RWStepElement
n RWStepFEA n RWStepFEA
n RWStepGeom n RWStepGeom
n RWStepKinematics
n RWStepRepr n RWStepRepr
n RWStepShape n RWStepShape
n RWStepVisual n RWStepVisual
@@ -347,6 +349,7 @@ n StepDimTol
n StepElement n StepElement
n StepFEA n StepFEA
n StepGeom n StepGeom
n StepKinematics
n StepRepr n StepRepr
n StepSelect n StepSelect
n StepShape n StepShape
@@ -374,16 +377,13 @@ r SHMessage
r XSMessage r XSMessage
r XSTEPResource r XSTEPResource
t TKBinXCAF t TKBinXCAF
t TKIGES t TKDESTL
t TKSTEP t TKDEVRML
t TKSTEP209
t TKSTEPAttr
t TKSTEPBase
t TKSTL
t TKVRML
t TKXCAF t TKXCAF
t TKXDEIGES t TKDE
t TKXDESTEP t TKDECascade
t TKDEIGES
t TKDESTEP
t TKXSBase t TKXSBase
t TKXmlXCAF t TKXmlXCAF
n BOPTest n BOPTest
@@ -392,6 +392,9 @@ n DBRep
n DDF n DDF
n DDataStd n DDataStd
n DDocStd n DDocStd
n DE
n DEXCAFCascade
n DEBRepCascade
n DNaming n DNaming
n DPrsStd n DPrsStd
n Draw n Draw
@@ -412,7 +415,12 @@ n XDEDRAW
n XSDRAW n XSDRAW
n XSDRAWIGES n XSDRAWIGES
n XSDRAWSTEP n XSDRAWSTEP
n XSDRAWSTLVRML n XSDRAWSTL
n XSDRAWVRML
n XSDRAWDE
n XSDRAWGLTF
n XSDRAWOBJ
n XSDRAWPLY
r DrawResources r DrawResources
t TKDCAF t TKDCAF
t TKDraw t TKDraw
@@ -424,6 +432,14 @@ t TKD3DHostTest
t TKViewerTest t TKViewerTest
t TKXDEDRAW t TKXDEDRAW
t TKXSDRAW t TKXSDRAW
t TKXSDRAWIGES
t TKXSDRAWSTEP
t TKXSDRAWSTL
t TKXSDRAWVRML
t TKXSDRAWDE
t TKXSDRAWGLTF
t TKXSDRAWOBJ
t TKXSDRAWPLY
x DRAWEXE x DRAWEXE
n QADraw n QADraw
n QANCollection n QANCollection
@@ -449,9 +465,13 @@ t TKVCAF
n XCAFView n XCAFView
n XCAFNoteObjects n XCAFNoteObjects
t TKRWMesh t TKRWMesh
t TKDEGLTF
t TKDEOBJ
t TKDEPLY
n RWGltf n RWGltf
n RWMesh n RWMesh
n RWObj n RWObj
n RWPly
n DFBrowser n DFBrowser
n DFBrowserPane n DFBrowserPane
n DFBrowserPaneXDE n DFBrowserPaneXDE
@@ -472,3 +492,6 @@ n TreeModel
n View n View
n ViewControl n ViewControl
n VInspector n VInspector
n Express
t TKExpress
x ExpToCasExe

View File

@@ -22,6 +22,4 @@ if (3RDPARTY_DIR)
endforeach() endforeach()
endif() endif()
# bison 3.2 is required because it provides options to avoid generation of redundant header find_package (BISON 3.7.4)
# files and embedding of local paths in the generated code
find_package (BISON 3.2)

View File

@@ -3,7 +3,7 @@
# See the cotire manual for usage hints. # See the cotire manual for usage hints.
# #
#============================================================================= #=============================================================================
# Copyright 2012-2016 Sascha Kratky # Copyright 2012-2018 Sascha Kratky
# #
# Permission is hereby granted, free of charge, to any person # Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation # obtaining a copy of this software and associated documentation
@@ -43,7 +43,7 @@ if (NOT CMAKE_SCRIPT_MODE_FILE)
endif() endif()
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}") set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.7.9") set (COTIRE_CMAKE_MODULE_VERSION "1.8.1")
# activate select policies # activate select policies
if (POLICY CMP0025) if (POLICY CMP0025)
@@ -106,6 +106,11 @@ if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0054 NEW)
endif() endif()
if (POLICY CMP0055)
# strict checking for break() command
cmake_policy(SET CMP0055 NEW)
endif()
include(CMakeParseArguments) include(CMakeParseArguments)
include(ProcessorCount) include(ProcessorCount)
@@ -234,7 +239,13 @@ function (cotire_filter_language_source_files _language _target _sourceFilesVar
# add to excluded sources, if file has custom compile flags # add to excluded sources, if file has custom compile flags
list (APPEND _excludedSourceFiles "${_sourceFile}") list (APPEND _excludedSourceFiles "${_sourceFile}")
else() else()
list (APPEND _sourceFiles "${_sourceFile}") get_source_file_property(_sourceCompileOptions "${_sourceFile}" COMPILE_OPTIONS)
if (_sourceCompileOptions)
# add to excluded sources, if file has list of custom compile options
list (APPEND _excludedSourceFiles "${_sourceFile}")
else()
list (APPEND _sourceFiles "${_sourceFile}")
endif()
endif() endif()
endif() endif()
endforeach() endforeach()
@@ -293,7 +304,7 @@ function (cotire_get_source_file_property_values _valuesVar _property)
set (${_valuesVar} ${_values} PARENT_SCOPE) set (${_valuesVar} ${_values} PARENT_SCOPE)
endfunction() endfunction()
function (cotire_resolve_config_properites _configurations _propertiesVar) function (cotire_resolve_config_properties _configurations _propertiesVar)
set (_properties "") set (_properties "")
foreach (_property ${ARGN}) foreach (_property ${ARGN})
if ("${_property}" MATCHES "<CONFIG>") if ("${_property}" MATCHES "<CONFIG>")
@@ -309,8 +320,8 @@ function (cotire_resolve_config_properites _configurations _propertiesVar)
set (${_propertiesVar} ${_properties} PARENT_SCOPE) set (${_propertiesVar} ${_properties} PARENT_SCOPE)
endfunction() endfunction()
function (cotire_copy_set_properites _configurations _type _source _target) function (cotire_copy_set_properties _configurations _type _source _target)
cotire_resolve_config_properites("${_configurations}" _properties ${ARGN}) cotire_resolve_config_properties("${_configurations}" _properties ${ARGN})
foreach (_property ${_properties}) foreach (_property ${_properties})
get_property(_isSet ${_type} ${_source} PROPERTY ${_property} SET) get_property(_isSet ${_type} ${_source} PROPERTY ${_property} SET)
if (_isSet) if (_isSet)
@@ -320,13 +331,18 @@ function (cotire_copy_set_properites _configurations _type _source _target)
endforeach() endforeach()
endfunction() endfunction()
function (cotire_get_target_usage_requirements _target _targetRequirementsVar) function (cotire_get_target_usage_requirements _target _config _targetRequirementsVar)
set (_targetRequirements "") set (_targetRequirements "")
get_target_property(_librariesToProcess ${_target} LINK_LIBRARIES) get_target_property(_librariesToProcess ${_target} LINK_LIBRARIES)
while (_librariesToProcess) while (_librariesToProcess)
# remove from head # remove from head
list (GET _librariesToProcess 0 _library) list (GET _librariesToProcess 0 _library)
list (REMOVE_AT _librariesToProcess 0) list (REMOVE_AT _librariesToProcess 0)
if (_library MATCHES "^\\$<\\$<CONFIG:${_config}>:([A-Za-z0-9_:-]+)>$")
set (_library "${CMAKE_MATCH_1}")
elseif (_config STREQUAL "None" AND _library MATCHES "^\\$<\\$<CONFIG:>:([A-Za-z0-9_:-]+)>$")
set (_library "${CMAKE_MATCH_1}")
endif()
if (TARGET ${_library}) if (TARGET ${_library})
list (FIND _targetRequirements ${_library} _index) list (FIND _targetRequirements ${_library} _index)
if (_index LESS 0) if (_index LESS 0)
@@ -441,7 +457,7 @@ function (cotire_get_target_compile_flags _config _language _target _flagsVar)
# interface compile options from linked library targets # interface compile options from linked library targets
if (_target) if (_target)
set (_linkedTargets "") set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} _linkedTargets) cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets}) foreach (_linkedTarget ${_linkedTargets})
get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS) get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS)
if (_targetOptions) if (_targetOptions)
@@ -573,7 +589,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
# interface include directories from linked library targets # interface include directories from linked library targets
if (_target) if (_target)
set (_linkedTargets "") set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} _linkedTargets) cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets}) foreach (_linkedTarget ${_linkedTargets})
get_target_property(_linkedTargetType ${_linkedTarget} TYPE) get_target_property(_linkedTargetType ${_linkedTarget} TYPE)
if (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE AND NOT CMAKE_VERSION VERSION_LESS "3.4.0" AND if (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE AND NOT CMAKE_VERSION VERSION_LESS "3.4.0" AND
@@ -627,7 +643,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
if (CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES) if (CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES)
list (REMOVE_ITEM _includeDirs ${CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES}) list (REMOVE_ITEM _includeDirs ${CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES})
endif() endif()
if (WIN32) if (WIN32 AND NOT MINGW)
# convert Windows paths in include directories to CMake paths # convert Windows paths in include directories to CMake paths
if (_includeDirs) if (_includeDirs)
set (_paths "") set (_paths "")
@@ -703,7 +719,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
endif() endif()
# interface compile definitions from linked library targets # interface compile definitions from linked library targets
set (_linkedTargets "") set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} _linkedTargets) cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets}) foreach (_linkedTarget ${_linkedTargets})
get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS) get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS)
if (_definitions) if (_definitions)
@@ -711,7 +727,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
endif() endif()
endforeach() endforeach()
# parse additional compile definitions from target compile flags # parse additional compile definitions from target compile flags
# and don't look at directory compile definitions, which we already handled # and do not look at directory compile definitions, which we already handled
set (_targetFlags "") set (_targetFlags "")
cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags) cotire_get_target_compile_flags("${_config}" "${_language}" "${_target}" _targetFlags)
cotire_filter_compile_flags("${_language}" "D" _definitions _ignore ${_targetFlags}) cotire_filter_compile_flags("${_language}" "D" _definitions _ignore ${_targetFlags})
@@ -859,6 +875,9 @@ macro (cotire_set_cmd_to_prologue _cmdVar)
list (APPEND ${_cmdVar} "--warn-uninitialized") list (APPEND ${_cmdVar} "--warn-uninitialized")
endif() endif()
list (APPEND ${_cmdVar} "-DCOTIRE_BUILD_TYPE:STRING=$<CONFIGURATION>") list (APPEND ${_cmdVar} "-DCOTIRE_BUILD_TYPE:STRING=$<CONFIGURATION>")
if (XCODE)
list (APPEND ${_cmdVar} "-DXCODE:BOOL=TRUE")
endif()
if (COTIRE_VERBOSE) if (COTIRE_VERBOSE)
list (APPEND ${_cmdVar} "-DCOTIRE_VERBOSE:BOOL=ON") list (APPEND ${_cmdVar} "-DCOTIRE_VERBOSE:BOOL=ON")
elseif("${CMAKE_GENERATOR}" MATCHES "Makefiles") elseif("${CMAKE_GENERATOR}" MATCHES "Makefiles")
@@ -876,6 +895,9 @@ function (cotire_init_compile_cmd _cmdVar _language _compilerLauncher _compilerE
if (NOT _compilerArg1) if (NOT _compilerArg1)
set (_compilerArg1 ${CMAKE_${_language}_COMPILER_ARG1}) set (_compilerArg1 ${CMAKE_${_language}_COMPILER_ARG1})
endif() endif()
if (WIN32)
file (TO_NATIVE_PATH "${_compilerExe}" _compilerExe)
endif()
string (STRIP "${_compilerArg1}" _compilerArg1) string (STRIP "${_compilerArg1}" _compilerArg1)
if ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") if ("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
# compiler launcher is only supported for Makefile and Ninja # compiler launcher is only supported for Makefile and Ninja
@@ -902,16 +924,16 @@ function (cotire_add_includes_to_cmd _cmdVar _language _includesVar _systemInclu
foreach (_include ${_includeDirs}) foreach (_include ${_includeDirs})
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
file (TO_NATIVE_PATH "${_include}" _include) file (TO_NATIVE_PATH "${_include}" _include)
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}") list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
else() else()
set (_index -1) set (_index -1)
if ("${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" MATCHES ".+") if ("${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" MATCHES ".+")
list (FIND ${_systemIncludesVar} "${_include}" _index) list (FIND ${_systemIncludesVar} "${_include}" _index)
endif() endif()
if (_index GREATER -1) if (_index GREATER -1)
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${_include}") list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
else() else()
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}") list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
endif() endif()
endif() endif()
endforeach() endforeach()
@@ -1046,10 +1068,10 @@ macro (cotire_check_ignore_header_file_path _headerFile _headerIsIgnoredVar)
set (${_headerIsIgnoredVar} TRUE) set (${_headerIsIgnoredVar} TRUE)
elseif (IS_DIRECTORY "${_headerFile}") elseif (IS_DIRECTORY "${_headerFile}")
set (${_headerIsIgnoredVar} TRUE) set (${_headerIsIgnoredVar} TRUE)
elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed" AND "${_headerFile}" MATCHES "\\.h$") elseif ("${_headerFile}" MATCHES "\\.\\.|[_-]fixed")
# heuristic: ignore C headers with embedded parent directory references or "-fixed" or "_fixed" in path # heuristic: ignore headers with embedded parent directory references or "-fixed" or "_fixed" in path
# these often stem from using GCC #include_next tricks, which may break the precompiled header compilation # these often stem from using GCC #include_next tricks, which may break the precompiled header compilation
# with the error message "error: no include path in which to search for header.h" # with the error message "error: no include path in which to search for header"
set (${_headerIsIgnoredVar} TRUE) set (${_headerIsIgnoredVar} TRUE)
else() else()
set (${_headerIsIgnoredVar} FALSE) set (${_headerIsIgnoredVar} FALSE)
@@ -1070,12 +1092,11 @@ endmacro()
macro (cotire_parse_line _line _headerFileVar _headerDepthVar) macro (cotire_parse_line _line _headerFileVar _headerDepthVar)
if (MSVC) if (MSVC)
# cl.exe /showIncludes output looks different depending on the language pack used, e.g.: # cl.exe /showIncludes produces different output, depending on the language pack used, e.g.:
# English: "Note: including file: C:\directory\file" # English: "Note: including file: C:\directory\file"
# German: "Hinweis: Einlesen der Datei: C:\directory\file" # German: "Hinweis: Einlesen der Datei: C:\directory\file"
# We use a very general regular expression, relying on the presence of the : characters # We use a very general regular expression, relying on the presence of the : characters
if (_line MATCHES "( +)([a-zA-Z]:[^:]+)$") if (_line MATCHES "( +)([a-zA-Z]:[^:]+)$")
# Visual Studio compiler output
string (LENGTH "${CMAKE_MATCH_1}" ${_headerDepthVar}) string (LENGTH "${CMAKE_MATCH_1}" ${_headerDepthVar})
get_filename_component(${_headerFileVar} "${CMAKE_MATCH_2}" ABSOLUTE) get_filename_component(${_headerFileVar} "${CMAKE_MATCH_2}" ABSOLUTE)
else() else()
@@ -1233,11 +1254,19 @@ function (cotire_scan_includes _includesVar)
set (${_includesVar} "" PARENT_SCOPE) set (${_includesVar} "" PARENT_SCOPE)
return() return()
endif() endif()
list (APPEND _cmd ${_existingSourceFiles}) # add source files to be scanned
if (WIN32)
foreach (_sourceFile ${_existingSourceFiles})
file (TO_NATIVE_PATH "${_sourceFile}" _sourceFileNative)
list (APPEND _cmd "${_sourceFileNative}")
endforeach()
else()
list (APPEND _cmd ${_existingSourceFiles})
endif()
if (COTIRE_VERBOSE) if (COTIRE_VERBOSE)
message (STATUS "execute_process: ${_cmd}") message (STATUS "execute_process: ${_cmd}")
endif() endif()
if (_option_COMPILER_ID MATCHES "MSVC") if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared # cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
unset (ENV{VS_UNICODE_OUTPUT}) unset (ENV{VS_UNICODE_OUTPUT})
endif() endif()
@@ -1473,11 +1502,16 @@ function (cotire_generate_prefix_header _prefixFile)
if (_unparsedLines) if (_unparsedLines)
if (COTIRE_VERBOSE OR _scanResult OR NOT _selectedHeaders) if (COTIRE_VERBOSE OR _scanResult OR NOT _selectedHeaders)
list (LENGTH _unparsedLines _skippedLineCount) list (LENGTH _unparsedLines _skippedLineCount)
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFile}") if (WIN32)
file (TO_NATIVE_PATH "${_unparsedLinesFile}" _unparsedLinesLogPath)
else()
set (_unparsedLinesLogPath "${_unparsedLinesFile}")
endif()
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesLogPath}")
endif() endif()
string (REPLACE ";" "\n" _unparsedLines "${_unparsedLines}") string (REPLACE ";" "\n" _unparsedLines "${_unparsedLines}")
endif() endif()
file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}") file (WRITE "${_unparsedLinesFile}" "${_unparsedLines}\n")
endfunction() endfunction()
function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flagsVar) function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flagsVar)
@@ -1507,7 +1541,7 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
# append to list # append to list
list (APPEND _flags -H -E) list (APPEND _flags -H -E)
if (NOT "${_compilerVersion}" VERSION_LESS "4.3.0") if (NOT "${_compilerVersion}" VERSION_LESS "4.3.0")
list (APPEND _flags "-fdirectives-only") list (APPEND _flags -fdirectives-only)
endif() endif()
else() else()
# return as a flag string # return as a flag string
@@ -1517,16 +1551,36 @@ function (cotire_add_makedep_flags _language _compilerID _compilerVersion _flags
endif() endif()
endif() endif()
elseif (_compilerID MATCHES "Clang") elseif (_compilerID MATCHES "Clang")
# Clang options used if (UNIX)
# -H print the name of each header file used # Clang options used
# -E invoke preprocessor # -H print the name of each header file used
# -fno-color-diagnostics don't prints diagnostics in color # -E invoke preprocessor
if (_flags) # -fno-color-diagnostics do not print diagnostics in color
# append to list # -Eonly just run preprocessor, no output
list (APPEND _flags -H -E -fno-color-diagnostics) if (_flags)
else() # append to list
# return as a flag string list (APPEND _flags -H -E -fno-color-diagnostics -Xclang -Eonly)
set (_flags "-H -E -fno-color-diagnostics") else()
# return as a flag string
set (_flags "-H -E -fno-color-diagnostics -Xclang -Eonly")
endif()
elseif (WIN32)
# Clang-cl.exe options used
# /TC treat all files named on the command line as C source files
# /TP treat all files named on the command line as C++ source files
# /EP preprocess to stdout without #line directives
# -H print the name of each header file used
# -fno-color-diagnostics do not print diagnostics in color
# -Eonly just run preprocessor, no output
set (_sourceFileTypeC "/TC")
set (_sourceFileTypeCXX "/TP")
if (_flags)
# append to list
list (APPEND _flags "${_sourceFileType${_language}}" /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly)
else()
# return as a flag string
set (_flags "${_sourceFileType${_language}} /EP -fno-color-diagnostics -Xclang -H -Xclang -Eonly")
endif()
endif() endif()
elseif (_compilerID MATCHES "Intel") elseif (_compilerID MATCHES "Intel")
if (WIN32) if (WIN32)
@@ -1600,8 +1654,8 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}") set (_flags "${_flags} /Zm${COTIRE_PCH_MEMORY_SCALING_FACTOR}")
endif() endif()
endif() endif()
elseif (_compilerID MATCHES "GNU|Clang") elseif (_compilerID MATCHES "GNU")
# GCC / Clang options used # GCC options used
# -x specify the source language # -x specify the source language
# -c compile but do not link # -c compile but do not link
# -o place output in file # -o place output in file
@@ -1611,11 +1665,55 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
set (_xLanguage_CXX "c++-header") set (_xLanguage_CXX "c++-header")
if (_flags) if (_flags)
# append to list # append to list
list (APPEND _flags "-x" "${_xLanguage_${_language}}" "-c" "${_prefixFile}" -o "${_pchFile}") list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
else() else()
# return as a flag string # return as a flag string
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"") set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
endif() endif()
elseif (_compilerID MATCHES "Clang")
if (UNIX)
# Clang options used
# -x specify the source language
# -c compile but do not link
# -o place output in file
# -fno-pch-timestamp disable inclusion of timestamp in precompiled headers (clang 4.0.0+)
set (_xLanguage_C "c-header")
set (_xLanguage_CXX "c++-header")
if (_flags)
# append to list
list (APPEND _flags -x "${_xLanguage_${_language}}" -c "${_prefixFile}" -o "${_pchFile}")
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
list (APPEND _flags -Xclang -fno-pch-timestamp)
endif()
else()
# return as a flag string
set (_flags "-x ${_xLanguage_${_language}} -c \"${_prefixFile}\" -o \"${_pchFile}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "4.0.0")
set (_flags "${_flags} -Xclang -fno-pch-timestamp")
endif()
endif()
elseif (WIN32)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
file (TO_NATIVE_PATH "${_hostFile}" _hostFileNative)
# Clang-cl.exe options used
# /Yc creates a precompiled header file
# /Fp specifies precompiled header binary file name
# /FI forces inclusion of file
# /Zs syntax check only
# /TC treat all files named on the command line as C source files
# /TP treat all files named on the command line as C++ source files
set (_sourceFileTypeC "/TC")
set (_sourceFileTypeCXX "/TP")
if (_flags)
# append to list
list (APPEND _flags "${_sourceFileType${_language}}"
"/Yc${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}" /Zs "${_hostFileNative}")
else()
# return as a flag string
set (_flags "/Yc\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
endif()
endif()
elseif (_compilerID MATCHES "Intel") elseif (_compilerID MATCHES "Intel")
if (WIN32) if (WIN32)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative) file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
@@ -1657,20 +1755,28 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
get_filename_component(_pchName "${_pchFile}" NAME) get_filename_component(_pchName "${_pchFile}" NAME)
set (_xLanguage_C "c-header") set (_xLanguage_C "c-header")
set (_xLanguage_CXX "c++-header") set (_xLanguage_CXX "c++-header")
set (_pchSuppressMessages FALSE)
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
set(_pchSuppressMessages TRUE)
endif()
if (_flags) if (_flags)
# append to list # append to list
if ("${_language}" STREQUAL "CXX") if ("${_language}" STREQUAL "CXX")
list (APPEND _flags -Kc++) list (APPEND _flags -Kc++)
endif() endif()
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-create" "${_pchName}" "-fsyntax-only" "${_hostFile}") list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-create "${_pchName}" -fsyntax-only "${_hostFile}")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
list (APPEND _flags "-Wpch-messages") if (NOT _pchSuppressMessages)
list (APPEND _flags -Wpch-messages)
endif()
endif() endif()
else() else()
# return as a flag string # return as a flag string
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-create \"${_pchName}\"") set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-create \"${_pchName}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
set (_flags "${_flags} -Wpch-messages") if (NOT _pchSuppressMessages)
set (_flags "${_flags} -Wpch-messages")
endif()
endif() endif()
endif() endif()
endif() endif()
@@ -1721,23 +1827,48 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
# note: ccache requires the -include flag to be used in order to process precompiled header correctly # note: ccache requires the -include flag to be used in order to process precompiled header correctly
if (_flags) if (_flags)
# append to list # append to list
list (APPEND _flags "-Winvalid-pch" "-include" "${_prefixFile}") list (APPEND _flags -Winvalid-pch -include "${_prefixFile}")
else() else()
# return as a flag string # return as a flag string
set (_flags "-Winvalid-pch -include \"${_prefixFile}\"") set (_flags "-Winvalid-pch -include \"${_prefixFile}\"")
endif() endif()
elseif (_compilerID MATCHES "Clang") elseif (_compilerID MATCHES "Clang")
# Clang options used if (UNIX)
# -include process include file as the first line of the primary source file # Clang options used
# -include-pch include precompiled header file # -include process include file as the first line of the primary source file
# -Qunused-arguments don't emit warning for unused driver arguments # note: ccache requires the -include flag to be used in order to process precompiled header correctly
# note: ccache requires the -include flag to be used in order to process precompiled header correctly if (_flags)
if (_flags) # append to list
# append to list list (APPEND _flags -include "${_prefixFile}")
list (APPEND _flags "-Qunused-arguments" "-include" "${_prefixFile}") else()
else() # return as a flag string
# return as a flag string set (_flags "-include \"${_prefixFile}\"")
set (_flags "-Qunused-arguments -include \"${_prefixFile}\"") endif()
elseif (WIN32)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileNative)
# Clang-cl.exe options used
# /Yu uses a precompiled header file during build
# /Fp specifies precompiled header binary file name
# /FI forces inclusion of file
if (_pchFile)
file (TO_NATIVE_PATH "${_pchFile}" _pchFileNative)
if (_flags)
# append to list
list (APPEND _flags "/Yu${_prefixFileNative}" "/Fp${_pchFileNative}" "/FI${_prefixFileNative}")
else()
# return as a flag string
set (_flags "/Yu\"${_prefixFileNative}\" /Fp\"${_pchFileNative}\" /FI\"${_prefixFileNative}\"")
endif()
else()
# no precompiled header, force inclusion of prefix header
if (_flags)
# append to list
list (APPEND _flags "/FI${_prefixFileNative}")
else()
# return as a flag string
set (_flags "/FI\"${_prefixFileNative}\"")
endif()
endif()
endif() endif()
elseif (_compilerID MATCHES "Intel") elseif (_compilerID MATCHES "Intel")
if (WIN32) if (WIN32)
@@ -1781,24 +1912,32 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
if (_pchFile) if (_pchFile)
get_filename_component(_pchDir "${_pchFile}" DIRECTORY) get_filename_component(_pchDir "${_pchFile}" DIRECTORY)
get_filename_component(_pchName "${_pchFile}" NAME) get_filename_component(_pchName "${_pchFile}" NAME)
set (_pchSuppressMessages FALSE)
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
set(_pchSuppressMessages TRUE)
endif()
if (_flags) if (_flags)
# append to list # append to list
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-use" "${_pchName}") list (APPEND _flags -include "${_prefixFile}" -pch-dir "${_pchDir}" -pch-use "${_pchName}")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
list (APPEND _flags "-Wpch-messages") if (NOT _pchSuppressMessages)
list (APPEND _flags -Wpch-messages)
endif()
endif() endif()
else() else()
# return as a flag string # return as a flag string
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-use \"${_pchName}\"") set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-use \"${_pchName}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0") if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
set (_flags "${_flags} -Wpch-messages") if (NOT _pchSuppressMessages)
set (_flags "${_flags} -Wpch-messages")
endif()
endif() endif()
endif() endif()
else() else()
# no precompiled header, force inclusion of prefix header # no precompiled header, force inclusion of prefix header
if (_flags) if (_flags)
# append to list # append to list
list (APPEND _flags "-include" "${_prefixFile}") list (APPEND _flags -include "${_prefixFile}")
else() else()
# return as a flag string # return as a flag string
set (_flags "-include \"${_prefixFile}\"") set (_flags "-include \"${_prefixFile}\"")
@@ -1836,9 +1975,17 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile)
if (COTIRE_VERBOSE) if (COTIRE_VERBOSE)
message (STATUS "execute_process: ${_cmd}") message (STATUS "execute_process: ${_cmd}")
endif() endif()
if (_option_COMPILER_ID MATCHES "MSVC") if (MSVC_IDE OR _option_COMPILER_ID MATCHES "MSVC")
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared # cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
unset (ENV{VS_UNICODE_OUTPUT}) unset (ENV{VS_UNICODE_OUTPUT})
elseif (_option_COMPILER_ID MATCHES "Clang" AND _option_COMPILER_VERSION VERSION_LESS "4.0.0")
if (_option_COMPILER_LAUNCHER MATCHES "ccache" OR
_option_COMPILER_EXECUTABLE MATCHES "ccache")
# Newer versions of Clang embed a compilation timestamp into the precompiled header binary,
# which results in "file has been modified since the precompiled header was built" errors if ccache is used.
# We work around the problem by disabling ccache upon pre-compiling the prefix header.
set (ENV{CCACHE_DISABLE} "true")
endif()
endif() endif()
execute_process( execute_process(
COMMAND ${_cmd} COMMAND ${_cmd}
@@ -1853,7 +2000,7 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
set (_unsupportedCompiler set (_unsupportedCompiler
"Precompiled headers not supported for ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}") "Precompiled headers not supported for ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}")
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC") if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC")
# supported since Visual Studio C++ 6.0 # PCH supported since Visual Studio C++ 6.0
# and CMake does not support an earlier version # and CMake does not support an earlier version
set (${_msgVar} "" PARENT_SCOPE) set (${_msgVar} "" PARENT_SCOPE)
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "GNU") elseif (CMAKE_${_language}_COMPILER_ID MATCHES "GNU")
@@ -1864,8 +2011,16 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
set (${_msgVar} "" PARENT_SCOPE) set (${_msgVar} "" PARENT_SCOPE)
endif() endif()
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Clang") elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Clang")
# all Clang versions have PCH support if (UNIX)
set (${_msgVar} "" PARENT_SCOPE) # all Unix Clang versions have PCH support
set (${_msgVar} "" PARENT_SCOPE)
elseif (WIN32)
# only clang-cl is supported under Windows
get_filename_component(_compilerName "${CMAKE_${_language}_COMPILER}" NAME_WE)
if (NOT _compilerName MATCHES "cl$")
set (${_msgVar} "${_unsupportedCompiler} version ${CMAKE_${_language}_COMPILER_VERSION}. Use clang-cl instead." PARENT_SCOPE)
endif()
endif()
elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Intel") elseif (CMAKE_${_language}_COMPILER_ID MATCHES "Intel")
# Intel PCH support requires version >= 8.0.0 # Intel PCH support requires version >= 8.0.0
if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "8.0.0") if ("${CMAKE_${_language}_COMPILER_VERSION}" VERSION_LESS "8.0.0")
@@ -1876,29 +2031,38 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
else() else()
set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE) set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE)
endif() endif()
# check if ccache is used as a compiler launcher
get_target_property(_launcher ${_target} ${_language}_COMPILER_LAUNCHER) get_target_property(_launcher ${_target} ${_language}_COMPILER_LAUNCHER)
if (CMAKE_${_language}_COMPILER MATCHES "ccache" OR _launcher MATCHES "ccache") get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" REALPATH)
if (_realCompilerExe MATCHES "ccache" OR _launcher MATCHES "ccache")
# verify that ccache configuration is compatible with precompiled headers
# always check environment variable CCACHE_SLOPPINESS, because earlier versions of ccache
# do not report the "sloppiness" setting correctly upon printing ccache configuration
if (DEFINED ENV{CCACHE_SLOPPINESS}) if (DEFINED ENV{CCACHE_SLOPPINESS})
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros") if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR
NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
set (${_msgVar} set (${_msgVar}
"ccache requires the environment variable CCACHE_SLOPPINESS to be set to \"pch_defines,time_macros\"." "ccache requires the environment variable CCACHE_SLOPPINESS to be set to \"pch_defines,time_macros\"."
PARENT_SCOPE) PARENT_SCOPE)
endif() endif()
else() else()
if (_launcher MATCHES "ccache") if (_realCompilerExe MATCHES "ccache")
get_filename_component(_ccacheExe "${_launcher}" REALPATH) set (_ccacheExe "${_realCompilerExe}")
else() else()
get_filename_component(_ccacheExe "${CMAKE_${_language}_COMPILER}" REALPATH) set (_ccacheExe "${_launcher}")
endif() endif()
# ccache 3.7.0 replaced --print-config with --show-config
# use -p instead, which seems to work for all version for now, sigh
execute_process( execute_process(
COMMAND "${_ccacheExe}" "--print-config" COMMAND "${_ccacheExe}" "-p"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
RESULT_VARIABLE _result RESULT_VARIABLE _result
OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET) ERROR_QUIET)
if (_result OR NOT if (_result)
_ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR NOT set (${_msgVar} "ccache configuration cannot be determined." PARENT_SCOPE)
_ccacheConfig MATCHES "sloppiness.*=.*pch_defines") elseif (NOT _ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR
NOT _ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
set (${_msgVar} set (${_msgVar}
"ccache requires configuration setting \"sloppiness\" to be set to \"pch_defines,time_macros\"." "ccache requires configuration setting \"sloppiness\" to be set to \"pch_defines,time_macros\"."
PARENT_SCOPE) PARENT_SCOPE)
@@ -2191,7 +2355,7 @@ function (cotire_generate_target_script _language _configurations _target _targe
XCODE MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES XCODE MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES
CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER_VERSION CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER_VERSION
CMAKE_${_language}_COMPILER_LAUNCHER CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1 CMAKE_${_language}_COMPILER_LAUNCHER CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_${_language}_SEP CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_SEP_${_language}
CMAKE_INCLUDE_SYSTEM_FLAG_${_language} CMAKE_INCLUDE_SYSTEM_FLAG_${_language}
CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG
CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG
@@ -2224,8 +2388,9 @@ endfunction()
function (cotire_setup_pch_file_compilation _language _target _targetScript _prefixFile _pchFile _hostFile) function (cotire_setup_pch_file_compilation _language _target _targetScript _prefixFile _pchFile _hostFile)
set (_sourceFiles ${ARGN}) set (_sourceFiles ${ARGN})
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
# for Visual Studio and Intel, we attach the precompiled header compilation to the host file (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
# for MSVC, Intel and Clang-cl, we attach the precompiled header compilation to the host file
# the remaining files include the precompiled header, see cotire_setup_pch_file_inclusion # the remaining files include the precompiled header, see cotire_setup_pch_file_inclusion
if (_sourceFiles) if (_sourceFiles)
set (_flags "") set (_flags "")
@@ -2233,6 +2398,9 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" "${_hostFile}" _flags) "${_prefixFile}" "${_pchFile}" "${_hostFile}" _flags)
set_property (SOURCE ${_hostFile} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") set_property (SOURCE ${_hostFile} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_hostFile} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_OUTPUTS "${_pchFile}") set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_OUTPUTS "${_pchFile}")
# make object file generated from host file depend on prefix header # make object file generated from host file depend on prefix header
set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}") set_property (SOURCE ${_hostFile} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}")
@@ -2270,8 +2438,9 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
endfunction() endfunction()
function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefixFile _pchFile _hostFile) function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefixFile _pchFile _hostFile)
if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") if (CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" OR
# for Visual Studio and Intel, we include the precompiled header in all but the host file (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
# for MSVC, Intel and clang-cl, we include the precompiled header in all but the host file
# the host file does the precompiled header compilation, see cotire_setup_pch_file_compilation # the host file does the precompiled header compilation, see cotire_setup_pch_file_compilation
set (_sourceFiles ${ARGN}) set (_sourceFiles ${ARGN})
list (LENGTH _sourceFiles _numberOfSourceFiles) list (LENGTH _sourceFiles _numberOfSourceFiles)
@@ -2283,6 +2452,9 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _flags) "${_prefixFile}" "${_pchFile}" _flags)
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
# make object files generated from source files depend on precompiled header # make object files generated from source files depend on precompiled header
set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}") set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_pchFile}")
endif() endif()
@@ -2296,6 +2468,9 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _flags) "${_prefixFile}" "${_pchFile}" _flags)
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
# mark sources as cotired to prevent them from being used in another cotired target # mark sources as cotired to prevent them from being used in another cotired target
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}") set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
endif() endif()
@@ -2313,6 +2488,9 @@ function (cotire_setup_prefix_file_inclusion _language _target _prefixFile)
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _flags) "${_prefixFile}" "${_pchFile}" _flags)
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ") set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
if (COTIRE_DEBUG)
message (STATUS "set_property: SOURCE ${_sourceFiles} APPEND_STRING COMPILE_FLAGS ${_flags}")
endif()
# mark sources as cotired to prevent them from being used in another cotired target # mark sources as cotired to prevent them from being used in another cotired target
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}") set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
# make object files generated from source files depend on prefix header # make object files generated from source files depend on prefix header
@@ -2402,7 +2580,7 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
message (STATUS "add_custom_command: TARGET ${_target} PRE_BUILD ${_cmds}") message (STATUS "add_custom_command: TARGET ${_target} PRE_BUILD ${_cmds}")
endif() endif()
# because CMake PRE_BUILD command does not support dependencies, # because CMake PRE_BUILD command does not support dependencies,
# we check dependencies explicitly in cotire script mode when the pre-build action is run # we check dependencies explicity in cotire script mode when the pre-build action is run
add_custom_command( add_custom_command(
TARGET "${_target}" TARGET "${_target}"
PRE_BUILD ${_cmds} PRE_BUILD ${_cmds}
@@ -2417,9 +2595,10 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
# if this is a single-language target without any excluded files # if this is a single-language target without any excluded files
if (_wholeTarget) if (_wholeTarget)
set (_language "${_languages}") set (_language "${_languages}")
# for Visual Studio and Intel, precompiled header inclusion is always done on the source file level # for MSVC, Intel and clang-cl, precompiled header inclusion is always done on the source file level
# see cotire_setup_pch_file_inclusion # see cotire_setup_pch_file_inclusion
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
(WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER) get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER)
if (_prefixFile) if (_prefixFile)
get_property(_pchFile TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER) get_property(_pchFile TARGET ${_target} PROPERTY COTIRE_${_language}_PRECOMPILED_HEADER)
@@ -2428,6 +2607,9 @@ function (cotire_setup_target_pch_usage _languages _target _wholeTarget)
"${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}" "${_language}" "${CMAKE_${_language}_COMPILER_ID}" "${CMAKE_${_language}_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" _options) "${_prefixFile}" "${_pchFile}" _options)
set_property(TARGET ${_target} APPEND PROPERTY ${_options}) set_property(TARGET ${_target} APPEND PROPERTY ${_options})
if (COTIRE_DEBUG)
message (STATUS "set_property: TARGET ${_target} APPEND PROPERTY ${_options}")
endif()
endif() endif()
endif() endif()
endif() endif()
@@ -2454,7 +2636,8 @@ function (cotire_setup_unity_generation_commands _language _target _targetScript
set_property (SOURCE "${_unityFile}" PROPERTY OBJECT_DEPENDS ${_objectDependsPaths}) set_property (SOURCE "${_unityFile}" PROPERTY OBJECT_DEPENDS ${_objectDependsPaths})
endif() endif()
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
# unity file compilation results in potentially huge object file, thus use /bigobj by default unter MSVC and Windows Intel # unity file compilation results in potentially huge object file,
# thus use /bigobj by default unter cl.exe and Windows Intel
set_property (SOURCE "${_unityFile}" APPEND_STRING PROPERTY COMPILE_FLAGS "/bigobj") set_property (SOURCE "${_unityFile}" APPEND_STRING PROPERTY COMPILE_FLAGS "/bigobj")
endif() endif()
cotire_set_cmd_to_prologue(_unityCmd) cotire_set_cmd_to_prologue(_unityCmd)
@@ -2660,6 +2843,9 @@ function (cotire_make_target_message _target _languages _disableMsg _targetMsgVa
else() else()
set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build.") set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build.")
endif() endif()
if (_disableMsg)
set (_targetMsg "${_targetMsg} ${_disableMsg}")
endif()
else() else()
if (_excludedStr) if (_excludedStr)
set (_targetMsg "${_languagesStr} target ${_target} cotired ${_excludedStr}.") set (_targetMsg "${_languagesStr} target ${_target} cotired ${_excludedStr}.")
@@ -2749,6 +2935,20 @@ function (cotire_choose_target_languages _target _targetLanguagesVar _wholeTarge
set (_targetUsePCH FALSE) set (_targetUsePCH FALSE)
endif() endif()
endif() endif()
if (_targetAddSCU)
# disable unity builds if automatic Qt processing is used
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
get_target_property(_targetAutoUic ${_target} AUTOUIC)
get_target_property(_targetAutoRcc ${_target} AUTORCC)
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
if (_disableMsg)
set (_disableMsg "${_disableMsg} Target uses automatic CMake Qt processing.")
else()
set (_disableMsg "Target uses automatic CMake Qt processing.")
endif()
set (_targetAddSCU FALSE)
endif()
endif()
set_property(TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${_targetUsePCH}) set_property(TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${_targetUsePCH})
set_property(TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD ${_targetAddSCU}) set_property(TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD ${_targetAddSCU})
cotire_make_target_message(${_target} "${_targetLanguages}" "${_disableMsg}" _targetMsg ${_allExcludedSourceFiles}) cotire_make_target_message(${_target} "${_targetLanguages}" "${_disableMsg}" _targetMsg ${_allExcludedSourceFiles})
@@ -2776,7 +2976,11 @@ function (cotire_compute_unity_max_number_of_includes _target _maxIncludesVar)
set (_sourceFiles ${ARGN}) set (_sourceFiles ${ARGN})
get_target_property(_maxIncludes ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES) get_target_property(_maxIncludes ${_target} COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES)
if (_maxIncludes MATCHES "(-j|--parallel|--jobs) ?([0-9]*)") if (_maxIncludes MATCHES "(-j|--parallel|--jobs) ?([0-9]*)")
set (_numberOfThreads "${CMAKE_MATCH_2}") if (DEFINED CMAKE_MATCH_2)
set (_numberOfThreads "${CMAKE_MATCH_2}")
else()
set (_numberOfThreads "")
endif()
if (NOT _numberOfThreads) if (NOT _numberOfThreads)
# use all available cores # use all available cores
ProcessorCount(_numberOfThreads) ProcessorCount(_numberOfThreads)
@@ -2889,8 +3093,9 @@ function (cotire_setup_pch_target _languages _configurations _target)
set (_dependsFiles "") set (_dependsFiles "")
foreach (_language ${_languages}) foreach (_language ${_languages})
set (_props COTIRE_${_language}_PREFIX_HEADER COTIRE_${_language}_UNITY_SOURCE) set (_props COTIRE_${_language}_PREFIX_HEADER COTIRE_${_language}_UNITY_SOURCE)
if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel") if (NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel" AND NOT
# Visual Studio and Intel only create precompiled header as a side effect (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "Clang"))
# MSVC, Intel and clang-cl only create precompiled header as a side effect
list (INSERT _props 0 COTIRE_${_language}_PRECOMPILED_HEADER) list (INSERT _props 0 COTIRE_${_language}_PRECOMPILED_HEADER)
endif() endif()
cotire_get_first_set_property_value(_dependsFile TARGET ${_target} ${_props}) cotire_get_first_set_property_value(_dependsFile TARGET ${_target} ${_props})
@@ -2938,6 +3143,7 @@ function (cotire_collect_unity_target_sources _target _languages _unityTargetSou
list (APPEND _unityTargetSources ${_unityFiles}) list (APPEND _unityTargetSources ${_unityFiles})
endif() endif()
endforeach() endforeach()
# handle object libraries which are part of the target's sources
get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT) get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT)
if ("${_linkLibrariesStrategy}" MATCHES "^COPY_UNITY$") if ("${_linkLibrariesStrategy}" MATCHES "^COPY_UNITY$")
cotire_filter_object_libraries(${_target} _objectLibraries ${_targetSourceFiles}) cotire_filter_object_libraries(${_target} _objectLibraries ${_targetSourceFiles})
@@ -2982,21 +3188,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
# determine unity target sources # determine unity target sources
set (_unityTargetSources "") set (_unityTargetSources "")
cotire_collect_unity_target_sources(${_target} "${_languages}" _unityTargetSources) cotire_collect_unity_target_sources(${_target} "${_languages}" _unityTargetSources)
# handle automatic Qt processing
get_target_property(_targetAutoMoc ${_target} AUTOMOC)
get_target_property(_targetAutoUic ${_target} AUTOUIC)
get_target_property(_targetAutoRcc ${_target} AUTORCC)
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
# if the original target sources are subject to CMake's automatic Qt processing,
# also include implicitly generated <targetname>_automoc.cpp file
if (CMAKE_VERSION VERSION_LESS "3.8.0")
list (APPEND _unityTargetSources "${_target}_automoc.cpp")
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE)
else()
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp")
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE)
endif()
endif()
# prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created # prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created
set (CMAKE_AUTOMOC OFF) set (CMAKE_AUTOMOC OFF)
set (CMAKE_AUTOUIC OFF) set (CMAKE_AUTOUIC OFF)
@@ -3010,21 +3201,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
else() else()
add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources}) add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources})
endif() endif()
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
# depend on original target's automoc target, if it exists
if (TARGET ${_target}_automoc)
add_dependencies(${_unityTargetName} ${_target}_automoc)
endif()
else()
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
# depend on the original target's implicitly generated <targetname>_automoc target
if (CMAKE_VERSION VERSION_LESS "3.8.0")
add_dependencies(${_unityTargetName} ${_target}_automoc)
else()
add_dependencies(${_unityTargetName} ${_target}_autogen)
endif()
endif()
endif()
# copy output location properties # copy output location properties
set (_outputDirProperties set (_outputDirProperties
ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>
@@ -3036,8 +3212,8 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
set (_outputDir "${COTIRE_UNITY_OUTPUT_DIRECTORY}") set (_outputDir "${COTIRE_UNITY_OUTPUT_DIRECTORY}")
else() else()
# append relative COTIRE_UNITY_OUTPUT_DIRECTORY to target's actual output directory # append relative COTIRE_UNITY_OUTPUT_DIRECTORY to target's actual output directory
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties}) cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
cotire_resolve_config_properites("${_configurations}" _properties ${_outputDirProperties}) cotire_resolve_config_properties("${_configurations}" _properties ${_outputDirProperties})
foreach (_property ${_properties}) foreach (_property ${_properties})
get_property(_outputDir TARGET ${_target} PROPERTY ${_property}) get_property(_outputDir TARGET ${_target} PROPERTY ${_property})
if (_outputDir) if (_outputDir)
@@ -3057,11 +3233,11 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
RUNTIME_OUTPUT_DIRECTORY "${_outputDir}") RUNTIME_OUTPUT_DIRECTORY "${_outputDir}")
endif() endif()
else() else()
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
${_outputDirProperties}) ${_outputDirProperties})
endif() endif()
# copy output name # copy output name
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_<CONFIG> ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_<CONFIG>
LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_<CONFIG> LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_<CONFIG>
OUTPUT_NAME OUTPUT_NAME_<CONFIG> OUTPUT_NAME OUTPUT_NAME_<CONFIG>
@@ -3069,7 +3245,7 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
PREFIX <CONFIG>_POSTFIX SUFFIX PREFIX <CONFIG>_POSTFIX SUFFIX
IMPORT_PREFIX IMPORT_SUFFIX) IMPORT_PREFIX IMPORT_SUFFIX)
# copy compile stuff # copy compile stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
COMPILE_DEFINITIONS COMPILE_DEFINITIONS_<CONFIG> COMPILE_DEFINITIONS COMPILE_DEFINITIONS_<CONFIG>
COMPILE_FLAGS COMPILE_OPTIONS COMPILE_FLAGS COMPILE_OPTIONS
Fortran_FORMAT Fortran_MODULE_DIRECTORY Fortran_FORMAT Fortran_MODULE_DIRECTORY
@@ -3081,12 +3257,12 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN
C_CLANG_TIDY CXX_CLANG_TIDY) C_CLANG_TIDY CXX_CLANG_TIDY)
# copy compile features # copy compile features
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED
CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED
COMPILE_FEATURES) COMPILE_FEATURES)
# copy interface stuff # copy interface stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN
COMPATIBLE_INTERFACE_STRING COMPATIBLE_INTERFACE_STRING
INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS
@@ -3094,8 +3270,9 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
INTERFACE_AUTOUIC_OPTIONS NO_SYSTEM_FROM_IMPORTED) INTERFACE_AUTOUIC_OPTIONS NO_SYSTEM_FROM_IMPORTED)
# copy link stuff # copy link stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUILD_WITH_INSTALL_RPATH INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH BUILD_WITH_INSTALL_RPATH BUILD_WITH_INSTALL_NAME_DIR
INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED
LINK_FLAGS LINK_FLAGS_<CONFIG> LINK_FLAGS LINK_FLAGS_<CONFIG>
LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_<CONFIG> LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_<CONFIG>
@@ -3103,18 +3280,18 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
LINK_SEARCH_START_STATIC LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LINK_SEARCH_END_STATIC
STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_<CONFIG> STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_<CONFIG>
NO_SONAME SOVERSION VERSION NO_SONAME SOVERSION VERSION
LINK_WHAT_YOU_USE) LINK_WHAT_YOU_USE BUILD_RPATH)
# copy cmake stuff # copy cmake stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK) IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK)
# copy Apple platform specific stuff # copy Apple platform specific stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUNDLE BUNDLE_EXTENSION FRAMEWORK FRAMEWORK_VERSION INSTALL_NAME_DIR BUNDLE BUNDLE_EXTENSION FRAMEWORK FRAMEWORK_VERSION INSTALL_NAME_DIR
MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_RPATH MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_RPATH
OSX_ARCHITECTURES OSX_ARCHITECTURES_<CONFIG> PRIVATE_HEADER PUBLIC_HEADER RESOURCE XCTEST OSX_ARCHITECTURES OSX_ARCHITECTURES_<CONFIG> PRIVATE_HEADER PUBLIC_HEADER RESOURCE XCTEST
IOS_INSTALL_COMBINED) IOS_INSTALL_COMBINED XCODE_EXPLICIT_FILE_TYPE XCODE_PRODUCT_TYPE)
# copy Windows platform specific stuff # copy Windows platform specific stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
GNUtoMS GNUtoMS
COMPILE_PDB_NAME COMPILE_PDB_NAME_<CONFIG> COMPILE_PDB_NAME COMPILE_PDB_NAME_<CONFIG>
COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG> COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
@@ -3128,15 +3305,19 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES
WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS
DEPLOYMENT_REMOTE_DIRECTORY VS_CONFIGURATION_TYPE DEPLOYMENT_REMOTE_DIRECTORY VS_CONFIGURATION_TYPE
VS_SDK_REFERENCES) VS_SDK_REFERENCES VS_USER_PROPS VS_DEBUGGER_WORKING_DIRECTORY)
# copy Android platform specific stuff # copy Android platform specific stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
ANDROID_API ANDROID_API_MIN ANDROID_GUI ANDROID_API ANDROID_API_MIN ANDROID_GUI
ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES
ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR
ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES
ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH
ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE) ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE)
# copy CUDA platform specific stuff
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
CUDA_PTX_COMPILATION CUDA_SEPARABLE_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS
CUDA_EXTENSIONS CUDA_STANDARD CUDA_STANDARD_REQUIRED)
# use output name from original target # use output name from original target
get_target_property(_targetOutputName ${_unityTargetName} OUTPUT_NAME) get_target_property(_targetOutputName ${_unityTargetName} OUTPUT_NAME)
if (NOT _targetOutputName) if (NOT _targetOutputName)
@@ -3150,6 +3331,13 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
set_property(TARGET ${_unityTargetName} PROPERTY ENABLE_EXPORTS TRUE) set_property(TARGET ${_unityTargetName} PROPERTY ENABLE_EXPORTS TRUE)
endif() endif()
endif() endif()
# enable parallel compilation for MSVC
if (MSVC AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
list (LENGTH _unityTargetSources _numberOfUnityTargetSources)
if (_numberOfUnityTargetSources GREATER 1)
set_property(TARGET ${_unityTargetName} APPEND PROPERTY COMPILE_OPTIONS "/MP")
endif()
endif()
cotire_init_target(${_unityTargetName}) cotire_init_target(${_unityTargetName})
cotire_add_to_unity_all_target(${_unityTargetName}) cotire_add_to_unity_all_target(${_unityTargetName})
set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_TARGET_NAME "${_unityTargetName}") set_property(TARGET ${_target} PROPERTY COTIRE_UNITY_TARGET_NAME "${_unityTargetName}")
@@ -3308,6 +3496,13 @@ function (cotire_target_link_libraries _target)
message (STATUS "unity target ${_unityTargetName} interface link libraries: ${_unityLinkInterfaceLibraries}") message (STATUS "unity target ${_unityTargetName} interface link libraries: ${_unityLinkInterfaceLibraries}")
endif() endif()
endif() endif()
get_target_property(_manualDependencies ${_target} MANUALLY_ADDED_DEPENDENCIES)
if (_manualDependencies)
cotire_map_libraries("${_linkLibrariesStrategy}" _unityManualDependencies ${_manualDependencies})
if (_unityManualDependencies)
add_dependencies("${_unityTargetName}" ${_unityManualDependencies})
endif()
endif()
endif() endif()
endif() endif()
endfunction(cotire_target_link_libraries) endfunction(cotire_target_link_libraries)
@@ -3340,9 +3535,9 @@ function (cotire_init_target _targetName)
set_target_properties(${_targetName} PROPERTIES FOLDER "${COTIRE_TARGETS_FOLDER}") set_target_properties(${_targetName} PROPERTIES FOLDER "${COTIRE_TARGETS_FOLDER}")
endif() endif()
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_ALL TRUE) set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_ALL TRUE)
if (MSVC_IDE) # if (MSVC_IDE)
set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE) # set_target_properties(${_targetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
endif() # endif()
endfunction() endfunction()
function (cotire_add_to_pch_all_target _pchTargetName) function (cotire_add_to_pch_all_target _pchTargetName)
@@ -3604,7 +3799,7 @@ else()
set (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "m;mm" CACHE STRING set (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "m;mm" CACHE STRING
"Ignore sources with the listed file extensions from the generated unity source.") "Ignore sources with the listed file extensions from the generated unity source.")
set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "3" CACHE STRING set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "2" CACHE STRING
"Minimum number of sources in target required to enable use of precompiled header.") "Minimum number of sources in target required to enable use of precompiled header.")
if (NOT DEFINED COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT) if (NOT DEFINED COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES_INIT)
@@ -3703,7 +3898,7 @@ else()
FULL_DOCS FULL_DOCS
"The variable can be set to an integer > 0." "The variable can be set to an integer > 0."
"If a target contains less than that number of source files, cotire will not enable the use of the precompiled header for the target." "If a target contains less than that number of source files, cotire will not enable the use of the precompiled header for the target."
"If not defined, defaults to 3." "If not defined, defaults to 2."
) )
define_property( define_property(

View File

@@ -1,4 +1,93 @@
# Draco - a library for a lossy vertex data compression, used as extension to glTF format. # Draco - a library for a lossy vertex data compression, used as extension to glTF format.
# https://github.com/google/draco # https://github.com/google/draco
THIRDPARTY_PRODUCT("DRACO" "draco/compression/decode.h" "CSF_Draco" "") OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
if (NOT DEFINED 3RDPARTY_DRACO_DIR)
set (3RDPARTY_DRACO_DIR "" CACHE PATH "The directory containing Draco")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_INCLUDE_DIR)
set (3RDPARTY_DRACO_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the Draco")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY)
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DEBUG)
set (3RDPARTY_DRACO_LIBRARY_DEBUG "" CACHE FILEPATH "Draco debug library")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR_DEBUG)
set (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "" CACHE PATH "The directory containing Draco debug library")
endif()
endif()
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
if (NOT 3RDPARTY_DRACO_DIR OR NOT EXISTS "${3RDPARTY_DRACO_DIR}")
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" draco DRACO_DIR_NAME)
if (DRACO_DIR_NAME)
set (3RDPARTY_DRACO_DIR "${3RDPARTY_DIR}/${DRACO_DIR_NAME}" CACHE PATH "The directory containing Draco" FORCE)
endif()
endif()
endif()
# header
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
set (HEADER_NAMES draco)
# set 3RDPARTY_DRACO_INCLUDE_DIR as notfound, otherwise find_path can't assign a new value to 3RDPARTY_DRACO_INCLUDE_DIR
set (3RDPARTY_DRACO_INCLUDE_DIR "3RDPARTY_DRACO_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "The directory containing headers of the Draco" FORCE)
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
find_path (3RDPARTY_DRACO_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATHS ${3RDPARTY_DRACO_DIR}
PATH_SUFFIXES "include"
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
endif()
endif()
if (3RDPARTY_DRACO_INCLUDE_DIR AND EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_DRACO_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DRACO_INCLUDE_DIR)
endif()
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
if (NOT 3RDPARTY_DRACO_LIBRARY OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
PATHS "${3RDPARTY_DRACO_DIR}"
PATH_SUFFIXES lib
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
if (3RDPARTY_DRACO_LIBRARY AND EXISTS "${3RDPARTY_DRACO_LIBRARY}")
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY}" PATH)
set (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY_DIR}" CACHE FILEPATH "The directory containing Draco library" FORCE)
endif()
endif()
if (WIN32 AND (NOT 3RDPARTY_DRACO_LIBRARY_DEBUG OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DEBUG}"))
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
set (3RDPARTY_DRACO_LIBRARY_DEBUG "3RDPARTY_DRACO_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "The path to debug Draco library" FORCE)
find_library (3RDPARTY_DRACO_LIBRARY_DEBUG NAMES ${CSF_Draco}
PATHS "${3RDPARTY_DRACO_DIR}"
PATH_SUFFIXES libd
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
if (3RDPARTY_DRACO_LIBRARY_DEBUG AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DEBUG}")
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "${3RDPARTY_DRACO_LIBRARY_DEBUG}" PATH)
set (3RDPARTY_DRACO_LIBRARY_DIR_DEBUG "${3RDPARTY_DRACO_LIBRARY_DIR_DEBUG}" CACHE FILEPATH "The directory containing debug Draco library" FORCE)
endif()
endif()
endif()

View File

@@ -26,9 +26,7 @@ if (3RDPARTY_DIR)
endforeach() endforeach()
endif() endif()
# flex 2.5.37 is required because closest known lower version, 2.5.3 from WOK 6.8.0, find_package (FLEX 2.6.4)
# generates code which is unusable on Windows (includes unistd.h without any way to avoid this)
find_package (FLEX 2.5.37)
if (NOT FLEX_FOUND OR NOT FLEX_INCLUDE_DIR OR NOT EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h") if (NOT FLEX_FOUND OR NOT FLEX_INCLUDE_DIR OR NOT EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
list (APPEND 3RDPARTY_NOT_INCLUDED FLEX_INCLUDE_DIR) list (APPEND 3RDPARTY_NOT_INCLUDED FLEX_INCLUDE_DIR)

View File

@@ -110,8 +110,19 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
set (ENV{FREETYPE_DIR} "${3RDPARTY_FREETYPE_DIR}") set (ENV{FREETYPE_DIR} "${3RDPARTY_FREETYPE_DIR}")
endif() endif()
unset (FREETYPE_LIBRARY_RELEASE)
find_package(Freetype) find_package(Freetype)
# Only for UNIX (not APPLE)
if ((NOT WIN32) AND (NOT APPLE))
# To avoid linker error on Ubuntu 18.04 and others linux distributives we should
# link with freetype library, compiled as Position Independent Code (PIC),
# for example, with shared object.
if ((DEFINED FREETYPE_LIBRARY_RELEASE) AND (NOT "${FREETYPE_LIBRARY_RELEASE}" STREQUAL "") AND (EXISTS "${FREETYPE_LIBRARY_RELEASE}"))
string (REPLACE "\.a" "\.so" FREETYPE_LIBRARY_RELEASE "${FREETYPE_LIBRARY_RELEASE}")
endif()
endif()
# restore ENV{FREETYPE_DIR} # restore ENV{FREETYPE_DIR}
if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}") if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
set (ENV{FREETYPE_DIR} ${CACHED_FREETYPE_DIR}) set (ENV{FREETYPE_DIR} ${CACHED_FREETYPE_DIR})
@@ -122,7 +133,7 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "The directory containing ft2build.h header") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "The directory containing ft2build.h header")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "The directory containing ftheader.h header") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "The directory containing ftheader.h header")
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library") CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY_RELEASE FILEPATH "freetype library")
endif() endif()
endif() endif()
@@ -141,8 +152,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED)
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}") if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}") if (FREETYPE_LIBRARY_RELEASE AND EXISTS "${FREETYPE_LIBRARY_RELEASE}")
set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE) set (3RDPARTY_FREETYPE_LIBRARY "${FREETYPE_LIBRARY_RELEASE}" CACHE FILEPATH "The path to freetype library" FORCE)
endif() endif()
endif() endif()
@@ -220,7 +231,7 @@ endif()
# freetype library # freetype library
#if (BUILD_SHARED_LIBS) #if (BUILD_SHARED_LIBS)
if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}") if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a) set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib)
set (FREETYPE_PATH_SUFFIXES lib) set (FREETYPE_PATH_SUFFIXES lib)
if (ANDROID) if (ANDROID)
@@ -242,6 +253,16 @@ endif()
CMAKE_FIND_ROOT_PATH_BOTH) CMAKE_FIND_ROOT_PATH_BOTH)
endif() endif()
# Only for UNIX (not APPLE)
if ((NOT WIN32) AND (NOT APPLE))
# To avoid linker error on Ubuntu 18.04 and some others linux distributives we should
# link with freetype library, compiled as Position Independent Code (PIC),
# for example, with shared object.
if ((DEFINED 3RDPARTY_FREETYPE_LIBRARY) AND (NOT "${3RDPARTY_FREETYPE_LIBRARY}" STREQUAL "") AND (EXISTS "${3RDPARTY_FREETYPE_LIBRARY}"))
string (REPLACE "\.a" "\.so" 3RDPARTY_FREETYPE_LIBRARY "${3RDPARTY_FREETYPE_LIBRARY}")
endif()
endif()
if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}") if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH) get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE) set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
@@ -350,7 +371,7 @@ endif()
# unset all redundant variables # unset all redundant variables
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build) OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2) OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY) OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY_RELEASE)
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL) mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)

143
adm/cmake/jemalloc.cmake Normal file
View File

@@ -0,0 +1,143 @@
# JeMalloc
if (NOT DEFINED INSTALL_JEMALLOC)
set (INSTALL_JEMALLOC OFF CACHE BOOL "${INSTALL_INSTALL_JEMALLOC_DESCR}")
endif()
# include occt macros. compiler_bitness, os_with_bit, compiler
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
# specify JEMALLOC folder in connection with 3RDPARTY_DIR
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
if (NOT 3RDPARTY_JEMALLOC_DIR OR NOT EXISTS "${3RDPARTY_JEMALLOC_DIR}")
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" jemalloc JEMALLOC_DIR_NAME)
if (JEMALLOC_DIR_NAME)
set (3RDPARTY_JEMALLOC_DIR "${3RDPARTY_DIR}/${JEMALLOC_DIR_NAME}" CACHE PATH "The directory containing JEMALLOC" FORCE)
set (3RDPARTY_JEMALLOC_DIR "${3RDPARTY_DIR}/${JEMALLOC_DIR_NAME}")
message(STATUS "Info: JEMALLOC detected in ${3RDPARTY_JEMALLOC_DIR}")
endif()
endif()
else()
endif()
# define required JEMALLOC variables
if (NOT DEFINED 3RDPARTY_JEMALLOC_INCLUDE_DIR)
set (3RDPARTY_JEMALLOC_INCLUDE_DIR "" CACHE PATH "the path of headers directory")
endif()
# check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR
if (3RDPARTY_JEMALLOC_DIR AND EXISTS "${3RDPARTY_JEMALLOC_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_JEMALLOC_DIR 3RDPARTY_JEMALLOC_INCLUDE_DIR PATH "the path to JEMALLOC")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_JEMALLOC_DIR 3RDPARTY_JEMALLOC_LIBRARY_DIR FILEPATH "The directory containing JEMALLOC libraries")
endif()
# header
if (NOT 3RDPARTY_JEMALLOC_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_JEMALLOC_INCLUDE_DIR}")
set (HEADER_NAMES jemalloc.h)
# set 3RDPARTY_JEMALLOC_INCLUDE_DIR as notfound, otherwise find_library can't assign a new value to 3RDPARTY_JEMALLOC_INCLUDE_DIR
set (3RDPARTY_JEMALLOC_INCLUDE_DIR "3RDPARTY_JEMALLOC_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "the path to header directory" FORCE)
if (3RDPARTY_JEMALLOC_DIR AND EXISTS "${3RDPARTY_JEMALLOC_DIR}")
find_path (3RDPARTY_JEMALLOC_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATHS ${3RDPARTY_JEMALLOC_DIR}
PATH_SUFFIXES include/jemalloc
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
endif()
endif()
if (3RDPARTY_JEMALLOC_INCLUDE_DIR AND EXISTS "${3RDPARTY_JEMALLOC_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_JEMALLOC_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_JEMALLOC_INCLUDE_DIR)
set (3RDPARTY_JEMALLOC_INCLUDE_DIR "" CACHE FILEPATH "the path to jemalloc.h" FORCE)
endif()
# Installing destination path
if (WIN32)
set (JEMALLOC_INSTALL_DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
else()
set (JEMALLOC_INSTALL_DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
endif()
macro (JEMALLOC_LIB_SEARCH MMGR_LIB PREFIX)
if (NOT 3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB})
set (JEMALLOC_PATH_SUFFIXES "lib" "bin")
set (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} "3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}-NOTFOUND")
if (3RDPARTY_JEMALLOC_DIR AND EXISTS "${3RDPARTY_JEMALLOC_DIR}")
find_library (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} NAMES ${MMGR_LIB}
PATHS "${3RDPARTY_JEMALLOC_LIBRARY_DIR}" "${3RDPARTY_JEMALLOC_DIR}"
PATH_SUFFIXES ${JEMALLOC_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} NAMES ${MMGR_LIB}
PATH_SUFFIXES ${JEMALLOC_PATH_SUFFIXES}
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
if (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB})
get_filename_component (3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB} "${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}}" PATH)
set (3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB} "${3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB}}")
else()
set (3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB} "")
endif()
endif()
if (3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB})
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB}}")
set (3RDPARTY_JEMALLOC_LIBRARY_DIR "${3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB}}" CACHE PATH "The directory containing JEMALLOC libraries" FORCE)
else()
message("Cannot find ${MMGR_LIB} library in jemalloc 3rdparty")
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB})
set (3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} "")
endif()
set (JEMALLOC_IS_STATIC_LIB FALSE)
if (((${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}} MATCHES "\.lib$")) OR ((${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}} MATCHES "\.a$")))
get_filename_component(STATIC_LIB_NAME ${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}} NAME)
list(APPEND CSF_MMGR "${STATIC_LIB_NAME}")
set (JEMALLOC_IS_STATIC_LIB TRUE)
endif()
# install instructions
if (INSTALL_JEMALLOC AND NOT JEMALLOC_IS_STATIC_LIB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
get_filename_component(3RDPARTY_JEMALLOC_LIBRARY ${3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB}} REALPATH)
if (SINGLE_GENERATOR)
install (FILES "${3RDPARTY_JEMALLOC_LIBRARY}"
DESTINATION "${INSTALL_DIR}/${INSTALL_DIR_LIB}")
else()
install (FILES "${3RDPARTY_JEMALLOC_LIBRARY}"
CONFIGURATIONS Debug
DESTINATION "${JEMALLOC_INSTALL_DESTINATION}d")
install (FILES "${3RDPARTY_JEMALLOC_LIBRARY}"
CONFIGURATIONS Release
DESTINATION "${JEMALLOC_INSTALL_DESTINATION}")
install (FILES "${3RDPARTY_JEMALLOC_LIBRARY}"
CONFIGURATIONS RelWithDebInfo
DESTINATION "${JEMALLOC_INSTALL_DESTINATION}i")
endif()
set (USED_3RDPARTY_JEMALLOC_DIR "")
elseif(NOT JEMALLOC_IS_STATIC_LIB)
# the library directory for using by the executable
set (USED_3RDPARTY_JEMALLOC_DIR ${3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB}})
endif()
unset(3RDPARTY_JEMALLOC_LIBRARY_DIR_${MMGR_LIB} CACHE)
unset(3RDPARTY_JEMALLOC_LIBRARY_${PREFIX}_${MMGR_LIB} CACHE)
endmacro()
# Reset CSF variable
set (CSF_MMGR "")
# find static jemalloc lib
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a")
if (WIN32)
JEMALLOC_LIB_SEARCH ("jemalloc" "STATIC")
elseif(NOT WIN32)
JEMALLOC_LIB_SEARCH ("jemalloc_pic" "STATIC")
SET(CMAKE_FIND_LIBRARY_SUFFIXES "" "so")
JEMALLOC_LIB_SEARCH ("jemalloc.so.2" "SHARED")
endif()
# find shared jemalloc lib
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".so")
JEMALLOC_LIB_SEARCH ("jemalloc" "SHARED")

View File

@@ -25,6 +25,9 @@ if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
endif() endif()
if (MSVC) if (MSVC)
# suppress C26812 on VS2019/C++20 (prefer 'enum class' over 'enum')
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise /wd\"26812\"")
# suppress warning on using portable non-secure functions in favor of non-portable secure ones
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else() else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
@@ -41,9 +44,25 @@ elseif (MSVC)
endif() endif()
if (MSVC) if (MSVC)
# string pooling (GF), function-level linking (Gy) if ("${BUILD_OPT_PROFILE}" STREQUAL "Production")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GF /Gy") # string pooling (GF), function-level linking (Gy)
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GF /Gy") set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GF /Gy")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GF /Gy")
# Favor fast code (Ot), Omit frame pointers (Oy)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ot /Oy")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Ot /Oy")
# Whole Program Optimisation (GL), Enable intrinsic functions (Oi)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL /Oi")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL /Oi")
# Link-Time Code Generation(LTCG) is requared for Whole Program Optimisation(GL)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
endif()
if (BUILD_FORCE_RelWithDebInfo) if (BUILD_FORCE_RelWithDebInfo)
# generate debug info (Zi), inline expansion level (Ob1) # generate debug info (Zi), inline expansion level (Ob1)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /Ob1") set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /Ob1")
@@ -113,8 +132,27 @@ if (MSVC)
else() else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif() endif()
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if ("${BUILD_OPT_PROFILE}" STREQUAL "Production")
# /Ot (favor speed over size) is similar to -O2 or -O3 in GCC/Clang.
# /Oy (omit frame pointers) is similar to -fomit-frame-pointer in GCC/Clang.
# /GL (whole program optimization) is similar to -flto (Link Time Optimization) in GCC/Clang.
# /GF (eliminate duplicate strings) doesn't have a direct equivalent in GCC/Clang, but the compilers do string pooling automatically.
# /Gy (enable function-level linking) is similar to -ffunction-sections in GCC/Clang.
# /fp:precise (improve floating-point consistency) is similar to -ffloat-store in GCC, but there isn't a perfect equivalent in Clang.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fomit-frame-pointer -flto -ffunction-sections -ffloat-store")
# Link-Time Code Generation(LTCG) is requared for Whole Program Optimisation(GL)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -flto")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -flto")
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshorten-64-to-32")
endif()
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
if (APPLE) if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}") set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
@@ -124,14 +162,10 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP
endif() endif()
endif() endif()
if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang") if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
if (APPLE) if (APPLE)
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated. # CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
elseif(NOT WIN32)
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
# does not support option "-std=c++0x"
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
endif() endif()
# Optimize size of binaries # Optimize size of binaries
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}") set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-s ${CMAKE_SHARED_LINKER_FLAGS}")
@@ -142,14 +176,10 @@ elseif(MINGW)
# workaround bugs in mingw with vtable export # workaround bugs in mingw with vtable export
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols") set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
# Require C++11
set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
# Optimize size of binaries # Optimize size of binaries
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s") set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s") set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX) elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
# Require C++11
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
# Optimize size of binaries # Optimize size of binaries
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s") set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s") set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")

View File

@@ -80,9 +80,9 @@ macro (OCCT_MAKE_COMPILER_SHORT_NAME)
set (COMPILER gcc) set (COMPILER gcc)
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX) elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
set (COMPILER gxx) set (COMPILER gxx)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
set (COMPILER clang) set (COMPILER clang)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") elseif (CMAKE_CXX_COMPILER_ID MATCHES "[Ii][Nn][Tt][Ee][Ll]")
set (COMPILER icc) set (COMPILER icc)
else() else()
set (COMPILER ${CMAKE_GENERATOR}) set (COMPILER ${CMAKE_GENERATOR})
@@ -160,6 +160,8 @@ function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
if ("${lower_PRODUCT_NAME}" STREQUAL "egl") if ("${lower_PRODUCT_NAME}" STREQUAL "egl")
string (SUBSTRING "${lower_PRODUCT_NAME}" 1 -1 lower_PRODUCT_NAME) string (SUBSTRING "${lower_PRODUCT_NAME}" 1 -1 lower_PRODUCT_NAME)
list (APPEND SEARCH_TEMPLATES "[^gl]+${lower_PRODUCT_NAME}.*") list (APPEND SEARCH_TEMPLATES "[^gl]+${lower_PRODUCT_NAME}.*")
elseif ("${lower_PRODUCT_NAME}" STREQUAL "tbb")
list (APPEND SEARCH_TEMPLATES "^.*${lower_PRODUCT_NAME}.*")
else() else()
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}") list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}") list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
@@ -589,9 +591,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
endif() endif()
install (CODE install (CODE
"cmake_policy(PUSH) "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
cmake_policy(SET CMP0007 NEW)
string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWERCASE)
file (GLOB ALL_OCCT_TARGET_FILES \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\") file (GLOB ALL_OCCT_TARGET_FILES \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADE*Targets-\${CMAKE_INSTALL_CONFIG_NAME_LOWERCASE}.cmake\")
foreach(TARGET_FILENAME \${ALL_OCCT_TARGET_FILES}) foreach(TARGET_FILENAME \${ALL_OCCT_TARGET_FILES})
file (STRINGS \"\${TARGET_FILENAME}\" TARGET_FILE_CONTENT) file (STRINGS \"\${TARGET_FILENAME}\" TARGET_FILE_CONTENT)
@@ -600,8 +600,7 @@ macro (OCCT_UPDATE_TARGET_FILE)
string (REGEX REPLACE \"[\\\\]?[\\\$]{OCCT_INSTALL_BIN_LETTER}\" \"\${OCCT_INSTALL_BIN_LETTER}\" line \"\${line}\") string (REGEX REPLACE \"[\\\\]?[\\\$]{OCCT_INSTALL_BIN_LETTER}\" \"\${OCCT_INSTALL_BIN_LETTER}\" line \"\${line}\")
file (APPEND \"\${TARGET_FILENAME}\" \"\${line}\\n\") file (APPEND \"\${TARGET_FILENAME}\" \"\${line}\\n\")
endforeach() endforeach()
endforeach() endforeach()")
cmake_policy(POP)")
endmacro() endmacro()
macro (OCCT_INSERT_CODE_FOR_TARGET) macro (OCCT_INSERT_CODE_FOR_TARGET)
@@ -615,17 +614,14 @@ macro (OCCT_INSERT_CODE_FOR_TARGET)
endmacro() endmacro()
macro (OCCT_UPDATE_DRAW_DEFAULT_FILE) macro (OCCT_UPDATE_DRAW_DEFAULT_FILE)
install(CODE "cmake_policy(PUSH) install(CODE "set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
cmake_policy(SET CMP0007 NEW)
set (DRAW_DEFAULT_FILE_NAME \"${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}/DrawResources/DrawPlugin\")
file (STRINGS \"\${DRAW_DEFAULT_FILE_NAME}\" DRAW_DEFAULT_CONTENT) file (STRINGS \"\${DRAW_DEFAULT_FILE_NAME}\" DRAW_DEFAULT_CONTENT)
file (REMOVE \"\${DRAW_DEFAULT_FILE_NAME}\") file (REMOVE \"\${DRAW_DEFAULT_FILE_NAME}\")
foreach (line IN LISTS DRAW_DEFAULT_CONTENT) foreach (line IN LISTS DRAW_DEFAULT_CONTENT)
string (REGEX MATCH \": TK\([a-zA-Z]+\)$\" IS_TK_LINE \"\${line}\") string (REGEX MATCH \": TK\([a-zA-Z]+\)$\" IS_TK_LINE \"\${line}\")
string (REGEX REPLACE \": TK\([a-zA-Z]+\)$\" \": TK\${CMAKE_MATCH_1}${BUILD_SHARED_LIBRARY_NAME_POSTFIX}\" line \"\${line}\") string (REGEX REPLACE \": TK\([a-zA-Z]+\)$\" \": TK\${CMAKE_MATCH_1}${BUILD_SHARED_LIBRARY_NAME_POSTFIX}\" line \"\${line}\")
file (APPEND \"\${DRAW_DEFAULT_FILE_NAME}\" \"\${line}\\n\") file (APPEND \"\${DRAW_DEFAULT_FILE_NAME}\" \"\${line}\\n\")
endforeach() endforeach()")
cmake_policy(POP)")
endmacro() endmacro()
macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME) macro (OCCT_CREATE_SYMLINK_TO_FILE LIBRARY_NAME LINK_NAME)

View File

@@ -70,6 +70,16 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
OCCT_ORIGIN_AND_PATCHED_FILES ("${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}" "*[.]lex" SOURCE_FILES_FLEX) OCCT_ORIGIN_AND_PATCHED_FILES ("${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}" "*[.]lex" SOURCE_FILES_FLEX)
list (LENGTH SOURCE_FILES_FLEX SOURCE_FILES_FLEX_LEN) list (LENGTH SOURCE_FILES_FLEX SOURCE_FILES_FLEX_LEN)
# remove old general version of FlexLexer
if (EXISTS ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/FlexLexer/FlexLexer.h)
message (STATUS "Info: remove old FLEX header file: ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/FlexLexer/FlexLexer.h")
file(REMOVE ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/FlexLexer/FlexLexer.h)
endif()
# install copy of FlexLexer.h locally to allow further building without flex
if (FLEX_INCLUDE_DIR AND EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
configure_file("${FLEX_INCLUDE_DIR}/FlexLexer.h" "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/FlexLexer/FlexLexer.h" @ONLY NEWLINE_STYLE LF)
endif()
# bison files # bison files
OCCT_ORIGIN_AND_PATCHED_FILES ("${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}" "*[.]yacc" SOURCE_FILES_BISON) OCCT_ORIGIN_AND_PATCHED_FILES ("${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}" "*[.]yacc" SOURCE_FILES_BISON)
list (LENGTH SOURCE_FILES_BISON SOURCE_FILES_BISON_LEN) list (LENGTH SOURCE_FILES_BISON SOURCE_FILES_BISON_LEN)
@@ -106,21 +116,30 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
set (BISON_OUTPUT_FILE_EXT "cxx") set (BISON_OUTPUT_FILE_EXT "cxx")
endif() endif()
endforeach() endforeach()
file (STRINGS "${CURRENT_FLEX_FILE}" FILE_FLEX_CONTENT) file (STRINGS "${CURRENT_FLEX_FILE}" FILE_FLEX_CONTENT)
foreach (FILE_FLEX_CONTENT_LINE ${FILE_FLEX_CONTENT}) foreach (FILE_FLEX_CONTENT_LINE ${FILE_FLEX_CONTENT})
string (REGEX MATCH "%option c\\+\\+" CXX_FLEX_LANGUAGE_FOUND ${FILE_FLEX_CONTENT_LINE}) string (REGEX MATCH "%option c\\+\\+" CXX_FLEX_LANGUAGE_FOUND ${FILE_FLEX_CONTENT_LINE})
if (CXX_FLEX_LANGUAGE_FOUND) if (CXX_FLEX_LANGUAGE_FOUND)
set (FLEX_OUTPUT_FILE_EXT "cxx") set (FLEX_OUTPUT_FILE_EXT "cxx")
# install copy of FlexLexer.h locally to allow further building without flex
if (FLEX_INCLUDE_DIR AND EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
configure_file("${FLEX_INCLUDE_DIR}/FlexLexer.h" "${FLEX_BISON_TARGET_DIR}/FlexLexer.h" @ONLY NEWLINE_STYLE LF)
endif()
endif() endif()
endforeach() endforeach()
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT}) set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.${FLEX_OUTPUT_FILE_EXT}) set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.${FLEX_OUTPUT_FILE_EXT})
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT}")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
endif()
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
endif()
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
message (STATUS "Info: remove old output FLEX file: ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
endif()
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} "${FLEX_BISON_TARGET_DIR}/${BISON_OUTPUT_FILE}" BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} "${FLEX_BISON_TARGET_DIR}/${BISON_OUTPUT_FILE}"
COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/=") COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/=")
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} "${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}" FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} "${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}"
@@ -226,6 +245,18 @@ endif (USE_QT)
if (EXECUTABLE_PROJECT) if (EXECUTABLE_PROJECT)
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES}) add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
else()
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
# So, we just exclude PROJECT_NAME from cotire list.
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
# endif()
endif()
install (TARGETS ${PROJECT_NAME} install (TARGETS ${PROJECT_NAME}
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}") DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
@@ -235,15 +266,33 @@ if (EXECUTABLE_PROJECT)
else() else()
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES}) add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES})
if (DEFINED ${PROJECT_NAME}_DISABLE_COTIRE AND ${PROJECT_NAME}_DISABLE_COTIRE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
else()
# To avoid excluding of PROJECT_NAME from cotire tool, we may use cotire
# COTIRE_PREFIX_HEADER_IGNORE_PATH instead. But, practically it causes many 'undefined symbols' error.
# So, we just exclude PROJECT_NAME from cotire list.
# if (DEFINED ${PROJECT_NAME}_COTIRE_IGNORE_PATH)
# set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_PREFIX_HEADER_IGNORE_PATH "${${PROJECT_NAME}_COTIRE_IGNORE_PATH}")
# endif()
endif()
if (MSVC) if (MSVC)
if (BUILD_FORCE_RelWithDebInfo) if (BUILD_FORCE_RelWithDebInfo)
set (aReleasePdbConf "Release") set (aReleasePdbConf "Release")
else() else()
set (aReleasePdbConf) set (aReleasePdbConf)
endif() endif()
install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb if (BUILD_SHARED_LIBS)
install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb
CONFIGURATIONS Debug ${aReleasePdbConf} RelWithDebInfo CONFIGURATIONS Debug ${aReleasePdbConf} RelWithDebInfo
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}") DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
else()
install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb
CONFIGURATIONS Debug ${aReleasePdbConf} RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
endif()
endif() endif()
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "") if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
@@ -255,7 +304,8 @@ else()
EXPORT OpenCASCADE${CURRENT_MODULE}Targets EXPORT OpenCASCADE${CURRENT_MODULE}Targets
RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}" RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}" ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}") LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
INCLUDES DESTINATION ${INSTALL_DIR_INCLUDE})
if (NOT WIN32) if (NOT WIN32)
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "") if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
@@ -280,14 +330,17 @@ get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR) get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE) get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
if (ANDROID) set (OCC_SOVERSION "")
# do not append version to the filename if (BUILD_SOVERSION_NUMBERS GREATER 2)
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}") set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
else() elseif (BUILD_SOVERSION_NUMBERS GREATER 1)
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}" set (OCC_SOVERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}")
SOVERSION "${OCC_VERSION_MAJOR}" elseif (BUILD_SOVERSION_NUMBERS GREATER 0)
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}") set (OCC_SOVERSION "${OCC_VERSION_MAJOR}")
endif() endif()
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
SOVERSION "${OCC_SOVERSION}"
VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
set (USED_TOOLKITS_BY_CURRENT_PROJECT) set (USED_TOOLKITS_BY_CURRENT_PROJECT)
set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT) set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
@@ -316,13 +369,17 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
else() # get CSF_ value else() # get CSF_ value
set (CURRENT_CSF ${${USED_ITEM}}) set (CURRENT_CSF ${${USED_ITEM}})
if (NOT "x${CURRENT_CSF}" STREQUAL "x") if (NOT "x${CURRENT_CSF}" STREQUAL "x")
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs") if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlLibs}")
add_definitions (-DHAVE_OPENGL) add_definitions (-DHAVE_OPENGL)
endif() endif()
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlesLibs") if ("${CURRENT_CSF}" STREQUAL "${CSF_OpenGlesLibs}")
add_definitions (-DHAVE_GLES2) add_definitions (-DHAVE_GLES2)
endif() endif()
if ("${CURRENT_CSF}" STREQUAL "${CSF_Draco}")
set (CURRENT_CSF "")
set (USED_DRACO 1)
endif()
set (LIBRARY_FROM_CACHE 0) set (LIBRARY_FROM_CACHE 0)
separate_arguments (CURRENT_CSF) separate_arguments (CURRENT_CSF)
foreach (CSF_LIBRARY ${CURRENT_CSF}) foreach (CSF_LIBRARY ${CURRENT_CSF})
@@ -350,7 +407,7 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
endforeach() endforeach()
endforeach() endforeach()
if (NOT ${LIBRARY_FROM_CACHE}) if (NOT ${LIBRARY_FROM_CACHE} AND NOT "${CURRENT_CSF}" STREQUAL "")
# prepare a list from a string with whitespaces # prepare a list from a string with whitespaces
separate_arguments (CURRENT_CSF) separate_arguments (CURRENT_CSF)
list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF}) list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
@@ -361,6 +418,28 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
endif() endif()
endforeach() endforeach()
if (USE_DRACO)
if (USED_DRACO)
set (USED_LIB_RELEASE ${3RDPARTY_DRACO_LIBRARY})
if (WIN32)
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY_DEBUG})
else()
set (USED_LIB_DEBUG ${3RDPARTY_DRACO_LIBRARY})
endif()
set (USED_LIB_CONF)
if (EXISTS ${USED_LIB_DEBUG})
set (USED_LIB_CONF "$<$<CONFIG:DEBUG>:${USED_LIB_DEBUG}>;${USED_LIB_CONF}")
endif()
if (EXISTS ${USED_LIB_RELEASE})
set (USED_LIB_CONF "$<$<CONFIG:RELEASE>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
set (USED_LIB_CONF "$<$<CONFIG:RELWITHDEBINFO>:${USED_LIB_RELEASE}>;${USED_LIB_CONF}")
endif()
if (DEFINED USED_LIB_CONF)
set_property (TARGET ${PROJECT_NAME} APPEND PROPERTY LINK_LIBRARIES "${USED_LIB_CONF}")
endif()
endif()
endif()
if (APPLE) if (APPLE)
list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND) list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
if (NOT ${IS_X11_FOUND} EQUAL -1) if (NOT ${IS_X11_FOUND} EQUAL -1)

View File

@@ -1,294 +1,240 @@
# tbb # tbb
if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
endif()
# tbb directory
if (NOT DEFINED 3RDPARTY_TBB_DIR)
set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
endif()
if (MSVC AND BUILD_SHARED_LIBS) if (MSVC AND BUILD_SHARED_LIBS)
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE) add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE) add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
endif() endif()
# include occt macros. compiler_bitness, os_wiht_bit, compiler if (NOT DEFINED INSTALL_TBB AND BUILD_SHARED_LIBS)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros") set (INSTALL_TBB OFF CACHE BOOL "${INSTALL_TBB_DESCR}")
endif()
# specify TBB folder in connectin with 3RDPARTY_DIR # Initialize tbb directory.
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}") if (NOT DEFINED 3RDPARTY_TBB_DIR)
#CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_DIR 3RDPARTY_TBB_DIR PATH "The directory containing tbb") set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing tbb")
endif()
if (NOT 3RDPARTY_TBB_DIR OR NOT EXISTS "${3RDPARTY_TBB_DIR}") if (WIN32)
if (NOT DEFINED 3RDPARTY_DIR)
message (FATAL_ERROR "3RDPARTY_DIR is not defined.")
endif()
if ("${3RDPARTY_DIR}" STREQUAL "")
message (FATAL_ERROR "3RDPARTY_DIR is empty string.")
endif()
if (NOT EXISTS "${3RDPARTY_DIR}")
message (FATAL_ERROR "3RDPARTY_DIR is not exist.")
endif()
# Below, we have correct 3RDPARTY_DIR.
# Initialize TBB folder in connectin with 3RDPARTY_DIR.
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME) FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
if (TBB_DIR_NAME) if (TBB_DIR_NAME)
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE) set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
endif() endif()
endif() endif()
else()
#set (3RDPARTY_TBB_DIR "" CACHE PATH "The directory containing TBB" FORCE)
endif()
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR) # Here we have full path name to installation directory of TBB.
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB") # Employ it.
endif() if (EXISTS "${3RDPARTY_TBB_DIR}")
find_package (
TBB 2021.5
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
REQUIRED
CONFIG)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}") # Achive include directory
# check 3RDPARTY_TBB_INCLUDE_DIR for consictency with specified 3RDPARTY_TBB_DIR get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_TBB_INCLUDE_DIR PATH "The directory containing headers of the TBB") if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
endif() set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
# tbb.h
if (NOT 3RDPARTY_TBB_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
set (HEADER_NAMES tbb.h tbb/tbb.h)
# set 3RDPARTY_TBB_INCLUDE_DIR as notfound, otherwise find_library can't assign a new value to 3RDPARTY_TBB_INCLUDE_DIR
set (3RDPARTY_TBB_INCLUDE_DIR "3RDPARTY_TBB_INCLUDE_DIR-NOTFOUND" CACHE PATH "the path to tbb.h" FORCE)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATHS ${3RDPARTY_TBB_DIR}
PATH_SUFFIXES include
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
else()
find_path (3RDPARTY_TBB_INCLUDE_DIR NAMES ${HEADER_NAMES}
PATH_SUFFIXES include
CMAKE_FIND_ROOT_PATH_BOTH)
endif()
endif()
if (3RDPARTY_TBB_INCLUDE_DIR AND EXISTS "${3RDPARTY_TBB_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "the path to tbb.h" FORCE)
endif()
# common steps for tbb and tbbmalloc
macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
# define required tbb/tbbmalloc variables
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
endif()
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library")
endif()
if (WIN32)
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}")
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
endif() endif()
endif() if (EXISTS "${TBB_INCLUDE_DIR}")
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
if (WIN32 AND NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR) list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
endif()
# check 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_ paths for consistency with specified 3RDPARTY_TBB_DIR
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} library")
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
else() else()
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library") list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
endif() endif()
if (WIN32) separate_arguments (CSF_TBB)
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL FILEPATH "the path to ${upper_PRODUCT_LIBRARY_NAME} shared library") foreach (LIB IN LISTS CSF_TBB)
string(TOLOWER "${LIB}" LIB_LOWER)
string(TOUPPER "${LIB}" LIB_UPPER)
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}") # Achive *.lib files and directory containing it.
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH) get_target_property (TBB_LIB_FILE "TBB::${LIB_LOWER}" IMPORTED_IMPLIB_RELEASE)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE) # Reserve cache variable for *.lib.
else() if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.lib)")
CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_TBB_DIR 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library")
endif() endif()
endif() # Reserve cache variable for directory containing *.lib file.
endif() if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.lib)")
OCCT_MAKE_COMPILER_SHORT_NAME() endif()
OCCT_MAKE_COMPILER_BITNESS() if (EXISTS "${TBB_LIB_FILE}")
set (3RDPARTY_${LIB_UPPER}_LIBRARY
if (${COMPILER_BITNESS} EQUAL 32) "${TBB_LIB_FILE}"
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME ia32) CACHE FILEPATH
else() "${LIB_UPPER} library (*.lib)"
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME intel64) FORCE)
endif() get_filename_component (TBB_LIB_FILE_DIRECTORY "${TBB_LIB_FILE}" DIRECTORY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
# tbb/tbbmalloc library "${TBB_LIB_FILE_DIRECTORY}"
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}") CACHE PATH
"The directory containing ${LIB_UPPER} library (*.lib)"
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a) FORCE)
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME}) list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
if (EXISTS "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
if (THE_MOST_FRESH_COMPILER_VERSION)
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
endif()
endif()
endif()
else() else()
set (PRODUCT_PATH_SUFFIXES lib ${PRODUCT_LIBRARY_NAME} lib/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}) list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
endif() endif()
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME} # Achive *.dll files and directory containing it.
PATHS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" "${3RDPARTY_TBB_DIR}" get_target_property (TBB_DLL_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES} # Reserve cache variable for *.dll.
CMAKE_FIND_ROOT_PATH_BOTH if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL)
NO_DEFAULT_PATH) set (3RDPARTY_${LIB_UPPER}_DLL "" CACHE FILEPATH "${LIB_UPPER} library (*.dll)")
else() endif()
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY ${PRODUCT_LIBRARY_NAME} # Reserve cache variable for directory containing *.dll file.
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES} if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_DLL_DIR)
CMAKE_FIND_ROOT_PATH_BOTH) set (3RDPARTY_${LIB_UPPER}_DLL_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.dll)")
endif() endif()
if (EXISTS "${TBB_DLL_FILE}")
set (3RDPARTY_${LIB_UPPER}_DLL
"${TBB_DLL_FILE}"
CACHE FILEPATH
"${LIB_UPPER} library (*.dll)"
FORCE)
get_filename_component (TBB_DLL_FILE_DIRECTORY "${TBB_DLL_FILE}" DIRECTORY)
set (3RDPARTY_${LIB_UPPER}_DLL_DIR
"${TBB_DLL_FILE_DIRECTORY}"
CACHE PATH
"The directory containing ${LIB_UPPER} library (*.dll)"
FORCE)
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${LIB_UPPER}_DLL_DIR}")
else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${LIB_UPPER}_DLL_DIR)
endif()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}") # install *.dll (tbb & tbbmalloc)
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}" PATH) if (INSTALL_TBB)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE) OCCT_MAKE_OS_WITH_BITNESS()
else() OCCT_MAKE_COMPILER_SHORT_NAME()
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
endif()
endif()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}") if (SINGLE_GENERATOR)
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}") install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
endif()
# tbb/tbbmalloc shared library
if (WIN32)
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
set (PRODUCT_PATH_SUFFIXES bin)
# set 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL-NOTFOUND" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
if (NOT EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}")
if (EXISTS "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}")
file (GLOB ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST "${3RDPARTY_TBB_DIR}/bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/*")
if (${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST)
list (GET ${upper_PRODUCT_LIBRARY_NAME}_COMPILER_LIST -1 THE_MOST_FRESH_COMPILER_VERSION)
if (THE_MOST_FRESH_COMPILER_VERSION)
get_filename_component (THE_MOST_FRESH_COMPILER_VERSION_NAME "${THE_MOST_FRESH_COMPILER_VERSION}" NAME)
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${THE_MOST_FRESH_COMPILER_VERSION_NAME})
endif()
endif()
endif()
else() else()
set (PRODUCT_PATH_SUFFIXES bin bin/${${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME}/${COMPILER}) install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_BIN}")
endif() install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${3RDPARTY_${LIB_UPPER}_DLL} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_BIN}d")
if (3RDPARTY_TBB_DIR AND EXISTS "${3RDPARTY_TBB_DIR}")
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME}
PATHS "${3RDPARTY_TBB_DIR}"
PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES}
NO_DEFAULT_PATH)
else()
find_library (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL ${PRODUCT_LIBRARY_NAME} PATH_SUFFIXES ${PRODUCT_PATH_SUFFIXES})
endif()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL AND EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
get_filename_component (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}" PATH)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
else()
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR "" CACHE PATH "The directory containing ${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} shared library" FORCE)
endif() endif()
endif() endif()
endif() mark_as_advanced (3RDPARTY_${LIB_UPPER}_LIBRARY 3RDPARTY_${LIB_UPPER}_DLL)
endforeach()
if (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR OR EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}") if (INSTALL_TBB)
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR}") set (USED_3RDPARTY_TBB_DIR "")
else() else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL_DIR) # the *.dll/*.so* directory for using by the executable
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
endif() endif()
else()
message (FATAL_ERROR "Installation directory with TBB is not exist.")
endif()
else ()
# NOT WIN32 branch
if ((DEFINED 3RDPARTY_DIR) AND (NOT "${3RDPARTY_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_DIR}"))
# Here, we have correct 3RDPARTY_DIR.
# Trying to specify TBB folder in connection with 3RDPARTY_DIR
if (("${3RDPARTY_TBB_DIR}" STREQUAL "") OR (NOT EXISTS "${3RDPARTY_TBB_DIR}"))
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" TBB TBB_DIR_NAME)
if (TBB_DIR_NAME)
set (3RDPARTY_TBB_DIR "${3RDPARTY_DIR}/${TBB_DIR_NAME}" CACHE PATH "The directory containing tbb" FORCE)
endif()
endif()
if ((NOT "${3RDPARTY_TBB_DIR}" STREQUAL "") AND (EXISTS "${3RDPARTY_TBB_DIR}"))
# Find TBB 2021.5 in existing directory.
find_package (
TBB 2021.5
PATHS "${3RDPARTY_TBB_DIR}" NO_DEFAULT_PATH
REQUIRED
CONFIG)
else()
# Find TBB 2021.5 in system directory.
find_package (
TBB 2021.5
REQUIRED
CONFIG)
endif()
else()
# Find TBB 2021.5 in system directory.
find_package (
TBB 2021.5
REQUIRED
CONFIG)
endif()
# TBB has been configured (in other case FATAL_ERROR occures).
# Achive include directory.
get_target_property (TBB_INCLUDE_DIR TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
if (NOT DEFINED 3RDPARTY_TBB_INCLUDE_DIR)
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the TBB")
endif()
if (EXISTS "${TBB_INCLUDE_DIR}")
set (3RDPARTY_TBB_INCLUDE_DIR "${TBB_INCLUDE_DIR}" CACHE PATH "The directory containing headers of the TBB" FORCE)
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_TBB_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_TBB_INCLUDE_DIR)
endif() endif()
# install tbb/tbbmalloc
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (WIN32)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL} DESTINATION "${INSTALL_DIR_BIN}")
else()
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_BIN}")
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_BIN}i")
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_BIN}d")
endif()
else()
get_filename_component (PRODUCT_LIBRARY_NAME ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY} NAME)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
DESTINATION "${INSTALL_DIR_LIB}"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
else()
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
install (FILES ${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}.2
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d"
RENAME ${PRODUCT_LIBRARY_NAME}.2)
endif()
endif()
endif()
mark_as_advanced (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL)
endmacro()
#if (BUILD_SHARED_LIBS)
separate_arguments (CSF_TBB) separate_arguments (CSF_TBB)
foreach (LIB IN LISTS CSF_TBB) foreach (LIB IN LISTS CSF_TBB)
TBB_PRODUCT_SEARCH (${LIB}) string(TOLOWER "${LIB}" LIB_LOWER)
endforeach() string(TOUPPER "${LIB}" LIB_UPPER)
# Achive *.so files and directory containing it.
get_target_property (TBB_SO_FILE "TBB::${LIB_LOWER}" IMPORTED_LOCATION_RELEASE)
# Reserve cache variable for *.so.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY "" CACHE FILEPATH "${LIB_UPPER} library (*.so)")
endif()
# Reserve cache variable for directory containing *.so file.
if (NOT DEFINED 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR "" CACHE PATH "The directory containing ${LIB_UPPER} library (*.so)")
endif()
if (EXISTS "${TBB_SO_FILE}")
set (3RDPARTY_${LIB_UPPER}_LIBRARY
"${TBB_SO_FILE}"
CACHE FILEPATH
"${LIB_UPPER} library (*.so)"
FORCE)
get_filename_component (TBB_SO_FILE_DIRECTORY "${TBB_SO_FILE}" DIRECTORY)
set (3RDPARTY_${LIB_UPPER}_LIBRARY_DIR
"${TBB_SO_FILE_DIRECTORY}"
CACHE PATH
"The directory containing ${LIB_UPPER} library (*.so)"
FORCE)
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${LIB_UPPER}_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${LIB_UPPER}_LIBRARY_DIR)
endif()
# install *.so* (tbb & tbbmalloc)
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} DESTINATION "${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Release DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS RelWithDebInfo DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_${LIB_UPPER}_LIBRARY} CONFIGURATIONS Debug DESTINATION "${INSTALL_DIR_LIB}d")
endif()
endif()
endforeach()
if (INSTALL_TBB) if (INSTALL_TBB)
set (USED_3RDPARTY_TBB_DIR "") set (USED_3RDPARTY_TBB_DIR "")
else() else()
# the library directory for using by the executable # the *.so* directory for using by the executable
if (WIN32) set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
else()
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
endif()
endif() endif()
#endif() endif()

View File

@@ -28,6 +28,9 @@ Applies only for Debug configuration.")
set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR set (BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR
"Append the postfix to names of output libraries") "Append the postfix to names of output libraries")
set (BUILD_SOVERSION_NUMBERS_DESCR
"Version numbers to put into SONAME: 0 - for empty, 1 - for major, 2 - for major.minor, 3 - for major.minor.maintenance")
set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR set (BUILD_RELEASE_DISABLE_EXCEPTIONS_DESCR
"Disables exceptions like Standard_OutOfRange in Release builds. "Disables exceptions like Standard_OutOfRange in Release builds.
Defines No_Exception macros for Release builds when enabled (default). Defines No_Exception macros for Release builds when enabled (default).
@@ -113,6 +116,7 @@ endmacro()
BUILD_MODULE_MESSAGE (BUILD_MODULE_ApplicationFramework "ApplicationFramework") BUILD_MODULE_MESSAGE (BUILD_MODULE_ApplicationFramework "ApplicationFramework")
BUILD_MODULE_MESSAGE (BUILD_MODULE_DataExchange "DataExchange") BUILD_MODULE_MESSAGE (BUILD_MODULE_DataExchange "DataExchange")
BUILD_MODULE_MESSAGE (BUILD_MODULE_DETools "DETools")
BUILD_MODULE_MESSAGE (BUILD_MODULE_Draw "Draw") BUILD_MODULE_MESSAGE (BUILD_MODULE_Draw "Draw")
BUILD_MODULE_MESSAGE (BUILD_MODULE_FoundationClasses "FoundationClasses") BUILD_MODULE_MESSAGE (BUILD_MODULE_FoundationClasses "FoundationClasses")
BUILD_MODULE_MESSAGE (BUILD_MODULE_ModelingAlgorithms "ModelingAlgorithms") BUILD_MODULE_MESSAGE (BUILD_MODULE_ModelingAlgorithms "ModelingAlgorithms")

View File

@@ -56,36 +56,52 @@ lappend ::SYS_PRJNAME_LIST "Qt Creator (.pro)"
set aPrjIndex [lsearch $::SYS_PRJFMT_LIST $::PRJFMT] set aPrjIndex [lsearch $::SYS_PRJFMT_LIST $::PRJFMT]
set ::PRJNAME [lindex $::SYS_PRJNAME_LIST $aPrjIndex] set ::PRJNAME [lindex $::SYS_PRJNAME_LIST $aPrjIndex]
set ::CONFIG "Release"
set SYS_VS_LIST {} set SYS_VS_LIST {}
set SYS_VC_LIST {} set SYS_VC_LIST {}
set SYS_VCVARS_LIST {} set SYS_VCVARS_LIST {}
# detect installed Visual Studio 2017+ instances by running vswhere.exe # detect installed Visual Studio 2017+ instances by running vswhere.exe
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } { if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141)" lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141)"
lappend ::SYS_VC_LIST "vc141" lappend ::SYS_VC_LIST "vc141"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
} }
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } { if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141) UWP" lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141) UWP"
lappend ::SYS_VC_LIST "vc141-uwp" lappend ::SYS_VC_LIST "vc141-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
} }
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } { if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142)" lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142)"
lappend ::SYS_VC_LIST "vc142" lappend ::SYS_VC_LIST "vc142"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
} }
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } { if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142) UWP" lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142) UWP"
lappend ::SYS_VC_LIST "vc142-uwp" lappend ::SYS_VC_LIST "vc142-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
} }
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] } { if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)" lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)"
lappend ::SYS_VC_LIST "vclang" lappend ::SYS_VC_LIST "vclang"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat" lappend ::SYS_VCVARS_LIST "$res\\VC\Auxiliary\\Build\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[17.0,17.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2022 (17, toolset v143)"
lappend ::SYS_VC_LIST "vc143"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[17.0,17.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2022 (17, toolset v143) UWP"
lappend ::SYS_VC_LIST "vc143-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[17.0,17.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] && "$res" != "" } {
lappend ::SYS_VS_LIST "Visual Studio 2022 (17, toolset ClangCL)"
lappend ::SYS_VC_LIST "vclang"
lappend ::SYS_VCVARS_LIST "$res\\VC\\Auxiliary\\Build\\vcvarsall.bat"
} }
# detect installed Visual Studio instances from global environment # detect installed Visual Studio instances from global environment
@@ -138,6 +154,13 @@ proc wokdep:gui:Close {} {
exit exit
} }
proc wokdep:gui:configSuffix {} {
if { "$::CONFIG" == "Debug" } {
return "D"
}
return ""
}
proc wokdep:gui:SwitchConfig {} { proc wokdep:gui:SwitchConfig {} {
set ::PRJFMT [lindex $::SYS_PRJFMT_LIST [.myFrame.myPrjFrame.myPrjCombo current]] set ::PRJFMT [lindex $::SYS_PRJFMT_LIST [.myFrame.myPrjFrame.myPrjCombo current]]
set ::VCVER [lindex $::SYS_VC_LIST [.myFrame.myVsFrame.myVsCombo current]] set ::VCVER [lindex $::SYS_VC_LIST [.myFrame.myVsFrame.myVsCombo current]]
@@ -148,16 +171,15 @@ proc wokdep:gui:SwitchConfig {} {
set ::CSF_OPT_LIB64 {} set ::CSF_OPT_LIB64 {}
set ::CSF_OPT_BIN32 {} set ::CSF_OPT_BIN32 {}
set ::CSF_OPT_BIN64 {} set ::CSF_OPT_BIN64 {}
set ::CSF_OPT_LIB32D {}
set ::CSF_OPT_LIB64D {}
set ::CSF_OPT_BIN32D {}
set ::CSF_OPT_BIN64D {}
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:SwitchArch {} { proc wokdep:gui:SwitchArch {} {
if { "$::ARCH" == "32" } { wokdep:gui:Show3264Bitness ::aRowIter
wokdep:gui:Show32Bitness ::aRowIter
}
if { "$::ARCH" == "64" } {
wokdep:gui:Show64Bitness ::aRowIter
}
if { [llength [grid info .myFrame.mySave]] != 0 } { if { [llength [grid info .myFrame.mySave]] != 0 } {
grid forget .myFrame.mySave .myFrame.myClose grid forget .myFrame.mySave .myFrame.myClose
@@ -168,6 +190,16 @@ proc wokdep:gui:SwitchArch {} {
grid .myFrame.myClose -row $::aRowIter -column 6 -columnspan 2 grid .myFrame.myClose -row $::aRowIter -column 6 -columnspan 2
} }
# update label text and visibility
font create wokdep:gui:EmptyFont -size -1
proc wokdep:gui:SetLabelText {theLabel theText} {
set aFont TkDefaultFont
if { $theText == "" } {
set aFont wokdep:gui:EmptyFont
}
$theLabel configure -text $theText -font $aFont
}
proc wokdep:gui:UpdateList {} { proc wokdep:gui:UpdateList {} {
set anIncErrs {} set anIncErrs {}
set anLib32Errs {} set anLib32Errs {}
@@ -244,11 +276,28 @@ proc wokdep:gui:UpdateList {} {
wokdep:SearchJDK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs wokdep:SearchJDK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
} }
.myFrame.myIncErrLbl configure -text [join $anIncErrs "\n"] wokdep:gui:SetLabelText .myFrame.myIncErrLbl [join $anIncErrs "\n"]
.myFrame.myLib32ErrLbl configure -text [join $anLib32Errs "\n"]
.myFrame.myLib64ErrLbl configure -text [join $anLib64Errs "\n"] wokdep:gui:SetLabelText .myFrame.myIncErrLbl [join $anIncErrs "\n"]
.myFrame.myBin32ErrLbl configure -text [join $anBin32Errs "\n"] wokdep:gui:SetLabelText .myFrame.myLib32_ErrLbl [join $anLib32Errs "\n"]
.myFrame.myBin64ErrLbl configure -text [join $anBin64Errs "\n"] wokdep:gui:SetLabelText .myFrame.myLib64_ErrLbl [join $anLib64Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myBin32_ErrLbl [join $anBin32Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myBin64_ErrLbl [join $anBin64Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myLib32D_ErrLbl [join $anLib32Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myLib64D_ErrLbl [join $anLib64Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myBin32D_ErrLbl [join $anBin32Errs "\n"]
wokdep:gui:SetLabelText .myFrame.myBin64D_ErrLbl [join $anBin64Errs "\n"]
# merge duplicates
set ::CSF_OPT_LIB32 [lsort -unique $::CSF_OPT_LIB32]
set ::CSF_OPT_LIB64 [lsort -unique $::CSF_OPT_LIB64]
set ::CSF_OPT_BIN32 [lsort -unique $::CSF_OPT_BIN32]
set ::CSF_OPT_BIN64 [lsort -unique $::CSF_OPT_BIN64]
set ::CSF_OPT_LIB32D [lsort -unique $::CSF_OPT_LIB32D]
set ::CSF_OPT_LIB64D [lsort -unique $::CSF_OPT_LIB64D]
set ::CSF_OPT_BIN32D [lsort -unique $::CSF_OPT_BIN32D]
set ::CSF_OPT_BIN64D [lsort -unique $::CSF_OPT_BIN64D]
} }
proc wokdep:gui:BrowseVcVars {} { proc wokdep:gui:BrowseVcVars {} {
@@ -274,34 +323,20 @@ proc wokdep:gui:AddIncPath {} {
} }
} }
proc wokdep:gui:AddLib32Path {} { proc wokdep:gui:AddLibPath {} {
set aCfg [wokdep:gui:configSuffix]
set aResult [tk_chooseDirectory -title "Choose a directory"] set aResult [tk_chooseDirectory -title "Choose a directory"]
if { "$aResult" != "" } { if { "$aResult" != "" } {
lappend ::CSF_OPT_LIB32 "$aResult" lappend ::CSF_OPT_LIB${::ARCH}${aCfg} "$aResult"
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
} }
proc wokdep:gui:AddLib64Path {} { proc wokdep:gui:AddBinPath {} {
set aCfg [wokdep:gui:configSuffix]
set aResult [tk_chooseDirectory -title "Choose a directory"] set aResult [tk_chooseDirectory -title "Choose a directory"]
if { "$aResult" != "" } { if { "$aResult" != "" } {
lappend ::CSF_OPT_LIB64 "$aResult" lappend ::CSF_OPT_BIN${::ARCH}${aCfg} "$aResult"
wokdep:gui:UpdateList
}
}
proc wokdep:gui:AddBin32Path {} {
set aResult [tk_chooseDirectory -title "Choose a directory"]
if { "$aResult" != "" } {
lappend ::CSF_OPT_BIN32 "$aResult"
wokdep:gui:UpdateList
}
}
proc wokdep:gui:AddBin64Path {} {
set aResult [tk_chooseDirectory -title "Choose a directory"]
if { "$aResult" != "" } {
lappend ::CSF_OPT_BIN64 "$aResult"
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
} }
@@ -314,34 +349,20 @@ proc wokdep:gui:RemoveIncPath {} {
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:RemoveLib32Path {} { proc wokdep:gui:RemoveLibPath {} {
set aSelIndices [.myFrame.myLib32List curselection] set aCfg [wokdep:gui:configSuffix]
set aSelIndices [.myFrame.myLib${::ARCH}${aCfg}_List curselection]
if { [llength $aSelIndices] != 0 } { if { [llength $aSelIndices] != 0 } {
.myFrame.myLib32List delete [lindex $aSelIndices 0] .myFrame.myLib${::ARCH}${aCfg}_List delete [lindex $aSelIndices 0]
} }
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:RemoveLib64Path {} { proc wokdep:gui:RemoveBinPath {} {
set aSelIndices [.myFrame.myLib64List curselection] set aCfg [wokdep:gui:configSuffix]
set aSelIndices [.myFrame.myBin${::ARCH}${aCfg}_List curselection]
if { [llength $aSelIndices] != 0 } { if { [llength $aSelIndices] != 0 } {
.myFrame.myLib64List delete [lindex $aSelIndices 0] .myFrame.myBin${::ARCH}${aCfg}_List delete [lindex $aSelIndices 0]
}
wokdep:gui:UpdateList
}
proc wokdep:gui:RemoveBin32Path {} {
set aSelIndices [.myFrame.myBin32List curselection]
if { [llength $aSelIndices] != 0 } {
.myFrame.myBin32List delete [lindex $aSelIndices 0]
}
wokdep:gui:UpdateList
}
proc wokdep:gui:RemoveBin64Path {} {
set aSelIndices [.myFrame.myBin64List curselection]
if { [llength $aSelIndices] != 0 } {
.myFrame.myBin64List delete [lindex $aSelIndices 0]
} }
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
@@ -351,109 +372,73 @@ proc wokdep:gui:ResetIncPath {} {
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:ResetLib32Path {} { proc wokdep:gui:ResetLibPath {} {
set ::CSF_OPT_LIB32 {} set ::CSF_OPT_LIB${::ARCH} {}
set ::CSF_OPT_LIB${::ARCH}D {}
set ::CSF_OPT_BIN${::ARCH} {}
set ::CSF_OPT_BIN${::ARCH}D {}
wokdep:gui:UpdateList wokdep:gui:UpdateList
} }
proc wokdep:gui:ResetLib64Path {} { proc wokdep:gui:Show3264Bitness { theRowIter } {
set ::CSF_OPT_LIB64 {}
wokdep:gui:UpdateList
}
proc wokdep:gui:ResetBin32Path {} {
set ::CSF_OPT_BIN32 {}
wokdep:gui:UpdateList
}
proc wokdep:gui:ResetBin64Path {} {
set ::CSF_OPT_BIN64 {}
wokdep:gui:UpdateList
}
proc wokdep:gui:Show32Bitness { theRowIter } {
upvar $theRowIter aRowIter upvar $theRowIter aRowIter
if { [llength [grid info .myFrame.myLib64Lbl]] != 0 } { set aArchOld ""
grid forget .myFrame.myLib64Lbl .myFrame.myLib64List .myFrame.myLib64Scrl set aCfg [wokdep:gui:configSuffix]
grid forget .myFrame.myLib64Add .myFrame.myLib64Remove .myFrame.myLib64Clear .myFrame.myLib64ErrLbl if { "$::ARCH" == "32" } {
grid forget .myFrame.myBin64Lbl .myFrame.myBin64List .myFrame.myBin64Scrl set aArchOld "64"
grid forget .myFrame.myBin64Add .myFrame.myBin64Remove .myFrame.myBin64Clear .myFrame.myBin64ErrLbl } else {
set aArchOld "32"
} }
# Additional libraries (32-bit) search paths set aCfgOld "D"
grid .myFrame.myLib32Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w if { "$::CONFIG" == "Debug" } { set aCfgOld "" }
incr aRowIter set aDelArch ${aArchOld}${aCfg}
grid .myFrame.myLib32List -row $aRowIter -column 0 -rowspan 4 -columnspan 5 if { [llength [grid info .myFrame.myLib${aDelArch}_Lbl]] != 0 } {
grid .myFrame.myLib32Scrl -row $aRowIter -column 5 -rowspan 4 grid forget .myFrame.myLib${aDelArch}_Lbl .myFrame.myLib${aDelArch}_List .myFrame.myLib${aDelArch}_Scrl
grid .myFrame.myLib32Add -row $aRowIter -column 6 grid forget .myFrame.myLib${aDelArch}_Add .myFrame.myLib${aDelArch}_Remove .myFrame.myLib${aDelArch}_Clear .myFrame.myLib${aDelArch}_ErrLbl
incr aRowIter grid forget .myFrame.myBin${aDelArch}_Lbl .myFrame.myBin${aDelArch}_List .myFrame.myBin${aDelArch}_Scrl
#grid .myFrame.myLib32Edit -row $aRowIter -column 6 grid forget .myFrame.myBin${aDelArch}_Add .myFrame.myBin${aDelArch}_Remove .myFrame.myBin${aDelArch}_Clear .myFrame.myBin${aDelArch}_ErrLbl
incr aRowIter }
grid .myFrame.myLib32Remove -row $aRowIter -column 6 set aDelCfg ${::ARCH}${aCfgOld}
incr aRowIter if { [llength [grid info .myFrame.myLib${aDelCfg}_Lbl]] != 0 } {
grid .myFrame.myLib32Clear -row $aRowIter -column 6 grid forget .myFrame.myLib${aDelCfg}_Lbl .myFrame.myLib${aDelCfg}_List .myFrame.myLib${aDelCfg}_Scrl
incr aRowIter grid forget .myFrame.myLib${aDelCfg}_Add .myFrame.myLib${aDelCfg}_Remove .myFrame.myLib${aDelCfg}_Clear .myFrame.myLib${aDelCfg}_ErrLbl
grid .myFrame.myLib32ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid forget .myFrame.myBin${aDelCfg}_Lbl .myFrame.myBin${aDelCfg}_List .myFrame.myBin${aDelCfg}_Scrl
incr aRowIter grid forget .myFrame.myBin${aDelCfg}_Add .myFrame.myBin${aDelCfg}_Remove .myFrame.myBin${aDelCfg}_Clear .myFrame.myBin${aDelCfg}_ErrLbl
# Additional executables (32-bit) search paths
grid .myFrame.myBin32Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter
grid .myFrame.myBin32List -row $aRowIter -column 0 -rowspan 4 -columnspan 5
grid .myFrame.myBin32Scrl -row $aRowIter -column 5 -rowspan 4
grid .myFrame.myBin32Add -row $aRowIter -column 6
incr aRowIter
#grid .myFrame.myBin32Edit -row $aRowIter -column 6
incr aRowIter
grid .myFrame.myBin32Remove -row $aRowIter -column 6
incr aRowIter
grid .myFrame.myBin32Clear -row $aRowIter -column 6
incr aRowIter
grid .myFrame.myBin32ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter
}
proc wokdep:gui:Show64Bitness { theRowIter } {
upvar $theRowIter aRowIter
if { [llength [grid info .myFrame.myLib32Lbl]] != 0 } {
grid forget .myFrame.myLib32Lbl .myFrame.myLib32List .myFrame.myLib32Scrl
grid forget .myFrame.myLib32Add .myFrame.myLib32Remove .myFrame.myLib32Clear .myFrame.myLib32ErrLbl
grid forget .myFrame.myBin32Lbl .myFrame.myBin32List .myFrame.myBin32Scrl
grid forget .myFrame.myBin32Add .myFrame.myBin32Remove .myFrame.myBin32Clear .myFrame.myBin32ErrLbl
} }
# Additional libraries (64-bit) search paths set aNewCfg ${::ARCH}${aCfg}
grid .myFrame.myLib64Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w # Additional libraries search paths
grid .myFrame.myLib${aNewCfg}_Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
grid .myFrame.myLib64List -row $aRowIter -column 0 -rowspan 4 -columnspan 5 grid .myFrame.myLib${aNewCfg}_List -row $aRowIter -column 0 -rowspan 4 -columnspan 5
grid .myFrame.myLib64Scrl -row $aRowIter -column 5 -rowspan 4 grid .myFrame.myLib${aNewCfg}_Scrl -row $aRowIter -column 5 -rowspan 4
grid .myFrame.myLib64Add -row $aRowIter -column 6 grid .myFrame.myLib${aNewCfg}_Add -row $aRowIter -column 6
incr aRowIter incr aRowIter
#grid .myFrame.myLib64Edit -row $aRowIter -column 6 #grid .myFrame.myLib${aNewCfg}_Edit -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myLib64Remove -row $aRowIter -column 6 grid .myFrame.myLib${aNewCfg}_Remove -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myLib64Clear -row $aRowIter -column 6 grid .myFrame.myLib${aNewCfg}_Clear -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myLib64ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myLib${aNewCfg}_ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
# Additional executables (64-bit) search paths # Additional executables search paths
grid .myFrame.myBin64Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myBin${aNewCfg}_Lbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
grid .myFrame.myBin64List -row $aRowIter -column 0 -rowspan 4 -columnspan 5 grid .myFrame.myBin${aNewCfg}_List -row $aRowIter -column 0 -rowspan 4 -columnspan 5
grid .myFrame.myBin64Scrl -row $aRowIter -column 5 -rowspan 4 grid .myFrame.myBin${aNewCfg}_Scrl -row $aRowIter -column 5 -rowspan 4
grid .myFrame.myBin64Add -row $aRowIter -column 6 grid .myFrame.myBin${aNewCfg}_Add -row $aRowIter -column 6
incr aRowIter incr aRowIter
#grid .myFrame.myBin64Edit -row $aRowIter -column 6 #grid .myFrame.myBin${aNewCfg}_Edit -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myBin64Remove -row $aRowIter -column 6 grid .myFrame.myBin${aNewCfg}_Remove -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myBin64Clear -row $aRowIter -column 6 grid .myFrame.myBin${aNewCfg}_Clear -row $aRowIter -column 6
incr aRowIter incr aRowIter
grid .myFrame.myBin64ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myBin${aNewCfg}_ErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
} }
@@ -463,6 +448,7 @@ ttk::combobox .myFrame.myPrjFrame.myPrjCombo -values $SYS_PRJNAME_LIST -state
ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration:" -padding {5 5 20 5} ttk::label .myFrame.myVsFrame.myVsLbl -text "Visual Studio configuration:" -padding {5 5 20 5}
ttk::combobox .myFrame.myVsFrame.myVsCombo -values $SYS_VS_LIST -state readonly -textvariable VSVER -width 40 ttk::combobox .myFrame.myVsFrame.myVsCombo -values $SYS_VS_LIST -state readonly -textvariable VSVER -width 40
ttk::combobox .myFrame.myVsFrame.myArchCombo -values { {32} {64} } -textvariable ARCH -state readonly -width 6 ttk::combobox .myFrame.myVsFrame.myArchCombo -values { {32} {64} } -textvariable ARCH -state readonly -width 6
ttk::combobox .myFrame.myVsFrame.myConfigCombo -values { {Release} {Debug} } -textvariable CONFIG -state readonly -width 6
entry .myFrame.myVcEntry -textvariable VCVER -width 10 entry .myFrame.myVcEntry -textvariable VCVER -width 10
entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70 entry .myFrame.myVcVarsEntry -textvariable VCVARS -width 70
ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars ttk::button .myFrame.myVcBrowseBtn -text "Browse" -command wokdep:gui:BrowseVcVars
@@ -535,44 +521,84 @@ ttk::button .myFrame.myIncClear -text "Reset" -command wokdep:gui:ResetIncP
ttk::label .myFrame.myIncErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myIncErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional libraries (32-bit) search paths # Additional libraries (32-bit) search paths
ttk::label .myFrame.myLib32Lbl -text "Additional libraries (32-bit) search paths:" -padding {5 5 80 5} ttk::label .myFrame.myLib32_Lbl -text "Additional libraries (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib32Scrl -command ".myFrame.myLib32List yview" scrollbar .myFrame.myLib32_Scrl -command ".myFrame.myLib32_List yview"
listbox .myFrame.myLib32List -listvariable CSF_OPT_LIB32 -width 80 -height 5 -yscrollcommand ".myFrame.myLib32Scrl set" listbox .myFrame.myLib32_List -listvariable CSF_OPT_LIB32 -width 80 -height 5 -yscrollcommand ".myFrame.myLib32_Scrl set"
ttk::button .myFrame.myLib32Add -text "Add" -command wokdep:gui:AddLib32Path ttk::button .myFrame.myLib32_Add -text "Add" -command wokdep:gui:AddLibPath
ttk::button .myFrame.myLib32Edit -text "Edit" ttk::button .myFrame.myLib32_Edit -text "Edit"
ttk::button .myFrame.myLib32Remove -text "Remove" -command wokdep:gui:RemoveLib32Path ttk::button .myFrame.myLib32_Remove -text "Remove" -command wokdep:gui:RemoveLibPath
ttk::button .myFrame.myLib32Clear -text "Reset" -command wokdep:gui:ResetLib32Path ttk::button .myFrame.myLib32_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myLib32ErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myLib32_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional debug libraries (32-bit) search paths
ttk::label .myFrame.myLib32D_Lbl -text "Additional debug libraries (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib32D_Scrl -command ".myFrame.myLib32D_List yview"
listbox .myFrame.myLib32D_List -listvariable CSF_OPT_LIB32D -width 80 -height 5 -yscrollcommand ".myFrame.myLib32D_Scrl set"
ttk::button .myFrame.myLib32D_Add -text "Add" -command wokdep:gui:AddLibPath
ttk::button .myFrame.myLib32D_Edit -text "Edit"
ttk::button .myFrame.myLib32D_Remove -text "Remove" -command wokdep:gui:RemoveLibPath
ttk::button .myFrame.myLib32D_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myLib32D_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional libraries (64-bit) search paths # Additional libraries (64-bit) search paths
ttk::label .myFrame.myLib64Lbl -text "Additional libraries (64-bit) search paths:" -padding {5 5 80 5} ttk::label .myFrame.myLib64_Lbl -text "Additional libraries (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib64Scrl -command ".myFrame.myLib64List yview" scrollbar .myFrame.myLib64_Scrl -command ".myFrame.myLib64_List yview"
listbox .myFrame.myLib64List -listvariable CSF_OPT_LIB64 -width 80 -height 5 -yscrollcommand ".myFrame.myLib64Scrl set" listbox .myFrame.myLib64_List -listvariable CSF_OPT_LIB64 -width 80 -height 5 -yscrollcommand ".myFrame.myLib64_Scrl set"
ttk::button .myFrame.myLib64Add -text "Add" -command wokdep:gui:AddLib64Path ttk::button .myFrame.myLib64_Add -text "Add" -command wokdep:gui:AddLibPath
ttk::button .myFrame.myLib64Edit -text "Edit" ttk::button .myFrame.myLib64_Edit -text "Edit"
ttk::button .myFrame.myLib64Remove -text "Remove" -command wokdep:gui:RemoveLib64Path ttk::button .myFrame.myLib64_Remove -text "Remove" -command wokdep:gui:RemoveLibPath
ttk::button .myFrame.myLib64Clear -text "Reset" -command wokdep:gui:ResetLib64Path ttk::button .myFrame.myLib64_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myLib64ErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myLib64_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional debug libraries (64-bit) search paths
ttk::label .myFrame.myLib64D_Lbl -text "Additional debug libraries (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myLib64D_Scrl -command ".myFrame.myLib64D_List yview"
listbox .myFrame.myLib64D_List -listvariable CSF_OPT_LIB64D -width 80 -height 5 -yscrollcommand ".myFrame.myLib64D_Scrl set"
ttk::button .myFrame.myLib64D_Add -text "Add" -command wokdep:gui:AddLibPath
ttk::button .myFrame.myLib64D_Edit -text "Edit"
ttk::button .myFrame.myLib64D_Remove -text "Remove" -command wokdep:gui:RemoveLibPath
ttk::button .myFrame.myLib64D_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myLib64D_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional executables (32-bit) search paths # Additional executables (32-bit) search paths
ttk::label .myFrame.myBin32Lbl -text "Additional executables (32-bit) search paths:" -padding {5 5 80 5} ttk::label .myFrame.myBin32_Lbl -text "Additional executables (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin32Scrl -command ".myFrame.myBin32List yview" scrollbar .myFrame.myBin32_Scrl -command ".myFrame.myBin32_List yview"
listbox .myFrame.myBin32List -listvariable CSF_OPT_BIN32 -width 80 -height 5 -yscrollcommand ".myFrame.myBin32Scrl set" listbox .myFrame.myBin32_List -listvariable CSF_OPT_BIN32 -width 80 -height 5 -yscrollcommand ".myFrame.myBin32_Scrl set"
ttk::button .myFrame.myBin32Add -text "Add" -command wokdep:gui:AddBin32Path ttk::button .myFrame.myBin32_Add -text "Add" -command wokdep:gui:AddBinPath
ttk::button .myFrame.myBin32Edit -text "Edit" ttk::button .myFrame.myBin32_Edit -text "Edit"
ttk::button .myFrame.myBin32Remove -text "Remove" -command wokdep:gui:RemoveBin32Path ttk::button .myFrame.myBin32_Remove -text "Remove" -command wokdep:gui:RemoveBinPath
ttk::button .myFrame.myBin32Clear -text "Reset" -command wokdep:gui:ResetBin32Path ttk::button .myFrame.myBin32_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myBin32ErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myBin32_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional debug executables (32-bit) search paths
ttk::label .myFrame.myBin32D_Lbl -text "Additional debug executables (32-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin32D_Scrl -command ".myFrame.myBin32D_List yview"
listbox .myFrame.myBin32D_List -listvariable CSF_OPT_BIN32D -width 80 -height 5 -yscrollcommand ".myFrame.myBin32D_Scrl set"
ttk::button .myFrame.myBin32D_Add -text "Add" -command wokdep:gui:AddBinPath
ttk::button .myFrame.myBin32D_Edit -text "Edit"
ttk::button .myFrame.myBin32D_Remove -text "Remove" -command wokdep:gui:RemoveBinPath
ttk::button .myFrame.myBin32D_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myBin32D_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional executables (64-bit) search paths # Additional executables (64-bit) search paths
ttk::label .myFrame.myBin64Lbl -text "Additional executables (64-bit) search paths:" -padding {5 5 80 5} ttk::label .myFrame.myBin64_Lbl -text "Additional executables (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin64Scrl -command ".myFrame.myBin64List yview" scrollbar .myFrame.myBin64_Scrl -command ".myFrame.myBin64_List yview"
listbox .myFrame.myBin64List -listvariable CSF_OPT_BIN64 -width 80 -height 5 -yscrollcommand ".myFrame.myBin64Scrl set" listbox .myFrame.myBin64_List -listvariable CSF_OPT_BIN64 -width 80 -height 5 -yscrollcommand ".myFrame.myBin64_Scrl set"
ttk::button .myFrame.myBin64Add -text "Add" -command wokdep:gui:AddBin64Path ttk::button .myFrame.myBin64_Add -text "Add" -command wokdep:gui:AddBinPath
ttk::button .myFrame.myBin64Edit -text "Edit" ttk::button .myFrame.myBin64_Edit -text "Edit"
ttk::button .myFrame.myBin64Remove -text "Remove" -command wokdep:gui:RemoveBin64Path ttk::button .myFrame.myBin64_Remove -text "Remove" -command wokdep:gui:RemoveBinPath
ttk::button .myFrame.myBin64Clear -text "Reset" -command wokdep:gui:ResetBin64Path ttk::button .myFrame.myBin64_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myBin64ErrLbl -text "Error: " -foreground red -padding {5 5 5 5} ttk::label .myFrame.myBin64_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Additional debug executables (64-bit) search paths
ttk::label .myFrame.myBin64D_Lbl -text "Additional debug executables (64-bit) search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myBin64D_Scrl -command ".myFrame.myBin64D_List yview"
listbox .myFrame.myBin64D_List -listvariable CSF_OPT_BIN64D -width 80 -height 5 -yscrollcommand ".myFrame.myBin64D_Scrl set"
ttk::button .myFrame.myBin64D_Add -text "Add" -command wokdep:gui:AddBinPath
ttk::button .myFrame.myBin64D_Edit -text "Edit"
ttk::button .myFrame.myBin64D_Remove -text "Remove" -command wokdep:gui:RemoveBinPath
ttk::button .myFrame.myBin64D_Clear -text "Reset" -command wokdep:gui:ResetLibPath
ttk::label .myFrame.myBin64D_ErrLbl -text "Error: " -foreground red -padding {5 5 5 5}
# Bottom # Bottom
ttk::button .myFrame.mySave -text "Save" -command wokdep:SaveCustom ttk::button .myFrame.mySave -text "Save" -command wokdep:SaveCustom
@@ -583,17 +609,22 @@ ttk::button .myFrame.myClose -text "Close" -command wokdep:gui:Close
grid .myFrame.myPrjFrame -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myPrjFrame -row $aRowIter -column 0 -columnspan 10 -sticky w
grid .myFrame.myPrjFrame.myPrjLbl -row 0 -column 0 grid .myFrame.myPrjFrame.myPrjLbl -row 0 -column 0
grid .myFrame.myPrjFrame.myPrjCombo -row 0 -column 1 grid .myFrame.myPrjFrame.myPrjCombo -row 0 -column 1
incr aRowIter
if { "$tcl_platform(platform)" == "windows" } { if { "$tcl_platform(platform)" == "windows" } {
incr aRowIter
grid .myFrame.myVsFrame -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myVsFrame -row $aRowIter -column 0 -columnspan 10 -sticky w
grid .myFrame.myVsFrame.myVsLbl -row 0 -column 0 grid .myFrame.myVsFrame.myVsLbl -row 0 -column 0
grid .myFrame.myVsFrame.myVsCombo -row 0 -column 1 -padx 5 grid .myFrame.myVsFrame.myVsCombo -row 0 -column 1 -padx 5
grid .myFrame.myVsFrame.myArchCombo -row 0 -column 2 grid .myFrame.myVsFrame.myArchCombo -row 0 -column 2
grid .myFrame.myVsFrame.myConfigCombo -row 0 -column 3
incr aRowIter incr aRowIter
grid .myFrame.myVcEntry -row $aRowIter -column 0 grid .myFrame.myVcEntry -row $aRowIter -column 0
grid .myFrame.myVcVarsEntry -row $aRowIter -column 1 -columnspan 4 -sticky w grid .myFrame.myVcVarsEntry -row $aRowIter -column 1 -columnspan 4 -sticky w
grid .myFrame.myVcBrowseBtn -row $aRowIter -column 6 grid .myFrame.myVcBrowseBtn -row $aRowIter -column 6
incr aRowIter incr aRowIter
} else {
grid .myFrame.myVsFrame -row $aRowIter -column 4 -sticky w
grid .myFrame.myVsFrame.myConfigCombo -row 0 -column 0
incr aRowIter
} }
# #
@@ -686,15 +717,8 @@ incr aRowIter
grid .myFrame.myIncErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w grid .myFrame.myIncErrLbl -row $aRowIter -column 0 -columnspan 10 -sticky w
incr aRowIter incr aRowIter
# Additional 32-bit search paths # Additional search paths
if { "$ARCH" == "32" } { wokdep:gui:Show3264Bitness aRowIter
wokdep:gui:Show32Bitness aRowIter
}
# Additional 64-bit search paths
if { "$ARCH" == "64" } {
wokdep:gui:Show64Bitness aRowIter
}
# Bottom section # Bottom section
grid .myFrame.mySave -row $aRowIter -column 4 -columnspan 2 grid .myFrame.mySave -row $aRowIter -column 4 -columnspan 2
@@ -710,6 +734,9 @@ bind .myFrame.myVsFrame.myVsCombo <<ComboboxSelected>> {
bind .myFrame.myVsFrame.myArchCombo <<ComboboxSelected>> { bind .myFrame.myVsFrame.myArchCombo <<ComboboxSelected>> {
wokdep:gui:SwitchArch wokdep:gui:SwitchArch
} }
bind .myFrame.myVsFrame.myConfigCombo <<ComboboxSelected>> {
wokdep:gui:SwitchArch
}
.myFrame.mySrchEntry configure -validate all -validatecommand { .myFrame.mySrchEntry configure -validate all -validatecommand {
set ::PRODUCTS_PATH [file normalize "$::PRODUCTS_PATH_INPUT"] set ::PRODUCTS_PATH [file normalize "$::PRODUCTS_PATH_INPUT"]

View File

@@ -52,6 +52,10 @@ set CSF_OPT_LIB32 [list]
set CSF_OPT_LIB64 [list] set CSF_OPT_LIB64 [list]
set CSF_OPT_BIN32 [list] set CSF_OPT_BIN32 [list]
set CSF_OPT_BIN64 [list] set CSF_OPT_BIN64 [list]
set CSF_OPT_LIB32D [list]
set CSF_OPT_LIB64D [list]
set CSF_OPT_BIN32D [list]
set CSF_OPT_BIN64D [list]
if { "$tcl_platform(pointerSize)" == "4" } { if { "$tcl_platform(pointerSize)" == "4" } {
set ARCH "32" set ARCH "32"
@@ -116,6 +120,35 @@ if { [info exists ::env(CSF_OPT_BIN64)] } {
set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER] set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER]
} }
if { [info exists ::env(CSF_OPT_LIB32D)] } {
set CSF_OPT_LIB32D [split "$::env(CSF_OPT_LIB32D)" $::SYS_PATH_SPLITTER]
foreach aLibIter $::CSF_OPT_LIB32 {
set aPos [lsearch -exact $::CSF_OPT_LIB32D $aLibIter]
set ::CSF_OPT_LIB32D [lreplace $::CSF_OPT_LIB32D $aPos $aPos]
}
}
if { [info exists ::env(CSF_OPT_LIB64D)] } {
set CSF_OPT_LIB64D [split "$::env(CSF_OPT_LIB64D)" $::SYS_PATH_SPLITTER]
foreach aLibIter $::CSF_OPT_LIB64 {
set aPos [lsearch -exact $::CSF_OPT_LIB64D $aLibIter]
set ::CSF_OPT_LIB64D [lreplace $::CSF_OPT_LIB64D $aPos $aPos]
}
}
if { [info exists ::env(CSF_OPT_BIN32D)] } {
set CSF_OPT_BIN32D [split "$::env(CSF_OPT_BIN32D)" $::SYS_PATH_SPLITTER]
foreach aLibIter $::CSF_OPT_BIN32 {
set aPos [lsearch -exact $::CSF_OPT_BIN32D $aLibIter]
set ::CSF_OPT_BIN32D [lreplace $::CSF_OPT_BIN32D $aPos $aPos]
}
}
if { [info exists ::env(CSF_OPT_BIN64D)] } {
set CSF_OPT_BIN64D [split "$::env(CSF_OPT_BIN64D)" $::SYS_PATH_SPLITTER]
foreach aLibIter $::CSF_OPT_BIN64 {
set aPos [lsearch -exact $::CSF_OPT_BIN64D $aLibIter]
set ::CSF_OPT_BIN64D [lreplace $::CSF_OPT_BIN64D $aPos $aPos]
}
}
# Search header file in $::CSF_OPT_INC and standard paths # Search header file in $::CSF_OPT_INC and standard paths
proc wokdep:SearchHeader {theHeader} { proc wokdep:SearchHeader {theHeader} {
# search in custom paths # search in custom paths
@@ -316,6 +349,12 @@ proc wokdep:SearchStandardLibrary {theErrInc theErrLib32 theErrLib64 theErrBin32
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
set hasLib true set hasLib true
set aLibDPath [wokdep:SearchLib "$theCheckLib" "$anArchIter" "$aPath/libd"]
if { "$aLibDPath" != "" } {
lappend ::CSF_OPT_LIB${anArchIter}D "$aPath/libd"
lappend ::CSF_OPT_BIN${anArchIter}D "$aPath/bind"
}
break break
} }
} }
@@ -741,14 +780,14 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
} }
} }
if { "$::tcl_platform(platform)" == "windows" } { if { "$::tcl_platform(platform)" == "windows" } {
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"] set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter"]
if { "$aTbbDllPath" == "" } { if { "$aTbbDllPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ] set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"] set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
if { "$aTbbDllPath" != "" } { if { "$aTbbDllPath" != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib" lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
} else { } else {
lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)" lappend anErrBin$anArchIter "Error: 'tbb12.dll' not found (Intel TBB)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" } if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
} }
} }
@@ -1212,13 +1251,13 @@ proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
return "$isFound" return "$isFound"
} }
set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"] set aX11LibPath [wokdep:SearchLib "X11" "$::ARCH"]
if { "$aXmuLibPath" == "" } { if { "$aX11LibPath" == "" } {
set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"] set aX11LibPath [wokdep:SearchLib "X11" "$::ARCH" "/usr/X11/lib"]
if { "$aXmuLibPath" != "" } { if { "$aX11LibPath" != "" } {
#lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib" #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
} else { } else {
lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)" lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}X11.${::SYS_LIB_SUFFIX}' not found (X11)"
set isFound "false" set isFound "false"
} }
} }
@@ -1287,6 +1326,18 @@ proc wokdep:SaveCustom {} {
puts $aFile "rem Additional libraries (32-bit) search paths" puts $aFile "rem Additional libraries (32-bit) search paths"
puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\"" puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
set aStringLib32d [join $::CSF_OPT_LIB32D $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringLib32d [regsub -all "$::PRODUCTS_PATH" $aStringLib32d "%PRODUCTS_PATH%"]
}
puts $aFile ""
puts $aFile "rem Additional debug libraries (32-bit) search paths"
if { "$aStringLib32d" != "" && "$aStringLib32" != "" } {
puts $aFile "set \"CSF_OPT_LIB32D=$aStringLib32d;%CSF_OPT_LIB32%\""
} else {
puts $aFile "set \"CSF_OPT_LIB32D=$aStringLib32d\""
}
set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER] set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } { if { "$::PRODUCTS_PATH" != "" } {
set aStringLib64 [regsub -all "$::PRODUCTS_PATH" $aStringLib64 "%PRODUCTS_PATH%"] set aStringLib64 [regsub -all "$::PRODUCTS_PATH" $aStringLib64 "%PRODUCTS_PATH%"]
@@ -1295,6 +1346,18 @@ proc wokdep:SaveCustom {} {
puts $aFile "rem Additional libraries (64-bit) search paths" puts $aFile "rem Additional libraries (64-bit) search paths"
puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\"" puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
set aStringLib64d [join $::CSF_OPT_LIB64D $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringLib64d [regsub -all "$::PRODUCTS_PATH" $aStringLib64d "%PRODUCTS_PATH%"]
}
puts $aFile ""
puts $aFile "rem Additional debug libraries (64-bit) search paths"
if { "$aStringLib64d" != "" && "$aStringLib64" != "" } {
puts $aFile "set \"CSF_OPT_LIB64D=$aStringLib64d;%CSF_OPT_LIB64%\""
} else {
puts $aFile "set \"CSF_OPT_LIB64D=$aStringLib64d\""
}
set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER] set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } { if { "$::PRODUCTS_PATH" != "" } {
set aStringBin32 [regsub -all "$::PRODUCTS_PATH" $aStringBin32 "%PRODUCTS_PATH%"] set aStringBin32 [regsub -all "$::PRODUCTS_PATH" $aStringBin32 "%PRODUCTS_PATH%"]
@@ -1303,6 +1366,18 @@ proc wokdep:SaveCustom {} {
puts $aFile "rem Additional (32-bit) search paths" puts $aFile "rem Additional (32-bit) search paths"
puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\"" puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
set aStringBin32d [join $::CSF_OPT_BIN32D $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringBin32d [regsub -all "$::PRODUCTS_PATH" $aStringBin32d "%PRODUCTS_PATH%"]
}
puts $aFile ""
puts $aFile "rem Additional debug (32-bit) search paths"
if { "$aStringBin32d" != "" && "$aStringBin32" != "" } {
puts $aFile "set \"CSF_OPT_BIN32D=$aStringBin32d;%CSF_OPT_BIN32%\""
} else {
puts $aFile "set \"CSF_OPT_BIN32D=$aStringBin32d\""
}
set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER] set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } { if { "$::PRODUCTS_PATH" != "" } {
set aStringBin64 [regsub -all "$::PRODUCTS_PATH" $aStringBin64 "%PRODUCTS_PATH%"] set aStringBin64 [regsub -all "$::PRODUCTS_PATH" $aStringBin64 "%PRODUCTS_PATH%"]
@@ -1311,6 +1386,18 @@ proc wokdep:SaveCustom {} {
puts $aFile "rem Additional (64-bit) search paths" puts $aFile "rem Additional (64-bit) search paths"
puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\"" puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
set aStringBin64d [join $::CSF_OPT_BIN64D $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringBin64d [regsub -all "$::PRODUCTS_PATH" $aStringBin64d "%PRODUCTS_PATH%"]
}
puts $aFile ""
puts $aFile "rem Additional debug (64-bit) search paths"
if { "$aStringBin64d" != "" && "$aStringBin64" != "" } {
puts $aFile "set \"CSF_OPT_BIN64D=$aStringBin64d;%CSF_OPT_BIN64%\""
} else {
puts $aFile "set \"CSF_OPT_BIN64D=$aStringBin64d\""
}
close $aFile close $aFile
} else { } else {
set aCustomFilePath "./custom.sh" set aCustomFilePath "./custom.sh"
@@ -1352,6 +1439,18 @@ proc wokdep:SaveCustom {} {
puts $aFile "# Additional libraries ($::ARCH-bit) search paths" puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib]\"" puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib]\""
set aStringLibD [join [set ::CSF_OPT_LIB${::ARCH}D] $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringLibD [regsub -all "$::PRODUCTS_PATH" $aStringLibD "\${PRODUCTS_PATH}"]
}
puts $aFile ""
puts $aFile "# Additional debug libraries ($::ARCH-bit) search paths"
if { "$aStringLibD" != "" && "$aStringLib" != "" } {
puts $aFile "export CSF_OPT_LIB${::ARCH}D=\"[set aStringLibD]:\$CSF_OPT_LIB${::ARCH}\""
} else {
puts $aFile "export CSF_OPT_LIB${::ARCH}D=\"[set aStringLibD]\""
}
set aStringBin [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER] set aStringBin [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } { if { "$::PRODUCTS_PATH" != "" } {
set aStringBin [regsub -all "$::PRODUCTS_PATH" $aStringBin "\${PRODUCTS_PATH}"] set aStringBin [regsub -all "$::PRODUCTS_PATH" $aStringBin "\${PRODUCTS_PATH}"]
@@ -1360,6 +1459,18 @@ proc wokdep:SaveCustom {} {
puts $aFile "# Additional ($::ARCH-bit) search paths" puts $aFile "# Additional ($::ARCH-bit) search paths"
puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin]\"" puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin]\""
set aStringBinD [join [set ::CSF_OPT_BIN${::ARCH}D] $::SYS_PATH_SPLITTER]
if { "$::PRODUCTS_PATH" != "" } {
set aStringBinD [regsub -all "$::PRODUCTS_PATH" $aStringBinD "\${PRODUCTS_PATH}"]
}
puts $aFile ""
puts $aFile "# Additional debug ($::ARCH-bit) search paths"
if { "$aStringBinD" != "" && "$aStringBin" != "" } {
puts $aFile "export CSF_OPT_BIN${::ARCH}D=\"[set aStringBinD]:\$CSF_OPT_BIN${::ARCH}\""
} else {
puts $aFile "export CSF_OPT_BIN${::ARCH}D=\"[set aStringBinD]\""
}
close $aFile close $aFile
} }
puts "Configuration saved to file '$aCustomFilePath'" puts "Configuration saved to file '$aCustomFilePath'"
@@ -1397,6 +1508,27 @@ proc wokdep:SaveCustom {} {
puts $aFile "INCLUDEPATH += \"${anIncPath}\"" puts $aFile "INCLUDEPATH += \"${anIncPath}\""
} }
puts $aFile ""
puts $aFile "CONFIG(debug, debug|release) {"
puts $aFile " # Additional debug libraries search paths"
foreach aLibPath [set ::CSF_OPT_LIB${::ARCH}D] {
if { "$::PRODUCTS_PATH" != "" } {
set aLibPath [regsub -all "$::PRODUCTS_PATH" $aLibPath "\$\$\{PRODUCTS_PATH\}"]
}
puts $aFile " LIBS += -L\"${aLibPath}\""
}
if { "$::tcl_platform(platform)" == "windows" } {
puts $aFile ""
puts $aFile " # Additional debug DLLs search paths"
foreach aDllPath [set ::CSF_OPT_BIN${::ARCH}D] {
if { "$::PRODUCTS_PATH" != "" } {
set aDllPath [regsub -all "$::PRODUCTS_PATH" $aDllPath "\$\$\{PRODUCTS_PATH\}"]
}
puts $aFile " LIBS += -L\"${aDllPath}\""
}
}
puts $aFile "}"
puts $aFile "" puts $aFile ""
puts $aFile "# Additional libraries search paths" puts $aFile "# Additional libraries search paths"
foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] { foreach aLibPath [set ::CSF_OPT_LIB$::ARCH] {

View File

@@ -236,9 +236,11 @@ proc gendoc {args} {
return -1 return -1
} }
} elseif {$arg_n == "s"} { } elseif {$arg_n == "s"} {
if { [ lsearch $args_names "pdf" ] == -1 } { if { [ lsearch $args_names "pdf" ] != -1 } {
puts "Warning: search is not used with PDF and will be ignored."
continue continue
} }
if {$args_values(s) != "NULL"} { if {$args_values(s) != "NULL"} {
set SEARCH_MODE $args_values(s) set SEARCH_MODE $args_values(s)
} else { } else {
@@ -247,16 +249,16 @@ proc gendoc {args} {
} }
} elseif {$arg_n == "mathjax"} { } elseif {$arg_n == "mathjax"} {
if { [ lsearch $args_names "pdf" ] != -1 } { if { [ lsearch $args_names "pdf" ] != -1 } {
set possible_mathjax_loc $args_values(mathjax) puts "Warning: MathJax is not used with PDF and will be ignored."
if {[file exist [file join $possible_mathjax_loc $mathjax_js_name]]} { }
set MATHJAX_LOCATION $args_values(mathjax)
puts "$MATHJAX_LOCATION" set possible_mathjax_loc $args_values(mathjax)
} else { if {[file exist [file join $possible_mathjax_loc $mathjax_js_name]]} {
puts "Warning: $mathjax_js_name is not found in $possible_mathjax_loc." set MATHJAX_LOCATION $args_values(mathjax)
puts " MathJax will be used from $MATHJAX_LOCATION" puts "$MATHJAX_LOCATION"
}
} else { } else {
puts "Warning: MathJax is not used with pdf and will be ignored." puts "Warning: $mathjax_js_name is not found in $possible_mathjax_loc."
puts " MathJax will be used from $MATHJAX_LOCATION"
} }
} else { } else {
puts "\nWrong argument: $arg_n" puts "\nWrong argument: $arg_n"
@@ -833,6 +835,7 @@ proc OCCDoc_MakeDoxyfile {docType outDir tagFileDir {doxyFileName} {generatorMod
puts $doxyFile "PROJECT_NUMBER = $occt_version" puts $doxyFile "PROJECT_NUMBER = $occt_version"
puts $doxyFile "OUTPUT_DIRECTORY = $outDir/." puts $doxyFile "OUTPUT_DIRECTORY = $outDir/."
puts $doxyFile "PROJECT_LOGO = [OCCDoc_GetDoxDir]/resources/occ_logo.png" puts $doxyFile "PROJECT_LOGO = [OCCDoc_GetDoxDir]/resources/occ_logo.png"
puts $doxyFile "EXAMPLE_PATH = [OCCDoc_GetSourceDir $productsPath]"
set PARAM_INPUT "INPUT =" set PARAM_INPUT "INPUT ="
set PARAM_IMAGEPATH "IMAGE_PATH = [OCCDoc_GetDoxDir]/resources/ " set PARAM_IMAGEPATH "IMAGE_PATH = [OCCDoc_GetDoxDir]/resources/ "

View File

@@ -260,7 +260,7 @@ proc genAllResources { theSrcDir } {
# Wrapper-function to generate VS project files # Wrapper-function to generate VS project files
proc genproj {theFormat args} { proc genproj {theFormat args} {
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vclang" "cbp" "xcd" "pro"} set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vc143" "vclang" "cbp" "xcd" "pro"}
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" } set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
set isHelpRequire false set isHelpRequire false
@@ -324,6 +324,7 @@ proc genproj {theFormat args} {
vc14 - Visual Studio 2015 vc14 - Visual Studio 2015
vc141 - Visual Studio 2017 vc141 - Visual Studio 2017
vc142 - Visual Studio 2019 vc142 - Visual Studio 2019
vc143 - Visual Studio 2022
vclang - Visual Studio with ClangCL toolset vclang - Visual Studio with ClangCL toolset
cbp - CodeBlocks cbp - CodeBlocks
xcd - XCode xcd - XCode
@@ -560,6 +561,7 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl theSolution }
"vc14" - "vc14" -
"vc141" - "vc141" -
"vc142" - "vc142" -
"vc143" -
"vclang" { OS:MKVC $anOutDir $aModules $aTools $theSolution $theFormat $isUWP} "vclang" { OS:MKVC $anOutDir $aModules $aTools $theSolution $theFormat $isUWP}
"cbp" { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl } "cbp" { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl }
"xcd" { "xcd" {
@@ -1014,8 +1016,8 @@ proc osutils:vcsolution:header { vcversion } {
append var \ append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \ "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 2013\n" "# Visual Studio 2013\n"
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" || } elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" ||
"$vcversion" == "vc142" || "$vcversion" == "vclang" } { "$vcversion" == "vc142" || "$vcversion" == "vc143" || "$vcversion" == "vclang" } {
append var \ append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \ "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 14\n" "# Visual Studio 14\n"
@@ -1231,28 +1233,11 @@ proc osutils:convertModules { theModules theSrcDir theSourceDirOther theProjects
lappend aProjectsInModule($aModule) $aToolKit lappend aProjectsInModule($aModule) $aToolKit
lappend aDependencies [LibToLink $aToolKit $theSrcDir $theSourceDirOther] lappend aDependencies [LibToLink $aToolKit $theSrcDir $theSourceDirOther]
} }
# executables, assume one project per cxx file... # executables
foreach aUnit [OS:executable ${aModule}] { foreach aUnit [OS:executable ${aModule}] {
set aUnitLoc $aUnit lappend aProjects $aUnit
set src_files [_get_used_files $aUnit $theSrcDir false] lappend aProjectsInModule($aModule) $aUnit
set aSrcFiles {} lappend aDependencies [LibToLink $aUnit $theSrcDir $theSourceDirOther]
foreach s $src_files {
regexp {source ([^\s]+)} $s dummy name
lappend aSrcFiles $name
}
foreach aSrcFile $aSrcFiles {
set aFileExtension [file extension $aSrcFile]
if { $aFileExtension == ".cxx" } {
set aPrjName [file rootname $aSrcFile]
lappend aProjects $aPrjName
lappend aProjectsInModule($aModule) $aPrjName
if {[file isdirectory $path/$theSrcDir/$aUnitLoc]} {
lappend aDependencies [LibToLinkX $aUnitLoc [file rootname $aSrcFile] $theSrcDir $theSourceDirOther]
} else {
lappend aDependencies {}
}
}
}
} }
} }
} }
@@ -1290,6 +1275,9 @@ proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
} elseif { $theVcVer == "vc142" } { } elseif { $theVcVer == "vc142" } {
set aVCRTVer "vc14" set aVCRTVer "vc14"
set aToolset "v142" set aToolset "v142"
} elseif { $theVcVer == "vc143" } {
set aVCRTVer "vc14"
set aToolset "v143"
} elseif { $theVcVer == "vclang" } { } elseif { $theVcVer == "vclang" } {
set aVCRTVer "vc14" set aVCRTVer "vc14"
set aToolset "ClangCL" set aToolset "ClangCL"
@@ -2105,98 +2093,106 @@ proc osutils:tk:execfiles { theFiles theOutDir theCommand thePrefix theExtension
# Generate Visual Studio project file for executable # Generate Visual Studio project file for executable
proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir theSourceDirOther } { proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir theSourceDirOther } {
set aVcFiles {} set aVcFiles {}
foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] { set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
set aProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 1]
set aProjName [file rootname [file tail $f]] set aProjName $theToolKit
set l_compilable [osutils:compilable wnt] set l_compilable [osutils:compilable wnt]
regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl regsub -all -- {__XQTNAM__} $aProjTmpl $aProjName aProjTmpl
upvar $theGuidsMap aGuidsMap upvar $theGuidsMap aGuidsMap
if { ! [info exists aGuidsMap($aProjName)] } { if { ! [info exists aGuidsMap($aProjName)] } {
set aGuidsMap($aProjName) [OS:genGUID] set aGuidsMap($aProjName) [OS:genGUID]
} }
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
set aUsedLibs [list] set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] { foreach tkx [osutils:commonUsedTK $theToolKit $theSrcDir $theSourceDirOther] {
lappend aUsedLibs "${tkx}.lib" lappend aUsedLibs "${tkx}.lib"
} }
set anOsReleaseLibs {} set anOsReleaseLibs {}
set anOsDebugLibs {} set anOsDebugLibs {}
osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true osutils:usedOsLibs $theToolKit "wnt" anOsReleaseLibs aFrameworks $theSrcDir true
osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false osutils:usedOsLibs $theToolKit "wnt" anOsDebugLibs aFrameworks $theSrcDir false
set aVCRTVer [string range $theVcVer 0 3] set aVCRTVer [string range $theVcVer 0 3]
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
set aFilesSection "" set aFilesSection ""
set aVcFilesCxx(units) "" set aVcFilesCxx(units) ""
set aVcFilesHxx(units) "" set aVcFilesHxx(units) ""
if { ![info exists written([file tail $f])] } { if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
set written([file tail $f]) 1 foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
if { ![info exists written([file tail $f])] } {
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } { set written([file tail $f]) 1
append aFilesSection [osutils:vcxproj:cxxfile $f "" 3] append aFilesSection [osutils:vcxproj:cxxfile $f "" 3]
if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit } if { ! [info exists aVcFilesCxx($theToolKit)] } { lappend aVcFilesCxx(units) $theToolKit }
lappend aVcFilesCxx($theToolKit) $f lappend aVcFilesCxx($theToolKit) $f
} else { } else {
append aFilesSection "\t\t\t<Filter\n" puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
append aFilesSection "\t\t\t\t>\n"
append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
append aFilesSection "\t\t\t</Filter>"
} }
} else {
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
} }
#puts "$aProjTmpl $aFilesSection" } else {
set anIncPaths "..\\..\\..\\inc" append aFilesSection "\t\t\t<Filter\n"
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl append aFilesSection "\t\t\t\tName=\"$theToolKit\"\n"
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl append aFilesSection "\t\t\t\t>\n"
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl foreach f [osutils:tk:cxxfiles $theToolKit wnt $theSrcDir] {
if { ![info exists written([file tail $f])] } {
set written([file tail $f]) 1
append aFilesSection [osutils:vcproj:file $theVcVer $f ""]
} else {
puts "Warning : in vcproj there are more than one occurrences for [file tail $f]"
}
}
append aFilesSection "\t\t\t</Filter>"
}
regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl #puts "$aProjTmpl $aFilesSection"
set anIncPaths "..\\..\\..\\inc"
regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl
regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl
regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w] regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl
set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w]
fconfigure $aFile -translation crlf
puts $aFile $aProjTmpl
close $aFile
set aCommonSettingsFile "$aVcFilePath.user"
lappend aVcFiles $aVcFilePath
# write filters file for vc10
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
}
# write resource file
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
set aCommonSettingsFileTmpl ""
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
# nothing
} elseif { "$theVcVer" == "vc9" } {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
} else {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
}
if { "$aCommonSettingsFileTmpl" != "" } {
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
fconfigure $aFile -translation crlf fconfigure $aFile -translation crlf
puts $aFile $aProjTmpl puts $aFile $aCommonSettingsFileTmpl
close $aFile close $aFile
set aCommonSettingsFile "$aVcFilePath.user" lappend aVcFiles "$aCommonSettingsFile"
lappend aVcFiles $aVcFilePath
# write filters file for vc10
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
lappend aVcFiles [osutils:vcxproj:filters $theOutDir $aProjName aVcFilesCxx aVcFilesHxx]
}
# write resource file
lappend aVcFiles [osutils:readtemplate:rc $theOutDir $aProjName]
set aCommonSettingsFileTmpl ""
if { "$theVcVer" == "vc7" || "$theVcVer" == "vc8" } {
# nothing
} elseif { "$theVcVer" == "vc9" } {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcproj.user.vc9x"]
} else {
set aCommonSettingsFileTmpl [wokUtils:FILES:FileToString "$::THE_CASROOT/adm/templates/vcxproj.user.vc10x"]
}
if { "$aCommonSettingsFileTmpl" != "" } {
regsub -all -- {__VCVER__} $aCommonSettingsFileTmpl $aVCRTVer aCommonSettingsFileTmpl
set aFile [open [set aVcFilePath "$aCommonSettingsFile"] w]
fconfigure $aFile -translation crlf
puts $aFile $aCommonSettingsFileTmpl
close $aFile
lappend aVcFiles "$aCommonSettingsFile"
}
} }
return $aVcFiles return $aVcFiles
} }

View File

@@ -39,6 +39,10 @@ win32 {
DEFINES += _SCL_SECURE_NO_WARNINGS DEFINES += _SCL_SECURE_NO_WARNINGS
} else { } else {
CONFIG += c++11 CONFIG += c++11
clang {
QMAKE_CFLAGS_WARN_ON += -Wshorten-64-to-32
QMAKE_CXXFLAGS_WARN_ON += -Wshorten-64-to-32
}
QMAKE_CFLAGS += -fexceptions QMAKE_CFLAGS += -fexceptions
QMAKE_CXXFLAGS += -fexceptions QMAKE_CXXFLAGS += -fexceptions
QMAKE_CXXFLAGS += -fvisibility=default QMAKE_CXXFLAGS += -fvisibility=default
@@ -115,6 +119,8 @@ android-g++ {
# VS2015, vc141 # VS2015, vc141
} else:equals(aMsvcVer, 16.0){ } else:equals(aMsvcVer, 16.0){
# VS2019, vc142 # VS2019, vc142
} else:equals(aMsvcVer, 17.0){
# VS2022, vc143
} else { } else {
warning (Unknown msvc version. "$$MY_COMPILER" is used) warning (Unknown msvc version. "$$MY_COMPILER" is used)
} }

View File

@@ -26,6 +26,7 @@ HAVE_FFMPEG { CSF_FFmpeg = -lavcodec -lavformat -lswscale -lavutil }
HAVE_TBB { CSF_TBB = -ltbb -ltbbmalloc } HAVE_TBB { CSF_TBB = -ltbb -ltbbmalloc }
HAVE_ZLIB { CSF_ZLIB = -lzlib } HAVE_ZLIB { CSF_ZLIB = -lzlib }
HAVE_LIBLZMA { CSF_LIBLZMA = -lliblzma } HAVE_LIBLZMA { CSF_LIBLZMA = -lliblzma }
HAVE_DRACO { CSF_Draco = -ldraco }
win32 { win32 {
CSF_kernel32 = -lkernel32 CSF_kernel32 = -lkernel32
CSF_advapi32 = -ladvapi32 CSF_advapi32 = -ladvapi32
@@ -131,21 +132,31 @@ for (aPackage, aPackages) {
} }
} }
# extend clean with versioned .so files
!win32 { !win32 {
aVerList = $$split(VERSION, ".") aVerList = $$split(VERSION, ".")
aVerMaj = $$member(aVerList, 0) aVerMaj = $$member(aVerList, 0)
aVerMin = $$member(aVerList, 1) aVerMin = $$member(aVerList, 1)
aVerMic = $$member(aVerList, 2) aVerMic = $$member(aVerList, 2)
equals(TEMPLATE, app) { equals(TEMPLATE, app) {
QMAKE_CLEAN += $$DESTDIR/$${TARGET} QMAKE_CLEAN += $$DESTDIR/$${TARGET}
} else { } else {
mac { mac {
# override qmake soname versionong logic
QMAKE_LFLAGS_SONAME =
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.dylib.$${aVerMaj}.$${aVerMin}
# extend clean with versioned .dylib files
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.dylib QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.dylib
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.$${aVerMaj}.$${aVerMin}.$${aVerMic}.dylib
} else { } else {
# override qmake soname versionong logic
QMAKE_LFLAGS_SONAME =
QMAKE_LFLAGS += -Wl,-soname=lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}
# extend clean with versioned .so files
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj} QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}
QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin} QMAKE_CLEAN += $$DESTDIR/lib$${TARGET}.so.$${aVerMaj}.$${aVerMin}

View File

@@ -33,6 +33,7 @@ set "BUILD_ModelingAlgorithms=ON"
set "BUILD_Visualization=ON" set "BUILD_Visualization=ON"
set "BUILD_ApplicationFramework=ON" set "BUILD_ApplicationFramework=ON"
set "BUILD_DataExchange=ON" set "BUILD_DataExchange=ON"
set "BUILD_DETools=OFF"
rem Optional 3rd-party libraries to enable rem Optional 3rd-party libraries to enable
set "USE_FREETYPE=ON" set "USE_FREETYPE=ON"
@@ -166,6 +167,7 @@ if ["%toCMake%"] == ["1"] (
-D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^ -D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^
-D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^ -D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^
-D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^ -D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^
-D BUILD_MODULE_DETools:BOOL="OFF" ^
-D BUILD_MODULE_Draw:BOOL="OFF" ^ -D BUILD_MODULE_Draw:BOOL="OFF" ^
-D BUILD_DOC_Overview:BOOL="OFF" ^ -D BUILD_DOC_Overview:BOOL="OFF" ^
-D USE_FREETYPE:BOOL="%USE_FREETYPE%" ^ -D USE_FREETYPE:BOOL="%USE_FREETYPE%" ^

View File

@@ -27,6 +27,7 @@ rem set "BUILD_ModelingAlgorithms=ON"
rem set "BUILD_Visualization=ON" rem set "BUILD_Visualization=ON"
rem set "BUILD_ApplicationFramework=ON" rem set "BUILD_ApplicationFramework=ON"
rem set "BUILD_DataExchange=ON" rem set "BUILD_DataExchange=ON"
rem set "BUILD_MODULE_DETools=OFF"
rem Optional 3rd-party libraries to enable rem Optional 3rd-party libraries to enable
rem set "USE_RAPIDJSON=ON" rem set "USE_RAPIDJSON=ON"

View File

@@ -33,6 +33,7 @@ rem set BUILD_PATCH=
rem set BUILD_MODULE_ApplicationFramework=ON rem set BUILD_MODULE_ApplicationFramework=ON
rem set BUILD_MODULE_DataExchange=ON rem set BUILD_MODULE_DataExchange=ON
rem set BUILD_MODULE_DETools=OFF
rem set BUILD_MODULE_Draw=ON rem set BUILD_MODULE_Draw=ON
rem set BUILD_MODULE_ModelingAlgorithms=ON rem set BUILD_MODULE_ModelingAlgorithms=ON
rem set BUILD_MODULE_ModelingData=ON rem set BUILD_MODULE_ModelingData=ON

View File

@@ -26,6 +26,7 @@ FREETYPE_DIR="$OCCT3RDPARTY/freetype-2.7.1"
#BUILD_MODULE_ApplicationFramework=ON #BUILD_MODULE_ApplicationFramework=ON
#BUILD_MODULE_DataExchange=ON #BUILD_MODULE_DataExchange=ON
#BUILD_MODULE_DETools=OFF
#BUILD_MODULE_Draw=ON #BUILD_MODULE_Draw=ON
#BUILD_MODULE_ModelingAlgorithms=ON #BUILD_MODULE_ModelingAlgorithms=ON
#BUILD_MODULE_ModelingData=ON #BUILD_MODULE_ModelingData=ON

View File

@@ -28,6 +28,7 @@ set BUILD_FORCE_RelWithDebInfo=OFF
set BUILD_MODULE_ApplicationFramework=ON set BUILD_MODULE_ApplicationFramework=ON
set BUILD_MODULE_DataExchange=ON set BUILD_MODULE_DataExchange=ON
set BUILD_MODULE_DETools=OFF
set BUILD_MODULE_Draw=ON set BUILD_MODULE_Draw=ON
set BUILD_MODULE_ModelingAlgorithms=ON set BUILD_MODULE_ModelingAlgorithms=ON
set BUILD_MODULE_ModelingData=ON set BUILD_MODULE_ModelingData=ON
@@ -62,6 +63,7 @@ cmake -G "%arch_compile%" ^
-D BUILD_LIBRARY_TYPE:STRING=%BUILD_LIBRARY_TYPE% ^ -D BUILD_LIBRARY_TYPE:STRING=%BUILD_LIBRARY_TYPE% ^
-D BUILD_MODULE_ApplicationFramework:BOOL=%BUILD_MODULE_ApplicationFramework% ^ -D BUILD_MODULE_ApplicationFramework:BOOL=%BUILD_MODULE_ApplicationFramework% ^
-D BUILD_MODULE_DataExchange:BOOL=%BUILD_MODULE_DataExchange% ^ -D BUILD_MODULE_DataExchange:BOOL=%BUILD_MODULE_DataExchange% ^
-D BUILD_MODULE_DETools:BOOL=%BUILD_MODULE_DETools% ^
-D BUILD_MODULE_Draw:BOOL=%BUILD_MODULE_Draw% ^ -D BUILD_MODULE_Draw:BOOL=%BUILD_MODULE_Draw% ^
-D BUILD_MODULE_FoundationClasses:BOOL=ON ^ -D BUILD_MODULE_FoundationClasses:BOOL=ON ^
-D BUILD_MODULE_ModelingAlgorithms:BOOL=%BUILD_MODULE_ModelingAlgorithms% ^ -D BUILD_MODULE_ModelingAlgorithms:BOOL=%BUILD_MODULE_ModelingAlgorithms% ^

View File

@@ -31,6 +31,7 @@ BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
BUILD_MODULE_ApplicationFramework=ON BUILD_MODULE_ApplicationFramework=ON
BUILD_MODULE_DataExchange=ON BUILD_MODULE_DataExchange=ON
BUILD_MODULE_DETools=OFF
BUILD_MODULE_Draw=ON BUILD_MODULE_Draw=ON
BUILD_MODULE_ModelingAlgorithms=ON BUILD_MODULE_ModelingAlgorithms=ON
BUILD_MODULE_ModelingData=ON BUILD_MODULE_ModelingData=ON
@@ -63,6 +64,7 @@ cmake -G "Unix Makefiles" \
-D BUILD_LIBRARY_TYPE:STRING=$BUILD_LIBRARY_TYPE \ -D BUILD_LIBRARY_TYPE:STRING=$BUILD_LIBRARY_TYPE \
-D BUILD_MODULE_ApplicationFramework:BOOL=$BUILD_MODULE_ApplicationFramework \ -D BUILD_MODULE_ApplicationFramework:BOOL=$BUILD_MODULE_ApplicationFramework \
-D BUILD_MODULE_DataExchange:BOOL=$BUILD_MODULE_DataExchange \ -D BUILD_MODULE_DataExchange:BOOL=$BUILD_MODULE_DataExchange \
-D BUILD_MODULE_DETools:BOOL=$BUILD_MODULE_DETools \
-D BUILD_MODULE_Draw:BOOL=$BUILD_MODULE_Draw \ -D BUILD_MODULE_Draw:BOOL=$BUILD_MODULE_Draw \
-D BUILD_MODULE_FoundationClasses:BOOL=ON \ -D BUILD_MODULE_FoundationClasses:BOOL=ON \
-D BUILD_MODULE_ModelingAlgorithms:BOOL=$BUILD_MODULE_ModelingAlgorithms \ -D BUILD_MODULE_ModelingAlgorithms:BOOL=$BUILD_MODULE_ModelingAlgorithms \

View File

@@ -20,13 +20,13 @@ export aRapidJson=
export aDraco= export aDraco=
# build stages to perform # build stages to perform
export toSimulator=0
export isStatic=1 export isStatic=1
export toCMake=1 export toCMake=1
export toClean=1 export toClean=1
export toMake=1 export toMake=1
export toInstall=1 export toInstall=1
export toPack=0 export toPack=0
export toPackFat=0
export toDebug=0 export toDebug=0
export BUILD_ModelingData=ON export BUILD_ModelingData=ON
@@ -34,6 +34,7 @@ export BUILD_ModelingAlgorithms=ON
export BUILD_Visualization=ON export BUILD_Visualization=ON
export BUILD_ApplicationFramework=ON export BUILD_ApplicationFramework=ON
export BUILD_DataExchange=ON export BUILD_DataExchange=ON
export BUILD_DETools=OFF
export USE_FREETYPE=ON export USE_FREETYPE=ON
export USE_FREEIMAGE=OFF export USE_FREEIMAGE=OFF
@@ -41,13 +42,25 @@ export USE_RAPIDJSON=OFF
export USE_DRACO=OFF export USE_DRACO=OFF
export IPHONEOS_DEPLOYMENT_TARGET=8.0 export IPHONEOS_DEPLOYMENT_TARGET=8.0
export anAbi=arm64 #export anAbiList="iPhoneOS|arm64 iPhoneSimulator|arm64 iPhoneSimulator|x86_64"
#export anAbi=x86_64 export anAbiList="iPhoneOS|arm64"
if [[ -f "${aScriptDir}/ios_custom.sh" ]]; then if [[ -f "${aScriptDir}/ios_custom.sh" ]]; then
source "${aScriptDir}/ios_custom.sh" source "${aScriptDir}/ios_custom.sh"
fi fi
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aGitBranch=`git symbolic-ref --short HEAD`
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aRevision=-${YEAR}-${MONTH}-${DAY}
#aRevision=-${aGitBranch}
set -o pipefail
aBuildType="Release" aBuildType="Release"
aBuildTypePrefix= aBuildTypePrefix=
if [[ $toDebug == 1 ]]; then if [[ $toDebug == 1 ]]; then
@@ -58,59 +71,52 @@ aLibType="Shared"
if [[ $isStatic == 1 ]]; then if [[ $isStatic == 1 ]]; then
aLibType="Static" aLibType="Static"
fi fi
aPlatformAndCompiler=ios-${anAbi}${aBuildTypePrefix}-clang
aPlatformSdk="iphoneos"
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
if [[ $toSimulator == 1 ]]; then
#anAbi=x86_64
aPlatformAndCompiler=ios-simulator64-${anAbi}${aBuildTypePrefix}-clang
aPlatformSdk="iphonesimulator"
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
fi
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make" function buildArch {
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}" anAbi=$1
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log" aPlatformSdk=$2
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then aPlatformAndCompiler=${aPlatformSdk}-${anAbi}${aBuildTypePrefix}-clang
rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
fi
mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs` aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs` aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
aGitBranch=`git symbolic-ref --short HEAD` aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
# include some information about OCCT into archive if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
echo \<pre\>> "${aWorkDir}/VERSION.html" rm -r -f "$aWorkDir"
git status >> "${aWorkDir}/VERSION.html" rm -r -f "$aDestDir"
git log -n 100 >> "${aWorkDir}/VERSION.html"
echo \</pre\>>> "${aWorkDir}/VERSION.html"
pushd "$aWorkDir"
aTimeZERO=$SECONDS
set -o pipefail
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi fi
} mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
# (re)generate Make files # include some information about OCCT into archive
if [[ $toCMake == 1 ]]; then echo \<pre\>> "${aWorkDir}/VERSION.html"
echo Configuring OCCT for iOS... git status >> "${aWorkDir}/VERSION.html"
cmake -G "Unix Makefiles" \ git log -n 100 >> "${aWorkDir}/VERSION.html"
echo \</pre\>>> "${aWorkDir}/VERSION.html"
pushd "$aWorkDir"
aTimeZERO=$SECONDS
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi
}
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/${aPlatformSdk}.platform/Developer/SDKs/${aPlatformSdk}.sdk"
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring OCCT for iOS...
cmake -G "Unix Makefiles" \
-D CMAKE_SYSTEM_NAME="iOS" \ -D CMAKE_SYSTEM_NAME="iOS" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \ -D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D CMAKE_OSX_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \ -D CMAKE_OSX_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \
-D CMAKE_OSX_SYSROOT:PATH="$aSysRoot" \ -D CMAKE_OSX_SYSROOT:PATH="$aSysRoot" \
-D ENABLE_VISIBILITY:BOOL="TRUE" \
-D CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \ -D CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
-D CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \ -D CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \ -D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
@@ -143,59 +149,121 @@ if [[ $toCMake == 1 ]]; then
-D BUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \ -D BUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \
-D BUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \ -D BUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \
-D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \ -D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-D BUILD_MODULE_DETools:BOOL="${BUILD_DETools}" \
-D BUILD_MODULE_Draw:BOOL="OFF" \ -D BUILD_MODULE_Draw:BOOL="OFF" \
-D BUILD_DOC_Overview:BOOL="OFF" \ -D BUILD_DOC_Overview:BOOL="OFF" \
"$aCasSrc" 2>&1 | tee -a "$aLogFile" "$aCasSrc" 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi fi
aTimeGEN=$SECONDS aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build # clean up from previous build
if [[ $toClean == 1 ]]; then if [[ $toClean == 1 ]]; then
make clean make clean
fi fi
# build the project # build the project
if [[ $toMake == 1 ]]; then if [[ $toMake == 1 ]]; then
echo Building... echo Building...
make -j $aNbJobs 2>&1 | tee -a "$aLogFile" make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi fi
aTimeBUILD=$SECONDS aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project # install the project
if [[ $toInstall == 1 ]]; then if [[ $toInstall == 1 ]]; then
echo Installing OCCT into $aDestDir... echo Installing OCCT into $aDestDir...
make install 2>&1 | tee -a "$aLogFile" make install 2>&1 | tee -a "$aLogFile"
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html" cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
fi echo Platform: ${aPlatformSdk} ABI: ${anAbi} Build: ${aBuildType} IPHONEOS_DEPLOYMENT_TARGET: ${IPHONEOS_DEPLOYMENT_TARGET} > "$aDestDir/build_target.txt"
aTimeINSTALL=$SECONDS fi
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive # create an archive
if [[ $toPack == 1 ]]; then if [[ $toPack == 1 ]]; then
YEAR=$(date +"%Y") anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
MONTH=$(date +"%m") echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
DAY=$(date +"%d") rm ${aDestDir}/../${anArchName} &>/dev/null
aRevision=-${YEAR}-${MONTH}-${DAY} pushd "$aDestDir"
#aRevision=-${aGitBranch} tar -jcf ${aDestDir}/../${anArchName} *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aDestDir}/../${anArchName} &>/dev/null
pushd "$aDestDir"
tar -jcf ${aDestDir}/../${anArchName} *
popd popd
}
for anArchIter in $anAbiList
do
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
echo Platform: ${aPlatform} ABI: ${anArch} Build: ${aBuildType}
buildArch $anArch $aPlatform
done
# create a FAT archive
if [[ $toPackFat == 1 ]]; then
for aPlatIter in iPhoneOS iPhoneSimulator
do
aSuffixFat=${aPlatIter}${aBuildTypePrefix}-clang
aFatDir="${aCasSrc}/${aBuildRoot}/${aSuffixFat}"
# merge per-arch builds into fat builds
hasPlatform=0
for anArchIter in $anAbiList
do
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
if [[ $aPlatIter != ${aPlatform} ]]; then
continue
fi
aSuffixThin=${aPlatform}-${anArch}${aBuildTypePrefix}-clang
anArchDir="${aCasSrc}/${aBuildRoot}/${aSuffixThin}"
if [[ $hasPlatform == 0 ]]; then
hasPlatform=1
echo Packing FAT archive for platform: ${aPlatform}
rm -r -f "$aFatDir"
mkdir -p "$aFatDir"
rsync -r --exclude '*.a' "$anArchDir/" "$aFatDir"
rm -f "$aFatDir/build_target.txt"
for aLibIter in $anArchDir/lib/*.a; do
aLibName=`basename $aLibIter`
lipo "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
done
else
for aLibIter in $aFatDir/lib/*.a; do
aLibName=`basename $aLibIter`
lipo "$aFatDir/lib/$aLibName" "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
#lipo -info "$aFatDir/lib/$aLibName"
done
fi
cat "$anArchDir/build_target.txt" >> "$aFatDir/build_target.txt"
done
# create an archive
for anArchIter in $anAbiList
do
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
if [[ $aPlatIter != ${aPlatform} ]]; then
continue
fi
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aSuffixFat}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aFatDir}/../${anArchName} &>/dev/null
pushd "$aFatDir"
tar -jcf ${aFatDir}/../${anArchName} *
popd
break
done
done
fi fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -1,4 +1,4 @@
# environment configuration template for macos_build.sh (to be renamed as macos_custom_env.sh) # environment configuration template for ios_build.sh (to be renamed as ios_custom_env.sh)
export PATH=/Applications/CMake.app/Contents/bin:$PATH export PATH=/Applications/CMake.app/Contents/bin:$PATH
export aFreeType="$aSrcRoot/../3rdparty/freetype-2.10.4-ios" export aFreeType="$aSrcRoot/../3rdparty/freetype-2.10.4-ios"
export aFreeImage="$aSrcRoot/../3rdparty/freeimage-3.18-ios" export aFreeImage="$aSrcRoot/../3rdparty/freeimage-3.18-ios"
@@ -6,13 +6,13 @@ export aRapidJson="$aSrcRoot/../3rdparty/rapidjson-1.1.0"
export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-ios" export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-ios"
# Uncomment to customize building steps # Uncomment to customize building steps
#export toSimulator=0
#export isStatic=0 #export isStatic=0
#export toCMake=1 #export toCMake=1
#export toClean=1 #export toClean=1
#export toMake=1 #export toMake=1
#export toInstall=1 #export toInstall=1
#export toPack=0 #export toPack=0
#export toPackFat=1
#export toDebug=0 #export toDebug=0
#export BUILD_ModelingData=ON #export BUILD_ModelingData=ON
@@ -20,11 +20,12 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-ios"
#export BUILD_Visualization=ON #export BUILD_Visualization=ON
#export BUILD_ApplicationFramework=ON #export BUILD_ApplicationFramework=ON
#export BUILD_DataExchange=ON #export BUILD_DataExchange=ON
#export BUILD_DETools=OFF
#export USE_RAPIDJSON=ON #export USE_RAPIDJSON=ON
#export USE_DRACO=ON #export USE_DRACO=ON
#export USE_FREEIMAGE=ON #export USE_FREEIMAGE=ON
#export IPHONEOS_DEPLOYMENT_TARGET=8.0 #export IPHONEOS_DEPLOYMENT_TARGET=8.0
#export anAbi=arm64 #export anAbiList="iPhoneOS|arm64 iPhoneSimulator|arm64 iPhoneSimulator|x86_64"
#export anAbi=x86_64 #export anAbiList="iPhoneOS|arm64"

View File

@@ -20,11 +20,13 @@ export aRapidJson=
export aDraco= export aDraco=
# build stages to perform # build stages to perform
export isStatic=0
export toCMake=1 export toCMake=1
export toClean=1 export toClean=1
export toMake=1 export toMake=1
export toInstall=1 export toInstall=1
export toPack=0 export toPack=0
export toPackFat=0
export toDebug=0 export toDebug=0
export BUILD_ModelingData=ON export BUILD_ModelingData=ON
@@ -32,74 +34,95 @@ export BUILD_ModelingAlgorithms=ON
export BUILD_Visualization=ON export BUILD_Visualization=ON
export BUILD_ApplicationFramework=ON export BUILD_ApplicationFramework=ON
export BUILD_DataExchange=ON export BUILD_DataExchange=ON
export BUILD_DETools=OFF
export BUILD_Draw=ON export BUILD_Draw=ON
export USE_FREETYPE=ON
export USE_FREEIMAGE=ON export USE_FREEIMAGE=ON
export USE_RAPIDJSON=OFF export USE_RAPIDJSON=OFF
export USE_DRACO=OFF export USE_DRACO=OFF
export MACOSX_DEPLOYMENT_TARGET=10.10 export MACOSX_DEPLOYMENT_TARGET=10.10
#export anAbi=arm64 #export anAbiList="arm64 x86_64"
export anAbi=x86_64 export anAbiList="x86_64"
aPlatform="macos"
if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then
source "${aScriptDir}/macos_custom.sh" source "${aScriptDir}/macos_custom.sh"
fi fi
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
aGitBranch=`git symbolic-ref --short HEAD`
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aRevision=-${YEAR}-${MONTH}-${DAY}
#aRevision=-${aGitBranch}
set -o pipefail
aBuildType="Release" aBuildType="Release"
aBuildTypePrefix= aBuildTypePrefix=
if [[ $toDebug == 1 ]]; then if [[ $toDebug == 1 ]]; then
aBuildType="Debug" aBuildType="Debug"
aBuildTypePrefix="-debug" aBuildTypePrefix="-debug"
fi fi
aPlatformAndCompiler=mac-${anAbi}${aBuildTypePrefix}-clang aLibType="Shared"
aLibExt="dylib"
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make" if [[ $isStatic == 1 ]]; then
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}" aLibType="Static"
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log" aLibExt="a"
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
fi fi
mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs` function buildArch {
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs` anAbi=$1
aGitBranch=`git symbolic-ref --short HEAD`
# include some information about OCCT into archive aPlatformAndCompiler=${aPlatform}-${anAbi}${aBuildTypePrefix}-clang
echo \<pre\>> "${aWorkDir}/VERSION.html"
git status >> "${aWorkDir}/VERSION.html"
git log -n 100 >> "${aWorkDir}/VERSION.html"
echo \</pre\>>> "${aWorkDir}/VERSION.html"
pushd "$aWorkDir" aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
aTimeZERO=$SECONDS if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
set -o pipefail rm -r -f "$aWorkDir"
rm -r -f "$aDestDir"
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi fi
} mkdir -p "$aWorkDir"
mkdir -p "$aDestDir"
rm -f "$aLogFile"
# (re)generate Make files # include some information about OCCT into archive
if [[ $toCMake == 1 ]]; then echo \<pre\>> "${aWorkDir}/VERSION.html"
echo Configuring OCCT for macOS... git status >> "${aWorkDir}/VERSION.html"
cmake -G "Unix Makefiles" \ git log -n 100 >> "${aWorkDir}/VERSION.html"
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \ echo \</pre\>>> "${aWorkDir}/VERSION.html"
-D BUILD_LIBRARY_TYPE:STRING="Shared" \
pushd "$aWorkDir"
aTimeZERO=$SECONDS
function logDuration {
if [[ $1 == 1 ]]; then
aDur=$(($4 - $3))
echo $2 time: $aDur sec>> "$aLogFile"
fi
}
# (re)generate Make files
if [[ $toCMake == 1 ]]; then
echo Configuring OCCT for macOS...
cmake -G "Unix Makefiles" \
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \ -D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
-D BUILD_LIBRARY_TYPE:STRING="$aLibType" \
-D INSTALL_DIR:PATH="$aDestDir" \ -D INSTALL_DIR:PATH="$aDestDir" \
-D INSTALL_DIR_INCLUDE:STRING="inc" \ -D INSTALL_DIR_INCLUDE:STRING="inc" \
-D INSTALL_DIR_LIB:STRING="lib" \ -D INSTALL_DIR_LIB:STRING="lib" \
-D INSTALL_DIR_RESOURCE:STRING="src" \ -D INSTALL_DIR_RESOURCE:STRING="src" \
-D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \ -D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \
-D USE_FREETYPE:BOOL="$USE_FREETYPE" \
-D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \ -D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \ -D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \ -D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
@@ -123,59 +146,125 @@ if [[ $toCMake == 1 ]]; then
-D BUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \ -D BUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \
-D BUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \ -D BUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \
-D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \ -D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-D BUILD_MODULE_DETools:BOOL="${BUILD_DETools}" \
-D BUILD_MODULE_Draw:BOOL="${BUILD_Draw}" \ -D BUILD_MODULE_Draw:BOOL="${BUILD_Draw}" \
-D BUILD_DOC_Overview:BOOL="OFF" \ -D BUILD_DOC_Overview:BOOL="OFF" \
"$aCasSrc" 2>&1 | tee -a "$aLogFile" "$aCasSrc" 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi fi
aTimeGEN=$SECONDS aTimeGEN=$SECONDS
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
# clean up from previous build # clean up from previous build
if [[ $toClean == 1 ]]; then if [[ $toClean == 1 ]]; then
make clean make clean
fi fi
# build the project # build the project
if [[ $toMake == 1 ]]; then if [[ $toMake == 1 ]]; then
echo Building OCCT... echo Building OCCT...
make -j $aNbJobs 2>&1 | tee -a "$aLogFile" make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
fi fi
aTimeBUILD=$SECONDS aTimeBUILD=$SECONDS
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
# install the project # install the project
if [[ $toInstall == 1 ]]; then if [[ $toInstall == 1 ]]; then
echo Installing OCCT into $aDestDir... echo Installing OCCT into $aDestDir...
make install 2>&1 | tee -a "$aLogFile" make install 2>&1 | tee -a "$aLogFile"
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html" cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
fi echo Platform: macOS ABI: ${anAbi} Build: ${aBuildType} MACOSX_DEPLOYMENT_TARGET: ${MACOSX_DEPLOYMENT_TARGET} > "$aDestDir/build_target.txt"
aTimeINSTALL=$SECONDS fi
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL aTimeINSTALL=$SECONDS
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
# create an archive # create an archive
if [[ $toPack == 1 ]]; then if [[ $toPack == 1 ]]; then
YEAR=$(date +"%Y") anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
MONTH=$(date +"%m") echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
DAY=$(date +"%d") rm ${aDestDir}/../${anArchName} &>/dev/null
aRevision=-${YEAR}-${MONTH}-${DAY} pushd "$aDestDir"
#aRevision=-${aGitBranch} tar -jcf ${aDestDir}/../${anArchName} *
popd
fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2 # finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd
}
for anArchIter in $anAbiList
do
echo Platform: macOS ABI: ${anArchIter} Build: ${aBuildType}
buildArch $anArchIter
done
# create a FAT archive
if [[ $toPackFat == 1 ]]; then
aSuffixFat=${aPlatform}${aBuildTypePrefix}-clang
aFatDir="${aCasSrc}/${aBuildRoot}/${aSuffixFat}"
# merge per-arch builds into fat builds
hasPlatform=0
for anArchIter in $anAbiList
do
aSuffixThin=${aPlatform}-${anArchIter}${aBuildTypePrefix}-clang
anArchDir="${aCasSrc}/${aBuildRoot}/${aSuffixThin}"
if [[ $hasPlatform == 0 ]]; then
hasPlatform=1
echo Packing FAT archive
rm -r -f "$aFatDir"
mkdir -p "$aFatDir"
if [[ $isStatic == 1 ]]; then
rsync -r -l --exclude '*.a' "$anArchDir/" "$aFatDir"
else
rsync -r -l --exclude '*.dylib' "$anArchDir/" "$aFatDir"
fi
rm -f "$aFatDir/build_target.txt"
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
rm $aFatDir/bin/$aDrawExe
lipo "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
fi
for aLibIter in $anArchDir/lib/*.$aLibExt; do
aLibName=`basename $aLibIter`
if [[ -L "$anArchDir/lib/$aLibName" ]]; then
cp -a "$anArchDir/lib/$aLibName" "$aFatDir/lib/"
else
lipo "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
fi
done
else
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
lipo "$aFatDir/bin/$aDrawExe" "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
fi
for aLibIter in $aFatDir/lib/*.$aLibExt; do
aLibName=`basename $aLibIter`
if [[ ! -L "$anArchDir/lib/$aLibName" ]]; then
lipo "$aFatDir/lib/$aLibName" "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
#lipo -info "$aFatDir/lib/$aLibName"
fi
done
fi
cat "$anArchDir/build_target.txt" >> "$aFatDir/build_target.txt"
done
# create an archive
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aSuffixFat}.tar.bz2
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}... echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
rm ${aDestDir}/../${anArchName} &>/dev/null rm ${aFatDir}/../${anArchName} &>/dev/null
pushd "$aDestDir" pushd "$aFatDir"
tar -jcf ${aDestDir}/../${anArchName} * tar -jcf ${aFatDir}/../${anArchName} *
popd popd
fi fi
aTimePACK=$SECONDS
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
# finished
DURATION=$(($aTimePACK - $aTimeZERO))
echo Total time: $DURATION sec
logDuration 1 "Total" $aTimeZERO $aTimePACK
popd

View File

@@ -12,12 +12,14 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
#export toMake=1 #export toMake=1
#export toInstall=1 #export toInstall=1
#export toPack=1 #export toPack=1
#export toPackFat=1
#export BUILD_ModelingData=ON #export BUILD_ModelingData=ON
#export BUILD_ModelingAlgorithms=ON #export BUILD_ModelingAlgorithms=ON
#export BUILD_Visualization=ON #export BUILD_Visualization=ON
#export BUILD_ApplicationFramework=ON #export BUILD_ApplicationFramework=ON
#export BUILD_DataExchange=ON #export BUILD_DataExchange=ON
#export BUILD_DETools=OFF
#export BUILD_Draw=ON #export BUILD_Draw=ON
#export USE_RAPIDJSON=ON #export USE_RAPIDJSON=ON
@@ -25,5 +27,6 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
#export USE_FREEIMAGE=ON #export USE_FREEIMAGE=ON
#export MACOSX_DEPLOYMENT_TARGET=10.10 #export MACOSX_DEPLOYMENT_TARGET=10.10
#export anAbi=arm64 #export anAbiList=arm64
#export anAbi=x86_64 #export anAbiList=x86_64
#export anAbiList="arm64 x86_64"

View File

@@ -32,6 +32,7 @@ set "BUILD_ModelingAlgorithms=ON"
set "BUILD_Visualization=ON" set "BUILD_Visualization=ON"
set "BUILD_ApplicationFramework=ON" set "BUILD_ApplicationFramework=ON"
set "BUILD_DataExchange=ON" set "BUILD_DataExchange=ON"
set "BUILD_DETools=OFF"
set "BUILD_Draw=ON" set "BUILD_Draw=ON"
rem Optional 3rd-party libraries to enable rem Optional 3rd-party libraries to enable
@@ -155,6 +156,7 @@ if ["%toCMake%"] == ["1"] (
-D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^ -D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^
-D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^ -D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^
-D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^ -D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^
-D BUILD_MODULE_DETools:BOOL="%BUILD_DETools%" ^
-D BUILD_MODULE_Draw:BOOL="%BUILD_Draw%" ^ -D BUILD_MODULE_Draw:BOOL="%BUILD_Draw%" ^
-D 3RDPARTY_TCL_DIR:PATH="%aTclTk%" ^ -D 3RDPARTY_TCL_DIR:PATH="%aTclTk%" ^
-D 3RDPARTY_TCL_INCLUDE_DIR:FILEPATH="%aTclTk%/include" ^ -D 3RDPARTY_TCL_INCLUDE_DIR:FILEPATH="%aTclTk%/include" ^

View File

@@ -22,6 +22,7 @@ rem set "BUILD_ModelingAlgorithms=ON"
rem set "BUILD_Visualization=ON" rem set "BUILD_Visualization=ON"
rem set "BUILD_ApplicationFramework=ON" rem set "BUILD_ApplicationFramework=ON"
rem set "BUILD_DataExchange=ON" rem set "BUILD_DataExchange=ON"
rem set "BUILD_DETools=OFF"
rem set "BUILD_Draw=ON" rem set "BUILD_Draw=ON"
rem set "USE_RAPIDJSON=ON" rem set "USE_RAPIDJSON=ON"

View File

@@ -32,12 +32,14 @@ set "BUILD_ModelingAlgorithms=ON"
set "BUILD_Visualization=ON" set "BUILD_Visualization=ON"
set "BUILD_ApplicationFramework=ON" set "BUILD_ApplicationFramework=ON"
set "BUILD_DataExchange=ON" set "BUILD_DataExchange=ON"
set "BUILD_DETools=OFF"
set "BUILD_Draw=OFF" set "BUILD_Draw=OFF"
rem Optional 3rd-party libraries to enable rem Optional 3rd-party libraries to enable
set "USE_FREETYPE=ON" set "USE_FREETYPE=ON"
set "USE_RAPIDJSON=OFF" set "USE_RAPIDJSON=OFF"
set "USE_DRACO=OFF" set "USE_DRACO=OFF"
set "USE_PTHREADS=OFF"
rem Archive tool rem Archive tool
set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on" set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
@@ -59,9 +61,14 @@ for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
set "aBuildType=Release" set "aBuildType=Release"
set "aBuildTypePrefix=" set "aBuildTypePrefix="
set "anExtraCxxFlags="
if /I ["%USE_PTHREADS%"] == ["ON"] (
set "anExtraCxxFlags=-pthread"
set "aBuildTypePrefix=%aBuildTypePrefix%-pthread"
)
if ["%toDebug%"] == ["1"] ( if ["%toDebug%"] == ["1"] (
set "aBuildType=Debug" set "aBuildType=Debug"
set "aBuildTypePrefix=-debug" set "aBuildTypePrefix=%aBuildTypePrefix%-debug"
) )
call :cmakeGenerate call :cmakeGenerate
@@ -159,6 +166,7 @@ if ["%toCMake%"] == ["1"] (
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^ -D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
-D BUILD_LIBRARY_TYPE:STRING="Static" ^ -D BUILD_LIBRARY_TYPE:STRING="Static" ^
-D CMAKE_CXX_FLAGS="%anExtraCxxFlags%" ^
-D INSTALL_DIR:PATH="%aDestDir%" ^ -D INSTALL_DIR:PATH="%aDestDir%" ^
-D INSTALL_DIR_INCLUDE:STRING="inc" ^ -D INSTALL_DIR_INCLUDE:STRING="inc" ^
-D INSTALL_DIR_RESOURCE:STRING="src" ^ -D INSTALL_DIR_RESOURCE:STRING="src" ^
@@ -168,6 +176,7 @@ if ["%toCMake%"] == ["1"] (
-D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^ -D BUILD_MODULE_Visualization:BOOL="%BUILD_Visualization%" ^
-D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^ -D BUILD_MODULE_ApplicationFramework:BOOL="%BUILD_ApplicationFramework%" ^
-D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^ -D BUILD_MODULE_DataExchange:BOOL="%BUILD_DataExchange%" ^
-D BUILD_MODULE_DETools:BOOL="%BUILD_DETools%" ^
-D BUILD_MODULE_Draw:BOOL="%BUILD_Draw%" ^ -D BUILD_MODULE_Draw:BOOL="%BUILD_Draw%" ^
-D BUILD_DOC_Overview:BOOL="OFF" ^ -D BUILD_DOC_Overview:BOOL="OFF" ^
-D USE_FREETYPE:BOOL="%USE_FREETYPE%" ^ -D USE_FREETYPE:BOOL="%USE_FREETYPE%" ^
@@ -256,6 +265,7 @@ if ["%toCMake%"] == ["1"] (
cmake -G "MinGW Makefiles" ^ cmake -G "MinGW Makefiles" ^
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^ -D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
-D CMAKE_CXX_FLAGS="%anExtraCxxFlags%" ^
-D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^ -D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^
-D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^ -D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^
-D OpenCASCADE_DIR:PATH="%aDestDir%/lib/cmake/opencascade" ^ -D OpenCASCADE_DIR:PATH="%aDestDir%/lib/cmake/opencascade" ^

View File

@@ -20,6 +20,7 @@ export BUILD_ModelingAlgorithms=ON
export BUILD_Visualization=ON export BUILD_Visualization=ON
export BUILD_ApplicationFramework=ON export BUILD_ApplicationFramework=ON
export BUILD_DataExchange=ON export BUILD_DataExchange=ON
export BUILD_DETools=OFF
if [ -f "${aScriptDir}/wasm_custom.sh" ] ; then if [ -f "${aScriptDir}/wasm_custom.sh" ] ; then
. "${aScriptDir}/wasm_custom.sh" . "${aScriptDir}/wasm_custom.sh"
@@ -74,6 +75,7 @@ echo cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \
-DBUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \ -DBUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \
-DBUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \ -DBUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \
-DBUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \ -DBUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-DBUILD_MODULE_DETools:BOOL="${BUILD_DETools}" \
-DBUILD_MODULE_Draw:BOOL="OFF" \ -DBUILD_MODULE_Draw:BOOL="OFF" \
-DBUILD_DOC_Overview:BOOL="OFF" "${aSrcRoot}" -DBUILD_DOC_Overview:BOOL="OFF" "${aSrcRoot}"
@@ -92,6 +94,7 @@ cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \
-DBUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \ -DBUILD_MODULE_Visualization:BOOL="${BUILD_Visualization}" \
-DBUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \ -DBUILD_MODULE_ApplicationFramework:BOOL="${BUILD_ApplicationFramework}" \
-DBUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \ -DBUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
-DBUILD_MODULE_DETools:BOOL="${BUILD_DETools}" \
-DBUILD_MODULE_Draw:BOOL="OFF" \ -DBUILD_MODULE_Draw:BOOL="OFF" \
-DBUILD_DOC_Overview:BOOL="OFF" "${aSrcRoot}" -DBUILD_DOC_Overview:BOOL="OFF" "${aSrcRoot}"

View File

@@ -23,6 +23,8 @@ rem set "BUILD_ModelingAlgorithms=ON"
rem set "BUILD_Visualization=ON" rem set "BUILD_Visualization=ON"
rem set "BUILD_ApplicationFramework=ON" rem set "BUILD_ApplicationFramework=ON"
rem set "BUILD_DataExchange=ON" rem set "BUILD_DataExchange=ON"
rem set "BUILD_DETools=OFF"
rem set "USE_RAPIDJSON=OFF" rem set "USE_RAPIDJSON=ON"
rem set "USE_DRACO=ON" rem set "USE_DRACO=ON"
rem set "USE_PTHREADS=ON"

View File

@@ -14,3 +14,4 @@ export EMSDK_ROOT="$aSrcRoot/../emsdk"
#export BUILD_Visualization=ON #export BUILD_Visualization=ON
#export BUILD_ApplicationFramework=ON #export BUILD_ApplicationFramework=ON
#export BUILD_DataExchange=ON #export BUILD_DataExchange=ON
#export BUILD_DETools=OFF

View File

@@ -21,6 +21,8 @@ set "toInstall=1"
set "toDebug=0" set "toDebug=0"
set "sourceMapBase=" set "sourceMapBase="
set "USE_PTHREADS=OFF"
rem Configuration file rem Configuration file
if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat" if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat"
@@ -30,9 +32,14 @@ if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
set "aBuildType=Release" set "aBuildType=Release"
set "aBuildTypePrefix=" set "aBuildTypePrefix="
set "anExtraCxxFlags="
if /I ["%USE_PTHREADS%"] == ["ON"] (
set "anExtraCxxFlags=-pthread"
set "aBuildTypePrefix=%aBuildTypePrefix%-pthread"
)
if ["%toDebug%"] == ["1"] ( if ["%toDebug%"] == ["1"] (
set "aBuildType=Debug" set "aBuildType=Debug"
set "aBuildTypePrefix=-debug" set "aBuildTypePrefix=%aBuildTypePrefix%-debug"
) )
call :cmakeGenerate call :cmakeGenerate
@@ -64,6 +71,7 @@ if ["%toCMake%"] == ["1"] (
cmake -G "MinGW Makefiles" ^ cmake -G "MinGW Makefiles" ^
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
-D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^ -D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
-D CMAKE_CXX_FLAGS="%anExtraCxxFlags%" ^
-D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^ -D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^
-D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^ -D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^
-D OpenCASCADE_DIR:PATH="%aDestDirOcct%/lib/cmake/opencascade" ^ -D OpenCASCADE_DIR:PATH="%aDestDirOcct%/lib/cmake/opencascade" ^

View File

@@ -23,6 +23,8 @@ if "%VCVER%" == "vc8" (
call "%VS141COMNTOOLS%/vsvars32.bat" > nul call "%VS141COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc142" ( ) else if "%VCVER%" == "vc142" (
call "%VS142COMNTOOLS%/vsvars32.bat" > nul call "%VS142COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc143" (
call "%VS143COMNTOOLS%/vsvars32.bat" > nul
) else ( ) else (
echo Error: wrong VS identifier echo Error: wrong VS identifier
exit /B exit /B

View File

@@ -14,6 +14,7 @@ if /I "%VCVER%" == "@COMPILER@" (
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@" set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@" set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
set "FFMPEG_DIR=@3RDPARTY_FFMPEG_DLL_DIR@" set "FFMPEG_DIR=@3RDPARTY_FFMPEG_DLL_DIR@"
set "JEMALLOC_DIR=@3RDPARTY_JEMALLOC_LIBRARY_DIR@"
set "OPENVR_DIR=@3RDPARTY_OPENVR_DLL_DIRS@" set "OPENVR_DIR=@3RDPARTY_OPENVR_DLL_DIRS@"
if not "@3RDPARTY_QT_DIR@" == "" ( if not "@3RDPARTY_QT_DIR@" == "" (

View File

@@ -12,6 +12,7 @@ if [ "$1" == "@BIN_LETTER@" ]; then
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@" export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@" export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
export FFMPEG_DIR="@3RDPARTY_FFMPEG_LIBRARY_DIR@" export FFMPEG_DIR="@3RDPARTY_FFMPEG_LIBRARY_DIR@"
export JEMALLOC_DIR="@3RDPARTY_JEMALLOC_LIBRARY_DIR@"
if [ "x@3RDPARTY_QT_DIR" != "x" ]; then if [ "x@3RDPARTY_QT_DIR" != "x" ]; then
export QTDIR="@3RDPARTY_QT_DIR@" export QTDIR="@3RDPARTY_QT_DIR@"

View File

@@ -16,6 +16,7 @@ if /I "%VCVER%" == "@COMPILER@" (
set "TBB_DIR=@USED_3RDPARTY_TBB_DIR@" set "TBB_DIR=@USED_3RDPARTY_TBB_DIR@"
set "VTK_DIR=@USED_3RDPARTY_VTK_DIR@" set "VTK_DIR=@USED_3RDPARTY_VTK_DIR@"
set "FFMPEG_DIR=@USED_3RDPARTY_FFMPEG_DIR@" set "FFMPEG_DIR=@USED_3RDPARTY_FFMPEG_DIR@"
set "JEMALLOC_DIR=@USED_3RDPARTY_JEMALLOC_DIR@"
set "OPENVR_DIR=@USED_3RDPARTY_OPENVR_DIR@" set "OPENVR_DIR=@USED_3RDPARTY_OPENVR_DIR@"
if not "@USED_3RDPARTY_QT_DIR@" == "" ( if not "@USED_3RDPARTY_QT_DIR@" == "" (

View File

@@ -12,6 +12,7 @@ if [ "$1" == "@BIN_LETTER@" ]; then
export TBB_DIR="@USED_3RDPARTY_TBB_DIR@" export TBB_DIR="@USED_3RDPARTY_TBB_DIR@"
export VTK_DIR="@USED_3RDPARTY_VTK_DIR@" export VTK_DIR="@USED_3RDPARTY_VTK_DIR@"
export FFMPEG_DIR="@USED_3RDPARTY_FFMPEG_DIR@" export FFMPEG_DIR="@USED_3RDPARTY_FFMPEG_DIR@"
export JEMALLOC_DIR="@USED_3RDPARTY_JEMALLOC_DIR@"
if [ "x@USED_3RDPARTY_QT_DIR@" != "x" ]; then if [ "x@USED_3RDPARTY_QT_DIR@" != "x" ]; then
export QTDIR="@USED_3RDPARTY_QT_DIR@" export QTDIR="@USED_3RDPARTY_QT_DIR@"

View File

@@ -121,8 +121,12 @@ if not "%DevEnvDir%" == "" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do ( for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\" set "DevEnvDir=%%i\Common7\IDE\"
) )
) else if /I "%VCFMT%" == "vc143" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\"
)
) else if /I "%VCFMT%" == "vclang" ( ) else if /I "%VCFMT%" == "vclang" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do ( for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\" set "DevEnvDir=%%i\Common7\IDE\"
) )
) else if /I "%VCFMT%" == "gcc" ( ) else if /I "%VCFMT%" == "gcc" (
@@ -137,6 +141,7 @@ if not "%DevEnvDir%" == "" (
echo vc14 = VS 2015 echo vc14 = VS 2015
echo vc141 = VS 2017 echo vc141 = VS 2017
echo vc142 = VS 2019 echo vc142 = VS 2019
echo vc143 = VS 2022
echo vclang = VS 2019 with ClangCL toolset echo vclang = VS 2019 with ClangCL toolset
exit /B exit /B
) )
@@ -167,10 +172,15 @@ if /I "%VCFMT%" == "vc9" (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat" set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
) )
set "VCPlatformToolSet=v142" set "VCPlatformToolSet=v142"
) else if /I "%VCFMT%" == "vclang" ( ) else if /I "%VCFMT%" == "vc143" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do ( for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat" set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
) )
set "VCPlatformToolSet=v143"
) else if /I "%VCFMT%" == "vclang" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
set "VCPlatformToolSet=ClangCL" set "VCPlatformToolSet=ClangCL"
) else if /I "%VCFMT%" == "gcc" ( ) else if /I "%VCFMT%" == "gcc" (
rem MinGW rem MinGW

View File

@@ -74,6 +74,10 @@ if not "%DevEnvDir%" == "" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do ( for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\" set "DevEnvDir=%%i\Common7\IDE\"
) )
) else if /I "%VCFMT%" == "vc143" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\"
)
) else if /I "%VCFMT%" == "gcc" ( ) else if /I "%VCFMT%" == "gcc" (
rem MinGW rem MinGW
) else ( ) else (
@@ -107,6 +111,11 @@ if /I "%VCFMT%" == "vc9" (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat" set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
) )
set "VCPlatformToolSet=v142" set "VCPlatformToolSet=v142"
) else if /I "%VCFMT%" == "vc143" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[17.0,17.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
set "VCPlatformToolSet=v142"
) else if /I "%VCFMT%" == "gcc" ( ) else if /I "%VCFMT%" == "gcc" (
rem MinGW rem MinGW
) else ( ) else (
@@ -126,11 +135,16 @@ if ["%ARCH%"] == ["64"] set VCARCH=amd64
if /I ["%1"] == ["vc141"] set "VCVER=vc14" if /I ["%1"] == ["vc141"] set "VCVER=vc14"
if /I ["%1"] == ["vc142"] set "VCVER=vc14" if /I ["%1"] == ["vc142"] set "VCVER=vc14"
if /I ["%1"] == ["vc143"] set "VCVER=vc14"
if exist "%CASROOT%\custom.bat" ( if exist "%CASROOT%\custom.bat" (
call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB% call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB%
) )
if not ["%QTDIR%"] == [""] (
set "PATH=%QTDIR%/bin;%PATH%"
set "QT_PLUGIN_PATH=%QTDIR%/plugins"
)
if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%" if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%"
if not ["%TK_DIR%"] == [""] set "PATH=%TK_DIR%;%PATH%" if not ["%TK_DIR%"] == [""] set "PATH=%TK_DIR%;%PATH%"
if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%" if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
@@ -140,11 +154,8 @@ if not ["%GLES2_DIR%"] == [""] set "PATH=%GLES2_DIR%;%PATH%"
if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%" if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%" if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%" if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%"
if not ["%JEMALLOC_DIR%"] == [""] set "PATH=%JEMALLOC_DIR%;%PATH%"
if not ["%OPENVR_DIR%"] == [""] set "PATH=%OPENVR_DIR%;%PATH%" if not ["%OPENVR_DIR%"] == [""] set "PATH=%OPENVR_DIR%;%PATH%"
if not ["%QTDIR%"] == [""] (
set "PATH=%QTDIR%/bin;%PATH%"
set "QT_PLUGIN_PATH=%QTDIR%/plugins"
)
rem ----- Set path to 3rd party and OCCT libraries ----- rem ----- Set path to 3rd party and OCCT libraries -----
if not "%CSF_OCCTBinPath%" == "" ( if not "%CSF_OCCTBinPath%" == "" (

View File

@@ -69,6 +69,10 @@ if [ "$FFMPEG_DIR" != "" ]; then
THRDPARTY_PATH="${FFMPEG_DIR}:${THRDPARTY_PATH}" THRDPARTY_PATH="${FFMPEG_DIR}:${THRDPARTY_PATH}"
fi fi
if [ "$JEMALLOC_DIR" != "" ]; then
THRDPARTY_PATH="${JEMALLOC_DIR}:${THRDPARTY_PATH}"
fi
if [ "$QTDIR" != "" ]; then if [ "$QTDIR" != "" ]; then
THRDPARTY_PATH="${QTDIR}/lib:${THRDPARTY_PATH}" THRDPARTY_PATH="${QTDIR}/lib:${THRDPARTY_PATH}"
fi fi

View File

@@ -71,6 +71,10 @@ if [ "$FFMPEG_DIR" != "" ]; then
THRDPARTY_PATH="${FFMPEG_DIR}:${THRDPARTY_PATH}" THRDPARTY_PATH="${FFMPEG_DIR}:${THRDPARTY_PATH}"
fi fi
if [ "$JEMALLOC_DIR" != "" ]; then
THRDPARTY_PATH="${JEMALLOC_DIR}:${THRDPARTY_PATH}"
fi
if [ "$QTDIR" != "" ]; then if [ "$QTDIR" != "" ]; then
THRDPARTY_PATH="${QTDIR}/lib:${THRDPARTY_PATH}" THRDPARTY_PATH="${QTDIR}/lib:${THRDPARTY_PATH}"
fi fi

View File

@@ -7,6 +7,7 @@ if exist "%~dp0custom.bat" (
call "@INSTALL_DIR_ABSOLUTE@\@INSTALL_DIR_SCRIPT@\env.bat" %1 %2 %3 call "@INSTALL_DIR_ABSOLUTE@\@INSTALL_DIR_SCRIPT@\env.bat" %1 %2 %3
if /I ["%1"] == ["vc141"] set "VCVER=vc141" if /I ["%1"] == ["vc141"] set "VCVER=vc141"
if /I ["%1"] == ["vc142"] set "VCVER=vc142" if /I ["%1"] == ["vc142"] set "VCVER=vc142"
if /I ["%1"] == ["vc143"] set "VCVER=vc143"
set "BIN_DIR=win%ARCH%\%VCVER%\bind" set "BIN_DIR=win%ARCH%\%VCVER%\bind"
set "LIB_DIR=win%ARCH%\%VCVER%\libd" set "LIB_DIR=win%ARCH%\%VCVER%\libd"

View File

@@ -23,6 +23,8 @@ if "%VCVER%" == "vc8" (
call "%VS141COMNTOOLS%/vsvars32.bat" > nul call "%VS141COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc142" ( ) else if "%VCVER%" == "vc142" (
call "%VS142COMNTOOLS%/vsvars32.bat" > nul call "%VS142COMNTOOLS%/vsvars32.bat" > nul
) else if "%VCVER%" == "vc143" (
call "%VS143COMNTOOLS%/vsvars32.bat" > nul
) else ( ) else (
echo Error: wrong VS identifier echo Error: wrong VS identifier
exit /B exit /B

View File

@@ -100,7 +100,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName> <ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>26812</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel> <FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
__VCMPL32__ __VCMPL32__
@@ -148,7 +148,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>26812</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel> <FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
@@ -196,7 +196,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName> <ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>26812</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel> <FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
__VCMPL64__ __VCMPL64__
@@ -244,7 +244,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>26812</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel> <FloatingPointModel>Precise</FloatingPointModel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>

View File

@@ -95,7 +95,7 @@
<ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName> <ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>26812</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__ <FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@@ -140,7 +140,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>26812</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__ <FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
</ClCompile> </ClCompile>
@@ -185,7 +185,7 @@
<ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName> <ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>26812</DisableSpecificWarnings>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__ <FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@@ -229,7 +229,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>26812</DisableSpecificWarnings>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__ <FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
</ClCompile> </ClCompile>

View File

@@ -43,6 +43,7 @@ configure_file ("${OCCT_OVERVIEW_RESOURCE_DIR}/occt_ug_html.doxyfile" "${OCCT_CO
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_NUMBER = ${OCC_VERSION_STRING_EXT}") file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_NUMBER = ${OCC_VERSION_STRING_EXT}")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nOUTPUT_DIRECTORY = ${OCCT_GENERATED_OVERVIEW_DIR}/.") file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nOUTPUT_DIRECTORY = ${OCCT_GENERATED_OVERVIEW_DIR}/.")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_LOGO = ${OCCT_OVERVIEW_DIR}/resources/occ_logo.png") file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nPROJECT_LOGO = ${OCCT_OVERVIEW_DIR}/resources/occ_logo.png")
file (APPEND ${OCCT_CONFIG_FOR_DOXYGEN} "\nEXAMPLE_PATH = ${CMAKE_SOURCE_DIR}/src")
set (OCCT_ARTICLE_PARAM_INPUT "INPUT =") set (OCCT_ARTICLE_PARAM_INPUT "INPUT =")
set (OCCT_ARTICLE_PARAM_IMAGEPATH "IMAGE_PATH = ${OCCT_OVERVIEW_DIR}/resources/ ") set (OCCT_ARTICLE_PARAM_IMAGEPATH "IMAGE_PATH = ${OCCT_OVERVIEW_DIR}/resources/ ")

View File

@@ -12,14 +12,19 @@ samples/samples.md
../samples/CSharp/ReadMe.md ../samples/CSharp/ReadMe.md
../samples/CSharp/ReadMe_D3D.md ../samples/CSharp/ReadMe_D3D.md
../samples/qt/AndroidQt/ReadMe.md ../samples/qt/AndroidQt/ReadMe.md
../samples/qt/IESample/ReadMe.md
../samples/qt/OCCTOverview/ReadMe.md ../samples/qt/OCCTOverview/ReadMe.md
../samples/qt/Tutorial/ReadMe.md
../samples/java/jniviewer/ReadMe.md ../samples/java/jniviewer/ReadMe.md
../samples/ios/UIKitSample/ReadMe.md ../samples/ios/UIKitSample/ReadMe.md
../samples/webgl/ReadMe.md ../samples/webgl/ReadMe.md
../samples/glfw/readme.md
samples/ocaf.md samples/ocaf.md
samples/ocaf_func.md samples/ocaf_func.md
samples/draw_scripts.md samples/draw_scripts.md
samples/ais_object.md
samples/novice_guide.md
tutorial/tutorial.md tutorial/tutorial.md
build/build_upgrade.md build/build_upgrade.md
@@ -40,6 +45,7 @@ user_guides/visualization/visualization.md
user_guides/iges/iges.md user_guides/iges/iges.md
user_guides/step/step.md user_guides/step/step.md
user_guides/xde/xde.md user_guides/xde/xde.md
user_guides/de_wrapper/de_wrapper.md
user_guides/ocaf/ocaf.md user_guides/ocaf/ocaf.md
user_guides/draw_test_harness/draw_test_harness.md user_guides/draw_test_harness/draw_test_harness.md
user_guides/inspector/inspector.md user_guides/inspector/inspector.md

View File

@@ -6,6 +6,8 @@
tutorial/tutorial.md tutorial/tutorial.md
samples/novice_guide.md
upgrade/upgrade.md upgrade/upgrade.md
user_guides/foundation_classes/foundation_classes.md user_guides/foundation_classes/foundation_classes.md
@@ -18,6 +20,7 @@ user_guides/vis/vis.md
user_guides/iges/iges.md user_guides/iges/iges.md
user_guides/step/step.md user_guides/step/step.md
user_guides/xde/xde.md user_guides/xde/xde.md
user_guides/de_wrapper/de_wrapper.md
user_guides/inspector/inspector.md user_guides/inspector/inspector.md
user_guides/draw_test_harness/draw_test_harness.md user_guides/draw_test_harness/draw_test_harness.md

View File

@@ -2,60 +2,48 @@
============================================== ==============================================
@tableofcontents @tableofcontents
On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from https://opencascade.com/content/3rd-party-components. On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from https://dev.opencascade.org/resources/download/3rd-party-components.
On Linux and OS X, it is recommended to use the version installed in the system natively. On Linux and macOS, it is recommended to use the version installed in the system natively.
@section dev_guides__building_3rdparty_win_1 Windows @section dev_guides__building_3rdparty_win_1 Windows
This document presents guidelines for building third-party products used by Open CASCADE Technology (OCCT) and samples on Windows platform. It is assumed that you are already familiar with MS Visual Studio / Visual C++. This section presents guidelines for building third-party products used by Open CASCADE Technology (OCCT) and samples on Windows platform.
It is assumed that you are already familiar with MS Visual Studio / Visual C++.
You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of run-time binaries. You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of runtime binaries.
The links for downloading the third-party products are available at https://opencascade.com/content/3rd-party-components. It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, `c:/occ3rdparty`).
Further in this document, this folder is referred to as `3rdparty`.
There are two types of third-party products used by OCCT:
* Mandatory products:
* Tcl/Tk 8.5 -- 8.6;
* FreeType 2.4.10 -- 2.5.3.
* Optional products:
* TBB 3.x -- 4.x;
* FreeImage 3.14.1 -- 3.16.0;
* VTK 6.1.0.
It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, *c:\\occ3rdparty*).
Further in this document, this folder is referred to as *3rdparty*.
@subsection dev_guides__building_3rdparty_win_2 Tcl/Tk @subsection dev_guides__building_3rdparty_win_2 Tcl/Tk
Tcl/Tk is required for DRAW test harness. Tcl/Tk is required for DRAW test harness.
**Installation from sources: Tcl** **Installation from sources: Tcl**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. In the *win* sub-directory, edit file *buildall.vc.bat*: 1. In the `win` sub-directory, edit file `buildall.vc.bat`:
* Edit the line "call ... vcvars32.bat" to have correct path to the version of Visual Studio to be used for building, for instance: * Edit the line `"call ... vcvars32.bat"` to have correct path to the version of Visual Studio to be used for building, for instance:
call "%VS80COMNTOOLS%\vsvars32.bat" call "%VS80COMNTOOLS%\vsvars32.bat"
If you are building 64-bit version, set environment accordingly, e.g.: If you are building 64-bit version, set environment accordingly, e.g.:
call "%VS80COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64 call "%VS80COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
* Define variable *INSTALLDIR* pointing to directory where Tcl/Tk will be installed, e.g.: * Define variable `INSTALLDIR` pointing to directory where Tcl/Tk will be installed, e.g.:
set INSTALLDIR=D:\OCCT\3rdparty\tcltk-86-32 set INSTALLDIR=D:\OCCT\3rdparty\tcltk-86-32
* Add option *install* to the first command line calling *nmake*: * Add option `install` to the first command line calling `nmake`:
nmake -nologo -f makefile.vc release htmlhelp install %1 nmake -nologo -f makefile.vc release htmlhelp install %1
* Remove second call to *nmake* (building statically linked executable) * Remove second call to `nmake` (building statically linked executable)
2. Edit file *rules.vc* replacing line 2. Edit file `rules.vc` replacing line
SUFX = tsgx SUFX = tsgx
@@ -65,21 +53,18 @@ Download the necessary archive from https://www.tcl.tk/software/tcltk/download.h
This is to avoid extra prefix 't' in the library name, which is not recognized by default by OCCT build tools. This is to avoid extra prefix 't' in the library name, which is not recognized by default by OCCT build tools.
3. By default, Tcl uses dynamic version of run-time library (MSVCRT), which must be installed on the system where Tcl will be used. 3. By default, Tcl uses dynamic version of run-time library (MSVCRT), which must be installed on the system where Tcl will be used.
You may wish to link Tcl library with static version of run-time to avoid this dependency. You may wish to link Tcl library with static version of run-time to avoid this dependency.
For that: For that:
* Edit file *makefile.vc* replacing strings "crt = -MD" by "crt = -MT" * Edit file `makefile.vc` replacing strings `"crt = -MD"` by `"crt = -MT"`
* Edit source file *tclMain.c* (located in folder *generic*) commenting out forward declaration of function *isatty()*. * Edit source file `tclMain.c` (located in folder `generic`) commenting out forward declaration of function `isatty()`.
4. In the command prompt, run `buildall.vc.bat`<br>
You might need to run this script twice to have `tclsh` executable installed; check subfolder `bin` of specified installation path to verify this.
4. In the command prompt, run *buildall.vc.bat* 5. For convenience of use, we recommend making a copy of `tclsh` executable created in subfolder `bin` of `INSTALLDIR` and named with Tcl version number suffix, as `tclsh.exe` (with no suffix)
You might need to run this script twice to have *tclsh* executable installed; check subfolder *bin* of specified installation path to verify this.
5. For convenience of use, we recommend making a copy of *tclsh* executable created in subfolder *bin* of *INSTALLDIR* and named with Tcl version number suffix, as *tclsh.exe* (with no suffix)
> cd D:\OCCT\3rdparty\tcltk-86-32\bin > cd D:\OCCT\3rdparty\tcltk-86-32\bin
> cp tclsh86.exe tclsh.exe > cp tclsh86.exe tclsh.exe
@@ -87,339 +72,304 @@ Download the necessary archive from https://www.tcl.tk/software/tcltk/download.h
**Installation from sources: Tk** **Installation from sources: Tk**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
Apply the same steps as described for building Tcl above, with the same `INSTALLDIR`.
Note that Tk produces its own executable, called `wish`.
Apply the same steps as described for building Tcl above, with the same INSTALLDIR. You might need to edit default value of `TCLDIR` variable defined in `buildall.vc.bat` (should be not necessary if you unpack both Tcl and Tk sources in the same folder).
Note that Tk produces its own executable, called *wish*.
You might need to edit default value of *TCLDIR* variable defined in *buildall.vc.bat* (should be not necessary if you unpack both Tcl and Tk sources in the same folder).
@subsection dev_guides__building_3rdparty_win_2_2 FreeType @subsection dev_guides__building_3rdparty_win_2_2 FreeType
FreeType is required for text display in a 3D viewer. You can download its sources from https://sourceforge.net/projects/freetype/files/ FreeType is required for text display in a 3D viewer.
You can download its sources from https://freetype.org/
### The building procedure 1. Unpack the downloaded archive of FreeType product into the `3rdparty` folder.
As a result, you will get a folder named, for example, `3rdparty/freetype-2.4.10`.
Further in this document, this folder is referred to as `freetype`.
1. Unpack the downloaded archive of FreeType product into the *3rdparty* folder. As a result, you will get a folder named, for example, *3rdparty\\freetype-2.4.10*. Further in this document, this folder is referred to as *freetype*. 2. Open the solution file `freetype/builds/win32/vc20xx/freetype.sln` in Visual Studio.
Here `vc20xx` stands for your version of Visual Studio.
2. Open the solution file *freetype\\builds\\win32\\vc20xx\\freetype.sln* in Visual Studio. Here *vc20xx* stands for your version of Visual Studio.
3. Select the configuration to build: either Debug or Release. 3. Select the configuration to build: either `Debug` or `Release`.
4. Build the *freetype* project. 4. Build the `freetype` project.<br>
As a result, you will get a `freetype` import library (`.lib`) in the `freetype/obj/win32/vc20xx` folder.
As a result, you will get a freetype import library (.lib) in the *freetype\\obj\\win32\\vc20xx* folder. 5. If you build FreeType for a 64 bit platform, select in the main menu `Build - Configuration Manager`
and add `x64` platform to the solution configuration by copying the settings from `Win32` platform:
5. If you build FreeType for a 64 bit platform, select in the main menu **Build - Configuration Manager** and add *x64* platform to the solution configuration by copying the settings from Win32 platform:
@figure{/build/build_3rdparty/images/3rdparty_image001.png} @figure{/build/build_3rdparty/images/3rdparty_image001.png}
Update the value of the Output File for x64 configuration: Update the value of the Output File for `x64` configuration:
@figure{/build/build_3rdparty/images/3rdparty_image003.png} @figure{/build/build_3rdparty/images/3rdparty_image003.png}
Build the *freetype* project. Build the `freetype` project.<br>
As a result, you will obtain a 64 bit import library (`.lib`) file in the `freetype/x64/vc20xx` folder.
To build FreeType as a dynamic library (`.dll`) follow steps 6, 7 and 8 of this procedure.
As a result, you will obtain a 64 bit import library (.lib) file in the *freetype\\x64\\vc20xx* folder. 6. Open menu Project-> Properties-> Configuration Properties-> General and change option `Configuration Type` to `Dynamic Library (.dll)`.
7. Edit file `freetype/include/freetype/config/ftoption.h`:<br>
in line 255, uncomment the definition of macro `FT_EXPORT` and change it as follows:
To build FreeType as a dynamic library (.dll) follow steps 6, 7 and 8 of this procedure. #define FT_EXPORT(x) __declspec(dllexport) x
6. Open menu Project-> Properties-> Configuration Properties-> General and change option **Configuration Type** to *Dynamic Library (.dll)*. 8. Build the `freetype` project.<br>
7. Edit file *freetype\\include\\freetype\\config\\ftoption.h*: As a result, you will obtain the files of the import library (`.lib`) and the dynamic library (`.dll`) in folders `freetype/objs/release` or `freetype/objs/debug`.
If you build for a 64 bit platform, follow step 5 of the procedure.
in line 255, uncomment the definition of macro *FT_EXPORT* and change it as follows:
#define FT_EXPORT(x) __declspec(dllexport) x To facilitate the use of FreeType libraries in OCCT with minimal adjustment of build procedures,
it is recommended to copy the include files and libraries of FreeType into a separate folder, named according to the pattern `freetype-compiler-bitness-building mode`, where:
8. Build the *freetype* project. * `compiler` is `vc8` or `vc9` or `vc10` or `vc11`;
* `bitness` is `32` or `64`;
As a result, you will obtain the files of the import library (.lib) and the dynamic library (.dll) in folders <i>freetype \\objs\\release</i> or <i>\\objs\\debug </i>. * `building mode` is `opt` (for `Release`) or `deb` (for `Debug`).
If you build for a 64 bit platform, follow step 5 of the procedure.
To facilitate the use of FreeType libraries in OCCT with minimal adjustment of build procedures, it is recommended to copy the include files and libraries of FreeType into a separate folder, named according to the pattern: *freetype-compiler-bitness-building mode*, where:
* **compiler** is *vc8* or *vc9* or *vc10* or *vc11*;
* **bitness** is *32* or *64*;
* **building mode** is *opt* (for Release) or *deb* (for Debug).
The *include* subfolder should be copied as is, while libraries should be renamed to *freetype.lib* and *freetype.dll* (suffixes removed) and placed to subdirectories *lib *and *bin*, respectively. If the Debug configuration is built, the Debug libraries should be put into subdirectories *libd* and *bind*.
The `include` subfolder should be copied as is, while libraries should be renamed to `freetype.lib` and `freetype.dll` (suffixes removed) and placed to subdirectories `lib` and `bin`, respectively.
If the `Debug` configuration is built, the Debug libraries should be put into subdirectories `libd` and `bind`.
@subsection dev_guides__building_3rdparty_win_3_1 TBB @subsection dev_guides__building_3rdparty_win_3_1 TBB
This third-party product is installed with binaries This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
from the archive that can be downloaded from https://github.com/intel/tbb. Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Windows platform.
Go to the **Download** page, find the release version you need (e.g. *tbb30_018oss*) and pick the archive for Windows platform. To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-win.zip`)
Unpack the downloaded archive of TBB product into the *3rdparty* folder. Unpack the downloaded archive of TBB product into the `3rdparty` folder.
Further in this document, this folder is referred to as *tbb*. Further in this document, this folder is referred to as `tbb`.
@subsection dev_guides__building_3rdparty_win_3_3 FreeImage @subsection dev_guides__building_3rdparty_win_3_3 FreeImage
This third-party product should be built as a dynamically loadable library (.dll file). This third-party product should be built as a dynamically loadable library (`.dll` file).
You can download its sources from You can download its sources from
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
### The building procedure: 1. Unpack the downloaded archive of FreeImage product into `3rdparty` folder.<br>
As a result, you should have a folder named `3rdparty/FreeImage`.
Rename it according to the rule: `freeimage-platform-compiler-building mode`, where
1. Unpack the downloaded archive of FreeImage product into *3rdparty* folder. * `platform` is `win32` or `win64`;
* `compiler` is `vc8` or `vc9` or `vc10` or `vc11`;
As a result, you should have a folder named *3rdparty\\FreeImage*. * `building mode` is *opt* (for release) or `deb` (for debug)
Rename it according to the rule: *freeimage-platform-compiler-building mode*, where
* **platform** is *win32* or *win64*;
* **compiler** is *vc8* or *vc9* or *vc10* or *vc11*;
* **building mode** is *opt* (for release) or *deb* (for debug)
Further in this document, this folder is referred to as *freeimage*. Further in this document, this folder is referred to as `freeimage`.
2. Open the solution file *freeimage\\FreeImage.*.sln* in your Visual Studio. 2. Open the solution file `freeimage/FreeImage.*.sln` in your Visual Studio.<br>
If you use a Visual Studio version higher than VC++ 2008, apply conversion of the workspace.
If you use a Visual Studio version higher than VC++ 2008, apply conversion of the workspace. Such conversion should be suggested automatically by Visual Studio.
Such conversion should be suggested automatically by Visual Studio.
3. Select a configuration to build.
- Choose **Release** if you are building Release binaries. 3. Select a configuration to build.
- Choose **Debug** if you are building Debug binaries. - Choose `Release` if you are building Release binaries.
- Choose `Debug` if you are building Debug binaries.
*Note:* *Note:*
If you want to build a debug version of FreeImage binaries then you need to rename the following files in FreeImage projects:
If you want to build a debug version of FreeImage binaries then you need to rename the following files in FreeImage and FreeimagePlus projects:
Project -> Properties -> Configuration Properties -> Linker -> General -> Output File Project -> Properties -> Configuration Properties -> Linker -> General -> Output File
FreeImage*d*.dll to FreeImage.dll FreeImage*d*.dll to FreeImage.dll
FreeImagePlus*d*.dll to FreeImagePlus.dll
Project -> Properties -> Configuration Properties -> Linker -> Debugging-> Generate Program Database File Project -> Properties -> Configuration Properties -> Linker -> Debugging-> Generate Program Database File
FreeImage*d*.pdb to FreeImage.pdb FreeImage*d*.pdb to FreeImage.pdb
FreeImagePlus*d*.pdb to FreeImagePlus.pdb
Project -> Properties -> Configuration Properties -> Linker -> Advanced-Import Library Project -> Properties -> Configuration Properties -> Linker -> Advanced-Import Library
FreeImage*d*.lib to FreeImage.lib FreeImage*d*.lib to FreeImage.lib
FreeImagePlus*d*.lib to FreeImagePlus.lib
Project -> Properties -> Configuration Properties -> Build Events -> Post -> Build Event -> Command Line Project -> Properties -> Configuration Properties -> Build Events -> Post -> Build Event -> Command Line
FreeImage*d*.dll to FreeImage.dll FreeImage*d*.dll to FreeImage.dll
FreeImage*d*.lib to FreeImage.lib FreeImage*d*.lib to FreeImage.lib
FreeImagePlus*d*.dll to FreeImagePlus.dll
FreeImagePlus*d*.lib to FreeImagePlus.lib
Additionally, rename in project FreeImagePlus Additionally, rename in project FreeImagePlus
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
from FreeImage*d*.lib to FreeImage.lib Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
4. Select a platform to build. from FreeImage*d*.lib to FreeImage.lib
- Choose *Win32* if you are building for a 32 bit platform. 4. Select a platform to build.
- Choose *x64* if you are building for a 64 bit platform. - Choose `Win32` if you are building for a 32 bit platform.
- Choose `x64` if you are building for a 64 bit platform.
5. Start the building process. 5. Start the building process.<br>
As a result, you should have the library files of FreeImage product in `freeimage/Dist` folder (`FreeImage.dll` and `FreeImage.lib`).
As a result, you should have the library files of FreeImage product in *freeimage\\Dist* folder (*FreeImage.dll* and *FreeImage.lib*) and in *freeimage\\Wrapper\\FreeImagePlus\\dist* folder (*FreeImagePlus.dll* and *FreeImagePlus.lib*).
@subsection dev_guides__building_3rdparty_win_3_4 VTK @subsection dev_guides__building_3rdparty_win_3_4 VTK
VTK is an open-source, freely available software system for 3D computer graphics, image processing and visualization. VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library. VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library.
### The building procedure: 1. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it into `3rdparty` folder.<br>
As a result, you will get a folder named, for example, `3rdparty/VTK-6.1.0`.
1. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it into *3rdparty* folder. Further in this document, this folder is referred to as `VTK`.
As a result, you will get a folder named, for example, <i>3rdparty\VTK-6.1.0.</i>
Further in this document, this folder is referred to as *VTK*.
2. Use CMake to generate VS projects for building the library: 2. Use CMake to generate VS projects for building the library:
- Start CMake-GUI and select VTK folder as source path, and the folder of your choice for VS project and intermediate build data. - Start CMake-GUI and select `VTK` folder as source path, and the folder of your choice for VS project and intermediate build data.
- Click **Configure**. - Click **Configure**.
- Select the VS version to be used from the ones you have installed (we recommend using VS 2010) and the architecture (32 or 64-bit). - Select the VS version to be used from the ones you have installed (we recommend using VS 2015) and the architecture (32 or 64-bit).
- Generate VS projects with default CMake options. The open solution *VTK.sln* will be generated in the build folder. - Generate VS projects with default CMake options. The open solution `VTK.sln` will be generated in the build folder.
3. Build project VTK in Release mode. 3. Build project VTK in Release mode.
@section build_3rdparty_linux Linux @section build_3rdparty_linux Linux
This document presents additional guidelines for building third-party This section presents additional guidelines for building third-party products used by Open CASCADE Technology and samples on Linux platform.
products used by Open CASCADE Technology and samples on Linux platform.
The links for downloading the third-party products are available on the web site at
https://opencascade.com/content/3rd-party-components.
There are two types of third-party products, which are necessary to build OCCT:
* Mandatory products:
* Tcl/Tk 8.5 - 8.6;  
* FreeType 2.4.10 - 2.5.3;
* Optional products:
* TBB 3.x - 4.x;
* FreeImage 3.14.1 - 3.16.0;
* VTK 6.1.0.
@subsection dev_guides__building_3rdparty_linux_4 Installation From Official Repositories @subsection dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
**Debian-based distributives** **Debian-based distributives**
All 3rd-party products required for building of OCCT could be installed All 3rd-party products required for building of OCCT could be installed from official repositories.
from official repositories. You may install them from console using apt-get utility: You may install them from console using apt-get utility:
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libx11-dev libgl1-mesa-dev libfreeimage-dev rapidjson-dev sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libx11-dev libgl1-mesa-dev libfreeimage-dev
sudo apt-get install rapidjson-dev libdraco-dev
Building is possible with C++ compliant compiler: Building is possible with C++ compliant compiler:
sudo apt-get install g++ sudo apt-get install g++
@subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk @subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
Tcl/Tk is required for DRAW test harness. Tcl/Tk is required for DRAW test harness.
**Installation from sources: Tcl** **Installation from sources: Tcl**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the unix sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>.
cd TCL_SRC_DIR/unix 1. Enter the `unix` sub-directory of the directory where the Tcl source files are located (`TCL_SRC_DIR`).
2. Run the *configure* command: cd TCL_SRC_DIR/unix
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR 2. Run the `configure` command:
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line. configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
3. If the configure command has finished successfully, start the building process:
make
4. If building is finished successfully, start the installation of Tcl. For a 64 bit platform also add `--enable-64bit` option to the command line.
All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*
make install 3. If the configure command has finished successfully, start the building process:
make
4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by `TCL_INSTALL_DIR`
make install
**Installation from sources: Tk** **Installation from sources: Tk**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the unix sub-directory of the directory where the Tk source files are located <i>(TK_SRC_DIR)</i> 1. Enter the `unix` sub-directory of the directory where the Tk source files are located (`TK_SRC_DIR`)
cd TK_SRC_DIR/unix cd TK_SRC_DIR/unix
2. Run the configure command, where <i>TCL_LIB_DIR</i> is *TCL_INSTALL_DIR/lib*. 2. Run the `configure` command, where `TCL_LIB_DIR` is `TCL_INSTALL_DIR/lib`.
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line. For a 64 bit platform also add `--enable-64bit` option to the command line.
3. If the configure command has finished successfully, start the building process: 3. If the configure command has finished successfully, start the building process:
make make
4. If the building has finished successfully, start the installation of Tk. 4. If the building has finished successfully, start the installation of Tk.
All binary and service files of the product will be copied All binary and service files of the product will be copied
to the directory defined by *TK_INSTALL_DIR* (usually it is *TCL_INSTALL_DIR*) to the directory defined by `TK_INSTALL_DIR` (usually it is `TCL_INSTALL_DIR`)
make install make install
@subsection dev_guides__building_3rdparty_linux_2_2 FreeType @subsection dev_guides__building_3rdparty_linux_2_2 FreeType
FreeType is required for text display in the 3D viewer. FreeType is required for text display in the 3D viewer.
Download the necessary archive from https://sourceforge.net/projects/freetype/files/ and unpack it. Download the necessary archive from https://freetype.org/ and unpack it.
1. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>. 1. Enter the directory where the source files of FreeType are located (`FREETYPE_SRC_DIR`).
cd FREETYPE_SRC_DIR cd FREETYPE_SRC_DIR
2. Run the *configure* command: 2. Run the `configure` command:
configure --prefix=FREETYPE_INSTALL_DIR
For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line. configure --prefix=FREETYPE_INSTALL_DIR
3. If the *configure* command has finished successfully, start the building process:
make For a 64 bit platform also add `CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'` option to the command line.
4. If the building has finished successfully, start the installation of FreeType. 3. If the `configure` command has finished successfully, start the building process:
All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*
make
make install
4. If the building has finished successfully, start the installation of FreeType.
All binary and service files of the product will be copied to the directory defined by `FREETYPE_INSTALL_DIR`
make install
@subsection dev_guides__building_3rdparty_linux_3_1 TBB @subsection dev_guides__building_3rdparty_linux_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb. This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need and pick the archive for Linux platform. Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product. To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-lin.tgz`).
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage @subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
Download the necessary archive from https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ Download the necessary archive from https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ and unpack it.
and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*. The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DIR`.
1. Modify *FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h*:
In line 60 insert the following:
#include string.h 1. Modify `FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h`:<br>
In line 60 insert the following:
2. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>. #include string.h
cd FREEIMAGE_SRC_DIR
3. Run the building process 2. Enter the directory where the source files of FreeImage are located (`FREEIMAGE_SRC_DIR`).
make
4. Run the installation process cd FREEIMAGE_SRC_DIR
a. If you have the permission to write into directories <i>/usr/include</i> and <i>/usr/lib</i>, run the following command: 3. Run the building process
make
4. Run the installation process
a. If you have the permission to write into directories `/usr/include` and `/usr/lib`, run the following command:
make install
b. If you do not have this permission, you need to modify file `FREEIMAGE_SRC_DIR/Makefile.gnu`:
make install
b. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.gnu*:
Change lines 7-9 from: Change lines 7-9 from:
DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib
to: DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib
DESTDIR ?= $(DESTDIR)
INCDIR ?= $(DESTDIR)/include
INSTALLDIR ?= $(DESTDIR)/lib
Change lines 65-67 from:
install -m 644 -o root -g root $(HEADER) $(INCDIR)
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
to: to:
install -m 755 $(HEADER) $(INCDIR) DESTDIR ?= $(DESTDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR) INCDIR ?= $(DESTDIR)/include
INSTALLDIR ?= $(DESTDIR)/lib
Change lines 65-67 from:
install -m 644 -o root -g root $(HEADER) $(INCDIR)
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
to:
install -m 755 $(HEADER) $(INCDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR)
install -m 755 $(SHAREDLIB) $(INSTALLDIR) install -m 755 $(SHAREDLIB) $(INSTALLDIR)
Change line 70 from:  Change line 70 from:
ldconfig ldconfig
to: to:
\#ldconfig \#ldconfig
Then run the installation process by the following command:
make DESTDIR=FREEIMAGE_INSTALL_DIR install Then run the installation process by the following command:
make DESTDIR=FREEIMAGE_INSTALL_DIR install
5. Clean temporary files 5. Clean temporary files
@@ -427,201 +377,180 @@ and unpack it. The directory with unpacked sources is further referred to as *F
@subsection dev_guides__building_3rdparty_linux_3_4 VTK @subsection dev_guides__building_3rdparty_linux_3_4 VTK
You can download VTK sources from https://www.vtk.org/VTK/resources/software.html
### The building procedure:
Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it.
1. Install or build *cmake* product from the source file. 1. Install or build `cmake` product from the source file.
2. Start *cmake* in GUI mode with the directory where the source files of *VTK* are located: 2. Start `cmake` in GUI mode with the directory where the source files of *VTK* are located:
ccmake VTK_SRC_DIR ccmake VTK_SRC_DIR
* Press <i>[c]</i> to make the initial configuration * Press `[c]` to make the initial configuration
* Define the necessary options in *VTK_INSTALL_PREFIX* * Define the necessary options in `VTK_INSTALL_PREFIX`
* Press <i>[c]</i> to make the final configuration * Press `[c]` to make the final configuration
* Press <i>[g]</i> to generate Makefile and exit * Press `[g]` to generate `Makefile` and exit
3. Start the building of VTK: 3. Start the building of VTK:
make make
4. Start the installation of VTK. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option. 4. Start the installation of VTK. Binaries will be installed according to the `VTK_INSTALL_PREFIX` option.
make install make install
@section build_3rdparty_macos Mac OS X @section build_3rdparty_macos Mac OS X
This document presents additional guidelines for building third-party products This section presents additional guidelines for building third-party products
used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later). used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later).
The links for downloading the third-party products are available at https://opencascade.com/content/3rd-party-components. @subsection dev_guides__building_3rdparty_osx_2_1 Tcl/Tk
There are two types of third-party products, which are necessary to build OCCT: Tcl/Tk is required for DRAW test harness.
* Mandatory products:
* Tcl/Tk 8.5 - 8.6;
* FreeType 2.4.10 - 2.5.3.
* Optional products:
* TBB 3.x - 4.x;
* FreeImage 3.14.1 - 3.16.0
@subsection dev_guides__building_3rdparty_osx_2_1 Tcl/Tk 8.5 **Installation from sources: Tcl**
Tcl/Tk is required for DRAW test harness. Version 8.5 or 8.6 can be used with OCCT.
**Installation from sources: Tcl 8.5**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the *macosx* sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>. 1. Enter the `macosx` sub-directory of the directory where the Tcl source files are located (`TCL_SRC_DIR`).
cd TCL_SRC_DIR/macosx cd TCL_SRC_DIR/macosx
2. Run the *configure* command 2. Run the `configure` command
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line. For a 64 bit platform also add `--enable-64bit` option to the command line.
3. If the *configure* command has finished successfully, start the building process 3. If the `configure` command has finished successfully, start the building process
make make
4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*.
make install 4. If building is finished successfully, start the installation of Tcl.
All binary and service files of the product will be copied to the directory defined by `TCL_INSTALL_DIR`.
**Installation from sources: Tk 8.5** make install
**Installation from sources: Tk**
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it. Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
1. Enter the *macosx* sub-directory of the directory where the source files of Tk are located <i>(TK_SRC_DIR)</i>. 1. Enter the `macosx` sub-directory of the directory where the source files of Tk are located (`TK_SRC_DIR`).
cd TK_SRC_DIR/macosx cd TK_SRC_DIR/macosx
2. Run the *configure* command, where TCL_LIB_DIR is TCL_INSTALL_DIR/lib 2. Run the `configure` command, where `TCL_LIB_DIR` is `TCL_INSTALL_DIR/lib`
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line. For a 64 bit platform also add `--enable-64bit` option to the command line.
3. If the *configure* command has finished successfully, start the building process: 3. If the `configure` command has finished successfully, start the building process:
make make
4. If the building has finished successfully, start the installation of Tk. All binary and service files of the product will be copied to the directory defined by *TK_INSTALL_DIR* (usually it is TCL_INSTALL_DIR) 4. If the building has finished successfully, start the installation of Tk.
All binary and service files of the product will be copied to the directory defined by `TK_INSTALL_DIR` (usually it is `TCL_INSTALL_DIR`).
make install make install
@subsection dev_guides__building_3rdparty_osx_2_2 FreeType 2.4.10 @subsection dev_guides__building_3rdparty_osx_2_2 FreeType
FreeType is required for text display in the 3D viewer.
Download the necessary archive from https://sourceforge.net/projects/freetype/files/ and unpack it. FreeType is required for text display in the 3D viewer.
Download the necessary archive from https://freetype.org/ and unpack it.
1. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>. 1. Enter the directory where the source files of FreeType are located (`FREETYPE_SRC_DIR`).
cd FREETYPE_SRC_DIR cd FREETYPE_SRC_DIR
2. Run the *configure* command 2. Run the `configure` command
configure --prefix=FREETYPE_INSTALL_DIR
For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line. configure --prefix=FREETYPE_INSTALL_DIR
3. If the *configure* command has finished successfully, start the building process For a 64 bit platform also add `CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'` option to the command line.
make 3. If the `configure` command has finished successfully, start the building process
4. If building has finished successfully, start the installation of FreeType. make
All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*.
make install 4. If building has finished successfully, start the installation of FreeType.
All binary and service files of the product will be copied to the directory defined by `FREETYPE_INSTALL_DIR`.
@subsection dev_guides__building_3rdparty_osx_3_1 TBB 3.x or 4.x
This third-party product is installed with binaries from the archive make install
that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need (e.g. *tbb30_018oss*)
and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB 3.0 product (*tbb30_018oss_osx.tgz*).
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage 3.14.1 or 3.15.x @subsection dev_guides__building_3rdparty_osx_3_1 TBB
Download the necessary archive from This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-mac.tgz`).
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage
Download the necessary archive from
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*. and unpack it. The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DIR`.
Note that for building FreeImage on Mac OS X 10.7 you should replace *Makefile.osx* Note that for building FreeImage on Mac OS X 10.7 you should replace `Makefile.osx`
in *FREEIMAGE_SRC_DIR* by the corrected file, which you can find in attachment to issue #22811 in OCCT Mantis bug tracker in `FREEIMAGE_SRC_DIR` by the corrected file, which you can find in attachment to issue [`#22811`](https://tracker.dev.opencascade.org/file_download.php?file_id=6937&type=bug) in OCCT Mantis bug tracker.
(https://tracker.dev.opencascade.org/file_download.php?file_id=6937&type=bug).
1. If you build FreeImage 3.15.x you can skip this step. 1. If you build FreeImage 3.15.x you can skip this step.
Modify <i>FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:</i>
In line 60 insert the following:
#include string.h Modify `FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:`<br>
In line 60 insert the following:
Modify <i>FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp:</i> #include string.h
In line 320 replace:
SwapShort(value); Modify `FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp`:<br>
In line 320 replace:
with: SwapShort(value);
SwapShort(&value); with:
2. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>. SwapShort(&value);
cd FREEIMAGE_SRC_DIR 2. Enter the directory where the source files of FreeImage are located (`FREEIMAGE_SRC_DIR`).
cd FREEIMAGE_SRC_DIR
3. Run the building process 3. Run the building process
make make
4. Run the installation process 4. Run the installation process
1. If you have the permission to write into <i>/usr/local/include</i> and <i>/usr/local/lib</i> directories, run the following command:
make install 1. If you have the permission to write into `/usr/local/include` and `/usr/local/lib` directories, run the following command:
2. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.osx*: make install
Change line 49 from:    2. If you do not have this permission, you need to modify file `FREEIMAGE_SRC_DIR/Makefile.osx`:<br>
Change line 49 from:
PREFIX ?= /usr/local PREFIX ?= /usr/local
to: to:
PREFIX ?= $(PREFIX)
  Change lines 65-69 from: PREFIX ?= $(PREFIX)
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)   Change lines 65-69 from:
install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
ranlib -sf $(INSTALLDIR)/$(STATICLIB)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
to:
install -d $(INCDIR) $(INSTALLDIR) install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
install -m 755 $(HEADER) $(INCDIR) install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR) install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
install -m 755 $(SHAREDLIB) $(INSTALLDIR) ranlib -sf $(INSTALLDIR)/$(STATICLIB)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME) ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
to:
install -d $(INCDIR) $(INSTALLDIR)
install -m 755 $(HEADER) $(INCDIR)
install -m 755 $(STATICLIB) $(INSTALLDIR)
install -m 755 $(SHAREDLIB) $(INSTALLDIR)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME) ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
Then run the installation process by the following command: Then run the installation process by the following command:
make PREFIX=FREEIMAGE_INSTALL_DIR install make PREFIX=FREEIMAGE_INSTALL_DIR install
5. Clean temporary files 5. Clean temporary files
make clean make clean

View File

@@ -3,29 +3,25 @@ Build OCCT {#build_upgrade__building_occt}
@tableofcontents @tableofcontents
@note Before building OCCT, make sure to have all required third-party libraries installed. Before building OCCT, make sure to have all required third-party libraries installed.
The list of required libraries depends on what OCCT modules will be used, and your preferences. The list of required libraries depends on what OCCT modules will be used, and your preferences.
The typical minimum is **Freetype** (necessary for Visualization) and **Tcl/Tk** (for DRAW). The typical minimum is **FreeType** (necessary for Visualization) and **Tcl/Tk** (for DRAW).
See @ref intro_req "requirements on 3rdparty libraries" for a full list. See @ref intro_req "requirements on 3rdparty libraries" for a full list.
On OS X we recommend to use native libraries.
@section build_occt_windows Windows The easiest way to install third-party libraries is to download archive with pre-built binaries, corresponding to your target configuration,
from [Development Portal](https://dev.opencascade.org/resources/download/3rd-party-components).
You can also build third-party libraries from their sources, see @ref build_upgrade_building_3rdparty for instructions.
@subsection build_occt_win_cmake Building with CMake tool On Linux and macOS we recommend to use libraries maintained by distributive developers, when possible.
This article describes the **CMake**-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources. *OCCT requires CMake version 2.8.12 or later*. @section build_occt_win_cmake Building with CMake tool
Here we describe the build procedure on the example of Windows platform with Visual Studio 2010. This chapter describes the [CMake](https://cmake.org/download/)-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources.
However, CMake is cross-platform and can be used to build OCCT on Linux and OS X in essentially the same way. OCCT requires CMake version 3.1 or later.
@note Before you start, make sure to have installed all 3-rd party products that you are going to use with OCCT; see @ref build_upgrade.
@subsubsection build_cmake_start Start CMake
CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010). CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010).
Here we describe the build procedure on the example of Windows platform with Visual Studio 2010.
For unexperienced users we recommend to start with *cmake-gui* -- a cross-platform GUI tool provided by CMake on Windows, Mac and Linux. However, CMake is cross-platform and can be used to build OCCT on Linux and macOS in essentially the same way.
A command-line alternative, *ccmake* can also be used.
CMake deals with three directories: source, build or binary and installation. CMake deals with three directories: source, build or binary and installation.
@@ -36,272 +32,287 @@ CMake deals with three directories: source, build or binary and installation.
The good practice is not to use the source directory as a build one. The good practice is not to use the source directory as a build one.
Different configurations should be built in different build directories to avoid conflicts. Different configurations should be built in different build directories to avoid conflicts.
It is however possible to choose one installation directory for several configurations of OCCT (differentiated by platform, bitness, compiler and build type), for example: It is however possible to choose one installation directory for several configurations of OCCT (differentiated by platform, bitness, compiler and build type), for example:
d:/occt/ -- the source directory
d:/tmp/occt-build-vc10-x64 -- the build directory with the generated
solution and other intermediate files created during a CMake tool working
d:/occt-install -- the installation directory that is
able to contain several OCCT configurations
@subsubsection build_cmake_conf Configuration process d:/occt/ - the source directory
d:/tmp/occt-build-vc10-x64 - the build directory with the generated
solution and other intermediate files created during a CMake tool working
d:/occt-install - the installation directory that is
able to contain several OCCT configurations
If the command-line tool is used, run the tool from the build directory with a single argument indicating the source (relative or absolute path) directory: @subsection build_cmake_conf Configuration process
For unexperienced users we recommend to start with *cmake-gui* -- a cross-platform GUI tool provided by CMake on Windows, Mac and Linux.
A command-line alternative, *ccmake* can also be used.
If the command-line tool is used, run the tool from the build directory with a single argument indicating the source (relative or absolute path) directory, and press *c* to configure:
cd d:/tmp/occt-build-vc10-x64 cd d:/tmp/occt-build-vc10-x64
ccmake d:/occt ccmake d:/occt
@figure{/build/build_occt/images/cmake_image000.png} @figure{/build/build_occt/images/cmake_image000.png}
Press *c* to configure. If the GUI tool is used, run this tool without additional arguments and after that specify the source directory by clicking **Browse Source** and the build (binary) one by clicking **Browse Build**:
All actions required in the configuration process with the GUI tool will be described below.
If the GUI tool is used, run this tool without additional arguments and after that specify the source directory by clicking **Browse Source** and the build (binary) one by clicking **Browse Build**.
@figure{/build/build_occt/images/cmake_image001.png} @figure{/build/build_occt/images/cmake_image001.png}
**Note**: Each configuration of the project should be built in its own directory. When building multiple configurations it is recommended to indicate in the name of build directories the system, bitness and compiler (e.g., <i>d:/occt/build/win32-vc10</i> ). @note Each configuration of the project should be built in its own directory.
When building multiple configurations it is suggested to indicate in the name of build directories the system, bitness and compiler (e.g., <i>d:/occt/build/win32-vc10</i>).
Once the source and build directories are selected, "Configure" button should be pressed in order to start manual configuration process. It begins with selection of a target configurator. It is "Visual Studio 10 2010 Win64" in our example. Once the source and build directories are selected, "Configure" button should be pressed in order to start manual configuration process.
It begins with selection of a target configurator. It is "Visual Studio 10 2010 Win64" in our example.
@figure{/build/build_occt/images/cmake_image002.png} @figure{/build/build_occt/images/cmake_image002.png}
To build OCCT for **Universal Windows Platform (UWP)** specify the path to toolchain file for cross-compiling <i>d:/occt/adm/templates/uwp.toolchain.config.cmake</i>. @note To build OCCT for **Universal Windows Platform (UWP)** specify the path to toolchain file for cross-compiling <i>d:/occt/adm/templates/uwp.toolchain.config.cmake</i>.
Alternatively, if you are using CMake from the command line add options `-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0`.
Universal Windows Platform (UWP) is supported only on "Visual Studio 14 2015".
File `CASROOT/samples/xaml/ReadMe.md` describes the building procedure of XAML (UWP) sample.
Alternatively, if you are using CMake from the command line add options -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 . Once "Finish" button is pressed, the first pass of the configuration process is executed.
At the end of the process, CMake outputs the list of environment variables, which have to be properly specified for successful configuration.
**Note**: Universal Windows Platform (UWP) is supported only on "Visual Studio 14 2015". File <i>d:/occt/samples/xaml/ReadMe.md</i> describes the building procedure of XAML (UWP) sample.
Once "Finish" button is pressed, the first pass of the configuration process is executed. At the end of the process, CMake outputs the list of environment variables, which have to be properly specified for successful configuration.
@figure{/build/build_occt/images/cmake_image003.png} @figure{/build/build_occt/images/cmake_image003.png}
The error message provides some information about these variables. This message will appear after each pass of the process until all required variables are specified correctly. The error message provides some information about these variables.
This message will appear after each pass of the process until all required variables are specified correctly.
The change of the state of some variables can lead to the appearance of new variables. The new variables appeared after the pass of the configuration process are highlighted with red color by CMake GUI tool. The change of the state of some variables can lead to the appearance of new variables.
The new variables appeared after the pass of the configuration process are highlighted with red color by CMake GUI tool.
Note: There is "grouped" option, which groups variables with a common prefix. @note There is "grouped" option, which groups variables with a common prefix.
The following table gives the full list of environment variables used at the configuration stage: The following table gives the full list of environment variables used at the configuration stage:
| Variable | Type | Purpose | | Variable | Type | Purpose |
|----------|------|---------| |----------|------|---------|
| CMAKE_BUILD_TYPE | String | Specifies the build type on single-configuration generators (such as make). Possible values are Debug, Release and RelWithDebInfo | | CMAKE_BUILD_TYPE | String | Specifies the build type on single-configuration generators (such as make). Possible values are Debug, Release and RelWithDebInfo |
| USE_FREEIMAGE | Boolean flag | Indicates whether FreeImage product should be used in OCCT visualization module for support of popular graphics image formats (PNG, BMP, etc.) | | USE_FREETYPE | Boolean | Indicates whether FreeType product should be used in OCCT for text rendering |
| USE_RAPIDJSON | Boolean flag | Indicates whether RapidJSON product should be used in OCCT Data Exchange module for support of glTF mesh file format | | USE_FREEIMAGE | Boolean | Indicates whether FreeImage product should be used in OCCT visualization module for support of popular graphics image formats (PNG, BMP, etc.) |
| USE_TBB | Boolean flag | Indicates whether TBB 3rd party is used or not. TBB stands for Threading Building Blocks, the technology of Intel Corp, which comes with different mechanisms and patterns for injecting parallelism into your application. OCCT remains parallel even without TBB product | | USE_OPENVR | Boolean | Indicates whether OpenVR product should be used in OCCT visualization module for support of Virtual Reality |
| USE_VTK | Boolean flag | Indicates whether VTK 3rd party is used or not. VTK stands for Visualization ToolKit, the technology of Kitware Inc intended for general-purpose scientific visualization. OCCT comes with a bridge between CAD data representation and VTK by means of its dedicated VIS component (VTK Integration Services). You may skip this 3rd party unless you are planning to use VTK visualization for OCCT geometry. See the official documentation @ref occt_user_guides__vis for the details on VIS | | USE_OPENGL | Boolean | Indicates whether TKOpenGl graphic driver using OpenGL library (desktop) should be built within OCCT visualization module |
| USE_GLES2 | Boolean | Indicates whether TKOpenGles graphic driver using OpenGL ES library (embedded OpenGL) should be built within OCCT visualization module |
| USE_RAPIDJSON | Boolean | Indicates whether RapidJSON product should be used in OCCT Data Exchange module for support of glTF mesh file format |
| USE_DRACO | Boolean | Indicates whether Draco product should be used in OCCT Data Exchange module for support of Draco compression in glTF mesh file format |
| USE_TK | Boolean | Indicates whether Tcl/Tk product should be used in OCCT Draw Harness module for user interface (in addition to Tcl, which is mandatory for Draw Harness) |
| USE_TBB | Boolean | Indicates whether TBB (Threading Building Blocks) 3rd party is used or not. Note that OCCT remains parallel even without TBB product |
| USE_VTK | Boolean | Indicates whether VTK 3rd party is used or not. OCCT comes with a bridge between CAD data representation and VTK by means of its dedicated VIS component (VTK Integration Services). You may skip this 3rd party unless you are planning to use VTK visualization for OCCT geometry. See the official documentation @ref occt_user_guides__vis for the details on VIS |
| 3RDPARTY_DIR | Path | Defines the root directory where all required 3rd party products will be searched. Once you define this path it is very convenient to click "Configure" button in order to let CMake automatically detect all necessary products| | 3RDPARTY_DIR | Path | Defines the root directory where all required 3rd party products will be searched. Once you define this path it is very convenient to click "Configure" button in order to let CMake automatically detect all necessary products|
| 3RDPARTY_FREETYPE_* | Path | Path to Freetype binaries | | 3RDPARTY_FREETYPE_* | Path | Path to FreeType binaries |
| 3RDPARTY_TCL_* 3RDPARTY_TK_* | Path | Path to Tcl/Tk binaries | | 3RDPARTY_TCL_* 3RDPARTY_TK_* | Path | Path to Tcl/Tk binaries |
| 3RDPARTY_FREEIMAGE* | Path | Path to Freeimage binaries | | 3RDPARTY_FREEIMAGE* | Path | Path to FreeImage binaries |
| 3RDPARTY_TBB* | Path | Path to TBB binaries | | 3RDPARTY_TBB* | Path | Path to TBB binaries |
| 3RDPARTY_VTK_* | Path | Path to VTK binaries | | 3RDPARTY_VTK_* | Path | Path to VTK binaries |
| BUILD_MODULE_<MODULE>| Boolean flag | Indicates whether the corresponding OCCT module should be built or not. It should be noted that some toolkits of a module can be built even if this module is not checked (this happens if some other modules depend on these toolkits). The main modules and their descriptions can be found in @ref user_guides | | BUILD_MODULE_<MODULE>| Boolean | Indicates whether the corresponding OCCT module should be built or not. It should be noted that some toolkits of a module can be built even if this module is not checked (this happens if some other modules depend on these toolkits). The main modules and their descriptions can be found in @ref user_guides |
| BUILD_LIBRARY_TYPE | String | Specifies the type of library to be created. "Shared" libraries are linked dynamically and loaded at runtime. "Static" libraries are archives of object files used when linking other targets. Note that Draw Harness plugin system is incompatible with "Static" builds, and therefore it is disabled for these builds.| | BUILD_LIBRARY_TYPE | String | Specifies the type of library to be created. "Shared" libraries are linked dynamically and loaded at runtime. "Static" libraries are archives of object files used when linking other targets. Note that Draw Harness plugin system is incompatible with "Static" builds, and therefore it is disabled for these builds.|
| BUILD_ADDITIONAL_TOOLKITS | String | Semicolon-separated individual toolkits to include into build process. If you want to build some particular libraries (toolkits) only, then you may uncheck all modules in the corresponding *BUILD_MODUE_\<MODULE\>* options and provide the list of necessary libraries here. Of course, all dependencies will be resolved automatically | | BUILD_ADDITIONAL_TOOLKITS | String | Semicolon-separated individual toolkits to include into build process. If you want to build some particular libraries (toolkits) only, then you may uncheck all modules in the corresponding *BUILD_MODUE_\<MODULE\>* options and provide the list of necessary libraries here. Of course, all dependencies will be resolved automatically |
| BUILD_YACCLEX | Boolean flag | Enables Flex/Bison lexical analyzers. OCCT source files relating to STEP reader and ExprIntrp functionality are generated automatically with Flex/Bison. Checking this option leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files | | BUILD_YACCLEX | Boolean | Enables Flex/Bison lexical analyzers. OCCT source files relating to STEP reader and ExprIntrp functionality are generated automatically with Flex/Bison. Checking this option leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files |
| BUILD_SAMPLES_MFC | Boolean flag | Indicates whether MFC samples should be built together with OCCT. This option is only relevant to Windows platforms | | BUILD_SAMPLES_MFC | Boolean | Indicates whether MFC samples should be built together with OCCT. This option is only relevant to Windows platforms |
| BUILD_SAMPLES_QT | Boolean flag | Indicates whether QT samples should be built together with OCCT. | | BUILD_SAMPLES_QT | Boolean | Indicates whether QT samples should be built together with OCCT. |
| BUILD_Inspector | Boolean flag | Indicates whether Inspector should be built together with OCCT. | | BUILD_Inspector | Boolean | Indicates whether Inspector should be built together with OCCT. |
| BUILD_DOC_Overview | Boolean flag | Indicates whether OCCT overview documentation project should be created together with OCCT. It is not built together with OCCT. Checking this option leads to automatic search of Doxygen binaries. Its building calls Doxygen command to generate the documentation in HTML format | | BUILD_DOC_Overview | Boolean | Indicates whether OCCT overview documentation project should be created together with OCCT. It is not built together with OCCT. Checking this option leads to automatic search of Doxygen binaries. Its building calls Doxygen command to generate the documentation in HTML format |
| BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution | | BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution |
| BUILD_WITH_DEBUG | Boolean flag | Enables extended messages of many OCCT algorithms, usually printed to cout. These include messages on internal errors and special cases encountered, timing, etc. | | BUILD_WITH_DEBUG | Boolean | Enables extended messages of many OCCT algorithms, usually printed to cout. These include messages on internal errors and special cases encountered, timing, etc. |
| BUILD_ENABLE_FPE_SIGNAL_HANDLER | Boolean flag | Enable/Disable the floating point exceptions (FPE) during DRAW execution only. Corresponding environment variable (CSF_FPE) can be changed manually in custom.bat/sh scripts without regeneration by CMake. | | BUILD_ENABLE_FPE_SIGNAL_HANDLER | Boolean | Enable/Disable the floating point exceptions (FPE) during DRAW execution only. Corresponding environment variable (CSF_FPE) can be changed manually in custom.bat/sh scripts without regeneration by CMake. |
| BUILD_CPP_STANDARD | String | Employ corresponding c++ standard (C++11, C++14, ..C++23) for building OCCT |
| CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations | | CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations |
| INSTALL_DIR | Path | Points to the installation directory. *INSTALL_DIR* is a synonym of *CMAKE_INSTALL_PREFIX*. The user can specify both *INSTALL_DIR* or *CMAKE_INSTALL_PREFIX* | | INSTALL_DIR | Path | Points to the installation directory. *INSTALL_DIR* is a synonym of *CMAKE_INSTALL_PREFIX*. The user can specify both *INSTALL_DIR* or *CMAKE_INSTALL_PREFIX* |
| INSTALL_DIR_BIN | Path | Relative path to the binaries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_BIN}) | | INSTALL_DIR_BIN | Path | Relative path to the binaries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_BIN}) |
| INSTALL_DIR_SCRIPT | Path | Relative path to the scripts installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}) | | INSTALL_DIR_SCRIPT | Path | Relative path to the scripts installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}) |
| INSTALL_DIR_LIB | Path | Relative path to the libraries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_LIB}) | | INSTALL_DIR_LIB | Path | Relative path to the libraries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_LIB}) |
| INSTALL_DIR_INCLUDE | Path | Relative path to the includes installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_INCLUDE}) | | INSTALL_DIR_INCLUDE | Path | Relative path to the includes installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_INCLUDE}) |
| INSTALL_DIR_RESOURCE | Path | Relative path to the resources installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}) | | INSTALL_DIR_RESOURCE | Path | Relative path to the resources installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}) |
| INSTALL_DIR_LAYOUT | String | Defines the structure of OCCT files (binaries, resources, headers, etc.) for the install directory. Two variants are predefined: for Windows (standard OCCT layout) and for Unix operating systems (standard Linux layout). If needed, the layout can be customized with INSTALL_DIR_* variables | | INSTALL_DIR_LAYOUT | String | Defines the structure of OCCT files (binaries, resources, headers, etc.) for the install directory. Two variants are predefined: for Windows (standard OCCT layout) and for Unix operating systems (standard Linux layout). If needed, the layout can be customized with INSTALL_DIR_* variables |
| INSTALL_DIR_DATA | Path | Relative path to the data files installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DATA}) | | INSTALL_DIR_DATA | Path | Relative path to the data files installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DATA}) |
| INSTALL_DIR_SAMPLES | Path | Relative path to the samples installation directory. Note that only "samples/tcl" folder will be installed. (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}) | | INSTALL_DIR_SAMPLES | Path | Relative path to the samples installation directory. Note that only "samples/tcl" folder will be installed. (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}) |
| INSTALL_DIR_TESTS | Path | Relative path to the tests installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_TESTS}) | | INSTALL_DIR_TESTS | Path | Relative path to the tests installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_TESTS}) |
| INSTALL_DIR_DOC | Path | Relative path to the documentation installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DOC}) | | INSTALL_DIR_DOC | Path | Relative path to the documentation installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DOC}) |
| INSTALL_FREETYPE | Boolean flag | Indicates whether Freetype binaries should be installed into the installation directory | | INSTALL_FREETYPE | Boolean | Indicates whether FreeType binaries should be installed into the installation directory |
| INSTALL_FREEIMAGE* | Boolean flag | Indicates whether Freeimage binaries should be installed into the installation directory | | INSTALL_FREEIMAGE | Boolean | Indicates whether FreeImage binaries should be installed into the installation directory |
| INSTALL_TBB | Boolean flag | Indicates whether TBB binaries should be installed into the installation directory | | INSTALL_TBB | Boolean | Indicates whether TBB binaries should be installed into the installation directory |
| INSTALL_VTK | Boolean flag | Indicates whether VTK binaries should be installed into the installation directory | | INSTALL_VTK | Boolean | Indicates whether VTK binaries should be installed into the installation directory |
| INSTALL_TCL | Boolean flag | Indicates whether TCL binaries should be installed into the installation directory | | INSTALL_TCL | Boolean | Indicates whether TCL binaries should be installed into the installation directory |
| INSTALL_TEST_CASES | Boolean flag | Indicates whether non-regression OCCT test scripts should be installed into the installation directory | | INSTALL_TEST_CASES | Boolean | Indicates whether non-regression OCCT test scripts should be installed into the installation directory |
| INSTALL_DOC_Overview | Boolean flag | Indicates whether OCCT overview documentation should be installed into the installation directory | | INSTALL_DOC_Overview | Boolean | Indicates whether OCCT overview documentation should be installed into the installation directory |
**Note:** Only the forward slashes ("/") are acceptable in the CMake options defining paths. @note Only the forward slashes ("/") are acceptable in the CMake options defining paths.
@subsubsection build_cmake_3rdparty 3rd party search mechanism @subsubsection build_cmake_3rdparty 3rd party search mechanism
If *3RDPARTY_DIR* directory is defined, then required 3rd party binaries are sought in it, and default system folders are ignored. If `3RDPARTY_DIR` directory is defined, then required 3rd party binaries are sought in it, and default system folders are ignored.
The procedure expects to find binary and header files of each 3rd party product in its own sub-directory: *bin*, *lib* and *include*. The procedure expects to find binary and header files of each 3rd party product in its own sub-directory: *bin*, *lib* and *include*.
The results of the search (achieved on the next pass of the configuration process) are recorded in the corresponding variables: The results of the search (achieved on the next pass of the configuration process) are recorded in the corresponding variables:
* *3RDPARTY_\<PRODUCT\>_DIR* -- path to the 3rdparty directory (with directory name) (e.g. <i>D:/3rdparty/tcltk-86-32</i>) * `3RDPARTY_<PRODUCT>_DIR` -- path to the 3rdparty directory (with directory name) (e.g. <i>D:/3rdparty/tcltk-86-32</i>);
* *3RDPARTY_\<PRODUCT\>_LIBRARY_DIR* -- path to the directory containing a library (e.g. <i>D:/3rdparty/tcltk-86-32/lib</i>). * `3RDPARTY_<PRODUCT>_LIBRARY_DIR` -- path to the directory containing a library (e.g. <i>D:/3rdparty/tcltk-86-32/lib</i>);
* *3RDPARTY_\<PRODUCT\>_INCLUDE_DIR* -- path to the directory containing a header file (e.g., <i>D:/3rdparty/tcltk-86-32/include</i>) * `3RDPARTY_<PRODUCT>_INCLUDE_DIR` -- path to the directory containing a header file (e.g., <i>D:/3rdparty/tcltk-86-32/include</i>);
* *3RDPARTY_\<PRODUCT\>_DLL_DIR* -- path to the directory containing a shared library (e.g., <i>D:/3rdparty/tcltk-86-32/bin</i>) This variable is only relevant to Windows platforms. * `3RDPARTY_<PRODUCT>_DLL_DIR` -- path to the directory containing a shared library (e.g., <i>D:/3rdparty/tcltk-86-32/bin</i>) This variable is only relevant to Windows platforms.
Note: each library and include directory should be children of the product directory if the last one is defined. @note Each library and include directory should be children of the product directory if the last one is defined.
The search process is as follows: The search process is as follows:
1. Common path: *3RDPARTY_DIR* 1. Common path: `3RDPARTY_DIR`
2. Path to a particular 3rd-party library: *3RDPARTY_\<PRODUCT\>_DIR* 2. Path to a particular 3rd-party library: `3RDPARTY_<PRODUCT>_DIR`
3. Paths to headers and binaries: 3. Paths to headers and binaries:
1. *3RDPARTY_\<PRODUCT\>_INCLUDE_DIR* 1. `3RDPARTY_<PRODUCT>_INCLUDE_DIR`
2. *3RDPARTY_\<PRODUCT\>_LIBRARY_DIR* 2. `3RDPARTY_<PRODUCT>_LIBRARY_DIR`
3. *3RDPARTY_\<PRODUCT\>_DLL_DIR* 3. `3RDPARTY_<PRODUCT>_DLL_DIR`
If a variable of any level is not defined (empty or <i> \<variable name\>-NOTFOUND </i>) and the upper level variable is defined, the content of the non-defined variable will be sought at the next configuration step. If the search process at level 3 does not find the required files, it seeks in default places. If a variable of any level is not defined (empty or `<variable name>-NOTFOUND`) and the upper level variable is defined, the content of the non-defined variable will be sought at the next configuration step.
If the search process at level 3 does not find the required files, it seeks in default places.
If a search result (include path, or library path, or dll path) does not meet your expectations, you can change *3RDPARTY_\<PRODUCT\>_*_DIR variable*, clear (if they are not empty) *3RDPARTY_\<PRODUCT\>_DLL_DIR, 3RDPARTY_\<PRODUCT\>_INCLUDE_DIR* and 3RDPARTY_\<PRODUCT\>_LIBRARY_DIR variables (or clear one of them) and run the configuration process again. If a search result (include path, or library path, or dll path) does not meet your expectations, you can change `3RDPARTY_<PRODUCT>_*_DIR` variable,
clear (if they are not empty) `3RDPARTY_<PRODUCT>_DLL_DIR`, `3RDPARTY_<PRODUCT>_INCLUDE_DIR` and `3RDPARTY_<PRODUCT>_LIBRARY_DIR` variables (or clear one of them) and run the configuration process again.
At this time the search will be performed in the newly identified directory At this time the search will be performed in the newly identified directory and the result will be recorded to corresponding variables (replace old value if it is necessary).
and the result will be recorded to corresponding variables (replace old value if it is necessary). For example, `3RDPARTY_FREETYPE_DIR` variable
For example, *3RDPARTY_FREETYPE_DIR* variable
d:/3rdparty/freetype-2.4.10 d:/3rdparty/freetype-2.4.10
can be changed to can be changed to
d:/3rdparty/freetype-2.5.3 d:/3rdparty/freetype-2.5.3
During the configuration process the related variables (*3RDPARTY_FREETYPE_DLL_DIR*, *3RDPARTY_FREETYPE_INCLUDE_DIR* and *3RDPARTY_FREETYPE_LIBRARY_DIR*) will be filled with new found values. During the configuration process the related variables (`3RDPARTY_FREETYPE_DLL_DIR`, `3RDPARTY_FREETYPE_INCLUDE_DIR` and `3RDPARTY_FREETYPE_LIBRARY_DIR`) will be filled with new found values.
**Note**: The names of searched libraries and header files are hard-coded. If there is the need to change their names, change appropriate cmake variables (edit CMakeCache.txt file or edit in cmake-gui in advance mode) without reconfiguration: *3RDPARTY_\<PRODUCT\>_INCLUDE* for include, *3RDPARTY_\<PRODUCT\>_LIB* for library and *3RDPARTY_\<PRODUCT\>_DLL* for shared library. @note The names of searched libraries and header files are hard-coded.
If there is the need to change their names, change appropriate CMake variables (edit CMakeCache.txt file or edit in cmake-gui in advance mode) without reconfiguration:
`3RDPARTY_<PRODUCT>_INCLUDE` for include, `3RDPARTY_<PRODUCT>_LIB` for library and `3RDPARTY_<PRODUCT>_DLL` for shared library.
@subsubsection build_cmake_gen Projects generation @subsection build_cmake_gen Projects generation
Once the configuration process is done, the "Generate" button is used to prepare project files for the target IDE. Once the configuration process is done, the "Generate" button is used to prepare project files for the target IDE.
In our exercise the Visual Studio solution will be automatically created in the build directory. In our exercise the Visual Studio solution will be automatically created in the build directory.
@subsubsection build_cmake_build Building @subsection build_cmake_build Building
Go to the build folder, start the Visual Studio solution *OCCT.sln* and build it by clicking **Build -> Build Solution**. Go to the build folder, start the Visual Studio solution *OCCT.sln* and build it by clicking **Build -> Build Solution**.
@figure{/build/build_occt/images/cmake_image004.png} @figure{/build/build_occt/images/cmake_image004.png}
By default the build solution process skips the building of the INSTALL and Overview project. By default, the build solution process skips the building of the INSTALL and Overview projects.
When the building process is finished build: When the building process is finished build:
* Overview project to generate OCCT overview documentation (if BUILD_DOC_Overview variable is checked) * *Overview* project to generate OCCT overview documentation (if `BUILD_DOC_Overview` variable is checked)
* the *INSTALL* project to run **the installation process** * the *INSTALL* project to run the **installation process**
For this, right-click on the *Overview/INSTALL* project and select **Project Only -> Build Only** -> *Overview/INSTALL* in the solution explorer. For this, right-click on the *Overview/INSTALL* project and select **Project Only -> Build Only** -> *Overview/INSTALL* in the solution explorer.
@subsubsection build_cmake_install Installation @subsection build_cmake_install Installation
Installation is a process of extracting redistributable resources (binaries, include files etc) from the build directory into the installation one. The installation directory will be free of project files, intermediate object files and any other information related to the build routines. Installation is a process of extracting redistributable resources (binaries, include files etc) from the build directory into the installation one.
The installation directory will be free of project files, intermediate object files and any other information related to the build routines.
Normally you use the installation directory of OCCT to link against your specific application.
Normally you use the installation directory of OCCT to link against your specific application.
The directory structure is as follows: The directory structure is as follows:
data -- data files for OCCT (brep, iges, stp)
doc -- OCCT overview documentation in HTML format
inc -- header files
samples -- samples
src -- all required source files for OCCT
tests -- OCCT test suite
win32\vc10\bind -- binary files (installed 3rdparties and occt)
\libd -- libraries (installed 3rdparties and occt)
**Note:** The above example is given for debug configuration. However, it is generally safe to use the same installation directory for the release build. In the latter case the contents of install directory will be enriched with subdirectories and files related to the release configuration. In particular, the binaries directory win64 will be expanded as data - data files for OCCT (brep, iges, stp)
follows: doc - OCCT overview documentation in HTML format
inc - header files
samples - samples
src - all required source files for OCCT
tests - OCCT test suite
win32\vc10\bind - binary files (installed 3rdparties and occt)
\libd - libraries (installed 3rdparties and occt)
@note The above example is given for debug configuration.
However, it is generally safe to use the same installation directory for the release build.
In the latter case the contents of install directory will be enriched with subdirectories and files related to the release configuration.
In particular, the binaries directory win64 will be expanded as follows:
\win32\vc10\bind \win32\vc10\bind
\libd \libd
\bin \bin
\lib \lib
If CMake installation flags are enabled for the 3rd party products (e.g. INSTALL_FREETYPE), then the corresponding binaries will be copied to the same bin(d) and lib(d) directories together with the native binaries of OCCT. Such organization of libraries can be especially helpful if your OCCT-based software does not use itself the 3rd parties of Open CASCADE Technology (thus, there is no sense to pack them into dedicated directories). If CMake installation flags are enabled for the 3rd party products (e.g. `INSTALL_FREETYPE`), then the corresponding binaries will be copied to the same bin(d) and lib(d) directories together with the native binaries of OCCT.
Such organization of libraries can be especially helpful if your OCCT-based software does not use itself the 3rd parties of Open CASCADE Technology (thus, there is no sense to pack them into dedicated directories).
The installation folder contains the scripts to run *DRAWEXE* (*draw.bat* or *draw.sh*), samples (if they were installed) and overview.html (short-cut for installed OCCT overview documentation). The installation folder contains the scripts to run *DRAWEXE* (*draw.bat* or *draw.sh*), samples (if they were installed) and overview.html (short-cut for installed OCCT overview documentation).
@subsection build_occt_win_codeblocks Building with Code::Blocks @subsection build_occt_crossplatform_cmake Cross-compiling (Android)
This file describes steps to build OCCT libraries from sources using **Code::Blocks**, a cross-platform IDE, using project files generated by OCCT legacy tool **genproj**. This section describes the steps to build OCCT libraries for Android from a complete source package with GNU make (makefiles).
It can be used as an alternative to CMake build system (see @ref build_occt_win_cmake) for all supported platforms. The steps on Windows 7 and Ubuntu 15.10 are similar. There is the only one difference: makefiles are built with mingw32-make on Windows and native GNU make on Ubuntu.
@subsubsection build_codeblocks_3rdparty Third-party libraries Required tools (download and install if it is required):
- CMake 3.0+
- [Cross-compilation toolchain for CMake](https://github.com/taka-no-me/android-cmake)
- [Android NDK r12+](https://developer.android.com/ndk/downloads)
- GNU Make: MinGW v4.82+ for [Windows](https://www.mingw-w64.org/), GNU Make 4.0 for Ubuntu.
Before building OCCT, make sure to have all the needed third-party libraries installed, see @ref build_upgrade. Run GUI tool provided by CMake and:
- Specify the root folder of OCCT (`$CASROOT`, which contains *CMakelists.txt* file) by clicking **Browse Source**.
- Specify the location (build folder) for CMake generated project files by clicking **Browse Build**.
@subsubsection build_codeblocks_conf Configuration @figure{/build/build_occt/images/android_image001.png}
Before building it is necessary to set up build environment. Click **Configure** button. It opens the window with a drop-down list of generators supported by CMake project.
Select "MinGW MakeFiles" item from the list
- Choose "Specify toolchain file for cross-compiling", and click "Next".
@figure{/build/build_occt/images/android_image002.png}
The environment is defined in the file *custom.sh* (on Linux and OS X) or *custom.bat* (on Windows) which can be edited directly: - Specify a toolchain file at the next dialog to `android.toolchain.cmake`, and click "Finish".
@figure{/build/build_occt/images/android_image003.png}
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*. If `ANDROID_NDK` environment variable is not defined in current OS, add cache entry `ANDROID_NDK` (entry type is `PATH`) -- path to the NDK folder ("Add Entry" button):
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*. @figure{/build/build_occt/images/android_image004.png}
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
If on Windows the message is appeared:
"CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles" CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.",
specify `CMAKE_MAKE_PROGRAM` to mingw32-make executable.
@figure{/build/build_occt/images/android_image005.png}
How to configure OCCT, see @ref build_cmake_conf "Configure" section taking into account the specific configuration variables for Android:
- `ANDROID_ABI` = `armeabi-v7a`
- `ANDROID_NATIVE_API_LEVEL` = `15`
- `ANDROID_NDK_LAYOUT` is equal to `CMAKE_BUILD_TYPE` variable
- `BUILD_MODULE_Draw` = `OFF`
@figure{/build/build_occt/images/android_image006.png}
Click **Generate** button and wait until the generation process is finished.
Then makefiles will appear in the build folder (e.g. <i> D:/tmp/occt-android </i>).
Open console and go to the build folder. Type "mingw32-make" (Windows) or "make" (Ubuntu) to start build process:
> mingw32-make
or
> make
Parallel building can be started with using `-jN` argument of "mingw32-make/make", where `N` is the number of building threads:
> mingw32-make -j4
or
> make -j4
Type "mingw32-make/make" with argument "install" to place the libraries to the install folder:
> mingw32-make install
or
> make install
@section build_occt_genproj Building with Genproj tool
**genproj** is a legacy tool (originated from command "wgenproj" in WOK) for generation of Visual Studio, Code::Blocks, Qt Creator (qmake), and XCode project files for building Open CASCADE Technology.
These project files are placed inside OCCT directory (in *adm* subfolder) and use relative paths, thus can be moved together with sources.
The project files included in official distribution of OCCT are generated by this tool.
@note If you have official distribution with project files included, you can use them directly without a need to call **genproj**.
**genproj** is a less flexible alternative to use of CMake build system (see @ref build_occt_win_cmake), but still has some small features useful for OCCT development.
@subsection build_genproj Configuration process
The environment is defined in the file *custom.sh* (on Linux and macOS) or *custom.bat* (on Windows) which can be edited directly:
* `ARCH` -- architecture (32 or 64), affects only `PATH` variable for execution
* `HAVE_*` -- flags to enable or disable use of optional third-party products
* `CSF_OPT_*` -- paths to search for includes and binaries of all used third-party products
* `SHORTCUT_HEADERS` -- defines method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*; * *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*; * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created. * *HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.: * `VCVER` -- specification of format of project files, defining also version of Visual Studio to be used, and default name of the sub-folder for binaries:
~~~~ * Add paths to includes of used third-party libraries in variable `CSF_OPT_INC`.
export HAVE_FREEIMAGE=false * Add paths to their binary libraries in variable `CSF_OPT_LIB64`.
~~~~ * For optional third-party libraries, set corresponding environment variable `HAVE_<LIBRARY_NAME>` to either *false*, e.g. `export HAVE_FREEIMAGE=false`.
Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure environment interactively:
@figure{/build/build_occt/images/genconf_linux.png}
Click "Save" to store the specified configuration in *custom.sh* or *custom.bat* file.
@subsubsection build_codeblocks_gen Projects generation
Launch **genproj** tool with option *cbp* to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files:
~~~~
$ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj cbp
~~~~
The generated Code::Blocks project are placed into subfolder *adm/&lt;OS&gt;/cbp*.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
@subsubsection build_codeblocks_build Building
To start **Code::Blocks**, launch script *codeblocks.sh*.
To build all toolkits, click **Build->Build workspace** in the menu bar.
To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
~~~~
./draw.sh cbp [d]
~~~~
Option *d* is used if OCCT has been built in **Debug** mode.
@subsection build_occt_genproj Building with Genproj tool
This page describes steps to build OCCT libraries from a complete source archive on Windows with <b>MS Visual C++</b> using projects generated by **genproj** tool.
It is an alternative to use of CMake build system (see @ref build_occt_win_cmake).
**genproj** is a legacy tool (originated from command "wgenproj" in WOK) for generation of Visual Studio, Code.Blocks, and XCode project files used for building Open CASCADE Technology.
These project files are placed inside OCCT directory (in *adm* subfolder) and use relative paths, thus can be moved together with sources.
The project files included in official distribution of OCCT are generated by this tool.
If you have official distribution with project files included, you can use them directly without a need to call **genproj**.
@subsubsection build_msvc_3rdparty Third-party libraries
Before building OCCT, make sure to have all the required third-party libraries installed.
The easiest way to install third-party libraries is to download archive with pre-built binaries, corresponding to version of Visual Studio you are using, from https://opencascade.com/content/3rd-party-components.
You can also build third-party libraries from their sources, see @ref build_upgrade_building_3rdparty for instructions.
@subsubsection build_msvc_conf Configuration
If you have Visual Studio projects already available (pre-installed or generated), you can edit file *custom.bat* manually to adjust the environment:
* *VCVER* -- specification of format of project files, defining also version of Visual Studio to be used, and default name of the sub-folder for binaries:
| VCVER | Visual Studio version | Windows Platform | Binaries folder name | | VCVER | Visual Studio version | Windows Platform | Binaries folder name |
|-----------|-----------------------|----------------------------------|----------------------| |-----------|-----------------------|----------------------------------|----------------------|
@@ -314,268 +325,87 @@ If you have Visual Studio projects already available (pre-installed or generated
| vc141-uwp | 2017 (15) | UWP (Universal Windows Platform) | vc14-uwp | | vc141-uwp | 2017 (15) | UWP (Universal Windows Platform) | vc14-uwp |
| vc142 | 2019 (16) | Desktop (Windows API) | vc14 | | vc142 | 2019 (16) | Desktop (Windows API) | vc14 |
| vc142-uwp | 2019 (16) | UWP (Universal Windows Platform) | vc14-uwp | | vc142-uwp | 2019 (16) | UWP (Universal Windows Platform) | vc14-uwp |
| vc143 | 2022 (17) | Desktop (Windows API) | vc14 |
* *ARCH* -- architecture (32 or 64), affects only *PATH* variable for execution
* <i>HAVE_*</i> -- flags to enable or disable use of optional third-party products
* <i>CSF_OPT_*</i> -- paths to search for includes and binaries of all used third-party products
* *SHORTCUT_HEADERS* -- defines method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively. Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively.
That tool will analyze your environment and propose you to choose available options: That tool will analyze your environment and propose you to choose available options:
* Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*). * Type and version of project files to generate (from the list of installed ones, detected by presence of environment variables like `VS100COMNTOOLS` on Windows platform).
* Method to populate folder *inc* (short-cuts by default). * Method to populate folder *inc* (short-cuts by default).
* Location of third-party libraries (usually downloaded from OCCT web site, see above). * Location of third-party libraries (usually downloaded from OCCT web site, see above).
* Path to common directory where third-party libraries are located (optional). * Path to common directory where third-party libraries are located (optional).
* Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update). * Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update).
* Generation of PDB files within Release build ("Release with Debug info", false by default). * Generation of PDB files within Release build ("Release with Debug info", false by default).
Below are screenshots of **genconf** tool on various platforms (Windows and Linux):
@figure{/build/build_occt/images/genconf_windows.png} @figure{/build/build_occt/images/genconf_windows.png}
@figure{/build/build_occt/images/genconf_linux.png}
Click "Save" to store the specified configuration in *custom.bat* file. Click "Save" to store the specified configuration in *custom.bat* (Windows) or *custom.sh* (other systems) file.
@subsubsection build_msvc_generate Projects generation @subsection build_genproj_generate Projects generation
Launch **genproj** to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files. Launch **genproj** to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH. @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by `PATH`.
If Tcl is not found, the tool may prompt you to enter the path to directory where Tcl can be found. If Tcl is not found, the tool may prompt you to enter the path to directory where Tcl can be found.
~~~~ ~~~~
$ genproj.bat $ genproj.bat
~~~~ ~~~~
Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment. Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment.
@subsubsection build_msvc_build Building @subsection build_genproj_build Building
@subsubsection build_msvc_build Visual Studio
Launch *msvc.bat* to start Visual Studio with all necessary environment variables defined, and build the whole solution or required toolkits. Launch *msvc.bat* to start Visual Studio with all necessary environment variables defined, and build the whole solution or required toolkits.
Note: the MSVC project files are located in folders <i>adm\\msvc\\vc...</i>. The MSVC project files are located in folders <i>adm\\msvc\\vc...</i>.
Binaries are produced in *win32* or *win64* folders. Binaries are produced in *win32* or *win64* folders.
To start DRAW, launch *draw.bat*. To start DRAW, launch *draw.bat*.
@section build_occt_linux Linux @subsubsection build_codeblocks_build Code::Blocks
You may choose one of the following ways to generate, configure and build OCCT sources on Linux just keeping in mind Code::Blocks is a cross-platform IDE which can be used for building OCCT on Linux, macOS and Windows platforms.
this platform specific: The generated Code::Blocks project could be found within subfolder *adm/&lt;OS&gt;/cbp*.
* @ref build_occt_win_cmake "Configuration, generation and building OCCT on Windows using CMake tool" To start **Code::Blocks**, launch script *codeblocks.sh*.
* @ref build_occt_code_blocks "Building on Mac OS X with Code::Blocks IDE" To build all toolkits, click **Build->Build workspace** in the menu bar.
@section build_occt_crossplatform_cmake Android (cross-compiling) To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
This article describes the steps to build OCCT libraries for Android from a complete source package
with GNU make (makefiles). The steps on Windows 7 and Ubuntu 15.10 are similar. There is the only one difference:
makefiles are built with mingw32-make
on Windows and native GNU make on Ubuntu.
Required tools (download and install if it is required):
- CMake v3.0+ http://www.cmake.org/cmake/resources/software.html
- Cross-compilation toolchain for CMake https://github.com/taka-no-me/android-cmake
- Android NDK rev.10+ https://developer.android.com/tools/sdk/ndk/index.html
- GNU Make: MinGW v4.82+ for Windows (http://sourceforge.net/projects/mingw/files/), GNU Make 4.0 for Ubuntu.
Run GUI tool provided by CMake.
@subsection build_occt_crossplatform_cmake_config Configuration
**Configure Tools**
- Specify the root folder of OCCT (<i>$CASROOT</i>, which contains *CMakelists.txt* file) by clicking **Browse Source**.
- Specify the location (build folder) for Cmake generated project files by clicking **Browse Build**.
@figure{/build/build_occt/images/android_image001.png}
Click **Configure** button. It opens the window with a drop-down list of generators supported by CMake project.
Select "MinGW MakeFiles" item from the list
- Choose "Specify toolchain file for cross-compiling"
- Click "Next"
@figure{/build/build_occt/images/android_image002.png}
- Specify a toolchain file at the next dialog by android.toolchain.cmake . It is contained by cross-compilation
toolchain for CMake
- Click "Finish"
@figure{/build/build_occt/images/android_image003.png}
If ANDROID_NDK environment variable is not defined in current OS, add cache entry ANDROID_NDK (entry type is PATH) --
path to the NDK folder ("Add Entry" button)
@figure{/build/build_occt/images/android_image004.png}
If on Windows the message is appeared: "CMake Error: CMake was unable to find a build program corresponding
to "MinGW Makefiles"
CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.",
specify **CMAKE_MAKE_PROGRAM** to mingw32-make executable.
@figure{/build/build_occt/images/android_image005.png}
**Configure OCCT**
How to configure OCCT, see "OCCT Configuration" section of @ref build_occt_win_cmake
"Configure, Generate, Build using CMake tool" taking into account the specific configuration variables for android:
- ANDROID_ABI = armeabi-v7a
- ANDROID_NATIVE_API_LEVEL = 15
- ANDROID_NDK_LAYOUT is equal to CMAKE_BUILD_TYPE variable
- **BUILD_MODULE_Draw = OFF**
@figure{/build/build_occt/images/android_image006.png}
@subsection build_occt_crossplatform_cmake_generation Generate Makefiles
Click **Generate** button and wait until the generation process is finished.
Then makefiles will appear in the build folder (e.g. <i> D:/tmp/occt-android </i>).
@subsection build_occt_crossplatform_cmake_building Build Makefiles
Open console and go to the build folder. Type "mingw32-make" (Windows) or "make" (Ubuntu) to start build process.
> mingw32-make
or
> make
Parallel building can be started with using **"-jN"** argument of "mingw32-make/make", where N is the number of
building threads.
> mingw32-make -j4
or
> make -j4
@subsection build_occt_crossplatform_cmake_install Install OCCT Libraries
Type "mingw32-make/make" with argument "install" to place the libraries to the install folder
> mingw32-make install
or
> make install
@section build_occt_macos Mac OS X
@subsection build_occt_macos_xcode Building with Xcode
This file describes steps to build OCCT libraries from sources on Mac OS X with **Xcode** projects, generated by OCCT legacy tool **genproj**.
<h2>Configuration</h2>
Before building it is necessary to set up build environment.
The environment is defined in the file *custom.sh* which can be edited directly:
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC* (use colon ":" as path separator).
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~ ~~~~
export HAVE_FREEIMAGE=false ./draw.sh cbp [d]
~~~~ ~~~~
Option *d* is used if OCCT has been built in **Debug** mode.
Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively: @subsubsection build_occt_macos_xcode XCode
@figure{/build/build_occt/images/genconf_osx.png} XCode is an IDE for development on macOS platform and targeting macOS and iOS platforms.
**genproj** tool comes with a legacy XCode project files generator, but CMake is a preferred way for building OCCT on macOS platform.
Click "Save" to store the specified configuration in *custom.sh* file. To start **XCode**, launch script *xcode.sh*.
To build a certain toolkit, select it in **Scheme** drop-down list in XCode toolbar, press **Product** in the menu and click **Build** button.
<h2>Projects generation</h2>
Launch **genproj** tool to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
For instance, in Terminal application:
~~~~
$ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj
~~~~
<h2>Building</h2>
To start **Xcode**, launch script *xcode.sh*.
To build a certain toolkit, select it in **Scheme** drop-down list in Xcode toolbar, press **Product** in the menu and click **Build** button.
To build the entire OCCT: To build the entire OCCT:
* Create a new empty project (select **File -> New -> Project -> Empty project** in the menu; input the project name, e.g. *OCCT*; then click **Next** and **Create**). * Create a new empty project (select **File -> New -> Project -> Empty project** in the menu; input the project name, e.g. *OCCT*; then click **Next** and **Create**).
* Drag and drop the *OCCT* folder in the created *OCCT* project in the Project navigator. * Drag and drop the *OCCT* folder in the created *OCCT* project in the Project navigator.
* Select **File -> New -> Target -> Aggregate** in the menu. * Select **File -> New -> Target -> Aggregate** in the menu.
* Enter the project name (e.g. *OCCT*) and click **Finish**. The **Build Phases** tab will open. * Enter the project name (e.g. *OCCT*) and click **Finish**. The **Build Phases** tab will open.
* Click "+" button to add the necessary toolkits to the target project. It is possible to select all toolkits by pressing **Command+A** combination. * Click "+" button to add the necessary toolkits to the target project. It is possible to select all toolkits by pressing **Command+A** combination.
<h2>Launching DRAW</h2> To start *DRAWEXE*, which has been built with XCode on Mac OS X, perform the following steps:
To start *DRAWEXE*, which has been built with Xcode on Mac OS X, perform the following steps:
1.Open Terminal application 1.Open Terminal application
2.Enter `<OCCT_ROOT_DIR>`:
2.Enter <i>\<OCCT_ROOT_DIR\></i>:
~~~~ ~~~~
cd \<OCCT_ROOT_DIR\> cd \<OCCT_ROOT_DIR\>
~~~~ ~~~~
3.Run the script 3.Run the script
~~~~ ~~~~
./draw_cbp.sh xcd [d] ./draw.sh xcd [d]
~~~~ ~~~~
Option *d* is used if OCCT has been built in **Debug** mode. Option *d* is used if OCCT has been built in **Debug** mode.
@subsection build_occt_code_blocks Building with Code::Blocks
This file describes steps to build OCCT libraries from sources using **Code::Blocks**, a cross-platform IDE, using
project files generated by OCCT legacy tool **genproj**.
<h2>Configure</h2>
Before building it is necessary to set up build environment.
The environment is defined in the file *custom.sh* (on Linux and OS X) or *custom.bat* (on Windows) which can be edited
directly:
* Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*.
* Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
* Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
* *Copy* - headers will be copied from *src*;
* *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
* "HardLink* - hard links to headers located in *src* will be created.
* For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
~~~~
export HAVE_FREEIMAGE=false
~~~~
Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure
environment interactively:
@figure{/build/build_occt/images/genconf_linux.png}
Click "Save" to store the specified configuration in *custom.sh* or *custom.bat* file.
<h2>Generate Projects</h2>
Launch **genproj** tool with option *cbp* to update content of *inc* folder and generate project files after changes in
OCCT code affecting layout or composition of source files:
~~~~
$ cd /dev/OCCT/opencascade-7.0.0
$ ./genproj cbp
~~~~
The generated Code::Blocks project are placed into subfolder *adm/&lt;OS&gt;/cbp*.
@note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
<h2>Build</h2>
To start **Code::Blocks**, launch script *codeblocks.sh*.
To build all toolkits, click **Build->Build workspace** in the menu bar.
To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
~~~~
./draw_cbp.sh cbp [d]
~~~~
Option *d* is used if OCCT has been built in **Debug** mode.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

View File

@@ -725,7 +725,7 @@ Another possible problem is the order of initialization of global variables defi
Avoid explicit usage of basic types (*int*, *float*, *double*, etc.), use Open CASCADE Technology types from package *Standard: Standard_Integer, Standard_Real, Standard_ShortReal, Standard_Boolean, Standard_CString* and others or a specific *typedef* instead. Avoid explicit usage of basic types (*int*, *float*, *double*, etc.), use Open CASCADE Technology types from package *Standard: Standard_Integer, Standard_Real, Standard_ShortReal, Standard_Boolean, Standard_CString* and others or a specific *typedef* instead.
### Use *sizeof()* to calculate sizes [MANDATORY] ### Use sizeof() to calculate sizes [MANDATORY]
Do not assume sizes of types. Use *sizeof()* instead to calculate sizes. Do not assume sizes of types. Use *sizeof()* instead to calculate sizes.
@@ -738,7 +738,7 @@ It is recommended to follow this rule for any plain text files for consistency a
The rules listed in this chapter are important for stability of the programs that use Open CASCADE Technology libraries. The rules listed in this chapter are important for stability of the programs that use Open CASCADE Technology libraries.
### Use *OSD::SetSignal()* to catch exceptions ### Use OSD::SetSignal() to catch exceptions
When using Open CASCADE Technology in an application, call *OSD::SetSignal()* function when the application is initialized. When using Open CASCADE Technology in an application, call *OSD::SetSignal()* function when the application is initialized.
@@ -787,7 +787,7 @@ See the following example:
In C++ use *new* and *delete* operators instead of *malloc()* and *free()*. Try not to mix different memory allocation techniques. In C++ use *new* and *delete* operators instead of *malloc()* and *free()*. Try not to mix different memory allocation techniques.
### Match *new* and *delete* [MANDATORY] ### Match new and delete [MANDATORY]
Use the same form of new and delete. Use the same form of new and delete.
@@ -812,7 +812,7 @@ Standard_Integer aTmpVar2 = 0; // OK
Uninitialized variables might be kept only within performance-sensitive code blocks and only when their initialization is guaranteed by subsequent code. Uninitialized variables might be kept only within performance-sensitive code blocks and only when their initialization is guaranteed by subsequent code.
### Do not hide global *new* ### Do not hide global new
Avoid hiding the global *new* operator. Avoid hiding the global *new* operator.

View File

@@ -1089,10 +1089,10 @@ This group allows testing extended data exchange packages.
| Draw | TKDraw, TKTopTest, TKViewerTest, TKXSDRAW, TKDCAF, TKXDEDRAW, TKTObjDRAW, TKQADraw, DRAWEXE, Problems of testing system | draw | | Draw | TKDraw, TKTopTest, TKViewerTest, TKXSDRAW, TKDCAF, TKXDEDRAW, TKTObjDRAW, TKQADraw, DRAWEXE, Problems of testing system | draw |
| Shape Healing | TKShHealing | heal | | Shape Healing | TKShHealing | heal |
| Mesh | TKMesh, TKXMesh | mesh | | Mesh | TKMesh, TKXMesh | mesh |
| Data Exchange | TKIGES | iges | | Data Exchange | TKDEIGES | iges |
| Data Exchange | TKSTEPBase, TKSTEPAttr, TKSTEP209, TKSTEP | step | | Data Exchange | TKDESTEP | step |
| Data Exchange | TKSTL, TKVRML | stlvrml | | Data Exchange | TKDESTL, TKDEVRML | stlvrml |
| Data Exchange | TKXSBase, TKXCAF, TKXCAFSchema, TKXDEIGES, TKXDESTEP, TKXmlXCAF, TKBinXCAF | xde | | Data Exchange | TKXSBase, TKXCAF, TKXCAFSchema, TKXmlXCAF, TKBinXCAF | xde |
| Foundation Classes | TKernel, TKMath | fclasses | | Foundation Classes | TKernel, TKMath | fclasses |
| Modeling_algorithms | TKGeomAlgo, TKTopAlgo, TKPrim, TKBO, TKBool, TKHLR, TKFillet, TKOffset, TKFeat, TKXMesh | modalg | | Modeling_algorithms | TKGeomAlgo, TKTopAlgo, TKPrim, TKBO, TKBool, TKHLR, TKFillet, TKOffset, TKFeat, TKXMesh | modalg |
| Modeling Data | TKG2d, TKG3d, TKGeomBase, TKBRep | moddata | | Modeling Data | TKG2d, TKG3d, TKGeomBase, TKBRep | moddata |

View File

@@ -234,7 +234,7 @@ This module handles various problems of interoperability between CAD systems, ca
* @ref occt_user_guides__step "STEP" (AP203: Mechanical Design, this covers General 3D CAD; AP214: Automotive Design; AP242). * @ref occt_user_guides__step "STEP" (AP203: Mechanical Design, this covers General 3D CAD; AP214: Automotive Design; AP242).
* @ref occt_iges_1 "IGES" (up to 5.3). * @ref occt_iges_1 "IGES" (up to 5.3).
* **glTF** 2.0 reader and writer. * **glTF** 2.0 reader and writer.
* **OBJ** mesh file reader. * **OBJ** mesh file reader and writer.
* **VRML** converter translates Open CASCADE shapes to VRML 1.0 files (Virtual Reality Modeling Language). * **VRML** converter translates Open CASCADE shapes to VRML 1.0 files (Virtual Reality Modeling Language).
* **STL** converter translates Open CASCADE shapes to STL files. * **STL** converter translates Open CASCADE shapes to STL files.
STL (STtereoLithography) format is widely used for rapid prototyping (3D printing). STL (STtereoLithography) format is widely used for rapid prototyping (3D printing).
@@ -341,7 +341,7 @@ The tables below describe the recommended software configurations for which OCCT
| OS | Compiler | | OS | Compiler |
| --------- | ----------- | | --------- | ----------- |
| Windows | Microsoft Visual Studio: 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)| | Windows | Microsoft Visual Studio: 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ | | Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X / macOS | XCode 6 or newer | | OS X / macOS | XCode 6 or newer |
| Android | NDK r12, GNU gcc 4.9 or newer | | Android | NDK r12, GNU gcc 4.9 or newer |
@@ -352,29 +352,28 @@ The tables below describe the recommended software configurations for which OCCT
@subsection intro_req_libs Third-party libraries and tools @subsection intro_req_libs Third-party libraries and tools
The following third-party libraries and tools are not included in OCCT sources but are either required or can be optionally used for the indicated components of OCCT. The following third-party libraries and tools are not included in OCCT sources but are either required or can be optionally used for the indicated components of OCCT.
They are not needed if relevant component is not needed. They are not needed if relevant component is not needed - it is possible building core OCCT modules without additional dependencies.
Note that pre-built packages of many of the listed libraries are available at Note that pre-built packages of many of the listed libraries are available at
https://www.opencascade.com/content/3rd-party-components https://dev.opencascade.org/resources/download/3rd-party-components
| Component | Where to find | Used for | Required or optional | | Component | Where to find | Used for | Purpose |
| --------- | ------------- | -------- | -------------------- | | --------- | ------------- | -------- | -------------------- |
| CMake 2.8+ | https://cmake.org/ | Build from sources | Optional | | CMake 3.1+ | https://cmake.org/ | Configuration | Build from sources |
| Intel TBB 4.x or later | https://www.threadingbuildingblocks.org/ | All | Optional (advanced parallelization of algorithms) | | Intel oneTBB 2021.5.0 | https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0 | All | Parallelization of algorithms (alternative to built-in thread pool) |
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required | | OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required for using 3D Viewer |
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | Optional (VR support) | | OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | VR (Virtual Reality) support in 3D Viewer |
| Direct3D 9 | Windows | Visualization | Optional (integration with GUI using Direct3D) | | FreeType 2.4+ | https://www.freetype.org/download.html | Visualization | Text rendering in 3D Viewer |
| FreeType 2.4+ | https://www.freetype.org/download.html | Visualization | Optional (text rendering) | | FreeImage 3.17+ | https://sourceforge.net/projects/freeimage/files | Visualization | Reading/writing image files |
| FreeImage 3.17+ | https://sourceforge.net/projects/freeimage/files | Visualization | Optional (support of common 2D graphic formats) | | FFmpeg 3.1+ | https://www.ffmpeg.org/download.html | Visualization | Video recording |
| FFmpeg 3.1+ | https://www.ffmpeg.org/download.html | Visualization | Optional (video recording) | | VTK 6.1+ | https://www.vtk.org/download/ | IVtk | VTK integration module |
| VTK 6.1+ | https://www.vtk.org/download/ | Visualization | Optional (VTK integration) | | Flex 2.6.4+ and Bison 3.7.1+ | https://sourceforge.net/projects/winflexbison/ | Data Exchange | Updating STEP and ExprIntrp parsers |
| Flex 2.6.4+ and Bison 3.7.1+ | https://sourceforge.net/projects/winflexbison/ | Data Exchange | Optional (update of STEP and ExprIntrp parsers) | | RapidJSON 1.1+ | https://rapidjson.org/ | Data Exchange | Reading glTF files |
| RapidJSON 1.1+ | https://rapidjson.org/ | Data Exchange | Optional (reading glTF files) | | Draco 1.4.1+ | https://github.com/google/draco | Data Exchange | Reading compressed glTF files |
| Draco 1.4.1+ | https://github.com/google/draco | Data Exchange | Optional (reading compressed glTF files) | | Tcl/Tk 8.6.3+ | https://www.tcl.tk/software/tcltk/download.html | DRAW Test Harness | Tcl interpretor in Draw module |
| Tcl/Tk 8.6.3+ <br> or ActiveTcl 8.6 | https://www.tcl.tk/software/tcltk/download.html <br> https://www.activestate.com/activetcl/downloads | DRAW Test Harness | Required | | Qt 5.3.2+ | https://www.qt.io/download/ | Inspector and Samples | Inspector Qt samples and |
| Qt Desktop: Qt 4.8.6+ <br> Android: Qt 5.3.2+ | https://www.qt.io/download/ | Samples and demos | Optional (Qt samples) | | Doxygen 1.8.5+ | https://www.doxygen.nl/download.html | Documentation | (Re)generating documentation |
| Doxygen 1.8.5+ | https://www.doxygen.nl/download.html | Documentation | Required | | Graphviz 2.38+ | https://graphviz.org/ | Documentation | Generating dependency graphs |
| Graphviz 2.38+ | https://graphviz.org/ | Documentation | Optional (dependency graphs) |
@subsection intro_req_hw Hardware @subsection intro_req_hw Hardware
@@ -398,7 +397,7 @@ Don't forget to report these bugs to vendors.
@section intro_install Download and Installation @section intro_install Download and Installation
OCCT can be downloaded from https://www.opencascade.com/content/latest-release OCCT can be downloaded from https://dev.opencascade.org/release
In most cases you would want to rebuild OCCT from sources on your platform (OS, compiler) before In most cases you would want to rebuild OCCT from sources on your platform (OS, compiler) before
using it in your project, to ensure binary compatibility and appropriate configuration of the library. using it in your project, to ensure binary compatibility and appropriate configuration of the library.
@@ -432,7 +431,7 @@ The contents of the OCCT-7.4.0 directory (called further "OCCT root", or $CASROO
* **adm** This folder contains administration files, which allow rebuilding OCCT; * **adm** This folder contains administration files, which allow rebuilding OCCT;
* **adm/cmake** This folder contains files of CMake building procedure; * **adm/cmake** This folder contains files of CMake building procedure;
* **adm/msvc** This folder contains Visual Studio projects for Visual C++ 2010, 2012, 2013, 2015, 2017 and 2019 which allow rebuilding OCCT under Windows platform in 32 and 64-bit mode; * **adm/msvc** This folder contains Visual Studio projects for Visual C++ 2013, 2015, 2017, 2019 and 2022 which allow rebuilding OCCT under Windows platform in 32 and 64-bit mode;
* **adm/scripts** This folder contains auxiliary scripts for semi-automated building and packaging of OCCT for different platforms; * **adm/scripts** This folder contains auxiliary scripts for semi-automated building and packaging of OCCT for different platforms;
* **data** This folder contains CAD files in different formats, which can be used to test the OCCT functionality; * **data** This folder contains CAD files in different formats, which can be used to test the OCCT functionality;
* **doc** This folder contains OCCT documentation in HTML and PDF format; * **doc** This folder contains OCCT documentation in HTML and PDF format;
@@ -442,7 +441,7 @@ The contents of the OCCT-7.4.0 directory (called further "OCCT root", or $CASROO
* **src** This folder contains OCCT source files. They are organized in folders, one per development unit; * **src** This folder contains OCCT source files. They are organized in folders, one per development unit;
* **tests** This folder contains scripts for OCCT testing. * **tests** This folder contains scripts for OCCT testing.
* **tools** This folder contains sources of Inspector tool. * **tools** This folder contains sources of Inspector tool.
* **win64/vc10** This folder contains executable and library files built in optimize mode for Windows platform by Visual C++ 2010; * **win64/vc14** This folder contains executable and library files built in optimize mode for Windows platform by Visual C++ 2015;
@subsection intro_install_linux Linux @subsection intro_install_linux Linux
@@ -463,7 +462,7 @@ To run any Open CASCADE Technology application you need to set the environment v
You can define the environment variables with env.bat script located in the You can define the environment variables with env.bat script located in the
$CASROOT folder. This script accepts two arguments to be used: $CASROOT folder. This script accepts two arguments to be used:
the version of Visual Studio (vc10 -- vc142) and the architecture (win32 or win64). the version of Visual Studio (vc12 -- vc143) and the architecture (win32 or win64).
The additional environment settings necessary for compiling OCCT libraries and samples The additional environment settings necessary for compiling OCCT libraries and samples
by Microsoft Visual Studio can be set using script custom.bat located in the same folder. by Microsoft Visual Studio can be set using script custom.bat located in the same folder.
@@ -507,7 +506,7 @@ The scripts are located in the OCCT root folder.
* **CSF_ShadersDirectory** (optional) defines the directory for GLSL programs for Ray Tracing renderer (embedded resources are used when variable is undefined); * **CSF_ShadersDirectory** (optional) defines the directory for GLSL programs for Ray Tracing renderer (embedded resources are used when variable is undefined);
* **CSF_SHMessage** (optional) defines the path to the messages file for *ShapeHealing*; * **CSF_SHMessage** (optional) defines the path to the messages file for *ShapeHealing*;
* **CSF_XSMessage** (optional) defines the path to the messages file for **STEP** and **IGES** translators; * **CSF_XSMessage** (optional) defines the path to the messages file for **STEP** and **IGES** translators;
* **CSF_StandardDefaults**, **CSF_StandardLiteDefaults*, **CSF_XCAFDefaults**, and **CSF_PluginDefaults** define paths to directory where configuration files for OCAF persistence are located (required for open/save operations with OCAF documents); * **CSF_StandardDefaults**, **CSF_StandardLiteDefaults**, **CSF_XCAFDefaults**, and **CSF_PluginDefaults** define paths to directory where configuration files for OCAF persistence are located (required for open/save operations with OCAF documents);
* **CSF_IGESDefaults** and **CSF_STEPDefaults** (optional) define paths to directory where resource files of **IGES** and **STEP** translators are located; * **CSF_IGESDefaults** and **CSF_STEPDefaults** (optional) define paths to directory where resource files of **IGES** and **STEP** translators are located;
* **CSF_XmlOcafResource** is required in order to set the path to **XSD** resources, which defines XML grammar. * **CSF_XmlOcafResource** is required in order to set the path to **XSD** resources, which defines XML grammar.
* **CSF_MIGRATION_TYPES** is required in order to read documents that contain old data types, such as *TDataStd_Shape*; * **CSF_MIGRATION_TYPES** is required in order to read documents that contain old data types, such as *TDataStd_Shape*;
@@ -532,7 +531,7 @@ At minimum the following should be considered:
the application should be provided separately in a modifiable form, with all materials needed for the user to be able to run the application with a modified version of OCCT. the application should be provided separately in a modifiable form, with all materials needed for the user to be able to run the application with a modified version of OCCT.
If you want to use Open CASCADE Technology without being bound by LGPL requirements, If you want to use Open CASCADE Technology without being bound by LGPL requirements,
please <a href="https://www.opencascade.com/contact">contact Open CASCADE company</a> for a commercial license. please <a href="https://dev.opencascade.org/webform/contact_us">contact Open CASCADE company</a> for a commercial license.
Note that Open CASCADE Technology is provided on an "AS IS" basis, WITHOUT Note that Open CASCADE Technology is provided on an "AS IS" basis, WITHOUT
WARRANTY OF ANY KIND. The entire risk related to any use of the OCCT code and WARRANTY OF ANY KIND. The entire risk related to any use of the OCCT code and
@@ -573,8 +572,7 @@ FreeType 2 is released under two open-source licenses: BSD-like FreeType License
It is a library that helps you to take advantage of multi-core processor performance without having to be a threading expert. It is a library that helps you to take advantage of multi-core processor performance without having to be a threading expert.
Threading Building Blocks is not just a threads-replacement library. It represents a higher-level, task-based parallelism that Threading Building Blocks is not just a threads-replacement library. It represents a higher-level, task-based parallelism that
abstracts platform details and threading mechanisms for scalability and performance. abstracts platform details and threading mechanisms for scalability and performance.
TBB version 2017 is available under Apache 2.0 license, while older versions Intel oneTBB 2021.5.0 is available under Apache 2.0 license (https://www.threadingbuildingblocks.org).
until 4.4 are available under GPLv2 license with the runtime exception (https://www.threadingbuildingblocks.org).
**OpenGL** is an industry standard API for 3D graphics used by OCCT for **OpenGL** is an industry standard API for 3D graphics used by OCCT for
implementation of 3D viewer. OpenGL specification is developed by the implementation of 3D viewer. OpenGL specification is developed by the
@@ -593,10 +591,10 @@ If you need further information on VTK, refer to VTK Homepage https://www.vtk.or
**Doxygen** developed by Dimitri van Heesch is open source documentation system for **Doxygen** developed by Dimitri van Heesch is open source documentation system for
C++, C, Java, Objective-C, Python, IDL, PHP and C#. This product is used in Open CASCADE Technology C++, C, Java, Objective-C, Python, IDL, PHP and C#. This product is used in Open CASCADE Technology
for automatic creation of Technical Documentation from C++ header files. for automatic creation of Technical Documentation from C++ header files.
If you need further information on Doxygen, refer to https://www.stack.nl/~dimitri/doxygen/index.html. If you need further information on Doxygen, refer to https://www.doxygen.nl/index.html.
**Graphviz** is open source graph visualization software developed by John Ellson, Emden Gansner, Yifan Hu and Arif Bilgin. **Graphviz** is open source graph visualization software developed by John Ellson, Emden Gansner, Yifan Hu and Arif Bilgin.
Graph visualization is representiation of structured information as diagrams of abstract graphs and networks. Graph visualization is representation of structured information as diagrams of abstract graphs and networks.
This product is used together with Doxygen in Open CASCADE Technology for automatic creation of Technical Documentation This product is used together with Doxygen in Open CASCADE Technology for automatic creation of Technical Documentation
(generation of dependency graphs). Current versions of Graphviz are licensed on an open source (generation of dependency graphs). Current versions of Graphviz are licensed on an open source
basis under The Eclipse Public License (EPL) (https://www.graphviz.org/license/). basis under The Eclipse Public License (EPL) (https://www.graphviz.org/license/).

911
dox/samples/ais_object.md Normal file
View File

@@ -0,0 +1,911 @@
AIS: Custom Presentation {#tutorials__ais_object}
========
@tableofcontents
@section intro Getting Started
OCCT provides a strong set of built-in Interactive Objects for rapid application development,
but the real power and flexibility of **Application Interactive Services** (@c AIS) could be revealed by subclassing and implementing custom presentations.
In this tutorial we will focus on the development of a custom @c AIS_InteractiveObject and show the basics step by step.
Let's start from the very beginning and try subclassing @c AIS_InteractiveObject object:
~~~~{.cpp}
class MyAisObject : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTI_INLINE(MyAisObject, AIS_InteractiveObject)
public:
MyAisObject() {}
public:
virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) override {}
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) override {}
virtual bool AcceptDisplayMode (const Standard_Integer theMode) const override
{ return true; }
};
~~~~
@c DEFINE_STANDARD_RTTI_INLINE() macro will register the new class within the OCCT Run-Time Type Information (RTTI) system.
This step is optional (you may skip it if you are not going to use methods like @c Standard_Transient::DynamicType() in application code), but it is a common practice while subclassing OCCT classes.
The @c AIS_InteractiveObject interface defines only a couple of pure virtual methods - @c @::Compute() defining an object presentation and @c @::ComputeSelection() defining a selectable (pickable) volume.
Selection and presentation are two independent mechanisms in **AIS**. Presentation rendering is done with help of OpenGL or a similar low-level graphics library, while selection doesn't depend on a graphic driver at all.
Providing an empty implementation of these two methods would be enough for adding the object to @c AIS_InteractiveContext (@c @::Display()), but obviously nothing will appear on the screen.
@section prs_builders Presentation builders
To go ahead, we need to define some presentation of our object.
OCCT provides a set of presentation building tools for common elements like arrows, shapes, boxes, etc.
These tools could be found within @c Prs3d, @c StdPrs and @c DsgPrs packages:
- **Prs3d**
provides builders for simple geometric elements.
- @c Prs3d_Arrow, @c Prs3d_BndBox, @c Prs3d_Point, @c Prs3d_Text, @c Prs3d_ToolCylinder, @c Prs3d_ToolDisk, @c Prs3d_ToolSector, @c Prs3d_ToolSphere, @c Prs3d_ToolTorus
- **StdPrs**
provides builders for analytical geometry and B-Rep shapes (@c TopoDS_Shape).
- @c StdPrs_WFShape, @c StdPrs_ShadedShape, @c StdPrs_BRepTextBuilder
- **DsgPrs**
provides builders for datums, dimensions and relations.
Presentation builders are reusable bricks for constructing @c AIS objects.
Standard OCCT interactive objects highly rely on them, so that you may easily replicate @c AIS_Shape presentation for displaying a shape with just a couple of lines calling @c StdPrs_ShadedShape:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
}
...
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, true);
~~~~
@figure{ais_object_step1_shaded.png,"@c StdPrs_ShadedShape presentation builder.",409} height=409px
@c PrsMgr_PresentableObject::Compute() method takes three arguments:
- **Presentation Manager** (@c PrsMgr_PresentationManager).
Rarely used parameter, but might be necessary for some advanced use cases.
- **Presentation** (@c Prs3d_Presentation or @c Graphic3d_Structure).
Defines the structure to fill in with presentation elements.
- **Display Mode** (integer number).
Specifies the display mode to compute.
**0** is a default display mode, if not overridden by @c AIS_InteractiveObject::SetDisplayMode() or by @c AIS_InteractiveContext::Display().
For each supported display mode, the **Presentation Manager** creates a dedicated @c Prs3d_Presentation and stores it within the object itself as a list of presentations @c PrsMgr_PresentableObject::Presentations().
It is a good practice to reject unsupported display modes within @c @::Compute() method:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
if (theMode != 0) { return; } // reject non-zero display modes
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
}
~~~~
This wouldn't, however, prevent application from displaying the object with another display mode like this:
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, 100, -1, true);
~~~~
The code above will display @c MyAisObject with display mode equal to 100, and after @c @::Compute() modifications nothing will be displayed on the screen.
@c AIS will still create a presentation with specified display mode, but it will be empty - method @c @::AcceptDisplayMode() could be overridden to disallow even creation of an empty presentation:
~~~~{.cpp}
bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const
{
return theMode == 0; // reject non-zero display modes
}
~~~~
@c AIS_InteractiveContext::Display() checks if requested display mode is actually supported by the object, and uses default display mode (_**0**_) if it is not.
@c StdPrs_ShadedShape prepares a shaded (triangulated) presentation of a shape, while @c StdPrs_WFShape creates a wireframe presentation with B-Rep wire boundaries:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
if (!AcceptDisplayMode (theMode)) { return; }
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); // add shading
StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
}
~~~~
@figure{ais_object_step1_shaded_wf.png,"Result of @c StdPrs_ShadedShape + @c StdPrs_WFShape presentation builders.",409} height=409px
Presentation builders take the @c Prs3d_Drawer object defining various attributes - material of shaded shape, number of isolines in wireframe mode, tessellation quality, line colors and many others.
@c PrsMgr_PresentableObject defines @c myDrawer property with default attributes.
@c StdPrs makes it easy to display topological shapes.
With the help of @c Prs3d tools we may display elements like arrows, boxes or text labels.
Let's extend our presentation with a second **display mode 1** showing a bounding box using @c Prs3d_BndBox builder:
~~~~{.cpp}
bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const
{
return theMode == 0 || theMode == 1;
}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
if (theMode == 0)
{
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
}
else if (theMode == 1)
{
Bnd_Box aBox;
BRepBndLib::Add (aShape, aBox);
Prs3d_BndBox::Add (thePrs, aBox, myDrawer);
}
}
~~~~
Now, displaying an object with **display mode 1** will show a box:
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, 1, 0, true);
~~~~
@figure{ais_object_step1_bndbox.png,"@c Prs3d_BndBox presentation builder.",409} height=409px
@c AIS disallows activating multiple display modes at the same time, so that these presentation modes should be alternatives to each other.
But @c AIS may use non-active display mode for highlighting purposes - like wireframe (@c AIS_Wireframe) presentation displayed on top of shaded (@c AIS_Shaded) presentation for selected @c AIS_Shape objects.
Let's define a dedicated enumeration for display modes supported by our interactive object and setup the 1st (@c MyDispMode_Highlight) display mode for highlighting with help of @c PrsMgr_PresentableObject::SetHilightMode():
~~~~{.cpp}
class MyAisObject : public AIS_InteractiveObject
{
public:
enum MyDispMode { MyDispMode_Main = 0, MyDispMode_Highlight = 1 };
...
MyAisObject::MyAisObject()
{
SetDisplayMode (MyDispMode_Main); // main (active) display mode
SetHilightMode (MyDispMode_Highlight); // auxiliary (highlighting) mode
}
...
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
theCtx->HilightWithColor (aPrs, aPrs->HilightAttributes(), false);
theCtx->CurrentViewer()->Redraw();
~~~~
@figure{ais_object_step1_highlight.png,"Highlighting by color (left) and highlighting by another display mode (right).",818} height=409px
In this particular use case we've used the method @c AIS_InteractiveContext::HilightWithColor() instead of @c @::SetSelected() - just because our object is not selectable yet and @c @::SetSelected() wouldn't work.
Highlighted presentation appears on the screen with modulated color (see left screenshot above).
Using a dedicated display mode for highlighting (right screenshot above) allows customizing presentation in selected / highlighted states.
@section prim_arrays Primitive arrays
@c Prs3d_Presentation might be filled in by the following **primitives**:
- **Triangles**
- @c Graphic3d_ArrayOfTriangles
- @c Graphic3d_ArrayOfTriangleFans
- @c Graphic3d_ArrayOfTriangleStrips
- **Lines**
- @c Graphic3d_ArrayOfSegments
- @c Graphic3d_ArrayOfPolylines
- **Points** or **Markers**
- @c Graphic3d_ArrayOfPoints
This triplet of primitives is what graphics hardware is capable of rendering, so that it could be transferred directly to low-level graphics libraries in the form of *Vertex Buffer Objects* (VBO).
Each **primitive array** consists of an array of vertex attributes (_**position**, **normal**, **texture coordinates**, **vertex colors**_, etc.) and optional **array of indices**.
The latter one avoids duplicating vertices shared between connected elements (triangles, polylines) in attributes array.
@c Graphic3d_ArrayOfPrimitives and it's subclasses provide a convenient interface for filling in primitive arrays:
- Constructor takes a number of vertices, number of edges (indices) and a bitmask of optional vertex attributes.
- @c Graphic3d_ArrayOfPrimitives::AddVertex() appends a vertex with specified attributes to the end of the array (within the range specified at construction time).
- @c Graphic3d_ArrayOfPrimitives::AddEdges() appends indices, starting with 1.
Each line segment is defined by two consequential edges, each triangle is defined by three consequential edges.
Let's extend our sample and display a cylinder section contour defined by array of indexed segments (e.g. a polyline of four vertices):
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
if (theMode == MyDispMode_Main)
{
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
//StdPrs_WFShape::Add (thePrs, aShape, myDrawer);
Handle(Graphic3d_ArrayOfSegments) aSegs = new Graphic3d_ArrayOfSegments (4, 4 * 2, Graphic3d_ArrayFlags_None);
aSegs->AddVertex (gp_Pnt (0.0, -aRadius, 0.0));
aSegs->AddVertex (gp_Pnt (0.0, -aRadius, aHeight));
aSegs->AddVertex (gp_Pnt (0.0, aRadius, aHeight));
aSegs->AddVertex (gp_Pnt (0.0, aRadius, 0.0));
aSegs->AddEdges (1, 2);
aSegs->AddEdges (2, 3);
aSegs->AddEdges (3, 4);
aSegs->AddEdges (4, 1);
Handle(Graphic3d_Group) aGroupSegs = thePrs->NewGroup();
aGroupSegs->SetGroupPrimitivesAspect (myDrawer->WireAspect()->Aspect());
aGroupSegs->AddPrimitiveArray (aSegs);
}
else if (theMode == MyDispMode_Highlight) { ... }
}
~~~~
@figure{ais_object_step2_segments.png,"Displaying @c Graphic3d_ArrayOfSegments.",409} height=409px
The process is quite straightforward:
- Create a new @c Graphic3d_Group using @c Prs3d_Presentation::NewGroup();
- Specify presentation aspects using @c Graphic3d_Group::SetGroupPrimitivesAspect();
- Create and add an array of primitives using @c Graphic3d_Group::AddPrimitiveArray().
Standard presentation builders like @c StdPrs_ShadedShape / @c StdPrs_WFShape internally do exactly the same thing - a tessellated representation of a shape is added to presentation in form of triangles (shaded),
line segments (wireframe and free edges) and markers (free shape vertices).
A single @c Graphic3d_Group normally defines just a single primitive array, but it is technically possible adding more arrays to the same group @c Graphic3d_Group::AddPrimitiveArray()
and with different aspects @c Graphic3d_Group::SetPrimitivesAspect(), which might be considered in advanced scenarios.
Method @c Graphic3d_Group::AddText() allows adding text labels to a presentation.
Internally, text labels are rendered as an array of textured triangles using texture atlas created from a font, but this complex logic is hidden from the user.
@section prim_aspects Primitive aspects
@c Graphic3d_Aspects is a class defining **display properties** of a primitive array (@c Graphic3d_Group::SetGroupPrimitivesAspect()) -
_**material**, **shading model**, **color**, **texture maps**, **blending mode**, **line width**_ and others.
There are also subclasses @c Graphic3d_AspectFillArea3d (triangles), @c Graphic3d_AspectLine3d (lines), @c Graphic3d_AspectMarker3d (markers)
and @c Graphic3d_AspectText3d (text labels) defined as specializations for a specific primitive array type.
These subclasses exist for historical reasons and are treated by renderers in exactly the same way.
It is technically possible to create transient aspects directly within @c @::Compute() method like this:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
Handle(Graphic3d_Aspects) anAspects = new Graphic3d_Aspects();
anAspects->SetShadingModel (Graphic3d_TypeOfShadingModel_Unlit);
anAspects->SetColor (Quantity_NOC_RED);
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
aGroup->SetGroupPrimitivesAspect (anAspects);
...
}
~~~~
While this code would work as expected, but prevents further dynamic updates of presentation aspects without recomputing entire presentation.
Instead, it is preferred taking attributes from @c PrsMgr_PresentableObject::myDrawer / @c @::Attributes() or storing custom attributes as class fields.
@c Prs3d_Drawer defines a set of attributes used by @c AIS presentation builders, but the same parameters might be used by a custom builder as well.
It is also preferred preallocating attributes in the class constructor.
This would allow changing attributes without recomputing the entire presentation - just by calling @c PrsMgr_PresentableObject::SynchronizeAspects() after modifications.
Our custom object uses @c myDrawer->ShadingAspect() and @c myDrawer->WireAspect() aspects, so let's initialize them explicitly - assign silver material for shading and green color to line segments:
~~~~{.cpp}
MyAisObject::MyAisObject()
{
SetHilightMode (MyDispMode_Highlight);
myDrawer->SetupOwnShadingAspect();
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NameOfMaterial_Silver);
myDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 2.0));
}
~~~~
@section quadric_builders Quadric builders
Previously, we've used @c StdPrs_ShadedShape for displaying cylinder geometry.
The @c Prs3d package provides a simpler way for displaying geometry like cylinders, spheres and toruses - based on the @c Prs3d_ToolQuadric interface.
This interface allows bypassing creation of a complex B-Rep (@c TopoDS_Shape) definition of a simple geometry, and to avoid using general-purpose tessellators like @c BRepMesh.
> This difference could be negligible for a small number of such objects, but might become considerable for larger amounts.
> The B-Rep definition of a valid cylinder includes 2 unique @c TopoDS_Vertex, 3 @c TopoDS_Edge, 3 @c TopoDS_Wire, 3 @c TopoDS_Face, 1 @c TopoDS_Shell and 1 @c TopoDS_Solid.
> Internally each @c TopoDS_Edge also defines curves (@c Geom_Curve as well as 2D parametric @c Geom2d_Curve) and each @c TopoDS_Face defines analytical surface (@c Geom_Surface).
> Meshing such geometry with the help of @c BRepMesh is much more complicated than one may think.
> A plenty of data structures (memory!) and computations (time!) for displaying a geometry that could be triangulated by a simple for loop.
@c Prs3d_ToolQuadric solves this problem by creating a triangulation for such kinds of shapes in a straight-forward way.
Let's try using @c Prs3d_ToolCylinder in our sample:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
if (theMode == MyDispMode_Main)
{
//StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); // add shading
//StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 10, 10, gp_Trsf());
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupTris->AddPrimitiveArray (aTris);
...
}
...
}
~~~~
@figure{ais_object_step3_quadrics_10.png,"@c Prs3d_ToolCylinder (10 slices).",409} height=409px
Well... that looks a little bit edgy.
Quadric builder creates a triangulation taking the following parameters:
- Geometry parameters.
(in case of a cylinder - base radius, top radius and height).
- Number of subdivisions along U (slices) and V (stacks) parameters.
In some cases only one parametric scope matters.
- Transformation @c gp_Trsf to apply
(original geometry is defined within some reference coordinate system).
Let's increase number of subdivisions from _10_ to _25_:
~~~~{.cpp}
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf());
~~~~
@figure{ais_object_step3_quadrics_25.png,"@c Prs3d_ToolCylinder (25 slices).",409} height=409px
It looks much better now! Note that @c Prs3d_ToolCylinder could be used for building both cones and cylinders depending on top/bottom radius definition.
There is one issue though - our cylinder doesn't have top and bottom anymore!
To fix this problem we will use one more quadric builder @c Prs3d_ToolDisk:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
if (theMode == MyDispMode_Main)
{
Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, 25, 25);
Prs3d_ToolDisk aDisk (0.0, aRadius, 25, 1);
Handle(Graphic3d_ArrayOfTriangles) aTris =
new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb() + 2 * aDisk.VerticesNb(),
3 * (aCyl.TrianglesNb() + 2 * aDisk.TrianglesNb()),
Graphic3d_ArrayFlags_VertexNormal);
aCyl .FillArray (aTris, gp_Trsf());
aDisk.FillArray (aTris, gp_Trsf());
gp_Trsf aDisk2Trsf;
aDisk2Trsf.SetTransformation (gp_Ax3 (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ(), gp::DX()), gp::XOY());
aDisk.FillArray (aTris, aDisk2Trsf);
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupTris->AddPrimitiveArray (aTris);
aGroupTris->SetClosed (true);
...
}
}
~~~~
Now our cylinder looks solid! The sample above merges two triangulations into a single one instead of appending each primitive array individually.
This looks like a minor difference, but it might have a _dramatic impact on performance_ in case of a large scene,
as each `Graphic3d_ArrayOfPrimitives` is mapped into a dedicated draw call at graphic driver (OpenGL) level.
@figure{ais_object_step3_quadrics_fin.png,"@c Prs3d_ToolCylinder + @c Prs3d_ToolDisk.",409} height=409px
As an exercise, let's try computing a triangulation for cylinder disk without help of @c Prs3d_ToolDisk builder:
~~~~{.cpp}
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
if (theMode == MyDispMode_Main)
{
const int aNbSlices = 25;
Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, aNbSlices, aNbSlices);
Handle(Graphic3d_ArrayOfTriangles) aTris =
new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb(),
3 * (aCyl.TrianglesNb()),
Graphic3d_ArrayFlags_VertexNormal);
aCyl.FillArray (aTris, gp_Trsf());
Handle(Graphic3d_ArrayOfTriangles) aTris2 =
new Graphic3d_ArrayOfTriangles (aNbSlices + 1, aNbSlices * 3, Graphic3d_ArrayFlags_VertexNormal);
aTris2->AddVertex (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ());
for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter)
{
double anAngle = M_PI * 2.0 * double(aSliceIter) / double(aNbSlices);
aTris2->AddVertex (gp_Pnt (Cos (anAngle) * aRadius, Sin (anAngle) * aRadius, aHeight), -gp::DZ());
}
for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter)
{
aTris2->AddEdges (1, aSliceIter + 2, aSliceIter + 1 < aNbSlices ? (aSliceIter + 3) : 2);
}
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroupTris->AddPrimitiveArray (aTris);
aGroupTris->AddPrimitiveArray (aTris2);
...
}
}
~~~~
@figure{ais_object_step3_quadrics_disk.png,"Manually triangulated disk.",409} height=409px
The disk is here, but it has a strange color - like it is not affected by lighting.
This happens when vertex normals are defined incorrectly.
In our case we defined disk normal as @c -DZ (see the second argument of @c Graphic3d_ArrayOfTriangles::AddVertex()),
but normal direction should be also aligned to triangulation winding rule.
Graphic driver defines the front side of triangle using clockwise order of triangle nodes, and normal should be defined for a front side of triangle - e.g. it should be @c gp::DZ() in our case.
After reversing vertex normal direction, cylinder looks exactly like when @c Prs3d_ToolDisk was used.
Front / back face orientation might be displayed using different material based on @c Graphic3d_Aspects::SetDistinguish() flag and @c @::FrontMaterial() / @c @::BackMaterial() setup.
@section ais_selection Computing selection
In the first part of the tutorial we have created a custom @c AIS object @c MyAisObject computing presentation by implementing the @c PrsMgr_PresentableObject::Compute() interface.
In this part we will extend our object with interactive capabilities and make it selectable through implementing @c SelectMgr_SelectableObject interface.
Let's do the first step and put into @c @::ComputeSelection() method some logic.
This method should fill in the @c SelectMgr_Selection argument with @c SelectMgr_SensitiveEntity entities defining selectable elements - triangulations, polylines, points and their composition.
@c Select3D_SensitiveBox is probably the simplest way to define selectable volume - by it's bounding box:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
Bnd_Box aBox;
BRepBndLib::Add (aShape, aBox);
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
Handle(Select3D_SensitiveBox) aSensBox = new Select3D_SensitiveBox (anOwner, aBox);
theSel->Add (aSensBox);
}
~~~~
@c SelectMgr_EntityOwner is a key object in selection logic - it serves as an identifier of a pickable object or it's part.
You may see this object in methods like @c AIS_InteractiveContext::DetectedOwner(), **Owners** are stored within the list of selection objects @c AIS_Selection
and it received by methods like @c AIS_InteractiveContext::SetSelected() and @c AIS_InteractiveContext::AddOrRemoveSelected().
From the Selector's point of view, @c AIS_InteractiveObject is just a drawer for @c SelectMgr_EntityOwner.
The _**0th selection mode**_ normally defines a single Owner of the entire object.
To make a composite object selectable as whole, we add to Selection as many SensitiveEntity as necessary referring to the same Owner.
It might look confusing from first glance, that @c SelectMgr_SensitiveEntity stores @c SelectMgr_EntityOwner as a class field, and not in the opposite way
(@c SelectMgr_EntityOwner doesn't store the list of @c SelectMgr_SensitiveEntity defining it's picking volume).
For local selection (selection of object parts) we create individual Owners for each part and add SensitiveEntity to Selection in the same way.
Owner may store an additional identifier as a class field, like @c StdSelect_BRepOwner stores @c TopoDS_Shape as an identifier of picked sub-shape with @c AIS_Shape object.
In a similar way as @c StdPrs_ShadedShape is a **presentation builder** for @c TopoDS_Shape, the @c StdSelect_BRepSelectionTool can be seen as a standard **selection builder** for shapes:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
Standard_Real aDefl = StdPrs_ToolTriangulatedShape::GetDeflection (aShape, myDrawer);
StdSelect_BRepSelectionTool::Load (theSel, this, aShape, TopAbs_SHAPE, aDefl,
myDrawer->DeviationAngle(),
myDrawer->IsAutoTriangulation());
}
~~~~
Internally, @c StdSelect_BRepSelectionTool iterates over sub-shapes and appends to the Selection (@c theSel) entities like @c Select3D_SensitiveTriangulation (for faces) and @c Select3D_SensitiveCurve (for edges).
Previously, we have used @c Prs3d_ToolCylinder to triangulate a cylinder, so let's try to construct @c Select3D_SensitivePrimitiveArray from the same triangulation:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf());
Handle(Select3D_SensitivePrimitiveArray) aSensTri =
new Select3D_SensitivePrimitiveArray (anOwner);
aSensTri->InitTriangulation (aTris->Attributes(), aTris->Indices(),
TopLoc_Location());
theSel->Add (aSensTri);
}
~~~~
Selection is computed independently from presentation, so that they don't have to match each other.
But inconsistency between presentation and selection might confuse a user, when he will not be able to pick an object clearly displayed under the mouse cursor.
These issues might happen, for example, when selection uses tessellated representation of the same geometry computed with different parameters (different number of subdivisions, or different deflection parameters).
As in case of @c @::Compute(), it makes sense defining some enumeration of **selection modes** supported by specific object and reject unsupported ones to avoid unexpected behavior:
~~~~{.cpp}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
if (theMode != 0) { return; }
...
}
~~~~
Unlike display modes, @c AIS_InteractiveContext allows activating an arbitrary combination of selection modes.
A user should be careful to activate only the modes that actually make sense and may work together.
Selection mode to activate could be specified while displaying the object (passing _**-1**_ instead of _**0**_ would display an object with deactivated selection):
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(MyAisObject) aPrs = new MyAisObject();
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
~~~~
Later on @c AIS_InteractiveContext::SetSelectionModeActive(), or it's wrappers @c AIS_InteractiveContext::Activate() and @c AIS_InteractiveContext::Deactivate(),
could be used to enable or disable desired selection modes one by one.
@section sel_owner_highlight Highlighting selection owner
As has been mentioned in the previous section, @c SelectMgr_EntityOwner is a key object which can be used as an identifier of selectable part(s).
Naturally, you might want to subclass it to put some application-specific ids for identification of selected parts.
But there are more things you may do with the Owner class like customized highlighting.
Let's start from the beginning and define a custom Owner class:
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
DEFINE_STANDARD_RTTI_INLINE(MyAisOwner, SelectMgr_EntityOwner)
public:
MyAisOwner (const Handle(MyAisObject)& theObj, int thePriority = 0)
: SelectMgr_EntityOwner (theObj, thePriority) {}
virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode) override
{ base_type::HilightWithColor (thePrsMgr, theStyle, theMode); }
virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode) override
{ base_type::Unhilight (thePrsMgr, theMode); }
protected:
Handle(Prs3d_Presentation) myPrs;
};
~~~~
@c SelectMgr_EntityOwner doesn't define any pure virtual methods, and can be instanced straight ahead, like it was done within @c MyAisObject::ComputeSelection() implementation above.
Let's revert usage of a dedicated display mode for highlighting (remove @c SetHilightMode() in @c MyAisObject constructor) and use our new class @c MyAisOwner within @c @::ComputeSelection():
~~~~{.cpp}
MyAisObject::MyAisObject()
{
//SetHilightMode (MyDispMode_Highlight);
myDrawer->SetupOwnShadingAspect();
...
}
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
const double aRadius = 100.0, aHeight = 100.0;
Handle(MyAisOwner) anOwner = new MyAisOwner (this);
...
}
~~~~
The further logic creating sensitive entities and filling in Selection could be left as is.
Substitution of @c SelectMgr_EntityOwner with @c MyAisOwner currently doesn't change behavior and we see highlighting of the entire object through color modulation.
This is because default implementation of @c SelectMgr_EntityOwner for highlighting logic looks like this (simplified):
~~~~{.cpp}
void SelectMgr_EntityOwner::HilightWithColor (
const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
const Graphic3d_ZLayerId aHiLayer =
theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN
? theStyle->ZLayer()
: mySelectable->ZLayer();
thePrsMgr->Color (mySelectable, theStyle, theMode, NULL, aHiLayer);
}
~~~~
@figure{ais_object_step4_highlight1.png,"Default behavior of @c SelectMgr_EntityOwner::HilightWithColor().",409} height=409px
Now, let's override the @c SelectMgr_EntityOwner::HilightWithColor() method and display a bounding box presentation:
~~~~{.cpp}
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
if (myPrs.IsNull())
{
myPrs = new Prs3d_Presentation (thePrsMgr->StructureManager());
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
anObj->Compute (thePrsMgr, myPrs, MyAisObject::MyDispMode_Highlight);
}
if (!thePrsMgr->IsImmediateModeOn())
{
myPrs->Display();
}
}
~~~~
@c SelectMgr_EntityOwner::HilightWithColor() doesn't receive a presentation to fill in as an argument; highlight presentation should be manually created and even explicitly displayed on the screen.
To avoid code duplication, the code above reuses @c MyAisObject::Compute() already implementing computation of highlight presentation.
@figure{ais_object_step4_highlight2.png,"Result of custom implementation @c MyAisOwner::HilightWithColor().",409} height=409px
The visual result of the selected object looks exactly the same as when we've used a dedicated highlight mode.
One thing became broken, though - highlighting remains displayed even after clearing selection.
To fix this issue, we need implementing @c SelectMgr_EntityOwner::Unhilight() and hide our custom presentation explicitly:
~~~~{.cpp}
void MyAisOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode)
{
if (!myPrs.IsNull()) { myPrs->Erase(); }
}
~~~~
Another problem is that the object is no longer dynamically highlighted.
To fix that we need to handle @c PrsMgr_PresentationManager::IsImmediateModeOn() specifically.
Within this mode turned ON, presentation should be displayed on the screen with help of @c PrsMgr_PresentationManager::AddToImmediateList() method
(it will be cleared from the screen automatically on the next mouse movement):
~~~~{.cpp}
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
if (myPrs.IsNull())
{
myPrs = new Prs3d_Presentation (thePrsMgr->StructureManager());
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
anObj->Compute (thePrsMgr, myPrs, MyAisObject::MyDispMode_Highlight);
}
if (thePrsMgr->IsImmediateModeOn())
{
Handle(Prs3d_PresentationShadow) aShadow =
new Prs3d_PresentationShadow (thePrsMgr->StructureManager(), myPrs);
aShadow->SetZLayer (Graphic3d_ZLayerId_Top);
aShadow->Highlight (theStyle);
thePrsMgr->AddToImmediateList (aShadow);
}
else
{
myPrs->Display();
}
}
~~~~
We may create two dedicated presentations for dynamic highlighting or reuse existing one for both cases with help of a transient object @c Prs3d_PresentationShadow.
Let's go further and make dynamic highlighting a little bit more interesting - by drawing a surface normal at the point where mouse picked the object:
~~~~{.cpp}
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode)
{
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
if (thePrsMgr->IsImmediateModeOn())
{
Handle(StdSelect_ViewerSelector) aSelector =
anObj->InteractiveContext()->MainSelector();
SelectMgr_SortCriterion aPickPnt;
for (int aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
if (aSelector->Picked (aPickIter) == this)
{
aPickPnt = aSelector->PickedData (aPickIter);
break;
}
}
Handle(Prs3d_Presentation) aPrs = mySelectable->GetHilightPresentation (thePrsMgr);
aPrs->SetZLayer (Graphic3d_ZLayerId_Top);
aPrs->Clear();
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
aGroupPnt->SetGroupPrimitivesAspect (theStyle->ArrowAspect()->Aspect());
gp_Trsf aTrsfInv = mySelectable->LocalTransformation().Inverted();
gp_Dir aNorm (aPickPnt.Normal.x(), aPickPnt.Normal.y(), aPickPnt.Normal.z());
Handle(Graphic3d_ArrayOfTriangles) aTris =
Prs3d_Arrow::DrawShaded (gp_Ax1(aPickPnt.Point, aNorm).Transformed (aTrsfInv),
1.0, 15.0,
3.0, 4.0, 10);
aGroupPnt->AddPrimitiveArray (aTris);
thePrsMgr->AddToImmediateList (aPrs);
}
}
~~~~
Code above does not store our new highlight presentation as a property of @c MyAisOwner, and instead uses @c SelectMgr_SelectableObject::GetHilightPresentation() method
to create a presentation stored directly inside of our interactive object.
Next trick is passing through the last picking results in @c StdSelect_ViewerSelector.
Dynamic highlighting is expected to be called right after picking, so that highlighted Owner should be always found in picking results.
@c StdSelect_ViewerSelector::Picked() returns entities in the descending order of their distance from picking ray origin (mouse cursor);
normally our Owner should be the very first one in this list when no selection filters are assigned to @c AIS_InteractiveContext.
@c SelectMgr_SortCriterion provides us useful information like 3D point on detected object lying on the picking ray, and surface normal direction at this point (actually, it would be a normal to a picked triangle),
which we display as an arrow with help of @c Prs3d_Arrow presentation builder.
@figure{ais_object_step4_highlight3.png,"Surface normal on mouse over.",409} height=409px
Result looks pretty nice on the screenshot, but has interaction problems - once displayed, an arrow is no longer updated with further mouse movements.
But this behavior is not a bug - @c AIS calls @c MyAisOwner::HilightWithColor() only when picking Owner changes to avoid unnecessary Viewer updates.
To override this behavior, we may override @c SelectMgr_EntityOwner::IsForcedHilight() option:
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
...
virtual bool IsForcedHilight() const override { return true; }
};
~~~~
This solves the problem within our specific use case.
Keep in mind that most objects don't need updating highlight presentation on every mouse move;
overriding this flag everywhere would be a waste of resources and may cause performance issues - use it sparingly.
@section highlight_apporaches Highlighting approaches
@c AIS provides one more alternative to handle presentation highlighting, which is managed by option @c SelectMgr_SelectableObject::IsAutoHilight().
By default, this option is turned ON and redirects highlighting logic to @c SelectMgr_EntityOwner::HilightWithColor() demonstrated in the previous section.
Turning this option OFF redirects highlighting logic to the interactive object itself @c SelectMgr_SelectableObject::HilightSelected().
Apart from moving the logic from Owner to Interactive Object, this approach allows handling highlighting of all selected Owners within the same Object at once and sharing a common presentation
instead of per-Owner presentation - improving performance and reducing memory utilization in case of a large number of small selectable elements, like mesh nodes in @c MeshVS_Mesh object.
The further optimization of such a scenario would be using a single Owner for the entire Object
storing the list of selected elements within the Owner itself - as utilized by @c AIS_PointCloud object for highlighting individual points.
We wouldn't describe these advanced techniques here in detail - let's just summarize main highlighting approaches available in @c AIS:
- Highlighting of a main presentation of Interactive Object (active display mode)
filled in by @c PrsMgr_PresentableObject::Compute()
and displayed with color modulation by @c AIS logic.
- Example: @c AIS_TextLabel.
- Highlighting of a secondary presentation of Interactive Object
filled in by @c PrsMgr_PresentableObject::Compute()
and displayed with color modulation by @c AIS logic.
- Example: @c AIS_Shape, displayed in @c AIS_Shaded display mode and highlighted using @c AIS_Wireframe display mode (default behavior).
See also @c PrsMgr_PresentableObject::SetHilightMode().
- Highlight presentation stored within a custom @c SelectMgr_EntityOwner
and managed by @c SelectMgr_EntityOwner::HilightWithColor().
- Example: @c StdSelect_BRepOwner for selection of sub-shapes.
- Custom highlight presentation stored within Interactive Object itself
(see @c SelectMgr_SelectableObject::GetHilightPresentation() / @c @::GetSelectPresentation() methods).
- Filled in by @c SelectMgr_EntityOwner::HilightWithColor()
with @c SelectMgr_SelectableObject::IsAutoHilight() turned ON.<br>
Example: @c AIS_PointCloud.
- Filled in by @c SelectMgr_SelectableObject::HilightSelected()
with @c SelectMgr_SelectableObject::IsAutoHilight() turned OFF.<br>
Example: @c MeshVS_Mesh.
- Main presentation of Interactive Object (active display mode)
filled in by @c PrsMgr_PresentableObject::Compute()
and manually updated (recomputed or modified aspects) on highlight events.
- Example: @c AIS_Manipulator.
The number of options looks overwhelming but in general, it is better to stick to the simplest approach working for you and consider alternatives only when you have to.
@section mouse_click Mouse click
Dynamic highlighting is only one of scenarios where @c SelectMgr_EntityOwner could be useful.
Another feature is an interface for handling a mouse click @c SelectMgr_EntityOwner @c @::HandleMouseClick().
This interface is useful for defining some user interface elements like buttons, and most likely your application will use a more comprehensive GUI framework for this purpose instead of @c AIS.
But let's have some fun and make our object to change a color on each mouse click:
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
...
virtual bool HandleMouseClick (const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick) override;
};
bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick)
{
static math_BullardGenerator aRandGen;
Quantity_Color aRandColor (float(aRandGen.NextInt() % 256) / 255.0f,
float(aRandGen.NextInt() % 256) / 255.0f,
float(aRandGen.NextInt() % 256) / 255.0f,
Quantity_TOC_sRGB);
mySelectable->Attributes()->ShadingAspect()->SetColor(aRandColor);
mySelectable->SynchronizeAspects();
return true;
}
~~~~
Looks pretty simple. Now let's make things more interesting and launch some simple object animation on each click.
We use a couple of global (@c static) variables in our sample for simplicity - don't do that in a real production code.
~~~~{.cpp}
class MyAisOwner : public SelectMgr_EntityOwner
{
...
void SetAnimation (const Handle(AIS_Animation)& theAnim)
{ myAnim = theAnim; }
...
Handle(AIS_Animation) myAnim;
};
bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick)
{
static bool isFirst = true;
isFirst = !isFirst;
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
gp_Trsf aTrsfTo;
aTrsfTo.SetRotation (gp_Ax1 (gp::Origin(), gp::DX()),
isFirst ? M_PI * 0.5 : -M_PI * 0.5);
gp_Trsf aTrsfFrom = anObj->LocalTransformation();
Handle(AIS_AnimationObject) anAnim =
new AIS_AnimationObject ("MyAnim", anObj->InteractiveContext(),
anObj, aTrsfFrom, aTrsfTo);
anAnim->SetOwnDuration (2.0);
myAnim->Clear();
myAnim->Add (anAnim);
myAnim->StartTimer (0.0, 1.0, true);
return true;
}
~~~~
Animation is a complex topic that is worth a dedicated article - let's not go too deep in detail here.
To perform animation in a non-interrupted way, it should be handled by some class like @c AIS_ViewController, which is responsible for managing user input events and for 3D viewer updates.
To utilize it, you need adding a custom object animation to @c AIS_ViewController::ObjectsAnimation() or adding custom view animation to @c AIS_ViewController::ViewAnimation().
Somewhere in application this might look like this:
~~~~{.cpp}
Handle(AIS_InteractiveContext) theCtx;
Handle(AIS_ViewController) theViewCtrl;
Handle(MyAisObject) aPrs = new MyAisObject();
aPrs->SetAnimation (theViewCtrl->ObjectsAnimation());
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
~~~~
@section final Final result
The final sample could be seen by calling @c QATutorialAisObject command from Draw Harness plugin @c QAcommands (@c TKQADraw toolkit):
~~~~
pload VISUALIZATION QAcommands
vinit View1
QATutorialAisObject p
vfit
~~~~
You may also take a look onto source code of this command at @c src/QADraw/QADraw_Tutorials.cxx if you have some problems following the tutorial.

View File

@@ -1,4 +1,4 @@
Draw Demo Scripts {#samples__draw_scripts} Draw: Demo Scripts {#samples__draw_scripts}
================ ================
All demo scripts are provided with OCCT sources and locate in <i>CASROOT/samples/tcl</i>. To play around them please All demo scripts are provided with OCCT sources and locate in <i>CASROOT/samples/tcl</i>. To play around them please

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

115
dox/samples/novice_guide.md Normal file
View File

@@ -0,0 +1,115 @@
Novice Guide {#samples__novice_guide}
=======
@tableofcontents
@section diffs Modeling with OCCT: Key differences
Open CASCADE Technology (OCCT) is an object-oriented C++ framework designed for rapid production of sophisticated CAD/CAM/CAE applications.
In other words, it provides endless possibilities for raw 2D and 3D modeling in C++ environment.
Unlike end-user software, it is used by the application developers and therefore strongly differs from the most popular CAD/CAM/CAE software packages.
OCCT provides building blocks enough for modeling, editing, visualization, and data interoperability of 2D and 3D objects.
By using OCCT, users can create the objects of their desire (or edit already existing ones) using raw code commands.
It is a more complicated process than using GUI-based software, but it provides much more flexibility than even script-based manipulations that are available within existing CAD/CAM/CAE applications.
However, to fully grasp the possibilities of OCCT it is best for the user to have previous experience in C++ at least at a basic level.
@section basics Understanding the principles
If you don't have any programming skills, grasping the full magnitude of OCCT workflow is still an option.
The documentation for OCCT contains several entry points for new users.
It will not explain all OCCT classes but will help to comprehend the workflow and help start thinking in terms of Open CASCADE Technology.
The most basic workflow is described in the @ref occt__tutorial "OCCT Tutorial" - this is an excellent starting point for new users.
In this tutorial you will create a solid model step-by-step using different classes and methods.
Each step of the tutorial contains code snippets and images.
The basics involved in the modeling process are explained.
When the basics of OCCT are clear, the next logical step is to check out @ref samples "sample applications" and examine those that suit your needs.
For these, the best starting point is **OCCTOverview** located in /samples/qt subfolder of OCCT installation.
This sample provides code examples for several actions as well as visualization of these code snippets output.
The Overview interface is dynamically changing based on selected **Category** at the menu.
Additional menu buttons will appear, providing users with subcategories and relevant commands to select one of the actions.
The result will appear in the viewer window, the code will appear at the top right, and in several cases the output will be produced at the bottom right window.
@figure{sample_overview_qt_viewers.png,"Comparison of 3D and 2D viewer windows",240} height=420px
The 3D viewer window has a row of preset interface buttons to customize the visual output.
Those buttons can be grouped into three types, left to right:
- View controls: **Fit all** and **Isometric**, will center the view and reset the camera angles respectively;
- Display mode customization: **HLR,** e.g. "Hidden line removal" (works only when shading is disabled) can be turned on and off;
solid models may be displayed either in **Shading** or **Wireframe** modes. **Transparency** level may be set for models in shading mode;
- The last four buttons in a row are beautifiers enabling Ray-tracing engine and configuring it's parameters.
At the bottom left of the screen the orientation cube (trihedron) is located.
The trihedron interactively shows the position of the camera in relation to the XYZ axis of the displayed data.
The sides of the trihedron are labeled to help with orientation.
Click on a side of the box to orient the camera view along the preferred axis.
The 2D viewer window lacks most of these elements and only have **Fit all** button.
The **Geometry** category of the Overview focuses on primitive objects like dots, lines (including vectors) or planes.
These objects will appear in the viewer after the subcategory is selected.
This section will demonstrate these entities both in 2D and 3D view mode and provide basic examples of parametric creation and data analysis.
@figure{sample_overview_qt_geometry.png,"",240} height=440px
The usage of the functions shown in the Overview is described more thoroughly at the @ref occt_user_guides__modeling_data "Modeling data" section of the documentation.
Additionally, @ref occt_user_guides__modeling_algos "Modeling Algorithms" are used in more complex cases.
The **Topology** section of the Overview demonstrates the functions used in 3D operations.
Multiple use cases are provided, including different object intersections, modifying and calculations.
Some of these use cases are described in the documentation, such as @ref occt_user_guides__inspector "Inspector" usage.
@figure{sample_overview_qt_topology.png,"",240} height=440px
The subsections are grouped as shown on the screenshot before.
Most shapes and primitive objects are introduced and then followed by a set of operations and interactions.
The **Triangulation** segment allows computing the number of triangles on a shape.
This may be inspected via [Poly_Triangulation Class Reference](https://dev.opencascade.org/doc/refman/html/class_poly___triangulation.html) -
a part of the [Reference manual](https://dev.opencascade.org/doc/refman/html/index.html),
an overall Open CASCADE code guide that may be used to inspect the key points in classes and their connections.
@figure{sample_overview_qt_triangulation.png,"",240} height=440px
The triangulation uses some of Mesh-related classes - see full description at @ref occt_user_guides__mesh "Mesh" documentation section.
The **Data exchange** section provides examples of how to export and import files of several different formats.
@figure{sample_overview_qt_xde.png,"",240} height=440px
The **OCAF** section gives an introduction for the @ref intro_overview_ocaf "Open CASCADE Application Framework" functionality.
To test these functions, create an object first (box or cylinder).
After that, the object may be modified and saved. Actions are recorded and may be undone or redone.
@figure{sample_overview_qt_ocaf.png,"",240} height=440px
**Viewers** section demonstrates examples of the 2D and 3D visualization outputs.
Check @ref occt_user_guides__visualization "Visualization" section of the documentation for a detailed description.
In addition to these two samples, there are much more that might be of use to a new user based on their particular use case.
Check Readme files in the sample directories to learn more about samples compilation.
**Note:** source code for OCCTOverview is stored at 'samples/qt/OCCTOverview/src' folder in your OCCT root,
and the source code files for examples presented in subsections are stored at 'samples/OCCTOverview/code folder'.
Several utility classes that are not presented in the example window may be found in example source code files.
The overall classes introduction may be found in the @ref occt_user_guides__foundation_classes "Foundation Classes" section of the documentation.
The "Introduction" section contains short descriptions of the most massive entries in the documentation.
@section helps Additional assistance
There are several places that may be of use for new users.
The first one is [Training & E-learning](https://dev.opencascade.org/resources/trainings) page that lists available trainings and describes their specifics.
The second one is the Overview documentation (this document is a part of it) - here you can find information that suits most of the use cases.
This may seem overwhelming at first, but if you have the clear understanding of what do you seek, you will most likely find the required information.
Aside from the Overview documentation itself, the [Reference manual](https://dev.opencascade.org/doc/refman/html/index.html) is present.
Use it to check classes descriptions, dependencies and examples.
Additionally, there is a [Forum](https://dev.opencascade.org/forums) where you can contact the OCCT community and developers.

View File

@@ -1,82 +1,76 @@
OCAF Usage {#samples__ocaf} OCAF: Usage Tutorial {#samples__ocaf}
======== ========
## Getting Started ## Getting Started
At the beginning of your development, you first define an application class by inheriting from the Application abstract class.
You only have to create and determine the resources of the application for specifying the format of your documents (you generally use the standard one) and their file extension.
Then, you design the application data model by organizing attributes you choose among those provided with OCAF.
You can specialize these attributes using the User attribute. For example, if you need a reflection coefficient,
you aggregate a User attribute identified as a reflection coefficient
with a Real attribute containing the value of the coefficient (as such, you don't define a new class).
If you need application specific data not provided with OCAF, for example, to incorporate a finite element model in the data structure,
you define a new attribute class containing the mesh, and you include its persistent homologue in a new file format.
Once you have implemented the commands which create and modify the data structure according to your specification, OCAF provides you, without any additional programming:
* Persistent reference to any data, including geometric elements - several documents can be linked with such reference;
* Document-View association;
* Ready-to-use functions such as:
* Undo-redo;
* Save and open application data.
Finally, you develop the application's graphical user interface using the toolkit of your choice, for example:
* KDE Qt or GNOME GTK+ on Linux;
* Microsoft Foundation Classes (MFC) on Windows Motif on Sun;
* Other commercial products such as Ilog Views.
You can also implement the user interface in the Java language using the Swing-based Java Application Desktop component (JAD) provided with OCAF.
At the beginning of your development, you first define an application class by inheriting from the Application abstract class.
You only have to create and determine the resources of the application
for specifying the format of your documents (you generally use the standard one) and their file extension.
Then, you design the application data model by organizing attributes you choose among those provided with OCAF.
You can specialize these attributes using the User attribute. For example, if you need a reflection coefficient,
you aggregate a User attribute identified as a reflection coefficient
with a Real attribute containing the value of the coefficient (as such, you don't define a new class).
If you need application specific data not provided with OCAF, for example,
to incorporate a finite element model in the data structure,
you define a new attribute class containing the mesh,
and you include its persistent homologue in a new file format.
Once you have implemented the commands which create and modify the data structure
according to your specification, OCAF provides you, without any additional programming:
* Persistent reference to any data, including geometric elements â€" several documents can be linked with such reference;
* Document-View association;
* Ready-to-use functions such as :
* Undo-redo;
* Save and open application data.
Finally, you develop the application's graphical user interface using the toolkit of your choice, for example:
* KDE Qt or GNOME GTK+ on Linux;
* Microsoft Foundation Classes (MFC) on Windows Motif on Sun;
* Other commercial products such as Ilog Views.
You can also implement the user interface in the Java language using
the Swing-based Java Application Desktop component (JAD) provided with OCAF.
## An example of OCAF usage ## An example of OCAF usage
To create a useful OCAF-based application, it is necessary to redefine two deferred methods: <i> Formats</i> and <i> ResourcesName</i> To create a useful OCAF-based application, it is necessary to redefine two deferred methods: <i>Formats</i> and <i>ResourcesName</i>
In the <i> Formats </i> method, add the format of the documents, which need to be read by the application and may have been built in other applications. In the <i>Formats</i> method, add the format of the documents, which need to be read by the application and may have been built in other applications.
For example: For example:
~~~~ ~~~~{.cpp}
void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats) void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats)
{ {
Formats.Append(TCollection_ExtendedString ("OCAF-myApplication")); Formats.Append(TCollection_ExtendedString ("OCAF-myApplication"));
} }
~~~~ ~~~~
In the <i> ResourcesName</i> method, you only define the name of the resource file. This In the <i>ResourcesName</i> method, you only define the name of the resource file.
file contains several definitions for the saving and opening mechanisms associated This file contains several definitions for the saving and opening mechanisms associated with each format and calling of the plug-in file.
with each format and calling of the plug-in file.
~~~~ ~~~~{.cpp}
Standard_CString myApplication::ResourcesName() Standard_CString myApplication::ResourcesName()
{ {
return Standard_CString ("Resources"); return Standard_CString ("Resources");
} }
~~~~ ~~~~
To obtain the saving and opening mechanisms, it is necessary to set two environment variables: <i> CSF_PluginDefaults</i>, which defines the path of the plug-in file, and <i> CSF_ResourcesDefault</i>, which defines the resource file: To obtain the saving and opening mechanisms, it is necessary to set two environment variables: <i>CSF_PluginDefaults</i>, which defines the path of the plug-in file,
and <i>CSF_ResourcesDefault</i>, which defines the resource file:
~~~~ ~~~~{.cpp}
SetEnvironmentVariable ( "CSF_ResourcesDefaults",myDirectory); SetEnvironmentVariable ("CSF_ResourcesDefaults", myDirectory);
SetEnvironmentVariable ( "CSF_PluginDefaults",myDirectory); SetEnvironmentVariable ("CSF_PluginDefaults", myDirectory);
~~~~ ~~~~
The plugin and the resource files of the application will be located in <i> myDirector</i>. The plugin and the resource files of the application will be located in <i>myDirector</i>.
The name of the plugin file must be <i>Plugin</i>. The name of the plugin file must be <i>Plugin</i>.
### Resource File ### Resource File
The resource file describes the documents (type and extension) and The resource file describes the documents (type and extension) and the type of data that the application can manipulate
the type of data that the application can manipulate
by identifying the storage and retrieval drivers appropriate for this data. by identifying the storage and retrieval drivers appropriate for this data.
Each driver is unique and identified by a GUID generated, for example, with the <i> uuidgen </i> tool in Windows. Each driver is unique and identified by a GUID generated, for example, with the <i>uuidgen</i> tool in Windows.
Five drivers are required to use all standard attributes provided within OCAF: Five drivers are required to use all standard attributes provided within OCAF:
@@ -86,8 +80,7 @@ Five drivers are required to use all standard attributes provided within OCAF:
* the attribute storage driver (47b0b826-d931-11d1-b5da-00a0c9064368) * the attribute storage driver (47b0b826-d931-11d1-b5da-00a0c9064368)
* the attribute retrieval driver (47b0b827-d931-11d1-b5da-00a0c9064368) * the attribute retrieval driver (47b0b827-d931-11d1-b5da-00a0c9064368)
These drivers are provided as plug-ins and are located in the <i> PappStdPlugin</i> library. These drivers are provided as plug-ins and are located in the <i>PappStdPlugin</i> library.
For example, this is a resource file, which declares a new model document OCAF-MyApplication: For example, this is a resource file, which declares a new model document OCAF-MyApplication:
@@ -104,12 +97,11 @@ OCAF-MyApplication.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c906436
### Plugin File ### Plugin File
The plugin file describes the list of required plug-ins to run the application and the The plugin file describes the list of required plug-ins to run the application and the libraries in which plug-ins are located.
libraries in which plug-ins are located.
You need at least the <i> FWOSPlugin</i> and the plug-in drivers to run an OCAF application. You need at least the <i>FWOSPlugin</i> and the plug-in drivers to run an OCAF application.
The syntax of each item is <i> Identification.Location Library_Name, </i> where: The syntax of each item is <i>Identification.Location Library_Name</i>, where:
* Identification is GUID. * Identification is GUID.
* Location defines the location of the Identification (where its definition is found). * Location defines the location of the Identification (where its definition is found).
* Library_Name is the name (and path to) the library, where the plug-in is located. * Library_Name is the name (and path to) the library, where the plug-in is located.
@@ -125,412 +117,414 @@ ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
47b0b826-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin 47b0b826-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
47b0b827-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin 47b0b827-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
~~~~ ~~~~
## Implementation of Attribute Transformation in a HXX file ## Implementation of Attribute Transformation in a HXX file
~~~~ ~~~~{.cpp}
\#include <TDF_Attribute.hxx> #include <TDF_Attribute.hxx>
\#include <gp_Ax3.hxx> #include <gp_Ax3.hxx>
\#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
\#include <gp_Vec.hxx> #include <gp_Vec.hxx>
\#include <gp_Trsf.hxx> #include <gp_Trsf.hxx>
//! This attribute implements a transformation data container //! This attribute implements a transformation data container
class MyPackage_Transformation : public TDF_Attribute class MyPackage_Transformation : public TDF_Attribute
{ {
public: public: //!@ name Static methods
//!@ name Static methods
//! The method returns a unique GUID of this attribute. //! The method returns a unique GUID of this attribute.
//! By means of this GUID this attribute may be identified //! By means of this GUID this attribute may be identified
//! among other attributes attached to the same label. //! among other attributes attached to the same label.
Standard_EXPORT static const Standard_GUID& GetID (); Standard_EXPORT static const Standard_GUID& GetID ();
//! Finds or creates the attribute attached to <theLabel>. //! Finds or creates the attribute attached to <theLabel>.
//! The found or created attribute is returned. //! The found or created attribute is returned.
Standard_EXPORT static Handle(MyPackage_Transformation) Set (const TDF_Label theLabel); Standard_EXPORT static Handle(MyPackage_Transformation) Set (const TDF_Label theLabel);
//!@ name Methods for access to the attribute data public: //!@ name Methods for access to the attribute data
//! The method returns the transformation.
Standard_EXPORT gp_Trsf Get () const;
//!@ name Methods for setting the data of transformation //! The method returns the transformation.
Standard_EXPORT gp_Trsf Get () const;
//! The method defines a rotation type of transformation. public: //!@ name Methods for setting the data of transformation
Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle);
//! The method defines a translation type of transformation. //! The method defines a rotation type of transformation.
Standard_EXPORT void SetTranslation (const gp_Vec& theVector); Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle);
//! The method defines a point mirror type of transformation (point symmetry). //! The method defines a translation type of transformation.
Standard_EXPORT void SetMirror (const gp_Pnt& thePoint); Standard_EXPORT void SetTranslation (const gp_Vec& theVector);
//! The method defines an axis mirror type of transformation (axial symmetry). //! The method defines a point mirror type of transformation (point symmetry).
Standard_EXPORT void SetMirror (const gp_Ax1& theAxis); Standard_EXPORT void SetMirror (const gp_Pnt& thePoint);
//! The method defines a point mirror type of transformation (planar symmetry). //! The method defines an axis mirror type of transformation (axial symmetry).
Standard_EXPORT void SetMirror (const gp_Ax2& thePlane); Standard_EXPORT void SetMirror (const gp_Ax1& theAxis);
//! The method defines a scale type of transformation. //! The method defines a point mirror type of transformation (planar symmetry).
Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale); Standard_EXPORT void SetMirror (const gp_Ax2& thePlane);
//! The method defines a scale type of transformation.
Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale);
//! The method defines a complex type of transformation from one coordinate system to another. //! The method defines a complex type of transformation from one coordinate system to another.
Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2); Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2);
//!@ name Overridden methods from TDF_Attribute public: //!@ name Overridden methods from TDF_Attribute
//! The method returns a unique GUID of the attribute.
//! By means of this GUID this attribute may be identified among other attributes attached to the same label.
Standard_EXPORT const Standard_GUID& ID () const;
//! The method is called on Undo / Redo. //! The method returns a unique GUID of the attribute.
//! It copies the content of theAttribute into this attribute (copies the fields). //! By means of this GUID this attribute may be identified among other attributes attached to the same label.
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute); Standard_EXPORT const Standard_GUID& ID () const;
//! It creates a new instance of this attribute. //! The method is called on Undo / Redo.
//! It is called on Copy / Paste, Undo / Redo. //! It copies the content of theAttribute into this attribute (copies the fields).
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute);
//! It creates a new instance of this attribute.
//! It is called on Copy / Paste, Undo / Redo.
Standard_EXPORT Handle(TDF_Attribute) NewEmpty () const; Standard_EXPORT Handle(TDF_Attribute) NewEmpty () const;
//! The method is called on Copy / Paste. //! The method is called on Copy / Paste.
//! It copies the content of this attribute into theAttribute (copies the fields). //! It copies the content of this attribute into theAttribute (copies the fields).
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable); Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable);
//! Prints the content of this attribute into the stream. //! Prints the content of this attribute into the stream.
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS); Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS);
//!@ name Constructor public: //!@ name Constructor
//! The C++ constructor of this attribute class. //! The C++ constructor of this attribute class.
//! Usually it is never called outside this class. //! Usually it is never called outside this class.
Standard_EXPORT MyPackage_Transformation(); Standard_EXPORT MyPackage_Transformation();
private: private:
gp_TrsfForm myType; gp_TrsfForm myType;
// Axes (Ax1, Ax2, Ax3) // Axes (Ax1, Ax2, Ax3)
gp_Ax1 myAx1; gp_Ax1 myAx1;
gp_Ax2 myAx2; gp_Ax2 myAx2;
gp_Ax3 myFirstAx3; gp_Ax3 myFirstAx3;
gp_Ax3 mySecondAx3; gp_Ax3 mySecondAx3;
// Scalar values // Scalar values
Standard_Real myAngle; Standard_Real myAngle;
Standard_Real myScale; Standard_Real myScale;
// Points // Points
gp_Pnt myFirstPoint; gp_Pnt myFirstPoint;
gp_Pnt mySecondPoint; gp_Pnt mySecondPoint;
}; };
~~~~ ~~~~
## Implementation of Attribute Transformation in a CPP file ## Implementation of Attribute Transformation in a CPP file
~~~~{.cpp} ~~~~{.cpp}
\#include <MyPackage_Transformation.hxx> #include <MyPackage_Transformation.hxx>
//=======================================================================
//function : GetID
//purpose : The method returns a unique GUID of this attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::GetID()
{
static Standard_GUID ID("4443368E-C808-4468-984D-B26906BA8573");
return ID;
}
//=======================================================================
//function : Set
//purpose : Finds or creates the attribute attached to <theLabel>.
// The found or created attribute is returned.
//=======================================================================
Handle(MyPackage_Transformation) MyPackage_Transformation::Set(const TDF_Label& theLabel)
{
Handle(MyPackage_Transformation) T;
if (!theLabel.FindAttribute(MyPackage_Transformation::GetID(), T))
{
T = new MyPackage_Transformation();
theLabel.AddAttribute(T);
}
return T;
}
//=======================================================================
//function : Get
//purpose : The method returns the transformation.
//=======================================================================
gp_Trsf MyPackage_Transformation::Get() const
{
gp_Trsf transformation;
switch (myType)
{
case gp_Identity:
{
break;
}
case gp_Rotation:
{
transformation.SetRotation(myAx1, myAngle);
break;
}
case gp_Translation:
{
transformation.SetTranslation(myFirstPoint, mySecondPoint);
break;
}
case gp_PntMirror:
{
transformation.SetMirror(myFirstPoint);
break;
}
case gp_Ax1Mirror:
{
transformation.SetMirror(myAx1);
break;
}
case gp_Ax2Mirror:
{
transformation.SetMirror(myAx2);
break;
}
case gp_Scale:
{
transformation.SetScale(myFirstPoint, myScale);
break;
}
case gp_CompoundTrsf:
{
transformation.SetTransformation(myFirstAx3, mySecondAx3);
break;
}
case gp_Other:
{
break;
}
}
return transformation;
}
//=======================================================================
//function : SetRotation
//purpose : The method defines a rotation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const Standard_Real theAngle)
{
Backup();
myType = gp_Rotation;
myAx1 = theAxis;
myAngle = theAngle;
}
//=======================================================================
//function : SetTranslation
//purpose : The method defines a translation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetTranslation(const gp_Vec& theVector)
{
Backup();
myType = gp_Translation;
myFirstPoint.SetCoord(0, 0, 0);
mySecondPoint.SetCoord(theVector.X(), theVector.Y(), theVector.Z());
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (point symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Pnt& thePoint)
{
Backup();
myType = gp_PntMirror;
myFirstPoint = thePoint;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines an axis mirror type of transformation
// (axial symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax1& theAxis)
{
Backup();
myType = gp_Ax1Mirror;
myAx1 = theAxis;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (planar symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax2& thePlane)
{
Backup();
myType = gp_Ax2Mirror;
myAx2 = thePlane;
}
//=======================================================================
//function : SetScale
//purpose : The method defines a scale type of transformation.
//=======================================================================
void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const Standard_Real theScale)
{
Backup();
myType = gp_Scale;
myFirstPoint = thePoint;
myScale = theScale;
}
//=======================================================================
//function : SetTransformation
//purpose : The method defines a complex type of transformation
// from one coordinate system to another.
//=======================================================================
void MyPackage_Transformation::SetTransformation(const gp_Ax3& theCoordinateSystem1,
const gp_Ax3& theCoordinateSystem2)
{
Backup();
myFirstAx3 = theCoordinateSystem1;
mySecondAx3 = theCoordinateSystem2;
}
//=======================================================================
//function : ID
//purpose : The method returns a unique GUID of the attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::ID() const
{
return GetID();
}
//=======================================================================
//function : Restore
//purpose : The method is called on Undo / Redo.
// It copies the content of <theAttribute>
// into this attribute (copies the fields).
//=======================================================================
void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute)
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
myType = theTransformation->myType;
myAx1 = theTransformation->myAx1;
myAx2 = theTransformation->myAx2;
myFirstAx3 = theTransformation->myFirstAx3;
mySecondAx3 = theTransformation->mySecondAx3;
myAngle = theTransformation->myAngle;
myScale = theTransformation->myScale;
myFirstPoint = theTransformation->myFirstPoint;
mySecondPoint = theTransformation->mySecondPoint;
}
//=======================================================================
//function : NewEmpty
//purpose : It creates a new instance of this attribute.
// It is called on Copy / Paste, Undo / Redo.
//=======================================================================
Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const
{
return new MyPackage_Transformation();
}
//=======================================================================
//function : Paste
//purpose : The method is called on Copy / Paste.
// It copies the content of this attribute into
// <theAttribute> (copies the fields).
//=======================================================================
void MyPackage_Transformation::Paste(const Handle(TDF_Attribute)& theAttribute,
const Handle(TDF_RelocationTable)& ) const
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
theTransformation->myType = myType;
theTransformation->myAx1 = myAx1;
theTransformation->myAx2 = myAx2;
theTransformation->myFirstAx3 = myFirstAx3;
theTransformation->mySecondAx3 = mySecondAx3;
theTransformation->myAngle = myAngle;
theTransformation->myScale = myScale;
theTransformation->myFirstPoint = myFirstPoint;
theTransformation->mySecondPoint = mySecondPoint;
}
//=======================================================================
//function : Dump
//purpose : Prints the content of this attribute into the stream.
//=======================================================================
Standard_OStream& MyPackage_Transformation::Dump(Standard_OStream& anOS) const
{
anOS = "Transformation: ";
switch (myType)
{
case gp_Identity:
{
anOS = "gp_Identity";
break;
}
case gp_Rotation:
{
anOS = "gp_Rotation";
break;
}
case gp_Translation:
{
anOS = "gp_Translation";
break;
}
case gp_PntMirror:
{
anOS = "gp_PntMirror";
break;
}
case gp_Ax1Mirror:
{
anOS = "gp_Ax1Mirror";
break;
}
case gp_Ax2Mirror:
{
anOS = "gp_Ax2Mirror";
break;
}
case gp_Scale:
{
anOS = "gp_Scale";
break;
}
case gp_CompoundTrsf:
{
anOS = "gp_CompoundTrsf";
break;
}
case gp_Other:
{
anOS = "gp_Other";
break;
}
}
return anOS;
}
//======================================================================= //=======================================================================
//function : MyPackage_Transformation //function : GetID
//purpose : A constructor. //purpose : The method returns a unique GUID of this attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//======================================================================= //=======================================================================
MyPackage_Transformation::MyPackage_Transformation():myType(gp_Identity){ const Standard_GUID& MyPackage_Transformation::GetID()
{
static Standard_GUID ID("4443368E-C808-4468-984D-B26906BA8573");
return ID;
}
//=======================================================================
//function : Set
//purpose : Finds or creates the attribute attached to <theLabel>.
// The found or created attribute is returned.
//=======================================================================
Handle(MyPackage_Transformation) MyPackage_Transformation::Set(const TDF_Label& theLabel)
{
Handle(MyPackage_Transformation) T;
if (!theLabel.FindAttribute(MyPackage_Transformation::GetID(), T))
{
T = new MyPackage_Transformation();
theLabel.AddAttribute(T);
}
return T;
}
//=======================================================================
//function : Get
//purpose : The method returns the transformation.
//=======================================================================
gp_Trsf MyPackage_Transformation::Get() const
{
gp_Trsf transformation;
switch (myType)
{
case gp_Identity:
{
break;
}
case gp_Rotation:
{
transformation.SetRotation(myAx1, myAngle);
break;
}
case gp_Translation:
{
transformation.SetTranslation(myFirstPoint, mySecondPoint);
break;
}
case gp_PntMirror:
{
transformation.SetMirror(myFirstPoint);
break;
}
case gp_Ax1Mirror:
{
transformation.SetMirror(myAx1);
break;
}
case gp_Ax2Mirror:
{
transformation.SetMirror(myAx2);
break;
}
case gp_Scale:
{
transformation.SetScale(myFirstPoint, myScale);
break;
}
case gp_CompoundTrsf:
{
transformation.SetTransformation(myFirstAx3, mySecondAx3);
break;
}
case gp_Other:
{
break;
}
}
return transformation;
}
//=======================================================================
//function : SetRotation
//purpose : The method defines a rotation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const Standard_Real theAngle)
{
Backup();
myType = gp_Rotation;
myAx1 = theAxis;
myAngle = theAngle;
}
//=======================================================================
//function : SetTranslation
//purpose : The method defines a translation type of transformation.
//=======================================================================
void MyPackage_Transformation::SetTranslation(const gp_Vec& theVector)
{
Backup();
myType = gp_Translation;
myFirstPoint.SetCoord(0, 0, 0);
mySecondPoint.SetCoord(theVector.X(), theVector.Y(), theVector.Z());
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (point symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Pnt& thePoint)
{
Backup();
myType = gp_PntMirror;
myFirstPoint = thePoint;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines an axis mirror type of transformation
// (axial symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax1& theAxis)
{
Backup();
myType = gp_Ax1Mirror;
myAx1 = theAxis;
}
//=======================================================================
//function : SetMirror
//purpose : The method defines a point mirror type of transformation
// (planar symmetry).
//=======================================================================
void MyPackage_Transformation::SetMirror(const gp_Ax2& thePlane)
{
Backup();
myType = gp_Ax2Mirror;
myAx2 = thePlane;
}
//=======================================================================
//function : SetScale
//purpose : The method defines a scale type of transformation.
//=======================================================================
void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const Standard_Real theScale)
{
Backup();
myType = gp_Scale;
myFirstPoint = thePoint;
myScale = theScale;
}
//=======================================================================
//function : SetTransformation
//purpose : The method defines a complex type of transformation
// from one coordinate system to another
//=======================================================================
void MyPackage_Transformation::SetTransformation (const gp_Ax3& theCoordinateSystem1,
const gp_Ax3& theCoordinateSystem2)
{
Backup();
myFirstAx3 = theCoordinateSystem1;
mySecondAx3 = theCoordinateSystem2;
}
//=======================================================================
//function : ID
//purpose : The method returns a unique GUID of the attribute.
// By means of this GUID this attribute may be identified
// among other attributes attached to the same label.
//=======================================================================
const Standard_GUID& MyPackage_Transformation::ID() const
{
return GetID();
}
//=======================================================================
//function : Restore
//purpose : The method is called on Undo / Redo.
// It copies the content of <theAttribute>
// into this attribute (copies the fields).
//=======================================================================
void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute)
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
myType = theTransformation->myType;
myAx1 = theTransformation->myAx1;
myAx2 = theTransformation->myAx2;
myFirstAx3 = theTransformation->myFirstAx3;
mySecondAx3 = theTransformation->mySecondAx3;
myAngle = theTransformation->myAngle;
myScale = theTransformation->myScale;
myFirstPoint = theTransformation->myFirstPoint;
mySecondPoint = theTransformation->mySecondPoint;
}
//=======================================================================
//function : NewEmpty
//purpose : It creates a new instance of this attribute.
// It is called on Copy / Paste, Undo / Redo.
//=======================================================================
Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const
{
return new MyPackage_Transformation();
}
//=======================================================================
//function : Paste
//purpose : The method is called on Copy / Paste.
// It copies the content of this attribute into
// <theAttribute> (copies the fields).
//=======================================================================
void MyPackage_Transformation::Paste (const Handle(TDF_Attribute)& theAttribute,
const Handle(TDF_RelocationTable)& ) const
{
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
theTransformation->myType = myType;
theTransformation->myAx1 = myAx1;
theTransformation->myAx2 = myAx2;
theTransformation->myFirstAx3 = myFirstAx3;
theTransformation->mySecondAx3 = mySecondAx3;
theTransformation->myAngle = myAngle;
theTransformation->myScale = myScale;
theTransformation->myFirstPoint = myFirstPoint;
theTransformation->mySecondPoint = mySecondPoint;
}
//=======================================================================
//function : Dump
//purpose : Prints the content of this attribute into the stream.
//=======================================================================
Standard_OStream& MyPackage_Transformation::Dump(Standard_OStream& theOS) const
{
anOS << "Transformation: ";
switch (myType)
{
case gp_Identity:
{
anOS << "gp_Identity";
break;
}
case gp_Rotation:
{
anOS << "gp_Rotation";
break;
}
case gp_Translation:
{
anOS << "gp_Translation";
break;
}
case gp_PntMirror:
{
anOS << "gp_PntMirror";
break;
}
case gp_Ax1Mirror:
{
anOS << "gp_Ax1Mirror";
break;
}
case gp_Ax2Mirror:
{
anOS << "gp_Ax2Mirror";
break;
}
case gp_Scale:
{
anOS << "gp_Scale";
break;
}
case gp_CompoundTrsf:
{
anOS << "gp_CompoundTrsf";
break;
}
case gp_Other:
{
anOS << "gp_Other";
break;
}
}
return anOS;
}
//=======================================================================
//function : MyPackage_Transformation
//purpose : A constructor.
//=======================================================================
MyPackage_Transformation::MyPackage_Transformation()
: myType (gp_Identity)
{
//
} }
~~~~ ~~~~
## Implementation of typical actions with standard OCAF attributes. ## Implementation of typical actions with standard OCAF attributes.
There are four sample files provided in the directory 'OpenCasCade/ros/samples/ocafsamples'. They present typical actions with OCAF services (mainly for newcomers). There are four sample files provided in the directory 'OpenCasCade/ros/samples/ocafsamples'.
They present typical actions with OCAF services (mainly for newcomers).
The method *Sample()* of each file is not dedicated for execution 'as is', it is rather a set of logical actions using some OCAF services. The method *Sample()* of each file is not dedicated for execution 'as is', it is rather a set of logical actions using some OCAF services.
### TDataStd_Sample.cxx ### TDataStd_Sample.cxx
@@ -549,7 +543,7 @@ This sample contains templates for typical actions with the following standard O
- TDataXtd_Constraint attribute management; - TDataXtd_Constraint attribute management;
- TDataStd_Directory attribute management; - TDataStd_Directory attribute management;
- TDataStd_TreeNode attribute management. - TDataStd_TreeNode attribute management.
### TDocStd_Sample.cxx ### TDocStd_Sample.cxx
This sample contains template for the following typical actions: This sample contains template for the following typical actions:
- creating application; - creating application;
@@ -560,7 +554,7 @@ This sample contains template for the following typical actions:
- closing a document; - closing a document;
- opening the document stored in the file; - opening the document stored in the file;
- copying content of a document to another document with possibility to update the copy in the future. - copying content of a document to another document with possibility to update the copy in the future.
### TPrsStd_Sample.cxx ### TPrsStd_Sample.cxx
This sample contains template for the following typical actions: This sample contains template for the following typical actions:
- starting with data framework; - starting with data framework;
@@ -577,7 +571,7 @@ This sample contains template for the following typical actions:
- updating and displaying presentation of the attribute to be displayed; - updating and displaying presentation of the attribute to be displayed;
- setting a color to the displayed attribute; - setting a color to the displayed attribute;
- getting transparency of the displayed attribute; - getting transparency of the displayed attribute;
- modify attribute; - modify attribute;
- updating presentation of the attribute in viewer. - updating presentation of the attribute in viewer.
### TNaming_Sample.cxx ### TNaming_Sample.cxx
@@ -591,4 +585,3 @@ The following scenario is used:
- creating a Fillet (using the selected edges) and pushing the result as a modification of Box1; - creating a Fillet (using the selected edges) and pushing the result as a modification of Box1;
- creating a Cut (Box1, Box2) as a modification of Box1 and push it in DF; - creating a Cut (Box1, Box2) as a modification of Box1 and push it in DF;
- recovering the result from DF. - recovering the result from DF.

View File

@@ -1,4 +1,4 @@
Function Mechanism Usage {#samples__ocaf_func} OCAF: Function Mechanism {#samples__ocaf_func}
======================== ========================
Let us describe the usage of the "Function Mechanism" of Open CASCADE Application Framework on a simple example. Let us describe the usage of the "Function Mechanism" of Open CASCADE Application Framework on a simple example.

View File

@@ -1,176 +1,62 @@
Tutorials and Samples {#samples} Tutorials and Samples {#samples}
===================== =====================
Tutorial: Modelling a Bottle - @subpage samples__tutorials
---------------------------- * @ref samples__novice_guide
The Qt programming tutorial teaches how to use Open CASCADE Technology services to model a 3D object. <br>A document providing an introductory information to newcomers.
The purpose of the tutorial is not to explain all OCCT classes but * @ref samples__draw_scripts
to help start thinking in terms of the Open CASCADE Technology. <br>A set of demo scripts demonstrating OCCT functionality from DRAW.
These scripts can be also considered as a tutorials on **Tcl** usage within @ref occt_user_guides__test_harness "Draw Harness".
* @ref occt__tutorial
<br>A programming tutorial teaching how to use OCCT services to model a 3D object.
See also @ref samples_qt_tutorial
* @ref samples__ocaf
<br>A set of code snippets performing typical actions with @ref occt_user_guides__ocaf "OCAF" services for newcomers.
* @ref samples__ocaf_func
<br>A simple example dedicated to the usage of "Function Mechanism" of @ref occt_user_guides__ocaf "OCCT Application Framework".
* @ref tutorials__ais_object
<br>A programming tutorial teaching how to compute presentation within AIS_InteractiveObject subclass for displaying in @ref occt_user_guides__visualization "OCCT 3D Viewer".
- @subpage samples__projects
* @ref samples_qt_iesample
<br>A cross-platform multi-document 3D Viewer sample with CAD import / export functionality based on **Qt Widgets** framework.
* @ref samples_qml_android_occt
<br>A cross-platform 3D Viewer sample with CAD import based on **QtQuick** framework.
* @ref samples_qt_tutorial
<br>A cross-platform sample application based on **Qt Widgets** framework and implementing @ref occt__tutorial.
* @ref samples_qt_overview
<br>A sample application interactively demonstrating OCCT C++ usage with code snippets for newcomers.
* @ref samples_mfc_standard
<br>A set of projects for Windows platform demonstrating OCCT usage based on **Microsoft Foundation Class** (**MFC**) library.
* @ref samples_csharp_occt
<br>A Multi-document 3D Viewer sample with CAD import / export functionality based on .NET and **Windows Forms** or **WPF**.
* @ref samples_csharp_direct3d
<br>3D Viewer sample wrapped into Direct3D context based on .NET and **Windows Presentation Foundation** (**WPF**).
* @ref occt_samples_webgl
<br>3D Viewer sample based on **Emscripten SDK** representing a static HTML page to be opened in Web Browser.
* @ref samples_java_android_occt
<br>3D Viewer sample with CAD import for Android mobile platform based on Android SDK and JNI layer.
* @ref occt_samples_ios_uikit
<br>3D Viewer sample for iOS platform based on Apple **UIKit** framework.
* @ref occt_samples_glfw
<br>A cross-platform 3D Viewer sample using **GLFW** library.
This tutorial assumes that the user has experience in using and setting up C++. @page samples__tutorials Tutorials and Demos
From the viewpoint of programming, Open CASCADE Technology is designed - @subpage samples__novice_guide
to enhance user's C++ tools with high performance modeling classes, methods and functions. - @subpage samples__draw_scripts
The combination of these resources allows creating substantial applications. - @subpage occt__tutorial
- @subpage samples__ocaf
- @subpage samples__ocaf_func
- @subpage tutorials__ais_object
Read more about @subpage occt__tutorial @page samples__projects Sample Projects
- @subpage samples_qt_iesample
MFC - @subpage samples_qml_android_occt
--------- - @subpage samples_qt_tutorial
- @subpage samples_qt_overview
Visual C++ programming samples containing 10 Visual C++ projects - @subpage samples_mfc_standard
illustrating how to use a particular module or functionality. - @subpage samples_csharp_occt
- @subpage samples_csharp_direct3d
The list of MFC samples: - @subpage occt_samples_webgl
- @subpage samples_java_android_occt
* Geometry - @subpage occt_samples_ios_uikit
* Modeling - @subpage occt_samples_glfw
* Viewer2d
* Viewer3d
* ImportExport
* Ocaf
* Triangulation
* HLR
* Animation
* Convert
@figure{/samples/images/samples_mvc.png}
**Remarks:**
* MFC samples are available only on Windows platform;
* To start a sample use Open CASCADE Technology\\Samples\\Mfc\\ item of the Start\\Programs menu;
* Read carefully readme.txt to learn about launching and compilation options.
See @subpage samples_mfc_standard "Readme" for details.
Qt
---
OCCT includes several samples based on Qt application framework.
These samples are available on all supported desktop platforms.
To start a sample on Windows use Open CASCADE Technology\\Samples\\Qt\\ item of the Start\\Programs menu.
Import Export
-------------
Import Export programming sample contains 3D Viewer and Import / Export functionality.
@figure{/samples/images/samples_qt.png}
Tutorial
---------
The Qt programming tutorial teaches how to use Open CASCADE Technology services to model a 3D object.
The purpose of the tutorial is not to explain all OCCT classes but
to help start thinking in terms of the Open CASCADE Technology.
This tutorial assumes that the user has experience in using and setting up C++.
From the viewpoint of programming, Open CASCADE Technology is designed
to enhance user's C++ tools with high performance modeling classes, methods and functions.
The combination of these resources allows creating substantial applications.
**See also:** @ref occt__tutorial "OCCT Tutorial"
Overview
---------
The Qt application providing samples for basic usage of C++ API of various OCCT functionality.
The samples are organized in several categories according to relevant module of OCCT:
* Geometry
* Topology,
* Triangulation
* DataExchange
* OCAF
* Viewer 2d
* Viewer 3d
Each sample presents geometry view, C++ code fragment and sample output window.
@figure{/samples/images/sample_overview_qt.png}
See \subpage samples_qt_overview "Readme" for details.
C#
---
C# sample demonstrates integration of OCCT 3D Viewer and Import / Export functionality into .NET applications (using Windows Forms and WPF front ends).
@figure{/samples/images/samples_c__ie.png}
Import:
* BRep
* Iges
* Step
Export:
* Brep
* Iges
* Step
* Stl
* Vrml
See @subpage samples_csharp_occt "C# sample Readme" for details.
There is also another C# example with the same functionality, which demonstrates the integration of Direct3D Viewer into .NET applications using WPF front end.
See @subpage samples_csharp_direct3d "Direct3D C# sample Readme" for details.
Android
---------
There are two samples are representing usage OCCT framework on Android mobile platform. They represent an OCCT-based 3D-viewer with CAD import support in formats BREP, STEP and IGES: jniviewer (java) and AndroidQt (qt+qml)
jniviewer
@figure{/samples/images/samples_java_android_occt.jpg}
Java -- See @subpage samples_java_android_occt "Android Java sample Readme" for details.
AndroidQt
@figure{/samples/images/samples_qml_android_occt.jpg}
Qt -- See \subpage samples_qml_android_occt "Android Qt sample Readme" for details.
iOS
---
There is a sample demonstrating usage of OCCT on iOS with Apple UIKit framework.
@figure{/samples/images/sample_ios_uikit.png}
See @subpage occt_samples_ios_uikit "iOS sample Readme" for details.
Web
---------
WebGL Viewer sample demonstrating usage of OCCT 3D Viewer in Web browser with Emscripten SDK can be found in `samples/webgl`.
@figure{/samples/images/sample_webgl.png}
See @subpage occt_samples_webgl "WebGL sample Readme" for details.
OCAF Usage Sample
------------------
The provided set of samples dedicates to get initial knowledge about typical actions with OCAF services. It may be
useful for newcomers.
Read more about @subpage samples__ocaf
OCAF Function Mechanism Usage
-----------------------------
This simple example dedicates to the usage of "Function Mechanism" of OCCT Application Framework. It represents a "nail"
composed by a cone and two cylinders of different radius and height.
Read more about @subpage samples__ocaf_func
Draw Demo Scripts
------------------
A set of demo scripts demonsrates using OCCT functionality from DRAW. These scripts can be also considered as a
tutorials on tcl usage within Draw.
Read more about @subpage samples__draw_scripts

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -1,4 +1,4 @@
Tutorial {#occt__tutorial} Modeling: Bottle Tutorial {#occt__tutorial}
======= =======
@tableofcontents @tableofcontents
@@ -18,7 +18,7 @@ From a programming standpoint, Open CASCADE Technology is designed to enhance yo
To illustrate the use of classes provided in the 3D geometric modeling toolkits, you will create a bottle as shown: To illustrate the use of classes provided in the 3D geometric modeling toolkits, you will create a bottle as shown:
@figure{/tutorial/images/tutorial_image001.png,"",240} @figure{/tutorial/images/tutorial_image001.png,"",240} height=350px
In the tutorial we will create, step-by-step, a function that will model a bottle as shown above. You will find the complete source code of this tutorial, including the very function *MakeBottle* in the distribution of Open CASCADE Technology. The function body is provided in the file samples/qt/Tutorial/src/MakeBottle.cxx. In the tutorial we will create, step-by-step, a function that will model a bottle as shown above. You will find the complete source code of this tutorial, including the very function *MakeBottle* in the distribution of Open CASCADE Technology. The function body is provided in the file samples/qt/Tutorial/src/MakeBottle.cxx.
@@ -34,7 +34,7 @@ We first define the bottle specifications as follows:
In addition, we decide that the bottle's profile (base) will be centered on the origin of the global Cartesian coordinate system. In addition, we decide that the bottle's profile (base) will be centered on the origin of the global Cartesian coordinate system.
@figure{/tutorial/images/tutorial_image002.png,"",240} @figure{/tutorial/images/tutorial_image002.png,"",240} height=350px
This modeling requires four steps: This modeling requires four steps:
@@ -145,16 +145,16 @@ However, the *TopoDS* package provides only the data structure of the topologica
To create an edge, you use the BRepBuilderAPI_MakeEdge class with the previously computed curves: To create an edge, you use the BRepBuilderAPI_MakeEdge class with the previously computed curves:
~~~~{.cpp} ~~~~{.cpp}
TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1); TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(aSegment1);
TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle); TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle);
TopoDS_Edge aEdge3 = BRepBuilderAPI_MakeEdge(aSegment2); TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge(aSegment2);
~~~~ ~~~~
In Open CASCADE Technology, you can create edges in several ways. One possibility is to create an edge directly from two points, in which case the underlying geometry of this edge is a line, bounded by two vertices being automatically computed from the two input points. For example, aEdge1 and aEdge3 could have been computed in a simpler way: In Open CASCADE Technology, you can create edges in several ways. One possibility is to create an edge directly from two points, in which case the underlying geometry of this edge is a line, bounded by two vertices being automatically computed from the two input points. For example, anEdge1 and anEdge3 could have been computed in a simpler way:
~~~~{.cpp} ~~~~{.cpp}
TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aPnt1, aPnt3); TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(aPnt1, aPnt3);
TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aPnt4, aPnt5); TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(aPnt4, aPnt5);
~~~~ ~~~~
To connect the edges, you need to create a wire with the *BRepBuilderAPI_MakeWire* class. There are two ways of building a wire with this class: To connect the edges, you need to create a wire with the *BRepBuilderAPI_MakeWire* class. There are two ways of building a wire with this class:
@@ -165,7 +165,7 @@ To connect the edges, you need to create a wire with the *BRepBuilderAPI_MakeWir
When building a wire from less than four edges, as in the present case, you can use the constructor directly as follows: When building a wire from less than four edges, as in the present case, you can use the constructor directly as follows:
~~~~{.cpp} ~~~~{.cpp}
TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(aEdge1, aEdge2, aEdge3); TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(anEdge1, anEdge2, anEdge3);
~~~~ ~~~~
@@ -250,7 +250,7 @@ The bottle's profile is almost finished. You have created two wires: *aWire* and
@subsection OCCT_TUTORIAL_SUB3_1 Prism the Profile @subsection OCCT_TUTORIAL_SUB3_1 Prism the Profile
To compute the main body of the bottle, you need to create a solid shape. The simplest way is to use the previously created profile and to sweep it along a direction. The *Prism* functionality of Open CASCADE Technology is the most appropriate for that task. It accepts a shape and a direction as input and generates a new shape according to the following rules: To compute the main body of the bottle, you need to create a solid shape. The simplest way is to use the previously created profile and sweep it along a direction. The *Prism* functionality of Open CASCADE Technology is the most appropriate for that task. It accepts a shape and a direction as input and generates a new shape according to the following rules:
| Shape | Generates | | Shape | Generates |
| :----- | :----------------- | | :----- | :----------------- |
@@ -260,7 +260,7 @@ To compute the main body of the bottle, you need to create a solid shape. The si
| Face | Solid | | Face | Solid |
| Shell | Compound of Solids | | Shell | Compound of Solids |
@figure{/tutorial/images/tutorial_image007.png,"",240} @figure{/tutorial/images/tutorial_image007.png,"",240} height=350px
Your current profile is a wire. Referring to the Shape/Generates table, you need to compute a face out of its wire to generate a solid. Your current profile is a wire. Referring to the Shape/Generates table, you need to compute a face out of its wire to generate a solid.
To create a face, use the *BRepBuilderAPI_MakeFace* class. As previously explained, a face is a part of a surface bounded by a closed wire. Generally, *BRepBuilderAPI_MakeFace* computes a face out of a surface and one or more wires. To create a face, use the *BRepBuilderAPI_MakeFace* class. As previously explained, a face is a part of a surface bounded by a closed wire. Generally, *BRepBuilderAPI_MakeFace* computes a face out of a surface and one or more wires.
@@ -297,7 +297,7 @@ For our purposes, we will specify that fillets must be:
* applied on all edges of the shape * applied on all edges of the shape
* have a radius of *myThickness* / 12 * have a radius of *myThickness* / 12
@figure{/tutorial/images/tutorial_image008.png,"",240} @figure{/tutorial/images/tutorial_image008.png,"",240} height=350px
To apply fillets on the edges of a shape, you use the *BRepFilletAPI_MakeFillet* class. This class is normally used as follows: To apply fillets on the edges of a shape, you use the *BRepFilletAPI_MakeFillet* class. This class is normally used as follows:
@@ -353,7 +353,7 @@ Once this is done, you perform the last step of the procedure by asking for the
To add a neck to the bottle, you will create a cylinder and fuse it to the body. The cylinder is to be positioned on the top face of the body with a radius of *myThickness* / 4. and a height of *myHeight* / 10. To add a neck to the bottle, you will create a cylinder and fuse it to the body. The cylinder is to be positioned on the top face of the body with a radius of *myThickness* / 4. and a height of *myHeight* / 10.
@figure{/tutorial/images/tutorial_image009.png,"",240} @figure{/tutorial/images/tutorial_image009.png,"",240} height=350px
To position the cylinder, you need to define a coordinate system with the *gp_Ax2* class defining a right-handed coordinate system from a point and two directions - the main (Z) axis direction and the X direction (the Y direction is computed from these two). To position the cylinder, you need to define a coordinate system with the *gp_Ax2* class defining a right-handed coordinate system from a point and two directions - the main (Z) axis direction and the X direction (the Y direction is computed from these two).
To align the neck with the center of the top face, being in the global coordinate system (0, 0, *myHeight*), with its normal on the global Z axis, your local coordinate system can be defined as follows: To align the neck with the center of the top face, being in the global coordinate system (0, 0, *myHeight*), with its normal on the global Z axis, your local coordinate system can be defined as follows:
@@ -395,7 +395,7 @@ In Open CASCADE Technology, a hollowed solid is called a *Thick* *Solid* and is
* Create a parallel wall W2 from W1 at a distance D. If D is positive, W2 will be outside the initial solid, otherwise it will be inside. * Create a parallel wall W2 from W1 at a distance D. If D is positive, W2 will be outside the initial solid, otherwise it will be inside.
* Compute a solid from the two walls W1 and W2. * Compute a solid from the two walls W1 and W2.
@figure{/tutorial/images/tutorial_image010.png,"",240} @figure{/tutorial/images/tutorial_image010.png,"",240} height=350px
To compute a thick solid, you create an instance of the *BRepOffsetAPI_MakeThickSolid* class by giving the following information: To compute a thick solid, you create an instance of the *BRepOffsetAPI_MakeThickSolid* class by giving the following information:
@@ -438,7 +438,6 @@ To compare a given type with the type you seek, use the *STANDARD_TYPE* macro, w
~~~~{.cpp} ~~~~{.cpp}
if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)){ if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)){
//
} }
~~~~ ~~~~
@@ -478,9 +477,9 @@ The collection for shapes can be found in the *TopTools* package. As *BRepOffset
All the necessary data are now available so you can create your hollowed solid by calling the *BRepOffsetAPI_MakeThickSolid* MakeThickSolidByJoin method: All the necessary data are now available so you can create your hollowed solid by calling the *BRepOffsetAPI_MakeThickSolid* MakeThickSolidByJoin method:
~~~~{.cpp} ~~~~{.cpp}
BRepOffsetAPI_MakeThickSolid BodyMaker; BRepOffsetAPI_MakeThickSolid aSolidMaker;
BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3); aSolidMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
myBody = BodyMaker.Shape(); myBody = aSolidMaker.Shape();
~~~~ ~~~~
@@ -493,7 +492,7 @@ All the necessary data are now available so you can create your hollowed solid b
Up to now, you have learned how to create edges out of 3D curves. Up to now, you have learned how to create edges out of 3D curves.
You will now learn how to create an edge out of a 2D curve and a surface. You will now learn how to create an edge out of a 2D curve and a surface.
To learn this aspect of Open CASCADE Technology, you will build helicoidal profiles out of 2D curves on cylindrical surfaces. The theory is more complex than in previous steps, but applying it is very simple. To learn this aspect of Open CASCADE Technology, you will build helicoidal profiles out of 2D curves on cylindrical surfaces. The theory is more complex than in previous steps, but applying it is very simple.
As a first step, you compute these cylindrical surfaces. You are already familiar with curves of the *Geom* package. Now you can create a cylindrical surface (*Geom_CylindricalSurface*) using: As a first step, you compute these cylindrical surfaces. You are already familiar with the curves of the *Geom* package. Now you can create a cylindrical surface (*Geom_CylindricalSurface*) using:
* a coordinate system; * a coordinate system;
* a radius. * a radius.
@@ -604,7 +603,7 @@ As the parametric equation of an ellipse is P(U) = O + (MajorRadius * cos(U) * X
~~~~ ~~~~
The last step consists in defining the segment, which is the same for the two profiles: a line limited by the first and the last point of one of the arcs. The last step consists in defining the segment, which is the same for the two profiles: a line limited by the first and the last point of one of the arcs.
To access the point corresponding to the parameter of a curve or a surface, you use the Value or D0 method (meaning 0th derivative), D1 method is for first derivative, D2 for the second one. To access the point corresponding to the parameter of a curve or a surface, you use the Value or D0 method (meaning 0th derivative), D1 method is for the first derivative, D2 for the second one.
~~~~{.cpp} ~~~~{.cpp}
gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0); gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0);
@@ -698,7 +697,7 @@ You are almost done building the bottle. Use the *TopoDS_Compound* and *BRep_Bui
Congratulations! Your bottle is complete. Here is the result snapshot of the Tutorial application: Congratulations! Your bottle is complete. Here is the result snapshot of the Tutorial application:
@figure{/tutorial/images/tutorial_image019.png,"",320} @figure{/tutorial/images/tutorial_image019.png,"",320} height=450px
We hope that this tutorial has provided you with a feel for the industrial strength power of Open CASCADE Technology. We hope that this tutorial has provided you with a feel for the industrial strength power of Open CASCADE Technology.
If you want to know more and develop major projects using Open CASCADE Technology, we invite you to study our training, support, and consulting services on our site at https://www.opencascade.com/content/technology-support. Our professional services can maximize the power of your Open CASCADE Technology applications. If you want to know more and develop major projects using Open CASCADE Technology, we invite you to study our training, support, and consulting services on our site at https://www.opencascade.com/content/technology-support. Our professional services can maximize the power of your Open CASCADE Technology applications.
@@ -796,9 +795,9 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c
TopTools_ListOfShape facesToRemove; TopTools_ListOfShape facesToRemove;
facesToRemove.Append(faceToRemove); facesToRemove.Append(faceToRemove);
BRepOffsetAPI_MakeThickSolid BodyMaker; BRepOffsetAPI_MakeThickSolid aSolidMaker;
BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3); aSolidMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
myBody = BodyMaker.Shape(); myBody = aSolidMaker.Shape();
// Threading : Create Surfaces // Threading : Create Surfaces
Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99); Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99);
Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05); Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05);

View File

@@ -7,6 +7,8 @@ Upgrade from older OCCT versions {#occt__upgrade}
This document provides technical details on changes made in particular versions of OCCT. It can help to upgrade user applications based on previous versions of OCCT to newer ones. This document provides technical details on changes made in particular versions of OCCT. It can help to upgrade user applications based on previous versions of OCCT to newer ones.
@ref upgrade_occt780 "SEEK TO THE LAST CHAPTER (UPGRADE TO 7.8.0)"
@subsection upgrade_intro_precautions Precautions @subsection upgrade_intro_precautions Precautions
Back-up your code before the upgrade. Back-up your code before the upgrade.
@@ -24,7 +26,6 @@ The automatic upgrade tool is provided as is, without warranty of any kind, and
It is your responsibility to ensure that the changes you made in your code are correct. It is your responsibility to ensure that the changes you made in your code are correct.
When you upgrade the code by an automatic script, make sure to carefully review the introduced changes at each step before committing them. When you upgrade the code by an automatic script, make sure to carefully review the introduced changes at each step before committing them.
@section upgrade_65 Upgrade to OCCT 6.5.0 @section upgrade_65 Upgrade to OCCT 6.5.0
Porting of user applications from an earlier OCCT version to version 6.5 requires taking into account the following major changes: Porting of user applications from an earlier OCCT version to version 6.5 requires taking into account the following major changes:
@@ -396,7 +397,7 @@ However, due to redesign of basic mechanisms (CDL generic classes, Handles and R
WOK is not necessary anymore for building OCCT from sources, though it still can be used in a traditional way -- auxiliary files required for that are preserved. WOK is not necessary anymore for building OCCT from sources, though it still can be used in a traditional way -- auxiliary files required for that are preserved.
The recommended method for building OCCT 7.x is CMake, see @ref build_occt_win_cmake. The recommended method for building OCCT 7.x is CMake, see @ref build_occt_win_cmake.
The alternative solution is to use project files generated by OCCT legacy tool **genproj**, see @ref build_occt_genproj, @ref build_occt_win_codeblocks, and @ref build_occt_macos_xcode. The alternative solution is to use project files generated by OCCT legacy tool **genproj**, see @ref build_occt_genproj.
@subsubsection upgrade_occt700_cdl_auto Automatic upgrade @subsubsection upgrade_occt700_cdl_auto Automatic upgrade
@@ -2263,3 +2264,148 @@ For example:
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1); Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
BRepAlgoApi_Cut(S1, S2, aProgress->Start()); // method Start() creates range for usage in cut algorithm BRepAlgoApi_Cut(S1, S2, aProgress->Start()); // method Start() creates range for usage in cut algorithm
~~~~ ~~~~
@subsection upgrade_occt760_change_check_to_adaptors Changes in BRepLib_CheckCurveOnSurface & GeomLib_CheckCurveOnSurface interfaces
Now the classes accept adaptors instead objects as input parameters.
*BRepLib_CheckCurveOnSurface* does no more provide access to curves, surface and parameters: methods PCurve(), PCurve2(), Surface() and Range() have been removed.
*BRepLib_CheckCurveOnSurface*: the default value of the *isMultiThread* parameter of the *Perform()* function has been changed from *true* to *false*
*GeomLib_CheckCurveOnSurface* does no more provide access to curve, surface and parameters: methods Curve(), Surface() and Range() have been removed.
*GeomLib_CheckCurveOnSurface*: the default value of the *isMultiThread* parameter of the *Perform()* function has been changed from *true* to *false*
The following functions in *GeomLib_CheckCurveOnSurface* have been modified:
~~~~{.cpp}
GeomLib_CheckCurveOnSurface(const Handle(Adaptor3d_Curve)& theCurve,
const Standard_Real theTolRange);
void Init (const Handle(Adaptor3d_Curve)& theCurve, const Standard_Real theTolRange);
void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
const Standard_Boolean isMultiThread);
~~~~
@subsection upgrade_occt760_old_bop_removed Removal of old Boolean operations algorithm (BRepAlgo_BooleanOperation)
* The method *BRepAlgo_Tool::Deboucle3D* has been removed as duplicating. The corresponding method from *BRepOffset_Tool* class has to be used instead.
* The API classes from *BRepAlgo* package performing old Boolean operations algorithm have been removed:
- *BRepAlgo_BooleanOperation*
- *BRepAlgo_Fuse*
- *BRepAlgo_Common*
- *BRepAlgo_Cut*
- *BRepAlgo_Section*
The corresponding classes from the *BRepAlgoAPI* package have to be used instead.
@section upgrade_occt770 Upgrade to OCCT 7.7.0
Building OCCT now requires C++11-compliant compiler, so that some legacy compilers (Visual Studio 2010 and 2012) are no more supported.
It is recommended using Visual Studio 2015 or newer for building OCCT on Windows platform.
@subsection upgrade_770_removed_features Removed features
* One of the constructors of the BRepExtrema_DistanceSS class (the one without deflection parameter) has been removed as excessive. The remaining constructor has to be used instead.
@subsection upgrade_occt770_parallel_flag_removed Removed parameter theIsParallel from Put/Compute/Perform
theIsParallel parameter has been removed from Put/Compute/Perform from the next classes:
- BRepCheck_Analyzer
- BRepCheck_Edge
- BRepLib_ValidateEdge
- GeomLib_CheckCurveOnSurface
- BRepLib_CheckCurveOnSurface
Now, to set this flag, it is necessary to use method SetParallel()
For example:
~~~~{.cpp}
BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
aValidateEdge.SetParallel(toRunParallel);
aValidateEdge.Process();
~~~~
@subsection upgrade_occt770_drawer_aspects Prs3d_Drawer aspects
`Prs3d_Drawer` getters no more implicitly create "default" aspects.
If specific property has not been set before to this drawer instance nor to linked drawer instance, then NULL property will be returned.
Make sure to set property beforehand or to call `SetOwn*` / `SetupOwn*` methods to derive from defaults.
@subsection upgrade_occt770_opengl OpenGL functions
Applications extending OCCT 3D Viewer and calling OpenGL functions directly (like @c @::glEnable(), e.g. using global namespace) might be affected by changes in `OpenGl_GlFunctions.hxx`.
This header, as well as `OpenGl_GlCore20.hxx` and similar, no more include system OpenGL / OpenGL ES headers to define function table.
Application code calling OpenGL functions directly should be changed to either use `OpenGl_Context::core11fwd` (as designed)
or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hxx`).
@subsection upgrade_occt770_tooltriangulatedshape StdPrs_ToolTriangulatedShape
Method `StdPrs_ToolTriangulatedShape::Normal()` has been removed.
Please use `BRepLib_ToolTriangulatedShape::ComputeNormals()` to fill in normal attributes in triangulation and fetch them directly using `Poly_Triangulation::Normal()`.
@subsection upgrade_occt770_shapeproximity BRepExtrema_ShapeProximity
A new way of using the `BRepExtrema_ShapeProximity` class was provided for computing a proximity value between two shapes.
If at initialization of the `BRepExtrema_ShapeProximity` class the *theTolerance* parameter is not defined (Precision::Infinite() by default), the proximity value will be computed.
@section upgrade_occt780 Upgrade to OCCT 7.8.0
@subsection upgrade_780_recommendations New Features and Recommendations
The NCollection containers have been modernized to work with move semantics through the new `Move operator` and `Move constructor`. It is recommended to leverage this functionality in the development process.<br />
Backward compatibility with STL allocators has been implemented to use the OCCT memory manager with STL allocators (NCollection_Allocator, NCollection_OccAllocator).<br />
Additionally, utilities have been introduced to work with `shared_ptr` and `unique_ptr` using the OCCT memory manager (`Standard_MemoryUtils.hxx`).
@subsection upgrade_780_ncollection_update Change in Default Clear Behavior for Containers
NCollection container's `Clear(const bool theReleaseMemory = true)` have been changed to `Clear(const bool theReleaseMemory = false)`.<br />
Impacted classes include `IndexedMap`, `IndexedDataMap`, `Map`, `DataMap`, `DynamicArray(Vector)`, `IncAllocator`.<br />
This means that allocated memory for the container will be reused. In this case, it's necessary to be careful with `IncAllocator::Reset()` to control owners of memory blocks.
@subsection upgrade_780_hash_utils Reworked Hash Mechanism for Hash Map (NCollection's map)
The `HashCode(value, upperBound)` static method has been removed and `IsEqual(value1, value2)` is no longer used in the map.<br />
NCollection's map now operates on an STL-like hash mechanism: a struct with a public operator `size_t operator()(object&) const` and `bool operator(object&, object&) const`.<br />
The difference between STL and OCCT is that the hash struct and comparator are combined into a single struct to reduce conflicts on OCCT's user side.<br />
Hash utils have been implemented to hash objects, returning `uint32_t` and `uint64_t` depending on the template (`Standard_HashUtils.hxx`). Algorithms used are `MurmurHash` and `FNVHash`.<br />
Benefits:
* x64 using 8 bytes to store the hash instead of 4 bytes.
* OCCT classes will now be usable as elements in STL `unordered_map` and `unordered_set`.
The migration problem will occur at compile time. Make sure that `int HashCode` has been changed anywhere to `size operator` and `bool IsEqual` to `bool operator`.
@subsection upgrade_780_removed_files Removed Hash Specialization Classes
The majority of include files containing only specialized hashes have been removed.
Their functionality has been consolidated into the hashed object include file (in the "std" namespace).<br />
It is guaranteed that each removed hash class has been transferred to the native hash mechanism of the hashed class.
The migration problem may arise at compile time. Ensure that you remove any files that have been deprecated.
@subsection upgrade_780_tk_rework Reorganized DE TK
DE TK components have been combined or separated based on specific CAD formats to support plug-in ability.
* Components now have a "TKDE" prefix. The available list includes `TKDESTEP`, `TKDEOBJ`, `TKDEIGES`, `TKDEGLTF`, `TKDEVRML`, `TKDEPLY`, `TKDESTL`.
* The DE DRAW TK has been updated in a similar way: DRAW components now have a "TKXSDRAW" prefix. The available list includes `TKXSDRAWSTEP`, `TKXSDRAWOBJ`, `TKXSDRAWIGES`, `TKXSDRAWGLTF`, `TKXSDRAWVRML`, `TKXSDRAWPLY`, `TKXSDRAWSTL`.
Migration problems may occur during configuration time or compile time. Ensure that you update your project configuration accordingly.
@subsection upgrade_780_step_thread_safety Implemented STEP Thread-safety Interface
The STEP interface now uses Static_Interface to extract exchange settings.<br />
A new ability has been implemented to determine parameters in STEP, avoiding Static_Interface.
* For reading, use an additional argument with STEP's parameters in `ReadFile` or `Perform`.
* For writing, use an additional argument with STEP's parameters in `Transfer` or `Perform`.
@subsection upgrade_780_new_memory_manager New Memory Management Functionality
`Standard.hxx` has a new method `AllocateOptimal` for allocating without post-processing (cleaning).<br />
New profiles to allocate memory (defined at configuration time):
* `Native` - allocates with standard `malloc` and `calloc` functionality, performance depends on the OS.
* `TBB` - allocates with TBB's `scalable` allocator functionality.
* `JeMalloc` - allocates with `jemalloc` functions.
* `Flexible` - old-way allocation which defines allocation method in real-time by environment variables.<br />
The most recommended manager is `JeMalloc`. To use it with a plugin system, like `DRAW`, please ensure that JeMalloc was built with the `--disable-initial-exec-tls` flag. For more details, visit [JeMalloc](http://jemalloc.net/).
@subsection upgrade_780_optimization_profiles New CMake Variable for Optimization Profiles
`BUILD_OPT_PROFILE` is a new variable to define optimization level. Available profiles:
* `Default` - specializes only in quality-dependent parameters for the compiler.
* `Production` - specializes in performance and quality-dependent parameters for the compiler and linker.

View File

@@ -0,0 +1,413 @@
Data Exchange Wrapper (DE_Wrapper) {#occt_user_guides__de_wrapper}
============================
@tableofcontents
@section occt_de_wrapper_1 Introduction
This guide explains how to use the **Data Exchange Wrapper** (DE Wrapper).
It provides basic directions on setup, usage and file creation via DE_Wrapper.
The Data Exchange Wrapper (DE Wrapper) module allows reading and writing supported CAD formats to shape objects or special XDE documents, setting up the transfer process for all CAD files.
It is also possible to add support for new CAD formats by prototyping existing tools.
The DE Wrapper component requires @ref occt_user_guides__xde "XDE" toolkit for operation.
This guide mainly explains how to convert CAD files to Open CASCADE Technology (OCCT) shapes and vice versa.
This guide principally deals with the following OCCT classes:
* The Provider class, which loads CAD files and translates their contents to OCCT shapes or XDE documents, or translates OCCT shapes or XDE documents to CAD entities and then writes those entities to a CAD file.
* The Configuration class, which contains all information for the transfer process, such as the units, tolerance, and all internal information for the OCC readers or writers.
* The wrapper class, which contains all loaded configuration objects with own CAD format, reads or writes CAD files in the format derived from file extension or contents and saves or loads configuration settings for loaded configuration objects.
@section occt_de_wrapper_2 Supported CAD formats
| CAD format | Extensions | RW support | Thread Safety | Presentation | Package |
| :--------- | :--------- | :--------- | :----------- | :----------- | :------ |
| STEP | .stp, .step .stepz | RW | No | BRep, Mesh | STEPCAFControl |
| XCAF | .xbf | RW | Yes | BRep, Mesh | DEXCAFCascade |
| BREP | .brep | RW | Yes | BRep, Mesh | DEBRepCascade |
| IGES | .igs, .iges | RW | No | BRep | IGESCAFControl |
| OBJ | .obj | RW | Yes | Mesh | RWObj |
| STL | .stl | RW | Yes | Mesh | RWStl |
| PLY | .ply | W | Yes | Mesh | RWPly |
| GLTF | .glTF .glb | RW | Yes | Mesh | RWGltf |
| VRML | .wrl .vrml | RW | Yes | Mesh | Vrml |
**Note** :
* The format names in the first column match the FormatName values used for configuration nodes.
* The VendorName for all listed CAD formats is "OCC".
@section occt_de_wrapper_3 DE Session Configuration
Any providers can have their own read/write parameters. The transfer process is set up using DE configuration nodes, which hold all relevant parameters. There are two ways to change the parameter values: directly from code or by an external resource file/string.
The session is a global or static DE_Wrapper object that stores registered DE configuration nodes and wraps DE commands to work with them. It has some configuration parameters of its own and also keeps track of loaded nodes and specilal global parameters.
@subsection occt_de_wrapper_3_1 Getting a DE session. Code sample
Working with a DE session requires a DE_Wrapper object to be loaded or created first.
Getting the global DE_Wrapping object:
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
~~~~
Creating a local DE_Wrapper:
~~~~{.cpp}
Handle(DE_Wrapper) aSession = new DE_Wrapper();
~~~~
It is recommended to create a local one-time copy to work with the session, if no global changes are intended.
~~~~{.cpp}
Handle(DE_Wrapper) aOneTimeSession = aSession->Copy();
~~~~
@subsection occt_de_wrapper_3_2 Configuration resource
Configuration resource is an external file or string of the following format:
~~~~{.cpp}
global.priority.STEP : OCC DTK
global.general.length.unit : 1
provider.STEP.OCC.read.precision.val : 0.0001
~~~~
@subsubsection occt_de_wrapper_3_2_1 Configuration resource: graph of scopes
* **global.** is a scope of global parameters
* **priority.** is a scope of priority to use vendors with their providers.
* **general.** is a scope of global configuration parameter values
* <strong>"..."</strong> is an internal configuration with any internal scopes
* <strong>". : "</strong> is a separator of key-value
* __...__ parameter value, can't contain new line symbols.
* **provider.** is a scope of configuration providers
* **STEP.** is a scope of CAD format to configure
* **OCC.** is a scope of a vendor or provider
* <strong>"..."</strong> is an internal configuration with any internal scopes
* <strong>". : "</strong> is a separator of key-value
* <strong>"..."</strong> parameter value, can't contain new line symbols.
@subsubsection occt_de_wrapper_3_2_2 Loading configuration resources. Configuring DE Session
The resource should be loaded after the registration of all providers that should be configured. The resource only impacts registered parameters. To configure a new registered provider it is necessary to load the resource again. Parameters not present in the resource will remain unchanged.
There are two ways to check what parameters are available:
* C++: Open ConfigureNode file and check the InternalParameter field. Each parameter will be described with a comment. To check the global parameters, use the DE_Wrapper class public methods.
* Resource: Register all available Nodes to the session, then save the configuration and view all existing parameters.
There are two options for loading a resource: recursive and global parameters only. Recursive is the default option to configure all global parameters (units, priority, enable status) and all registered providers. Non-recursive configures only global parameters and ignores all provider settings. This option is the best for updating provider priority.
@subsubsection occt_de_wrapper_3_2_3 Loading configuration resources. Code sample
Configuring using a resource string:
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
TCollection_AsciiString aString =
"global.priority.STEP : OCC DTK\n"
"global.general.length.unit : 1\n"
"provider.STEP.OCC.read.precision.val : 0.\n";
Standard_Boolean aIsRecursive = Standard_True;
if (!aSession->Load(aString, aIsRecursive))
{
Message::SendFail() << "Error: configuration is incorrect";
}
~~~~
Configuring using a resource file:
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
TCollection_AsciiString aPathToFile = "";
Standard_Boolean aIsRecursive = Standard_True;
if (!aSession->Load(aPathToFile, aIsRecursive))
{
Message::SendFail() << "Error: configuration is incorrect";
}
~~~~
@subsubsection occt_de_wrapper_3_2_4 Loading configuration resources. DRAW sample
Configuring using a resource string:
~~~~{.cpp}
set conf "
global.priority.STEP : OCC
global.general.length.unit : 1
provider.STEP.OCC.read.iges.bspline.continuity : 1
provider.STEP.OCC.read.precision.mode : 0
provider.STEP.OCC.read.precision.val : 0.0001
"
LoadConfiguration ${conf} -recursive on
~~~~
Configuring using a resource file:
~~~~{.cpp}
set pathToFile ""
LoadConfiguration ${pathToFile} -recursive on
~~~~
@subsubsection occt_de_wrapper_3_2_5 Saving configuration resources. Dump of configuration DE Session
Saving the configuration of a DE Session involves dumping all parameters of registered providers.
If a parameter did not change during the session, its value remains as default.
There are two ways to save a resource: recursive and global parameters only. Recursive is the way to dump all registered provider information. Non-recursive dumps only global parameters, for example, save priority of vendors or the length unit.
It is possible to filter what vendors or providers to save by providing the correct name of the vendor or provider.
@subsubsection occt_de_wrapper_3_2_6 Saving configuration resources. Code sample
Dump to resource string. If the vendors list is empty, saves all vendors. If the providers list is empty, saves all providers of valid vendors.
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
TColStd_ListOfAsciiString aFormats;
TColStd_ListOfAsciiString aVendors;
aFormats.Appends("STEP");
aVendors.Appends("OCC");
Standard_Boolean aIsRecursive = Standard_True;
TCollection_AsciiString aConf = aSession->aConf->Save(aIsRecursive, aFormats, aVendors);
~~~~
Configure using a resource file. If the vendors list is empty, saves all vendors. If the providers list is empty, saves all providers of valid vendors.
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
TCollection_AsciiString aPathToFile = "";
TColStd_ListOfAsciiString aFormats;
TColStd_ListOfAsciiString aVendors;
aFormats.Appends("STEP");
aVendors.Appends("OCC");
Standard_Boolean aIsRecursive = Standard_True;
if (!aSession->Save(aPathToFile, aIsRecursive, aFormats,aVendors))
{
Message::SendFail() << "Error: configuration is not saved";
}
~~~~
@subsubsection occt_de_wrapper_3_2_7 Saving configuration resources. DRAW sample
Dump configuration to string. If no list of vendors is passed or it is empty, all vendors are saved. If no providers list is passed or it is empty, all providers of valid vendors are saved.
~~~~{.cpp}
set vendors "OCC"
set format "STEP"
set dump_conf [DumpConfiguration -recursive on -format ${format} -vendor ${vendors}]
~~~~
Dump configuration to file. If no vendors list are set as an argument or it is empty, saves all vendors. If no providers list as argument or it is empty, saves all providers of valid vendors:
~~~~{.cpp}
set vendors "OCC"
set format "STEP"
set pathToFile ""
DumpConfiguration -path ${pathToFile} -recursive on -format ${format} -vendor ${vendors}
~~~~
@subsection occt_de_wrapper_3_3 Registering providers
To transfer a CAD file using DE Wrapper, it is necessary to register a CAD provider.
The provider contains internal and global parameters that have default values in the creation stage.
All registered providers are set to the map with information about its vendor and kept as smart handles. Therefore, it is possible to change the values via handle from external code.
@subsubsection occt_de_wrapper_3_3_1 Registering providers. Code sample
It is nesessary to register only one ConfigurationNode for all needed formats.
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
Handle(DE_ConfigurationNode) aNode = new STEPCAFControl_ConfigurationNode();
aSession->Bind(aNode);
~~~~
@subsubsection occt_de_wrapper_3_3_2 Registering providers. DRAW Sample
Use DRAW with all providers registered by the following command:
~~~~{.cpp}
pload XDE
~~~~
@subsubsection occt_de_wrapper_3_3_3 Realtime initialization. Code sample
It is possible to change a paramater from code using a smart pointer.
~~~~{.cpp}
// global variable
static Handle(STEPCAFControl_ConfigurationNode) THE_STEP_NODE;
static Handle(DE_ConfigurationNode) RegisterStepNode()
{
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
if (!THE_STEP_NODE.IsNull())
{
return THE_STEP_NODE;
}
THE_STEP_NODE = new STEPCAFControl_ConfigurationNode();
aSession->Bind(THE_STEP_NODE);
return THE_STEP_NODE;
}
// Change parameter value
THE_STEP_NODE->InternalParameters.ReadRelationship = false;
THE_STEP_NODE->InternalParameters.ReadName = false;
THE_STEP_NODE->InternalParameters.ReadProps = false;
~~~~
@subsection occt_de_wrapper_3_4 Priority of Vendors
DE session is able to work with several vendors with the same supported CAD format. To choose the preffered vendor for each format, use a special priority list.
If the high priority vendor's provider is not supported, a transfer operation is needed (write/read), then the next vendor will be chosen.
@subsubsection occt_de_wrapper_3_4_1 Priority of Vendors. Code sample
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
TCollection_AsciiString aFormat = "STEP";
TColStd_ListOfAsciiString aVendors;
aVendors.Appends("OCC"); // high priority
aVendors.Appends("DTK");
// Flag to disable not choosen vendors, in this case configuration is possible
// otherwise, lower their priority and continue to check ability to transfer
Standard_Boolean aToDisable = Standard_True;
aSession->ChangePriority(aFormat, aVendors, aToDisable);
~~~~
@subsubsection occt_de_wrapper_3_4_2 Priority of Vendors. DRAW Sample
It is recommended to disable recursion and update only global parameters.
~~~~{.cpp}
set conf "
global.priority.STEP : OCC DTK
"
LoadConfiguration ${conf} -recursive off
~~~~
@section occt_de_wrapper_4 Transfer of CAD files
To transfer from a CAD file to OCC or from OCC to a CAD file, it is necessary to use a configured DE_Wrapper object. It can be local, one-time or global. Global configuration of DE_Wrapper propagates to all nodes via transfer. There are two options for transferring: using OCC shape or XCAF document. It is possible to work only with real path to/from the file. Streaming is not supported (yet).
The format of input/output file is automatically determined by its extension or contents.
@subsection occt_de_wrapper_4_1 Transfer of CAD files. Code samples
Reading STEP file to Shape.
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
TCollection_AsciiString aPathToFile = "example.stp";
TopoDS_Shape aShRes;
if (!aSession->Read(aPathToFile, aShRes))
{
Message::SendFail() << "Error: Can't read file";
}
~~~~
Writing Shape to STEP file.
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
TCollection_AsciiString aPathToFile = "example.stp";
TopoDS_Shape aShFrom = ...;
if (!aSession->Write(aPathToFile, aShRes))
{
Message::SendFail() << "Error: Can't write file";
}
~~~~
Reading STEP file into XCAF document.
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
TCollection_AsciiString aPathToFile = "example.stp";
Handle(TDocStd_Document) aDoc = ...;
if (!aSession->Read(aPathToFile, aDoc))
{
Message::SendFail() << "Error: Can't read file";
}
~~~~
Writing XCAF document into STEP.
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper();
TCollection_AsciiString aPathToFile = "example.stp";
Handle(TDocStd_Document) aDoc = ...;
if (!aSession->Write(aPathToFile, aDoc))
{
Message::SendFail() << "Error: Can't write file";
}
~~~~
@subsection occt_de_wrapper_4_2 Transfer of CAD files. DRAW samples
Reading a STEP file into a Shape.
~~~~{.cpp}
set fileName "sample.stp"
readfile shape ${fileName}
~~~~
Writing a Shape into STEP.
~~~~{.cpp}
set fileName "sample.stp"
writefile shape ${fileName}
~~~~
Reading STEP into XCAF document.
~~~~{.cpp}
set fileName "sample.stp"
ReadFile D ${fileName}
~~~~
Writing XCAF document into STEP.
~~~~{.cpp}
set fileName "sample.stp"
WriteFile D ${fileName}
~~~~
@subsection occt_de_wrapper_4_3 Transfer using DE Provider. Code sample
It is possible to read and write CAD files directly from a special provider.
~~~~{.cpp}
// Creating or getting node
Handle(STEPCAFControl_ConfigurationNode) aNode = new STEPCAFControl_ConfigurationNode();
// Creationg an one-time provider
Handle(DE_Provider) aProvider = aNode->BuildProvider();
// Setting configuration with all parameters
aProvider->SetNode(aNode);
if (!aProvider->Read(...))
{
Message::SendFail() << "Error: Can't read STEP file";
}
if (!aProvider->Write(...))
{
Message::SendFail() << "Error: Can't write STEP file";
}
~~~~
@subsection occt_de_wrapper_4_4 Temporary configuration via transfer
It is possible to change the configuration of only one transfer operation. To avoid changing parameters in a session, one-time clone of the session can be created and used for transfer. This way is recommended for use in multithreaded mode.
@subsubsection occt_de_wrapper_4_4_1 Temporary configuration via transfer. Code sample
Code sample to configure via transfer.
~~~~{.cpp}
Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper()->Copy();
TCollection_AsciiString aString =
"global.priority.STEP : OCC DTK\n"
"global.general.length.unit : 1\n"
"provider.STEP.OCC.read.precision.val : 0.\n";
if (!aSession->Load(aString, aIsRecursive))
{
Message::SendFail() << "Error: configuration is incorrect";
}
TCollection_AsciiString aPathToFile = "example.stp";
TopoDS_Shape aShRes;
if (!aSession->Read(aPathToFile, aShRes))
{
Message::SendFail() << "Error: Can't read file";
}
~~~~
@subsubsection occt_de_wrapper_4_4_2 Temporary configuration via transfer. DRAW sample
Code sample to configure via transfer within DRAW command.
~~~~{.cpp}
set fileName "sample.stp"
readfile S5 $filename -conf "global.general.length.unit : 1000 "
~~~~
Code sample to configure via transfer as variable.
~~~~{.cpp}
set fileName "sample.stp"
set conf "
global.priority.STEP : OCC
global.general.length.unit : 1
provider.STEP.OCC.read.iges.bspline.continuity : 1
provider.STEP.OCC.read.precision.mode : 0
provider.STEP.OCC.read.precision.val : 0.0001
"
readfile S5 $filename -conf ${conf}
~~~~

File diff suppressed because one or more lines are too long

View File

@@ -1331,7 +1331,7 @@ Therefore if the user of *NCollection* does not specify any allocator as a param
Nevertheless, it is possible to define a custom *Allocator* type to manage the memory in the most optimal or convenient way for this algorithm. Nevertheless, it is possible to define a custom *Allocator* type to manage the memory in the most optimal or convenient way for this algorithm.
As one possible choice, the class *NCollection_IncAllocator* is included. As one possible choice, the class *NCollection_IncAllocator* is included.
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 20kB) and the allocator keeps track of the amount of occupied memory. Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 12kB) and the allocator keeps track of the amount of occupied memory.
The method *Allocate* just increments the pointer to non-occupied memory and returns its previous value. The method *Allocate* just increments the pointer to non-occupied memory and returns its previous value.
Memory is only released in the destructor of *NCollection_IncAllocator*, the method *Free* is empty. Memory is only released in the destructor of *NCollection_IncAllocator*, the method *Free* is empty.
If used properly, this Allocator can greatly improve the performance of specific algorithms. If used properly, this Allocator can greatly improve the performance of specific algorithms.
@@ -1837,7 +1837,7 @@ bool areEqualAngles (double theAngle1, double theAngle2)
{ {
return Abs(theAngle1 - theAngle2) < Precision::Angular(); return Abs(theAngle1 - theAngle2) < Precision::Angular();
} }
~~~ ~~~~
It is also possible to check parallelism of two vectors as follows: It is also possible to check parallelism of two vectors as follows:
~~~~{.cpp} ~~~~{.cpp}
@@ -1845,7 +1845,7 @@ bool areParallelVectors (const gp_Vec& theVec1, const gp_Vec& theVec2)
{ {
return theVec1.IsParallel (theVec2, Precision::Angular()); return theVec1.IsParallel (theVec2, Precision::Angular());
} }
~~~ ~~~~
Note that *Precision::Angular()* can be used on both dot and cross products because for small angles the *Sine* and the *Angle* are equivalent. Note that *Precision::Angular()* can be used on both dot and cross products because for small angles the *Sine* and the *Angle* are equivalent.
So to test if two directions of type *gp_Dir* are perpendicular, it is legal to use the following code: So to test if two directions of type *gp_Dir* are perpendicular, it is legal to use the following code:
@@ -1854,7 +1854,7 @@ bool arePerpendicular (const gp_Dir& theDir1, const gp_Dir& theDir2)
{ {
return Abs(theDir1 * theDir2) < Precision::Angular(); return Abs(theDir1 * theDir2) < Precision::Angular();
} }
~~~ ~~~~
#### Precision::Confusion #### Precision::Confusion
@@ -1875,7 +1875,7 @@ bool isNullVector (const gp_Vec& theVec)
{ {
return theVec.Magnitude() < Precision::Confusion(); return theVec.Magnitude() < Precision::Confusion();
} }
~~~ ~~~~
#### Precision::Intersection #### Precision::Intersection

View File

@@ -165,7 +165,9 @@ if (!Interface_Static::SetIVal ("read.maxprecision.mode",1))
Default value is *Preferred (0)*. Default value is *Preferred (0)*.
<h4>read.maxprecision.val</h4> <h4>read.maxprecision.val</h4>
defines the maximum allowable tolerance (in mm) of the shape. It should be not less than the basis value of tolerance set in processor (either Resolution from the file or *read.precision.val*). Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance. defines the maximum allowable tolerance (in internal units, which are specified in xstep.cascade.unit) of the shape.
It should be not less than the basis value of tolerance set in processor (either Resolution from the file or *read.precision.val*).
Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance.
Read this parameter with: Read this parameter with:
~~~~{.cpp} ~~~~{.cpp}
Standard_Real rp = Interface_Static::RVal("read.maxprecision.val"); Standard_Real rp = Interface_Static::RVal("read.maxprecision.val");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Some files were not shown because too many files have changed in this diff Show More