Xcode confusion


#1

I’m new to XCode and confused - hoping somebody here will help me out with the project settings.

I need to port my juce application (the PILS programming language interpreter with Juce bindings) to mac.

I got a an intel dual core mini mac with XCode 3.1 (from the IPhone sdk). I checked out the Juce trunk and compiled it in debug and release mode, no sweat, the supplied project files just worked.

But I can’t find out how to set up my own project.

The tutorials I’ve found seem to concentrate on creating new projects, I haven’t found much info on how to port existing code.

On MSW, my system is a solution consisting of 3 projects: 2 static libs (the PILS interpreter kernel and a utility lib, both independent of Juce) and the exe file project which extends C++ classes defined in the interpreter kernel with wrappers for all kinds of Juce objects, and implements certain framework-dependent methods declared in the interpreter kernel, and initialises a lot of global static objects.

It runs on Linux too so the code is GCC compatible. (I used CodeBlocks for the setup, this is simular to Visual Studio and wasn’t a problem.)

My SVN trunk is organised much the same way as the Juce svn: project files are in trunk/build/platform, binaries in trunk/bin/platform, and sources in trunk/src/subproject

:?: Should I create the two juce-independent libraries as BSD static libraries? Will these be link-compatible with the main Juce app (which I understand is a Cocoa app)? Can the Juce app extend classes defined in the BSD libraries, and implement missing methods, using Cocoa? (I mean not only virtual methods, but also certain nonvirtual methods declared and used but left unimplemented in the static libs.)

:?: What are the exact steps in the XCode gui to create the project files under trunk/build/mac and have them use files under trunk/build/subproject, preferably without copying them to the build/mac folder? Do I create them as targets? Are XCode targets similar to Visual Studio projects?

:?: How should I set up the main project/target? I assume it’s a Cocoa application but when I try that, I get almost 2000 error messages resulting from precompilation of a header I don’t know I included, with objective-c code in it which fails to parse, apparently because the compiler is in C/C++ mode.

:?: I read somewhere that .mm files must be included to put GCC in mixed C++/objective-c mode, must I create these files specifially for my own project or is this handled by juce.h, or how?

:?: How are include paths specified in XCode?

:?: I read that XCode has SVN integration but I haven’t spotted any SVN commands in the menus.

Sorry if some of these questions seem trivial but I’m a newcomer to the Mac, having a hard time to find my way around this platform. Porting an app may not be the ideal first-experience with the Mac but it’s what I have to do.


#2

XCode seems pretty awful at first, though once you’ve got the hang of it, it’s only slightly awful…

I normally create a cocoa project, then immediately go in and remove all the precomiled headers, which I’ve never managed to get working. Other than that, it seems to mostly work ok. You should be able to link it to bsd libraries.

Don’t worry too much about includes or paths to source files - all of that stuff just works using relative paths. And I think the only mm file you’ll need is one to contain the juce amalgamated cpp file (if you’re using the amalgamated version)


#3

I can answer some of your question but not all of them.

if you are using any cocoa or objective c calls in the file then you would have to use .mm extension

There are three modes in xcode which you can see in the preference menu ->General tab

In condensed mode you would have a tab called target click on the arrow it would show a target there, you can either double click on it or do command + i

It would show a window titiled "Target “target name” info"
there select build and you would get a field “user header search path”

you need to put the header search path here

xcode creates a target for the project you dont have to bother about it, but if you want to add a target to the project you would have to right click on the Target button and select add-> New target

You would have to add the header search path in the project from where you want to get the sources files from

You might no be able to do it, you would have to encapsulate the cocoa classes with c++ class and re-implement the over- ridden methods in the c++ classes with cocoa class doing the work but abstraction class over-ridding. But not very sure if it would work :?


#4

Although Xcode 3 is much better than the Xcode 2 it is no where near visual studio 2005 and higher. Hopefully like me, with time you would get used to what Xcode offers. :lol:


#5

Thanks for some hints - one more question:

:?: How do I get the Subversion integration in place?

Should I check out my project from the command line (the thing called Terminal in mac) and then tell XCode to attach to it? How? Or should I check it out from within an XCode project???

Any books out there that cover this stuff? (it’s the kind of thing authors don’t find it interesting to write about)


#6

In the menu there is a option called “SCM” after debug and Design menu option, select it and select Configure SCM. It’s a very good option.


#7

I should have clarified it in a better way,
you would have to select General tab, and in the combo box next to SCM System : select the client for SVN it should be subversion (i use cvs).

Once you do that you would realize that the edit button next to the combo box is enabled, click the button you would be able to see a panel asking for svn path.
It should be /usr/local/bin/svn and click ok. Now it should work.

In the developer folder of the root drive/os drive you would find a pdf file about xcode. If it’s not available i can mail it to you.

I haven’t had much of chance to read books about xcode not even sure if they exist.