PyAPI: Add gpu.matrix API
[blender.git] / source / creator / CMakeLists.txt
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) 2006, Blender Foundation
18 # All rights reserved.
19 #
20 # The Original Code is: all of this file.
21 #
22 # Contributor(s): Jacques Beaurain.
23 #
24 # ***** END GPL LICENSE BLOCK *****
25
26 setup_libdirs()
27
28 blender_include_dirs(
29         ../../intern/guardedalloc
30         ../../intern/glew-mx
31         ../blender/blenlib
32         ../blender/blenkernel
33         ../blender/blenloader
34         ../blender/depsgraph
35         ../blender/editors/include
36         ../blender/makesrna
37         ../blender/imbuf
38         ../blender/render/extern/include
39         ../blender/makesdna
40         ../blender/gpu
41         ../blender/windowmanager
42 )
43
44 add_definitions(${GL_DEFINITIONS})
45 blender_include_dirs("${GLEW_INCLUDE_PATH}")
46
47 if(WIN32)
48         blender_include_dirs(../../intern/utfconv)
49 endif()
50
51 if(WITH_LIBMV)
52         blender_include_dirs(../../intern/libmv)
53         add_definitions(-DWITH_LIBMV)
54 endif()
55
56 if(WITH_CYCLES AND WITH_CYCLES_LOGGING)
57         blender_include_dirs(../../intern/cycles/blender)
58         add_definitions(-DWITH_CYCLES_LOGGING)
59 endif()
60
61 if(WITH_CODEC_FFMPEG)
62         add_definitions(-DWITH_FFMPEG)
63 endif()
64
65 if(WITH_PYTHON)
66         blender_include_dirs(../blender/python)
67         add_definitions(-DWITH_PYTHON)
68
69         if(WITH_PYTHON_SECURITY)
70                 add_definitions(-DWITH_PYTHON_SECURITY)
71         endif()
72 endif()
73
74 if(WITH_HEADLESS)
75         add_definitions(-DWITH_HEADLESS)
76 endif()
77
78 if(WITH_GAMEENGINE)
79         blender_include_dirs(../gameengine/BlenderRoutines)
80
81         add_definitions(-DWITH_GAMEENGINE)
82 endif()
83
84 if(WITH_SDL)
85         if(WITH_SDL_DYNLOAD)
86                 add_definitions(-DWITH_SDL_DYNLOAD)
87                 blender_include_dirs(../../extern/sdlew/include)
88         endif()
89         add_definitions(-DWITH_SDL)
90 endif()
91
92 if(WITH_BINRELOC)
93         add_definitions(-DWITH_BINRELOC)
94         blender_include_dirs(${BINRELOC_INCLUDE_DIRS})
95 endif()
96
97 if(WITH_FREESTYLE)
98         add_definitions(-DWITH_FREESTYLE)
99         blender_include_dirs(../blender/freestyle)
100 endif()
101
102 # Setup the exe sources and buildinfo
103 set(SRC
104         creator.c
105         creator_args.c
106         creator_signals.c
107
108         creator_intern.h
109 )
110
111 # MSVC 2010 gives linking errors with the manifest
112 if(WIN32 AND NOT UNIX)
113         string(SUBSTRING ${BLENDER_VERSION} 0 1 bver1)
114         string(SUBSTRING ${BLENDER_VERSION} 2 1 bver2)
115         string(SUBSTRING ${BLENDER_VERSION} 3 1 bver3)
116         add_definitions(
117                 -DBLEN_VER_RC_STR=${BLENDER_VERSION}
118                 -DBLEN_VER_RC_1=${bver1}
119                 -DBLEN_VER_RC_2=${bver2}
120                 -DBLEN_VER_RC_3=${bver3}
121                 -DBLEN_VER_RC_4=0
122         )
123
124
125         list(APPEND SRC
126                 ${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.rc
127         )
128 endif()
129
130 if(WITH_BUILDINFO)
131         add_definitions(-DWITH_BUILDINFO)
132         # --------------------------------------------------------------------------
133         # These defines could all be moved into the header below
134         string(REPLACE " " "\ " BUILDINFO_CFLAGS "${CMAKE_C_FLAGS}")
135         string(REPLACE " " "\ " BUILDINFO_CXXFLAGS "${CMAKE_CXX_FLAGS}")
136         string(REPLACE " " "\ " BUILDINFO_LINKFLAGS "${PLATFORM_LINKFLAGS}")
137         add_definitions(
138                 # # define in header now, else these get out of date on rebuilds.
139                 # -DBUILD_DATE="${BUILD_DATE}"
140                 # -DBUILD_TIME="${BUILD_TIME}"
141                 # -DBUILD_COMMIT_TIMESTAMP="${BUILD_COMMIT_TIMESTAMP}"
142                 # -DBUILD_COMMIT_TIME="${BUILD_COMMIT_TIME}"
143                 # -DBUILD_COMMIT_DATE="${BUILD_COMMIT_DATE}"
144                 # -DBUILD_HASH="${BUILD_HASH}"
145                 # -DBUILD_BRANCH="${BUILD_BRANCH}"
146                 -DWITH_BUILDINFO_HEADER # alternative to lines above
147                 -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}"
148                 -DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
149                 -DBUILD_CFLAGS="${BUILDINFO_CFLAGS}"
150                 -DBUILD_CXXFLAGS="${BUILDINFO_CXXFLAGS}"
151                 -DBUILD_LINKFLAGS="${BUILDINFO_LINKFLAGS}"
152                 -DBUILD_SYSTEM="CMake"
153         )
154
155         # --------------------------------------------------------------------------
156         # write header for values that change each build
157         # note, generaed file is in build dir's source/creator
158         #       except when used as an include path.
159
160         # include the output directory, where the buildinfo.h file is generated
161         include_directories(${CMAKE_CURRENT_BINARY_DIR})
162
163
164         # XXX, ${buildinfo_h_fake} is used here,
165         # because we rely on that file being detected as missing
166         # every build so that the real header "buildinfo.h" is updated.
167         #
168         # Keep this until we find a better way to resolve!
169
170         set(buildinfo_h_real "${CMAKE_CURRENT_BINARY_DIR}/buildinfo.h")
171         set(buildinfo_h_fake "${CMAKE_CURRENT_BINARY_DIR}/buildinfo.h_fake")
172
173         if(EXISTS ${buildinfo_h_fake})
174                 message(FATAL_ERROR "File \"${buildinfo_h_fake}\" found, this should never be created, remove!")
175         endif()
176
177         # a custom target that is always built
178         add_custom_target(buildinfo ALL
179                 DEPENDS ${buildinfo_h_fake})
180
181         # creates buildinfo.h using cmake script
182         add_custom_command(
183                 OUTPUT
184                         ${buildinfo_h_fake}  # ensure we always run
185                         ${buildinfo_h_real}
186                 COMMAND ${CMAKE_COMMAND}
187                 -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
188                 # overrides only used when non-empty strings
189                 -DBUILD_DATE=${BUILDINFO_OVERRIDE_DATE}
190                 -DBUILD_TIME=${BUILDINFO_OVERRIDE_TIME}
191                 -P ${CMAKE_SOURCE_DIR}/build_files/cmake/buildinfo.cmake)
192
193         # buildinfo.h is a generated file
194         set_source_files_properties(
195                 ${buildinfo_h_real}
196                 PROPERTIES GENERATED TRUE
197                 HEADER_FILE_ONLY TRUE)
198
199         unset(buildinfo_h_real)
200         unset(buildinfo_h_fake)
201
202         # add deps below, after adding blender
203         # -------------- done with header values.
204
205         list(APPEND SRC
206                 buildinfo.c
207         )
208
209         # make an object library so can load with it in tests
210         add_library(buildinfoobj OBJECT buildinfo.c)
211         add_dependencies(buildinfoobj buildinfo)
212 endif()
213
214 add_cc_flags_custom_test(blender)
215
216 # message(STATUS "Configuring blender")
217 if(WITH_PYTHON_MODULE)
218         add_definitions(-DWITH_PYTHON_MODULE)
219
220         # creates ./bin/bpy.so which can be imported as a python module.
221         #
222         # note that 'SHARED' works on Linux and Windows,
223         # but not OSX which _must_ be 'MODULE'
224         add_library(blender MODULE ${SRC})
225         set_target_properties(
226                 blender
227                 PROPERTIES
228                         PREFIX ""
229                         OUTPUT_NAME bpy
230                         LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
231                         RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin  # only needed on windows
232         )
233
234         if(APPLE)
235                 set_target_properties(
236                         blender
237                         PROPERTIES
238                                 MACOSX_BUNDLE TRUE
239                                 LINK_FLAGS_RELEASE "${PLATFORM_LINKFLAGS}"
240                                 LINK_FLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG}"
241                 )
242         endif()
243
244         if(WIN32)
245                 # python modules use this
246                 set_target_properties(
247                         blender
248                         PROPERTIES
249                         SUFFIX ".pyd"
250                 )
251         endif()
252
253 else()
254         add_executable(blender ${EXETYPE} ${SRC})
255         WINDOWS_SIGN_TARGET(blender)
256 endif()
257
258 if(WITH_BUILDINFO)
259         # explicitly say that the executable depends on the buildinfo
260         add_dependencies(blender buildinfo)
261 endif()
262
263
264 set(BLENDER_TEXT_FILES
265         ${CMAKE_SOURCE_DIR}/release/text/GPL-license.txt
266         ${CMAKE_SOURCE_DIR}/release/text/GPL3-license.txt
267         ${CMAKE_SOURCE_DIR}/release/text/Python-license.txt
268         ${CMAKE_SOURCE_DIR}/release/text/copyright.txt
269         ${CMAKE_SOURCE_DIR}/release/text/jemalloc-license.txt
270         ${CMAKE_SOURCE_DIR}/release/text/ocio-license.txt
271         # generate this file
272         # ${CMAKE_SOURCE_DIR}/release/text/readme.html
273         ${CMAKE_SOURCE_DIR}/release/datafiles/LICENSE-bfont.ttf.txt
274 )
275
276 if(WITH_INTERNATIONAL)
277         list(APPEND BLENDER_TEXT_FILES
278                 ${CMAKE_SOURCE_DIR}/release/datafiles/LICENSE-droidsans.ttf.txt
279                 ${CMAKE_SOURCE_DIR}/release/datafiles/LICENSE-bmonofont-i18n.ttf.txt
280         )
281 endif()
282
283
284 # -----------------------------------------------------------------------------
285 # Platform Specific Var: TARGETDIR_VER
286
287 if(UNIX AND NOT APPLE)
288         if(WITH_PYTHON_MODULE)
289                 if(WITH_INSTALL_PORTABLE)
290                         set(TARGETDIR_VER ${BLENDER_VERSION})
291                 else()
292                         set(TARGETDIR_VER ${PYTHON_SITE_PACKAGES}/${BLENDER_VERSION})
293                 endif()
294         else()
295                 if(WITH_INSTALL_PORTABLE)
296                         set(TARGETDIR_VER ${BLENDER_VERSION})
297                 else()
298                         set(TARGETDIR_VER share/blender/${BLENDER_VERSION})
299                 endif()
300         endif()
301
302 elseif(WIN32)
303         set(TARGETDIR_VER ${BLENDER_VERSION})
304
305 elseif(APPLE)
306         if(WITH_PYTHON_MODULE)
307                 set(TARGETDIR_VER ${BLENDER_VERSION})
308         else()
309                 set(TARGETDIR_VER blender.app/Contents/Resources/${BLENDER_VERSION})
310         endif()
311         # Skip relinking on cpack / install
312         set_target_properties(blender PROPERTIES BUILD_WITH_INSTALL_RPATH true)
313 endif()
314
315
316 # -----------------------------------------------------------------------------
317 # Install Targets (Generic, All Platforms)
318
319
320 # important to make a clean  install each time, else old scripts get loaded.
321 install(
322         CODE
323         "file(REMOVE_RECURSE ${TARGETDIR_VER})"
324 )
325
326 if(WITH_PYTHON)
327         # install(CODE "message(\"copying blender scripts...\")")
328         
329         # exclude addons_contrib if release
330         if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR
331            "${BLENDER_VERSION_CYCLE}" STREQUAL "rc")
332                 set(ADDON_EXCLUDE_CONDITIONAL "addons_contrib/*")
333         else()
334                 set(ADDON_EXCLUDE_CONDITIONAL "_addons_contrib/*")  # dummy, wont do anything
335         endif()
336
337         # do not install freestyle dir if disabled
338         if(NOT WITH_FREESTYLE)
339                 set(FREESTYLE_EXCLUDE_CONDITIONAL "freestyle/*")
340         else()
341                 set(FREESTYLE_EXCLUDE_CONDITIONAL "_freestyle/*")  # dummy, wont do anything
342         endif()
343
344         install(
345                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
346                 DESTINATION ${TARGETDIR_VER}
347                 PATTERN ".git" EXCLUDE
348                 PATTERN ".gitignore" EXCLUDE
349                 PATTERN ".arcconfig" EXCLUDE
350                 PATTERN "__pycache__" EXCLUDE
351                 PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE
352                 PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE
353         )
354         
355         unset(ADDON_EXCLUDE_CONDITIONAL)
356         unset(FREESTYLE_EXCLUDE_CONDITIONAL)
357 endif()
358
359 # localization
360 if(WITH_INTERNATIONAL)
361         install(
362                 DIRECTORY
363                         ${CMAKE_SOURCE_DIR}/release/datafiles/fonts
364                 DESTINATION ${TARGETDIR_VER}/datafiles
365         )
366
367         set(_locale_dir "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
368         set(_locale_target_dir ${TARGETDIR_VER}/datafiles/locale)
369
370         file(GLOB _po_files "${_locale_dir}/po/*.po")
371         foreach(_po_file ${_po_files})
372                 msgfmt_simple(${_po_file} _all_mo_files)
373         endforeach()
374
375         # Create a custom target which will compile all po to mo
376         add_custom_target(
377                 locales
378                 DEPENDS ${_all_mo_files})
379
380         add_dependencies(blender locales)
381
382         # Generate INSTALL rules
383         install(
384                 FILES ${_locale_dir}/languages
385                 DESTINATION ${_locale_target_dir}
386         )
387
388         foreach(_mo_file ${_all_mo_files})
389                 get_filename_component(_locale_name ${_mo_file} NAME_WE)
390                 install(
391                         FILES ${_mo_file}
392                         DESTINATION ${_locale_target_dir}/${_locale_name}/LC_MESSAGES
393                         RENAME blender.mo
394                 )
395                 unset(_locale_name)
396         endforeach()
397
398         unset(_all_mo_files)
399         unset(_po_files)
400         unset(_po_file)
401         unset(_mo_file)
402         unset(_locale_target_dir)
403
404         unset(_locale_dir)
405 endif()
406
407 # color management
408 if(WITH_OPENCOLORIO)
409         install(
410                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/datafiles/colormanagement
411                 DESTINATION ${TARGETDIR_VER}/datafiles
412         )
413 endif()
414
415 # Add default workspaces.blend to build (under [version]/datafiles
416 install(
417         FILES ${CMAKE_SOURCE_DIR}/release/datafiles/workspaces.blend
418         DESTINATION ${TARGETDIR_VER}/datafiles
419 )
420
421 # helpful tip when using make
422 if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*")
423         # message after building.
424         add_custom_command(
425                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
426                 COMMAND ${CMAKE_COMMAND} -E
427                         echo 'now run: \"make install\" to copy runtime files and scripts to ${TARGETDIR_VER}'
428         )
429 endif()
430
431
432 # -----------------------------------------------------------------------------
433 # Install Targets (Platform Specific)
434
435 if(UNIX AND NOT APPLE)
436
437         if(NOT WITH_PYTHON_MODULE)
438                 if(WITH_DOC_MANPAGE)
439                         add_custom_target(
440                                 blender_man_page ALL
441                                 COMMAND ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py
442                                         ${EXECUTABLE_OUTPUT_PATH}/blender
443                                         ${CMAKE_CURRENT_BINARY_DIR}/blender.1)
444                         add_dependencies(blender_man_page blender)
445                 endif()
446         endif()
447
448         # there are a few differences between portable and system install
449         if(WITH_PYTHON_MODULE)
450                 if(WITH_INSTALL_PORTABLE)
451                         install(
452                                 TARGETS blender
453                                 DESTINATION "."
454                         )
455                 else()
456                         install(
457                                 TARGETS blender
458                                 LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES}
459                         )
460                 endif()
461                 # none of the other files are needed currently
462         elseif(WITH_INSTALL_PORTABLE)
463                 install(
464                         TARGETS blender
465                         DESTINATION "."
466                 )
467
468                 if(WITH_DOC_MANPAGE)
469                         install(
470                                 FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
471                                 DESTINATION "."
472                         )
473                 endif()
474                 install(
475                         FILES
476                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
477                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
478                         DESTINATION "."
479                 )
480
481                 install(
482                         PROGRAMS
483                         ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
484                         DESTINATION "."
485                 )
486
487                 set(BLENDER_TEXT_FILES_DESTINATION ".")
488         else()
489                 # main blender binary
490                 install(
491                         TARGETS blender
492                         DESTINATION bin
493                 )
494                 if(WITH_DOC_MANPAGE)
495                         # manpage only with 'blender' binary
496                         install(
497                                 FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
498                                 DESTINATION share/man/man1
499                         )
500                 endif()
501
502                 # misc files
503                 install(
504                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
505                         DESTINATION share/applications
506                 )
507                 install(
508                         DIRECTORY
509                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/16x16
510                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/22x22
511                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/24x24
512                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/32x32
513                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/48x48
514                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/256x256
515                         DESTINATION share/icons/hicolor
516                         PATTERN "*.svg" EXCLUDE
517                 )
518                 install(
519                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
520                         DESTINATION share/icons/hicolor/scalable/apps
521                 )
522                 install(
523                         PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
524                         DESTINATION bin
525                 )
526                 set(BLENDER_TEXT_FILES_DESTINATION share/doc/blender)
527         endif()
528
529         if(WITH_PYTHON)
530                 if(WITH_PYTHON_INSTALL)
531
532                         install(
533                                 PROGRAMS ${PYTHON_EXECUTABLE}
534                                 DESTINATION ${TARGETDIR_VER}/python/bin
535                         )
536
537                         # on some platforms (like openSUSE) Python is linked
538                         # to be used from lib64 folder.
539                         # determine this from Python's libraries path
540                         #
541                         # ugh, its possible 'lib64' is just a symlink to 'lib' which causes incorrect use of 'lib64'
542                         get_filename_component(_pypath_real ${PYTHON_LIBPATH} REALPATH)
543                         if(${_pypath_real} MATCHES "lib64$")
544                                 set(_target_LIB "lib64")
545                         else()
546                                 set(_target_LIB "lib")
547                         endif()
548                         unset(_pypath_real)
549
550                         # Copy the systems python into the install directory
551                         # install(CODE "message(\"copying a subset of the systems python...\")")
552                         install(
553                                 DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}
554                                 DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}
555                                 PATTERN "__pycache__" EXCLUDE               # * any cache *
556                                 PATTERN "config-${PYTHON_VERSION}m/*.a" EXCLUDE  # static lib
557                                 PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
558                                 PATTERN "site-packages/*" EXCLUDE           # ./site-packages/*
559                                 PATTERN "tkinter" EXCLUDE                   # ./tkinter
560                                 PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
561                                 PATTERN "idlelib" EXCLUDE                   # ./idlelib
562                                 PATTERN "test" EXCLUDE                      # ./test
563                                 PATTERN "turtledemo" EXCLUDE                # ./turtledemo
564                                 PATTERN "turtle.py" EXCLUDE                 # ./turtle.py
565                         )
566
567                         # Needed for distutils/pip
568                         # get the last part of the include dir, will be 'python{version}{abiflag}',
569                         get_filename_component(_py_inc_suffix ${PYTHON_INCLUDE_DIR} NAME)
570                         install(
571                                 FILES ${PYTHON_INCLUDE_DIR}/pyconfig.h
572                                 DESTINATION ${TARGETDIR_VER}/python/include/${_py_inc_suffix}
573                         )
574                         unset(_py_inc_suffix)
575
576                         if(WITH_PYTHON_INSTALL_NUMPY)
577                                 # Install to the same directory as the source, so debian-like
578                                 # distros are happy with their policy.
579                                 set(_suffix "site-packages")
580                                 if(${PYTHON_NUMPY_PATH} MATCHES "dist-packages")
581                                         set(_suffix "dist-packages")
582                                 endif()
583                                 install(
584                                         DIRECTORY ${PYTHON_NUMPY_PATH}/numpy
585                                         DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
586                                         PATTERN ".svn" EXCLUDE
587                                         PATTERN "__pycache__" EXCLUDE           # * any cache *
588                                         PATTERN "*.pyc" EXCLUDE                 # * any cache *
589                                         PATTERN "*.pyo" EXCLUDE                 # * any cache *
590                                         PATTERN "oldnumeric" EXCLUDE            # ./oldnumeric
591                                         PATTERN "doc" EXCLUDE                   # ./doc
592                                         PATTERN "tests" EXCLUDE                 # ./tests
593                                         PATTERN "f2py" EXCLUDE                  # ./f2py - fortran/python interface code, not for blender.
594                                         PATTERN "include" EXCLUDE               # include dirs all over, we wont use NumPy/CAPI
595                                         PATTERN "*.h" EXCLUDE                   # some includes are not in include dirs
596                                         PATTERN "*.a" EXCLUDE                   # ./core/lib/libnpymath.a - for linking, we dont need.
597                                 )
598                                 unset(_suffix)
599                         endif()
600
601                         # Copy requests, we need to generalize site-packages
602                         if(WITH_PYTHON_INSTALL_REQUESTS)
603                                 set(_suffix "site-packages")
604                                 if(${PYTHON_REQUESTS_PATH} MATCHES "dist-packages")
605                                         set(_suffix "dist-packages")
606                                 endif()
607                                 install(
608                                         DIRECTORY ${PYTHON_REQUESTS_PATH}/requests
609                                         DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
610                                         PATTERN ".svn" EXCLUDE
611                                         PATTERN "__pycache__" EXCLUDE           # * any cache *
612                                         PATTERN "*.pyc" EXCLUDE                 # * any cache *
613                                         PATTERN "*.pyo" EXCLUDE                 # * any cache *
614                                 )
615                                 # On some platforms requests does have extra dependencies.
616                                 set(_requests_deps "chardet" "urllib3")
617                                 foreach(_requests_dep ${_requests_deps})
618                                         if(EXISTS ${PYTHON_REQUESTS_PATH}/${_requests_dep})
619                                                 install(
620                                                         DIRECTORY ${PYTHON_REQUESTS_PATH}/${_requests_dep}
621                                                         DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
622                                                         PATTERN ".svn" EXCLUDE
623                                                         PATTERN "__pycache__" EXCLUDE           # * any cache *
624                                                         PATTERN "*.pyc" EXCLUDE                 # * any cache *
625                                                         PATTERN "*.pyo" EXCLUDE                 # * any cache *
626                                                 )
627                                         endif()
628                                 endforeach()
629                                 if(EXISTS ${PYTHON_REQUESTS_PATH}/six.py)
630                                         install(
631                                                 FILES ${PYTHON_REQUESTS_PATH}/six.py
632                                                 DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
633                                         )
634                                 endif()
635                                 unset(_requests_dep)
636                                 unset(_requests_deps)
637                                 unset(_suffix)
638                         endif()
639                         unset(_target_LIB)
640                         
641                 endif()
642         endif()
643 elseif(WIN32)
644
645         set(BLENDER_TEXT_FILES_DESTINATION ".")
646
647         if(WITH_PYTHON)
648                 string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
649
650                 if(NOT CMAKE_COMPILER_IS_GNUCC)
651                         install(
652                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
653                                 DESTINATION "."
654                                 CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
655                         )
656
657                         install(
658                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
659                                 DESTINATION "."
660                                 CONFIGURATIONS Debug
661                         )
662                 endif()
663
664                 if(WITH_PYTHON_INSTALL)
665                         # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
666
667                         install(DIRECTORY DESTINATION ${TARGETDIR_VER}/python)
668                         install(DIRECTORY DESTINATION ${TARGETDIR_VER}/python/lib)
669
670                         # WARNING: its important that 'CMAKE_INSTALL_CONFIG_NAME' is evaluated at build time
671                         # and _NOT_ configuration time, when modifying the lines below,
672                         # check it works in both Release & Debug mode.
673                         #
674                         # Edit with extreme care! - Campbell
675
676                         # extract python
677                         install(
678                                 CODE
679                                 "
680                                 message(STATUS \"Extracting Python to: \${CMAKE_INSTALL_PREFIX}/${BLENDER_VERSION}/python\")
681                                 if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Dd][Ee][Bb][Uu][Gg])$\")
682                                         set(PYTHON_ZIP \"${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_d.tar.gz\")
683                                 else()
684                                         set(PYTHON_ZIP \"${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}.tar.gz\")
685                                 endif()
686
687                                 execute_process(
688                                         COMMAND \${CMAKE_COMMAND} -E make_directory
689                                                 \"\${CMAKE_INSTALL_PREFIX}/${BLENDER_VERSION}/python\"
690                                         COMMAND \${CMAKE_COMMAND} -E
691                                                 chdir \"\${CMAKE_INSTALL_PREFIX}/${BLENDER_VERSION}/python\"
692                                                 \${CMAKE_COMMAND} -E
693                                                 tar xzfv \"\${PYTHON_ZIP}\"
694                                 )
695                                 unset(PYTHON_ZIP)
696                                 "
697                         )
698
699                         # release/site-packages
700                         install(
701                                 DIRECTORY ${LIBDIR}/release/site-packages
702                                 DESTINATION ${BLENDER_VERSION}/python/lib
703                                 PATTERN ".svn" EXCLUDE
704                                 PATTERN "__pycache__" EXCLUDE           # * any cache *
705                                 PATTERN "*.pyc" EXCLUDE                 # * any cache *
706                                 PATTERN "*.pyo" EXCLUDE                 # * any cache *)
707                         )
708
709                         if(WITH_PYTHON_INSTALL_NUMPY)
710                                 set(PYTHON_NUMPY_VERSION 1.10)
711                                 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
712                                         COMMAND ${CMAKE_COMMAND} -E
713                                                 make_directory ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages)
714
715                                 add_custom_command(
716                                         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
717                                         COMMAND ${CMAKE_COMMAND} -E
718                                                 tar xzvf "${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}$<$<CONFIG:Debug>:d>.tar.gz"
719                                         DEPENDS
720                                                 ${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}$<$<CONFIG:Debug>:d>.tar.gz
721                                                 ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
722                                         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
723                                 )
724                                 add_custom_target(
725                                         python_numpy ALL
726                                         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
727                                 )
728                                 install(
729                                         DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
730                                         DESTINATION ${BLENDER_VERSION}/python/lib/site-packages
731                                 )
732                         endif()
733
734
735                         # TODO(sergey): For unti we've got better way to deal with python binary
736                         install(
737                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
738                                 DESTINATION ${BLENDER_VERSION}/python/bin
739                                 CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
740                         )
741                         install(
742                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
743                                 DESTINATION ${BLENDER_VERSION}/python/bin
744                                 CONFIGURATIONS Debug
745                         )
746                 endif()
747
748                 unset(_PYTHON_VERSION_NO_DOTS)
749         endif()
750
751         # EGL Runtime Components
752         if(WITH_GL_EGL)
753                 if(WIN32)
754                         install(FILES "${OPENGLES_DLL}"     DESTINATION ".")
755                         install(FILES "${OPENGLES_EGL_DLL}" DESTINATION ".")
756
757                         if(WITH_GL_ANGLE)
758                                 install(FILES "${D3DCOMPILER_DLL}" DESTINATION ".")
759                         endif()
760                 endif()
761         endif()
762
763         if(MSVC)
764                 install(
765                         FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
766                         DESTINATION "."
767                 )
768         endif()
769
770         if(WITH_CODEC_FFMPEG)
771                 install(
772                         FILES
773                                 ${LIBDIR}/ffmpeg/lib/avcodec-57.dll
774                                 ${LIBDIR}/ffmpeg/lib/avformat-57.dll
775                                 ${LIBDIR}/ffmpeg/lib/avdevice-57.dll
776                                 ${LIBDIR}/ffmpeg/lib/avutil-55.dll
777                                 ${LIBDIR}/ffmpeg/lib/swscale-4.dll
778                                 ${LIBDIR}/ffmpeg/lib/swresample-2.dll
779                         DESTINATION "."
780                 )
781         endif()
782
783         if(WITH_CODEC_SNDFILE)
784                 install(
785                         FILES ${LIBDIR}/sndfile/lib/libsndfile-1.dll
786                         DESTINATION "."
787                 )
788         endif()
789
790         if(WITH_OPENAL)
791                 install(
792                         FILES
793                                 ${LIBDIR}/openal/lib/OpenAL32.dll
794                         DESTINATION "."
795                 )
796         endif()
797
798         if(WITH_SDL)
799                 install(
800                         FILES ${LIBDIR}/sdl/lib/SDL2.dll
801                         DESTINATION "."
802                 )
803         endif()
804         
805         if(WITH_SYSTEM_AUDASPACE)
806                 install(
807                         FILES
808                                 ${LIBDIR}/audaspace/lib/audaspace.dll
809                                 ${LIBDIR}/audaspace/lib/audaspace-c.dll
810                                 ${LIBDIR}/audaspace/lib/audaspace-py.dll
811                         DESTINATION "."
812                 )
813         endif()
814
815         if(NOT CMAKE_CL_64)
816                 install(
817                         FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll
818                         DESTINATION "."
819                 )
820         endif()
821                 
822         install( # x86 builds can run on x64 Windows, so this is required at all times
823                 FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
824                 DESTINATION "."
825         )
826
827         if(WITH_OPENCOLORIO)
828                 set(OCIOBIN ${LIBDIR}/opencolorio/bin)
829                         install(
830                                 FILES
831                                         ${OCIOBIN}/OpenColorIO.dll
832                                 DESTINATION "."
833                         )
834         endif()
835
836 elseif(APPLE)
837
838         # handy install macro to exclude files, we use \$ escape for the "to"
839         # argument when calling so ${BUILD_TYPE} does not get expanded
840         macro(install_dir from to)
841                 install(
842                         DIRECTORY ${from}
843                         DESTINATION ${to}
844                         PATTERN ".git" EXCLUDE
845                         PATTERN ".svn" EXCLUDE
846                         PATTERN "*.pyc" EXCLUDE
847                         PATTERN "*.pyo" EXCLUDE
848                         PATTERN "*.orig" EXCLUDE
849                         PATTERN "*.rej" EXCLUDE
850                         PATTERN "__pycache__" EXCLUDE
851                         PATTERN "__MACOSX" EXCLUDE
852                         PATTERN ".DS_Store" EXCLUDE
853                         PATTERN "config-${PYTHON_VERSION}m/*.a" EXCLUDE  # static lib
854                         PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
855                         PATTERN "tkinter" EXCLUDE                   # ./tkinter
856                         PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
857                         PATTERN "idlelib" EXCLUDE                   # ./idlelib
858                         PATTERN "test" EXCLUDE                      # ./test
859                         PATTERN "turtledemo" EXCLUDE                # ./turtledemo
860                         PATTERN "turtle.py" EXCLUDE                 # ./turtle.py
861                 )
862         endmacro()
863
864         set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blender.app)
865
866         # setup Info.plist
867         execute_process(COMMAND date "+%Y-%m-%d"
868                         OUTPUT_VARIABLE BLENDER_DATE
869                         OUTPUT_STRIP_TRAILING_WHITESPACE)
870
871         set_target_properties(blender PROPERTIES
872                 MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist
873                 MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
874                 MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
875
876         # Gather the date in finder-style
877         execute_process(COMMAND date "+%m/%d/%Y/%H:%M"
878         OUTPUT_VARIABLE SETFILE_DATE
879         OUTPUT_STRIP_TRAILING_WHITESPACE)
880
881         # Give the bundle actual creation/modification date
882         execute_process(COMMAND SetFile -d ${SETFILE_DATE} -m ${SETFILE_DATE}
883                         ${EXECUTABLE_OUTPUT_PATH}/blender.app)
884
885         install(
886                 TARGETS blender
887                 DESTINATION "."
888         )
889
890         # install release and app files
891         set(BLENDER_TEXT_FILES_DESTINATION ".")
892
893         install(
894                 FILES ${OSX_APP_SOURCEDIR}/Contents/PkgInfo
895                 DESTINATION blender.app/Contents
896         )
897
898         install_dir(
899                 ${OSX_APP_SOURCEDIR}/Contents/Resources
900                 blender.app/Contents/
901         )
902
903         if(WITH_OPENMP AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
904                 install(
905                         FILES ${LIBDIR}/openmp/lib/libiomp5.dylib
906                         DESTINATION blender.app/Contents/Resources/lib/
907                 )
908                 install(
909                         FILES ${LIBDIR}/openmp/LICENSE.txt
910                         DESTINATION "."
911                         RENAME LICENSE-libiomp5.txt
912                 )
913         endif()
914
915         if(WITH_LLVM AND NOT LLVM_STATIC)
916                 install(
917                         FILES ${LIBDIR}/llvm/lib/libLLVM-3.4.dylib
918                         DESTINATION blender.app/Contents/MacOS
919                 )
920         endif()
921
922         # python
923         if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
924                 if(WITH_CXX11)
925                         # Copy the python libs into the install directory
926                         install_dir(
927                                 ${PYTHON_LIBPATH}
928                                 ${TARGETDIR_VER}/python/lib
929                         )
930                 else()
931                         # the python zip is first extracted as part of the build process,
932                         # and then later installed as part of make install. this is much
933                         # quicker, and means we can easily exclude files on copy
934                         # Not needed for PYTHON_MODULE or WEB_PLUGIN due uses Pyhon framework
935                         # use a hash of the .zip path to handle switching between different
936                         # lib directories without needing a clean build
937                         string(SHA1 PYTHON_ZIP_HASH ${LIBDIR}/release/${PYTHON_ZIP})
938                         set(PYTHON_EXTRACT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_ZIP_HASH}/python)
939
940                         add_custom_target(
941                                 extractpyzip
942                                 DEPENDS ${PYTHON_EXTRACT_DIR})
943
944                         set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
945
946                         add_custom_command(
947                                 OUTPUT ${PYTHON_EXTRACT_DIR}
948                                 COMMAND ${CMAKE_COMMAND} -E remove_directory "${PYTHON_EXTRACT_DIR}/"
949                                 COMMAND ${CMAKE_COMMAND} -E make_directory "${PYTHON_EXTRACT_DIR}/"
950                                 COMMAND ${CMAKE_COMMAND} -E chdir "${PYTHON_EXTRACT_DIR}/"
951                                                 ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}"
952                                 DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
953
954                         add_dependencies(blender extractpyzip)
955
956                         # copy extracted python files
957                         install_dir(
958                                 ${PYTHON_EXTRACT_DIR}
959                                 \${TARGETDIR_VER}
960                         )
961                         # copy site-packages files
962                         install_dir(
963                                 ${LIBDIR}/release/site-packages
964                                 \${TARGETDIR_VER}/python/lib/python${PYTHON_VERSION}
965                         )
966                 endif()
967
968                 install(DIRECTORY ${LIBDIR}/python/bin
969                         DESTINATION ${TARGETDIR_VER}/python
970                         USE_SOURCE_PERMISSIONS
971                 )
972
973                 # Needed for distutils/pip
974                 # get the last part of the include dir, will be 'python{version}{abiflag}',
975                 get_filename_component(_py_inc_suffix ${PYTHON_INCLUDE_DIR} NAME)
976                 install(
977                         FILES ${PYTHON_INCLUDE_DIR}/pyconfig.h
978                         DESTINATION ${TARGETDIR_VER}/python/include/${_py_inc_suffix}
979                 )
980                 unset(_py_inc_suffix)
981         endif()
982         
983         # install blenderplayer bundle - copy of blender.app above. re-using macros et al
984         # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it
985         if(WITH_GAMEENGINE AND WITH_PLAYER)
986                 set(OSX_APP_PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blenderplayer.app)
987                 set(PLAYER_SOURCEINFO ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Info.plist)
988                 set(PLAYER_TARGETDIR_VER blenderplayer.app/Contents/Resources/${BLENDER_VERSION})
989
990
991                 # important to make a clean  install each time else old scripts get loaded.
992                 install(
993                         CODE
994                         "file(REMOVE_RECURSE ${PLAYER_TARGETDIR_VER})"
995                 )
996
997                 # Give the bundle actual creation/modification date
998                 execute_process(COMMAND SetFile -d ${SETFILE_DATE} -m ${SETFILE_DATE}
999                                 ${EXECUTABLE_OUTPUT_PATH}/blenderplayer.app)
1000
1001                 install(
1002                         FILES ${OSX_APP_PLAYER_SOURCEDIR}/Contents/PkgInfo
1003                         DESTINATION blenderplayer.app/Contents
1004                 )
1005
1006                 install_dir(
1007                         ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Resources
1008                         blenderplayer.app/Contents/
1009                 )
1010
1011                 if(WITH_OPENMP AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
1012                         install(
1013                                 FILES ${LIBDIR}/openmp/lib/libiomp5.dylib
1014                                 DESTINATION blenderplayer.app/Contents/Resources/lib/
1015                         )
1016                 endif()
1017
1018
1019                 # python
1020                 if(WITH_PYTHON AND NOT WITH_PYTHON_FRAMEWORK)
1021                         if(WITH_CXX11)
1022                                 # Copy the python libs into the install directory
1023                                 install_dir(
1024                                         ${PYTHON_LIBPATH}
1025                                         ${PLAYER_TARGETDIR_VER}/python/lib
1026                                 )
1027                         else()
1028                                 add_custom_command(
1029                                         OUTPUT ${PYTHON_EXTRACT_DIR}
1030                                         COMMAND ${CMAKE_COMMAND} -E remove_directory "${PYTHON_EXTRACT_DIR}/"
1031                                         COMMAND ${CMAKE_COMMAND} -E make_directory "${PYTHON_EXTRACT_DIR}/"
1032                                         COMMAND ${CMAKE_COMMAND} -E chdir "${PYTHON_EXTRACT_DIR}/"
1033                                                         ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}"
1034                                         DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
1035
1036                                 # copy extracted python files
1037                                 install_dir(
1038                                         ${PYTHON_EXTRACT_DIR}
1039                                         \${PLAYER_TARGETDIR_VER}
1040                                 )
1041                         endif()
1042                 endif()
1043
1044         endif()
1045
1046 endif()
1047
1048 # -----------------------------------------------------------------------------
1049 # Generic Install, for all targets
1050
1051 if(DEFINED BLENDER_TEXT_FILES_DESTINATION)
1052
1053         install(
1054                 CODE
1055                 "
1056                 file(READ \"${CMAKE_SOURCE_DIR}/release/text/readme.html\" DATA_SRC)
1057                 string(REGEX REPLACE \"BLENDER_VERSION\" \"${BLENDER_VERSION}\" DATA_DST \"\${DATA_SRC}\")
1058                 file(WRITE \"${CMAKE_BINARY_DIR}/release/text/readme.html\" \"\${DATA_DST}\")
1059                 unset(DATA_SRC)
1060                 unset(DATA_DST)
1061                 "
1062         )
1063         list(APPEND BLENDER_TEXT_FILES
1064                 ${CMAKE_BINARY_DIR}/release/text/readme.html
1065         )
1066
1067         install(
1068                 FILES ${BLENDER_TEXT_FILES}
1069                 DESTINATION "${BLENDER_TEXT_FILES_DESTINATION}"
1070         )
1071 endif()
1072
1073 # install more files specified elsewhere
1074 delayed_do_install(${TARGETDIR_VER})
1075
1076 unset(BLENDER_TEXT_FILES)
1077 unset(BLENDER_TEXT_FILES_DESTINATION)
1078
1079
1080 # -----------------------------------------------------------------------------
1081 # Setup link libs
1082
1083 add_dependencies(blender makesdna)
1084
1085 setup_blender_sorted_libs()
1086 target_link_libraries(blender ${BLENDER_SORTED_LIBS})
1087
1088 setup_liblinks(blender)
1089
1090 # -----------------------------------------------------------------------------
1091 # Setup launcher
1092
1093 if(WIN32 AND NOT WITH_PYTHON_MODULE)
1094         install(
1095                 TARGETS blender
1096                 COMPONENT Blender
1097                 DESTINATION "."
1098         )
1099         if(CMAKE_CL_64)
1100                 set(_WIN_PLATFORM x64)
1101         else()
1102                 set(_WIN_PLATFORM x86)
1103         endif()
1104         if(MSVC12_REDIST_DIR)
1105                 install(
1106                         FILES
1107                                 ${MSVC12_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC120.CRT/msvcp120.dll
1108                                 ${MSVC12_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC120.CRT/msvcr120.dll
1109                         DESTINATION "."
1110                 )
1111                 if(WITH_OPENMP)
1112                         install(
1113                                 FILES ${MSVC12_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC120.OpenMP/vcomp120.dll
1114                                 DESTINATION "."
1115                         )
1116                 endif()
1117         endif()
1118         
1119         if(MSVC14_REDIST_DIR)
1120                 set(KITSDIRx86 "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/")
1121                 set(KITSDIR "$ENV{ProgramFiles}/Windows Kits/10/")
1122                 if(IS_DIRECTORY ${KITSDIR})
1123                         set(KITSPATH "${KITSDIR}/Redist/ucrt/DLLs/${_WIN_PLATFORM}")
1124                 else()
1125                         if(IS_DIRECTORY ${KITSDIRx86})
1126                                 set(KITSPATH "${KITSDIRx86}/Redist/ucrt/DLLs/${_WIN_PLATFORM}")
1127                         else()
1128                                 message(FATAL_ERROR "Windows 10 SDK directory not found")
1129                         endif()
1130                 endif()
1131                 FILE(TO_CMAKE_PATH  ${KITSPATH} KITSPATH)
1132                 install(
1133                         FILES
1134                                 ${KITSPATH}/api-ms-win-core-file-l1-2-0.dll
1135                                 ${KITSPATH}/api-ms-win-core-file-l2-1-0.dll
1136                                 ${KITSPATH}/api-ms-win-core-localization-l1-2-0.dll
1137                                 ${KITSPATH}/api-ms-win-core-processthreads-l1-1-0.dll
1138                                 ${KITSPATH}/api-ms-win-core-processthreads-l1-1-1.dll
1139                                 ${KITSPATH}/api-ms-win-core-synch-l1-1-0.dll
1140                                 ${KITSPATH}/api-ms-win-core-synch-l1-2-0.dll
1141                                 ${KITSPATH}/api-ms-win-core-timezone-l1-1-0.dll
1142                                 ${KITSPATH}/api-ms-win-crt-conio-l1-1-0.dll
1143                                 ${KITSPATH}/api-ms-win-crt-convert-l1-1-0.dll
1144                                 ${KITSPATH}/api-ms-win-crt-environment-l1-1-0.dll
1145                                 ${KITSPATH}/api-ms-win-crt-filesystem-l1-1-0.dll
1146                                 ${KITSPATH}/api-ms-win-crt-heap-l1-1-0.dll
1147                                 ${KITSPATH}/api-ms-win-crt-locale-l1-1-0.dll
1148                                 ${KITSPATH}/api-ms-win-crt-math-l1-1-0.dll
1149                                 ${KITSPATH}/api-ms-win-crt-process-l1-1-0.dll
1150                                 ${KITSPATH}/api-ms-win-crt-runtime-l1-1-0.dll
1151                                 ${KITSPATH}/api-ms-win-crt-stdio-l1-1-0.dll
1152                                 ${KITSPATH}/api-ms-win-crt-string-l1-1-0.dll
1153                                 ${KITSPATH}/api-ms-win-crt-time-l1-1-0.dll
1154                                 ${KITSPATH}/ucrtbase.dll
1155                                 ${MSVC14_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC140.CRT/vcruntime140.dll
1156                         DESTINATION "."
1157                 )
1158                 if(WITH_OPENMP)
1159                         install(
1160                                 FILES ${MSVC14_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC140.OpenMP/vcomp140.dll
1161                                 DESTINATION "."
1162                         )
1163                 endif()
1164         endif()
1165 endif()