Can I use OpenFrameworks on OS X without having to use XCode?
Asked Answered
B

5

12

I can't stand XCode, but really love OpenFrameworks, and I know it works on Linux+Win32 so I don't see why it should be XCode dependent. If I need to have XCode installed that's fine, I just don't want to use it at all.

Blub answered 14/5, 2012 at 15:25 Comment(1)
I want to know this too. I just put a bounty on it... detailed instructions appreciated.Endres
M
11

Xcode internally uses gcc/llvm. in fact from the command line you can cd into a directory that contains an openFrameworks project and just type xcodebuild. but this won't allow you to edit the project file and add new source code, etc.

the Linux makefiles could be adapted to work on OSX as well. they already contain a lot of the information necessary about finding the correct source files, library paths etc. however Linux allows us to install many more components as shared system libraries, while on OSX we link most of the libs statically, so a number of extra library paths would need to be added. probably the biggest gotcha is that everything has to be compiled 32 bit, which means passing -arch i386 everywhere, so you can't just install dependant libs using Homebrew or MacPorts. we are in the process of transitioning to 64 bit but there are still some QuickTime calls that require us to stick with 32 bit, mainly around accessing legacy video capture devices that a lot of us still use for computer vision.

like @cdelacroix points out, we only maintain Xcode project files on OSX. this is mainly due to the lack of a decent alternative. there is a version of Code::Blocks for OSX but it is not very well supported, has some issues with native gui rendering and tends to lag behind the other platforms. Xcode is also the easiest way to install a toolchain on OSX so for most users installing Xcode is necessary.

if you do get a makefile based build system working, and would be interested in maintaining it medium to long term, please consider contributing it to the GitHub repository, it would be gladly accepted.

Mindi answered 16/6, 2012 at 11:49 Comment(2)
Thanks for the info. I use emacs for everything, so I would prefer not to be tied to an IDE on either the osx or the linux versions. I'm more comfortable with the gnu toolchain than xcode, so personally I would prefer not to have to switch development environments just to use OF. It clearly shouldn't be that hard, I just wish there was more documentation on working outside IDEs.Endres
Thie Linux makefiles are actually very smart, they use shell calls to find to find arc files, libs and header search paths. openFrameworks is a complex system, especially with the addons concept, there is an addons.make file that is parsed on linux to find addons but this isn't used on OSX. Not sure what other information you need. OF is designed to be easy for beginning programmers and all the core team use IDEs, but as I said contributions are always welcome.Mindi
F
5

As of March 2013, openFrameworks has official makefile support for compiling the library itself. However, at the time of this writing, the changes haven't yet been merged into the stable release. You'll need to clone the Git repository and switch to the development branch.

git clone https://github.com/openframeworks/openFrameworks
cd openFrameworks && git checkout develop
cd libs/openFrameworksCompiled/project
make

As far as I can tell, we still need to use the unofficial solutions for compiling apps against the library.

Fullscale answered 24/4, 2013 at 17:1 Comment(1)
Minor correction: you want to checkout 'develop' and not 'development'. Thanks so much for this!Jesselyn
E
2

You need Xcode, or at least a set of compilers (more information is available here), but otherwise, no, you can edit/work with the code in whatever editor or environment you want.

Extraversion answered 14/5, 2012 at 16:21 Comment(0)
G
2

Here's a link to a makefile which will compile an OpenFrameworks application on OsX:

https://gist.github.com/labe-me/1190981

Place the makefile in the apps' directory and run make. Tested on OsX 10.6, but haven't tried with addons yet.

Gayn answered 27/3, 2013 at 9:4 Comment(0)
I
1

As @mipadi said, there is no requirement to actually use Xcode, you can do pretty much everything you do in Xcode with make or cake or any of your build system of choice. All you have to do is find the right set of command line options to pass to the usual tools (compiler, linker, strip, etc.), and sometimes the easier way is to... look in the Xcode build window how it is doing stuff (expand the lines with the small button on the right of each line).

For example you can link with your framework of choice with ld -framework Framework -FPathToFramework foo.o or your dynamic library with ld -lLib -LPathToDylib foo.o. You might have to learn about @rpath, @loader_path and install_name_tool to ship a self-contained packaged application.

As for OpenFrameworks, the "requirement" for Xcode is that the authors decided to maintain only Xcode project files. I just looked at how they do it, they ship source code and Xcode project files that build static libraries, so it will be even more simple for you (although you will need to link the library dependencies by hand). You will have to choose between compiling everything from source in your build system (if you want more customization power without touching Xcode), or just produce the 2 static libraries (openFrameworks.a and openFrameworksDebug.a) with Xcode once, then use them in your build system (recommended until you really need continuous customization).

Islean answered 15/6, 2012 at 23:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.