1b596e3d932b9e31078f4ff90d68e1fe9807246e
[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 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc")
101 set(CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} /nologo /J /Gd /MP")
102
103 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
104 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
105 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
106 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
107 set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT")
108 set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
109 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
110 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
111
112 set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
113 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ")
114
115 # Ignore meaningless for us linker warnings.
116 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
117 set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
118
119 if(CMAKE_CL_64)
120         set(PLATFORM_LINKFLAGS "/MACHINE:X64 ${PLATFORM_LINKFLAGS}")
121 else()
122         set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
123 endif()
124
125 set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
126
127 if(NOT DEFINED LIBDIR)
128
129         # Setup 64bit and 64bit windows systems
130         if(CMAKE_CL_64)
131                 message(STATUS "64 bit compiler detected.")
132                 set(LIBDIR_BASE "win64")
133         else()
134                 message(STATUS "32 bit compiler detected.")
135                 set(LIBDIR_BASE "windows")
136         endif()
137         if(MSVC_VERSION EQUAL 1911)
138                 message(STATUS "Visual Studio 2017 detected.")
139                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
140         elseif(MSVC_VERSION EQUAL 1910)
141                 message(STATUS "Visual Studio 2017 detected.")
142                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
143         elseif(MSVC_VERSION EQUAL 1900)
144                 message(STATUS "Visual Studio 2015 detected.")
145                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
146         else()
147                 message(STATUS "Visual Studio 2013 detected.")
148                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc12)
149         endif()
150 else()
151         message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
152 endif()
153 if(NOT EXISTS "${LIBDIR}/")
154         message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
155 endif()
156
157 # Add each of our libraries to our cmake_prefix_path so find_package() could work
158 file(GLOB children RELATIVE ${LIBDIR} ${LIBDIR}/*)
159 foreach(child ${children})
160         if(IS_DIRECTORY ${LIBDIR}/${child})
161                 list(APPEND CMAKE_PREFIX_PATH  ${LIBDIR}/${child})
162         endif()
163 endforeach()
164
165 set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
166 set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz_st.lib)
167 set(ZLIB_INCLUDE_DIR ${LIBDIR}/zlib/include)
168 set(ZLIB_LIBRARY ${LIBDIR}/zlib/lib/libz_st.lib)
169 set(ZLIB_DIR ${LIBDIR}/zlib)
170
171 windows_find_package(zlib) # we want to find before finding things that depend on it like png
172 windows_find_package(png)
173
174 if(NOT PNG_FOUND)
175         warn_hardcoded_paths(libpng)
176         set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include)
177         set(PNG_LIBRARIES libpng)
178         set(PNG "${LIBDIR}/png")
179         set(PNG_INCLUDE_DIRS "${PNG}/include")
180         set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
181 endif()
182
183 set(JPEG_NAMES ${JPEG_NAMES} libjpeg)
184 windows_find_package(jpeg REQUIRED)
185 if(NOT JPEG_FOUND)
186         warn_hardcoded_paths(jpeg)
187         set(JPEG_INCLUDE_DIR ${LIBDIR}/jpeg/include)
188         set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib)
189 endif()
190
191 set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
192 set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
193
194 set(FREETYPE ${LIBDIR}/freetype)
195 set(FREETYPE_INCLUDE_DIRS
196         ${LIBDIR}/freetype/include
197         ${LIBDIR}/freetype/include/freetype2
198 )
199 set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
200 windows_find_package(freetype REQUIRED)
201
202 if(WITH_FFTW3)
203         set(FFTW3 ${LIBDIR}/fftw3)
204         set(FFTW3_LIBRARIES libfftw)
205         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
206         set(FFTW3_LIBPATH ${FFTW3}/lib)
207 endif()
208
209 if(WITH_OPENCOLLADA)
210         set(OPENCOLLADA ${LIBDIR}/opencollada)
211
212         set(OPENCOLLADA_INCLUDE_DIRS
213                 ${OPENCOLLADA}/include/opencollada/COLLADAStreamWriter
214                 ${OPENCOLLADA}/include/opencollada/COLLADABaseUtils
215                 ${OPENCOLLADA}/include/opencollada/COLLADAFramework
216                 ${OPENCOLLADA}/include/opencollada/COLLADASaxFrameworkLoader
217                 ${OPENCOLLADA}/include/opencollada/GeneratedSaxParser
218         )
219
220         set(OPENCOLLADA_LIBRARIES
221                 ${OPENCOLLADA}/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib
222                 ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAFramework.lib
223                 ${OPENCOLLADA}/lib/opencollada/OpenCOLLADABaseUtils.lib
224                 ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAStreamWriter.lib
225                 ${OPENCOLLADA}/lib/opencollada/MathMLSolver.lib
226                 ${OPENCOLLADA}/lib/opencollada/GeneratedSaxParser.lib
227                 ${OPENCOLLADA}/lib/opencollada/xml.lib
228                 ${OPENCOLLADA}/lib/opencollada/buffer.lib
229                 ${OPENCOLLADA}/lib/opencollada/ftoa.lib
230         )
231
232         if(NOT WITH_LLVM)
233                 list(APPEND OPENCOLLADA_LIBRARIES ${OPENCOLLADA}/lib/opencollada/UTF.lib)
234         endif()
235
236         set(PCRE_LIBRARIES
237                 ${OPENCOLLADA}/lib/opencollada/pcre.lib
238         )
239 endif()
240
241 if(WITH_CODEC_FFMPEG)
242         set(FFMPEG_INCLUDE_DIRS
243                 ${LIBDIR}/ffmpeg/include
244                 ${LIBDIR}/ffmpeg/include/msvc
245         )
246         windows_find_package(FFMPEG)
247         if(NOT FFMPEG_FOUND)
248                 warn_hardcoded_paths(ffmpeg)
249                 set(FFMPEG_LIBRARY_VERSION 57)
250                 set(FFMPEG_LIBRARY_VERSION_AVU 55)
251                 set(FFMPEG_LIBRARIES
252                         ${LIBDIR}/ffmpeg/lib/avcodec.lib
253                         ${LIBDIR}/ffmpeg/lib/avformat.lib
254                         ${LIBDIR}/ffmpeg/lib/avdevice.lib
255                         ${LIBDIR}/ffmpeg/lib/avutil.lib
256                         ${LIBDIR}/ffmpeg/lib/swscale.lib
257                         )
258         endif()
259 endif()
260
261 if(WITH_IMAGE_OPENEXR)
262         set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
263         set(OPENEXR_VERSION "2.1")
264         windows_find_package(OPENEXR REQUIRED)
265         if(NOT OPENEXR_FOUND)
266                 warn_hardcoded_paths(OpenEXR)
267                 set(OPENEXR ${LIBDIR}/openexr)
268                 set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
269                 set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
270                 set(OPENEXR_LIBPATH ${OPENEXR}/lib)
271                 set(OPENEXR_LIBRARIES
272                         optimized ${OPENEXR_LIBPATH}/Iex-2_2.lib
273                         optimized ${OPENEXR_LIBPATH}/Half.lib
274                         optimized ${OPENEXR_LIBPATH}/IlmImf-2_2.lib
275                         optimized ${OPENEXR_LIBPATH}/Imath-2_2.lib
276                         optimized ${OPENEXR_LIBPATH}/IlmThread-2_2.lib
277                         debug ${OPENEXR_LIBPATH}/Iex-2_2_d.lib
278                         debug ${OPENEXR_LIBPATH}/Half_d.lib
279                         debug ${OPENEXR_LIBPATH}/IlmImf-2_2_d.lib
280                         debug ${OPENEXR_LIBPATH}/Imath-2_2_d.lib
281                         debug ${OPENEXR_LIBPATH}/IlmThread-2_2_d.lib
282                 )
283         endif()
284 endif()
285
286 if(WITH_IMAGE_TIFF)
287         # Try to find tiff first then complain and set static and maybe wrong paths
288         windows_find_package(TIFF)
289         if(NOT TIFF_FOUND)
290                 warn_hardcoded_paths(libtiff)
291                 set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
292                 set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
293         endif()
294 endif()
295
296 if(WITH_JACK)
297         set(JACK_INCLUDE_DIRS
298                 ${LIBDIR}/jack/include/jack
299                 ${LIBDIR}/jack/include
300         )
301         set(JACK_LIBRARIES optimized ${LIBDIR}/jack/lib/libjack.lib debug ${LIBDIR}/jack/lib/libjack_d.lib)
302 endif()
303
304 if(WITH_PYTHON)
305         set(PYTHON_VERSION 3.5) # CACHE STRING)
306
307         string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
308         # Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
309         set(PYTHON_LIBRARY ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.lib)
310         unset(_PYTHON_VERSION_NO_DOTS)
311
312         # Shared includes for both vc2008 and vc2010
313         set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
314
315         # uncached vars
316         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
317         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
318 endif()
319
320 if(WITH_BOOST)
321         if(WITH_CYCLES_OSL)
322                 set(boost_extra_libs wave)
323         endif()
324         if(WITH_INTERNATIONAL)
325                 list(APPEND boost_extra_libs locale)
326         endif()
327         if(WITH_OPENVDB)
328                 list(APPEND boost_extra_libs iostreams)
329         endif()
330         set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
331         set(Boost_USE_MULTITHREADED ON) # suffix -mt
332         set(Boost_USE_STATIC_LIBS ON) # suffix -s
333         if (WITH_WINDOWS_FIND_MODULES)
334                 find_package(Boost COMPONENTS date_time filesystem thread regex system ${boost_extra_libs})
335         endif (WITH_WINDOWS_FIND_MODULES)
336         if(NOT Boost_FOUND)
337                 warn_hardcoded_paths(BOOST)
338                 set(BOOST ${LIBDIR}/boost)
339                 set(BOOST_INCLUDE_DIR ${BOOST}/include)
340                 if(MSVC12)
341                         set(BOOST_LIBPATH ${BOOST}/lib)
342                         set(BOOST_POSTFIX "vc120-mt-s-1_60.lib")
343                         set(BOOST_DEBUG_POSTFIX "vc120-mt-sgd-1_60.lib")
344                 else()
345                         set(BOOST_LIBPATH ${BOOST}/lib)
346                         set(BOOST_POSTFIX "vc140-mt-s-1_60.lib")
347                         set(BOOST_DEBUG_POSTFIX "vc140-mt-sgd-1_60.lib")
348                 endif()
349                 set(BOOST_LIBRARIES
350                         optimized libboost_date_time-${BOOST_POSTFIX}
351                         optimized libboost_filesystem-${BOOST_POSTFIX}
352                         optimized libboost_regex-${BOOST_POSTFIX}
353                         optimized libboost_system-${BOOST_POSTFIX}
354                         optimized libboost_thread-${BOOST_POSTFIX}
355                         debug libboost_date_time-${BOOST_DEBUG_POSTFIX}
356                         debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
357                         debug libboost_regex-${BOOST_DEBUG_POSTFIX}
358                         debug libboost_system-${BOOST_DEBUG_POSTFIX}
359                         debug libboost_thread-${BOOST_DEBUG_POSTFIX}
360                 )
361                 if(WITH_CYCLES_OSL)
362                         set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
363                                 optimized libboost_wave-${BOOST_POSTFIX}
364                                 debug libboost_wave-${BOOST_DEBUG_POSTFIX})
365                 endif()
366                 if(WITH_INTERNATIONAL)
367                         set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
368                                 optimized libboost_locale-${BOOST_POSTFIX}
369                                 debug libboost_locale-${BOOST_DEBUG_POSTFIX})
370                 endif()
371         else() # we found boost using find_package
372                 set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
373                 set(BOOST_LIBRARIES ${Boost_LIBRARIES})
374                 set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
375         endif()
376         set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
377 endif()
378
379 if(WITH_OPENIMAGEIO)
380         windows_find_package(OpenImageIO)
381         set(OPENIMAGEIO ${LIBDIR}/openimageio)
382         set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
383         set(OIIO_OPTIMIZED optimized OpenImageIO optimized OpenImageIO_Util)
384         set(OIIO_DEBUG debug OpenImageIO_d debug OpenImageIO_Util_d)
385         set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
386         set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
387         set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
388         set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
389         set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
390         add_definitions(-DOIIO_STATIC_BUILD)
391         add_definitions(-DOIIO_NO_SSE=1)
392 endif()
393
394 if(WITH_LLVM)
395         set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH     "Path to the LLVM installation")
396         file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_ROOT_DIR}/lib/*.lib)
397
398         if(EXISTS ${LLVM_ROOT_DIR}/debug/lib)
399                 foreach(LLVM_OPTIMIZED_LIB ${LLVM_LIBRARY_OPTIMIZED})
400                         get_filename_component(LIBNAME ${LLVM_OPTIMIZED_LIB} ABSOLUTE)
401                         list(APPEND LLVM_LIBS optimized ${LIBNAME})
402                 endforeach(LLVM_OPTIMIZED_LIB)
403
404                 file(GLOB LLVM_LIBRARY_DEBUG ${LLVM_ROOT_DIR}/debug/lib/*.lib)
405
406                 foreach(LLVM_DEBUG_LIB ${LLVM_LIBRARY_DEBUG})
407                         get_filename_component(LIBNAME ${LLVM_DEBUG_LIB} ABSOLUTE)
408                         list(APPEND LLVM_LIBS debug ${LIBNAME})
409                 endforeach(LLVM_DEBUG_LIB)
410
411                 set(LLVM_LIBRARY ${LLVM_LIBS})
412         else()
413                 message(WARNING "LLVM debug libs not present on this system. Using release libs for debug builds.")
414                 set(LLVM_LIBRARY ${LLVM_LIBRARY_OPTIMIZED})
415         endif()
416
417 endif()
418
419 if(WITH_OPENCOLORIO)
420         set(OPENCOLORIO ${LIBDIR}/opencolorio)
421         set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
422         set(OPENCOLORIO_LIBRARIES OpenColorIO)
423         set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
424         set(OPENCOLORIO_DEFINITIONS)
425 endif()
426
427 if(WITH_OPENVDB)
428         set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib)
429         set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
430         set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
431         set(OPENVDB ${LIBDIR}/openvdb)
432         set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
433         set(OPENVDB_LIBRARIES optimized openvdb debug openvdb_d ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
434         set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
435 endif()
436
437 if(WITH_ALEMBIC)
438         set(ALEMBIC ${LIBDIR}/alembic)
439         set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
440         set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
441         set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
442         set(ALEMBIC_LIBRARIES optimized alembic debug alembic_d)
443         set(ALEMBIC_FOUND 1)
444 endif()
445
446 if(WITH_MOD_CLOTH_ELTOPO)
447         set(LAPACK ${LIBDIR}/lapack)
448         # set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
449         set(LAPACK_LIBPATH ${LAPACK}/lib)
450         set(LAPACK_LIBRARIES
451                 ${LIBDIR}/lapack/lib/libf2c.lib
452                 ${LIBDIR}/lapack/lib/clapack_nowrap.lib
453                 ${LIBDIR}/lapack/lib/BLAS_nowrap.lib
454         )
455 endif()
456
457 if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
458         set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
459         set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
460         set(OPENSUBDIV_LIBRARIES
461                 optimized ${OPENSUBDIV_LIBPATH}/osdCPU.lib
462                 optimized ${OPENSUBDIV_LIBPATH}/osdGPU.lib
463                 debug ${OPENSUBDIV_LIBPATH}/osdCPU_d.lib
464                 debug ${OPENSUBDIV_LIBPATH}/osdGPU_d.lib
465         )
466         set(OPENSUBDIV_HAS_OPENMP TRUE)
467         set(OPENSUBDIV_HAS_TBB FALSE)
468         set(OPENSUBDIV_HAS_OPENCL TRUE)
469         set(OPENSUBDIV_HAS_CUDA FALSE)
470         set(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK TRUE)
471         set(OPENSUBDIV_HAS_GLSL_COMPUTE TRUE)
472         windows_find_package(OpenSubdiv)
473 endif()
474
475 if(WITH_SDL)
476         set(SDL ${LIBDIR}/sdl)
477         set(SDL_INCLUDE_DIR ${SDL}/include)
478         set(SDL_LIBPATH ${SDL}/lib)
479         set(SDL_LIBRARY SDL2)
480 endif()
481
482 # Audio IO
483 if(WITH_SYSTEM_AUDASPACE)
484         set(AUDASPACE_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
485         set(AUDASPACE_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace.lib)
486         set(AUDASPACE_C_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
487         set(AUDASPACE_C_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-c.lib)
488         set(AUDASPACE_PY_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
489         set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
490 endif()
491
492 # used in many places so include globally, like OpenGL
493 blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
494
495 #find signtool
496 set(ProgramFilesX86_NAME "ProgramFiles(x86)") #env dislikes the ( )
497 find_program(SIGNTOOL_EXE signtool
498         HINTS
499                 "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/bin/x86/"
500                 "$ENV{ProgramFiles}/Windows Kits/10/bin/x86/"
501                 "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.1/bin/x86/"
502                 "$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86/"
503                 "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.0/bin/x86/"
504                 "$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86/"
505 )