MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0027407Open CASCADE[OCCT] OCCT:Configurationpublic2016-04-21 11:482017-09-29 16:29
Reporterabv 
Assigned Toabv 
PrioritynormalSeverityminor 
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version[OCCT] 7.2.0Fixed in Version[OCCT] 7.2.0 
Summary0027407: Accelerate OCCT build on Visual Studio by use of precompiled headers
DescriptionAs proven by OCE experience, use of precompiled headers feature of Visual Studio can considerably accelerate process of building OCCT from sources (by ~ 3.5 times, see http://dev.opencascade.org/index.php?q=node/1158 [^] for discussion).

Though not suitable for OCCT development, acceleration via use of PCH would be quite useful for certification testing: it can reduce build time by ~ 20 min.
Steps To ReproduceConfigure, generate and build occt with BUILD_USE_PRECOMPILED_HEADER_FILES=ON
Result: reduced build time
TagsNo tags attached.
Test case numberNot required
Attached Files

- Relationships
has duplicate 0028417closedbugmaster Community Using PRECOMPILED HEADER to speed up compilation time 

-  Notes
(0054539)
git (administrator)
2016-05-30 15:18

Branch CR27407 has been created by ski.

SHA-1: e0881ac5a56a9d7a8cc8f54a78f19f71c0483cf4


Detailed log of new commits:

Author: ski
Date: Mon May 30 14:54:47 2016 +0300

    Corrected comment in OSD_signal.cxx file

Author: ski
Date: Mon May 30 15:06:48 2016 +0300

    0027407: Accelerate OCCT build on Visual Studio by use of precompiled headers
    
    Added cmake functionality to generate and use precompiled header files.
(0054540)
git (administrator)
2016-05-30 15:21

Branch CR27407 has been updated forcibly by ski.

SHA-1: b2a3db75bf20e2ead4297b9fec24f9bb5ea96b85
(0054604)
git (administrator)
2016-06-01 17:44

Branch CR27407 has been updated by ski.

SHA-1: 398629dab7efa44eaae604f45c17a755b18fdbb3


Detailed log of new commits:

Author: ski
Date: Wed Jun 1 17:20:38 2016 +0300

    Eliminate compile warnings and errors.

Author: ski
Date: Tue May 31 14:55:05 2016 +0300

    Exclude problem header files names from pch file.

Author: ski
Date: Mon May 30 16:27:38 2016 +0300

    Apply using of precompiled header files only on *.cxx files.

(0054607)
kgv (developer)
2016-06-01 18:06
edited on: 2016-06-01 18:07

PLib_JacobiPolynomial_0.hxx
+#ifndef PLib_JacobiPolynomial_0_HeaderFile
+#define PLib_JacobiPolynomial_0_HeaderFile

it seems this header is designed for internal use.
It is better renaming it to "PLib_JacobiPolynomial.pxx" and including without angles in .cxx.

(0054612)
git (administrator)
2016-06-02 09:32

Branch CR27407 has been updated forcibly by ski.

SHA-1: dfd77f28415b4f8c1e24ff5f963e51f4d30bea2a
(0054613)
git (administrator)
2016-06-02 09:35

Branch CR27407 has been updated forcibly by ski.

SHA-1: 6d5cb88442f5ad02b642923c68c8bd3488b4543a
(0054622)
git (administrator)
2016-06-02 11:12

Branch CR27407 has been updated forcibly by ski.

SHA-1: aa725eb09bb361ccbfddc6127b00de1ccead5ebd
(0054623)
ski (developer)
2016-06-02 11:33

Dear abv,

branch CR27407 was rebased on current state of master and squashed.
New CMake option BUILD_USE_PRECOMPILED_HEADER_FILES was added.

Please, review.
(0054631)
git (administrator)
2016-06-02 14:41

Branch CR27407 has been updated forcibly by inv.

SHA-1: 5bac86486e7d00204781ee33eca6932d790f8304
(0054637)
git (administrator)
2016-06-02 15:51

Branch CR27407 has been updated by ski.

SHA-1: 86741974895ea15eb5d261fd7842ec1e189ac805


Detailed log of new commits:

Author: ski
Date: Thu Jun 2 15:50:44 2016 +0300

    Search for tclsh executable was added.

(0054638)
git (administrator)
2016-06-02 15:52

Branch CR27407 has been updated forcibly by ski.

SHA-1: ccac43a098a6d589aa82e2ae0c74d7fe40dc8939
(0054639)
git (administrator)
2016-06-02 15:59

Branch CR27407 has been updated forcibly by ski.

SHA-1: db0f47307d0a59076b5ce8fc4de557a50afd341e
(0054645)
git (administrator)
2016-06-02 17:24

Branch CR27407 has been updated by ski.

SHA-1: 5570acc5430d24c19e1d9b42dc8d0a721fc92f65


Detailed log of new commits:

Author: ski
Date: Thu Jun 2 17:24:20 2016 +0300

    Updated documentation.

Author: ski
Date: Thu Jun 2 17:15:19 2016 +0300

    Standard output during generation of precompiled header files was silenced.

(0054653)
abv (manager)
2016-06-02 18:26

Remarks:

1. It is very bad practice to treat some source files differently from others basing on hard-coded lists, as done in occt_toolkit.cmake -- this is very obscure and it will be extremely hard to debug (except for the author who knows the trick). Please find a way to either avoid this need at all, or at least implement it in a way so that files that need to be excluded from PCH could be marked individually.

2. Why using TCL for generating header files? I suppose this can be done by standard CMake tools as well. It is highly desirable to avoid dependency on TCL for generation of projects by CMake (consider that DRAW is optional, hence the TCL may not be present).

3. Changes in sources where some macro names are changed to avoid conflicts should be revised to avoid meaningless name variations like TRACE -> aTRACE. The best variant is to avoid such macros in header files at all. When not possible, names should be changed to class or package specific, e.g. Interface_TRACE

4. In PLib_JacobiPolynomial.cxx, inclusion of pxx file should be separated from normal headers, to highlight that it is part of the code and not header

5. In TopOpeBRepBuild_ShapeListOfShape.cxx, the #define in the beginning of the file seem to be completely unnecessary and can be removed
(0054693)
abv (manager)
2016-06-03 15:03
edited on: 2016-06-03 15:04

Besides, have a look at #pragma hdrstop declaration -- probably it can be used to disable precompiled header for a particular file

(0054733)
git (administrator)
2016-06-06 15:50

Branch CR27407_1 has been created by ski.

SHA-1: 55b3fe5233ddd7d89a0e9bf428571b4486ba7b48


Detailed log of new commits:

Author: ski
Date: Mon Jun 6 15:05:23 2016 +0300

    0027407: Accelerate OCCT build on Visual Studio by use of precompiled headers
    
    Added cmake functionality to generate and use precompiled header files.
    Corrected comment in OSD_signal.cxx file.
    Applied using of precompiled header files only on *.cxx files.
    Excluded problem header files names from pch file.
    Eliminated compile warnings and errors.
    Search for tclsh executable was added.
    Standard output during generation of precompiled header files was silenced.
    Updated documentation.
(0054767)
git (administrator)
2016-06-07 16:24

Branch CR27407_1 has been updated by ski.

SHA-1: 551fee38e068caaea4127c68927d37d48075ac25


Detailed log of new commits:

Author: ski
Date: Tue Jun 7 15:39:27 2016 +0300

    Eliminated compile warning for debug configuration.

(0054768)
kgv (developer)
2016-06-07 16:40

-      memcpy (ChangeData(), theCopy.Data(), std::min (SizeBytes(), theCopy.SizeBytes()));
+      memcpy (ChangeData(), theCopy.Data(), (std::min) (SizeBytes(), theCopy.SizeBytes()));

what does (std::min) is supposed to do?
How this helps with conflicting max/min macros (which I suppose the reason for this code)?

 #ifdef _WIN32
+#ifdef _WIN32_WINNT
+#undef _WIN32_WINNT
+#endif
 #define _WIN32_WINNT 0x0400  // for trackmouseevent support  requires Win95 with IE 3.0 or greater.
 
#include <windows.h>

I suppose OCCT7+ can not be built by compiler for so old versions of Windows.
Please try removing these defines at all and check compilation on the oldest supported compiler (msvc2010).
(0054924)
git (administrator)
2016-06-10 18:51

Branch CR27407_1 has been updated forcibly by ski.

SHA-1: 39ef1de02653025263a6b0a1d8cf94299b22abe7
(0054925)
git (administrator)
2016-06-10 19:06

Branch CR27407_1 has been updated forcibly by ski.

SHA-1: 352217088e8f0df6abf0f0eb78e31508c718aba6
(0054926)
git (administrator)
2016-06-10 19:13

Branch CR27407_2 has been created by ski.

SHA-1: 656a36394e995e1b6706c088cf320c56a6e27b3d


Detailed log of new commits:

Author: ski
Date: Fri Jun 10 12:46:13 2016 +0300

    0027407: Accelerate OCCT build on Visual Studio by use of precompiled headers
    
    Added cmake functionality to generate and use precompiled header files.
(0054942)
git (administrator)
2016-06-14 12:26

Branch CR27407_2 has been updated forcibly by ski.

SHA-1: d9ee908cdb6b1a945ef17b1b7b6c5d027a453f0a
(0054966)
ski (developer)
2016-06-14 15:58

Dear abv,

as it has been discussed, occt branch CR27407_2 contains procedure to create precompiled header files via CMake only.
Header files <TOOLKIT_NAME>.hxx (contains all header files of current toolkit, it will be installed during installation procedure) and
<TOOLKIT_NAME>.h (precompiled header file, contains includes of necessary <TOOLKIT_NAMES>.hxx) are created during configuration via CMake.
Both header files are located in "${CMAKE_BINARY_DIR}/inc" during building.

It seems that current approach could not reduce compilation time according to huge number of header files in pch.


Branch CR27407_1 contains procedure to create precompiled header files via tcl script.
It takes only included in source files headers to the precompiled header file <TOOLKIT_NAME>.h.
Compilation time of such approach is much faster than in branch CR27407_2


Another way of using of pch is not to generate pch files but take already generated files from branch CR27407_1, and generate only <TOOLKIT_NAME>.hxx API header files which will be installed and will not be used during building (such as in CR27407_2).
(0055837)
git (administrator)
2016-07-11 20:57

Branch CR27407_1 has been updated forcibly by abv.

SHA-1: 56b829a024d11ef17514e38b3bf5e60f2367dcd2
(0055838)
git (administrator)
2016-07-11 20:57

Branch CR27407_2 has been updated forcibly by abv.

SHA-1: 5569a25f940bcef42d695a68358abe93ebf5516a
(0055842)
abv (manager)
2016-07-12 08:32

I have rebased both branches on current master and tested with VC 10 and VC 14. Unfortunately, both fail to build (in the same way for VC 10 and VC14):

CR27407_1: compiler error in TKDraw.cpp due to macro "Opposite" defined in X11.h (included via tcl.h) that conflicts with math_Vector::Opposite

CR27401_2: linker error in TKDCAF and other libs that use TKStd, due to missing symbol ShapePersistent_Poly::pTriangulation::Import (required for some unclear reason, due to reference from some template instance). In addition, VC 14 fails sporadically when many files are built due to PCH heap overrun (suggests uzing -Zm104); the same files are built fine on the next build.

I have also played a bit with PCH and found them to be totally unusable: any change causes new kinds of errors that are extremely difficult to trace and understand. For instance, modifying CR27401_2 so as to keep only own toolkit .hxx in PCH header, I got errors in winnt.h when including OSD_Thread.hxx in TKGeomBase....

One obvuious conclusion is that PCH files cannot be generated automatically, alas. I suppose they can be generated once and put in sources, in each toolkit.

However, before proceeding with PCH, I propose trying another approach to accelerate build: instead of adding each CXX in project, add single CXX per package that #includes all CXX files of that package. The effect should be quite similar to using PCH, but more universal (not depending on compiler).
(0056715)
bugmaster (administrator)
2016-08-15 13:36

I processed only TKernel toolkit. See branch CR27401_3.
Such approach did you assume?

TKernel is not compiled such way.

The reason described in this article.
https://engineering-game-dev.com/2009/12/15/the-evils-of-unity-builds/ [^]
(0069405)
abv (manager)
2017-08-15 15:42

The support of use of precompiled headers has been introduced by fix for 0028417
(0069612)
git (administrator)
2017-08-18 17:00

Branch CR27407 has been deleted by kgv.

SHA-1: 5570acc5430d24c19e1d9b42dc8d0a721fc92f65
(0069613)
git (administrator)
2017-08-18 17:00

Branch CR27407_1 has been deleted by kgv.

SHA-1: 56b829a024d11ef17514e38b3bf5e60f2367dcd2
(0069614)
git (administrator)
2017-08-18 17:00

Branch CR27407_2 has been deleted by kgv.

SHA-1: 5569a25f940bcef42d695a68358abe93ebf5516a

- Issue History
Date Modified Username Field Change
2016-04-21 11:48 abv New Issue
2016-04-21 11:48 abv Assigned To => bugmaster
2016-04-21 13:13 msv Description Updated View Revisions
2016-05-30 15:18 git Note Added: 0054539
2016-05-30 15:21 git Note Added: 0054540
2016-06-01 17:44 git Note Added: 0054604
2016-06-01 18:06 kgv Note Added: 0054607
2016-06-01 18:07 kgv Note Edited: 0054607 View Revisions
2016-06-02 09:32 git Note Added: 0054612
2016-06-02 09:35 git Note Added: 0054613
2016-06-02 11:12 git Note Added: 0054622
2016-06-02 11:24 ski Assigned To bugmaster => ski
2016-06-02 11:24 ski Status new => assigned
2016-06-02 11:33 ski Note Added: 0054623
2016-06-02 11:33 ski Assigned To ski => abv
2016-06-02 11:33 ski Status assigned => resolved
2016-06-02 11:33 ski Steps to Reproduce Updated View Revisions
2016-06-02 14:41 git Note Added: 0054631
2016-06-02 15:51 git Note Added: 0054637
2016-06-02 15:52 git Note Added: 0054638
2016-06-02 15:59 git Note Added: 0054639
2016-06-02 17:24 git Note Added: 0054645
2016-06-02 18:26 abv Note Added: 0054653
2016-06-02 18:26 abv Assigned To abv => ski
2016-06-02 18:26 abv Status resolved => assigned
2016-06-03 15:03 abv Note Added: 0054693
2016-06-03 15:04 abv Note Edited: 0054693 View Revisions
2016-06-06 15:50 git Note Added: 0054733
2016-06-07 16:24 git Note Added: 0054767
2016-06-07 16:40 kgv Note Added: 0054768
2016-06-10 18:51 git Note Added: 0054924
2016-06-10 19:06 git Note Added: 0054925
2016-06-10 19:13 git Note Added: 0054926
2016-06-14 12:26 git Note Added: 0054942
2016-06-14 15:58 ski Note Added: 0054966
2016-06-14 15:58 ski Assigned To ski => abv
2016-06-14 15:58 ski Status assigned => feedback
2016-07-11 20:57 git Note Added: 0055837
2016-07-11 20:57 git Note Added: 0055838
2016-07-12 08:32 abv Note Added: 0055842
2016-07-14 07:25 abv Assigned To abv => bugmaster
2016-08-08 12:00 bugmaster Assigned To bugmaster => ski
2016-08-15 12:45 bugmaster Assigned To ski => bugmaster
2016-08-15 13:36 bugmaster Note Added: 0056715
2016-08-15 14:00 bugmaster Assigned To bugmaster => abv
2016-11-03 17:38 abv Target Version 7.1.0 => 7.2.0
2017-01-31 11:10 kgv Relationship added has duplicate 0028417
2017-08-15 15:42 abv Note Added: 0069405
2017-08-15 15:42 abv Status feedback => tested
2017-08-15 15:42 abv Status tested => verified
2017-08-15 15:42 abv Resolution open => fixed
2017-08-18 13:05 bugmaster Test case number => Not required
2017-08-18 17:00 git Note Added: 0069612
2017-08-18 17:00 git Note Added: 0069613
2017-08-18 17:00 git Note Added: 0069614
2017-09-29 16:17 user533 Fixed in Version => 7.2.0
2017-09-29 16:29 user533 Status verified => closed


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker