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