Prepare OCC for C++ module system

Andreas Fleischner's picture

I’m talking about the proposed c++ modules here, not open cascade modules
C++ Modules not getting in the vc17 standard but are a technical specification now. Many of the targeted compilers for OCC (Visual Studio, LLVM Clang and GCC) are working on compiler extensions probably ready in the 2017/18 timeframe. Visual Studio has a working experimental prototype available since Visual Studio 2015 Update 1 (currently command line only).

Starting Resources are:
- Paper: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0142r0.pdf
- CppCon2015 Keynote on YouTube: Large Scale C++ with Modules: What You Should Know

Maybe it’s too early since syntax/tools aren't finalized yet and supposed to change, however progress on this topic is currently very fast and inputs for this feature are taken at the moment. So experience from large frameworks as occ might help.

After full transition, c++ modules will also improve future refactoring issues due to improved compile speed and availability of upcoming tool support.

First step would be to allow building with c++ modules in Occ7.x (Only as a facade for the api; internal occ code unchanged for backward compatibility to old compilers)

Proposed work packages (up to discussion):
- Define granularity of c++ modules (Mapping to occ package, toolkit or module level)
- c++ modules target isolation from macros. Therefore analyze how clean occ is in terms of macros. Get rid of macros that cross package level (Not sure if this is required to build the facade)
- Place module keyword in all cpp files (after includes)
- Decorate all classes or namespaces with export keyword
- Create module definitions files
- Test feasibility by hand on some of the core packages
- Create scripts that could batch the whole library

Later if modules are available on all compilers also change internal occ code
- Create scripts to merge all header files with the cpp files (code and definition in one place). Remove all Headers
- Create scripts to remove all #includes and forward declarations. Replace with import statements

www.opencascade.com

Copyright 2011-2017
OPEN CASCADE SAS
Contact us