forked from axiomatic-systems/Bento4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bok
committed
Jan 17, 2006
1 parent
b2aea23
commit 7889a0d
Showing
7 changed files
with
179 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import sys | ||
|
||
####################################################### | ||
# reusable functions and data structures | ||
####################################################### | ||
|
||
# Platform to Target Map (specifies which default target to build on a platform) | ||
PLATFORM_TO_TARGET_MAP = { | ||
'linux-i386' : 'x86-unknown-linux', | ||
'linux2' : 'x86-unknown-linux', | ||
'win32' : 'x86-microsoft-win32', | ||
'cygwin' : 'x86-unknown-cygwin' | ||
} | ||
|
||
def DefaultTarget(): | ||
if PLATFORM_TO_TARGET_MAP.has_key(sys.platform): | ||
return PLATFORM_TO_TARGET_MAP[sys.platform] | ||
else: | ||
return None | ||
|
||
####################################################### | ||
# Main Build | ||
####################################################### | ||
|
||
options = Options() | ||
options.AddOptions( | ||
EnumOption('target', 'build target', DefaultTarget(), allowed_values=PLATFORM_TO_TARGET_MAP.values()), | ||
EnumOption('build_config', 'build config', 'Debug', allowed_values=('Debug', 'Release')) | ||
) | ||
|
||
env = Environment(options=options) | ||
Help(options.GenerateHelpText(env)) | ||
|
||
print '********** Building for target =', env['target'], '/', env['build_config'], '********' | ||
|
||
### call the actual build script | ||
SConscript('Build.scons', build_dir='Targets/'+env['target']+'/'+env['build_config'], exports='env', duplicate=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import sys | ||
import os | ||
from glob import glob | ||
|
||
####################################################### | ||
# reusable functions and data structures | ||
####################################################### | ||
def GlobSources(dir, patterns): | ||
root = GetBuildPath('#'+SOURCE_ROOT)+'/'+dir+'/' | ||
files = [] | ||
for pattern in patterns: | ||
files += glob(root+pattern) | ||
return [dir+'/'+os.path.basename(x) for x in files] | ||
|
||
def GetDirPath(dir): | ||
return '#'+SOURCE_ROOT+'/'+dir | ||
|
||
def DeclareBuildDir(dir): | ||
env.BuildDir(dir, GetDirPath(dir), duplicate=0) | ||
|
||
def GetModule(name): | ||
return Modules[name] | ||
|
||
def GetIncludeDirs(modules, exclude=None): | ||
dirs = [] | ||
for module in Split(modules): | ||
if Modules.has_key(module) and not module == exclude: | ||
dirs += Modules[module].GetIncludeDirs() | ||
else: | ||
dirs += [GetDirPath(module)] | ||
return dirs | ||
|
||
def GetLibraries(modules): | ||
return [GetModule(module).GetLibraries() for module in Split(modules)] | ||
|
||
Modules = {} | ||
class Module: | ||
def __init__(self, name, included_modules = [], linked_modules = []): | ||
self.included_modules = included_modules | ||
self.linked_modules = linked_modules | ||
self.product = [] | ||
|
||
def GetLibraries(self): | ||
return self.product+GetLibraries(self.linked_modules) | ||
|
||
def GetIncludeDirs(self): | ||
return GetIncludeDirs(self.included_modules, self.name) | ||
|
||
class LibraryModule(Module): | ||
def __init__(self, name, | ||
build_source_dirs, | ||
build_source_pattern=['*.c', '*.cpp'], | ||
build_include_dirs = [], | ||
included_modules = [], | ||
linked_modules = []) : | ||
Module.__init__(self, name, Split(included_modules)+Split(build_source_dirs), linked_modules) | ||
self.env = env.Copy() | ||
self.name = name | ||
self.build_source_dirs = build_source_dirs | ||
self.build_include_dirs = build_include_dirs | ||
|
||
# store this new object in the module dictionary | ||
Modules[name] = self | ||
|
||
# for each source dir to build, create a BuildDir | ||
# to say where we want the object files to be built, | ||
# and compute the list of source files to build | ||
sources = [] | ||
for dir in Split(self.build_source_dirs): | ||
DeclareBuildDir(dir) | ||
sources += GlobSources(dir, build_source_pattern) | ||
|
||
# calculate our build include path | ||
cpp_path = GetIncludeDirs(Split(build_include_dirs) + Split(build_source_dirs) + Split(included_modules)) | ||
|
||
# calculate our preprocessor defines for this module | ||
cpp_defines={} | ||
|
||
# the product is a library | ||
print "LIBRARAY:", name, "sources=", sources, "includes=", cpp_path | ||
self.env.AppendUnique(CPPDEFINES=cpp_defines) | ||
self.env.AppendUnique(CPPPATH=cpp_path) | ||
self.product = self.env.Library(target=name, source=sources) | ||
Alias(name, self.product) | ||
|
||
def Application(name, extra_deps=[]): | ||
dir = 'Apps/'+name | ||
DeclareBuildDir(dir) | ||
sdk = ['Core', 'System'] + Split(extra_deps) | ||
libs = GetLibraries(sdk) | ||
cpp_path = GetIncludeDirs(sdk) | ||
|
||
prog = env.Program(name, | ||
GlobSources(dir, ['*.cpp']), | ||
LIBS=libs, CPPPATH=cpp_path) | ||
Alias(name, prog) | ||
|
||
####################################################### | ||
# Main Build | ||
####################################################### | ||
Import("env") | ||
SOURCE_ROOT='Source/C++' | ||
|
||
### try to read in any target specific configuration | ||
#try: | ||
if os.path.exists('../Config.scons'): | ||
# Load the target-specific config file | ||
execfile('../Config.scons') | ||
print '@@@ Loaded target configuration @@@' | ||
|
||
####################################################### | ||
# modules | ||
####################################################### | ||
LibraryModule(name = 'Core', | ||
build_source_dirs = ['Core', 'Crypto', 'MetaData'], | ||
included_modules = 'Config') | ||
|
||
LibraryModule(name = 'System', | ||
build_source_dirs = 'System/StdC', | ||
included_modules = 'Core') | ||
|
||
LibraryModule(name = 'Codecs', | ||
build_source_dirs = ['Codecs'], | ||
included_modules = 'Core') | ||
|
||
for name in ['Mp4Dump', 'Mp4Info', 'Mp4Edit', 'Mp4Encrypt', 'Mp4Decrypt', 'Mp4Tag', 'Mp4Extract', 'Mp4RtpHintInfo', 'Mp42Aac']: | ||
Application(name) | ||
|
||
Application('Aac2Mp4', 'Codecs') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
env.AppendUnique(CPPDEFINES = {'AP4_PLATFORM_BYTE_ORDER':'AP4_PLATFORM_LITTLE_ENDIAN'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SConscript('Build/Boot.scons') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters