Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg-make] Misc fixes, in particular: parallel builds #43249

Merged
merged 11 commits into from
Jan 16, 2025
2 changes: 1 addition & 1 deletion ports/vcpkg-make/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vcpkg-make",
"version-date": "2024-12-27",
"version-date": "2025-01-13",
"documentation": "https://learn.microsoft.com/vcpkg/maintainers/functions/vcpkg_make_configure",
"license": null,
"supports": "native",
Expand Down
7 changes: 5 additions & 2 deletions ports/vcpkg-make/vcpkg_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function(vcpkg_run_shell_as_build)
"SHELL;COMMAND;NO_PARALLEL_COMMAND;SAVE_LOG_FILES"
)
z_vcpkg_unparsed_args(FATAL_ERROR)
z_vcpkg_required_args(SHELL WORKINK_DIRECTORY COMMAND LOGNAME)
z_vcpkg_required_args(SHELL WORKING_DIRECTORY COMMAND LOGNAME)

set(extra_opts "")
if(arg_SAVE_LOG_FILES)
Expand All @@ -62,9 +62,12 @@ function(vcpkg_run_shell_as_build)

list(JOIN arg_COMMAND " " cmd)
list(JOIN arg_NO_PARALLEL_COMMAND " " no_par_cmd)
if(NOT no_par_cmd STREQUAL "")
set(no_par_cmd NO_PARALLEL_COMMAND ${arg_SHELL} -c "${no_par_cmd}")
endif()
vcpkg_execute_build_process(
COMMAND ${arg_SHELL} -c "${cmd}"
NO_PARALLEL_COMMAND ${arg_SHELL} -c "${no_par_cmd}"
${no_par_cmd}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Restarting without parallelism" shouldn't be displayed if the build was initiated without parallelism.
This is achieved by not passing the NO_PARALLEL_COMMAND option when arg_NO_PARALLEL_COMMAND is empty.

WORKING_DIRECTORY "${arg_WORKING_DIRECTORY}"
LOGNAME "${arg_LOGNAME}"
${extra_opts}
Expand Down
3 changes: 1 addition & 2 deletions ports/vcpkg-make/vcpkg_make_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ macro(z_vcpkg_make_set_common_vars)
endforeach()
set(buildtypes release)
if(NOT VCPKG_BUILD_TYPE)
list(APPEND buildtypes debug)
list(PREPEND buildtypes debug)
endif()
endmacro()

Expand Down Expand Up @@ -557,7 +557,6 @@ function(z_vcpkg_make_prepare_flags)
${flags_opts}
)
if(NOT DEFINED VCPKG_BUILD_TYPE)
list(APPEND all_buildtypes DEBUG)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused in port vcpkg_make.

z_vcpkg_make_prepare_compile_flags(
CONFIG DEBUG
COMPILER_FRONTEND "${VCPKG_DETECTED_CMAKE_C_COMPILER_FRONTEND_VARIANT}"
Expand Down
4 changes: 2 additions & 2 deletions ports/vcpkg-make/vcpkg_make_configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ function(vcpkg_make_configure)
set(opts "")
if(NOT arg_DISABLE_DEFAULT_OPTIONS)
z_vcpkg_make_default_path_and_configure_options(opts AUTOMAKE CONFIG "${configup}")
vcpkg_list(APPEND arg_OPTIONS ${opts})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appended the second config's options, to the first config's options, breaking the debug,relase build order.

endif()

set(configure_path_from_wd "./${relative_build_path}/configure")
Expand All @@ -116,7 +115,8 @@ function(vcpkg_make_configure)
"${configure_path_from_wd}"
OPTIONS
${BUILD_TRIPLET}
${arg_OPTIONS}
${arg_OPTIONS}
${opts}
${arg_OPTIONS_${configup}}
WORKING_DIRECTORY
"${target_dir}"
Expand Down
15 changes: 8 additions & 7 deletions ports/vcpkg-make/vcpkg_make_install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_make.cmake")
function(vcpkg_make_install)
cmake_parse_arguments(PARSE_ARGV 0 arg
"DISABLE_PARALLEL"
"LOGFILE_ROOT;MAKEFILE;TARGETS"
"OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE"
"LOGFILE_ROOT;MAKEFILE"
"OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE;TARGETS"
)
z_vcpkg_unparsed_args(FATAL_ERROR)

Expand Down Expand Up @@ -81,26 +81,27 @@ function(vcpkg_make_install)
endif()

foreach(target IN LISTS arg_TARGETS)
string(REPLACE "/" "_" target_no_slash "${target}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most targets aren't "phony" but actual files. But filepaths must not be used to construct the log file name.

vcpkg_list(SET make_cmd_line ${make_command} ${arg_OPTIONS} ${arg_OPTIONS_${cmake_buildtype}} V=1 -j ${VCPKG_CONCURRENCY} ${extra_opts} -f ${arg_MAKEFILE} ${target} ${destdir_opt})
vcpkg_list(SET no_parallel_make_cmd_line ${make_command} ${arg_OPTIONS} ${arg_OPTIONS_${cmake_buildtype}} V=1 -j 1 ${extra_opts} -f ${arg_MAKEFILE} ${target} ${destdir_opt})
message(STATUS "Making target '${target}' for ${TARGET_TRIPLET}-${short_buildtype}")
if (arg_DISABLE_PARALLEL)
vcpkg_run_shell_as_build(
WORKING_DIRECTORY "${working_directory}"
LOGNAME "${arg_LOGFILE_ROOT}-${target}-${TARGET_TRIPLET}-${short_buildtype}"
LOGNAME "${arg_LOGFILE_ROOT}-${target_no_slash}-${TARGET_TRIPLET}-${short_buildtype}"
SHELL ${shell_cmd}
NO_PARALLEL_COMMAND ${configure_env} ${no_parallel_make_cmd_line}
COMMAND ${configure_env} ${no_parallel_make_cmd_line}
)
else()
vcpkg_run_shell_as_build(
WORKING_DIRECTORY "${working_directory}"
LOGNAME "${arg_LOGFILE_ROOT}-${target}-${TARGET_TRIPLET}-${short_buildtype}"
LOGNAME "${arg_LOGFILE_ROOT}-${target_no_slash}-${TARGET_TRIPLET}-${short_buildtype}"
SHELL ${shell_cmd}
COMMAND ${configure_env} ${no_parallel_make_cmd_line}
COMMAND ${configure_env} ${make_cmd_line}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why the build wasn't parallel.

NO_PARALLEL_COMMAND ${configure_env} ${no_parallel_make_cmd_line}
)
endif()
file(READ "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_ROOT}-${target}-${TARGET_TRIPLET}-${short_buildtype}-out.log" logdata)
file(READ "${CURRENT_BUILDTREES_DIR}/${arg_LOGFILE_ROOT}-${target_no_slash}-${TARGET_TRIPLET}-${short_buildtype}-out.log" logdata)
if(logdata MATCHES "Warning: linker path does not have real file for library")
message(FATAL_ERROR "libtool could not find a file being linked against!")
endif()
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -9405,7 +9405,7 @@
"port-version": 0
},
"vcpkg-make": {
"baseline": "2024-12-27",
"baseline": "2025-01-13",
"port-version": 0
},
"vcpkg-msbuild": {
Expand Down
5 changes: 5 additions & 0 deletions versions/v-/vcpkg-make.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5af3456c1f7742c9d880d70dc678c061b91668c1",
"version-date": "2025-01-13",
"port-version": 0
},
{
"git-tree": "ac1381c26cff8ab8365670f4fb00395e86c58dfa",
"version-date": "2024-12-27",
Expand Down