git.s-ol.nu ~forks/DiligentCore / 8306ee8
Added reference to code_formatting from readme Egor Yusov 1 year, 9 months ago
2 changed file(s) with 15 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
705705 that code in the **DiligentCore** repository is free of Intellectual Property encumbrances. In submitting code to
706706 this repository, you are agreeing that the code is free of any Intellectual Property claims.
707707
708 Diligent Engine uses [clang-format](https://clang.llvm.org/docs/ClangFormat.html) to valdiate and enforce
709 consistent source code style throught the code base. The format is validated by appveyor and travis
710 for each commit and pull request, and the build will fail if any code formatting issue is found. Please refer
711 to [this page](https://github.com/DiligentGraphics/DiligentCore/blob/master/doc/code_formatting.md) for instructions
712 on how to set up clang-format and automatic code formatting.
713
708714 <a name="references"></a>
709715 # References
710716
1313 ## Validation
1414
1515 Diligent Engine provides script files that can be executed to validate the source code formatting of every module. These scripts
16 can be found under `BuildTools/FormatValidation` folder. Besides that, CMake generates build targets
16 can be found under `BuildTools/FormatValidation` folder of each module. Besides that, CMake generates build targets
1717 (e.g. `DiligentCore-ValidateFormatting`) that run the same scripts. Building these targets has the effect of format validation,
1818 so if All-build finishes without errors, the code should be properly formatted.
1919
4141
4242 clang-format [supports integration](https://clang.llvm.org/docs/ClangFormat.html) with many popular IDEs.
4343 Formatting the code directly from the editor is probably the most convenient way as it let's you see the
44 results right-away. In certain circumstances it may be preferrable to override automatic formatting using
45 special comments:
44 results right-away.
45 In particular, to configure Visual Studio 2017 or later to use clang-format, open `Tools -> Options` dialog and
46 go to `Text Editor -> C/C++ -> Formatting` tab. Mark `Enable ClangFormat` checkbox, and make sure to use custom clang-format
47 file either from the source tree, or, if you have the right version installed, from LLVM distribution.
48 In the same dialog you can also configure various formatting options.
49
50 Note that in certain circumstances it may be preferrable to disable automatic formatting (please do not abuse
51 this option!), which can be done using the following special comments:
4652
4753 ```cpp
4854 // clang-format off
4955 ...
5056 // clang-format on
5157 ```
52
53 In particular, to configure Visual Studio 2017 or late to use clang-format, open `Tools -> Options` dialog and
54 go to `Text Editor -> C/C++ -> Formatting` tab. Mark `Enable ClangFormat` checkbox, and make sure to use custom clang-format
55 file either from the source tree, or, if you have the right version installed, from LLVM distribution.
56 In the same dialog you can also configure various formatting options.