Fixes submitted by Lieven de Cock:
[Fobs.git] / SConstruct
blob46a4a549b6ac1b6ed4d538563eba75e0d48e82e0
1 import os
2 import sys
3 import subprocess
4 sys.path += [sys.path[0]+'/scripts',sys.path[0]+'/scons-local']
5 import fobs
6 import fobscons
9 ffmpeg_path=fobs.FFMPEG_HOME
10 full_ffmpeg_path= os.path.abspath(ffmpeg_path.replace('#',fobs.root+"/"))
12 env_ffmpeg = Environment(ENV=os.environ)
13 if env_ffmpeg['PLATFORM']=='win32':
14 env_ffmpeg = Environment(tools=['mingw','javac','jar'])
15 env_ffmpeg['ENV']['PATH'] = os.environ['PATH']
17 #print env_ffmpeg['TOOLS']
19 env_ffmpeg.Append(ENV={'PKG_CONFIG_PATH':os.path.abspath(full_ffmpeg_path+'/lib/pkgconfig')})
20 env_ffmpeg.Append(CPPDEFINES={'__STDC_CONSTANT_MACROS':'', 'attribute_deprecated':''})
23 # for i in ['CPPPATH', 'LIBPATH', 'LIBS']:
24 # print "Environment['",i,"']=",env_ffmpeg[i]
26 if not env_ffmpeg.GetOption('clean'):
27 if env_ffmpeg['PLATFORM'] == 'win32':
28 #Run python version of pkg-config
29 res = fobscons.pkgconfig('libavformat',[env_ffmpeg['ENV']['PKG_CONFIG_PATH']])
30 env_ffmpeg.MergeFlags(res.get_output())
31 for i in ['CPPPATH', 'LIBPATH']:
32 env_ffmpeg[i]=[os.path.abspath(fobs.SYSTEM_ROOT+'/'+item) for item in env_ffmpeg[i]]
33 else:
34 res = fobscons.CustomParseConfig(env_ffmpeg,'pkg-config --cflags --libs libavformat')
36 conf = Configure(env_ffmpeg)
37 if not conf.CheckHeader('stdint.h','<>','cpp'):
38 print 'FFMpeg headers could not be found'
39 Exit(1)
40 if not conf.CheckHeader('libavcodec/avcodec.h','""'):
41 print 'FFMpeg headers could not be found'
42 Exit(1)
43 if not conf.CheckHeader('libavformat/avformat.h','""'):
44 print 'FFMpeg headers could not be found'
45 Exit(1)
46 if not conf.CheckHeader('libavformat/avi.h','""'):
47 print 'libavformat/avi.h was not found. Copy it from your ffmpeg sources package'
48 Exit(1)
49 if not conf.CheckHeader('libavformat/riff.h','""'):
50 print 'libavformat/riff.h was not found. Copy it from your ffmpeg sources package'
51 Exit(1)
52 if not conf.CheckHeader('libswscale/swscale.h','""'):
53 print 'libswscale/swscale.h was not found. Copy it from your ffmpeg sources package.'
54 Exit(1)
56 if not conf.CheckHeader('inttypes.h','""'):
57 print 'Inttypes headers could not be found'
58 Exit(1)
59 if not conf.CheckType('int64_t','#include <inttypes.h>'):
60 print 'Inttypes not found'
61 Exit(1)
62 env_ffmpeg = conf.Finish()
65 if fobs.DEBUG_SYMBOLS == 'yes':
66 env_ffmpeg.Append(LINKFLAGS=['-g'])
67 env_ffmpeg.Append(CCFLAGS=['-g'])
68 if fobs.OPTIMIZATIONS == 'yes':
69 env_ffmpeg.Append(LINKFLAGS=['-O3'])
70 env_ffmpeg.Append(CCFLAGS=['-O3'])
73 env_ffmpeg = SConscript('core/SConstruct', exports='env_ffmpeg')
74 SConscript(['test/SConstruct'], exports='env_ffmpeg')
76 if fobs.FOBS4JMF=='yes':
77 java_flag = fobscons.ConfigureJNI(env_ffmpeg)
78 if java_flag:
79 SConscript(['jmf/SConstruct'], exports='env_ffmpeg')
80 else:
81 print "\nFobs4jmf build was disabled. A valid JDK was not detected. Include \"/path/to/jdk/bin\" in your PATH."