View Issue Details

IDProjectCategoryView StatusLast Update
0027407Open CASCADEOCCT:Configurationpublic2017-09-29 16:29
ReporterabvAssigned Toabv 
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Target Version7.2.0Fixed in Version7.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

Relationships

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

Activities

git

2016-05-30 15:18

administrator   ~0054539

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.

git

2016-05-30 15:21

administrator   ~0054540

Branch CR27407 has been updated forcibly by ski.

SHA-1: b2a3db75bf20e2ead4297b9fec24f9bb5ea96b85

git

2016-06-01 17:44

administrator   ~0054604

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.

kgv

2016-06-01 18:06

developer   ~0054607

Last edited: 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.

git

2016-06-02 09:32

administrator   ~0054612

Branch CR27407 has been updated forcibly by ski.

SHA-1: dfd77f28415b4f8c1e24ff5f963e51f4d30bea2a

git

2016-06-02 09:35

administrator   ~0054613

Branch CR27407 has been updated forcibly by ski.

SHA-1: 6d5cb88442f5ad02b642923c68c8bd3488b4543a

git

2016-06-02 11:12

administrator   ~0054622

Branch CR27407 has been updated forcibly by ski.

SHA-1: aa725eb09bb361ccbfddc6127b00de1ccead5ebd

ski

2016-06-02 11:33

developer   ~0054623

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.

git

2016-06-02 14:41

administrator   ~0054631

Branch CR27407 has been updated forcibly by inv.

SHA-1: 5bac86486e7d00204781ee33eca6932d790f8304

git

2016-06-02 15:51

administrator   ~0054637

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.

git

2016-06-02 15:52

administrator   ~0054638

Branch CR27407 has been updated forcibly by ski.

SHA-1: ccac43a098a6d589aa82e2ae0c74d7fe40dc8939

git

2016-06-02 15:59

administrator   ~0054639

Branch CR27407 has been updated forcibly by ski.

SHA-1: db0f47307d0a59076b5ce8fc4de557a50afd341e

git

2016-06-02 17:24

administrator   ~0054645

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.

abv

2016-06-02 18:26

manager   ~0054653

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

abv

2016-06-03 15:03

manager   ~0054693

Last edited: 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

git

2016-06-06 15:50

administrator   ~0054733

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.

git

2016-06-07 16:24

administrator   ~0054767

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.

kgv

2016-06-07 16:40

developer   ~0054768

-      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).

git

2016-06-10 18:51

administrator   ~0054924

Branch CR27407_1 has been updated forcibly by ski.

SHA-1: 39ef1de02653025263a6b0a1d8cf94299b22abe7

git

2016-06-10 19:06

administrator   ~0054925

Branch CR27407_1 has been updated forcibly by ski.

SHA-1: 352217088e8f0df6abf0f0eb78e31508c718aba6

git

2016-06-10 19:13

administrator   ~0054926

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.

git

2016-06-14 12:26

administrator   ~0054942

Branch CR27407_2 has been updated forcibly by ski.

SHA-1: d9ee908cdb6b1a945ef17b1b7b6c5d027a453f0a

ski

2016-06-14 15:58

developer   ~0054966

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).

git

2016-07-11 20:57

administrator   ~0055837

Branch CR27407_1 has been updated forcibly by abv.

SHA-1: 56b829a024d11ef17514e38b3bf5e60f2367dcd2

git

2016-07-11 20:57

administrator   ~0055838

Branch CR27407_2 has been updated forcibly by abv.

SHA-1: 5569a25f940bcef42d695a68358abe93ebf5516a

abv

2016-07-12 08:32

manager   ~0055842

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).

bugmaster

2016-08-15 13:36

administrator   ~0056715

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/

abv

2017-08-15 15:42

manager   ~0069405

The support of use of precompiled headers has been introduced by fix for 0028417

git

2017-08-18 17:00

administrator   ~0069612

Branch CR27407 has been deleted by kgv.

SHA-1: 5570acc5430d24c19e1d9b42dc8d0a721fc92f65

git

2017-08-18 17:00

administrator   ~0069613

Branch CR27407_1 has been deleted by kgv.

SHA-1: 56b829a024d11ef17514e38b3bf5e60f2367dcd2

git

2017-08-18 17:00

administrator   ~0069614

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
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
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
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
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 aiv Fixed in Version => 7.2.0
2017-09-29 16:29 aiv Status verified => closed