-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[vcpkg/meson] fix some details #15756
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
Changes from 5 commits
1415cf4
0e414ba
ea74740
b786caa
abaf085
db6f17c
db69b42
dff02cb
1da6dce
5d66e98
eab9254
c25a94f
5b8ac64
a58e1fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # native file used to make the build machine compiler unusable | ||
|
|
||
| [host_machine] | ||
| system = 'none' | ||
| cpu_family = 'none' | ||
| cpu = 'none' | ||
| endian = 'little' | ||
|
|
||
| [properties] | ||
|
|
||
| [binaries] | ||
| c = ['false'] | ||
| cpp = ['false'] | ||
| objc = ['false'] | ||
| objcpp = ['false'] | ||
| ar = ['false'] | ||
| pkgconfig = ['false'] | ||
| cmake = ['false'] | ||
| ninja = ['false'] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ This command supplies many common arguments to Meson. To see the full list, exam | |
| * [libepoxy](https://github.com/Microsoft/vcpkg/blob/master/ports/libepoxy/portfile.cmake) | ||
| #]===] | ||
|
|
||
|
|
||
|
Neumann-A marked this conversation as resolved.
Outdated
|
||
| function(vcpkg_internal_meson_generate_native_file _additional_binaries) #https://mesonbuild.com/Native-environments.html | ||
| set(NATIVE "[binaries]\n") | ||
| #set(proglist AR RANLIB STRIP NM OBJDUMP DLLTOOL MT) | ||
|
|
@@ -101,15 +102,15 @@ function(vcpkg_internal_meson_generate_native_file_config _config) #https://meso | |
| set(LIBPATH_${_config} "'${L_FLAG}${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib'") | ||
|
|
||
| set(NATIVE_${_config} "[properties]\n") #https://mesonbuild.com/Builtin-options.html | ||
| string(REGEX REPLACE "( |^)(-|/)" ";\\2" MESON_CFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${_config}}") | ||
| string(REGEX REPLACE "( |^)(--?|/)" ";\\2" MESON_CFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${_config}}") | ||
|
Neumann-A marked this conversation as resolved.
Outdated
|
||
| list(TRANSFORM MESON_CFLAGS_${_config} APPEND "'") | ||
| list(TRANSFORM MESON_CFLAGS_${_config} PREPEND "'") | ||
| #list(APPEND MESON_CFLAGS_${_config} "${LIBPATH_${_config}}") | ||
| list(APPEND MESON_CFLAGS_${_config} "'-I${CURRENT_INSTALLED_DIR}/include'") | ||
| list(JOIN MESON_CFLAGS_${_config} ", " MESON_CFLAGS_${_config}) | ||
| string(REPLACE "'', " "" MESON_CFLAGS_${_config} "${MESON_CFLAGS_${_config}}") | ||
| string(APPEND NATIVE_${_config} "c_args = [${MESON_CFLAGS_${_config}}]\n") | ||
| string(REGEX REPLACE "( |^)(-|/)" ";\\2" MESON_CXXFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${_config}}") | ||
| string(REGEX REPLACE "( |^)(--?|/)" ";\\2" MESON_CXXFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${_config}}") | ||
|
Neumann-A marked this conversation as resolved.
Outdated
|
||
| list(TRANSFORM MESON_CXXFLAGS_${_config} APPEND "'") | ||
| list(TRANSFORM MESON_CXXFLAGS_${_config} PREPEND "'") | ||
| #list(APPEND MESON_CXXFLAGS_${_config} "${LIBPATH_${_config}}") | ||
|
|
@@ -123,7 +124,7 @@ function(vcpkg_internal_meson_generate_native_file_config _config) #https://meso | |
| else() | ||
| set(LINKER_FLAGS_${_config} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${_config}}") | ||
| endif() | ||
| string(REGEX REPLACE "( |^)(-|/)" ";\\2" LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}") | ||
| string(REGEX REPLACE "( +|^)(--?|/)" ";\\2" LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}") | ||
| list(TRANSFORM LINKER_FLAGS_${_config} APPEND "'") | ||
| list(TRANSFORM LINKER_FLAGS_${_config} PREPEND "'") | ||
| list(APPEND LINKER_FLAGS_${_config} "${LIBPATH_${_config}}") | ||
|
|
@@ -249,7 +250,7 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/ | |
| endforeach() | ||
|
|
||
| string(APPEND CROSS "[properties]\n") | ||
| string(APPEND CROSS "skip_sanity_check = true\n") | ||
|
|
||
| string(APPEND CROSS "[host_machine]\n") | ||
| string(APPEND CROSS "endian = 'little'\n") | ||
| if(NOT VCPKG_CMAKE_SYSTEM_NAME) | ||
|
|
@@ -273,7 +274,7 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/ | |
| string(APPEND CROSS "cpu_family = '${BUILD_CPU_FAM}'\n") | ||
| string(APPEND CROSS "cpu = '${BUILD_CPU}'\n") | ||
|
|
||
| if(NOT BUILD_CPU_FAM STREQUAL HOST_CPU_FAM) | ||
| if(NOT BUILD_CPU_FAM MATCHES "${HOST_CPU_FAM}" OR VCPKG_TARGET_IS_UWP) | ||
|
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. Why is this
Contributor
Author
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. So that
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. This will likely need a follow-up PR to handle the more generic BUILD_OS != HOST_OS (such as windows cross to linux or vice versa). What are the consequences of making everything a cross build?
Contributor
Author
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.
That probably strongly depends on whatever is in the meson.build. But I would assume that cross builds will, in general, not try to build host/native tools/codegenerator which is a problem if you start to depend on them being available within vcpkg. If everything is a cross build and the buildscript just tests for 'cross' for building the required tool than additional patches are necessary to introduce the required options/fixes to make the port actually build the tools if it is native build. Furthermore there might be more introspection into the system if it is a native build. But I agree everything should eventually be treated as a crossbuild. A native build is just a special case of a cross build, where the build machines happens to be the same as the target machine. Unfortunately most developers don't thing in that way and treat the cross build as the special case. |
||
| set(_file "${CURRENT_BUILDTREES_DIR}/meson-cross-${TARGET_TRIPLET}.log") | ||
| set(VCPKG_MESON_CROSS_FILE "${_file}" PARENT_SCOPE) | ||
| file(WRITE "${_file}" "${CROSS}") | ||
|
|
@@ -291,14 +292,14 @@ function(vcpkg_internal_meson_generate_cross_file_config _config) #https://meson | |
|
|
||
|
|
||
| set(NATIVE_${_config} "[properties]\n") #https://mesonbuild.com/Builtin-options.html | ||
| string(REGEX REPLACE "( |^)(-|/)" ";\\2" MESON_CFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${_config}}") | ||
| string(REGEX REPLACE "( |^)(--?|/)" ";\\2" MESON_CFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${_config}}") | ||
|
Neumann-A marked this conversation as resolved.
Outdated
|
||
| list(TRANSFORM MESON_CFLAGS_${_config} APPEND "'") | ||
| list(TRANSFORM MESON_CFLAGS_${_config} PREPEND "'") | ||
| list(APPEND MESON_CFLAGS_${_config} "'-I\"${CURRENT_INSTALLED_DIR}/include\"'") | ||
| list(JOIN MESON_CFLAGS_${_config} ", " MESON_CFLAGS_${_config}) | ||
| string(REPLACE "'', " "" MESON_CFLAGS_${_config} "${MESON_CFLAGS_${_config}}") | ||
| string(APPEND NATIVE_${_config} "c_args = [${MESON_CFLAGS_${_config}}]\n") | ||
| string(REGEX REPLACE "( |^)(-|/)" ";\\2" MESON_CXXFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${_config}}") | ||
| string(REGEX REPLACE "( |^)(--?|/)" ";\\2" MESON_CXXFLAGS_${_config} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${_config}}") | ||
|
Neumann-A marked this conversation as resolved.
Outdated
|
||
| list(TRANSFORM MESON_CXXFLAGS_${_config} APPEND "'") | ||
| list(TRANSFORM MESON_CXXFLAGS_${_config} PREPEND "'") | ||
| list(APPEND MESON_CXXFLAGS_${_config} "'-I\"${CURRENT_INSTALLED_DIR}/include\"'") | ||
|
|
@@ -311,7 +312,7 @@ function(vcpkg_internal_meson_generate_cross_file_config _config) #https://meson | |
| else() | ||
| set(LINKER_FLAGS_${_config} "${VCPKG_DETECTED_CMAKE_STATIC_LINKER_FLAGS_${_config}}") | ||
| endif() | ||
| string(REGEX REPLACE "( |^)(-|/)" ";\\2" LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}") | ||
| string(REGEX REPLACE "( +|^)(--?|/)" ";\\2" LINKER_FLAGS_${_config} "${LINKER_FLAGS_${_config}}") | ||
| list(TRANSFORM LINKER_FLAGS_${_config} APPEND "'") | ||
| list(TRANSFORM LINKER_FLAGS_${_config} PREPEND "'") | ||
| list(APPEND LINKER_FLAGS_${_config} "${LIBPATH_${_config}}") | ||
|
|
@@ -370,19 +371,6 @@ function(vcpkg_configure_meson) | |
|
|
||
| list(APPEND _vcm_OPTIONS --buildtype plain --backend ninja --wrap-mode nodownload) | ||
|
|
||
| if(NOT VCPKG_MESON_NATIVE_FILE) | ||
| vcpkg_internal_meson_generate_native_file("_vcm_ADDITIONAL_NATIVE_BINARIES") | ||
| endif() | ||
| if(NOT VCPKG_MESON_NATIVE_FILE_DEBUG) | ||
| vcpkg_internal_meson_generate_native_file_config(DEBUG) | ||
| endif() | ||
| if(NOT VCPKG_MESON_NATIVE_FILE_RELEASE) | ||
| vcpkg_internal_meson_generate_native_file_config(RELEASE) | ||
| endif() | ||
| list(APPEND _vcm_OPTIONS --native "${VCPKG_MESON_NATIVE_FILE}") | ||
| list(APPEND _vcm_OPTIONS_DEBUG --native "${VCPKG_MESON_NATIVE_FILE_DEBUG}") | ||
| list(APPEND _vcm_OPTIONS_RELEASE --native "${VCPKG_MESON_NATIVE_FILE_RELEASE}") | ||
|
|
||
| if(NOT VCPKG_MESON_CROSS_FILE) | ||
| vcpkg_internal_meson_generate_cross_file("_vcm_ADDITIONAL_CROSS_BINARIES") | ||
| endif() | ||
|
|
@@ -395,14 +383,30 @@ function(vcpkg_configure_meson) | |
| if(VCPKG_MESON_CROSS_FILE) | ||
| list(APPEND _vcm_OPTIONS --cross "${VCPKG_MESON_CROSS_FILE}") | ||
| endif() | ||
|
|
||
| if(VCPKG_MESON_CROSS_FILE_DEBUG) | ||
| list(APPEND _vcm_OPTIONS_DEBUG --cross "${VCPKG_MESON_CROSS_FILE_DEBUG}") | ||
| endif() | ||
| if(VCPKG_MESON_CROSS_FILE_RELEASE) | ||
| list(APPEND _vcm_OPTIONS_RELEASE --cross "${VCPKG_MESON_CROSS_FILE_RELEASE}") | ||
| endif() | ||
|
|
||
|
|
||
| if(NOT VCPKG_MESON_NATIVE_FILE AND NOT VCPKG_MESON_CROSS_FILE) | ||
| vcpkg_internal_meson_generate_native_file("_vcm_ADDITIONAL_NATIVE_BINARIES") | ||
| endif() | ||
| if(NOT VCPKG_MESON_NATIVE_FILE_DEBUG AND NOT VCPKG_MESON_CROSS_FILE) | ||
| vcpkg_internal_meson_generate_native_file_config(DEBUG) | ||
| endif() | ||
| if(NOT VCPKG_MESON_NATIVE_FILE_RELEASE AND NOT VCPKG_MESON_CROSS_FILE) | ||
| vcpkg_internal_meson_generate_native_file_config(RELEASE) | ||
| endif() | ||
| if(VCPKG_MESON_NATIVE_FILE AND NOT VCPKG_MESON_CROSS_FILE) | ||
|
Neumann-A marked this conversation as resolved.
|
||
| list(APPEND _vcm_OPTIONS --native "${VCPKG_MESON_NATIVE_FILE}") | ||
| list(APPEND _vcm_OPTIONS_DEBUG --native "${VCPKG_MESON_NATIVE_FILE_DEBUG}") | ||
| list(APPEND _vcm_OPTIONS_RELEASE --native "${VCPKG_MESON_NATIVE_FILE_RELEASE}") | ||
| else() | ||
| list(APPEND _vcm_OPTIONS --native "${SCRIPTS}/buildsystems/meson/none.txt") | ||
| endif() | ||
| if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") | ||
| list(APPEND _vcm_OPTIONS --default-library shared) | ||
| else() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.