How do I set up an external build tool (make) within XCode3? - xcode

I've used XCode4 for a large C++ project. The project uses make for build. I've set up XCode4 to use external build tool make so that my Makefile is called each time I hit build and I see compile errors nicely within XCode.
First, this worked OK but recently XCode4 crashes a lot. Now I am switching back to XCode3 but I cannot find out how to set up build using an external build tool in XCode 3.2.5.

I'm not sure if this is what you are looking for, but when I'm ready to build an external static framework I use a bunch of scripts I have written and you can see at my Github repo. Look in the scripts directory and at the build.sh which configures and calls them.
I've used these scripts on both XCode 3 and XCode 4. They make use of xcodebuild and a couple of external tools such as appledoc and produces a distributable (versioned) DMG file if successful.
You can use these scripts if you like or just take a look to see how they work and get ideas for your own.

Related

Xcode: how to work with library/framework conveniently while keeping code private towards others?

I have been following this tutorial: https://medium.com/better-programming/create-swift-5-static-library-f1c7a1be3e45
However, it is inconvenient to copy the new .a file every time I make a change to the library. What is the common setup during development of the static library? Do a "copy to iOS project folder" in the build script or linking the frameworks "Products" folder in the iOS project etc.?
During development, Subprojects seem to be a really useful way (https://www.raywenderlich.com/2658-creating-a-static-library-in-ios-tutorial). However, copying the project to another computer renders it useless as it seems to rely on the Subproject and not e.g. cache the data from the last build.
The background is that I want to work with a client that I don't want to give access to my private API.
I am looking for a solution that lets me
work on the project as well as the library conveniently (either by submodules or by having opened 2 Xcode windows at the time)
commit changes to the Git repo (via the Xcode Source Control) and automatically have the compiled framework being pushed, too
have my be able client to use my Project and work on the Project but only has access to the compiled library so he can't see what's inside it

Halide HelloAndroid import method not found

I tried to import HelloAndroid project in Android Studio, but, when i try to build the apk and run it on a device, i get a gradle error:
Does anyone know how to solve this and run the app?
Original author of the build.gradle script here. As you can probably tell, our gradle build is pretty messy. It consists of three steps:
Build the Halide generators using gradle's native "cpp" plugin. That is, they're just regular C++ programs.
Run each Halide generator with per-architecture arguments to generate a set of .so files in the appropriate jni/libs/ directory.
Shell out to the ndk-build script to compile Android.mk, which links the JNI portion of the app with the Halide-generated .so files.
The process is brittle, especially with both Gradle and the Android platform changing under us. I've been waiting for the platform to stabilize with the new Gradle Component Model that is still "incubating" as well as the New Android Build System and New Experimental Plugin.
In the meantime, everything should still build if you use Android Studio 1.5 and Gradle 1.2.2 (1.2.3 will probably work, but IIRC 1.2.4 is broken).

Checked Out New Project in XCode 6.1 but XCTest and other libraries are missing

Today I checked out a new copy of stable project from gitHub to my home computer using Xcode 6.1. After doing so, I see that many of the frameworks and libraries, including XCTest, are missing (shown in red). I have added Framework and Header Search Paths, but they are still not found.
To make things stranger, I can build the project to a simulator or device, but when I try to run an individual test, I get clang or missing file error for the libraries/frameworks shown in red.
As it turns out, the reason for my errors was that I had not run "Build for Testing" before trying to run the individual Unit Tests. As such, the proper library dependencies had not been generated.

Jenkins Xcode build arguments to change the application name

I've got a phonegap project that is getting built via Jenkins via the Xcode plugin. After the project is built, I'm using the TestFlight plugin to upload it there. Everything works great.
Now, I need to add two more versions of this for our different environments so I'll have a Dev and Test version (and also Prod, but not to TestFlight).
In order to do this, I need to change the name of the application so both Dev and Test show up in TestFlight, MyProgram-Dev, and MyProgram-Test. Then the production version would just be MyProgram.
In the xcode section on Jenkins, there's a "custom xcodebuild arguments" field that can be filled out, which I'm assuming is where I need to make my changes. I want to do this at build time because I don't want the program name to change when merging Dev into Test, etc.
I've done alot of googling and can't find any example command line parameters for the xcode build process. Is it the CFBundle that I need to be changing? What is the name of the parameter to change?
Edit: So I was able to change the production name via 'PRODUCT_NAME=MyProject-Test', but that produced the following error:
The following build commands failed:
Ld /Users/buildaccount/Library/Developer/Xcode/DerivedData/MyProject-cpvmaiwadviebmbhkdggxpzejddf/Build/Intermediates/MyProject.build/Release-iphoneos/MyProject.build/Objects-normal/armv7/MyProject-Test normal armv7
Wow, that took alot of googling and testing.
Here's what was the eventual fix for my scenario. It was a combination of this post/answer, as well as this one.

Specifying a subproject's Configuration in Xcode

I have an Xcode project (A) referencing another project (B). By default (as far as I understand it) Xcode will implicitly build the configuration for the B dependency that matches the configuration of the A's target (e.g., "Debug"). But what if I want, say, A to build as "Debug" and the B to build as "Release"? How would I go about specifying that in Xcode?
I don't know of any easy approach, but you can brute-force it by calling xcodebuild directly for the dependency with a "Run Script" build phase.
I know it was just an example, but if your real goal is that the sub-project be a Release (no symbols) build, then you may have a better experience by just building the sub-project into a library or framework and checking the resulting binary into your version control system. Whenever I have a piece of the system that seldom changes and that I don't want debug symbols for, I go ahead and build it as a static library and check it in. I often go ahead and move the code elsewhere as well (with a README file with the .a that says where the code is and how it was built). This saves time on both build and checkout and is invaluable for large projects in my experience.
This might help: if the configuration of the project A is not found, Xcode will build Release config as a fallback (or maybe the first config of the list).
Then you can "force" the link using this tip: Xcode custom build configuration causes "library/file not found" for static libraries
Yes, this is not naturally supported by Xcode; when you build a target, it builds one configuration of itself and of all dependent targets.
The workaround, as Rob mentioned, is to have a dependent target that's an Aggregate Target type that comprises a single Run Script build phase, which simply invokes xcodebuild -configuration Release (or whatever).
You can specify the default 'fallback' configuration in the project info.
Change from:
Use 'Release' for command-line builds.
to:
Use 'Debug' for command-line builds.
And default will be 'Debug'.
Diffs of project file:

Resources