-
Notifications
You must be signed in to change notification settings - Fork 7.5k
[vcpkg osx] Fix building for non-x86_64 archs on macOS (OSX) and fixes escapes for some params #12657
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
Closed
Closed
[vcpkg osx] Fix building for non-x86_64 archs on macOS (OSX) and fixes escapes for some params #12657
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c8762fa
Attempt to fix arm64 for macOS
Deadpikle b57ad3f
fix it
strega-nil 80fe695
fix escaping
strega-nil a8285f6
Remove VCPKG_OSX_ARCHITECTURES from osx triplets
Deadpikle 07b1c75
Add VCPKG_TARGET_IS_IOS
Deadpikle c611b81
Add multiple arch in VCPKG_TARGET_ARCHITECTURE
Deadpikle 3abcea7
Fix prettify output not working in some cases
Deadpikle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,6 +211,12 @@ function(vcpkg_configure_cmake) | |
| endif() | ||
| endif() | ||
|
|
||
| # make sure to escape multiple architectures in VCPKG_TARGET_ARCHITECTURE | ||
| string(REPLACE ";" "\\;" _VCPKG_TARGET_ARCHITECTURE "${VCPKG_TARGET_ARCHITECTURE}") | ||
| if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS) | ||
| # VCPKG_TARGET_ARCHITECTURE -> CMAKE_OSX_ARCHITECTURES | ||
| list(APPEND _csc_OPTIONS "-DCMAKE_OSX_ARCHITECTURES=${_VCPKG_TARGET_ARCHITECTURE}") | ||
| endif() | ||
|
|
||
| list(APPEND _csc_OPTIONS | ||
| "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" | ||
|
|
@@ -233,7 +239,7 @@ function(vcpkg_configure_cmake) | |
| "-DVCPKG_C_FLAGS_DEBUG=${VCPKG_C_FLAGS_DEBUG}" | ||
| "-DVCPKG_CRT_LINKAGE=${VCPKG_CRT_LINKAGE}" | ||
| "-DVCPKG_LINKER_FLAGS=${VCPKG_LINKER_FLAGS}" | ||
| "-DVCPKG_TARGET_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}" | ||
| "-DVCPKG_TARGET_ARCHITECTURE=${_VCPKG_TARGET_ARCHITECTURE}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be passed only if |
||
| "-DCMAKE_INSTALL_LIBDIR:STRING=lib" | ||
| "-DCMAKE_INSTALL_BINDIR:STRING=bin" | ||
| "-D_VCPKG_ROOT_DIR=${VCPKG_ROOT_DIR}" | ||
|
|
@@ -250,7 +256,9 @@ function(vcpkg_configure_cmake) | |
| # Sets configuration variables for macOS builds | ||
| foreach(config_var INSTALL_NAME_DIR OSX_DEPLOYMENT_TARGET OSX_SYSROOT OSX_ARCHITECTURES) | ||
| if(DEFINED VCPKG_${config_var}) | ||
| list(APPEND _csc_OPTIONS "-DCMAKE_${config_var}=${VCPKG_${config_var}}") | ||
| # support lists in these configuration vars | ||
| string(REPLACE ";" "\\;" _csc_VCPKG_CONFIG_VAR "${VCPKG_${config_var}}") | ||
| list(APPEND _csc_OPTIONS "-DCMAKE_${config_var}=${_csc_VCPKG_CONFIG_VAR}") | ||
| endif() | ||
| endforeach() | ||
|
|
||
|
|
@@ -307,7 +315,7 @@ function(vcpkg_configure_cmake) | |
| message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") | ||
| file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) | ||
| vcpkg_execute_required_process( | ||
| COMMAND ${dbg_command} | ||
| COMMAND "${dbg_command}" | ||
| WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg | ||
| LOGNAME config-${TARGET_TRIPLET}-dbg | ||
| ) | ||
|
|
@@ -317,7 +325,7 @@ function(vcpkg_configure_cmake) | |
| message(STATUS "Configuring ${TARGET_TRIPLET}-rel") | ||
| file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) | ||
| vcpkg_execute_required_process( | ||
| COMMAND ${rel_command} | ||
| COMMAND "${rel_command}" | ||
| WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel | ||
| LOGNAME config-${TARGET_TRIPLET}-rel | ||
| ) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,5 @@ | ||||||
| set(VCPKG_TARGET_ARCHITECTURE x86_64 arm64) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be:
Suggested change
|
||||||
| set(VCPKG_CRT_LINKAGE dynamic) | ||||||
| set(VCPKG_LIBRARY_LINKAGE static) | ||||||
|
|
||||||
| set(VCPKG_CMAKE_SYSTEM_NAME Darwin) | ||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
And then here:
thus, we actually write the vcpkg names for these targets, as opposed to the cmake names. I'm not sure if this is the right way, but it makes sense to me... cc @ras0219-msft ?
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.
The reason I think this is that in
x86-windows, we setVCPKG_TARGET_ARCHITECTUREtox86, notWin32.Uh oh!
There was an error while loading. Please reload this page.
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.
Also, this should break x64-osx, so these suggestions will fix it; otherwise, we'll have to change
x64-osx.