Xcode Plugin for Win32 c/c++ compiler


Plugin screen capture
Full size image with Xcode 2.5
Win32Plugin gives Xcode, Apple's development environment, the possibility to fully drive a GNU c/c++ cross-compiler for MSWindows (95 and above). Win32Plugin works with versions 2.5, 3.1.*, and 3.2 of Xcode.

Win32Plugin allows a single Xcode project to build executables for MacOS X and MSWindows platforms.

Plugin screen capture
Full size image with Xcode 3.1.1

Installation

Usage

For your first use of Win32Plugin, download this Xcode project hello that contains 4 targets for MacOS X, Darwin + X11, and MSWindows, with the same source file. Targets 25helloWin32 and 3.xhelloWin32 are to be used with Xcode 2.5 and 3 respectively. Quit and restart Xcode for it to load the plugin. If using Xcode 3, delete target 25helloWin32, and conversely for Xcode 2.5. You should be able to build each of the 3 remaining targets. The xxhelloWin32 target will produce a working MSWindows executable program.

The easiest would be to modify the hello Xcode project by adding more elaborate source files, and possibly pre-compiled libraries. This project contains FLTK 1.1.8 header files and libraries for MacOS X, Darwin+X11, MSWindows. You can replace them by your own, or by other FLTK versions.

Alternatively, add a Win32 target to an existing project of yours by the "New target..." command, or create a new Win32 project by the "New project..." command. The Assistant window allows to choose Win32 program or library. Add the relevant c/c++ source files to the newly created win32 target. After that, open the Info window of this target, go to the Rules view, and modify the System C rule: change "using: GCC System Version (4.0)" into "using: Win32 C/C++". Next, go to the Build view, and set the compiler & linker settings, namely header and library search paths and Win32Plugin's own ones (see table below).

MSWindows system libraries (e.g., ole32.dll) can be added to your target as follows:

Win32Plugin can produce and use libraries as well as executables.

Win32Plugin's compiler and linker settings (for Xcode 3.1/3.2)

Use HEADER_SEARCH_PATHS and LIBRARY_SEARCH_PATHS as with Mac OS X targets.
Setting "Base SDK" from section "Architectures" must be set to "Current Mac OS".
Win32Plugin-specific settingsUsage
GCC_GENERATE_DEBUGGING_SYMBOLSwhen on, adds "-g" to compilation and link operations
OPTIMIZEto add "-O1", "-O2", or "-O3" to compilations
WARNING_AS_ERRORwhen on, adds "-Werror" to compilations
ALL_WARNINGSwhen on, adds "-Wall" to compilations
OTHER_WIN32_FLAGSto add any additional options to compilations
USE_WIN32_GUIwhen on, adds "-mwindows" to the link command
WIN32_SYSTEMLIBSset this to "-Wl,-lname1,-lname2,..." to link with named system libraries
OTHER_WIN32_LDFLAGSto add any additional options to the link command

Acknowledgements

Many thanks to Damien Bobillot for his Xcode Plugins.