26568abd9bf420a2359d2ad18efe1ace498411a0
[blender.git] / build_files / cmake / platform / platform_win32_msvc.cmake
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # The Original Code is Copyright (C) 2016, Blender Foundation
18 # All rights reserved.
19 #
20 # Contributor(s): Sergey Sharybin.
21 #
22 # ***** END GPL LICENSE BLOCK *****
23
24 # Libraries configuration for Windows when compiling with MSVC.
25
26 macro(warn_hardcoded_paths package_name
27         )
28         if(WITH_WINDOWS_FIND_MODULES)
29                 message(WARNING "Using HARDCODED ${package_name} locations")
30         endif(WITH_WINDOWS_FIND_MODULES)
31 endmacro()
32
33 macro(windows_find_package package_name
34         )
35         if(WITH_WINDOWS_FIND_MODULES)
36                 find_package(${package_name})
37         endif(WITH_WINDOWS_FIND_MODULES)
38 endmacro()
39
40 macro(find_package_wrapper)
41         if(WITH_WINDOWS_FIND_MODULES)
42                 find_package(${ARGV})
43         endif()
44 endmacro()
45
46 add_definitions(-DWIN32)
47 # Minimum MSVC Version
48 if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
49         if(MSVC_VERSION EQUAL 1800)
50                 set(_min_ver "18.0.31101")
51                 if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
52                         message(FATAL_ERROR
53                                 "Visual Studio 2013 (Update 4, ${_min_ver}) required, "
54                                 "found (${CMAKE_CXX_COMPILER_VERSION})")
55                 endif()
56         endif()
57         if(MSVC_VERSION EQUAL 1900)
58                 set(_min_ver "19.0.24210")
59                 if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
60                         message(FATAL_ERROR
61                                 "Visual Studio 2015 (Update 3, ${_min_ver}) required, "
62                                 "found (${CMAKE_CXX_COMPILER_VERSION})")
63                 endif()
64         endif()
65 endif()
66 unset(_min_ver)
67
68 # needed for some MSVC installations
69 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
70 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
71 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
72
73 list(APPEND PLATFORM_LINKLIBS
74         ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32
75         advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp
76 )
77
78 if(WITH_INPUT_IME)
79         list(APPEND PLATFORM_LINKLIBS imm32)
80 endif()
81
82 add_definitions(
83         -D_CRT_NONSTDC_NO_DEPRECATE
84         -D_CRT_SECURE_NO_DEPRECATE
85         -D_SCL_SECURE_NO_DEPRECATE
86         -D_CONSOLE
87         -D_LIB
88 )
89
90 # MSVC11 needs _ALLOW_KEYWORD_MACROS to build
91 add_definitions(-D_ALLOW_KEYWORD_MACROS)
92
93 # We want to support Vista level ABI
94 add_definitions(-D_WIN32_WINNT=0x600)
95
96 # Make cmake find the msvc redistributables
97 set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
98 include(InstallRequiredSystemLibraries)
99
100 #4133 treat incompatible pointer types as error
101 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc /we4133")
102 set(CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /we4133")
103
104 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
105 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
106 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
107 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
108 set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT")
109 set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
110 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
111 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
112
113 set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
114 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ")
115
116 # Ignore meaningless for us linker warnings.
117 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
118 set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
119
120 if(CMAKE_CL_64)
121         set(PLATFORM_LINKFLAGS "/MACHINE:X64 ${PLATFORM_LINKFLAGS}")
122 else()
123         set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
124 endif()
125
126 set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
127
128 if(NOT DEFINED LIBDIR)
129
130         # Setup 64bit and 64bit windows systems
131         if(CMAKE_CL_64)
132                 message(STATUS "64 bit compiler detected.")
133                 set(LIBDIR_BASE "win64")
134         else()
135                 message(STATUS "32 bit compiler detected.")
136                 set(LIBDIR_BASE "windows")
137         endif()
138         if(MSVC_VERSION EQUAL 1911)
139                 message(STATUS "Visual Studio 2017 detected.")
140                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
141         elseif(MSVC_VERSION EQUAL 1910)
142                 message(STATUS "Visual Studio 2017 detected.")
143                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
144         elseif(MSVC_VERSION EQUAL 1900)
145                 message(STATUS "Visual Studio 2015 detected.")
146                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
147         else()
148                 message(STATUS "Visual Studio 2013 detected.")
149                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc12)
150         endif()
151 else()
152         message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
153 endif()
154 if(NOT EXISTS "${LIBDIR}/")
155         message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
156 endif()
157
158 # Add each of our libraries to our cmake_prefix_path so find_package() could work
159 file(GLOB children RELATIVE ${LIBDIR} ${LIBDIR}/*)
160 foreach(child ${children})
161         if(IS_DIRECTORY ${LIBDIR}/${child})
162                 list(APPEND CMAKE_PREFIX_PATH  ${LIBDIR}/${child})
163         endif()
164 endforeach()
165
166 set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
167 set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz_st.lib)
168 set(ZLIB_INCLUDE_DIR ${LIBDIR}/zlib/include)
169 set(ZLIB_LIBRARY ${LIBDIR}/zlib/lib/libz_st.lib)
170 set(ZLIB_DIR ${LIBDIR}/zlib)
171
172 windows_find_package(zlib) # we want to find before finding things that depend on it like png
173 windows_find_package(png)
174
175 if(NOT PNG_FOUND)
176         warn_hardcoded_paths(libpng)
177         set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include)
178         set(PNG_LIBRARIES libpng)
179         set(PNG "${LIBDIR}/png")
180         set(PNG_INCLUDE_DIRS "${PNG}/include")
181         set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
182 endif()
183
184 set(JPEG_NAMES ${JPEG_NAMES} libjpeg)
185 windows_find_package(jpeg REQUIRED)
186 if(NOT JPEG_FOUND)
187         warn_hardcoded_paths(jpeg)
188         set(JPEG_INCLUDE_DIR ${LIBDIR}/jpeg/include)
189         set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib)
190 endif()
191
192 set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
193 set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
194
195 set(FREETYPE ${LIBDIR}/freetype)
196 set(FREETYPE_INCLUDE_DIRS
197         ${LIBDIR}/freetype/include
198         ${LIBDIR}/freetype/include/freetype2
199 )
200 set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
201 windows_find_package(freetype REQUIRED)
202
203 if(WITH_FFTW3)
204         set(FFTW3 ${LIBDIR}/fftw3)
205         set(FFTW3_LIBRARIES libfftw)
206         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
207         set(FFTW3_LIBPATH ${FFTW3}/lib)
208 endif()
209
210 if(WITH_OPENCOLLADA)
211         set(OPENCOLLADA ${LIBDIR}/opencollada)
212
213         set(OPENCOLLADA_INCLUDE_DIRS
214                 ${OPENCOLLADA}/include/opencollada/COLLADAStreamWriter
215                 ${OPENCOLLADA}/include/opencollada/COLLADABaseUtils
216                 ${OPENCOLLADA}/include/opencollada/COLLADAFramework
217                 ${OPENCOLLADA}/include/opencollada/COLLADASaxFrameworkLoader
218                 ${OPENCOLLADA}/include/opencollada/GeneratedSaxParser
219         )
220
221         set(OPENCOLLADA_LIBRARIES
222                 ${OPENCOLLADA}/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib
223                 ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAFramework.lib
224                 ${OPENCOLLADA}/lib/opencollada/OpenCOLLADABaseUtils.lib
225                 ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAStreamWriter.lib
226                 ${OPENCOLLADA}/lib/opencollada/MathMLSolver.lib
227                 ${OPENCOLLADA}/lib/opencollada/GeneratedSaxParser.lib
228                 ${OPENCOLLADA}/lib/opencollada/xml.lib
229                 ${OPENCOLLADA}/lib/opencollada/buffer.lib
230                 ${OPENCOLLADA}/lib/opencollada/ftoa.lib
231         )
232
233         if(NOT WITH_LLVM)
234                 list(APPEND OPENCOLLADA_LIBRARIES ${OPENCOLLADA}/lib/opencollada/UTF.lib)
235         endif()
236
237         set(PCRE_LIBRARIES
238                 ${OPENCOLLADA}/lib/opencollada/pcre.lib
239         )
240 endif()
241
242 if(WITH_CODEC_FFMPEG)
243         set(FFMPEG_INCLUDE_DIRS
244                 ${LIBDIR}/ffmpeg/include
245                 ${LIBDIR}/ffmpeg/include/msvc
246         )
247         windows_find_package(FFMPEG)
248         if(NOT FFMPEG_FOUND)
249                 warn_hardcoded_paths(ffmpeg)
250                 set(FFMPEG_LIBRARY_VERSION 57)
251                 set(FFMPEG_LIBRARY_VERSION_AVU 55)
252                 set(FFMPEG_LIBRARIES
253                         ${LIBDIR}/ffmpeg/lib/avcodec.lib
254                         ${LIBDIR}/ffmpeg/lib/avformat.lib
255                         ${LIBDIR}/ffmpeg/lib/avdevice.lib
256                         ${LIBDIR}/ffmpeg/lib/avutil.lib
257                         ${LIBDIR}/ffmpeg/lib/swscale.lib
258                         )
259         endif()
260 endif()
261
262 if(WITH_IMAGE_OPENEXR)
263         set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
264         set(OPENEXR_VERSION "2.1")
265         windows_find_package(OPENEXR REQUIRED)
266         if(NOT OPENEXR_FOUND)
267                 warn_hardcoded_paths(OpenEXR)
268                 set(OPENEXR ${LIBDIR}/openexr)
269                 set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
270                 set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
271                 set(OPENEXR_LIBPATH ${OPENEXR}/lib)
272                 set(OPENEXR_LIBRARIES
273                         optimized ${OPENEXR_LIBPATH}/Iex-2_2.lib
274                         optimized ${OPENEXR_LIBPATH}/Half.lib
275                         optimized ${OPENEXR_LIBPATH}/IlmImf-2_2.lib
276                         optimized ${OPENEXR_LIBPATH}/Imath-2_2.lib
277                         optimized ${OPENEXR_LIBPATH}/IlmThread-2_2.lib
278                         debug ${OPENEXR_LIBPATH}/Iex-2_2_d.lib
279                         debug ${OPENEXR_LIBPATH}/Half_d.lib
280                         debug ${OPENEXR_LIBPATH}/IlmImf-2_2_d.lib
281                         debug ${OPENEXR_LIBPATH}/Imath-2_2_d.lib
282                         debug ${OPENEXR_LIBPATH}/IlmThread-2_2_d.lib
283                 )
284         endif()
285 endif()
286
287 if(WITH_IMAGE_TIFF)
288         # Try to find tiff first then complain and set static and maybe wrong paths
289         windows_find_package(TIFF)
290         if(NOT TIFF_FOUND)
291                 warn_hardcoded_paths(libtiff)
292                 set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
293                 set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
294         endif()
295 endif()
296
297 if(WITH_JACK)
298         set(JACK_INCLUDE_DIRS
299                 ${LIBDIR}/jack/include/jack
300                 ${LIBDIR}/jack/include
301         )
302         set(JACK_LIBRARIES optimized ${LIBDIR}/jack/lib/libjack.lib debug ${LIBDIR}/jack/lib/libjack_d.lib)
303 endif()
304
305 if(WITH_PYTHON)
306         set(PYTHON_VERSION 3.6) # CACHE STRING)
307
308         string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
309         # Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
310         set(PYTHON_LIBRARY ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.lib)
311         unset(_PYTHON_VERSION_NO_DOTS)
312
313         # Shared includes for both vc2008 and vc2010
314         set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
315
316         # uncached vars
317         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
318         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
319 endif()
320
321 if(WITH_BOOST)
322         if(WITH_CYCLES_OSL)
323                 set(boost_extra_libs wave)
324         endif()
325         if(WITH_INTERNATIONAL)
326                 list(APPEND boost_extra_libs locale)
327         endif()
328         if(WITH_OPENVDB)
329                 list(APPEND boost_extra_libs iostreams)
330         endif()
331         set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
332         set(Boost_USE_MULTITHREADED ON) # suffix -mt
333         set(Boost_USE_STATIC_LIBS ON) # suffix -s
334         if (WITH_WINDOWS_FIND_MODULES)
335                 find_package(Boost COMPONENTS date_time filesystem thread regex system ${boost_extra_libs})
336         endif (WITH_WINDOWS_FIND_MODULES)
337         if(NOT Boost_FOUND)
338                 warn_hardcoded_paths(BOOST)
339                 set(BOOST ${LIBDIR}/boost)
340                 set(BOOST_INCLUDE_DIR ${BOOST}/include)
341                 if(MSVC12)
342                         set(BOOST_LIBPATH ${BOOST}/lib)
343                         set(BOOST_POSTFIX "vc120-mt-s-1_60.lib")
344                         set(BOOST_DEBUG_POSTFIX "vc120-mt-sgd-1_60.lib")
345                 else()
346                         set(BOOST_LIBPATH ${BOOST}/lib)
347                         set(BOOST_POSTFIX "vc140-mt-s-1_60.lib")
348                         set(BOOST_DEBUG_POSTFIX "vc140-mt-sgd-1_60.lib")
349                 endif()
350                 set(BOOST_LIBRARIES
351                         optimized libboost_date_time-${BOOST_POSTFIX}
352                         optimized libboost_filesystem-${BOOST_POSTFIX}
353                         optimized libboost_regex-${BOOST_POSTFIX}
354                         optimized libboost_system-${BOOST_POSTFIX}
355                         optimized libboost_thread-${BOOST_POSTFIX}
356                         debug libboost_date_time-${BOOST_DEBUG_POSTFIX}
357                         debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
358                         debug libboost_regex-${BOOST_DEBUG_POSTFIX}
359                         debug libboost_system-${BOOST_DEBUG_POSTFIX}
360                         debug libboost_thread-${BOOST_DEBUG_POSTFIX}
361                 )
362                 if(WITH_CYCLES_OSL)
363                         set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
364                                 optimized libboost_wave-${BOOST_POSTFIX}
365                                 debug libboost_wave-${BOOST_DEBUG_POSTFIX})
366                 endif()
367                 if(WITH_INTERNATIONAL)
368                         set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
369                                 optimized libboost_locale-${BOOST_POSTFIX}
370                                 debug libboost_locale-${BOOST_DEBUG_POSTFIX})
371                 endif()
372         else() # we found boost using find_package
373                 set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
374                 set(BOOST_LIBRARIES ${Boost_LIBRARIES})
375                 set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
376         endif()
377         set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
378 endif()
379
380 if(WITH_OPENIMAGEIO)
381         windows_find_package(OpenImageIO)
382         set(OPENIMAGEIO ${LIBDIR}/openimageio)
383         set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
384         set(OIIO_OPTIMIZED optimized OpenImageIO optimized OpenImageIO_Util)
385         set(OIIO_DEBUG debug OpenImageIO_d debug OpenImageIO_Util_d)
386         set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
387         set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
388         set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
389         set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
390         set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
391         add_definitions(-DOIIO_STATIC_BUILD)
392         add_definitions(-DOIIO_NO_SSE=1)
393 endif()
394
395 if(WITH_LLVM)
396         set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH     "Path to the LLVM installation")
397         file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_ROOT_DIR}/lib/*.lib)
398
399         if(EXISTS ${LLVM_ROOT_DIR}/debug/lib)
400                 foreach(LLVM_OPTIMIZED_LIB ${LLVM_LIBRARY_OPTIMIZED})
401                         get_filename_component(LIBNAME ${LLVM_OPTIMIZED_LIB} ABSOLUTE)
402                         list(APPEND LLVM_LIBS optimized ${LIBNAME})
403                 endforeach(LLVM_OPTIMIZED_LIB)
404
405                 file(GLOB LLVM_LIBRARY_DEBUG ${LLVM_ROOT_DIR}/debug/lib/*.lib)
406
407                 foreach(LLVM_DEBUG_LIB ${LLVM_LIBRARY_DEBUG})
408                         get_filename_component(LIBNAME ${LLVM_DEBUG_LIB} ABSOLUTE)
409                         list(APPEND LLVM_LIBS debug ${LIBNAME})
410                 endforeach(LLVM_DEBUG_LIB)
411
412                 set(LLVM_LIBRARY ${LLVM_LIBS})
413         else()
414                 message(WARNING "LLVM debug libs not present on this system. Using release libs for debug builds.")
415                 set(LLVM_LIBRARY ${LLVM_LIBRARY_OPTIMIZED})
416         endif()
417
418 endif()
419
420 if(WITH_OPENCOLORIO)
421         set(OPENCOLORIO ${LIBDIR}/opencolorio)
422         set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
423         set(OPENCOLORIO_LIBRARIES OpenColorIO)
424         set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
425         set(OPENCOLORIO_DEFINITIONS)
426 endif()
427
428 if(WITH_OPENVDB)
429         set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib)
430         set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
431         set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
432         set(OPENVDB ${LIBDIR}/openvdb)
433         set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
434         set(OPENVDB_LIBRARIES optimized openvdb debug openvdb_d ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
435         set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
436 endif()
437
438 if(WITH_ALEMBIC)
439         set(ALEMBIC ${LIBDIR}/alembic)
440         set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
441         set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
442         set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
443         set(ALEMBIC_LIBRARIES optimized alembic debug alembic_d)
444         set(ALEMBIC_FOUND 1)
445 endif()
446
447 if(WITH_MOD_CLOTH_ELTOPO)
448         set(LAPACK ${LIBDIR}/lapack)
449         # set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
450         set(LAPACK_LIBPATH ${LAPACK}/lib)
451         set(LAPACK_LIBRARIES
452                 ${LIBDIR}/lapack/lib/libf2c.lib
453                 ${LIBDIR}/lapack/lib/clapack_nowrap.lib
454                 ${LIBDIR}/lapack/lib/BLAS_nowrap.lib
455         )
456 endif()
457
458 if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
459         set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
460         set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
461         set(OPENSUBDIV_LIBRARIES
462                 optimized ${OPENSUBDIV_LIBPATH}/osdCPU.lib
463                 optimized ${OPENSUBDIV_LIBPATH}/osdGPU.lib
464                 debug ${OPENSUBDIV_LIBPATH}/osdCPU_d.lib
465                 debug ${OPENSUBDIV_LIBPATH}/osdGPU_d.lib
466         )
467         set(OPENSUBDIV_HAS_OPENMP TRUE)
468         set(OPENSUBDIV_HAS_TBB FALSE)
469         set(OPENSUBDIV_HAS_OPENCL TRUE)
470         set(OPENSUBDIV_HAS_CUDA FALSE)
471         set(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK TRUE)
472         set(OPENSUBDIV_HAS_GLSL_COMPUTE TRUE)
473         windows_find_package(OpenSubdiv)
474 endif()
475
476 if(WITH_SDL)
477         set(SDL ${LIBDIR}/sdl)
478         set(SDL_INCLUDE_DIR ${SDL}/include)
479         set(SDL_LIBPATH ${SDL}/lib)
480         set(SDL_LIBRARY SDL2)
481 endif()
482
483 # Audio IO
484 if(WITH_SYSTEM_AUDASPACE)
485         set(AUDASPACE_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
486         set(AUDASPACE_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace.lib)
487         set(AUDASPACE_C_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
488         set(AUDASPACE_C_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-c.lib)
489         set(AUDASPACE_PY_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
490         set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
491 endif()
492
493 # used in many places so include globally, like OpenGL
494 blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
495
496 #find signtool
497 set(ProgramFilesX86_NAME "ProgramFiles(x86)") #env dislikes the ( )
498 find_program(SIGNTOOL_EXE signtool
499         HINTS
500                 "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/bin/x86/"
501                 "$ENV{ProgramFiles}/Windows Kits/10/bin/x86/"
502                 "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.1/bin/x86/"
503                 "$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86/"
504                 "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.0/bin/x86/"
505                 "$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86/"
506 )