git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/3] Make CMake work out of the box
@ 2021-06-04 17:43 Matthew Rogers via GitGitGadget
  2021-06-04 17:43 ` [PATCH 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
                   ` (4 more replies)
  0 siblings, 5 replies; 31+ messages in thread
From: Matthew Rogers via GitGitGadget @ 2021-06-04 17:43 UTC (permalink / raw)
  To: git
  Cc: Philip Oakley, Sibi Siddharthan, Johannes Schindelin, Danh Doan,
	Matthew Rogers

This pull request comes from our discussion here[1], and I think these
patches provide a good compromise around the concerns discussed there

1:
https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/

CCing the people involved in the original discussion.

Matthew Rogers (3):
  cmake: add knob to disable vcpkg
  cmake: create compile_commands.json by default
  cmake: add warning for ignored MSGFMT_EXE

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


base-commit: c09b6306c6ca275ed9d0348a8c8014b2ff723cfb
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-970%2FROGERSM94%2Ffix-cmake-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-970/ROGERSM94/fix-cmake-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/970
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 1/3] cmake: add knob to disable vcpkg
  2021-06-04 17:43 [PATCH 0/3] Make CMake work out of the box Matthew Rogers via GitGitGadget
@ 2021-06-04 17:43 ` Matthew Rogers via GitGitGadget
  2021-06-04 18:03   ` Eric Sunshine
  2021-06-04 20:55   ` Sibi Siddharthan
  2021-06-04 17:43 ` [PATCH 2/3] cmake: create compile_commands.json by default Matthew Rogers via GitGitGadget
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 31+ messages in thread
From: Matthew Rogers via GitGitGadget @ 2021-06-04 17:43 UTC (permalink / raw)
  To: git
  Cc: Philip Oakley, Sibi Siddharthan, Johannes Schindelin, Danh Doan,
	Matthew Rogers, Matthew Rogers

From: Matthew Rogers <mattr94@gmail.com>

When building on windows users have the option to use vcpkg to provide
the dependencies needed to compile.  Previously, this was used only when
using the Visual Studio generator which was not ideal because:

  - Not all users who want to use vcpkg use the Visual Studio
    generators.

  - Some versions of Visual Studio 2019 moved away from using the
    VS 2019 by default, making it impossible for Visual Studio to
    configure the project in the likely event that it couldn't find the
    dependencies.

  - Inexperienced users of CMake are very likely to get tripped up by
    the errors caused by a lack of vcpkg, making the above bullet point
    both annoying and hard to debug.

As such, lets make using vcpkg the default on windows.  Users who want
to avoid using vcpkg can disable it by passing -DNO_VCPKG=TRUE.

Signed-off-by: Matthew Rogers <mattr94@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index a87841340e6a..41320150bf66 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -43,14 +43,24 @@ NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studi
 to use another tool say `ninja` add this to the command line when configuring.
 `-G Ninja`
 
+NOTE: By default CMake will install vcpkg locally to your source tree on configuration,
+to avoid this, add `-DNO_VCPKG=TRUE` to the command line when configuring.
+
 ]]
 cmake_minimum_required(VERSION 3.14)
 
 #set the source directory to root of git
 set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-if(WIN32)
+
+if (WIN32 AND NOT NO_VCPKG)
+	set(USING_VCPKG TRUE)
+else()
+	set(USING_VCPKG FALSE)
+endif()
+
+if(USING_VCPKG)
 	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
-	if(MSVC AND NOT EXISTS ${VCPKG_DIR})
+	if(NOT EXISTS ${VCPKG_DIR})
 		message("Initializing vcpkg and building the Git's dependencies (this will take a while...)")
 		execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat)
 	endif()
@@ -178,7 +188,9 @@ endif()
 
 find_program(MSGFMT_EXE msgfmt)
 if(NOT MSGFMT_EXE)
-	set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
+	if (USING_VCPKG)
+		set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
+	endif()
 	if(NOT EXISTS ${MSGFMT_EXE})
 		message(WARNING "Text Translations won't be built")
 		unset(MSGFMT_EXE)
@@ -982,7 +994,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n"
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
-if(WIN32)
+if(USING_VCPKG)
 	file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
 endif()
 
-- 
gitgitgadget


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 2/3] cmake: create compile_commands.json by default
  2021-06-04 17:43 [PATCH 0/3] Make CMake work out of the box Matthew Rogers via GitGitGadget
  2021-06-04 17:43 ` [PATCH 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
@ 2021-06-04 17:43 ` Matthew Rogers via GitGitGadget
  2021-06-04 18:05   ` Eric Sunshine
  2021-06-04 21:09   ` Sibi Siddharthan
  2021-06-04 17:43 ` [PATCH 3/3] cmake: add warning for ignored MSGFMT_EXE Matthew Rogers via GitGitGadget
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 31+ messages in thread
From: Matthew Rogers via GitGitGadget @ 2021-06-04 17:43 UTC (permalink / raw)
  To: git
  Cc: Philip Oakley, Sibi Siddharthan, Johannes Schindelin, Danh Doan,
	Matthew Rogers, Matthew Rogers

From: Matthew Rogers <mattr94@gmail.com>

Some users have expressed interest in a more "batteries included" way of
building via CMake[1], and a big part of that is providing easier access
to tooling external tools.

A straightforward way to accomplish this is to make it as simple as
possible is to enable the generation of the compile_commands.json file,
which is supported by many tools such as: clang-tidy, clang-format,
sourcetrail, etc.

This does come with a small run-time overhead during the configuration
step (~6 seconds on my machine):

    Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=TRUE

    real    1m9.840s
    user    0m0.031s
    sys     0m0.031s

    Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=FALSE

    real    1m3.195s
    user    0m0.015s
    sys     0m0.015s

This seems like a small enough price to pay to make the project more
accessible to newer users.  Additionally there are other large projects
like llvm [2] which has had this enabled by default for >6 years at the
time of this writing, and no real negative consequences that I can find
with my search-skills.

NOTE: That the comppile_commands.json is currenntly produced only when
using the Ninja and Makefile generators.  See The CMake documentation[3]
for more info.

1: https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
2: https://github.com/llvm/llvm-project/commit/2c5712051b31b316a9fc972f692579bd8efa6e67
3: https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html

Signed-off-by: Matthew Rogers <mattr94@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 41320150bf66..99150c8f5853 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -58,6 +58,10 @@ else()
 	set(USING_VCPKG FALSE)
 endif()
 
+if (NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
+	SET(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
+endif()
+
 if(USING_VCPKG)
 	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
 	if(NOT EXISTS ${VCPKG_DIR})
-- 
gitgitgadget


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 3/3] cmake: add warning for ignored MSGFMT_EXE
  2021-06-04 17:43 [PATCH 0/3] Make CMake work out of the box Matthew Rogers via GitGitGadget
  2021-06-04 17:43 ` [PATCH 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
  2021-06-04 17:43 ` [PATCH 2/3] cmake: create compile_commands.json by default Matthew Rogers via GitGitGadget
@ 2021-06-04 17:43 ` Matthew Rogers via GitGitGadget
  2021-06-04 18:10   ` Eric Sunshine
  2021-06-05  3:40 ` [PATCH 0/3] Make CMake work out of the box Bagas Sanjaya
  2021-06-06 12:02 ` [PATCH v2 " Matthew Rogers via GitGitGadget
  4 siblings, 1 reply; 31+ messages in thread
From: Matthew Rogers via GitGitGadget @ 2021-06-04 17:43 UTC (permalink / raw)
  To: git
  Cc: Philip Oakley, Sibi Siddharthan, Johannes Schindelin, Danh Doan,
	Matthew Rogers, Matthew Rogers

From: Matthew Rogers <mattr94@gmail.com>

It does not make sense to attempt to set MSGFMT_EXE when NO_GETTEXT is
configured, as such add a check for NO_GETTEXT before attempting to set
it.

suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Matthew Rogers <mattr94@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 99150c8f5853..ea43a4f9cc9f 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -190,14 +190,18 @@ if(WIN32 AND NOT MSVC)#not required for visual studio builds
 	endif()
 endif()
 
-find_program(MSGFMT_EXE msgfmt)
-if(NOT MSGFMT_EXE)
-	if (USING_VCPKG)
-		set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
-	endif()
-	if(NOT EXISTS ${MSGFMT_EXE})
-		message(WARNING "Text Translations won't be built")
-		unset(MSGFMT_EXE)
+if(NO_GETTEXT)
+	message(STATUS "msgfmt not used under NO_GETTEXT")
+else()
+	find_program(MSGFMT_EXE msgfmt)
+	if(NOT MSGFMT_EXE)
+		if (USING_VCPKG)
+			set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
+		endif()
+		if(NOT EXISTS ${MSGFMT_EXE})
+			message(WARNING "Text Translations won't be built")
+			unset(MSGFMT_EXE)
+		endif()
 	endif()
 endif()
 
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 1/3] cmake: add knob to disable vcpkg
  2021-06-04 17:43 ` [PATCH 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
@ 2021-06-04 18:03   ` Eric Sunshine
  2021-06-04 18:34     ` Matt Rogers
  2021-06-04 20:55   ` Sibi Siddharthan
  1 sibling, 1 reply; 31+ messages in thread
From: Eric Sunshine @ 2021-06-04 18:03 UTC (permalink / raw)
  To: Matthew Rogers via GitGitGadget
  Cc: Git List, Philip Oakley, Sibi Siddharthan, Johannes Schindelin,
	Danh Doan, Matthew Rogers

On Fri, Jun 4, 2021 at 1:44 PM Matthew Rogers via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> When building on windows users have the option to use vcpkg to provide
> the dependencies needed to compile.  Previously, this was used only when
> using the Visual Studio generator which was not ideal because:
>
>   - Not all users who want to use vcpkg use the Visual Studio
>     generators.
>
>   - Some versions of Visual Studio 2019 moved away from using the
>     VS 2019 by default, making it impossible for Visual Studio to
>     configure the project in the likely event that it couldn't find the
>     dependencies.

Is there something missing between "using the" and "VS 2019"? I'm
having a hard time trying to understand what this bullet point is
saying due to this apparent gap.

>   - Inexperienced users of CMake are very likely to get tripped up by
>     the errors caused by a lack of vcpkg, making the above bullet point
>     both annoying and hard to debug.
>
> As such, lets make using vcpkg the default on windows.  Users who want
> to avoid using vcpkg can disable it by passing -DNO_VCPKG=TRUE.

s/lets/let's/

> Signed-off-by: Matthew Rogers <mattr94@gmail.com>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 2/3] cmake: create compile_commands.json by default
  2021-06-04 17:43 ` [PATCH 2/3] cmake: create compile_commands.json by default Matthew Rogers via GitGitGadget
@ 2021-06-04 18:05   ` Eric Sunshine
  2021-06-04 21:09   ` Sibi Siddharthan
  1 sibling, 0 replies; 31+ messages in thread
From: Eric Sunshine @ 2021-06-04 18:05 UTC (permalink / raw)
  To: Matthew Rogers via GitGitGadget
  Cc: Git List, Philip Oakley, Sibi Siddharthan, Johannes Schindelin,
	Danh Doan, Matthew Rogers

On Fri, Jun 4, 2021 at 1:44 PM Matthew Rogers via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> Some users have expressed interest in a more "batteries included" way of
> building via CMake[1], and a big part of that is providing easier access
> to tooling external tools.
>
> A straightforward way to accomplish this is to make it as simple as
> possible is to enable the generation of the compile_commands.json file,
> which is supported by many tools such as: clang-tidy, clang-format,
> sourcetrail, etc.
>
> This does come with a small run-time overhead during the configuration
> step (~6 seconds on my machine):
>     [...]
> This seems like a small enough price to pay to make the project more
> accessible to newer users.  Additionally there are other large projects
> like llvm [2] which has had this enabled by default for >6 years at the
> time of this writing, and no real negative consequences that I can find
> with my search-skills.
>
> NOTE: That the comppile_commands.json is currenntly produced only when
> using the Ninja and Makefile generators.  See The CMake documentation[3]
> for more info.

s/comppile/compile/
s/currenntly/currently/

> Signed-off-by: Matthew Rogers <mattr94@gmail.com>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 3/3] cmake: add warning for ignored MSGFMT_EXE
  2021-06-04 17:43 ` [PATCH 3/3] cmake: add warning for ignored MSGFMT_EXE Matthew Rogers via GitGitGadget
@ 2021-06-04 18:10   ` Eric Sunshine
  0 siblings, 0 replies; 31+ messages in thread
From: Eric Sunshine @ 2021-06-04 18:10 UTC (permalink / raw)
  To: Matthew Rogers via GitGitGadget
  Cc: Git List, Philip Oakley, Sibi Siddharthan, Johannes Schindelin,
	Danh Doan, Matthew Rogers

On Fri, Jun 4, 2021 at 1:44 PM Matthew Rogers via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> It does not make sense to attempt to set MSGFMT_EXE when NO_GETTEXT is
> configured, as such add a check for NO_GETTEXT before attempting to set
> it.

This would be easier to digest if "as such" is the start of a new
sentence: "As such...". Or "Therefore, add a check...".

> suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Matthew Rogers <mattr94@gmail.com>

s/suggested-by/Suggested-by:/

Tiny little nits, both. Don't know if it's worth a re-roll, but if you
happen to re-roll for some other reason, perhaps these could be
tweaked.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 1/3] cmake: add knob to disable vcpkg
  2021-06-04 18:03   ` Eric Sunshine
@ 2021-06-04 18:34     ` Matt Rogers
  0 siblings, 0 replies; 31+ messages in thread
