ITADN

Simplify XCode Swift builds

#1797Opentothambrus11 创建于 2025-11-30
T
tothambrus11commented
Currently, our XCode builds require seemingly unnecessary complexity, such as [`hylo_propage_swift_modules`](https://github.com/hylo-lang/hylo/blob/main/cmake/TopLevelDefaults.cmake#L118) function. The core of the complexity comes from how Xcode works, it requires all dependencies (even the ones that are aimed to be privately linked) to be publicly exposed and be a direct dependency of the top level built target. I believe this MR was supposed to fix the issue by implicitly propagating include paths of the dependencies to the current target: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4320/diffs Also, see this thread: https://discourse.cmake.org/t/fixing-xcode-swift/10768/20 We also had to patch lots of our dependencies' CMake files: - https://github.com/apple/swift-collections/pull/547/files - https://github.com/apple/swift-argument-parser/compare/main...hylo-lang:swift-argument-parser:main - add `swift_module_re_exports` - remove setting target property `INTERFACE_INCLUDE_DIRECTORIES` to `${CMAKE_Swift_MODULE_DIRECTORY}` - remove ``` set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) ``` We should debug where the problem(s) lie, in CMake, XCode, the libraries we use, or our code. The test cases of XCode's cmake support may be helpful.
2 条评论