2.5 Sound:
[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'
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
56 if env['WITH_BF_LCMS']:
57         defs.append('WITH_LCMS')
58
59 if env['WITH_BF_GAMEENGINE']:
60         defs.append('GAMEBLENDER=1')
61         
62 if env['WITH_BF_FFTW3']:
63     defs.append('FFTW3=1')
64
65 if env['WITH_BF_SDL']:
66     defs.append('WITH_SDL')
67
68 if env['WITH_BF_OPENAL']:
69     defs.append('WITH_OPENAL')
70
71 if env['WITH_BF_JACK']:
72     defs.append('WITH_JACK')
73
74 makesrna_tool.Append(CPPDEFINES=defs)
75
76 makesrna_tool.Append (CPPPATH = Split(incs))
77
78 if env['OURPLATFORM'] == 'linuxcross':
79         USE_WINE = True # when cross compiling on linux 64bit this is useful
80 else:
81         USE_WINE = False
82
83 if not USE_WINE:
84         if env['OURPLATFORM'] == 'linuxcross':
85                 makesdna_tool.Replace(CC='gcc')
86                 makesdna_tool.Replace(AR='ar')
87                 makesdna_tool.Replace(LINK='gcc')
88
89 if sys.platform != 'cygwin':
90         makesrna_tool.Append (CCFLAGS = cflags)
91 makesrna_tool.Append (CPPDEFINES = defines)
92
93 libdir = root_build_dir+'/lib'
94 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
95         libdir = '#' + libdir
96
97 makesrna_tool.Append (LIBPATH = libdir)
98
99 if env['BF_PROFILE']:
100         makesrna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
101
102 if env['BF_DEBUG']:
103         makesrna_tool.Append(CFLAGS = env['BF_DEBUG_CFLAGS'])
104         makesrna_tool.Append(CCFLAGS = env['BF_DEBUG_CCFLAGS'])
105         if env['OURPLATFORM'] in ('win32-vc','win64-vc'):
106                 makesrna_tool.Append(LINKFLAGS = ['/DEBUG','/PDB:makesrna.pdb'])
107
108 targetpath = root_build_dir+'/makesrna'
109 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
110         targetpath = '#' + targetpath
111
112 if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep:
113         makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
114 else:
115         makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
116
117 rna_dict = rna.Dictionary()
118 rna.Depends (generated_files, makesrna)
119
120 # this seems bad, how to retrieve it from scons?
121 build_dir = root_build_dir + os.sep +'source' + os.sep + 'blender' + os.sep + 'makesrna' + os.sep + 'intern' + os.sep
122
123 if env['OURPLATFORM'] != 'linuxcross':
124         if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
125                 rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \""  + build_dir )
126         else:
127                 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna "  + build_dir)
128 else:
129         rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe "  + build_dir)
130         
131         if USE_WINE:
132                 rna.Command (generated_files, '', 'wine ' + root_build_dir+os.sep+"makesrna.exe "  + build_dir)
133         else:
134                 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe "  + build_dir)
135
136
137 obj = ['intern/rna_access.c']
138 for generated_file in generated_files:
139         obj += ['intern/' + generated_file]
140
141 Return ('obj')
142