From: Matt Rogers @ 2021-06-04 18:34 UTC (permalink / raw)
  To: Eric Sunshine
  Cc: Matthew Rogers via GitGitGadget, Git List, Philip Oakley,
	Sibi Siddharthan, Johannes Schindelin, Danh Doan

On Fri, Jun 4, 2021 at 2:03 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
>
> On Fri, Jun 4, 2021 at 1:44 PM Matthew Rogers via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> > When building on windows users have the option to use vcpkg to provide
> > the dependencies needed to compile.  Previously, this was used only when
> > using the Visual Studio generator which was not ideal because:
> >
> >   - Not all users who want to use vcpkg use the Visual Studio
> >     generators.
> >
> >   - Some versions of Visual Studio 2019 moved away from using the
> >     VS 2019 by default, making it impossible for Visual Studio to
> >     configure the project in the likely event that it couldn't find the
> >     dependencies.
>
> Is there something missing between "using the" and "VS 2019"? I'm
> having a hard time trying to understand what this bullet point is
> saying due to this apparent gap.
>

Yeah, this should really read
- Some versions of Visual Studio 2019 moved away from using the
     VS 2019 _Generator_ by default, making it impossible for Visual Studio to
     configure the project in the likely event that it couldn't find the
     dependencies.


> >   - Inexperienced users of CMake are very likely to get tripped up by
> >     the errors caused by a lack of vcpkg, making the above bullet point
> >     both annoying and hard to debug.
> >
> > As such, lets make using vcpkg the default on windows.  Users who want
> > to avoid using vcpkg can disable it by passing -DNO_VCPKG=TRUE.
>
> s/lets/let's/
>
> > Signed-off-by: Matthew Rogers <mattr94@gmail.com>



-- 
Matthew Rogers

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 1/3] cmake: add knob to disable vcpkg
  2021-06-04 17:43 ` [PATCH 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
  2021-06-04 18:03   ` Eric Sunshine
@ 2021-06-04 20:55   ` Sibi Siddharthan
  2021-06-05 22:30     ` Matt Rogers
  1 sibling, 1 reply; 31+ messages in thread
From: Sibi Siddharthan @ 2021-06-04 20:55 UTC (permalink / raw)
  To: Matthew Rogers via GitGitGadget
  Cc: Git List, Philip Oakley, Johannes Schindelin, Danh Doan, Matthew Rogers

On Fri, Jun 4, 2021 at 11:13 PM Matthew Rogers via GitGitGadget
<gitgitgadget@gmail.com> wrote:

> -if(WIN32)
> +
> +if (WIN32 AND NOT NO_VCPKG)
> +       set(USING_VCPKG TRUE)
> +else()
> +       set(USING_VCPKG FALSE)
> +endif()

I think it would be better if we could have an option for this knob.
Maybe like this

option(NO_VCPKG "Don't use vcpkg for obtaining dependencies. Only
applicable to Windows platforms" OFF)

I would prefer to use `USE_VCPKG`.

Thank You,
Sibi Siddharthan

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 2/3] cmake: create compile_commands.json by default
  2021-06-04 17:43 ` [PATCH 2/3] cmake: create compile_commands.json by default Matthew Rogers via GitGitGadget
  2021-06-04 18:05   ` Eric Sunshine
@ 2021-06-04 21:09   ` Sibi Siddharthan
  2021-06-05 22:36     ` Matt Rogers
  1 sibling, 1 reply; 31+ messages in thread
From: Sibi Siddharthan @ 2021-06-04 21:09 UTC (permalink / raw)
  To: Matthew Rogers via GitGitGadget
  Cc: Git List, Philip Oakley, Johannes Schindelin, Danh Doan, Matthew Rogers

On Fri, Jun 4, 2021 at 11:13 PM Matthew Rogers via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> A straightforward way to accomplish this is to make it as simple as
> possible is to enable the generation of the compile_commands.json file,
> which is supported by many tools such as: clang-tidy, clang-format,
> sourcetrail, etc.
>
> This does come with a small run-time overhead during the configuration
> step (~6 seconds on my machine):
>
>     Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=TRUE
>
>     real    1m9.840s
>     user    0m0.031s
>     sys     0m0.031s
>
>     Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=FALSE
>
>     real    1m3.195s
>     user    0m0.015s
>     sys     0m0.015s
>
> This seems like a small enough price to pay to make the project more
> accessible to newer users.  Additionally there are other large projects
> like llvm [2] which has had this enabled by default for >6 years at the
> time of this writing, and no real negative consequences that I can find
> with my search-skills.
>

