AquaBuild/Cocoa Informations
From OpenOffice.org Wiki
This page documents the steps required to use the Mac OS X Cocoa Runtime Environment and Objective-C++ to program the Aqua Mac OS X port of OOo
These are draft changes, yet to be verified!
Contents |
Changes to MakeFiles
IMPORTANT: make the changes in solenv can currently lead to garbage in some modules, and the build is broken (e.g. testshl2 )
The most simple, waiting we decide a complete strategy, is to add what follows in the makefiles of the modules where you added Cocoa changes.
In <module>/<your_tree>/unxmacx.mk, add the "-x-objective-c++" flag to CFLAGSCXX, in a new conditional section under Compilation Flags after the definition of CFLAGSCXX like this:
[c++,N]
.IF "$(GUIBASE)" == "aqua"
CFLAGSCXX+=-x objective-c++ -fobjc-exceptions
.ENDIF
And if you encounter linking issues, add "LINKFLAGS+=-framework Cocoa" flag to LINKFLAGSDEFS, in the conditional section right under "LINKFLAGS+=-lobjc"
[c++,N]
.IF "$(GUIBASE)" == "aqua"
LINKFLAGS+=-framework Cocoa
# Sometimes we still use files that would be in a GUIBASE="unx" specific directory
# because they really aren't GUIBASE specific, so we've got to account for that here.
INCGUI+= -I$(PRJ)$/unx/inc
.ENDIF
Changes to Header Files
Add the following to include Carbon and Cocoa :
[c++,N]
- include <premac.h>
- include <Carbon/Carbon.h>
- import <Cocoa/Cocoa.h>
- include <postmac.h>
Changes to Source Files
Anything besides the Cocoa code? Some additions to the OOo C++ style guide perhaps?
Current Open Issues
I have a conflict with the String class when using the -x objective-c++ switch. Can this be fixed by adding the String class to premac.h and postmac.h?
I found that I needed to put a call to NSApplicationLoad to get the Spellcheck code to run. Is there a problem with multiple calls to NSApplicationLoad?
Cocoa migration: changelog
- AquaPortCocoa/Changelog -> understand the work in progress
Important Links
Pierre Chatelier page about C++ to Cocoa conversion
Notes: .pdf available in both english and french versions. Excellent.
Categories: MacOSX | Porting | Development | Aqua | Build System

