-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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 scripts] Use ninja from vcpkg fetch #43309
base: master
Are you sure you want to change the base?
Conversation
endif() | ||
if(NOT NINJA) | ||
vcpkg_execute_in_download_mode( | ||
COMMAND "$ENV{VCPKG_COMMAND}" fetch ninja |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also be:
COMMAND "$ENV{VCPKG_COMMAND}" fetch ninja | |
COMMAND "$ENV{VCPKG_COMMAND}" fetch "${program_name}" |
if we want to generalize this pattern somehow?
if(NOT NINJA) | ||
vcpkg_execute_in_download_mode( | ||
COMMAND "$ENV{VCPKG_COMMAND}" fetch ninja | ||
RESULT_VARIABLE error_code | ||
OUTPUT_VARIABLE NINJA | ||
WORKING_DIRECTORY "${DOWNLOADS}" | ||
) | ||
string(STRIP "${NINJA}" NINJA) | ||
set(NINJA "${NINJA}" CACHE STRING "" FORCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't testing and setting NINJA
the responsibility of the vfap.cmake script?
Should this script just return the directory in paths_to_search
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't testing and setting NINJA the responsibility of the vfap.cmake script?
In general yes but:
- vcpkg fetch ninja should always return the correct minimum version -> see CMake
- NINJA needs to be overwritable by the user from a triplet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't testing and setting NINJA the responsibility of the vfap.cmake script?
In general yes but:
- vcpkg fetch ninja should always return the correct minimum version -> see CMake
This is vcpkg fetch
responsibility now, and it works AFAICS on my computer.
- NINJA needs to be overwritable by the user from a triplet.
It is AFAICS.
vcpkg/scripts/cmake/vcpkg_find_acquire_program.cmake
Lines 97 to 100 in cf035d9
function(vcpkg_find_acquire_program program) | |
if(${program}) | |
return() | |
endif() |
These per-program scripts are really meant to just provide the most specific part of the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These per-program scripts are really meant to just provide the most specific part of the implementation.
So you want:
vcpkg_execute_in_download_mode(
COMMAND "$ENV{VCPKG_COMMAND}" fetch ninja
RESULT_VARIABLE error_code
OUTPUT_VARIABLE NINJA
WORKING_DIRECTORY "${DOWNLOADS}"
)
string(STRIP "${NINJA}" NINJA)
set(NINJA "${NINJA}" CACHE STRING "" FORCE)
return() # so that the rest of vcpkg_find_acquire_program is not executed.
?
or even
set(program_name ninja)
set(use_vcpkg_fetch ON)
some impl. doing vcpkg fetch in vcpkg_find_acquire_program?
I don't see a reason to do the last one yet.
I mean the only goal here is to not duplicate the ninja information and keep vcpkg_find_acquire_program(NINJA)
intact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More like
set(program_name ninja)
vcpkg_execute_in_download_mode(
COMMAND "$ENV{VCPKG_COMMAND}" fetch ninja
RESULT_VARIABLE error_code
OUTPUT_VARIABLE ninja
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${DOWNLOADS}"
)
cmake_path(GET ninja PARENT_PATH paths_to_search)
but I see that we already have the ultimate NINJA at that point. It is just that it is not clear from which scope we would be return()
ing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is just that it is not clear from which scope we would be return()ing.
The return
is actually not needed. Just an unnecessary early return, so we could go without it.
No description provided.