Skip to content

Commit

Permalink
Doc: update docs/windows.rst
Browse files Browse the repository at this point in the history
Signed-off-by: leleliu008 <[email protected]>
  • Loading branch information
leleliu008 committed Sep 20, 2023
1 parent dedfed1 commit c10f7c7
Showing 1 changed file with 58 additions and 15 deletions.
73 changes: 58 additions & 15 deletions docs/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Microsoft Visual Studio
.............................................................................
https://www.visualstudio.com/

Obviously there is Microsoft Visual Studio 2013. Many professional developers targeting Windows use Visual Studio. Visual Studio comes in a couple of different editions. Their Express and Community editions are free to use, but a Microsoft-account is required to download the .iso and when you want to continue using it after a 30-days trial period. Other editions of Visual Studio must be purchased.
Many professional developers targeting Windows use Visual Studio. Visual Studio comes in a couple of different editions. Their Express and Community editions are free to use, but a Microsoft-account is required to download the .iso and when you want to continue using it after a 30-days trial period. Other editions of Visual Studio must be purchased.

Installing Visual Studio will give you the IDE, the command line compilers and the MS-version of make named nmake.

Expand Down Expand Up @@ -46,7 +46,46 @@ Building ctags from the command line
Microsoft Visual Studio
.............................................................................

Most users of Visual Studio will use the IDE and not the command line to compile a project. But by default a shortcut to the command prompt that sets the proper path is installed in the Start Menu. When this command prompt is used ``nmake -f mk_mvc.mak`` will compile ctags. You can also go into the ``win32`` subdirectory and run ``msbuild ctags_vs2013.sln`` for the default build. Use ``msbuild ctags_vs2013.sln /p:Configuration=Release`` to specifically build a release build. MSBuild is what the IDE uses internally and therefore will produce the same files as the IDE.
Microsoft Visual Studio provides ``Visual Studio Developer Command Prompt`` for command-line enthusiasts.

There are two ways to setup ``Visual Studio Developer Command Prompt``.

The first way to setup ``Visual Studio Developer Command Prompt`` is by clicking the ``Windows Start Menu``, details please refer to https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2019

The second way to setup ``Visual Studio Developer Command Prompt`` is as follows:

step1. open ``Command Prompt`` Application

step2. call ``vcvarsall.bat`` in current ``Command Prompt``, ``vcvarsall.bat`` file's location is various for different Microsoft Visual Studio versions and editions.

For Microsoft Visual Studio 2022 Enterprise::

call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"

For Microsoft Visual Studio 2022 Community::

call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"

For Microsoft Visual Studio 2019 Enterprise::

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"

For Microsoft Visual Studio 2019 Community::

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"

For more details please refer to https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160

Once ``Visual Studio Developer Command Prompt`` is setup, you can build ctags with ``NMake`` or ``MSBuild``.

Building ctags with NMake
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This requires Microsoft Visual Studio 2019 or later.

The simplest build instructions like below::

nmake -f mk_mvc.mak

If you want to build an iconv enabled version, you must specify ``WITH_ICONV=yes`` and ``ICONV_DIR`` like below::

Expand All @@ -60,29 +99,33 @@ If you want to create PDB files for debugging even for a release version, you mu

nmake -f mk_mvc.mak PDB=1

GCC
.............................................................................
Building ctags with MSBuild
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**General**
This supports only Microsoft Visual Studio 2013.

All the GCC's come with installers or with zipped archives. Install or extract them in a directory without spaces.
The simplest build instructions like below::

GNU Make builds for Win32 are available as well, and sometimes are included with the compilers. Make sure it is in your path, for instance by copying the make.exe in the bin directory of your compiler.
msbuild ctags_vs2013.sln

Native win32 versions of the GNU/Linux commands cp, rm and mv can be useful. rm is almost always used in by the ``clean`` target of a makefile.
If you want to build a release version, run command like below::

msbuild ctags_vs2013.sln /p:Configuration=Release

MSBuild is what the IDE uses internally and therefore will produce the same files as the IDE.

**CMD**
For more information about MSBuild, please refer to https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild?view=vs-2019

Any Windows includes a command prompt. Not the most advanced, but it is enough to do the build tasks. Make sure the path is set properly and ``make -f mk_mingw.mak`` should do the trick.
GCC
.............................................................................

If you want to build an iconv enabled version, you must specify ``WITH_ICONV=yes`` like below::
**General**

make -f mk_mingw.mak WITH_ICONV=yes
All the GCC's come with installers or with zipped archives. Install or extract them in a directory without spaces.

If you want to build a debug version, you must specify ``DEBUG=1`` like below::
GNU Make builds for Win32 are available as well, and sometimes are included with the compilers. Make sure it is in your path, for instance by copying the make.exe in the bin directory of your compiler.

make -f mk_mingw.mak DEBUG=1
Native win32 versions of the GNU/Linux commands cp, rm and mv can be useful. rm is almost always used in by the ``clean`` target of a makefile.

**MSYS2**

Expand Down Expand Up @@ -146,7 +189,7 @@ All major distributions have both MinGW and MinGW-w64 packages. Cross-compiling
Building ctags with IDEs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I have no idea how things work for most GNU/Linux developers, but most Windows developers are used to IDEs. Not many use a command prompt and running the debugger from the command line is not a thing a Windows developers would normally do. Many IDEs exist for Windows, I use the two below.
I have no idea how things work for the most GNU/Linux developers, but most of Windows developers prefer to use IDE over command prompt, running the debugger from the command line is not a thing a Windows developers would normally do. Many IDEs exist for Windows, I use the two below.

Microsoft Visual Studio
.............................................................................
Expand Down

0 comments on commit c10f7c7

Please sign in to comment.