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