Skip to content

Commit d65092b

Browse files
committed
Merge branch 'js/cmake-vsbuild' into jch
CMake update for vsbuild. * js/cmake-vsbuild: cmake(install): include vcpkg dlls cmake: add a preparatory work-around to accommodate `vcpkg` cmake(install): fix double .exe suffixes cmake: support SKIP_DASHED_BUILT_INS
2 parents b2524a7 + 958a5f5 commit d65092b

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ jobs:
186186
## Unzip and remove the artifact
187187
unzip artifacts.zip
188188
rm artifacts.zip
189+
- name: initialize vcpkg
190+
uses: actions/checkout@v2
191+
with:
192+
repository: 'microsoft/vcpkg'
193+
path: 'compat/vcbuild/vcpkg'
189194
- name: download vcpkg artifacts
190195
shell: powershell
191196
run: |

contrib/buildsystems/CMakeLists.txt

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ if(WIN32)
5858

5959
# In the vcpkg edition, we need this to be able to link to libcurl
6060
set(CURL_NO_CURL_CMAKE ON)
61+
62+
# Copy the necessary vcpkg DLLs (like iconv) to the install dir
63+
set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON)
64+
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
6165
endif()
6266

6367
find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin")
@@ -691,13 +695,17 @@ endif()
691695

692696
parse_makefile_for_executables(git_builtin_extra "BUILT_INS")
693697

698+
option(SKIP_DASHED_BUILT_INS "Skip hardlinking the dashed versions of the built-ins")
699+
694700
#Creating hardlinks
701+
if(NOT SKIP_DASHED_BUILT_INS)
695702
foreach(s ${git_SOURCES} ${git_builtin_extra})
696703
string(REPLACE "${CMAKE_SOURCE_DIR}/builtin/" "" s ${s})
697704
string(REPLACE ".c" "" s ${s})
698705
file(APPEND ${CMAKE_BINARY_DIR}/CreateLinks.cmake "file(CREATE_LINK git${EXE_EXTENSION} git-${s}${EXE_EXTENSION})\n")
699706
list(APPEND git_links ${CMAKE_BINARY_DIR}/git-${s}${EXE_EXTENSION})
700707
endforeach()
708+
endif()
701709

702710
if(CURL_FOUND)
703711
set(remote_exes
@@ -813,15 +821,19 @@ list(TRANSFORM git_shell_scripts PREPEND "${CMAKE_BINARY_DIR}/")
813821
list(TRANSFORM git_perl_scripts PREPEND "${CMAKE_BINARY_DIR}/")
814822

815823
#install
816-
install(TARGETS git git-shell
824+
foreach(program ${PROGRAMS_BUILT})
825+
if(program STREQUAL "git" OR program STREQUAL "git-shell")
826+
install(TARGETS ${program}
817827
RUNTIME DESTINATION bin)
828+
else()
829+
install(TARGETS ${program}
830+
RUNTIME DESTINATION libexec/git-core)
831+
endif()
832+
endforeach()
833+
818834
install(PROGRAMS ${CMAKE_BINARY_DIR}/git-cvsserver
819835
DESTINATION bin)
820836

821-
list(REMOVE_ITEM PROGRAMS_BUILT git git-shell)
822-
install(TARGETS ${PROGRAMS_BUILT}
823-
RUNTIME DESTINATION libexec/git-core)
824-
825837
set(bin_links
826838
git-receive-pack git-upload-archive git-upload-pack)
827839

@@ -834,12 +846,12 @@ install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git-shell${EXE_EXTENS
834846

835847
foreach(b ${git_links})
836848
string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
837-
install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
849+
install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/bin/git${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
838850
endforeach()
839851

840852
foreach(b ${git_http_links})
841853
string(REPLACE "${CMAKE_BINARY_DIR}" "" b ${b})
842-
install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b}${EXE_EXTENSION})")
854+
install(CODE "file(CREATE_LINK ${CMAKE_INSTALL_PREFIX}/libexec/git-core/git-remote-http${EXE_EXTENSION} ${CMAKE_INSTALL_PREFIX}/libexec/git-core/${b})")
843855
endforeach()
844856

845857
install(PROGRAMS ${git_shell_scripts} ${git_perl_scripts} ${CMAKE_BINARY_DIR}/git-p4

0 commit comments

Comments
 (0)