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