QTKit (OSX 64bit): Add audio export to Quicktime
[blender.git] / source / blender / makesrna / intern / SConscript
1 #!/usr/bin/python
2 import sys
3 import os
4
5 def normpath(path):
6         return os.path.abspath(os.path.normpath(path))
7
8 Import ('env')
9 cflags = ['-Wall']
10 defines = []
11 root_build_dir=normpath(env['BF_BUILDDIR'])
12
13 source_files = env.Glob('*.c')
14 source_files.remove('rna_access.c')
15
16 generated_files = source_files[:]
17 generated_files.remove('rna_define.c')
18 generated_files.remove('makesrna.c')
19
20 api_files = env.Glob('*_api.c')
21 for api_file in api_files:
22     generated_files.remove(api_file)
23
24 generated_files = [filename[:-2] + '_gen.c' for filename in generated_files]
25
26 makesrna_tool = env.Clone()
27 rna = env.Clone()
28 makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ')
29
30 defs = []
31
32 incs = '#/intern/guardedalloc ../../blenlib ../../blenkernel'
33 incs += ' ../../imbuf ../../makesdna ../../makesrna ../../ikplugin'
34 incs += ' ../../windowmanager ../../editors/include'
35 incs += ' ../../render/extern/include'
36 incs += ' #/intern/audaspace/intern'
37
38 if env['WITH_BF_OPENEXR']:
39         defs.append('WITH_OPENEXR')
40
41 if env['WITH_BF_OPENJPEG']:
42         defs.append('WITH_OPENJPEG')
43
44 if env['WITH_BF_DDS']:
45         defs.append('WITH_DDS')
46
47 if env['WITH_BF_FFMPEG']:
48         defs.append('WITH_FFMPEG')
49         incs += ' ' + env['BF_FFMPEG_INC']
50
51 if env['WITH_BF_OGG']:
52         defs.append('WITH_OGG')
53
54 if env['WITH_BF_QUICKTIME']:
55         defs.append('WITH_QUICKTIME')
56         incs += ' ../../quicktime'
57
58 if env['WITH_BF_LCMS']:
59         defs.append('WITH_LCMS')
60
61 if env['WITH_BF_GAMEENGINE']:
62         defs.append('GAMEBLENDER=1')
63         
64 if env['WITH_BF_FFTW3']:
65     defs.append('FFTW3=1')
66
67 if env['WITH_BF_SDL']:
68     defs.append('WITH_SDL')
69
70 if env['WITH_BF_OPENAL']:
71     defs.append('WITH_OPENAL')
72
73 if env['WITH_BF_JACK']:
74     defs.append('WITH_JACK')
75
76 if env['BF_UNIT_TEST']:
77         defs.append('UNIT_TEST')
78
79 if not env['WITH_BF_PYTHON']:
80         defs.append('DISABLE_PYTHON')
81
82 if env['OURPLATFORM'] == 'linux2':
83         cflags='-pthread'
84         incs += ' ../../../extern/binreloc/include'
85
86 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
87         incs += ' ' + env['BF_PTHREADS_INC']
88
89 makesrna_tool.Append(CPPDEFINES=defs)
90
91 makesrna_tool.Append (CPPPATH = Split(incs))
92
93 if env['OURPLATFORM'] == 'linuxcross':
94         USE_WINE = True # when cross compiling on linux 64bit this is useful
95 else:
96         USE_WINE = False
97
98 if not USE_WINE:
99         if env['OURPLATFORM'] == 'linuxcross':
100                 makesdna_tool.Replace(CC='gcc')
101                 makesdna_tool.Replace(AR='ar')
102                 makesdna_tool.Replace(LINK='gcc')
103
104 if sys.platform != 'cygwin':
105         makesrna_tool.Append (CCFLAGS = cflags)
106 makesrna_tool.Append (CPPDEFINES = defines)
107
108 libdir = root_build_dir+'/lib'
109 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
110         libdir = '#' + libdir
111
112 makesrna_tool.Append (LIBPATH = libdir)
113
114 makesrna_tool.Append( CFLAGS = env['CFLAGS'])
115 makesrna_tool.Append( CCFLAGS = env['CCFLAGS'])
116 makesrna_tool.Append( LINKFLAGS = env['PLATFORM_LINKFLAGS'])
117
118 if env['BF_PROFILE']:
119         makesrna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
120
121 if env['BF_DEBUG']:
122         makesrna_tool.Append(CFLAGS = env['BF_DEBUG_CFLAGS'])
123         makesrna_tool.Append(CCFLAGS = env['BF_DEBUG_CCFLAGS'])
124         if env['OURPLATFORM'] in ('win32-vc','win64-vc'):
125                 makesrna_tool.Append(LINKFLAGS = ['/DEBUG','/PDB:makesrna.pdb'])
126
127 targetpath = root_build_dir+'/makesrna'
128 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
129         targetpath = '#' + targetpath
130
131 if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep:
132         makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna', 'bf_blenlib'])
133 else:
134         makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna', 'bf_blenlib'])
135
136 rna_dict = rna.Dictionary()
137 rna.Depends (generated_files, makesrna)
138
139 # this seems bad, how to retrieve it from scons?
140 build_dir = root_build_dir + os.sep +'source' + os.sep + 'blender' + os.sep + 'makesrna' + os.sep + 'intern' + os.sep
141         
142 if env['OURPLATFORM'] != 'linuxcross':
143         if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
144                 rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \""  + build_dir )
145         else:
146                 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna "  + build_dir)
147 else:
148         rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe "  + build_dir)
149         
150         if USE_WINE:
151                 rna.Command (generated_files, '', 'wine ' + root_build_dir+os.sep+"makesrna.exe "  + build_dir)
152         else:
153                 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe "  + build_dir)
154
155
156 obj = ['intern/rna_access.c']
157 for generated_file in generated_files:
158         obj += ['intern/' + generated_file]
159
160 Return ('obj')
161