prevent cycles sm_35 kernel to be built on win32 with vs2012 because of ptxas crashes.
[blender.git] / build_files / scons / config / win32-vc-config.py
1 import subprocess
2
3 CL_OUT = subprocess.Popen(["cl.exe"],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
4 CL_STDOUT, CL_STDERR = CL_OUT.communicate()
5
6 if CL_STDERR.find("Version 15.00.") == -1:
7     VC_VERSION = '11.0'
8     LCGDIR = '#../lib/windows_vc11'
9     
10 else:
11     VC_VERSION = '9.0'
12     LCGDIR = '#../lib/windows'
13
14 LIBDIR = '${LCGDIR}'
15
16 WITH_BF_FFMPEG = True
17 BF_FFMPEG = LIBDIR +'/ffmpeg'
18 BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc'
19 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
20 if VC_VERSION == '11.0':
21     BF_FFMPEG_LIB = 'avformat-54.lib avcodec-54.lib avdevice-54.lib avutil-52.lib avfilter-3.lib swscale-2.lib swresample-0.lib'
22     BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-54.dll ${BF_FFMPEG_LIBPATH}/avcodec-54.dll ${BF_FFMPEG_LIBPATH}/avdevice-54.dll ${BF_FFMPEG_LIBPATH}/avutil-52.dll ${BF_FFMPEG_LIBPATH}/avfilter-3.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll ${BF_FFMPEG_LIBPATH}/swresample-0.dll'
23 else:
24     BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib swscale-2.lib'
25     BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
26
27 BF_PYTHON = LIBDIR + '/python'
28 BF_PYTHON_VERSION = '3.3'
29 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
30 BF_PYTHON_BINARY = 'python'
31 BF_PYTHON_LIB = 'python33'
32 BF_PYTHON_DLL = '${BF_PYTHON_LIB}'
33 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
34
35 WITH_BF_OPENAL = True
36 BF_OPENAL = LIBDIR + '/openal'
37 BF_OPENAL_INC = '${BF_OPENAL}/include '
38 if VC_VERSION == '11.0':
39     BF_OPENAL_LIB = 'OpenAL32'
40 else:
41     BF_OPENAL_LIB = 'wrap_oal'
42 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
43
44 WITH_BF_ICONV = True
45 BF_ICONV = LIBDIR + '/iconv'
46 BF_ICONV_INC = '${BF_ICONV}/include'
47 BF_ICONV_LIB = 'iconv'
48 BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
49
50 WITH_BF_JACK = False
51 BF_JACK = LIBDIR + '/jack'
52 BF_JACK_INC = '${BF_JACK}/include ${BF_FFMPEG}/include/msvc'
53 BF_JACK_LIB = 'libjack'
54 BF_JACK_LIBPATH = '${BF_JACK}/lib'
55
56 WITH_BF_SNDFILE = True
57 BF_SNDFILE = LIBDIR + '/sndfile'
58 BF_SNDFILE_INC = '${BF_SNDFILE}/include'
59 BF_SNDFILE_LIB = 'libsndfile-1'
60 BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
61
62 WITH_BF_SDL = True
63 BF_SDL = LIBDIR + '/sdl'
64 BF_SDL_INC = '${BF_SDL}/include'
65 if VC_VERSION == '11.0':
66     BF_SDL_LIB = 'SDL.lib dxguid.lib'
67 else:
68     BF_SDL_LIB = 'SDL.lib'
69 BF_SDL_LIBPATH = '${BF_SDL}/lib'
70
71 BF_PTHREADS = LIBDIR + '/pthreads'
72 BF_PTHREADS_INC = '${BF_PTHREADS}/include'
73 BF_PTHREADS_LIB = 'pthreadVC2'
74 BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
75
76 WITH_BF_OPENEXR = True
77 WITH_BF_STATICOPENEXR = False
78 BF_OPENEXR = LIBDIR + '/openexr'
79 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
80 BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
81 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
82 BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
83
84 WITH_BF_DDS = True
85
86 WITH_BF_JPEG = True
87 BF_JPEG = LIBDIR + '/jpeg'
88 BF_JPEG_INC = '${BF_JPEG}/include'
89 BF_JPEG_LIB = 'libjpeg'
90 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
91
92 WITH_BF_PNG = True
93 BF_PNG = LIBDIR + '/png'
94 BF_PNG_INC = '${BF_PNG}/include'
95 BF_PNG_LIB = 'libpng'
96 BF_PNG_LIBPATH = '${BF_PNG}/lib'
97
98 WITH_BF_TIFF = True
99 BF_TIFF = LIBDIR + '/tiff'
100 BF_TIFF_INC = '${BF_TIFF}/include'
101 BF_TIFF_LIB = 'libtiff'
102 BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
103
104 WITH_BF_ZLIB = True
105 BF_ZLIB = LIBDIR + '/zlib'
106 BF_ZLIB_INC = '${BF_ZLIB}/include'
107 BF_ZLIB_LIB = 'libz_st'
108 BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
109
110 WITH_BF_INTERNATIONAL = True
111
112 WITH_BF_GAMEENGINE = True
113 WITH_BF_PLAYER = True
114 WITH_BF_OCEANSIM = True
115
116 WITH_BF_BULLET = True
117 BF_BULLET = '#extern/bullet2/src'
118 BF_BULLET_INC = '${BF_BULLET}'
119 BF_BULLET_LIB = 'extern_bullet'
120
121 WITH_BF_ELTOPO = False
122 BF_LAPACK = LIBDIR + '/lapack'
123 BF_LAPACK_LIB = 'libf2c clapack_nowrap BLAS_nowrap'
124 BF_LAPACK_LIBPATH = '${BF_LAPACK}/lib'
125
126 BF_WINTAB = LIBDIR + '/wintab'
127 BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
128
129 WITH_BF_BINRELOC = False
130
131 BF_WITH_FREETYPE = True
132 BF_FREETYPE = LIBDIR + '/freetype'
133 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
134 BF_FREETYPE_LIB = 'freetype2ST'
135 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
136
137 WITH_BF_QUICKTIME = False
138 BF_QUICKTIME = LIBDIR + '/QTDevWin'
139 BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
140 BF_QUICKTIME_LIB = 'qtmlClient'
141 BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
142
143 WITH_BF_OPENJPEG = True 
144 BF_OPENJPEG = '#extern/libopenjpeg'
145 BF_OPENJPEG_LIB = ''
146 BF_OPENJPEG_INC = '${BF_OPENJPEG}'
147 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
148
149 WITH_BF_FFTW3 = True
150 BF_FFTW3 = LIBDIR + '/fftw3'
151 BF_FFTW3_INC = '${BF_FFTW3}/include'
152 BF_FFTW3_LIB = 'libfftw'
153 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
154
155 WITH_BF_REDCODE = False  
156 BF_REDCODE_INC = '#extern'
157
158 WITH_BF_COLLADA = True
159 BF_COLLADA = '#source/blender/collada'
160 BF_COLLADA_INC = '${BF_COLLADA}'
161 BF_COLLADA_LIB = 'bf_collada'
162
163 BF_OPENCOLLADA = LIBDIR + '/opencollada'
164 BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
165 BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa UTF'
166 BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
167
168 WITH_BF_3DMOUSE = True
169
170 WITH_BF_OPENMP = True
171
172 #Cycles
173 WITH_BF_CYCLES = True 
174
175 WITH_BF_CYCLES_OSL = True
176 WITH_BF_STATICOSL = True
177 BF_OSL = '${LIBDIR}/osl'
178 BF_OSL_INC = '${BF_OSL}/include'
179 BF_OSL_LIBPATH = '${BF_OSL}/lib'
180 BF_OSL_LIB_STATIC = '${BF_OSL_LIBPATH}/oslcomp.lib ${BF_OSL_LIBPATH}/oslexec.lib ${BF_OSL_LIBPATH}/oslquery.lib '
181 BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
182
183 WITH_BF_LLVM = True
184 BF_LLVM = LIBDIR + '/llvm'
185 BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
186     'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
187     'LLVMTarget LLVMMC LLVMCore LLVMObject LLVMRuntimeDyld LLVMSupport'
188 BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
189
190 WITH_BF_OIIO = True
191 BF_OIIO = '${LIBDIR}/openimageio'
192 BF_OIIO_INC = '${BF_OIIO}/include'
193 BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
194 BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/OpenImageIO.lib'
195 WITH_BF_STATICOIIO = True
196
197 WITH_BF_OCIO = True
198 BF_OCIO = '${LIBDIR}/opencolorio'
199 BF_OCIO_INC = '${BF_OCIO}/include'
200 BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
201 BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/OpenColorIO.lib'
202 WITH_BF_STATICOCIO = True
203
204 WITH_BF_BOOST = True
205 BF_BOOST = '${LIBDIR}/boost'
206 BF_BOOST_INC = '${BF_BOOST}/include'
207 if VC_VERSION == '11.0':
208     BF_BOOST_LIB = 'libboost_date_time-vc110-mt-s-1_53 libboost_filesystem-vc110-mt-s-1_53 libboost_regex-vc110-mt-s-1_53 libboost_system-vc110-mt-s-1_53 libboost_thread-vc110-mt-s-1_53 libboost_wave-vc110-mt-s-1_53'
209     BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc110-mt-s-1_53'
210 else:
211     BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49 libboost_wave-vc90-mt-s-1_49'
212     BF_BOOST_LIB_INTERNATIONAL = 'libboost_locale-vc90-mt-s-1_49'
213 BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
214
215 #CUDA
216 WITH_BF_CYCLES_CUDA_BINARIES = False
217 #BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
218
219 # Workaround for ptxas.exe crash on VS2012 and cuda 5.5
220 if VC_VERSION == '11.0':
221         BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
222 else:
223         BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35']
224
225 #Ray trace optimization
226 WITH_BF_RAYOPTIMIZATION = True
227 BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
228
229 #Freestyle
230 WITH_BF_FREESTYLE = True
231
232 WITH_BF_STATICOPENGL = False
233 BF_OPENGL_INC = '${BF_OPENGL}/include'
234 BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
235 BF_OPENGL_LIB = 'opengl32 glu32'
236 BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a',
237                          '${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
238                          '${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
239                          
240 CC = 'cl.exe'
241 CXX = 'cl.exe'
242
243 CCFLAGS = ['/nologo', '/J', '/W1', '/Gd', '/wd4018', '/wd4244', '/wd4305', '/wd4800', '/wd4065', '/wd4267', '/we4013']
244 CXXFLAGS = ['/EHsc']
245 BGE_CXXFLAGS = ['/O2', '/Ob2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE']
246
247 BF_DEBUG_CCFLAGS = ['/Zi', '/Ob0', '/Od', '/FR${TARGET}.sbr']
248
249 CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE', '-DOPJ_STATIC']
250 REL_CFLAGS = []
251 REL_CXXFLAGS = []
252 REL_CCFLAGS = ['-O2', '/Ob2', '-DNDEBUG']
253
254 C_WARN = []
255 CC_WARN = []
256 CXX_WARN = []
257
258 LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
259
260 PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
261
262 # # Todo
263 # BF_PROFILE_CCFLAGS = ['-pg', '-g ']
264 # BF_PROFILE_LINKFLAGS = ['-pg']
265 # BF_PROFILE = False
266
267 BF_BSC=False
268
269 if VC_VERSION == '11.0':
270     BF_BUILDDIR = '..\\build\\win32-vc11'
271     BF_INSTALLDIR='..\\install\\win32-vc11'
272 else:
273     BF_BUILDDIR = '..\\build\\win32-vc'
274     BF_INSTALLDIR='..\\install\\win32-vc'