diff options
author | Steven Knight <knight@baldmt.com> | 2005-08-12 11:58:49 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-08-12 11:58:49 (GMT) |
commit | 62b1b28dd7e952eb3d9910feb39fde8f02dd5dfa (patch) | |
tree | 633bc514ecb582b328f0bb9a9ae0f9a8a0f8f133 | |
parent | 33f2e8d10b3f0334ab37ffb72bc4a282221dade6 (diff) | |
download | SCons-62b1b28dd7e952eb3d9910feb39fde8f02dd5dfa.zip SCons-62b1b28dd7e952eb3d9910feb39fde8f02dd5dfa.tar.gz SCons-62b1b28dd7e952eb3d9910feb39fde8f02dd5dfa.tar.bz2 |
Add Framework support for Mac OS X. (Greg Noel) Document it. (Gary Oberbrunner)
-rw-r--r-- | doc/man/scons.1 | 59 | ||||
-rw-r--r-- | src/CHANGES.txt | 14 | ||||
-rw-r--r-- | src/RELEASE.txt | 7 | ||||
-rw-r--r-- | src/engine/SCons/Tool/applelink.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/Tool/applelink.xml | 84 | ||||
-rw-r--r-- | src/engine/SCons/Tool/c++.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/cc.py | 13 | ||||
-rw-r--r-- | src/engine/SCons/Tool/gnulink.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/link.py | 4 | ||||
-rw-r--r-- | test/ToolSurrogate.py | 2 | ||||
-rw-r--r-- | test/gnutools.py | 10 |
11 files changed, 186 insertions, 23 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1 index 76fc705..6e690a2 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -5711,11 +5711,66 @@ The default list is: A function that converts a file name into a File instance relative to the target being built. +.IP FRAMEWORKPATH +On Mac OS X with gcc, +a list containing the paths to search for frameworks. +Used by the compiler to find framework-style includes like +#include <Fmwk/Header.h>. +Used by the linker to find user-specified frameworks when linking (see +$FRAMEWORKS). +For example: +.ES + env.AppendUnique(FRAMEWORKPATH='#myframeworkdir') +.EE +.IP +will add +.ES + ... -Fmyframeworkdir +.EE +.IP +to the compiler and linker command lines. + +.IP _FRAMEWORKPATH +On Mac OS X with gcc, an automatically-generated construction variable +containing the linker command-line options corresponding to FRAMEWORKPATH. + +.IP FRAMEWORKPATHPREFIX +On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH entries. +(see $FRAMEWORKPATH). +The default value is +.BR -F . + +.IP FRAMEWORKPREFIX +On Mac OS X with gcc, +the prefix to be used for linking in frameworks +(see $FRAMEWORKS). +The default value is +.BR -framework . + +.IP FRAMEWORKS +On Mac OS X with gcc, a list of the framework names to be linked into a +program or shared library or bundle. +The default value is the empty list. +For example: +.ES + env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration')) +.EE + +.IP _FRAMEWORKS +On Mac OS X with gcc, +an automatically-generated construction variable +containing the linker command-line options +for linking with FRAMEWORKS. + .IP FRAMEWORKSFLAGS -On Mac OS X, -frameworks options to be added at +On Mac OS X with gcc, +general user-supplied frameworks options to be added at the end of a command line building a loadable module. +(This has been largely superceded by +the $FRAMEWORKPATH, $FRAMEWORKPATHPREFIX, +$FRAMWORKPREFIX and $FRAMEWORKS variables +described above.) .IP GS The Ghostscript program used to convert PostScript to PDF files. diff --git a/src/CHANGES.txt b/src/CHANGES.txt index cbc0a72..9ef394c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -311,6 +311,10 @@ RELEASE 0.97 - XXX - Add a --raw argument to the sconsign script, so it can print a raw representation of each entry's NodeInfo dictionary. + From Chen Lee: + + - Handle Visual Studio project and solution files in Unicode. + From Wayne Lee: - Avoid "maximum recursion limit" errors when removing $(-$) pairs @@ -368,6 +372,14 @@ RELEASE 0.97 - XXX value directory; avoiding slowing substitution logic when there's no '$' in the string. + From Greg Noel: + + - Add construction variables to support frameworks on Mac OS X: + $FRAMEWORKS, $FRAMEWORKPREFIX, $FRAMEWORKPATH, $FRAMEWORKPATHPREFIX. + + - Re-order link lines so the -o option always comes right after the + command name. + From Gary Oberbrunner: - Add an Environment.Dump() method to print the contents of a @@ -418,6 +430,8 @@ RELEASE 0.97 - XXX - Add support for Intel C++ beta 9.0 (both 32 and 64 bit versions). + - Document the new $FRAMEWORK* variables for Mac OS X. + From Chris Pawling: - Have the linkloc tool use $MSVS_VERSION to select the Microsoft diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 5b95aa7..d55c7a4 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -137,6 +137,13 @@ RELEASE 0.97 - XXX converting signature information from .sconsign files written by SCons versions prior to 0.96 has been removed. + -- ORDER OF -o FLAGS ON CERTAIN LINK COMMAND LINES HAS CHANGED + + The -o flag that specifies an output file has been moved on + certain linker command lines to place it consistently after + the link command itself. This will cause recompilation + of target files created by these changed lines. + -- CACHED Configure() RESULTS ARE STORED IN A DIFFERENT FILE The Configure() subsystem now stores its cached results in a diff --git a/src/engine/SCons/Tool/applelink.py b/src/engine/SCons/Tool/applelink.py index 87c92d4..a65a4af 100644 --- a/src/engine/SCons/Tool/applelink.py +++ b/src/engine/SCons/Tool/applelink.py @@ -42,16 +42,20 @@ def generate(env): Environment.""" gnulink.generate(env) + env['FRAMEWORKPATHPREFIX'] = '-F' + env['_FRAMEWORKPATH'] = '${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, "", __env__)}' + env['_FRAMEWORKS'] = '${_concat("-framework ", FRAMEWORKS, "", __env__)}' + env['LINKCOM'] = env['LINKCOM'] + ' $_FRAMEWORKPATH $_FRAMEWORKS' env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -dynamiclib') + env['SHLINKCOM'] = env['SHLINKCOM'] + ' $_FRAMEWORKPATH $_FRAMEWORKS' # override the default for loadable modules, which are different # on OS X than dynamic shared libs. echoing what XCode does for # pre/suffixes: env['LDMODULEPREFIX'] = '' env['LDMODULESUFFIX'] = '' - env['LDMODULE'] = '$SHLINK' env['LDMODULEFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -bundle') - env['LDMODULECOM'] = '$LDMODULE $LDMODULEFLAGS -o ${TARGET} $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $FRAMEWORKSFLAGS' + env['LDMODULECOM'] = '$LDMODULE -o ${TARGET} $LDMODULEFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $_FRAMEWORKPATH $_FRAMEWORKS $FRAMEWORKSFLAGS' diff --git a/src/engine/SCons/Tool/applelink.xml b/src/engine/SCons/Tool/applelink.xml index d839be0..13eea31 100644 --- a/src/engine/SCons/Tool/applelink.xml +++ b/src/engine/SCons/Tool/applelink.xml @@ -1,11 +1,87 @@ -<!-- __COPYRIGHT__ --> -<cvar name="FRAMEWORKSFLAGS"> +<!-- Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation --> +<cvar name="FRAMEWORKSFLAGS">"> <summary> -On Mac OS X, -frameworks options to be added at +On Mac OS X with gcc, +general user-supplied frameworks options to be added at the end of a command line building a loadable module. +(This has been largely superceded by +the &cv-FRAMEWORKPATH;, &cv-FRAMEWORKPATHPREFIX;, +&cv-FRAMEWORKPREFIX; and &cv-FRAMEWORKS; variables +described above.) </summary> </cvar> +<cvar name="FRAMEWORKS"> +<summary> +On Mac OS X with gcc, a list of the framework names to be linked into a +program or shared library or bundle. +The default value is the empty list. +For example: + +<example> + env.AppendUnique(FRAMEWORKS=Split('System Cocoa SystemConfiguration')) +</example> + +</summary> +</cvar> + +<cvar name="FRAMEWORKPREFIX"> +<summary> +On Mac OS X with gcc, +the prefix to be used for linking in frameworks +(see &cv-FRAMEWORKS;). +The default value is +<option>-framework</option>. +</summary> +</cvar> + +<cvar name="_FRAMEWORKS"> +<summary> +On Mac OS X with gcc, +an automatically-generated construction variable +containing the linker command-line options +for linking with FRAMEWORKS. +</summary> +</cvar> + +<cvar name="FRAMEWORKPATH"> +<summary> +On Mac OS X with gcc, +a list containing the paths to search for frameworks. +Used by the compiler to find framework-style includes like +#include <Fmwk/Header.h>. +Used by the linker to find user-specified frameworks when linking (see +&cv-FRAMEWORKS;). +For example: + +<example> + env.AppendUnique(FRAMEWORKPATH='#myframeworkdir') +</example> + +will add + +<example> + ... -Fmyframeworkdir +</example> + +to the compiler and linker command lines. +</summary> +</cvar> +<cvar name="FRAMEWORKPATHPREFIX"> +<summary> +On Mac OS X with gcc, the prefix to be used for the FRAMEWORKPATH entries. +(see &cv-FRAMEWORKPATH;). +The default value is +<option>-F</option>. +</summary> +</cvar> + +<cvar name="_FRAMEWORKPATH"> +<summary> +On Mac OS X with gcc, an automatically-generated construction variable +containing the linker command-line options corresponding to +&cv-FRAMEWORKPATH;. +</summary> +</cvar> diff --git a/src/engine/SCons/Tool/c++.py b/src/engine/SCons/Tool/c++.py index 90b01ae..a44fa6d 100644 --- a/src/engine/SCons/Tool/c++.py +++ b/src/engine/SCons/Tool/c++.py @@ -70,10 +70,10 @@ def generate(env): env['CXX'] = 'c++' env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['CXXCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + env['CXXCOM'] = '$CXX -o $TARGET -c $CXXFLAGS $_CCCOMCOM $SOURCES' env['SHCXX'] = '$CXX' env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + env['SHCXXCOM'] = '$SHCXX -o $TARGET -c $SHCXXFLAGS $_CCCOMCOM $SOURCES' env['CPPDEFPREFIX'] = '-D' env['CPPDEFSUFFIX'] = '' diff --git a/src/engine/SCons/Tool/cc.py b/src/engine/SCons/Tool/cc.py index 8fb9e26..c4114b7 100644 --- a/src/engine/SCons/Tool/cc.py +++ b/src/engine/SCons/Tool/cc.py @@ -52,12 +52,21 @@ def generate(env): static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter) + env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS' + # It's a hack to test for darwin here, but the alternative of creating + # an applecc.py to contain this seems overkill. Maybe someday the Apple + # platform will require more setup and this logic will be moved. + env['FRAMEWORKS'] = SCons.Util.CLVar('') + env['FRAMEWORKPATH'] = SCons.Util.CLVar('') + if env['PLATFORM'] == 'darwin': + env['_CCCOMCOM'] = env['_CCCOMCOM'] + ' $_FRAMEWORKPATH' + env['CC'] = 'cc' env['CCFLAGS'] = SCons.Util.CLVar('') - env['CCCOM'] = '$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + env['CCCOM'] = '$CC -o $TARGET -c $CCFLAGS $_CCCOMCOM $SOURCES' env['SHCC'] = '$CC' env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + env['SHCCCOM'] = '$SHCC -o $TARGET -c $SHCCFLAGS $_CCCOMCOM $SOURCES' env['CPPDEFPREFIX'] = '-D' env['CPPDEFSUFFIX'] = '' diff --git a/src/engine/SCons/Tool/gnulink.py b/src/engine/SCons/Tool/gnulink.py index 6276fbe..dbd0c54 100644 --- a/src/engine/SCons/Tool/gnulink.py +++ b/src/engine/SCons/Tool/gnulink.py @@ -45,13 +45,11 @@ def generate(env): if env['PLATFORM'] == 'hpux': env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared -fPIC') - elif env['PLATFORM'] == 'darwin': - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -dynamiclib') # __RPATH is set to $_RPATH in the platform specification if that # platform supports it. env.Append(LINKFLAGS=['$__RPATH']) - env['RPATHPREFIX'] = '-Wl,--rpath=' + env['RPATHPREFIX'] = '-Wl,-rpath=' env['RPATHSUFFIX'] = '' env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' diff --git a/src/engine/SCons/Tool/link.py b/src/engine/SCons/Tool/link.py index 5188634..b9fb71d 100644 --- a/src/engine/SCons/Tool/link.py +++ b/src/engine/SCons/Tool/link.py @@ -51,14 +51,14 @@ def generate(env): env['SHLINK'] = '$LINK' env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') - env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + env['SHLINKCOM'] = '$SHLINK -o $TARGET $SHLINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' # don't set up the emitter, cause AppendUnique will generate a list # starting with None :-( #env['SHLIBEMITTER']= None env['SMARTLINK'] = smart_link env['LINK'] = "$SMARTLINK" env['LINKFLAGS'] = SCons.Util.CLVar('') - env['LINKCOM'] = '$LINK $LINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + env['LINKCOM'] = '$LINK -o $TARGET $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' env['LIBDIRPREFIX']='-L' env['LIBDIRSUFFIX']='' env['_LIBFLAGS']='${_stripixes(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, LIBPREFIX, LIBSUFFIX, __env__)}' diff --git a/test/ToolSurrogate.py b/test/ToolSurrogate.py index fa13b57..527e3d3 100644 --- a/test/ToolSurrogate.py +++ b/test/ToolSurrogate.py @@ -87,7 +87,7 @@ env.Program('foo.c') test.write('foo.c', "foo.c posix\n") test.run(arguments = '. platform=posix', stdout = test.wrap_stdout("""\ -cc -c -o foo.obj foo.c +cc -o foo.obj -c foo.c cc -o foo.exe foo.obj """)) diff --git a/test/gnutools.py b/test/gnutools.py index d5173ee..82c83ef 100644 --- a/test/gnutools.py +++ b/test/gnutools.py @@ -128,16 +128,16 @@ def testObject(test, obj, command, flags): if sys.platform == 'cygwin': fpic = '' else: - fpic = '-fPIC ' + fpic = ' -fPIC' test.fail_test(not testObject(test, 'cfile1.o', 'gcc', '-c') or not testObject(test, 'cfile2.o', 'gcc', '-c') or not testObject(test, 'cppfile1.o', 'g++', '-c') or not testObject(test, 'cppfile2.o', 'g++', '-c') or - not testObject(test, 'cfile1.os', 'gcc', fpic + '-c') or - not testObject(test, 'cfile2.os', 'gcc', fpic + '-c') or - not testObject(test, 'cppfile1.os', 'g++', fpic + '-c') or - not testObject(test, 'cppfile2.os', 'g++', fpic + '-c') or + not testObject(test, 'cfile1.os', 'gcc', '-c' + fpic) or + not testObject(test, 'cfile2.os', 'gcc', '-c' + fpic) or + not testObject(test, 'cppfile1.os', 'g++', '-c' + fpic) or + not testObject(test, 'cppfile2.os', 'g++', '-c' + fpic) or not testObject(test, 'c-only' + _exe, 'gcc', '') or not testObject(test, 'cpp-only' + _exe, 'g++', '') or not testObject(test, 'c-and-cpp' + _exe, 'g++', '') or |