Post

Replies

Boosts

Views

Activity

How to build projects once?
Hi, I have been tasked with porting our C++ codebase from Windows/Linux to MacOS. Our setup uses Premake to generate platform specific project files. On Windows it creates a Visual Studio solution and project files, on Linux it creates makefiles, and on MacOS it generates an Xcode workspace and project files. Our project hierarchy looks something like this: Solution/Workspace S Project A (shared library) Project B (shared library) Project C (shared library) Projects D to R (About a dozen or so - all shared libraries) Project V (application) Project W (application) Project X (application) Project Y (application) Project Z (application) Projects B and C depend on A. Projects D to R are dependent on some or all of the projects A, B, and C. Each application is dependent on projects A, B, and C, and some of the intermediate projects D to R. (The exact dependencies vary according to the application.) Additionally, some applications can load shared libraries dynamically according to their state/settings. I.e., not all shared library dependencies are known at build time. Initially all building typically happens on the command line. Once our build script has run Premake to generate the project files, it proceeds to build everything. Further builds can happen within Visual Studio/Xcode as part of the normal workflow. However, building must happen on the command line for DevOps CI/Release builds. On Windows, for example, MSBuild lets me build the entire solution for a given configuration (Debug/Release/etc) in a single command. This builds projects A, B, C in order, followed by the intermediate projects (D to R), followed by the applications (V to Z). Each project is built once. Same deal for Linux. Make builds each project in turn according to the dependencies with a single command. Each project is build once. On MacOS, however, xcodebuild doesn't let me just build the entire workspace for a given configuration. I can specify a workspace, but then I have to also specify a scheme. Or I can just specify a specific project. However, when I build a specific project, Xcodebuild always builds all dependencies. So my build script at the moment explicitly builds projects D to R, followed by applications V to Z. This, however, leads to the ridiculous situation of Xcode building projects in the following order: D, C, B, A E, C, A F, C, B, A G, B, A etc... V, F, G, H, C, B, A W, G, I, C, B, A X, K, C, B, A etc... With the obvious effect of our MacOS builds taking 20+ times longer than their Windows/Linux counterparts. So, my main questions are: Is it possible to just build every project in the workspace once? Or if that can't be done, is it possible to not build project dependencies? I.e., can I just build the single project I specify? If neither of those are possible, how can I optimise my builds so that they don't take half a day to complete? I should point out, removing the project dependencies isn't an option. If project A is genuinely out of date, it should be built if I build one of the applications. Xcode should be smart enough to realise that it doesn't need to build everything every time.
3
0
430
Jul ’24
Xcode precompiled header problem
Hi, We are using Precompiled Headers in all our projects. (Project files are generated with Premake and support Windows, Linux, Emscripten (web), and MacOS.) I am having a problem with one project in particular which contains a mix of C and C++ files. We explicitly disable precompiled headers for C files because past experience has proven it's impossible to use C++ precompiled headers in C sources, and vice versa. At least that's the theory. In Xcode it doesn't seem possible to enable/disable precompiled headers on a per file basis. (At least that's my conclusion so far.) Is this actually true? Is it not possible to configure individual build settings for single source files? Specifically, is it not possible to use precompiled headers for C++ files and not for C files within a single project? Cheers, James
1
0
900
Aug ’23
error: lipo: can't move temporary file: (No such file or directory)
Hi, I am building xcode projects from both the command line and from within xcode. I am encountering the following lipo error: error: lipo: can't move temporary file: /Users/james/Work/KDI/Build/Debug/libMyLib.dylib.dSYM/Contents/Resources/DWARF/libMyLib.dylib to file: /Users/james/Work/KDI/Build/Debug/libMyLib.dylib.dSYM/Contents/Resources/DWARF/libMyLib.dylib.lipo (No such file or directory) (The names have been changed to protect the innocent.) ;) Most of the time, this error happens occasionally and rebuilding the project solves it. It usually (but not always) happens when switching from building on the command line to building in xcode. At least, that's been the most consistent way to reproduce it. However, I say "most of the time", because now it's happening every time with one particular project. Does anyone know what's causing this, and, more importantly, how to fix it? (I'm using XCode Version 14.2 (14C18) on Mac OS Ventura Version 13.3.1 (22E261) running on Apple Silicon.)
1
0
635
Jun ’23
ObjC compile errors in Apple headers
Hi, I'm trying to set up a quick demo app for part of our technology stack. (Basically implementing the same small app necessities for MacOS that we already have running on Linux and Windows.) But I'm getting some errors in Apple headers that I don't how to solve. From #import <Cocoa/Cocoa.h> I'm getting the following errors: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:14: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAccessibility.h:12: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAccessibilityConstants.h:130:15: error: unknown type name 'NSAttributedStringKey'; did you mean 'NSAttributedString'? APPKIT_EXTERN NSAttributedStringKey const NSAccessibilityFontTextAttribute; //(NSDictionary<NSAccessibilityFontAttributeKey, id> *) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:255:8: note: 'NSAttributedString' declared here @class NSAttributedString; ^ Does anyone know what I'm doing wrong? Should I be declaring some preprocessor symbol or including some other header files before #import <Cocoa/Cocoa.h>? I'm building from the command line with XCode Version 14.2 (14C18) on macOS Ventura 13.0 (22A8381). Cheers, James
6
0
925
Feb ’23