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