Quicktime-qtkit : encoding settings now in blender ui (encoding panel)
[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
37 if env['WITH_BF_OPENEXR']:
38         defs.append('WITH_OPENEXR')
39
40 if env['WITH_BF_OPENJPEG']:
41         defs.append('WITH_OPENJPEG')
42
43 if env['WITH_BF_DDS']:
44         defs.append('WITH_DDS')
45
46 if env['WITH_BF_FFMPEG']:
47         defs.append('WITH_FFMPEG')
48         incs += ' ' + env['BF_FFMPEG_INC']
49
50 if env['WITH_BF_OGG']:
51         defs.append('WITH_OGG')
52
53 if env['WITH_BF_QUICKTIME']:
54         defs.append('WITH_QUICKTIME')
55         incs += ' ../../quicktime'
56
57 if env['WITH_BF_LCMS']:
58         defs.append('WITH_LCMS')
59
60 if env['WITH_BF_GAMEENGINE']:
61         defs.append('GAMEBLENDER=1')
62         
63 if env['WITH_BF_FFTW3']:
64     defs.append('FFTW3=1')
65
66 if env['WITH_BF_SDL']:
67     defs.append('WITH_SDL')
68
69 if env['WITH_BF_OPENAL']:
70     defs.append('WITH_OPENAL')
71
72 if env['WITH_BF_JACK']:
73     defs.append('WITH_JACK')
74
75 if env['BF_UNIT_TEST']:
76         defs.append('UNIT_TEST')
77
78
79 if env['OURPLATFORM'] == 'linux2':
80         cflags='-pthread'
81         incs += ' ../../../extern/binreloc/include'
82
83 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
84         incs += ' ' + env['BF_PTHREADS_INC']
85
86 makesrna_tool.Append(CPPDEFINES=defs)
87
88 makesrna_tool.Append (CPPPATH = Split(incs))
89
90 if env['OURPLATFORM'] == 'linuxcross':
91         USE_WINE = True # when cross compiling on linux 64bit this is useful
92 else:
93         USE_WINE = False
94
95 if not USE_WINE:
96         if env['OURPLATFORM'] == 'linuxcross':
97                 makesdna_tool.Replace(CC='gcc')
98                 makesdna_tool.Replace(AR='ar')
99                 makesdna_tool.Replace(LINK='gcc')
100
101 if sys.platform != 'cygwin':
102         makesrna_tool.Append (CCFLAGS = cflags)
103 makesrna_tool.Append (CPPDEFINES = defines)
104
105 libdir = root_build_dir+'/lib'
106 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
107         libdir = '#' + libdir
108
109 makesrna_tool.Append (LIBPATH = libdir)
110
111 makesrna_tool.Append( CFLAGS = env['CFLAGS'])
112 makesrna_tool.Append( CCFLAGS = env['CCFLAGS'])
113 makesrna_tool.Append( LINKFLAGS = env['PLATFORM_LINKFLAGS'])
114
115 if env['BF_PROFILE']:
116         makesrna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
117
118 if env['BF_DEBUG']:
119         makesrna_tool.Append(CFLAGS = env['BF_DEBUG_CFLAGS'])
120         makesrna_tool.Append(CCFLAGS = env['BF_DEBUG_CCFLAGS'])
121         if env['OURPLATFORM'] in ('win32-vc','win64-vc'):
122                 makesrna_tool.Append(LINKFLAGS = ['/DEBUG','/PDB:makesrna.pdb'])
123
124 targetpath = root_build_dir+'/makesrna'
125 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
126         targetpath = '#' + targetpath
127
128 if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep:
129         makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
130 else:
131         makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
132
133 rna_dict = rna.Dictionary()
134 rna.Depends (generated_files, makesrna)
135
136 # this seems bad, how to retrieve it from scons?
137 build_dir = root_build_dir + os.sep +'source' + os.sep + 'blender' + os.sep + 'makesrna' + os.sep + 'intern' + os.sep
138         
139 if env['OURPLATFORM'] != 'linuxcross':
140         if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
141                 rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \""  + build_dir )
142         else:
143                 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna "  + build_dir)
144 else:
145         rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe "  + build_dir)
146         
147         if USE_WINE:
148                 rna.Command (generated_files, '', 'wine ' + root_build_dir+os.sep+"makesrna.exe "  + build_dir)
149         else:
150                 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe "  + build_dir)
151
152
153 obj = ['intern/rna_access.c']
154 for generated_file in generated_files:
155         obj += ['intern/' + generated_file]
156
157 Return ('obj')
158