Setting up sample project for other developers Xcode - xcode

So I am trying to set up a sample project that includes all of the search headers for distributing to other developers.
My plan is to have the folder structure something like this when the developer unzips the project:
/SDKandSample
/SDKandSample/SDK
/SDKandSample/SampleProject
How can I have xcode link to the correct SDK folder regardless of where the folder is stored?

You can set up a workspace that includes two projects. One project is your framework / library. And the other is your example project. The example project will link to your framework / library. Check out this project for an example.
If you're wondering how to create file paths in build settings that reference the project root:
$(SRCROOT)/MyDirectory/MyFile.ext

Related

Xcode Framework Search Paths not finding frameworks outside project directory

In a large monorepo of Cocoapod projects I have the following directory structure.
Project
Common
Foo.Framework
First Project
Project.Xcode
Second Project
Project.Xcode
The goal is that there are multiple Cocoapod projects and rather than have the same framework copied in multiple places within the First and Second project, I'd rather have it once in a Common folder in the parent directory, and then drag it into the project and set the framework search paths.
So I'm running into an issue where the linker cannot find the Foo.framework.
What should I set the framework search path to so that it correctly finds the framework.
If I include the framework inside the Project directories it doesn't run into any issues.
I had the same issue and solved it like following:
Go to Build Settings
Find the "Framework Search Paths"
Add $(PROJECT_DIR)/../your_directory
Use the recursive flag if the framework file isn't in the exact directory you selected)

How to run a specific project when you have multiple projects in xcode?

If you have a xcode project like restkit that has the core code for restkit + examples that have their own project, how do you run a specific project?
https://github.com/RestKit/RestKit/
If you look at the /Example's folder, you will see they have a few of them and each have their own project file.
You can use multiple targate in xcode.
A target specifies a product to build and contains the instructions
for building the product from a set of files in a project or
workspace. A target defines a single product; it organizes the inputs
into the build system—the source files and instructions for processing
those source files—required to build that product. Projects can
contain one or more targets, each of which produces one product.

Include another xcode project into my own

How can I include a project (is standalone) into my project and launch it from within my own app? What are the requiered steps so that my current project recognizes all the sourcecode from the other project?
If you are intending to run an application unmodified from another application, you can't do this. iOS expects you to have one application executable with one entry point and one app delegate.
If you have a library in source form that you would like to include in your project, you can simply drag the files into Xcode while your project is open.
If you drag an Xcode project file into the project navigator sidebar it will be added to the project setup.
You will need to configure import paths and other things in order to access code though.
If you are trying to use 3rd party libraries, I strongly recommend having a look at CocoaPods. It's really easy to set up and manages dependencies with all of their build settings for you.

How can I set up my project hierarchy in QtCreator?

I'm quite new to QtCreator, so perhaps I left my heart in eclipse-ville, but I can't for the life of me understand how I should be setting up a project hierarchy in QtCreator. I understand there is an option to create a kind of root project and then from there add sub-projects to it, which makes sense but it leaves me wondering whether or not this is necessary at the time of creating the project, e.g. can I just create a library in one project and reference it later by another project?
I've tried setting up a blanket type of project by creating a new subdirs project and then adding the main program as a subproject, but then how should I add my library project?
Ideally, I'd like to create one project as the main application and reference another project as a library. Help?
The documentation of Qt Creator contains two sections that may help you find the answers to your questions:
Adding Subprojects to Projects
Adding Libraries to Projects
EDIT:
You can find a really simple sample project here: QtSymbianDllExample. "It is intended to demonstrate how to create and use a DLL with Qt on the Symbian platform". It is a sample for Symbian development but that is irrelevant now, I do not have a Symbian phone. What is important is that it contains a root project (QtSymbianDllExample\qtssymbiandllexample.pro) and two subprojects (QtSymbianDllExample\qtenginedll\qtenginedll.pro, QtSymbianDllExample\testui_simpledllengine\testui_simpledllengine.pro) which you can examine and compare to you projects. I have checked that I can build the root project by doing the following steps:
Download and install the Windows Offline Installer from http://www.qt.io/download/
Download and extract QtSymbianDllExample.zip
Run Qt Creator
File / Open File or Project... Select qtssymbiandllexample.pro
Build / Run qmake
Build / Build project "qtsymbiandllexample"

How to import JSON framework?

I've downloaded the JSON framework DMG from http://code.google.com/p/json-framework/downloads/list. I followed Option 3 here: http://code.google.com/p/json-framework/wiki/InstallationInstructions. For the copy files build phase, I set path to ~/Library/Frameworks/JSON.framework. Buid failed. I then tried setting it to my project root. Build failed.
I keep getting this error:
<JSON/JSON.h>: No such file or directory
Any suggestions?
There's no need to put the framework in Library, at least under Xcode 3.1.3. Here's what you do:
Put the JSON framework source tree in your source tree.
Add the framework project to your project.
Get Info on your target, click + under the Direct Dependencies list, and choose the framework target from the framework project.
Right-click on your target in the group tree and choose “New Build Phase▶ Copy Files”. In the window that results, choose Frameworks as the destination.
Add the framework target (which will transmogrify into its build product) to the Copy Files phase.
Add the framework target (which will transmogrify) to your target's Link with Libraries phase.

Resources