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