I'm writing an macos app where the main xcproj depends on some swift packages. Some of these packages depend on other packages. Some of these packages provide xcframeworks for 3rd party dependencies.
I'm at a point where packages are compiling in isolation, but I get dependency related errors when integrating into the app.
I use a number of 3rd party libraries: Ceres, Eigen, gflags, glog, OpenCV. The flow of dependencies looks like this:
App -> OpenCV
App -> Eigen
App -> Ceres (which internally depends on headers from Eigen, gflags, glog)
App -> Custom Package -> Eigen, gflags, glog, OpenCV
I have Packages for each of these 3rd party libraries that provides them as an xcframework, with the exception of Eigen which is consumed as source (either by the App via build settings that point to include files within the project, or by my Custom Package via git submodule)
When I compile the App it has trouble building each dependency. I can import them fine, but at compile time I get errors from within the dependencies themselves (ie compiles errors inside Eigen, or inside OpenCV, etc)
Some questions:
- High level - Is my intended structure possible with swift packages? or am I attempting something that's not supported?
- Low level - if it is possible, can someone point me in the right direction to get my dependencies linked properly so they compile. Any build settings in XCode or flags to set in my Package.swift files?
Environment:
- macOS 12.6
- XCode 14.2
- App target 12.3
Libraries
- GitHub - ceres-solver/ceres-solver: A large scale non-linear optimization library
- libeigen / eigen · GitLab
- GitHub - gflags/gflags: The gflags package contains a C++ library that implements commandline flags processing. It includes built-in support for standard types such as string and the ability to define flags in the source file in which they are used. Online documentation available at:
- GitHub - google/glog: C++ implementation of the Google logging module
- GitHub - opencv/opencv: Open Source Computer Vision Library