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