[meson] Add support for loongarch64 cpu. (#25615)

* Add support for loongarch64 cpu.

* update ci.baseline.txt

* Revert "update ci.baseline.txt"

This reverts commit 0b3f4851bc.

* Allow user to add additional options for meson within custom triplet.

Co-authored-by: Jamlys Lee <jamlys_lee@163.com>
This commit is contained in:
Jamlys Lee 2022-07-18 10:41:15 +08:00 committed by GitHub
parent 68b7fec22e
commit de176433e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View file

@ -93,6 +93,13 @@ This option also has forms for configuration-specific flags:
- `VCPKG_LINKER_FLAGS_DEBUG`
- `VCPKG_LINKER_FLAGS_RELEASE`
### VCPKG_MESON_CONFIGURE_OPTIONS
Set additional Meson configure options that are appended to the configure command (in [`vcpkg_configure_meson`](../maintainers/vcpkg_configure_meson.md)).
This field is optional.
Also available as build-type specific `VCPKG_MESON_CONFIGURE_OPTIONS_DEBUG` and `VCPKG_MESON_CONFIGURE_OPTIONS_RELEASE` variables.
### VCPKG_CMAKE_CONFIGURE_OPTIONS
Set additional CMake configure options that are appended to the configure command (in [`vcpkg_cmake_configure`](../maintainers/vcpkg_cmake_configure.md)).

View file

@ -233,6 +233,9 @@ function(z_vcpkg_meson_generate_cross_file additional_binaries) #https://mesonbu
elseif(MACHINE MATCHES "i386")
set(build_cpu_fam x86)
set(build_cpu i386)
elseif(MACHINE MATCHES "loongarch64")
set(build_cpu_fam loongarch64)
set(build_cpu loongarch64)
else()
# https://github.com/mesonbuild/meson/blob/master/docs/markdown/Reference-tables.md#cpu-families
message(FATAL_ERROR "Unhandled machine: ${MACHINE}")
@ -253,6 +256,9 @@ function(z_vcpkg_meson_generate_cross_file additional_binaries) #https://mesonbu
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)$")
set(host_cpu_fam arm)
set(host_cpu armv7hl)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "loongarch64")
set(host_cpu_fam loongarch64)
set(host_cpu loongarch64)
else()
message(FATAL_ERROR "Unsupported target architecture ${VCPKG_TARGET_ARCHITECTURE}!" )
endif()
@ -341,6 +347,17 @@ function(vcpkg_configure_meson)
vcpkg_list(APPEND arg_OPTIONS --buildtype plain --backend ninja --wrap-mode nodownload)
# Allow overrides / additional configuration variables from triplets
if(DEFINED VCPKG_MESON_CONFIGURE_OPTIONS)
vcpkg_list(APPEND arg_OPTIONS ${VCPKG_MESON_CONFIGURE_OPTIONS})
endif()
if(DEFINED VCPKG_MESON_CONFIGURE_OPTIONS_RELEASE)
vcpkg_list(APPEND arg_OPTIONS_RELEASE ${VCPKG_MESON_CONFIGURE_OPTIONS_RELEASE})
endif()
if(DEFINED VCPKG_MESON_CONFIGURE_OPTIONS_DEBUG)
vcpkg_list(APPEND arg_OPTIONS_DEBUG ${VCPKG_MESON_CONFIGURE_OPTIONS_DEBUG})
endif()
if(NOT vcpkg_meson_cross_file)
z_vcpkg_meson_generate_cross_file("${arg_ADDITIONAL_CROSS_BINARIES}")
endif()