Changeset 32:4a3a1770955e
- Timestamp:
- 08/23/06 18:58:05
(2 years ago)
- Author:
- vadim@mbdsys.com
- Message:
Added Library and SharedLibrary? methods to BuildJobInfo? to further simplify Sconscripts
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r30 |
r32 |
|
| 81 | 81 | self.buildpath += "/release" |
|---|
| 82 | 82 | |
|---|
| 83 | | |
|---|
| 84 | | |
|---|
| 85 | | |
|---|
| 86 | | def Component(self, name, includes = [], libpath = [], libs = [] , uses = [], node = None): |
|---|
| | 83 | |
|---|
| | 84 | self.sharedtarget = False |
|---|
| | 85 | |
|---|
| | 86 | |
|---|
| | 87 | def Component(self, name, includes = [], libpath = [], libs = [], uses = [], node = None): |
|---|
| 87 | 88 | if self.components.has_key(name): |
|---|
| 88 | 89 | return self.components[name] |
|---|
| … | … | |
| 97 | 98 | return self.components[x] |
|---|
| 98 | 99 | |
|---|
| 99 | | newuses = [ compinfo(x) for x in uses ] |
|---|
| 100 | | |
|---|
| | 100 | if uses and len(uses): |
|---|
| | 101 | newuses = [ compinfo(x) for x in uses ] |
|---|
| | 102 | else: |
|---|
| | 103 | newuses = [] |
|---|
| | 104 | |
|---|
| | 105 | if node: |
|---|
| | 106 | self.env.Alias(name, node) |
|---|
| | 107 | |
|---|
| | 108 | if node: |
|---|
| | 109 | if len(libpath) == 0: |
|---|
| | 110 | libpath = [node[0].dir] |
|---|
| | 111 | if len(libs) == 0: |
|---|
| | 112 | libs = [name] |
|---|
| | 113 | |
|---|
| 101 | 114 | m = CompInfo(name, includes, libpath, libs, newuses, node) |
|---|
| 102 | 115 | self.components[name] = m |
|---|
| … | … | |
| 154 | 167 | def Autoconf(self, env, moduleName, outputFiles, |
|---|
| 155 | 168 | configureCommand = './configure', makeCommand = 'make', |
|---|
| 156 | | configureFiles = 'configure', makeFiles = 'Makefile'): |
|---|
| | 169 | configureFiles = 'configure', makeFiles = 'Makefile', |
|---|
| | 170 | uses = None, includes = None, libpath = None, libs = None): |
|---|
| 157 | 171 | """ |
|---|
| 158 | 172 | Build a library using autotools: configure and make. |
|---|
| 159 | 173 | |
|---|
| 160 | 174 | Algorithm: |
|---|
| 161 | | - Copy the library source directory to the build path directory |
|---|
| 162 | 175 | - Launch the configure command |
|---|
| 163 | 176 | - Launch the make command |
|---|
| … | … | |
| 187 | 200 | |
|---|
| 188 | 201 | env.Depends(make, makefile) |
|---|
| | 202 | #self.Component(moduleName, includes, libpath, libs, uses) |
|---|
| 189 | 203 | env.Alias(moduleName, [make]) |
|---|
| | 204 | |
|---|
| 190 | 205 | |
|---|
| 191 | 206 | |
|---|
| … | … | |
| 210 | 225 | |
|---|
| 211 | 226 | |
|---|
| 212 | | |
|---|
| 213 | | |
|---|
| | 227 | def Library(self, env, target, source = None, uses = [], includes = [], libpath = [], libs = [], sharedtarget = None, **kw): |
|---|
| | 228 | |
|---|
| | 229 | if sharedtarget == None: |
|---|
| | 230 | sharedtarget = self.sharedtarget |
|---|
| | 231 | |
|---|
| | 232 | |
|---|
| | 233 | self.Use(env, uses) |
|---|
| | 234 | env.AppendUnique( **kw ) |
|---|
| | 235 | if sharedtarget: |
|---|
| | 236 | obj = env.SharedObject( source = source) |
|---|
| | 237 | else: |
|---|
| | 238 | obj = env.StaticObject( source = source) |
|---|
| | 239 | |
|---|
| | 240 | |
|---|
| | 241 | lib = env.StaticLibrary( target, obj ) |
|---|
| | 242 | self.Component(target, includes = includes, libpath = libpath, libs = libs, uses = uses, node = lib) |
|---|
| | 243 | |
|---|
| | 244 | return lib |
|---|
| | 245 | |
|---|
| | 246 | |
|---|
| | 247 | def SharedLibrary(self, env, target, source, uses = [], includes = [], libpath = [], libs = [], **kw): |
|---|
| | 248 | |
|---|
| | 249 | self.Use(env, uses) |
|---|
| | 250 | env.AppendUnique( **kw ) |
|---|
| | 251 | lib = env.SharedLibrary( target, source = source ) |
|---|
| | 252 | self.Component(target, includes = includes, libpath = libpath, libs = libs, uses = uses, node = lib) |
|---|
| | 253 | |
|---|
| | 254 | return lib |
|---|
| | 255 | |
|---|
| r22 |
r32 |
|
| 36 | 36 | |
|---|
| 37 | 37 | env = BJ.NewEnv() |
|---|
| | 38 | if env["shared_phapi"]: |
|---|
| | 39 | BJ.sharedtarget = True |
|---|
| 38 | 40 | |
|---|
| 39 | 41 | #Duplicate = 0 is very important: it tells SCons |
|---|
| r31 |
r32 |
|
| 35 | 35 | sources += ['src/null-pixertool.cpp'] |
|---|
| 36 | 36 | |
|---|
| 37 | | env.Append(CPPPATH = include_path, CPPDEFINES = defines) |
|---|
| 38 | | BJ.Use(env, libs) |
|---|
| 39 | | print "pixertool includes", env["CPPPATH"] |
|---|
| 40 | | if env['shared_phapi']: |
|---|
| 41 | | pxo = env.SharedObject( source = sources ) |
|---|
| | 37 | |
|---|
| | 38 | if True: |
|---|
| | 39 | pxl = BJ.Library(env, target = 'pixertool', |
|---|
| | 40 | source = sources, |
|---|
| | 41 | uses = ["owutil", "owcutil", "avcodec", "avutil"], |
|---|
| | 42 | includes = ["#/libs/pixertool/include"], |
|---|
| | 43 | CPPPATH = include_path, CPPDEFINES = defines |
|---|
| | 44 | ) |
|---|
| | 45 | |
|---|
| | 46 | |
|---|
| 42 | 47 | else: |
|---|
| 43 | | pxo = env.StaticObject( source = sources ) |
|---|
| | 48 | env.Append(CPPPATH = include_path, CPPDEFINES = defines) |
|---|
| | 49 | BJ.Use(env, libs) |
|---|
| | 50 | if env['shared_phapi']: |
|---|
| | 51 | pxo = env.SharedObject( source = sources ) |
|---|
| | 52 | else: |
|---|
| | 53 | pxo = env.StaticObject( source = sources ) |
|---|
| 44 | 54 | |
|---|
| 45 | | pxl = env.StaticLibrary('pixertool', source = pxo) |
|---|
| | 55 | pxl = env.StaticLibrary('pixertool', source = pxo) |
|---|
| 46 | 56 | |
|---|
| 47 | | BJ.Component('pixertool', includes = ["#/libs/pixertool/include"], libpath = [pxl[0].dir], libs = ["pixertool"], |
|---|
| 48 | | uses = ["owutil", "owcutil", "avcodec", "avutil"], node = pxl) |
|---|
| | 57 | BJ.Component('pixertool', uses = ["owutil", "owcutil", "avcodec", "avutil"], |
|---|
| | 58 | includes = ["#/libs/pixertool/include"]) |
|---|
| | 59 | |
|---|
| | 60 | |
|---|
| | 61 | |
|---|
| 49 | 62 | |
|---|
| 50 | 63 | |
|---|