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