The overhead is actually much smaller than that. In my system it is
less than 150ms.
The first configure takes this long because we generate command-list.h
and config-list.h.
This process is really slow under Windows.

Thank You,
Sibi Siddharthan

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 0/3] Make CMake work out of the box
  2021-06-04 17:43 [PATCH 0/3] Make CMake work out of the box Matthew Rogers via GitGitGadget
                   ` (2 preceding siblings ...)
  2021-06-04 17:43 ` [PATCH 3/3] cmake: add warning for ignored MSGFMT_EXE Matthew Rogers via GitGitGadget
@ 2021-06-05  3:40 ` Bagas Sanjaya
  2021-06-05 23:22   ` Matt Rogers
  2021-06-10  9:43   ` Johannes Schindelin
  2021-06-06 12:02 ` [PATCH v2 " Matthew Rogers via GitGitGadget
  4 siblings, 2 replies; 31+ messages in thread
From: Bagas Sanjaya @ 2021-06-05  3:40 UTC (permalink / raw)
  To: Matthew Rogers via GitGitGadget, git
  Cc: Philip Oakley, Sibi Siddharthan, Johannes Schindelin, Danh Doan,
	Matthew Rogers

Hi,

On 05/06/21 00.43, Matthew Rogers via GitGitGadget wrote:
> This pull request comes from our discussion here[1], and I think these
> patches provide a good compromise around the concerns discussed there
> 
> 1:
> https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
> 
> CCing the people involved in the original discussion.

This focused on improving CMake support, especially on Visual Studio, right?

Then so we have three ways to build Git:
1. plain Makefile
2. ./configure (really just wrapper on top of Makefile)
3. generate build file with CMake

If we want to support all of them, it may makes sense to have CI jobs 
that perform build with each options above.

-- 
An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 1/3] cmake: add knob to disable vcpkg
  2021-06-04 20:55   ` Sibi Siddharthan
@ 2021-06-05 22:30     ` Matt Rogers
  2021-06-06  4:33       ` Sibi Siddharthan
  0 siblings, 1 reply; 31+ messages in thread
From: Matt Rogers @ 2021-06-05 22:30 UTC (permalink / raw)
  To: Sibi Siddharthan
  Cc: Matthew Rogers via GitGitGadget, Git List, Philip Oakley,
	Johannes Schindelin, Danh Doan

On Fri, Jun 4, 2021 at 4:55 PM Sibi Siddharthan
<sibisiddharthan.github@gmail.com> wrote:
>
> On Fri, Jun 4, 2021 at 11:13 PM Matthew Rogers via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>
> > -if(WIN32)
> > +
> > +if (WIN32 AND NOT NO_VCPKG)
> > +       set(USING_VCPKG TRUE)
> > +else()
> > +       set(USING_VCPKG FALSE)
> > +endif()
>
> I think it would be better if we could have an option for this knob.
> Maybe like this
>
> option(NO_VCPKG "Don't use vcpkg for obtaining dependencies. Only
> applicable to Windows platforms" OFF)

Option would definitely be the better tool to use here, I just didn't
think about
it when originally writing it, so I'll send a reroll with that and the spelling
corrections suggested by Eric Sunshine.  I assume you'd prefer something
with a final form more like:

option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.
Only applicable to Windows platforms" ON)


>
> I would prefer to use `USE_VCPKG`.
>
> Thank You,
> Sibi Siddharthan



-- 
Matthew Rogers

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 2/3] cmake: create compile_commands.json by default
  2021-06-04 21:09   ` Sibi Siddharthan
@ 2021-06-05 22:36     ` Matt Rogers
  2021-06-06  4:39       ` Sibi Siddharthan
  0 siblings, 1 reply; 31+ messages in thread
From: Matt Rogers @ 2021-06-05 22:36 UTC (permalink / raw)
  To: Sibi Siddharthan
  Cc: Matthew Rogers via GitGitGadget, Git List, Philip Oakley,
	Johannes Schindelin, Danh Doan

On Fri, Jun 4, 2021 at 5:09 PM Sibi Siddharthan
<sibisiddharthan.github@gmail.com> wrote:
>
> On Fri, Jun 4, 2021 at 11:13 PM Matthew Rogers via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> >
> > A straightforward way to accomplish this is to make it as simple as
> > possible is to enable the generation of the compile_commands.json file,
> > which is supported by many tools such as: clang-tidy, clang-format,
> > sourcetrail, etc.
> >
> > This does come with a small run-time overhead during the configuration
> > step (~6 seconds on my machine):
> >
> >     Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=TRUE
> >
> >     real    1m9.840s
> >     user    0m0.031s
> >     sys     0m0.031s
> >
> >     Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=FALSE
> >
> >     real    1m3.195s
> >     user    0m0.015s
> >     sys     0m0.015s
> >
> > This seems like a small enough price to pay to make the project more
> > accessible to newer users.  Additionally there are other large projects
> > like llvm [2] which has had this enabled by default for >6 years at the
> > time of this writing, and no real negative consequences that I can find
> > with my search-skills.
> >
>
> The overhead is actually much smaller than that. In my system it is
> less than 150ms.

Is that 150 ms for the whole process or just the difference between the two
options?  I'm running this on windows via the git bash provided by the
git sdk.

> The first configure takes this long because we generate command-list.h
> and config-list.h.
> This process is really slow under Windows.
>

I used two different build directories for both my invocations specifically
to avoid having to account for cache variables and other side effects
from earlier configurations.  The variation could also be from network
latency since in this test I was downloading vcpkg, etc.

> Thank You,
> Sibi Siddharthan



-- 
Matthew Rogers

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 0/3] Make CMake work out of the box
  2021-06-05  3:40 ` [PATCH 0/3] Make CMake work out of the box Bagas Sanjaya
@ 2021-06-05 23:22   ` Matt Rogers
  2021-06-10  9:43   ` Johannes Schindelin
  1 sibling, 0 replies; 31+ messages in thread
From: Matt Rogers @ 2021-06-05 23:22 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Matthew Rogers via GitGitGadget, Git Mailing List, Philip Oakley,
	Sibi Siddharthan, Johannes Schindelin, Danh Doan

On Fri, Jun 4, 2021 at 11:40 PM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
>
> Hi,
>
> On 05/06/21 00.43, Matthew Rogers via GitGitGadget wrote:
> > This pull request comes from our discussion here[1], and I think these
> > patches provide a good compromise around the concerns discussed there
> >
> > 1:
> > https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
> >
> > CCing the people involved in the original discussion.
>
> This focused on improving CMake support, especially on Visual Studio, right?
>
> Then so we have three ways to build Git:
> 1. plain Makefile
> 2. ./configure (really just wrapper on top of Makefile)
> 3. generate build file with CMake
>
> If we want to support all of them, it may makes sense to have CI jobs
> that perform build with each options above.
>
> --
> An old man doll... just what I always wanted! - Clara

Here's my understanding of the current pipeline situation:

I know the Visual Studio CMake generator is currently used to build on
Windows for gitgitgadget[1].

I'm not sure how worth it it would be to add another pipeline just to test if
we correctly set EXPORT_COMPILE_COMMANDS=TRUE on by default
correctly.

I think adding support for running cmake builds on linux is a bit of a waste
since those platforms should have ready access to make, and that's the build
method that gets the official support.

I don't really have much more of a position on this other than "Probably not
worth it to add a cmake build on linux"

1: https://github.com/gitgitgadget/git/runs/2748313673

--
Matthew Rogers

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 1/3] cmake: add knob to disable vcpkg
  2021-06-05 22:30     ` Matt Rogers
@ 2021-06-06  4:33       ` Sibi Siddharthan
  0 siblings, 0 replies; 31+ messages in thread
From: Sibi Siddharthan @ 2021-06-06  4:33 UTC (permalink / raw)
  To: Matt Rogers
  Cc: Matthew Rogers via GitGitGadget, Git List, Philip Oakley,
	Johannes Schindelin, Danh Doan

On Sun, Jun 6, 2021 at 4:01 AM Matt Rogers <mattr94@gmail.com> wrote:
>
> On Fri, Jun 4, 2021 at 4:55 PM Sibi Siddharthan
> <sibisiddharthan.github@gmail.com> wrote:
> >
> > On Fri, Jun 4, 2021 at 11:13 PM Matthew Rogers via GitGitGadget
> > <gitgitgadget@gmail.com> wrote:
> >
> > > -if(WIN32)
> > > +
> > > +if (WIN32 AND NOT NO_VCPKG)
> > > +       set(USING_VCPKG TRUE)
> > > +else()
> > > +       set(USING_VCPKG FALSE)
> > > +endif()
> >
> > I think it would be better if we could have an option for this knob.
> > Maybe like this
> >
> > option(NO_VCPKG "Don't use vcpkg for obtaining dependencies. Only
> > applicable to Windows platforms" OFF)
>
> Option would definitely be the better tool to use here, I just didn't
> think about
> it when originally writing it, so I'll send a reroll with that and the spelling
> corrections suggested by Eric Sunshine.  I assume you'd prefer something
> with a final form more like:
>
> option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.
> Only applicable to Windows platforms" ON)
>

Yes, this would be better.

Thank You,
Sibi Siddharthan

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 2/3] cmake: create compile_commands.json by default
  2021-06-05 22:36     ` Matt Rogers
