summaryrefslogtreecommitdiff
path: root/mesonbuild/backend/xcodebackend.py
AgeCommit message (Collapse)Author
2025-12-16review get_subdir vs get_builddirPaolo Bonzini
Comparing the implementation of build_subdir with https://github.com/mesonbuild/meson/pull/12258, both of them introduced a similar separation between srcdir and builddir. There were some differences in the choices of srcdir vs builddir; this commit tries to identify which are bugs in which implementation, and get the best of both worlds.
2025-11-19compilers: Remove Environment parameter from Compiler.get_option_compile_argsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.get_option_std_argsDylan Baker
2025-11-12build: Use a tuple for pch dataDylan Baker
This really isn't a list because it's not homogenous data, it's really `tuple[str, str | None] | None`, but we're using list length to decide what to do with it, and that makes for strict null issues, as an accurate annotation would be `list[str | None]`, which would require a lot of `is not None` checking. By using a tuple we don't need to keep checking length, which is more expensive than null checking. To ensure correctness I annotated some things in the VS backend
2025-10-29environment, backends: remove is_* methodsPaolo Bonzini
They are duplicates of what is already in compilers and have no state. Just use compilers. Fixes: #15082 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-16backend: remove InterpreterPaolo Bonzini
No one is accessing backend.interpreter anymore, get rid of it to avoid future temptations. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-16build, backend: store build_def_files in BuildPaolo Bonzini
The interpreter's build_def_files are the only remaining piece of interpreter state used by the backend. Compute it once and store it in build, using a property to ensure that it's initialized and accessed correctly. This also removes one of the cases in which introspection uses the interpreter object. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-14Make use of build TypeAliasesDylan Baker
There are a lot of spelled out unions for these types, lets reduce that number
2025-09-25mypy: low-effort addition of various missing typesEli Schwartz
``` -Found 438 errors in 3 files (checked 3 source files) +Found 402 errors in 3 files (checked 3 source files) ```
2025-08-02Add swift_interoperability_mode kwargKatalin Rebhan
2025-07-09xcode: Setup folder tree in IDEAlbert Tang
2025-06-23swift: Add support for C++/Objective-C++ interoperabilityAlbert Tang
As of Swift 5.9, C++/Objective-C++ code can be mixed with Swift, and C++ APIs can be imported to Swift. However, this must be explicitly enabled, as it is disabled by default. Xcode 15 introduces a new setting for this, so only set it on Xcode 15 and above.
2025-04-04compilers: introduce get_option_std_argsPaolo Bonzini
Allow CUDA to completely override the -std arguments but not the rest. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-03-10coredata: replace get_option with optstore.get_value_forDylan Baker
This is an old method, that is now just a wrapper around the OptionStore method, that doesn't add any value. It's also an option related method attached to the CoreData instead of the OptionStore, so useless and a layering violation.
2025-03-08Fix typos in commentsco63oc
2025-02-13Make all Meson level options overridable per subproject.Jussi Pakkanen
2024-12-16Xcode backend: better quoting for spaces in HEADER_SEARCH_PATHSNick
Xcode treats this dict value as a space-separated string, any spaces in the path will make the path invalid by splitting it into pieces. Split out header path processing into a helper function.
2024-12-06Fix ugly path after path join with the empty dirnameNick
2024-12-06Slightly fix compiler args order for the Xcode backendNick
Reorder compile args so that target has a chance to override options set by its dependencies. Fix piling up of custom target include paths.
2024-11-04Xcode backend: only use found appleframeworksnNick
Add a check before using an `appleframeworks` to make sure it was found. This fixes an exception in meson while encountering an optional dep for the target.
2024-09-14Fix various incorrect uses of `its` vs `it's`.Andrew McNulty
These errors can make reading comments and documentation unnecessarily confusing for users and contributors who do not speak English as their first language.
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen
2024-07-10Merge pull request #13360 from klokik/xcode-quotes-fixJussi Pakkanen
Refactor duplicated quoting code for XCode backend
2024-07-10backend: xcode fix map access in generate_pbx_sources_build_phase for ↵Cepsylon
CustomTargetIndex Fix incorrect map access to custom_target_output_buildfile in CustomTargetIndex case. Map keys are file names with the path appended, but the used keys were just the file name. This led to crashes.
2024-06-28Remove redundant quoting boilerplate on .add_itemMykola Dolhyi
A follow-up to the PbxDictItem refactoring. This removes extra type casting and string formatting before inserting values to the PbxDict.
2024-06-27Change empty string check approach Mykola
Review suggestion Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2024-06-27Refactor duplicated quoting code for XCode backendMykola Dolhyi
XCode project file contains dictionary-like structures. Strings for the mapped values have to be quoted if these include special characters. Previously this quoting was happening in-place, before adding a new value to the dictionary. This produce big amounts of boilerplate error-prone code. For example if there are targets whose names contain special characters (grpc++ in my case), produced file will be invalid. This moves checking and quoting subroutine to the PbxDictItem class, eliminating the need to do this on the caller side. [Kin](https://github.com/Serchinastico/Kin) tool was used to validate produced PBXProj files.
2024-06-03xcode: Skip generating PBXBuildStyle on Xcode 9 and aboveAlbert Tang
This was removed on Xcode 9, so only generate it for Xcode 8.3.3 and lower.
2024-06-03xcode: Generate files for highest detected versionAlbert Tang
Some settings require "objectVersion" to be set to a certain value or Xcode will not use it. To fix this, we set it to the highest possible value, determined by the detected version of Xcode. We also set "compatibilityVersion", but mainly so it lines up with "objectVersion". At the same time, we should not be generating Xcode 3.2-compatible projects by default anyway.
2024-06-03xcode: Detect installed version of XcodeAlbert Tang
This will allow for generating project files more specific to certain versions of Xcode without breaking compatibility.
2024-04-24backend: fix type annotation of Backend.generateDylan Baker
`func(value: dict = None)` is invalid, it must be `func(value: dict | None = None)`, or in our older syntax: `T.Optional[T.Dict] = None`
2024-04-09backends: Add Nasm support to Xcode through a custom build ruleL. E. Segovia
2024-04-09backends: Add Nasm support to Xcode through a custom build ruleL. E. Segovia
2024-01-26xcode: Fix "clean" operation under new build systemAlbert Tang
Xcode 14 has dropped the legacy build system, forcing us to use the new one introduced in Xcode 9. The new system requires that we conform to its "clean build folder" behavior, or clean operations fail. CMake achieves this by setting other variables instead of SYMROOT, so we follow that approach while retaining our current behavior as much as possible. Ref: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7730
2024-01-26xcode: Check custom target input for extracted objectsAlbert Tang
If there are any specified, the build target that generates them must be added as a dependency.
2024-01-26backends: Make object_filename_from_source() backend-agnosticAlbert Tang
Some backends may need to use its own target directories instead of our default one. For this, introduce an optional argument "targetdir" that will still use our default one when not specified.
2024-01-26xcode: Autodetect host machine's CPU architectureAlbert Tang
Currently, the backend has "x86_64" hardcoded as the architecture, which breaks cross compiling and compiling normally on arm64. Fix this by setting it to the host machine's CPU architecture instead.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-12-11xcode backend: sundry type annotationsEli Schwartz
Down from 120 to 44 mypy errors.
2023-12-11xcode backend: make the type of get_target_dir align with parent classEli Schwartz
mypy will complain if backends.Backend has a lru_cache wrapped method, but it is overridden in XCodeBackend with a method that isn't cached. This is almost certainly a sign that we should be caching it here too anyway. The generic backend cache was added years ago via an intimidating commit f39d2cc3bfa1dd4983cbe5adfb6c6e87dd09d684 which claims that it reduced call time from 60s to 0.000435s and that this was specifically due to getting a coredata option every single time. This is probably workload dependent, but getting an option is *not* nearly as cheap as a throwaway function call.
2023-12-11xcode backend: delete unused codeEli Schwartz
2023-12-11backends: correct nonebackend return annotation and check in run_mypyEli Schwartz
The only backend that can return values in generate() is ninja, so this was useless cruft.
2023-12-10xcode: Filter out targets not built by defaultAlbert Tang
2023-12-10xcode: Override determine_swift_deps_dir()Albert Tang
Xcode does not recognize our private directories, nor does it ever try to generate them. Instead, just import the build directories for each swift dependency. This fixes linking between swift targets when they are in their own subdirectories, as they will have different build directories in that case.
2023-12-10xcode: Enclose work directory in shell scriptsAlbert Tang
2023-12-10xcode: Wrap custom target output paths in quotesAlbert Tang
Without this, any build directory with a space in it was enough to make Xcode fail to open the project due to parsing errors.
2023-12-10xcode: Fix generating single generator phaseAlbert Tang
2023-12-10xcode: Search for dependencies for custom targetsAlbert Tang
When generating aggregated targets, custom targets were not being checked for dependencies when they should have. Fixes passing swift test case 4 (generate).
2023-12-10xcode: Classify metal and glsl files correctlyAlbert Tang
This fixes syntax highlighting on Xcode when viewing those files.
2023-12-10xcode: Set bridging header for mixed swift targetsAlbert Tang
This must be explicitly set in Xcode or it will not be able to compile mixed targets successfully. This is not needed for pure Swift targets. Set a new variable "is_swift" so finding the bridging header does not take O(n^2) time. Fixes passing swift test case 5 (mixed) with Xcode backend.