diff mbox series

[09/10] cmake (Windows): recommend using Visual Studio's built-in CMake support

Message ID f07e4216669bcda728668d8c5cc99081bfca9f49.1601044119.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series CMake and Visual Studio | expand

Commit Message

Linus Arver via GitGitGadget Sept. 25, 2020, 2:28 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

It is a lot more convenient to use than having to specify the
configuration in CMake manually (does not matter whether using the
command-line or CMake's GUI).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 contrib/buildsystems/CMakeLists.txt | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Junio C Hamano Sept. 25, 2020, 6:22 p.m. UTC | #1
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> It is a lot more convenient to use than having to specify the
> configuration in CMake manually (does not matter whether using the
> command-line or CMake's GUI).
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  contrib/buildsystems/CMakeLists.txt | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
> index 1eaeb8b8e0..442b4e69ad 100644
> --- a/contrib/buildsystems/CMakeLists.txt
> +++ b/contrib/buildsystems/CMakeLists.txt
> @@ -4,7 +4,17 @@
>  
>  #[[
>  
> -Instructions to run CMake:
> +Instructions how to use this in Visual Studio:
> +
> +Open the worktree as a folder. Visual Studio 2019 and later will detect
> +the CMake configuration automatically and set everything up for you,
> +ready to build. You can then run the tests in `t/` via a regular Git Bash.
> +
> +Note: Visual Studio also has the option of opening the CMake configuration
> +directly; Using this option, Visual Studio will not find the source code,
> +though, therefore the `File>Open>Folder...` option is preferred.
> +
> +Instructions to run CMake manually:
>  
>  cmake `relative-path-to-CMakeLists.txt` -DCMAKE_BUILD_TYPE=Release
>  Eg.

Having the primary case upfront is a good idea.  As we discussed,
our source tree structure (especially the .gitignore we ship) only
supports an separate-dir build in contrib/buildsystems/out, so we
should update the "manually" part of the instruction to guide users
to use the same location.  Perhaps something along the line of the
attached.

Also, after the post-context of the attached patch, there are
mentions of Visual Studio.  Please double check if they need
adjustment, or more preferrably the above paragraph the patch in
question added is all that is needed by Visual Studio users, in
which case perhaps it would be a good idea to remove all mention of
Visual Studio there to avoid sending confusing choices to the
readers.

Thanks.

 contrib/buildsystems/CMakeLists.txt | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 442b4e69ad..0c748949f9 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -16,15 +16,13 @@ though, therefore the `File>Open>Folder...` option is preferred.
 
 Instructions to run CMake manually:
 
-cmake `relative-path-to-CMakeLists.txt` -DCMAKE_BUILD_TYPE=Release
-Eg.
-From the root of git source tree
-	`cmake contrib/buildsystems/ `
-This will build the git binaries at the root
-
-For out of source builds, say build in 'git/git-build/'
-	`mkdir git-build;cd git-build; cmake ../contrib/buildsystems/`
-This will build the git binaries in git-build directory
+    mkdir -p contrib/buildsystems/out
+    cd contrib/buildsystems/out
+    cmake ../ -DCMAKE_BUILD_TYPE=Release
+
+This will build the git binaries in contrib/buildsystems/out
+directory (our top-level .gitignore file knows to ignore contents of
+this directory).
 
 Possible build configurations(-DCMAKE_BUILD_TYPE) with corresponding
 compiler flags
Johannes Schindelin Sept. 26, 2020, 8:45 p.m. UTC | #2
Hi Junio,

On Fri, 25 Sep 2020, Junio C Hamano wrote:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >
> > It is a lot more convenient to use than having to specify the
> > configuration in CMake manually (does not matter whether using the
> > command-line or CMake's GUI).
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> >  contrib/buildsystems/CMakeLists.txt | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
> > index 1eaeb8b8e0..442b4e69ad 100644
> > --- a/contrib/buildsystems/CMakeLists.txt
> > +++ b/contrib/buildsystems/CMakeLists.txt
> > @@ -4,7 +4,17 @@
> >
> >  #[[
> >
> > -Instructions to run CMake:
> > +Instructions how to use this in Visual Studio:
> > +
> > +Open the worktree as a folder. Visual Studio 2019 and later will detect
> > +the CMake configuration automatically and set everything up for you,
> > +ready to build. You can then run the tests in `t/` via a regular Git Bash.
> > +
> > +Note: Visual Studio also has the option of opening the CMake configuration
> > +directly; Using this option, Visual Studio will not find the source code,
> > +though, therefore the `File>Open>Folder...` option is preferred.
> > +
> > +Instructions to run CMake manually:
> >
> >  cmake `relative-path-to-CMakeLists.txt` -DCMAKE_BUILD_TYPE=Release
> >  Eg.
>
> Having the primary case upfront is a good idea.  As we discussed,
> our source tree structure (especially the .gitignore we ship) only
> supports an separate-dir build in contrib/buildsystems/out, so we
> should update the "manually" part of the instruction to guide users
> to use the same location.  Perhaps something along the line of the
> attached.

I squashed your changes into the patch.

> Also, after the post-context of the attached patch, there are
> mentions of Visual Studio.  Please double check if they need
> adjustment, or more preferrably the above paragraph the patch in
> question added is all that is needed by Visual Studio users, in
> which case perhaps it would be a good idea to remove all mention of
> Visual Studio there to avoid sending confusing choices to the
> readers.

The parts that still mention Visual Studio are in the part that talks
about running CMake manually, in which case they strike me as helpful,
still.

Thank you,
Dscho

>
> Thanks.
>
>  contrib/buildsystems/CMakeLists.txt | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
> index 442b4e69ad..0c748949f9 100644
> --- a/contrib/buildsystems/CMakeLists.txt
> +++ b/contrib/buildsystems/CMakeLists.txt
> @@ -16,15 +16,13 @@ though, therefore the `File>Open>Folder...` option is preferred.
>
>  Instructions to run CMake manually:
>
> -cmake `relative-path-to-CMakeLists.txt` -DCMAKE_BUILD_TYPE=Release
> -Eg.
> -From the root of git source tree
> -	`cmake contrib/buildsystems/ `
> -This will build the git binaries at the root
> -
> -For out of source builds, say build in 'git/git-build/'
> -	`mkdir git-build;cd git-build; cmake ../contrib/buildsystems/`
> -This will build the git binaries in git-build directory
> +    mkdir -p contrib/buildsystems/out
> +    cd contrib/buildsystems/out
> +    cmake ../ -DCMAKE_BUILD_TYPE=Release
> +
> +This will build the git binaries in contrib/buildsystems/out
> +directory (our top-level .gitignore file knows to ignore contents of
> +this directory).
>
>  Possible build configurations(-DCMAKE_BUILD_TYPE) with corresponding
>  compiler flags
>
>
diff mbox series

Patch

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 1eaeb8b8e0..442b4e69ad 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -4,7 +4,17 @@ 
 
 #[[
 
-Instructions to run CMake:
+Instructions how to use this in Visual Studio:
+
+Open the worktree as a folder. Visual Studio 2019 and later will detect
+the CMake configuration automatically and set everything up for you,
+ready to build. You can then run the tests in `t/` via a regular Git Bash.
+
+Note: Visual Studio also has the option of opening the CMake configuration
+directly; Using this option, Visual Studio will not find the source code,
+though, therefore the `File>Open>Folder...` option is preferred.
+
+Instructions to run CMake manually:
 
 cmake `relative-path-to-CMakeLists.txt` -DCMAKE_BUILD_TYPE=Release
 Eg.