[m-rev.] for review: improve support for using frameworks on Mac OS X
Julien Fischer
juliensf at csse.unimelb.edu.au
Wed Oct 6 14:26:30 AEDT 2010
On Wed, 6 Oct 2010, Ian MacLarty wrote:
> On Wed, Oct 06, 2010 at 01:21:14PM +1100, Julien Fischer wrote:
>>
>> For review by Ian.
>>
>> Improve support for building and linking against frameworks on Mac OS X
>> by providing mmc command line options that allow which framework(s) to
>> build against to be specified directly.
>>
>> compiler/options.m:
>> Add a new option, --framework, that causes an executable
>> or library to be linked against the framework specified
>> by the argument.
>>
>> Add new option, --framework-directory, that appends a new
>> framework search directory to the current set of framework
>> search directories. (The short for of the option is -F;
>
> s/for/form/
Fixed.
>
>> the reason for using this is that if the linker emits warnings
>> about the framework search directories, then it will refer
>> to the option by that name.)
>>
>> compiler/compile_target_code.m:
>> Pass the framework search directories to both the C compiler
>> and the linker. (They need to go the C compiler so that it
>
> to go to
Fixed.
>> Index: compiler/compile_target_code.m
>> ===================================================================
>> RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
>> retrieving revision 1.160
>> diff -u -r1.160 compile_target_code.m
>> --- compiler/compile_target_code.m 30 Sep 2010 07:23:31 -0000 1.160
>> +++ compiler/compile_target_code.m 6 Oct 2010 02:13:46 -0000
>> @@ -437,6 +437,9 @@
>> C_Incl_Dirs),
>> InclOpt = string.append_list(list.condense(list.map(
>> (func(C_INCL) = ["-I", quote_arg(C_INCL), " "]), C_Incl_Dirs))),
>> +
>> + get_framework_directories(Globals, FrameworkInclOpt),
>> +
>> globals.lookup_bool_option(Globals, highlevel_code, HighLevelCode),
>> (
>> HighLevelCode = yes,
>> @@ -889,7 +892,8 @@
>> % listed after CFLAGS.
>> %
>> string.append_list([
>> - SubDirInclOpt, InclOpt,
>> + SubDirInclOpt, InclOpt, " ",
>> + FrameworkInclOpt, " ",
>> OptimizeOpt, " ",
>> HighLevelCodeOpt,
>> NestedFunctionsOpt, @@ -1885,6 +1889,9 @@
>> get_runtime_library_path_opts(Globals, LinkTargetType,
>> RpathFlagOpt, RpathSepOpt, RpathOpts),
>>
>> + % Set up any framework search paths.
>> + get_framework_directories(Globals, FrameworkDirectories),
>> +
>> % Set up the install name for shared libraries.
>> globals.lookup_bool_option(Globals, shlib_linker_use_install_name,
>> UseInstallName),
>> @@ -1913,6 +1920,7 @@
>> globals.lookup_string_option(Globals, TraceFlagsOpt, TraceOpts)
>> ),
>>
>> + get_frameworks(Globals, Frameworks),
>> get_link_libraries(Globals, MaybeLinkLibraries, !IO),
>> globals.lookup_string_option(Globals, linker_opt_separator, LinkOptSep),
>> (
>> @@ -1961,8 +1969,10 @@
>> LinkOptSep, " ",
>> LinkLibraryDirectories, " ",
>> RpathOpts, " ",
>> + FrameworkDirectories, " ",
>> InstallNameOpt, " ",
>> DebugOpts, " ",
>> + Frameworks, " ",
>> LDFlags, " ",
>> LinkLibraries, " ",
>> MercuryStdLibs, " ",
>> @@ -2400,6 +2410,34 @@
>> MadeSymlinkOrCopy = no
>> ).
>>
>> +:- pred get_framework_directories(globals::in, string::out) is det.
>> +
>> +get_framework_directories(Globals, FrameworkDirs) :-
>> + globals.lookup_accumulating_option(Globals, framework_directories,
>> + FrameworkDirs0),
>> + (
>> + % Short-circuit the common case.
>> + FrameworkDirs0 = [],
>> + FrameworkDirs = ""
>
> Is this optimisation really necessary?
No - when I started working on this change there was a bit more going on
in the other branch. I've removed it the above (in both cases).
> I mean this code is only going
> to get called once per module isn't it?
Yes.
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list