diff --git a/SConstruct b/SConstruct index f3ffbb90..9f154411 100644 --- a/SConstruct +++ b/SConstruct @@ -16,7 +16,7 @@ config.read( [ 'scons.cfg', ] ) -icommonInclude = [] +commonInclude = [] commonLibDir = [] installPrefix = "/usr/local" @@ -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', @@ -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 diff --git a/tools/scons.windows7.cfg b/tools/scons.windows7.cfg new file mode 100644 index 00000000..fe203c22 --- /dev/null +++ b/tools/scons.windows7.cfg @@ -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