mirror of
https://github.com/axiomatic-systems/Bento4.git
synced 2026-01-12 00:18:59 +08:00
This commit is contained in:
37
Build/Boot.scons
Normal file
37
Build/Boot.scons
Normal file
@@ -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)
|
||||
129
Build/Build.scons
Normal file
129
Build/Build.scons
Normal file
@@ -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')
|
||||
@@ -91,6 +91,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaData", "MetaData\MetaDa
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Config", "Config\Config.vcproj", "{0775F43A-0D4B-45EA-9509-9CE457B3B9EE}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
@@ -161,6 +165,10 @@ Global
|
||||
{D2A66E1B-6C25-4D48-8908-F70AD585A7E1}.Debug.Build.0 = Debug|Win32
|
||||
{D2A66E1B-6C25-4D48-8908-F70AD585A7E1}.Release.ActiveCfg = Release|Win32
|
||||
{D2A66E1B-6C25-4D48-8908-F70AD585A7E1}.Release.Build.0 = Release|Win32
|
||||
{0775F43A-0D4B-45EA-9509-9CE457B3B9EE}.Debug.ActiveCfg = Debug|Win32
|
||||
{0775F43A-0D4B-45EA-9509-9CE457B3B9EE}.Debug.Build.0 = Debug|Win32
|
||||
{0775F43A-0D4B-45EA-9509-9CE457B3B9EE}.Release.ActiveCfg = Release|Win32
|
||||
{0775F43A-0D4B-45EA-9509-9CE457B3B9EE}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto;..\..\..\..\Source\C++\MetaData"
|
||||
AdditionalIncludeDirectories=""..\..\..\..\Source\C++\Config";"..\..\..\..\Source\C++\Crypto";"..\..\..\..\Source\C++\MetaData""
|
||||
PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@@ -76,7 +76,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto;..\..\..\..\Source\C++\MetaData"
|
||||
AdditionalIncludeDirectories=""..\..\..\..\Source\C++\Config";"..\..\..\..\Source\C++\Crypto";"..\..\..\..\Source\C++\MetaData""
|
||||
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
@@ -128,7 +128,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto;..\..\..\..\Source\C++\MetaData"
|
||||
AdditionalIncludeDirectories=""..\..\..\..\Source\C++\Config";"..\..\..\..\Source\C++\Crypto";"..\..\..\..\Source\C++\MetaData""
|
||||
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
@@ -369,9 +369,6 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\Source\C++\Core\Ap4ByteStream.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Source\C++\Config\Ap4Config.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Source\C++\Core\Ap4Constants.h">
|
||||
</File>
|
||||
|
||||
1
Build/Targets/x86-unknown-cygwin/Config.scons
Normal file
1
Build/Targets/x86-unknown-cygwin/Config.scons
Normal file
@@ -0,0 +1 @@
|
||||
env.AppendUnique(CPPDEFINES = {'AP4_PLATFORM_BYTE_ORDER':'AP4_PLATFORM_LITTLE_ENDIAN'})
|
||||
1
SConstruct
Normal file
1
SConstruct
Normal file
@@ -0,0 +1 @@
|
||||
SConscript('Build/Boot.scons')
|
||||
@@ -62,8 +62,6 @@
|
||||
#include "Ap4IkmsAtom.h"
|
||||
#include "Ap4IsfmAtom.h"
|
||||
#include "Ap4TrefTypeAtom.h"
|
||||
|
||||
// builtin extensions
|
||||
#include "Ap4MetaData.h"
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user