Fix Xcode project build failures#2879
Conversation
- Added missing .c sources causing build failures. - Added missing includes for the Framework target - Removed all private headers; they are not needed at all. - Removed references to headers that have been deleted from the repo.
Old test sources were removed when modern tests were introduced in 191db14.
|
It compiles successfully, but it seems to have completely deleted the tests from the Xcode project? It also lacks support for later-added architectures such as Tricore. On macOS, you can use the Xcode generator to create an Xcode project ( I think it’s perfectly fine to delete the current outdated Xcode project files and instead ensure that the code compiles (using the Xcode project generated by CMake). |
@jack68k If you could add a workflow and docs for it it would be awesome! |
64fdf17 to
87ffd6e
Compare
|
Thank you for the feedback. Here are my overall thoughts on maintaining an Xcode project. I think the value in having an Xcode project at all is to provide an idiomatic way to integrate the Capstone library into a consuming project that's being developed in Xcode on macOS. This opens the door to source-level debugging of Capstone, if needed. In this scenario, one approach to consuming the Capstone library is to add it as a git submodule and then add Capstone's Xcode project to your workspace. This makes it easy to build the library as part of your consuming project's build process, and to choose which of the macOS targets you want to link with: the static library, the dynamic library, or most idiomatically on macOS, the .framework because it encapsulates both the library and the public headers. Certainly there are alternatives such as creating a custom build script that pulls and builds the Capstone library in a directory that's ignored by git, or committing the library artifacts and public headers to the consuming project's source tree. Opinions differ on the best way to handle this, and there are significant drawbacks to every approach. I personally prefer the submodule approach when possible. Since the native build system for Capstone is CMake, it doesn't make sense to try to use Xcode for actual Capstone library development on macOS. You'd be better off choosing an IDE that has support for CMake such as Visual Studio Code (it has an extension, of course), or just use your favorite text editor + command line builds. So, back to the Xcode project. I would propose:
Out of scope:
Unfortunately, there's not a good way to generate or sync an Xcode project with the source of truth, CMakeLists.txt.
So, custom scripting would be needed to produce a project that's in sync with CMakeLists.txt. AlternativesI'm wondering if it would be best to remove the Idea 1: Separate ProjectSomeone maintains a separate project on GitHub that provides the .xcodeproj and references Capstone as a git submodule. New commits to Capstone would be pulled in manually and the .xcodeproj would be updated. Pros:
Cons:
Idea 2: Pre-built packageThere is a Capstone homebrew package however it only provides released versions. Since there's a lot of active development, it would be helpful to have nightly packages or packages built from other tags. Pros:
Cons:
I know this is a lot -- I look forward to your thoughts. |
Sorry, I never got into the Apple ecosystem so far and struggle to find a quick answer for myself.
This seems the best option IMHO.
If someone maintains it it would be good. It maybe wouldn't need to be update for each commit? Only for each release?
It doesn't seem to pick up the latest Alpha releases sadly. |
Your checklist for this pull request
Detailed description
Previously, the Xcode project failed to build due to being out-of-sync with C sources that have been added or removed.
Now:
.csources from the root directory andarch/*..hand.incfiles are removed as they were very out-of-sync with the actual filesystem. The files that previously existed were not included in any target and do not need to be present in the project tree to for build.xcode/README.mdto reflect the current state.No sources, headers, or tests were modified.
Test plan
Verify that all 3 targets in the Xcode project build successfully. The simplest way is to use xcodebuild:
Closing issues
I did not find any associated issues.