Skip to content

Build windows #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 21, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 75 additions & 52 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ config.read( [
'scons.cfg',
] )

icommonInclude = []
commonInclude = []
commonLibDir = []
installPrefix = "/usr/local"

Expand Down Expand Up @@ -44,20 +44,23 @@ if not config.has_section( 'PYTHON' ):


javaInclude = config.get( 'JAVA', 'inc' ).split( splitChar )

pyInclude = config.get( 'PYTHON', 'inc' ).split( splitChar )
pyLibrary = []
if config.has_option( 'PYTHON', 'libdir' ):
pyLibrary = config.get( 'PYTHON', 'libdir' ).split( splitChar )

libavInclude = config.get( 'LIBAV', 'inc' ).split( splitChar )
libavLibDir = config.get( 'LIBAV', 'libdir' ).split( splitChar )

env = Environment().Clone()
envJava = Environment().Clone()
envPy = Environment().Clone()
env = Environment( ENV = { 'PATH' : os.environ[ 'PATH' ] } )

# C++ environment
env.Append(
CPPPATH = [
libavInclude,
"#src",
],
] + commonInclude,
CXXFLAGS = [
'-Wall',
'-fPIC',
Expand All @@ -66,88 +69,108 @@ env.Append(
libavLibDir,
"#src",
"#build/src"
],
] + commonLibDir,
)

if os.name == "nt" and sys.platform.startswith("win"): # detect windows plateform
env.AppendUnique( CPPDEFINES = 'WIN' )
env.AppendUnique( CPPDEFINES = 'WIN32' )
env.AppendUnique( CPPDEFINES = 'WINDOWS' )
env.AppendUnique( CPPDEFINES = '_WINDOWS' )
env.AppendUnique( CPPDEFINES = '__WINDOWS__' )
env.AppendUnique( CPPDEFINES = '__STDC_CONSTANT_MACROS' )
bits = 64
if 'PROGRAMFILES(X86)' not in os.environ:
bits = 32
env.AppendUnique( CPPDEFINES = 'WIN'+str(bits) )
env.AppendUnique( TMP = os.environ['TMP'].split( splitChar ) )

if 'LIB' not in os.environ or 'LIBPATH' not in os.environ :
print "Compiler environment not set."
sys.exit( -1 )
env.AppendUnique( LIB = os.environ['LIB'].split( splitChar ) )
env.AppendUnique( LIBPATH = os.environ['LIBPATH'].split( splitChar ) )
env.AppendUnique( TMP = os.environ['TMP'].split( splitChar ) )
else:
env.AppendUnique( CPPDEFINES = 'UNIX' )
env.AppendUnique( CPPDEFINES = '__UNIX__' )
if sys.platform.startswith( "darwin" ): # for disabling macros such as check, verify, require ... ( AssertMacros.h )
env.AppendUnique( CPPDEFINES = '__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0' )

envJava = env.Clone()
envPy = env.Clone()

# Java environment
envJava.Replace(
CPPPATH = [
javaInclude,
libavInclude,
".",
],
SWIGCXXFILESUFFIX= '_wrapJava$CXXFILESUFFIX',
CXXFLAGS = [
'-Wall',
],
SWIGFLAGS = [
'-java',
'-c++',
'-fcompact',
],
LINKFLAGS = [
],
LIBPATH = [
libavLibDir,
"#src",
],
JARCHDIR = env.Dir('#build/'+mymode+'/src/AvTranscoder').get_abspath(),
)

envJava.Append(
envJava.AppendUnique(
CPPPATH = javaInclude,
SWIGPATH = envJava['CPPPATH'],
SWIGFLAGS = [ '-package', 'org.AvTranscoder' ],
)
JARCHDIR = env.Dir('#build/'+mymode+'/src/AvTranscoder').get_abspath(),
)

# Python environment
envPy.Replace(
CPPPATH = [
pyInclude,
libavInclude,
".",
],
SWIGCXXFILESUFFIX= '_wrapPython$CXXFILESUFFIX',
SHLIBPREFIX= '_',
CXXFLAGS = [
'-Wall',
],
SWIGFLAGS = [
'-python',
'-c++',
'-fcompact',
],
LINKFLAGS = [
],
LIBPATH = [
libavLibDir,
"#src",
],
)

envPy.Append( SWIGPATH = envPy['CPPPATH'] )
envPy.AppendUnique(
CPPPATH = pyInclude,
LIBPATH = pyLibrary,
SWIGPATH = envPy['CPPPATH']
)

conf = Configure( env )

resampleLibraryFlag = '-DAV_RESAMPLE_LIBRARY'
resampleLibraryName = 'avresample'

if not conf.CheckLibWithHeader('avutil', 'libavutil/avutil.h', 'c'):
sys.exit( 0 )
if os.name == "nt" and sys.platform.startswith("win"): # detect windows plateform
if not conf.CheckLibWithHeader('avutil', 'libavutil/avutil.h', 'c++'):
sys.exit( -1 )

if not conf.CheckLibWithHeader('avcodec', 'libavcodec/avcodec.h', 'c++'):
sys.exit( -1 )

if not conf.CheckLibWithHeader('avformat', 'libavformat/avformat.h', 'c++'):
sys.exit( -1 )

if not conf.CheckLibWithHeader('swscale', 'libswscale/swscale.h', 'c++'):
sys.exit( -1 )

if not conf.CheckLibWithHeader('avresample', 'libavresample/avresample.h', 'c'):
if conf.CheckLibWithHeader('swresample', 'libswresample/swresample.h', 'c'):
resampleLibraryFlag = '-DFF_RESAMPLE_LIBRARY'
resampleLibraryName = 'swresample'
if not conf.CheckLibWithHeader('avresample', 'libavresample/avresample.h', 'c++'):
if conf.CheckLibWithHeader('swresample', 'libswresample/swresample.h', 'c++'):
resampleLibraryFlag = '-DFF_RESAMPLE_LIBRARY'
resampleLibraryName = 'swresample'
else:
if not conf.CheckCHeader('libavutil/avutil.h'):
sys.exit( -1 )

if not conf.CheckLibWithHeader('avcodec', 'libavcodec/avcodec.h', 'c'):
sys.exit( 0 )
if not conf.CheckCHeader('libavcodec/avcodec.h'):
sys.exit( -1 )

if not conf.CheckLibWithHeader('avformat', 'libavformat/avformat.h', 'c'):
sys.exit( 0 )
if not conf.CheckCHeader('libavformat/avformat.h'):
sys.exit( -1 )

if not conf.CheckLibWithHeader('swscale', 'libswscale/swscale.h', 'c'):
sys.exit( 0 )
if not conf.CheckCHeader('libswscale/swscale.h'):
sys.exit( -1 )

if not conf.CheckCHeader('libavresample/avresample.h'):
if conf.CheckCHeader('libswresample/swresample.h'):
resampleLibraryFlag = '-DFF_RESAMPLE_LIBRARY'
resampleLibraryName = 'swresample'

env.Append(
CXXFLAGS = resampleLibraryFlag
Expand Down
14 changes: 14 additions & 0 deletions tools/scons.windows7.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[COMMON]
inc=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\msinttypes;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
libdir=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib

[LIBAV]
inc=C:\local_build\build-ffmpeg-2.3\include
libdir=C:\local_build\build-ffmpeg-2.3\bin;C:\local_build\build-ffmpeg-2.3\lib

[PYTHON]
inc=C:\Python27\include
libdir=C:\Python27\libs

[JAVA]
inc=C:\Program Files (x86)\Java\jdk1.7.0_51\include;C:\Program Files (x86)\Java\jdk1.7.0_51\include\win32