@ 2021-06-06  4:39       ` Sibi Siddharthan
  0 siblings, 0 replies; 31+ messages in thread
From: Sibi Siddharthan @ 2021-06-06  4:39 UTC (permalink / raw)
  To: Matt Rogers
  Cc: Matthew Rogers via GitGitGadget, Git List, Philip Oakley,
	Johannes Schindelin, Danh Doan

On Sun, Jun 6, 2021 at 4:06 AM Matt Rogers <mattr94@gmail.com> wrote:
>
> On Fri, Jun 4, 2021 at 5:09 PM Sibi Siddharthan
> <sibisiddharthan.github@gmail.com> wrote:
> >
> > On Fri, Jun 4, 2021 at 11:13 PM Matthew Rogers via GitGitGadget
> > <gitgitgadget@gmail.com> wrote:
> > >
> > > A straightforward way to accomplish this is to make it as simple as
> > > possible is to enable the generation of the compile_commands.json file,
> > > which is supported by many tools such as: clang-tidy, clang-format,
> > > sourcetrail, etc.
> > >
> > > This does come with a small run-time overhead during the configuration
> > > step (~6 seconds on my machine):
> > >
> > >     Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=TRUE
> > >
> > >     real    1m9.840s
> > >     user    0m0.031s
> > >     sys     0m0.031s
> > >
> > >     Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=FALSE
> > >
> > >     real    1m3.195s
> > >     user    0m0.015s
> > >     sys     0m0.015s
> > >
> > > This seems like a small enough price to pay to make the project more
> > > accessible to newer users.  Additionally there are other large projects
> > > like llvm [2] which has had this enabled by default for >6 years at the
> > > time of this writing, and no real negative consequences that I can find
> > > with my search-skills.
> > >
> >
> > The overhead is actually much smaller than that. In my system it is
> > less than 150ms.
>
> Is that 150 ms for the whole process or just the difference between the two
> options?  I'm running this on windows via the git bash provided by the
> git sdk.

The difference between the two. Without exporting compile_commands.json
it takes around 650ms, with it around 750ms.
NOTE: This is for subsequent CMake runs. (Excludes the initial run)

Thank You,
Sibi Siddharthan

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH v2 0/3] Make CMake work out of the box
  2021-06-04 17:43 [PATCH 0/3] Make CMake work out of the box Matthew Rogers via GitGitGadget
                   ` (3 preceding siblings ...)
  2021-06-05  3:40 ` [PATCH 0/3] Make CMake work out of the box Bagas Sanjaya
@ 2021-06-06 12:02 ` Matthew Rogers via GitGitGadget
  2021-06-06 12:02   ` [PATCH v2 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
                     ` (4 more replies)
  4 siblings, 5 replies; 31+ messages in thread
From: Matthew Rogers via GitGitGadget @ 2021-06-06 12:02 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers

This pull request comes from our discussion here[1], and I think these
patches provide a good compromise around the concerns discussed there

1:
https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/

CCing the people involved in the original discussion. cc: Philip Oakley
philipoakley@iee.email cc: Sibi Siddharthan
sibisiddharthan.github@gmail.com, cc: Johannes Schindelin
johannes.schindelin@gmx.de, cc: Danh Doan congdanhqx@gmail.com

Matthew Rogers (3):
  cmake: add knob to disable vcpkg
  cmake: create compile_commands.json by default
  cmake: add warning for ignored MSGFMT_EXE

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


base-commit: c09b6306c6ca275ed9d0348a8c8014b2ff723cfb
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-970%2FROGERSM94%2Ffix-cmake-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-970/ROGERSM94/fix-cmake-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/970

