[MSVC] Preliminary VS2017 support.
[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_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.9)
717                                 if((MSVC_VERSION EQUAL 1900) OR (MSVC_VERSION EQUAL 1910))
718                                         set(PYTHON_NUMPY_VERSION 1.11)
719                                 endif()
720                                 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
721                                         COMMAND ${CMAKE_COMMAND} -E
722                                                 make_directory ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages)
723
724                                 add_custom_command(
725                                         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
726                                         COMMAND ${CMAKE_COMMAND} -E
727                                                 tar xzvf "${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}.tar.gz"
728                                         DEPENDS
729                                                 ${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}.tar.gz
730                                                 ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
731                                         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
732                                 )
733                                 add_custom_target(
734                                         python_numpy ALL
735                                         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
736                                 )
737                                 install(
738                                         DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
739                                         DESTINATION ${BLENDER_VERSION}/python/lib/site-packages
740                                 )
741                         endif()
742
743
744                         # TODO(sergey): For unti we've got better way to deal with python binary
745                         install(
746                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
747                                 DESTINATION ${BLENDER_VERSION}/python/bin
748                                 CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
749                         )
750                         install(
751                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
752                                 DESTINATION ${BLENDER_VERSION}/python/bin
753                                 CONFIGURATIONS Debug
754                         )
755
756                         # MinGW needs Python DLL
757                         if(MINGW)
758                                 install(
759                                         FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
760                                         DESTINATION "."
761                                         CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
762                                 )
763                                 install(
764                                         FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
765                                         DESTINATION "."
766                                         CONFIGURATIONS Debug
767                                 )
768                         endif()
769                 endif()
770
771                 unset(_PYTHON_VERSION_NO_DOTS)
772         endif()
773
774         # EGL Runtime Components
775         if(WITH_GL_EGL)
776                 if(WIN32)
777                         install(FILES "${OPENGLES_DLL}"     DESTINATION ".")
778                         install(FILES "${OPENGLES_EGL_DLL}" DESTINATION ".")
779
780                         if(WITH_GL_ANGLE)
781                                 install(FILES "${D3DCOMPILER_DLL}" DESTINATION ".")
782                         endif()
783                 endif()
784         endif()
785
786         if(MSVC)
787                 install(
788                         FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
789                         DESTINATION "."
790                 )
791         else()
792                 #MinGW64 comes with own version. For portable builds it will probaly have to be copied to work
793                 if(NOT WITH_MINGW64)
794                         install(
795                                 FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
796                                 DESTINATION "."
797                         )
798                 elseif(WITH_MINGW64)
799                         install(
800                                 FILES 
801                                         ${LIBDIR}/binaries/libgcc_s_sjlj-1.dll
802                                         ${LIBDIR}/binaries/libwinpthread-1.dll
803                                         ${LIBDIR}/binaries/libstdc++-6.dll
804                                 DESTINATION "."
805                         )
806                         
807                         if(WITH_OPENMP)
808                                 install(
809                                         FILES 
810                                         ${LIBDIR}/binaries/libgomp-1.dll
811                                         DESTINATION "."
812                                 )
813                         endif()
814                 endif()
815         endif()
816
817         if(WITH_CODEC_FFMPEG)
818                 if(WITH_MINGW64)
819                         install(
820                                 FILES
821                                         ${LIBDIR}/ffmpeg/lib/avcodec-53.dll
822                                         ${LIBDIR}/ffmpeg/lib/avformat-53.dll
823                                         ${LIBDIR}/ffmpeg/lib/avdevice-53.dll
824                                         ${LIBDIR}/ffmpeg/lib/avutil-51.dll
825                                         ${LIBDIR}/ffmpeg/lib/swscale-2.dll
826                                         ${LIBDIR}/ffmpeg/lib/swresample-0.dll
827                                         ${LIBDIR}/ffmpeg/lib/xvidcore.dll
828                                 DESTINATION "."
829                         )
830                 else()
831                         install(
832                                 FILES
833                                         ${LIBDIR}/ffmpeg/lib/avcodec-55.dll
834                                         ${LIBDIR}/ffmpeg/lib/avformat-55.dll
835                                         ${LIBDIR}/ffmpeg/lib/avdevice-55.dll
836                                         ${LIBDIR}/ffmpeg/lib/avutil-52.dll
837                                         ${LIBDIR}/ffmpeg/lib/swscale-2.dll
838                                 DESTINATION "."
839                         )
840                 endif()
841         endif()
842
843         if(WITH_CODEC_SNDFILE)
844                 install(
845                         FILES ${LIBDIR}/sndfile/lib/libsndfile-1.dll
846                         DESTINATION "."
847                 )
848         endif()
849
850         if(WITH_OPENAL)
851                 install(
852                         FILES
853                                 ${LIBDIR}/openal/lib/OpenAL32.dll
854                         DESTINATION "."
855                 )
856                 # MinGW TODO: Need to update to a newer OpenAL version
857                 # which does not depend on wrap_oal.dll
858                 if(CMAKE_COMPILER_IS_GNUCC)
859                         install(
860                                 FILES
861                                         ${LIBDIR}/openal/lib/wrap_oal.dll
862                                 DESTINATION "."
863                         )
864                 endif()
865         endif()
866
867         if(WITH_SDL)
868                 #MinGW TODO: Update to SDL2
869                 if(NOT CMAKE_COMPILER_IS_GNUCC)
870                         install(
871                                 FILES ${LIBDIR}/sdl/lib/SDL2.dll
872                                 DESTINATION "."
873                         )
874                 else()
875                         install(
876                                 FILES ${LIBDIR}/sdl/lib/SDL.dll
877                                 DESTINATION "."
878                         )
879                 endif()
880         endif()
881         
882         if(WITH_SYSTEM_AUDASPACE)
883                 install(
884                         FILES
885                                 ${LIBDIR}/audaspace/lib/audaspace.dll
886                                 ${LIBDIR}/audaspace/lib/audaspace-c.dll
887                                 ${LIBDIR}/audaspace/lib/audaspace-py.dll
888                         DESTINATION "."
889                 )
890         endif()
891
892         if(NOT CMAKE_CL_64)
893                 install(
894                         FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll
895                         DESTINATION "."
896                 )
897         endif()
898                 
899         install( # x86 builds can run on x64 Windows, so this is required at all times
900                 FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
901                 DESTINATION "."
902         )
903
904         if(WITH_OPENCOLORIO)
905                 set(OCIOBIN ${LIBDIR}/opencolorio/bin)
906                 if(NOT MINGW)
907                         install(
908                                 FILES
909                                         ${OCIOBIN}/OpenColorIO.dll
910                                 DESTINATION "."
911                         )
912                 else()
913                         install(
914                                 FILES
915                                         ${OCIOBIN}/libOpenColorIO.dll
916                                 DESTINATION "."
917                         )
918                 endif()
919         endif()
920
921 elseif(APPLE)
922
923         # handy install macro to exclude files, we use \$ escape for the "to"
924         # argument when calling so ${BUILD_TYPE} does not get expanded
925         macro(install_dir from to)
926                 install(
927                         DIRECTORY ${from}
928                         DESTINATION ${to}
929                         PATTERN ".git" EXCLUDE
930                         PATTERN ".svn" EXCLUDE
931                         PATTERN "*.pyc" EXCLUDE
932                         PATTERN "*.pyo" EXCLUDE
933                         PATTERN "*.orig" EXCLUDE
934                         PATTERN "*.rej" EXCLUDE
935                         PATTERN "__pycache__" EXCLUDE
936                         PATTERN "__MACOSX" EXCLUDE
937                         PATTERN ".DS_Store" EXCLUDE
938                         PATTERN "config-${PYTHON_VERSION}m/*.a" EXCLUDE  # static lib
939                 )
940         endmacro()
941
942         set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blender.app)
943
944         # setup Info.plist
945         execute_process(COMMAND date "+%Y-%m-%d"
946                         OUTPUT_VARIABLE BLENDER_DATE
947                         OUTPUT_STRIP_TRAILING_WHITESPACE)
948
949         set_target_properties(blender PROPERTIES
950                 MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist
951                 MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
952                 MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
953
954         # Gather the date in finder-style
955         execute_process(COMMAND date "+%m/%d/%Y/%H:%M"
956         OUTPUT_VARIABLE SETFILE_DATE
957         OUTPUT_STRIP_TRAILING_WHITESPACE)
958
959         # Give the bundle actual creation/modification date
960         execute_process(COMMAND SetFile -d ${SETFILE_DATE} -m ${SETFILE_DATE}
961                         ${EXECUTABLE_OUTPUT_PATH}/blender.app)
962
963         install(
964                 TARGETS blender
965                 DESTINATION "."
966         )
967
968         # install release and app files
969         set(BLENDER_TEXT_FILES_DESTINATION ".")
970
971         install(
972                 FILES ${OSX_APP_SOURCEDIR}/Contents/PkgInfo
973                 DESTINATION blender.app/Contents
974         )
975
976         install_dir(
977                 ${OSX_APP_SOURCEDIR}/Contents/Resources
978                 blender.app/Contents/
979         )
980
981         if(WITH_OPENMP AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
982                 install(
983                         FILES ${LIBDIR}/openmp/lib/libiomp5.dylib
984                         DESTINATION blender.app/Contents/Resources/lib/
985                 )
986                 install(
987                         FILES ${LIBDIR}/openmp/LICENSE.txt
988                         DESTINATION "."
989                         RENAME LICENSE-libiomp5.txt
990                 )
991         endif()
992
993         if(WITH_LLVM AND NOT LLVM_STATIC)
994                 install(
995                         FILES ${LIBDIR}/llvm/lib/libLLVM-3.4.dylib
996                         DESTINATION blender.app/Contents/MacOS
997                 )
998         endif()
999
1000         # python
1001         if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
1002                 # the python zip is first extract as part of the build process,
1003                 # and then later installed as part of make install. this is much
1004                 # quicker, and means we can easily exclude files on copy
1005                 # Not needed for PYTHON_MODULE or WEB_PLUGIN due uses  Pyhon framework
1006                 add_custom_target(
1007                         extractpyzip
1008                         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/python)
1009
1010                 set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
1011
1012                 add_custom_command(
1013                         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
1014                         COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
1015                         COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
1016                         COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/python/"
1017                                 ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}"
1018                         DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
1019
1020                 add_dependencies(blender extractpyzip)
1021
1022                 # copy extracted python files
1023                 install_dir(
1024                         ${CMAKE_CURRENT_BINARY_DIR}/python
1025                         \${TARGETDIR_VER}
1026                 )
1027                 # copy site-packages files
1028                 install_dir(
1029                         ${LIBDIR}/release/site-packages
1030                         ${CMAKE_CURRENT_BINARY_DIR}/python/lib/python${PYTHON_VERSION}
1031                 )
1032
1033                 install(DIRECTORY ${LIBDIR}/python/bin
1034                         DESTINATION ${TARGETDIR_VER}/python
1035                         USE_SOURCE_PERMISSIONS
1036                 )
1037
1038                 # Needed for distutils/pip
1039                 # get the last part of the include dir, will be 'python{version}{abiflag}',
1040                 get_filename_component(_py_inc_suffix ${PYTHON_INCLUDE_DIR} NAME)
1041                 install(
1042                         FILES ${PYTHON_INCLUDE_DIR}/pyconfig.h
1043                         DESTINATION ${TARGETDIR_VER}/python/include/${_py_inc_suffix}
1044                 )
1045                 unset(_py_inc_suffix)
1046         endif()
1047         
1048         # install blenderplayer bundle - copy of blender.app above. re-using macros et al
1049         # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it
1050         if(WITH_GAMEENGINE AND WITH_PLAYER)
1051                 set(OSX_APP_PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blenderplayer.app)
1052                 set(PLAYER_SOURCEINFO ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Info.plist)
1053                 set(PLAYER_TARGETDIR_VER blenderplayer.app/Contents/Resources/${BLENDER_VERSION})
1054
1055
1056                 # important to make a clean  install each time else old scripts get loaded.
1057                 install(
1058                         CODE
1059                         "file(REMOVE_RECURSE ${PLAYER_TARGETDIR_VER})"
1060                 )
1061
1062                 # Give the bundle actual creation/modification date
1063                 execute_process(COMMAND SetFile -d ${SETFILE_DATE} -m ${SETFILE_DATE}
1064                                 ${EXECUTABLE_OUTPUT_PATH}/blenderplayer.app)
1065
1066                 install(
1067                         FILES ${OSX_APP_PLAYER_SOURCEDIR}/Contents/PkgInfo
1068                         DESTINATION blenderplayer.app/Contents
1069                 )
1070
1071                 install_dir(
1072                         ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Resources
1073                         blenderplayer.app/Contents/
1074                 )
1075
1076                 if(WITH_OPENMP AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
1077                         install(
1078                                 FILES ${LIBDIR}/openmp/lib/libiomp5.dylib
1079                                 DESTINATION blenderplayer.app/Contents/Resources/lib/
1080                         )
1081                 endif()
1082
1083
1084                 # python
1085                 if(WITH_PYTHON AND NOT WITH_PYTHON_FRAMEWORK)
1086                         add_custom_command(
1087                                 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
1088                                 COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
1089                                 COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
1090                                 COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/python/"
1091                                         ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}"
1092                                 DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
1093
1094                         # copy extracted python files
1095                         install_dir(
1096                                 ${CMAKE_CURRENT_BINARY_DIR}/python
1097                                 \${PLAYER_TARGETDIR_VER}
1098                         )
1099                 endif()
1100
1101         endif()
1102
1103 endif()
1104
1105 # -----------------------------------------------------------------------------
1106 # Generic Install, for all targets
1107
1108 if(DEFINED BLENDER_TEXT_FILES_DESTINATION)
1109
1110         install(
1111                 CODE
1112                 "
1113                 file(READ \"${CMAKE_SOURCE_DIR}/release/text/readme.html\" DATA_SRC)
1114                 string(REGEX REPLACE \"BLENDER_VERSION\" \"${BLENDER_VERSION}\" DATA_DST \"\${DATA_SRC}\")
1115                 file(WRITE \"${CMAKE_BINARY_DIR}/release/text/readme.html\" \"\${DATA_DST}\")
1116                 unset(DATA_SRC)
1117                 unset(DATA_DST)
1118                 "
1119         )
1120         list(APPEND BLENDER_TEXT_FILES
1121                 ${CMAKE_BINARY_DIR}/release/text/readme.html
1122         )
1123
1124         install(
1125                 FILES ${BLENDER_TEXT_FILES}
1126                 DESTINATION "${BLENDER_TEXT_FILES_DESTINATION}"
1127         )
1128 endif()
1129
1130 # install more files specified elsewhere
1131 delayed_do_install(${TARGETDIR_VER})
1132
1133 unset(BLENDER_TEXT_FILES)
1134 unset(BLENDER_TEXT_FILES_DESTINATION)
1135
1136
1137 # -----------------------------------------------------------------------------
1138 # Setup link libs
1139
1140 add_dependencies(blender makesdna)
1141
1142 setup_blender_sorted_libs()
1143 target_link_libraries(blender ${BLENDER_SORTED_LIBS})
1144
1145 setup_liblinks(blender)
1146
1147 # -----------------------------------------------------------------------------
1148 # Setup launcher
1149
1150 if(WIN32 AND NOT WITH_PYTHON_MODULE)
1151         install(
1152                 TARGETS blender
1153                 COMPONENT Blender
1154                 DESTINATION "."
1155         )
1156         if(CMAKE_CL_64)
1157                 set(_WIN_PLATFORM x64)
1158         else()
1159                 set(_WIN_PLATFORM x86)
1160         endif()
1161         if(MSVC12_REDIST_DIR)
1162                 install(
1163                         FILES
1164                                 ${MSVC12_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC120.CRT/msvcp120.dll
1165                                 ${MSVC12_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC120.CRT/msvcr120.dll
1166                         DESTINATION "."
1167                 )
1168                 if(WITH_OPENMP)
1169                         install(
1170                                 FILES ${MSVC12_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC120.OpenMP/vcomp120.dll
1171                                 DESTINATION "."
1172                         )
1173                 endif()
1174         endif()
1175         
1176         if(MSVC14_REDIST_DIR)
1177                 set(KITSDIRx86 "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/")
1178                 set(KITSDIR "$ENV{ProgramFiles}/Windows Kits/10/")
1179                 if(IS_DIRECTORY ${KITSDIR})
1180                         set(KITSPATH "${KITSDIR}/Redist/ucrt/DLLs/${_WIN_PLATFORM}")
1181                 else()
1182                         if(IS_DIRECTORY ${KITSDIRx86})
1183                                 set(KITSPATH "${KITSDIRx86}/Redist/ucrt/DLLs/${_WIN_PLATFORM}")
1184                         else()
1185                                 message(FATAL_ERROR "Windows 10 SDK directory not found")
1186                         endif()
1187                 endif()
1188                 
1189                 install(
1190                         FILES
1191                                 ${KITSPATH}/api-ms-win-core-file-l1-2-0.dll
1192                                 ${KITSPATH}/api-ms-win-core-file-l2-1-0.dll
1193                                 ${KITSPATH}/api-ms-win-core-localization-l1-2-0.dll
1194                                 ${KITSPATH}/api-ms-win-core-processthreads-l1-1-0.dll
1195                                 ${KITSPATH}/api-ms-win-core-processthreads-l1-1-1.dll
1196                                 ${KITSPATH}/api-ms-win-core-synch-l1-1-0.dll
1197                                 ${KITSPATH}/api-ms-win-core-synch-l1-2-0.dll
1198                                 ${KITSPATH}/api-ms-win-core-timezone-l1-1-0.dll
1199                                 ${KITSPATH}/api-ms-win-crt-conio-l1-1-0.dll
1200                                 ${KITSPATH}/api-ms-win-crt-convert-l1-1-0.dll
1201                                 ${KITSPATH}/api-ms-win-crt-environment-l1-1-0.dll
1202                                 ${KITSPATH}/api-ms-win-crt-filesystem-l1-1-0.dll
1203                                 ${KITSPATH}/api-ms-win-crt-heap-l1-1-0.dll
1204                                 ${KITSPATH}/api-ms-win-crt-locale-l1-1-0.dll
1205                                 ${KITSPATH}/api-ms-win-crt-math-l1-1-0.dll
1206                                 ${KITSPATH}/api-ms-win-crt-process-l1-1-0.dll
1207                                 ${KITSPATH}/api-ms-win-crt-runtime-l1-1-0.dll
1208                                 ${KITSPATH}/api-ms-win-crt-stdio-l1-1-0.dll
1209                                 ${KITSPATH}/api-ms-win-crt-string-l1-1-0.dll
1210                                 ${KITSPATH}/api-ms-win-crt-time-l1-1-0.dll
1211                                 ${KITSPATH}/ucrtbase.dll
1212                                 ${MSVC14_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC140.CRT/vcruntime140.dll
1213                         DESTINATION "."
1214                 )
1215                 if(WITH_OPENMP)
1216                         install(
1217                                 FILES ${MSVC14_REDIST_DIR}/${_WIN_PLATFORM}/Microsoft.VC140.OpenMP/vcomp140.dll
1218                                 DESTINATION "."
1219                         )
1220                 endif()
1221         endif()
1222 endif()