Skip to content

Commit fbe464e

Browse files
StefanStojanovicaduh95
authored andcommittedMar 9, 2025
doc: fix Windows ccache section position
PR-URL: #57326 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 41ea5a2 commit fbe464e

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed
 

‎BUILDING.md

+37-36
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ file a new issue.
4040
* [Option 2: Automated install with WinGet](#option-2-automated-install-with-winget)
4141
* [Option 3: Automated install with Boxstarter](#option-3-automated-install-with-boxstarter)
4242
* [Building Node.js](#building-nodejs-2)
43+
* [Using ccache](#using-ccache)
4344
* [Android](#android)
4445
* [`Intl` (ECMA-402) support](#intl-ecma-402-support)
4546
* [Build with full ICU support (all locales supported by ICU)](#build-with-full-icu-support-all-locales-supported-by-icu)
@@ -577,42 +578,6 @@ export CC="ccache cc" # add to ~/.zshrc or other shell config file
577578
export CXX="ccache c++" # add to ~/.zshrc or other shell config file
578579
```
579580

580-
On Windows:
581-
582-
Follow <https://github.com/ccache/ccache/wiki/MS-Visual-Studio>, and you
583-
should notice that obj file will be bigger than the normal one.
584-
585-
First, install ccache. Assuming the installation of ccache is in `c:\ccache`
586-
(where you can find `ccache.exe`), copy `c:\ccache\ccache.exe` to `c:\ccache\cl.exe`
587-
with this command.
588-
589-
```powershell
590-
cp c:\ccache\ccache.exe c:\ccache\cl.exe
591-
```
592-
593-
With newer version of Visual Studio, it may need the copy to be `clang-cl.exe`
594-
instead. If the output of `vcbuild.bat` suggestion missing `clang-cl.exe`, copy
595-
it differently:
596-
597-
```powershell
598-
cp c:\ccache\ccache.exe c:\ccache\clang-cl.exe
599-
```
600-
601-
When building Node.js, provide a path to your ccache via the option:
602-
603-
```powershell
604-
.\vcbuild.bat ccache c:\ccache\
605-
```
606-
607-
This will allow for near-instantaneous rebuilds when switching branches back
608-
and forth that were built with cache.
609-
610-
To use it with ClangCL, run this instead:
611-
612-
```powershell
613-
.\vcbuild.bat clang-cl ccache c:\ccache\
614-
```
615-
616581
##### Loading JS files from disk instead of embedding
617582

618583
When modifying only the JS layer in `lib`, it is possible to externally load it
@@ -810,6 +775,42 @@ To test if Node.js was built correctly:
810775
Release\node -e "console.log('Hello from Node.js', process.version)"
811776
```
812777

778+
##### Using ccache:
779+
780+
Follow <https://github.com/ccache/ccache/wiki/MS-Visual-Studio>, and you
781+
should notice that obj file will be bigger than the normal one.
782+
783+
First, install ccache. Assuming the installation of ccache is in `c:\ccache`
784+
(where you can find `ccache.exe`), copy `c:\ccache\ccache.exe` to `c:\ccache\cl.exe`
785+
with this command.
786+
787+
```powershell
788+
cp c:\ccache\ccache.exe c:\ccache\cl.exe
789+
```
790+
791+
With newer version of Visual Studio, it may need the copy to be `clang-cl.exe`
792+
instead. If the output of `vcbuild.bat` suggestion missing `clang-cl.exe`, copy
793+
it differently:
794+
795+
```powershell
796+
cp c:\ccache\ccache.exe c:\ccache\clang-cl.exe
797+
```
798+
799+
When building Node.js, provide a path to your ccache via the option:
800+
801+
```powershell
802+
.\vcbuild.bat ccache c:\ccache\
803+
```
804+
805+
This will allow for near-instantaneous rebuilds when switching branches back
806+
and forth that were built with cache.
807+
808+
To use it with ClangCL, run this instead:
809+
810+
```powershell
811+
.\vcbuild.bat clang-cl ccache c:\ccache\
812+
```
813+
813814
### Android
814815

815816
Android is not a supported platform. Patches to improve the Android build are

0 commit comments

Comments
 (0)
Please sign in to comment.