Range-diff vs v1:

 1:  3170f78daa5f ! 1:  485254b49de8 cmake: add knob to disable vcpkg
     @@ Commit message
              generators.
      
            - Some versions of Visual Studio 2019 moved away from using the
     -        VS 2019 by default, making it impossible for Visual Studio to
     -        configure the project in the likely event that it couldn't find the
     -        dependencies.
     +        VS 2019  generator by default, making it impossible for Visual
     +        Studio to configure the project in the likely event that it couldn't
     +        find the dependencies.
      
            - Inexperienced users of CMake are very likely to get tripped up by
              the errors caused by a lack of vcpkg, making the above bullet point
              both annoying and hard to debug.
      
     -    As such, lets make using vcpkg the default on windows.  Users who want
     +    As such, let's make using vcpkg the default on windows.  Users who want
          to avoid using vcpkg can disable it by passing -DNO_VCPKG=TRUE.
      
          Signed-off-by: Matthew Rogers <mattr94@gmail.com>
     @@ contrib/buildsystems/CMakeLists.txt: NOTE: By default CMake uses Makefile as the
       set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
      -if(WIN32)
      +
     -+if (WIN32 AND NOT NO_VCPKG)
     -+	set(USING_VCPKG TRUE)
     -+else()
     -+	set(USING_VCPKG FALSE)
     ++option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
     ++if(NOT WIN32)
     ++	set(USE_VCPKG OFF CACHE BOOL FORCE)
      +endif()
      +
     -+if(USING_VCPKG)
     ++if(USE_VCPKG)
       	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
      -	if(MSVC AND NOT EXISTS ${VCPKG_DIR})
      +	if(NOT EXISTS ${VCPKG_DIR})
     @@ contrib/buildsystems/CMakeLists.txt: endif()
       find_program(MSGFMT_EXE msgfmt)
       if(NOT MSGFMT_EXE)
      -	set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
     -+	if (USING_VCPKG)
     ++	if (USE_VCPKG)
      +		set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
      +	endif()
       	if(NOT EXISTS ${MSGFMT_EXE})
     @@ contrib/buildsystems/CMakeLists.txt: file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-O
       file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
       file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
      -if(WIN32)
     -+if(USING_VCPKG)
     ++if(USE_VCPKG)
       	file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
       endif()
       
 2:  c3bf266cf03a ! 2:  a3b5eef54188 cmake: create compile_commands.json by default
     @@ Commit message
          time of this writing, and no real negative consequences that I can find
          with my search-skills.
      
     -    NOTE: That the comppile_commands.json is currenntly produced only when
     +    NOTE: That the compile_commands.json is currently produced only when
          using the Ninja and Makefile generators.  See The CMake documentation[3]
          for more info.
      
     @@ Commit message
          Signed-off-by: Matthew Rogers <mattr94@gmail.com>
      
       ## contrib/buildsystems/CMakeLists.txt ##
     -@@ contrib/buildsystems/CMakeLists.txt: else()
     - 	set(USING_VCPKG FALSE)
     +@@ contrib/buildsystems/CMakeLists.txt: if(NOT WIN32)
     + 	set(USE_VCPKG OFF CACHE BOOL FORCE)
       endif()
       
     -+if (NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
     -+	SET(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
     ++if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
     ++	set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
      +endif()
      +
     - if(USING_VCPKG)
     + if(USE_VCPKG)
       	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
       	if(NOT EXISTS ${VCPKG_DIR})
 3:  07763a9de723 ! 3:  2110c8ffa423 cmake: add warning for ignored MSGFMT_EXE
     @@ Commit message
          configured, as such add a check for NO_GETTEXT before attempting to set
          it.
      
     -    suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
     +    Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
          Signed-off-by: Matthew Rogers <mattr94@gmail.com>
      
       ## contrib/buildsystems/CMakeLists.txt ##
     @@ contrib/buildsystems/CMakeLists.txt: if(WIN32 AND NOT MSVC)#not required for vis
       
      -find_program(MSGFMT_EXE msgfmt)
      -if(NOT MSGFMT_EXE)
     --	if (USING_VCPKG)
     +-	if (USE_VCPKG)
      -		set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
      -	endif()
      -	if(NOT EXISTS ${MSGFMT_EXE})
     @@ contrib/buildsystems/CMakeLists.txt: if(WIN32 AND NOT MSVC)#not required for vis
      +else()
      +	find_program(MSGFMT_EXE msgfmt)
      +	if(NOT MSGFMT_EXE)
     -+		if (USING_VCPKG)
     ++		if(USE_VCPKG)
      +			set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
      +		endif()
      +		if(NOT EXISTS ${MSGFMT_EXE})

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH v2 1/3] cmake: add knob to disable vcpkg
  2021-06-06 12:02 ` [PATCH v2 " Matthew Rogers via GitGitGadget
@ 2021-06-06 12:02   ` Matthew Rogers via GitGitGadget
  2021-06-06 12:02   ` [PATCH v2 2/3] cmake: create compile_commands.json by default Matthew Rogers via GitGitGadget
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 31+ messages in thread
From: Matthew Rogers via GitGitGadget @ 2021-06-06 12:02 UTC (permalink / raw)
  To: git
  Cc: Eric Sunshine, Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers,
	Matthew Rogers

From: Matthew Rogers <mattr94@gmail.com>

When building on windows users have the option to use vcpkg to provide
the dependencies needed to compile.  Previously, this was used only when
using the Visual Studio generator which was not ideal because:

  - Not all users who want to use vcpkg use the Visual Studio
    generators.

  - Some versions of Visual Studio 2019 moved away from using the
    VS 2019  generator by default, making it impossible for Visual
    Studio to configure the project in the likely event that it couldn't
    find the dependencies.

  - Inexperienced users of CMake are very likely to get tripped up by
    the errors caused by a lack of vcpkg, making the above bullet point
    both annoying and hard to debug.

As such, let's make using vcpkg the default on windows.  Users who want
to avoid using vcpkg can disable it by passing -DNO_VCPKG=TRUE.

Signed-off-by: Matthew Rogers <mattr94@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index a87841340e6a..be6d9659c387 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -43,14 +43,23 @@ NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studi
 to use another tool say `ninja` add this to the command line when configuring.
 `-G Ninja`
 
+NOTE: By default CMake will install vcpkg locally to your source tree on configuration,
+to avoid this, add `-DNO_VCPKG=TRUE` to the command line when configuring.
+
 ]]
 cmake_minimum_required(VERSION 3.14)
 
 #set the source directory to root of git
 set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-if(WIN32)
+
+option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
+if(NOT WIN32)
+	set(USE_VCPKG OFF CACHE BOOL FORCE)
+endif()
+
+if(USE_VCPKG)
 	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
-	if(MSVC AND NOT EXISTS ${VCPKG_DIR})
+	if(NOT EXISTS ${VCPKG_DIR})
 		message("Initializing vcpkg and building the Git's dependencies (this will take a while...)")
 		execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat)
 	endif()
@@ -178,7 +187,9 @@ endif()
 
 find_program(MSGFMT_EXE msgfmt)
 if(NOT MSGFMT_EXE)
-	set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
+	if (USE_VCPKG)
+		set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
+	endif()
 	if(NOT EXISTS ${MSGFMT_EXE})
 		message(WARNING "Text Translations won't be built")
 		unset(MSGFMT_EXE)
@@ -982,7 +993,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n"
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
-if(WIN32)
+if(USE_VCPKG)
 	file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
 endif()
 
-- 
gitgitgadget


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH v2 2/3] cmake: create compile_commands.json by default
  2021-06-06 12:02 ` [PATCH v2 " Matthew Rogers via GitGitGadget
  2021-06-06 12:02   ` [PATCH v2 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
@ 2021-06-06 12:02   ` Matthew Rogers via GitGitGadget
  2021-06-06 12:02   ` [PATCH v2 3/3] cmake: add warning for ignored MSGFMT_EXE Matthew Rogers via GitGitGadget
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 31+ messages in thread
From: Matthew Rogers via GitGitGadget @ 2021-06-06 12:02 UTC (permalink / raw)
  To: git
  Cc: Eric Sunshine, Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers,
	Matthew Rogers

From: Matthew Rogers <mattr94@gmail.com>

Some users have expressed interest in a more "batteries included" way of
building via CMake[1], and a big part of that is providing easier access
to tooling external tools.

A straightforward way to accomplish this is to make it as simple as
possible is to enable the generation of the compile_commands.json file,
which is supported by many tools such as: clang-tidy, clang-format,
sourcetrail, etc.

This does come with a small run-time overhead during the configuration
step (~6 seconds on my machine):

    Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=TRUE

    real    1m9.840s
    user    0m0.031s
    sys     0m0.031s

    Time to configure with CMAKE_EXPORT_COMPILE_COMMANDS=FALSE

    real    1m3.195s
    user    0m0.015s
    sys     0m0.015s

This seems like a small enough price to pay to make the project more
accessible to newer users.  Additionally there are other large projects
like llvm [2] which has had this enabled by default for >6 years at the
time of this writing, and no real negative consequences that I can find
with my search-skills.

NOTE: That the compile_commands.json is currently produced only when
using the Ninja and Makefile generators.  See The CMake documentation[3]
for more info.

1: https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
2: https://github.com/llvm/llvm-project/commit/2c5712051b31b316a9fc972f692579bd8efa6e67
3: https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html

Signed-off-by: Matthew Rogers <mattr94@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index be6d9659c387..399a3cd6c071 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -57,6 +57,10 @@ if(NOT WIN32)
 	set(USE_VCPKG OFF CACHE BOOL FORCE)
 endif()
 
+if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
+	set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
+endif()
+
 if(USE_VCPKG)
 	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
 	if(NOT EXISTS ${VCPKG_DIR})
-- 
gitgitgadget


^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH v2 3/3] cmake: add warning for ignored MSGFMT_EXE
  2021-06-06 12:02 ` [PATCH v2 " Matthew Rogers via GitGitGadget
  2021-06-06 12:02   ` [PATCH v2 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
  2021-06-06 12:02   ` [PATCH v2 2/3] cmake: create compile_commands.json by default Matthew Rogers via GitGitGadget
@ 2021-06-06 12:02   ` Matthew Rogers via GitGitGadget
  2021-06-07  0:54   ` [PATCH v2 0/3] Make CMake work out of the box Junio C Hamano
  2021-06-10  9:47   ` Johannes Schindelin
  4 siblings, 0 replies; 31+ messages in thread
From: Matthew Rogers via GitGitGadget @ 2021-06-06 12:02 UTC (permalink / raw)
  To: git
  Cc: Eric Sunshine, Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers,
	Matthew Rogers

From: Matthew Rogers <mattr94@gmail.com>

It does not make sense to attempt to set MSGFMT_EXE when NO_GETTEXT is
configured, as such add a check for NO_GETTEXT before attempting to set
it.

Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Matthew Rogers <mattr94@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 399a3cd6c071..3dc7ffcd98bb 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -189,14 +189,18 @@ if(WIN32 AND NOT MSVC)#not required for visual studio builds
 	endif()
 endif()
 
-find_program(MSGFMT_EXE msgfmt)
-if(NOT MSGFMT_EXE)
-	if (USE_VCPKG)
-		set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
-	endif()
-	if(NOT EXISTS ${MSGFMT_EXE})
-		message(WARNING "Text Translations won't be built")
-		unset(MSGFMT_EXE)
+if(NO_GETTEXT)
+	message(STATUS "msgfmt not used under NO_GETTEXT")
+else()
+	find_program(MSGFMT_EXE msgfmt)
+	if(NOT MSGFMT_EXE)
+		if(USE_VCPKG)
+			set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
+		endif()
+		if(NOT EXISTS ${MSGFMT_EXE})
+			message(WARNING "Text Translations won't be built")
+			unset(MSGFMT_EXE)
+		endif()
 	endif()
 endif()
 
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2 0/3] Make CMake work out of the box
  2021-06-06 12:02 ` [PATCH v2 " Matthew Rogers via GitGitGadget
                     ` (2 preceding siblings ...)
  2021-06-06 12:02   ` [PATCH v2 3/3] cmake: add warning for ignored MSGFMT_EXE Matthew Rogers via GitGitGadget
@ 2021-06-07  0:54   ` Junio C Hamano
  2021-06-10  9:45     ` Johannes Schindelin
  2021-06-18 13:09     ` Philip Oakley
  2021-06-10  9:47   ` Johannes Schindelin
  4 siblings, 2 replies; 31+ messages in thread
From: Junio C Hamano @ 2021-06-07  0:54 UTC (permalink / raw)
  To: Matthew Rogers via GitGitGadget
  Cc: git, Eric Sunshine, Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers

"Matthew Rogers via GitGitGadget" <gitgitgadget@gmail.com> writes:

> This pull request comes from our discussion here[1], and I think these
> patches provide a good compromise around the concerns discussed there
>
> 1:
> https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
>
> CCing the people involved in the original discussion. cc: Philip Oakley
> philipoakley@iee.email cc: Sibi Siddharthan
> sibisiddharthan.github@gmail.com, cc: Johannes Schindelin
> johannes.schindelin@gmx.de, cc: Danh Doan congdanhqx@gmail.com
>
> Matthew Rogers (3):
>   cmake: add knob to disable vcpkg
>   cmake: create compile_commands.json by default
>   cmake: add warning for ignored MSGFMT_EXE

I am neither cmake nor windows person, so I'll queue this as-is and
wait for the stakeholders to chime in.

I did wonder if we want this to be applicable to the maintenance
track for 2.31, though.  There is a textual conflict with the
addition of SIMPLE_IPC that happened during 2.32 cycle, which is
easily resolvable.

I am tempted to queue a version of these three patches rebased on to
'maint' after making sure that the result of merging that into
'master' is byte-for-byte identical to applying these three patches
directly on to 'master'.

The range-diff looks like the attached.  Thanks.

1:  546c49cc88 ! 1:  585b7ca371 cmake: add knob to disable vcpkg
    @@ contrib/buildsystems/CMakeLists.txt: endif()
      	if(NOT EXISTS ${MSGFMT_EXE})
      		message(WARNING "Text Translations won't be built")
      		unset(MSGFMT_EXE)
    -@@ contrib/buildsystems/CMakeLists.txt: file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
    - file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
    +@@ contrib/buildsystems/CMakeLists.txt: file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n"
      file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
      file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
    + file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
     -if(WIN32)
     +if(USE_VCPKG)
      	file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
2:  efa8681a22 = 2:  1cba2f9bd1 cmake: create compile_commands.json by default
3:  ceeca2bc0d = 3:  7824e74976 cmake: add warning for ignored MSGFMT_EXE

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 0/3] Make CMake work out of the box
  2021-06-05  3:40 ` [PATCH 0/3] Make CMake work out of the box Bagas Sanjaya
  2021-06-05 23:22   ` Matt Rogers
@ 2021-06-10  9:43   ` Johannes Schindelin
  2021-06-18 13:05     ` Philip Oakley
  1 sibling, 1 reply; 31+ messages in thread
From: Johannes Schindelin @ 2021-06-10  9:43 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Matthew Rogers via GitGitGadget, git, Philip Oakley,
	Sibi Siddharthan, Danh Doan, Matthew Rogers

Hi,

On Sat, 5 Jun 2021, Bagas Sanjaya wrote:

> On 05/06/21 00.43, Matthew Rogers via GitGitGadget wrote:
> > This pull request comes from our discussion here[1], and I think these
> > patches provide a good compromise around the concerns discussed there
> >
> > 1:
> > https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
> >
> > CCing the people involved in the original discussion.
>
> This focused on improving CMake support, especially on Visual Studio, right?
>
> Then so we have three ways to build Git:
> 1. plain Makefile
> 2. ./configure (really just wrapper on top of Makefile)
> 3. generate build file with CMake
>
> If we want to support all of them, it may makes sense to have CI jobs that
> perform build with each options above.

We already exercise the plain Makefile plenty, and the CMake-based build
using Windows (in the `vs-build` job in `.github/workflows/main.yml`).

I do not see that it is worth spending many electrons exercising the
`./configure` way, seeing as the preferred way to build Git is by using
the `Makefile` directly.

And our CMake configuration only really works on Windows, the attempts to
get it to work on Linux were met with less enthusiasm, seeing as the
`Makefile` approach is the recommended (and supported) one.

tl;dr I don't think we need to augment our CI jobs as suggested.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2 0/3] Make CMake work out of the box
  2021-06-07  0:54   ` [PATCH v2 0/3] Make CMake work out of the box Junio C Hamano
@ 2021-06-10  9:45     ` Johannes Schindelin
  2021-06-18 13:11       ` Philip Oakley
  2021-06-18 13:09     ` Philip Oakley
  1 sibling, 1 reply; 31+ messages in thread
From: Johannes Schindelin @ 2021-06-10  9:45 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Matthew Rogers via GitGitGadget, git, Eric Sunshine,
	Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers

Hi Junio,

On Mon, 7 Jun 2021, Junio C Hamano wrote:

> "Matthew Rogers via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > This pull request comes from our discussion here[1], and I think these
> > patches provide a good compromise around the concerns discussed there
> >
> > 1:
> > https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
> >
> > CCing the people involved in the original discussion. cc: Philip Oakley
> > philipoakley@iee.email cc: Sibi Siddharthan
> > sibisiddharthan.github@gmail.com, cc: Johannes Schindelin
> > johannes.schindelin@gmx.de, cc: Danh Doan congdanhqx@gmail.com
> >
> > Matthew Rogers (3):
> >   cmake: add knob to disable vcpkg
> >   cmake: create compile_commands.json by default
> >   cmake: add warning for ignored MSGFMT_EXE
>
> I am neither cmake nor windows person, so I'll queue this as-is and
> wait for the stakeholders to chime in.

As long as the CI builds pass, I am in favor of integrating the patch
series.

> I did wonder if we want this to be applicable to the maintenance
> track for 2.31, though.  There is a textual conflict with the
> addition of SIMPLE_IPC that happened during 2.32 cycle, which is
> easily resolvable.

If it isn't much work, sure. But I would think that developers who want to
build using Visual Studio really should stay on newer branches.

Thanks,
Dscho

> I am tempted to queue a version of these three patches rebased on to
> 'maint' after making sure that the result of merging that into
> 'master' is byte-for-byte identical to applying these three patches
> directly on to 'master'.
>
> The range-diff looks like the attached.  Thanks.
>
> 1:  546c49cc88 ! 1:  585b7ca371 cmake: add knob to disable vcpkg
>     @@ contrib/buildsystems/CMakeLists.txt: endif()
>       	if(NOT EXISTS ${MSGFMT_EXE})
>       		message(WARNING "Text Translations won't be built")
>       		unset(MSGFMT_EXE)
>     -@@ contrib/buildsystems/CMakeLists.txt: file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
>     - file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
>     +@@ contrib/buildsystems/CMakeLists.txt: file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n"
>       file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
>       file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
>     + file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
>      -if(WIN32)
>      +if(USE_VCPKG)
>       	file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
> 2:  efa8681a22 = 2:  1cba2f9bd1 cmake: create compile_commands.json by default
> 3:  ceeca2bc0d = 3:  7824e74976 cmake: add warning for ignored MSGFMT_EXE
>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2 0/3] Make CMake work out of the box
  2021-06-06 12:02 ` [PATCH v2 " Matthew Rogers via GitGitGadget
                     ` (3 preceding siblings ...)
  2021-06-07  0:54   ` [PATCH v2 0/3] Make CMake work out of the box Junio C Hamano
@ 2021-06-10  9:47   ` Johannes Schindelin
  2021-06-11  6:22     ` Junio C Hamano
  4 siblings, 1 reply; 31+ messages in thread
From: Johannes Schindelin @ 2021-06-10  9:47 UTC (permalink / raw)
  To: Matthew Rogers via GitGitGadget
  Cc: git, Eric Sunshine, Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers

Hi Matt,

On Sun, 6 Jun 2021, Matthew Rogers via GitGitGadget wrote:

> This pull request comes from our discussion here[1], and I think these
> patches provide a good compromise around the concerns discussed there
>
> 1:
> https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
>
> CCing the people involved in the original discussion. cc: Philip Oakley
> philipoakley@iee.email cc: Sibi Siddharthan
> sibisiddharthan.github@gmail.com, cc: Johannes Schindelin
> johannes.schindelin@gmx.de, cc: Danh Doan congdanhqx@gmail.com

Just in case that a v3 is needed, I fixed the PR description so that these
"Cc:"s are interpreted correctly again by GitGitGadget.

But from a brief glance over v2, all patches look good to me.

Thanks,
Dscho

>
> Matthew Rogers (3):
>   cmake: add knob to disable vcpkg
>   cmake: create compile_commands.json by default
>   cmake: add warning for ignored MSGFMT_EXE
>
>  contrib/buildsystems/CMakeLists.txt | 37 ++++++++++++++++++++++-------
>  1 file changed, 28 insertions(+), 9 deletions(-)
>
>
> base-commit: c09b6306c6ca275ed9d0348a8c8014b2ff723cfb
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-970%2FROGERSM94%2Ffix-cmake-v2
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-970/ROGERSM94/fix-cmake-v2
> Pull-Request: https://github.com/gitgitgadget/git/pull/970
>
> Range-diff vs v1:
>
>  1:  3170f78daa5f ! 1:  485254b49de8 cmake: add knob to disable vcpkg
>      @@ Commit message
>               generators.
>
>             - Some versions of Visual Studio 2019 moved away from using the
>      -        VS 2019 by default, making it impossible for Visual Studio to
>      -        configure the project in the likely event that it couldn't find the
>      -        dependencies.
>      +        VS 2019  generator by default, making it impossible for Visual
>      +        Studio to configure the project in the likely event that it couldn't
>      +        find the dependencies.
>
>             - Inexperienced users of CMake are very likely to get tripped up by
>               the errors caused by a lack of vcpkg, making the above bullet point
>               both annoying and hard to debug.
>
>      -    As such, lets make using vcpkg the default on windows.  Users who want
>      +    As such, let's make using vcpkg the default on windows.  Users who want
>           to avoid using vcpkg can disable it by passing -DNO_VCPKG=TRUE.
>
>           Signed-off-by: Matthew Rogers <mattr94@gmail.com>
>      @@ contrib/buildsystems/CMakeLists.txt: NOTE: By default CMake uses Makefile as the
>        set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
>       -if(WIN32)
>       +
>      -+if (WIN32 AND NOT NO_VCPKG)
>      -+	set(USING_VCPKG TRUE)
>      -+else()
>      -+	set(USING_VCPKG FALSE)
>      ++option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies.  Only applicable to Windows platforms" ON)
>      ++if(NOT WIN32)
>      ++	set(USE_VCPKG OFF CACHE BOOL FORCE)
>       +endif()
>       +
>      -+if(USING_VCPKG)
>      ++if(USE_VCPKG)
>        	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
>       -	if(MSVC AND NOT EXISTS ${VCPKG_DIR})
>       +	if(NOT EXISTS ${VCPKG_DIR})
>      @@ contrib/buildsystems/CMakeLists.txt: endif()
>        find_program(MSGFMT_EXE msgfmt)
>        if(NOT MSGFMT_EXE)
>       -	set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
>      -+	if (USING_VCPKG)
>      ++	if (USE_VCPKG)
>       +		set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
>       +	endif()
>        	if(NOT EXISTS ${MSGFMT_EXE})
>      @@ contrib/buildsystems/CMakeLists.txt: file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-O
>        file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
>        file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
>       -if(WIN32)
>      -+if(USING_VCPKG)
>      ++if(USE_VCPKG)
>        	file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
>        endif()
>
>  2:  c3bf266cf03a ! 2:  a3b5eef54188 cmake: create compile_commands.json by default
>      @@ Commit message
>           time of this writing, and no real negative consequences that I can find
>           with my search-skills.
>
>      -    NOTE: That the comppile_commands.json is currenntly produced only when
>      +    NOTE: That the compile_commands.json is currently produced only when
>           using the Ninja and Makefile generators.  See The CMake documentation[3]
>           for more info.
>
>      @@ Commit message
>           Signed-off-by: Matthew Rogers <mattr94@gmail.com>
>
>        ## contrib/buildsystems/CMakeLists.txt ##
>      -@@ contrib/buildsystems/CMakeLists.txt: else()
>      - 	set(USING_VCPKG FALSE)
>      +@@ contrib/buildsystems/CMakeLists.txt: if(NOT WIN32)
>      + 	set(USE_VCPKG OFF CACHE BOOL FORCE)
>        endif()
>
>      -+if (NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
>      -+	SET(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
>      ++if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
>      ++	set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
>       +endif()
>       +
>      - if(USING_VCPKG)
>      + if(USE_VCPKG)
>        	set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
>        	if(NOT EXISTS ${VCPKG_DIR})
>  3:  07763a9de723 ! 3:  2110c8ffa423 cmake: add warning for ignored MSGFMT_EXE
>      @@ Commit message
>           configured, as such add a check for NO_GETTEXT before attempting to set
>           it.
>
>      -    suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>      +    Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>           Signed-off-by: Matthew Rogers <mattr94@gmail.com>
>
>        ## contrib/buildsystems/CMakeLists.txt ##
>      @@ contrib/buildsystems/CMakeLists.txt: if(WIN32 AND NOT MSVC)#not required for vis
>
>       -find_program(MSGFMT_EXE msgfmt)
>       -if(NOT MSGFMT_EXE)
>      --	if (USING_VCPKG)
>      +-	if (USE_VCPKG)
>       -		set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
>       -	endif()
>       -	if(NOT EXISTS ${MSGFMT_EXE})
>      @@ contrib/buildsystems/CMakeLists.txt: if(WIN32 AND NOT MSVC)#not required for vis
>       +else()
>       +	find_program(MSGFMT_EXE msgfmt)
>       +	if(NOT MSGFMT_EXE)
>      -+		if (USING_VCPKG)
>      ++		if(USE_VCPKG)
>       +			set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
>       +		endif()
>       +		if(NOT EXISTS ${MSGFMT_EXE})
>
> --
> gitgitgadget
>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2 0/3] Make CMake work out of the box
  2021-06-10  9:47   ` Johannes Schindelin
@ 2021-06-11  6:22     ` Junio C Hamano
  0 siblings, 0 replies; 31+ messages in thread
From: Junio C Hamano @ 2021-06-11  6:22 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Matthew Rogers via GitGitGadget, git, Eric Sunshine,
	Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Just in case that a v3 is needed, I fixed the PR description so that these
> "Cc:"s are interpreted correctly again by GitGitGadget.
>
> But from a brief glance over v2, all patches look good to me.

Let me amend v2 with your Acked-by and merge it down to 'next',
then.

Thanks.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 0/3] Make CMake work out of the box
  2021-06-10  9:43   ` Johannes Schindelin
@ 2021-06-18 13:05     ` Philip Oakley
  2021-06-18 13:42       ` Johannes Schindelin
  0 siblings, 1 reply; 31+ messages in thread
From: Philip Oakley @ 2021-06-18 13:05 UTC (permalink / raw)
  To: Johannes Schindelin, Bagas Sanjaya
  Cc: Matthew Rogers via GitGitGadget, git, Sibi Siddharthan,
	Danh Doan, Matthew Rogers

On 10/06/2021 10:43, Johannes Schindelin wrote:
> Hi,
>
> On Sat, 5 Jun 2021, Bagas Sanjaya wrote:
>
>> On 05/06/21 00.43, Matthew Rogers via GitGitGadget wrote:
>>> This pull request comes from our discussion here[1], and I think these
>>> patches provide a good compromise around the concerns discussed there
>>>
>>> 1:
>>> https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
>>>
>>> CCing the people involved in the original discussion.
Matt,
Thanks for picking this up and the approach to working around the
updated build approach of recent Visual Studio versions.
 
It looks good to me, but the CI should also be tweaked (see below) so
that it is tested.
>> This focused on improving CMake support, especially on Visual Studio, right?
>>
>> Then so we have three ways to build Git:
>> 1. plain Makefile
>> 2. ./configure (really just wrapper on top of Makefile)
>> 3. generate build file with CMake
>>
>> If we want to support all of them, it may makes sense to have CI jobs that
>> perform build with each options above.
> We already exercise the plain Makefile plenty, and the CMake-based build
> using Windows (in the `vs-build` job in `.github/workflows/main.yml`).

There is one 'gotcha' in the yml (probably historical) in that it
doesn't actually test the approach/changes that Matt addresses regarding
my [1].

That is, I'm looking at the 'out of the box' view, while the yml test
_preloads_ the vcpkg artefacts.

There is also the (on Windows) issue that the ARM support has recently
been developed which also fudges the CmakeLists.txt file but forgot
about the assumption in the vcpkg install batch file that the default is
the x86 setup.
>
> I do not see that it is worth spending many electrons exercising the
> `./configure` way, seeing as the preferred way to build Git is by using
> the `Makefile` directly.
>
> And our CMake configuration only really works on Windows, the attempts to
> get it to work on Linux were met with less enthusiasm, seeing as the
> `Makefile` approach is the recommended (and supported) one.
>
> tl;dr I don't think we need to augment our CI jobs as suggested.
I'd agree that there's no need to augment the CI job to expressly check
the other flags, but the existing test should reflect the intent of the
patches (i.e. no preloading of the vcpkg artefacts).

I haven't had much time to catch up on Git, and I'm off-line again from
Sat night for another week.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2 0/3] Make CMake work out of the box
  2021-06-07  0:54   ` [PATCH v2 0/3] Make CMake work out of the box Junio C Hamano
  2021-06-10  9:45     ` Johannes Schindelin
@ 2021-06-18 13:09     ` Philip Oakley
  1 sibling, 0 replies; 31+ messages in thread
From: Philip Oakley @ 2021-06-18 13:09 UTC (permalink / raw)
  To: Junio C Hamano, Matthew Rogers via GitGitGadget
  Cc: git, Eric Sunshine, Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers

On 07/06/2021 01:54, Junio C Hamano wrote:
> "Matthew Rogers via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> This pull request comes from our discussion here[1], and I think these
>> patches provide a good compromise around the concerns discussed there
>>
>> 1:
>> https://lore.kernel.org/git/CAOjrSZusMSvs7AS-ZDsV8aQUgsF2ZA754vSDjgFKMRgi_oZAWw@mail.gmail.com/
>>
>> CCing the people involved in the original discussion. cc: Philip Oakley
>> philipoakley@iee.email cc: Sibi Siddharthan
>> sibisiddharthan.github@gmail.com, cc: Johannes Schindelin
>> johannes.schindelin@gmx.de, cc: Danh Doan congdanhqx@gmail.com
>>
>> Matthew Rogers (3):
>>   cmake: add knob to disable vcpkg
>>   cmake: create compile_commands.json by default
>>   cmake: add warning for ignored MSGFMT_EXE
> I am neither cmake nor windows person, so I'll queue this as-is and
> wait for the stakeholders to chime in.
>
> I did wonder if we want this to be applicable to the maintenance
> track for 2.31, though.  There is a textual conflict with the
> addition of SIMPLE_IPC that happened during 2.32 cycle, which is
> easily resolvable.
>
> I am tempted to queue a version of these three patches rebased on to
> 'maint' after making sure that the result of merging that into
> 'master' is byte-for-byte identical to applying these three patches
> directly on to 'master'.

Sorry for the delay - I've been off-line and I'm only now catching up.

Could we confirm that the CI actually tests the update. IIRC the yml
setup preloaded the vcpkg artefacts that this change looks to make work
'out of the box'.

Philip

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH v2 0/3] Make CMake work out of the box
  2021-06-10  9:45     ` Johannes Schindelin
@ 2021-06-18 13:11       ` Philip Oakley
  0 siblings, 0 replies; 31+ messages in thread
From: Philip Oakley @ 2021-06-18 13:11 UTC (permalink / raw)
  To: Johannes Schindelin, Junio C Hamano
  Cc: Matthew Rogers via GitGitGadget, git, Eric Sunshine,
	Sibi Siddharthan, Bagas Sanjaya, Matthew Rogers

On 10/06/2021 10:45, Johannes Schindelin wrote:
> As long as the CI builds pass, I am in favor of integrating the patch
> series.
>
>> I did wonder if we want this to be applicable to the maintenance
>> track for 2.31, though.  There is a textual conflict with the
>> addition of SIMPLE_IPC that happened during 2.32 cycle, which is
>> easily resolvable.
> If it isn't much work, sure. But I would think that developers who want to
> build using Visual Studio really should stay on newer branches.

Ack. Philip

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 0/3] Make CMake work out of the box
  2021-06-18 13:05     ` Philip Oakley
@ 2021-06-18 13:42       ` Johannes Schindelin
  2021-06-18 14:03         ` Philip Oakley
  0 siblings, 1 reply; 31+ messages in thread
From: Johannes Schindelin @ 2021-06-18 13:42 UTC (permalink / raw)
  To: Philip Oakley
  Cc: Bagas Sanjaya, Matthew Rogers via GitGitGadget, git,
	Sibi Siddharthan, Danh Doan, Matthew Rogers

Hi Philip,

On Fri, 18 Jun 2021, Philip Oakley wrote:

> On 10/06/2021 10:43, Johannes Schindelin wrote:
> >
> > On Sat, 5 Jun 2021, Bagas Sanjaya wrote:
> >
> >> This focused on improving CMake support, especially on Visual Studio, right?
> >>
> >> Then so we have three ways to build Git:
> >> 1. plain Makefile
> >> 2. ./configure (really just wrapper on top of Makefile)
> >> 3. generate build file with CMake
> >>
> >> If we want to support all of them, it may makes sense to have CI jobs that
> >> perform build with each options above.
> >
> > We already exercise the plain Makefile plenty, and the CMake-based build
> > using Windows (in the `vs-build` job in `.github/workflows/main.yml`).
>
> There is one 'gotcha' in the yml (probably historical) in that it
> doesn't actually test the approach/changes that Matt addresses regarding
> my [1].
>
> That is, I'm looking at the 'out of the box' view, while the yml test
> _preloads_ the vcpkg artefacts.

We need to "pre-load" them because building them would add another
whopping 20 minutes to each CI run. And I am not talking total time, but
wall-clock time.

And we're not in the business of testing vcpkg's build.

So I am really not in favor of even thinking about changing this
"pre-loading" strategy.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 0/3] Make CMake work out of the box
  2021-06-18 13:42       ` Johannes Schindelin
@ 2021-06-18 14:03         ` Philip Oakley
  2021-06-22 22:32           ` Johannes Schindelin
  0 siblings, 1 reply; 31+ messages in thread
From: Philip Oakley @ 2021-06-18 14:03 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Bagas Sanjaya, Matthew Rogers via GitGitGadget, git,
	Sibi Siddharthan, Danh Doan, Matthew Rogers

Hi Dscho

On 18/06/2021 14:42, Johannes Schindelin wrote:
>>> We already exercise the plain Makefile plenty, and the CMake-based build
>>> using Windows (in the `vs-build` job in `.github/workflows/main.yml`).
>> There is one 'gotcha' in the yml (probably historical) in that it
>> doesn't actually test the approach/changes that Matt addresses regarding
>> my [1].
>>
>> That is, I'm looking at the 'out of the box' view, while the yml test
>> _preloads_ the vcpkg artefacts.
> We need to "pre-load" them because building them would add another
> whopping 20 minutes to each CI run. And I am not talking total time, but
> wall-clock time.
>
> And we're not in the business of testing vcpkg's build.
>
> So I am really not in favor of even thinking about changing this
> "pre-loading" strategy.
>
>
I can see the common sense in that, however I was trying to highlight
that the approach in patch series could go stale, as did the previous
method. Making the entry ramp to investigating the code for the wide
variety windows users should have _some_ testing..

I don't have any good ideas about how to get out of that 20 minute
Catch-22 issue at the moment. Maybe it needs an independent, on-demand
(i.e. infrequent;-) test.

Maybe there is a way of adding a `--CI-test` option that at least
exercises the logic without needing the vcpkg to be built again (IIRC,
and I may well be wrong, we build once, remember the artefacts, and then
re-used them, but .. dunno).

Philip

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 0/3] Make CMake work out of the box
  2021-06-18 14:03         ` Philip Oakley
