Skip to content

Commit

Permalink
Pass 'make' between vcpkg scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Aug 4, 2021
1 parent bd5ea16 commit 257e8bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
19 changes: 7 additions & 12 deletions scripts/cmake/vcpkg_build_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,16 @@ function(vcpkg_build_make)
string(REPLACE " " "\ " _VCPKG_INSTALLED "${CURRENT_INSTALLED_DIR}")
endif()

set(MAKE )
set(MAKE_OPTS )
set(INSTALL_OPTS )
if (CMAKE_HOST_WIN32)
set(PATH_GLOBAL "$ENV{PATH}")
vcpkg_add_to_path(PREPEND "${SCRIPTS}/buildsystems/make_wrapper")
vcpkg_acquire_msys(MSYS_ROOT)
find_program(MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED)
set(MAKE_COMMAND "${MAKE}")
if(NOT DEFINED Z_VCPKG_MAKE)
vcpkg_acquire_msys(MSYS_ROOT)
find_program(Z_VCPKG_MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED)
endif()
set(MAKE_COMMAND "${Z_VCPKG_MAKE}")
set(MAKE_OPTS ${_bc_MAKE_OPTIONS} -j ${VCPKG_CONCURRENCY} --trace -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET})
set(NO_PARALLEL_MAKE_OPTS ${_bc_MAKE_OPTIONS} -j 1 --trace -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET})

Expand All @@ -98,14 +99,8 @@ function(vcpkg_build_make)
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} --trace -f ${_bc_MAKEFILE} ${_bc_INSTALL_TARGET} DESTDIR=${_VCPKG_PACKAGE_PREFIX})
#TODO: optimize for install-data (release) and install-exec (release/debug)
else()
# Compiler requriements
if(VCPKG_HOST_IS_OPENBSD)
find_program(MAKE gmake REQUIRED)
else()
find_program(MAKE make REQUIRED)
endif()
set(MAKE_COMMAND "${MAKE}")
# Set make command and install command
find_program(Z_VCPKG_MAKE gmake make REQUIRED)
set(MAKE_COMMAND "${Z_VCPKG_MAKE}")
set(MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j ${VCPKG_CONCURRENCY} -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET})
set(NO_PARALLEL_MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j 1 -f ${_bc_MAKEFILE} ${_bc_BUILD_TARGET})
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} -f ${_bc_MAKEFILE} ${_bc_INSTALL_TARGET} DESTDIR=${CURRENT_PACKAGES_DIR})
Expand Down
7 changes: 7 additions & 0 deletions scripts/cmake/vcpkg_configure_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,13 @@ function(vcpkg_configure_make)
endforeach()
endforeach()

# Export matching make program for vcpkg_build_make (cache variable)
if(MSYS_ROOT)
find_program(Z_VCPKG_MAKE make PATHS "${MSYS_ROOT}/usr/bin" NO_DEFAULT_PATH REQUIRED)
else()
find_program(Z_VCPKG_MAKE gmake make REQUIRED)
endif()

# Restore environment
_vcpkg_restore_env_variables(${_cm_FLAGS} LIB LIBPATH LIBRARY_PATH LD_LIBRARY_PATH)

Expand Down

0 comments on commit 257e8bf

Please sign in to comment.