[PATCH v5 0/8] CMake build system for git

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is an attempt to build Git using CMake. CMake is cross-platform build
generator which works well on a variety of platforms(primarily Linux and
Windows). Using CMake we can check whether certain headers exist, certain
functions exist, the required libraries are present and configure the build
accordingly. Using CMake we can also build and test Git out of source,
resulting in a clean source tree.

Tested platforms

Ubuntu 18.04 GCC 7.4 Clang 8.0.1

Windows MinGW GCC 9.2 Clang 9 Visual Studio 2015,2017,2019

Changes:

1) The CMake script has been relocated to contrib/buildsystems 2) The CMake
script parses the Makefile for the sources. LIB_OBJS BUILTIN_OBJS XDIFF_OBJS
VCSSVN_OBJS TEST_BUILTINS_OBJS SCRIPT_SH SCRIPT_PERL 3) Philip suggested to
change the error message if sh/bash was not found on windows. 4) CMake now
tests for ICONV_OMITS_BOM, NO_ST_BLOCKS_IN_STRUCT_STAT 5) Renamed the
variable test_helper_sources to test-tool_SOURCES [PATCH 4/8] to be
consistent with the naming of source variables.

Changes v2: Changes 1,2,4 have been rebased to PATCH 01/xx CMake uses
GIT-VERSION-GEN to get the version of Git Fixed a bug where a Windows user
can pose as Linux user and vice versa. [PATCH 6/8]

Changes v3: Patch changes are moved from the commit messages and are placed
here. Code inside check_c_source_(compiles/runs) have been formatted
according to git coding guidelines. [PATCH 1/8] The CMake script parses the
Makefile for SCRIPT_LIB also. [PATCH 2/8] The CMake script globs templates,
po files. Logic has been added to place the template files in their
respective directories instead of hard-coding them. [PATCH 2/8]

Changes v4: Removed EXE_EXTENSION conditional stuff using
CMAKE_EXECUTABLE_SUFFIX [PATCH 4/8] There was an issue in build pipelines
where CMake was not able to find the correct iconv library (caused by an
update that installed PostgreSQL), so we need to manually set the location
of the iconv library and its includes. This issue is extremely rare and is
specific to the implementation of FindIconv.cmake. Other libraries are
unaffected. [PATCH 8/8]

Sibi Siddharthan (8):
  Introduce CMake support for configuring Git
  cmake: generate the shell/perl/python scripts and templates,
    translations
  cmake: installation support for git
  cmake: support for testing git with ctest
  cmake: support for testing git when building out of the source tree
  cmake: support for building git on windows with mingw
  cmake: support for building git on windows with msvc and clang.
  ci: modification of main.yml to use cmake for vs-build job

 .github/workflows/main.yml          |   39 +-
 contrib/buildsystems/CMakeLists.txt | 1000 +++++++++++++++++++++++++++
 2 files changed, 1024 insertions(+), 15 deletions(-)
 create mode 100644 contrib/buildsystems/CMakeLists.txt


base-commit: e8ba1cc988e122f1a74cda161ba3ec1bf22fe88f
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-614%2FSibiSiddharthan%2Fgit-og-v5
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-614/SibiSiddharthan/git-og-v5
Pull-Request: https://github.com/gitgitgadget/git/pull/614

Range-diff vs v4:

 1:  c4e1ba7446 = 1:  07ae9f0a49 Introduce CMake support for configuring Git
 2:  abb9e6e1d5 ! 2:  74358b389d cmake: generate the shell/perl/python scripts and templates, translations
     @@ contrib/buildsystems/CMakeLists.txt: add_custom_command(OUTPUT ${git_links} ${gi
      +list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
      +list(REMOVE_ITEM templates ".gitignore")
      +list(REMOVE_ITEM templates "Makefile")
     ++list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
      +
      +list(REMOVE_ITEM templates "branches--")
      +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
 3:  4a0dd23cbb = 3:  a60e7472d3 cmake: installation support for git
 4:  db05180e98 = 4:  fedda55fc2 cmake: support for testing git with ctest
 5:  17e7f3e9de = 5:  398a578558 cmake: support for testing git when building out of the source tree
 6:  549f0cd5ff ! 6:  10acdbf5e4 cmake: support for building git on windows with mingw
     @@ contrib/buildsystems/CMakeLists.txt: add_compile_definitions(PAGER_ENV="LESS=FRX
      +	set(FALLBACK_RUNTIME_PREFIX /home/$ENV{USER})
      +	add_compile_definitions(FALLBACK_RUNTIME_PREFIX="${FALLBACK_RUNTIME_PREFIX}")
      +endif()
     - 
     --add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
     --list(APPEND compat_SOURCES unix-socket.c)
     ++
      +
      +#Platform Specific
      +if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
     @@ contrib/buildsystems/CMakeLists.txt: add_compile_definitions(PAGER_ENV="LESS=FRX
      +	add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
      +	list(APPEND compat_SOURCES unix-socket.c)
      +endif()
     -+
     -+if(WIN32)
     -+	set(EXE_EXTENSION .exe)
     -+else()
     -+	set(EXE_EXTENSION)
     -+endif()
     + 
     +-add_compile_definitions(PROCFS_EXECUTABLE_PATH="/proc/self/exe" HAVE_DEV_TTY )
     +-list(APPEND compat_SOURCES unix-socket.c)
     ++set(EXE_EXTENSION ${CMAKE_EXECUTABLE_SUFFIX})
       
       #header checks
       check_include_file(libgen.h HAVE_LIBGEN_H)
 7:  f85ea0ac0c = 7:  0b921545d2 cmake: support for building git on windows with msvc and clang.
 8:  2f7cf41e08 ! 8:  3cdefab43a ci: modification of main.yml to use cmake for vs-build job
     @@ .github/workflows/main.yml: jobs:
      +        if (!$?) { exit(1) }
      +    - name: generate Visual Studio solution
      +      shell: bash
     -+      run: cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows -DMSGFMT_EXE=`pwd`/git-sdk-64-minimal/mingw64/bin/msgfmt.exe -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
     ++      run: |
     ++        cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
     ++        -DIconv_LIBRARY=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows/lib/libiconv.lib -DIconv_INCLUDE_DIR=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows/include \
     ++        -DMSGFMT_EXE=`pwd`/git-sdk-64-minimal/mingw64/bin/msgfmt.exe -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
           - name: MSBuild
             run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
           - name: bundle artifact tar

-- 
gitgitgadget



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux