lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Thanks for the offer. I have already done some work on the Xcode (most recent version) build settings. I put them below. If you differ in opinion on some of these settings, I will be glad to hear.
The thing I would like to happen is, having the Lua (test) script being executed in the console window instead of in the build window. The "Build and Go" button is grayed out, presumably because the template is for a library, which inherently is not an executable in the direct sense.

Hans van der Meer

Template for compiling Lua C-modules in XCode

Start with the template BSD Dynamic Library.

Set Mach-O Type to
1. bundle (mh_bundle)
this requires emptying of the following two shell variables:
Compatibility Version
Current Library Version
2. dynamic library (mh_dylib)

Set Other Linker Flags to: -undefined dynamic_lookup

Set Executable Extension to: so
I did not succeed in emptying the Executable Prefix (default = lib)

Set Header Serach Path to /usr/local/include/** (** from recursive)

Placing the product in the main project directory requires adddition of a new setting:

For debugging set Preprocessor Macros Not Used in Precompiler to: TRACE

Addtional changes:
1. compiling c only
2. language dialect ANSI-C

Add a final shell script phase containing:
mv lib<product>.so <product>.so
/usr/local/bin/lua testfile

On 4 jul 2009, at 00:30, Geoff Leyland wrote:

On 4/07/2009, at 3:17 AM, Hans van der Meer wrote:

Working on a Macintosh under MacOSX I am trying to get the XCode build settings in shape for compilation of a Lua C-module into; starting with the XCode-template for a BSD dynamic library.

Having read the instructions for using make I have the following question:

Why does one prescribe for the Mach-O Type the choice "bundle" (mh_bundle) instead of "dynamic library" (mh_dylib). Both seem to work when the result is "require"-ed. Does it matter? Or is there a fundamental difference I am overlooking?

I've got an XCode template for a lua plugin that you could use if you want.  It's not much, but it took me a while to work out how to make a template, so it might save you some time.