@ 2021-06-22 22:32           ` Johannes Schindelin
  0 siblings, 0 replies; 31+ messages in thread
From: Johannes Schindelin @ 2021-06-22 22:32 UTC (permalink / raw)
  To: Philip Oakley
  Cc: Bagas Sanjaya, Matthew Rogers via GitGitGadget, git,
	Sibi Siddharthan, Danh Doan, Matthew Rogers

Hi Philip,

On Fri, 18 Jun 2021, Philip Oakley wrote:

> On 18/06/2021 14:42, Johannes Schindelin wrote:
> >>> We already exercise the plain Makefile plenty, and the CMake-based build
> >>> using Windows (in the `vs-build` job in `.github/workflows/main.yml`).
> >> There is one 'gotcha' in the yml (probably historical) in that it
> >> doesn't actually test the approach/changes that Matt addresses regarding
> >> my [1].
> >>
> >> That is, I'm looking at the 'out of the box' view, while the yml test
> >> _preloads_ the vcpkg artefacts.
> > We need to "pre-load" them because building them would add another
> > whopping 20 minutes to each CI run. And I am not talking total time, but
> > wall-clock time.
> >
> > And we're not in the business of testing vcpkg's build.
> >
> > So I am really not in favor of even thinking about changing this
> > "pre-loading" strategy.
> >
> >
> I can see the common sense in that, however I was trying to highlight
> that the approach in patch series could go stale, as did the previous
> method. Making the entry ramp to investigating the code for the wide
> variety windows users should have _some_ testing..
>
> I don't have any good ideas about how to get out of that 20 minute
> Catch-22 issue at the moment. Maybe it needs an independent, on-demand
> (i.e. infrequent;-) test.
>
> Maybe there is a way of adding a `--CI-test` option that at least
> exercises the logic without needing the vcpkg to be built again (IIRC,
> and I may well be wrong, we build once, remember the artefacts, and then
> re-used them, but .. dunno).

I would strongly discourage tacking this onto the current CI. It is way
too rare a use case to merit adding the cost for all developers using the
CI runs to verify their work.

All is not lost, though: interested parties (such as yourself!) can easily
add their own GitHub workflows in their own repositories and verify that
things work.

You could even put the workflow on a timer, and add a matrix job that
builds `maint`, `master`, `next` and `seen`, to verify that things work.

And for extra brownie points, you can monitor the runs and work on fixes
whenever you see breakages. That would definitely take a good chunk of the
maintenance burden off of the Git maintainers.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2021-06-22 22:32 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 17:43 [PATCH 0/3] Make CMake work out of the box Matthew Rogers via GitGitGadget
2021-06-04 17:43 ` [PATCH 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
2021-06-04 18:03   ` Eric Sunshine
2021-06-04 18:34     ` Matt Rogers
2021-06-04 20:55   ` Sibi Siddharthan
2021-06-05 22:30     ` Matt Rogers
2021-06-06  4:33       ` Sibi Siddharthan
2021-06-04 17:43 ` [PATCH 2/3] cmake: create compile_commands.json by default Matthew Rogers via GitGitGadget
2021-06-04 18:05   ` Eric Sunshine
2021-06-04 21:09   ` Sibi Siddharthan
2021-06-05 22:36     ` Matt Rogers
2021-06-06  4:39       ` Sibi Siddharthan
2021-06-04 17:43 ` [PATCH 3/3] cmake: add warning for ignored MSGFMT_EXE Matthew Rogers via GitGitGadget
2021-06-04 18:10   ` Eric Sunshine
2021-06-05  3:40 ` [PATCH 0/3] Make CMake work out of the box Bagas Sanjaya
2021-06-05 23:22   ` Matt Rogers
2021-06-10  9:43   ` Johannes Schindelin
2021-06-18 13:05     ` Philip Oakley
2021-06-18 13:42       ` Johannes Schindelin
2021-06-18 14:03         ` Philip Oakley
2021-06-22 22:32           ` Johannes Schindelin
2021-06-06 12:02 ` [PATCH v2 " Matthew Rogers via GitGitGadget
2021-06-06 12:02   ` [PATCH v2 1/3] cmake: add knob to disable vcpkg Matthew Rogers via GitGitGadget
2021-06-06 12:02   ` [PATCH v2 2/3] cmake: create compile_commands.json by default Matthew Rogers via GitGitGadget
2021-06-06 12:02   ` [PATCH v2 3/3] cmake: add warning for ignored MSGFMT_EXE Matthew Rogers via GitGitGadget
2021-06-07  0:54   ` [PATCH v2 0/3] Make CMake work out of the box Junio C Hamano
2021-06-10  9:45     ` Johannes Schindelin
2021-06-18 13:11       ` Philip Oakley
2021-06-18 13:09     ` Philip Oakley
2021-06-10  9:47   ` Johannes Schindelin
2021-06-11  6:22     ` Junio C Hamano

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git