fc02dfda9d131bac1ab9a8827994418fa5969aa4
[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")
342                 set(ADDON_EXCLUDE_CONDITIONAL "addons_contrib/*")
343         else()
344                 set(ADDON_EXCLUDE_CONDITIONAL "_addons_contrib/*")  # dummy, wont do anything
345         endif()
346
347         # do not install freestyle dir if disabled
348         if(NOT WITH_FREESTYLE)
349                 set(FREESTYLE_EXCLUDE_CONDITIONAL "freestyle/*")
350         else()
351                 set(FREESTYLE_EXCLUDE_CONDITIONAL "_freestyle/*")  # dummy, wont do anything
352         endif()
353
354         install(
355                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
356                 DESTINATION ${TARGETDIR_VER}
357                 PATTERN ".git" EXCLUDE
358                 PATTERN ".gitignore" EXCLUDE
359                 PATTERN ".arcconfig" EXCLUDE
360                 PATTERN "__pycache__" EXCLUDE
361                 PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE
362                 PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE
363         )
364         
365         unset(ADDON_EXCLUDE_CONDITIONAL)
366         unset(FREESTYLE_EXCLUDE_CONDITIONAL)
367 endif()
368
369 # localization
370 if(WITH_INTERNATIONAL)
371         install(
372                 DIRECTORY
373                         ${CMAKE_SOURCE_DIR}/release/datafiles/fonts
374                 DESTINATION ${TARGETDIR_VER}/datafiles
375         )
376
377         set(_locale_dir "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
378         set(_locale_target_dir ${TARGETDIR_VER}/datafiles/locale)
379
380         file(GLOB _po_files "${_locale_dir}/po/*.po")
381         foreach(_po_file ${_po_files})
382                 msgfmt_simple(${_po_file} _all_mo_files)
383         endforeach()
384
385         # Create a custom target which will compile all po to mo
386         add_custom_target(
387                 locales
388                 DEPENDS ${_all_mo_files})
389
390         add_dependencies(blender locales)
391
392         # Generate INSTALL rules
393         install(
394                 FILES ${_locale_dir}/languages
395                 DESTINATION ${_locale_target_dir}
396         )
397
398         foreach(_mo_file ${_all_mo_files})
399                 get_filename_component(_locale_name ${_mo_file} NAME_WE)
400                 install(
401                         FILES ${_mo_file}
402                         DESTINATION ${_locale_target_dir}/${_locale_name}/LC_MESSAGES
403                         RENAME blender.mo
404                 )
405                 unset(_locale_name)
406         endforeach()
407
408         unset(_all_mo_files)
409         unset(_po_files)
410         unset(_po_file)
411         unset(_mo_file)
412         unset(_locale_target_dir)
413
414         unset(_locale_dir)
415 endif()
416
417 # color management
418 if(WITH_OPENCOLORIO)
419         install(
420                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/datafiles/colormanagement
421                 DESTINATION ${TARGETDIR_VER}/datafiles
422         )
423 endif()
424
425 # helpful tip when using make
426 if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*")
427         # message after building.
428         add_custom_command(
429                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
430                 COMMAND ${CMAKE_COMMAND} -E
431                         echo 'now run: \"make install\" to copy runtime files and scripts to ${TARGETDIR_VER}'
432         )
433 endif()
434
435
436 # -----------------------------------------------------------------------------
437 # Install Targets (Platform Specific)
438
439 if(UNIX AND NOT APPLE)
440
441         if(NOT WITH_PYTHON_MODULE)
442                 if(WITH_DOC_MANPAGE)
443                         add_custom_target(
444                                 blender_man_page ALL
445                                 COMMAND ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py
446                                         ${EXECUTABLE_OUTPUT_PATH}/blender
447                                         ${CMAKE_CURRENT_BINARY_DIR}/blender.1)
448                         add_dependencies(blender_man_page blender)
449                 endif()
450         endif()
451
452         # there are a few differences between portable and system install
453         if(WITH_PYTHON_MODULE)
454                 if(WITH_INSTALL_PORTABLE)
455                         install(
456                                 TARGETS blender
457                                 DESTINATION "."
458                         )
459                 else()
460                         install(
461                                 TARGETS blender
462                                 LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES}
463                         )
464                 endif()
465                 # none of the other files are needed currently
466         elseif(WITH_INSTALL_PORTABLE)
467                 install(
468                         TARGETS blender
469                         DESTINATION "."
470                 )
471
472                 if(WITH_DOC_MANPAGE)
473                         install(
474                                 FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
475                                 DESTINATION "."
476                         )
477                 endif()
478                 install(
479                         FILES
480                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
481                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
482                         DESTINATION "."
483                 )
484
485                 install(
486                         PROGRAMS
487                         ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
488                         DESTINATION "."
489                 )
490
491                 set(BLENDER_TEXT_FILES_DESTINATION ".")
492         else()
493                 # main blender binary
494                 install(
495                         TARGETS blender
496                         DESTINATION bin
497                 )
498                 if(WITH_DOC_MANPAGE)
499                         # manpage only with 'blender' binary
500                         install(
501                                 FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
502                                 DESTINATION share/man/man1
503                         )
504                 endif()
505
506                 # misc files
507                 install(
508                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
509                         DESTINATION share/applications
510                 )
511                 install(
512                         DIRECTORY
513                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/16x16
514                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/22x22
515                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/24x24
516                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/32x32
517                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/48x48
518                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/256x256
519                         DESTINATION share/icons/hicolor
520                         PATTERN "*.svg" EXCLUDE
521                 )
522                 install(
523                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
524                         DESTINATION share/icons/hicolor/scalable/apps
525                 )
526                 install(
527                         PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
528                         DESTINATION bin
529                 )
530                 set(BLENDER_TEXT_FILES_DESTINATION share/doc/blender)
531         endif()
532
533         if(WITH_PYTHON)
534                 if(WITH_PYTHON_INSTALL)
535
536                         install(
537                                 PROGRAMS ${PYTHON_EXECUTABLE}
538                                 DESTINATION ${TARGETDIR_VER}/python/bin
539                         )
540
541                         # on some platforms (like openSUSE) Python is linked
542                         # to be used from lib64 folder.
543                         # determine this from Python's libraries path
544                         #
545                         # ugh, its possible 'lib64' is just a symlink to 'lib' which causes incorrect use of 'lib64'
546                         get_filename_component(_pypath_real ${PYTHON_LIBPATH} REALPATH)
547                         if(${_pypath_real} MATCHES "lib64$")
548                                 set(_target_LIB "lib64")
549                         else()
550                                 set(_target_LIB "lib")
551                         endif()
552                         unset(_pypath_real)
553
554                         # Copy the systems python into the install directory
555                         # install(CODE "message(\"copying a subset of the systems python...\")")
556                         install(
557                                 DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}
558                                 DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}
559                                 PATTERN "__pycache__" EXCLUDE               # * any cache *
560                                 PATTERN "config-${PYTHON_VERSION}m/*.a" EXCLUDE  # static lib
561                                 PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
562                                 PATTERN "site-packages/*" EXCLUDE           # ./site-packages/*
563                                 PATTERN "tkinter" EXCLUDE                   # ./tkinter
564                                 PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
565                                 PATTERN "idlelib" EXCLUDE                   # ./idlelib
566                                 PATTERN "test" EXCLUDE                      # ./test
567                                 PATTERN "turtledemo" EXCLUDE                # ./turtledemo
568                                 PATTERN "turtle.py" EXCLUDE                 # ./turtle.py
569                         )
570
571                         # Needed for distutils/pip
572                         # get the last part of the include dir, will be 'python{version}{abiflag}',
573                         get_filename_component(_py_inc_suffix ${PYTHON_INCLUDE_DIR} NAME)
574                         install(
575                                 FILES ${PYTHON_INCLUDE_DIR}/pyconfig.h
576                                 DESTINATION ${TARGETDIR_VER}/python/include/${_py_inc_suffix}
577                         )
578                         unset(_py_inc_suffix)
579
580                         if(WITH_PYTHON_INSTALL_NUMPY)
581                                 # Install to the same directory as the source, so debian-like
582                                 # distros are happy with their policy.
583                                 set(_suffix "site-packages")
584                                 if(${PYTHON_NUMPY_PATH} MATCHES "dist-packages")
585                                         set(_suffix "dist-packages")
586                                 endif()
587                                 install(
588                                         DIRECTORY ${PYTHON_NUMPY_PATH}/numpy
589                                         DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
590                                         PATTERN ".svn" EXCLUDE
591                                         PATTERN "__pycache__" EXCLUDE           # * any cache *
592                                         PATTERN "*.pyc" EXCLUDE                 # * any cache *
593                                         PATTERN "*.pyo" EXCLUDE                 # * any cache *
594                                         PATTERN "oldnumeric" EXCLUDE            # ./oldnumeric
595                                         PATTERN "doc" EXCLUDE                   # ./doc
596                                         PATTERN "tests" EXCLUDE                 # ./tests
597                                         PATTERN "f2py" EXCLUDE                  # ./f2py - fortran/python interface code, not for blender.
598                                         PATTERN "include" EXCLUDE               # include dirs all over, we wont use NumPy/CAPI
599                                         PATTERN "*.h" EXCLUDE                   # some includes are not in include dirs
600                                         PATTERN "*.a" EXCLUDE                   # ./core/lib/libnpymath.a - for linking, we dont need.
601                                 )
602                                 unset(_suffix)
603                         endif()
604
605                         # Copy requests, we need to generalize site-packages
606                         if(WITH_PYTHON_INSTALL_REQUESTS)
607                                 set(_suffix "site-packages")
608                                 if(${PYTHON_REQUESTS_PATH} MATCHES "dist-packages")
609                                         set(_suffix "dist-packages")
610                                 endif()
611                                 install(
612                                         DIRECTORY ${PYTHON_REQUESTS_PATH}/requests
613                                         DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
614                                         PATTERN ".svn" EXCLUDE
615                                         PATTERN "__pycache__" EXCLUDE           # * any cache *
616                                         PATTERN "*.pyc" EXCLUDE                 # * any cache *
617                                         PATTERN "*.pyo" EXCLUDE                 # * any cache *
618                                 )
619                                 # On some platforms requests does have extra dependencies.
620                                 set(_requests_deps "chardet" "urllib3")
621                                 foreach(_requests_dep ${_requests_deps})
622                                         if(EXISTS ${PYTHON_REQUESTS_PATH}/${_requests_dep})
623                                                 install(
624                                                         DIRECTORY ${PYTHON_REQUESTS_PATH}/${_requests_dep}
625                                                         DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
626                                                         PATTERN ".svn" EXCLUDE
627                                                         PATTERN "__pycache__" EXCLUDE           # * any cache *
628                                                         PATTERN "*.pyc" EXCLUDE                 # * any cache *
629                                                         PATTERN "*.pyo" EXCLUDE                 # * any cache *
630                                                 )
631                                         endif()
632                                 endforeach()
633                                 if(EXISTS ${PYTHON_REQUESTS_PATH}/six.py)
634                                         install(
635                                                 FILES ${PYTHON_REQUESTS_PATH}/six.py
636                                                 DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
637                                         )
638                                 endif()
639                                 unset(_requests_dep)
640                                 unset(_requests_deps)
641                                 unset(_suffix)
642                         endif()
643                         unset(_target_LIB)
644                         
645                 endif()
646         endif()
647 elseif(WIN32)
648
649         set(BLENDER_TEXT_FILES_DESTINATION ".")
650
651         if(WITH_PYTHON)
652                 string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
653
654                 # MinGW TODO: This bit of Python configuration diverges from MSVC
655                 if(NOT CMAKE_COMPILER_IS_GNUCC)
656                         install(
657                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
658                                 DESTINATION "."
659                                 CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
660                         )
661
662                         install(
663                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
664                                 DESTINATION "."
665                                 CONFIGURATIONS Debug
666                         )
667                 endif()
668
669                 if(WITH_PYTHON_INSTALL)
670                         # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
671
672                         install(DIRECTORY DESTINATION ${TARGETDIR_VER}/python)
673                         install(DIRECTORY DESTINATION ${TARGETDIR_VER}/python/lib)
674
675                         # WARNING: its important that 'CMAKE_INSTALL_CONFIG_NAME' is evaluated at build time
676                         # and _NOT_ configuration time, when modifying the lines below,
677                         # check it works in both Release & Debug mode.
678                         #
679                         # Edit with extreme care! - Campbell
680
681                         # extract python
682                         install(
683                                 CODE
684                                 "
685                                 message(STATUS \"Extracting Python to: \${CMAKE_INSTALL_PREFIX}/${BLENDER_VERSION}/python\")
686                                 if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Dd][Ee][Bb][Uu][Gg])$\")
687                                         set(PYTHON_ZIP \"${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_d.tar.gz\")
688                                 else()
689                                         set(PYTHON_ZIP \"${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}.tar.gz\")
690                                 endif()
691
692                                 execute_process(
693                                         COMMAND \${CMAKE_COMMAND} -E make_directory
694                                                 \"\${CMAKE_INSTALL_PREFIX}/${BLENDER_VERSION}/python\"
695                                         COMMAND \${CMAKE_COMMAND} -E
696                                                 chdir \"\${CMAKE_INSTALL_PREFIX}/${BLENDER_VERSION}/python\"
697                                                 \${CMAKE_COMMAND} -E
698                                                 tar xzfv \"\${PYTHON_ZIP}\"
699                                 )
700                                 unset(PYTHON_ZIP)
701                                 "
702                         )
703
704                         # release/site-packages
705                         install(
706                                 DIRECTORY ${LIBDIR}/release/site-packages
707                                 DESTINATION ${BLENDER_VERSION}/python/lib
708                                 PATTERN ".svn" EXCLUDE
709                                 PATTERN "__pycache__" EXCLUDE           # * any cache *
710                                 PATTERN "*.pyc" EXCLUDE                 # * any cache *
711                                 PATTERN "*.pyo" EXCLUDE                 # * any cache *)
712                         )
713
714                         if(WITH_PYTHON_INSTALL_NUMPY)
715                                 set(PYTHON_NUMPY_VERSION 1.9)
716                                 if(MSVC_VERSION EQUAL 1900)
717                                         set(PYTHON_NUMPY_VERSION 1.11)
718                                 endif()
719                                 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
720                                         COMMAND ${CMAKE_COMMAND} -E
721                                                 make_directory ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages)
722
723                                 add_custom_command(
724                                         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
725                                         COMMAND ${CMAKE_COMMAND} -E
726                                                 tar xzvf "${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}.tar.gz"
727                                         DEPENDS
728                                                 ${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_numpy_${PYTHON_NUMPY_VERSION}.tar.gz
729                                                 ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
730                                         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages
731                                 )
732                                 add_custom_target(
733                                         python_numpy ALL
734                                         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
735                                 )
736                                 install(
737                                         DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
738                                         DESTINATION ${BLENDER_VERSION}/python/lib/site-packages
739                                 )
740                         endif()
741
742
743                         # TODO(sergey): For unti we've got better way to deal with python binary
744                         install(
745                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
746                                 DESTINATION ${BLENDER_VERSION}/python/bin
747                                 CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
748                         )
749                         install(
750                                 FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
751                                 DESTINATION ${BLENDER_VERSION}/python/bin
752                                 CONFIGURATIONS Debug
753                         )
754
755                         # MinGW needs Python DLL
756                         if(MINGW)
757                                 install(
758                                         FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
759                                         DESTINATION "."
760                                         CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
761                                 )
762                                 install(
763                                         FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
764                                         DESTINATION "."
765                                         CONFIGURATIONS Debug
766                                 )
767                         endif()
768                 endif()
769
770                 unset(_PYTHON_VERSION_NO_DOTS)
771         endif()
772
773         # EGL Runtime Components
774         if(WITH_GL_EGL)
775                 if(WIN32)
776                         install(FILES "${OPENGLES_DLL}"     DESTINATION ".")
777                         install(FILES "${OPENGLES_EGL_DLL}" DESTINATION ".")
778
779                         if(WITH_GL_ANGLE)
780                                 install(FILES "${D3DCOMPILER_DLL}" DESTINATION ".")
781                         endif()
782                 endif()
783         endif()
784
785         if(MSVC)
786                 install(
787                         FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
788                         DESTINATION "."
789                 )
790         else()
791                 #MinGW64 comes with own version. For portable builds it will probaly have to be copied to work
792                 if(NOT WITH_MINGW64)
793                         install(
794                                 FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
795                                 DESTINATION "."
796                         )
797                 elseif(WITH_MINGW64)
798                         install(
799                                 FILES 
800                                         ${LIBDIR}/binaries/libgcc_s_sjlj-1.dll
801                                         ${LIBDIR}/binaries/libwinpthread-1.dll
802                                         ${LIBDIR}/binaries/libstdc++-6.dll
803                                 DESTINATION "."
804                         )
805                         
806                         if(WITH_OPENMP)
807                                 install(
808                                         FILES 
809                                         ${LIBDIR}/binaries/libgomp-1.dll
810                                         DESTINATION "."
811                                 )
812                         endif()
813                 endif()
814         endif()
815
816         if(WITH_CODEC_FFMPEG)
817                 if(WITH_MINGW64)
818                         install(
819                                 FILES
820                                         ${LIBDIR}/ffmpeg/lib/avcodec-53.dll
821                                         ${LIBDIR}/ffmpeg/lib/avformat-53.dll
822                                         ${LIBDIR}/ffmpeg/lib/avdevice-53.dll
823                                         ${LIBDIR}/ffmpeg/lib/avutil-51.dll
824                                         ${LIBDIR}/ffmpeg/lib/swscale-2.dll
825                                         ${LIBDIR}/ffmpeg/lib/swresample-0.dll
826                                         ${LIBDIR}/ffmpeg/lib/xvidcore.dll
827                                 DESTINATION "."
828                         )
829                 else()
830                         install(
831                                 FILES
832                                         ${LIBDIR}/ffmpeg/lib/avcodec-55.dll
833                                         ${LIBDIR}/ffmpeg/lib/avformat-55.dll
834                                         ${LIBDIR}/ffmpeg/lib/avdevice-55.dll
835                                         ${LIBDIR}/ffmpeg/lib/avutil-52.dll
836                                         ${LIBDIR}/ffmpeg/lib/swscale-2.dll
837                                 DESTINATION "."
838                         )
839                 endif()
840         endif()
841
842         if(WITH_CODEC_SNDFILE)
843                 install(
844                         FILES ${LIBDIR}/sndfile/lib/libsndfile-1.dll
845                         DESTINATION "."
846                 )
847         endif()
848
849         if(WITH_OPENAL)
850                 install(
851                         FILES
852                                 ${LIBDIR}/openal/lib/OpenAL32.dll
853                         DESTINATION "."
854                 )
855                 # MinGW TODO: Need to update to a newer OpenAL version
856                 # which does not depend on wrap_oal.dll
857                 if(CMAKE_COMPILER_IS_GNUCC)
858                         install(
859                                 FILES
860                                         ${LIBDIR}/openal/lib/wrap_oal.dll
861                                 DESTINATION "."
862                         )
863                 endif()
864         endif()
865
866         if(WITH_SDL)
867                 #MinGW TODO: Update to SDL2
868                 if(NOT CMAKE_COMPILER_IS_GNUCC)
869                         install(
870                                 FILES ${LIBDIR}/sdl/lib/SDL2.dll
871                                 DESTINATION "."
872                         )
873                 else()
874                         install(
875                                 FILES ${LIBDIR}/sdl/lib/SDL.dll
876                                 DESTINATION "."
877                         )
878                 endif()
879         endif()
880         
881         if(WITH_SYSTEM_AUDASPACE)
882                 install(
883                         FILES
884                                 ${LIBDIR}/audaspace/lib/audaspace.dll
885                                 ${LIBDIR}/audaspace/lib/audaspace-c.dll
886                                 ${LIBDIR}/audaspace/lib/audaspace-py.dll
887                         DESTINATION "."
888                 )
889         endif()
890
891         if(NOT CMAKE_CL_64)
892                 install(
893                         FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll
894                         DESTINATION "."
895                 )
896         endif()
897                 
898         install( # x86 builds can run on x64 Windows, so this is required at all times
899                 FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
900                 DESTINATION "."
901         )
902
903         if(WITH_OPENCOLORIO)
904                 set(OCIOBIN ${LIBDIR}/opencolorio/bin)
905                 if(NOT MINGW)
906                         install(
907                                 FILES
908                                         ${OCIOBIN}/OpenColorIO.dll
909                                 DESTINATION "."
910                         )
911                 else()
912                         install(
913                                 FILES
914                                         ${OCIOBIN}/libOpenColorIO.dll
915                                 DESTINATION "."
916                         )
917                 endif()
918         endif()
919
920 elseif(APPLE)
921
922         # handy install macro to exclude files, we use \$ escape for the "to"
923         # argument when calling so ${BUILD_TYPE} does not get expanded
924         macro(install_dir from to)
925                 install(
926                         DIRECTORY ${from}
927                         DESTINATION ${to}
928                         PATTERN ".git" EXCLUDE
929                         PATTERN ".svn" EXCLUDE
930                         PATTERN "*.pyc" EXCLUDE
931                         PATTERN "*.pyo" EXCLUDE
932                         PATTERN "*.orig" EXCLUDE
933                         PATTERN "*.rej" EXCLUDE
934                         PATTERN "__pycache__" EXCLUDE
935                         PATTERN "__MACOSX" EXCLUDE
936                         PATTERN ".DS_Store" EXCLUDE
937                         PATTERN "config-${PYTHON_VERSION}m/*.a" EXCLUDE  # static lib
938                 )
939         endmacro()
940
941         set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blender.app)
942
943         # setup Info.plist
944         execute_process(COMMAND date "+%Y-%m-%d"
945                         OUTPUT_VARIABLE BLENDER_DATE
946                         OUTPUT_STRIP_TRAILING_WHITESPACE)
947
948         set_target_properties(blender PROPERTIES
949                 MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist
950                 MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
951                 MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
952
953         # Gather the date in finder-style
954         execute_process(COMMAND date "+%m/%d/%Y/%H:%M"
955         OUTPUT_VARIABLE SETFILE_DATE
956         OUTPUT_STRIP_TRAILING_WHITESPACE)
957
958         # Give the bundle actual creation/modification date
959         execute_process(COMMAND SetFile -d ${SETFILE_DATE} -m ${SETFILE_DATE}
960                         ${EXECUTABLE_OUTPUT_PATH}/blender.app)
961
962         install(
963                 TARGETS blender
964                 DESTINATION "."
965         )
966
967         # install release and app files
968         set(BLENDER_TEXT_FILES_DESTINATION ".")
969
970         install(
971                 FILES ${OSX_APP_SOURCEDIR}/Contents/PkgInfo
972                 DESTINATION blender.app/Contents
973         )
974
975         install_dir(
976                 ${OSX_APP_SOURCEDIR}/Contents/Resources
977                 blender.app/Contents/
978         )
979
980         if(WITH_OPENMP AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
981                 install(
982                         FILES ${LIBDIR}/openmp/lib/libiomp5.dylib
983                         DESTINATION blender.app/Contents/Resources/lib/
984                 )
985                 install(
986                         FILES ${LIBDIR}/openmp/LICENSE.txt
987                         DESTINATION "."
988                         RENAME LICENSE-libiomp5.txt
989                 )
990         endif()
991
992         if(WITH_LLVM AND NOT LLVM_STATIC)
993                 install(
994                         FILES ${LIBDIR}/llvm/lib/libLLVM-3.4.dylib
995                         DESTINATION blender.app/Contents/MacOS
996                 )
997         endif()
998
999         # python
1000         if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
1001                 # the python zip is first extract as part of the build process,
1002                 # and then later installed as part of make install. this is much
1003                 # quicker, and means we can easily exclude files on copy
1004                 # Not needed for PYTHON_MODULE or WEB_PLUGIN due uses  Pyhon framework
1005                 add_custom_target(
1006                         extractpyzip
1007                         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/python)
1008
1009                 set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
1010
1011                 add_custom_command(
1012                         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
1013                         COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
1014                         COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
1015                         COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/python/"
1016                                 ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}"
1017                         DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
1018
1019                 add_dependencies(blender extractpyzip)
1020
1021                 # copy extracted python files
1022                 install_dir(
1023                         ${CMAKE_CURRENT_BINARY_DIR}/python
1024                         \${TARGETDIR_VER}
1025                 )
1026                 # copy site-packages files
1027                 install_dir(
1028                         ${LIBDIR}/release/site-packages
1029                         ${CMAKE_CURRENT_BINARY_DIR}/python/lib/python${PYTHON_VERSION}
1030                 )
1031
1032                 install(DIRECTORY ${LIBDIR}/python/bin
1033                         DESTINATION ${TARGETDIR_VER}/python
1034                         USE_SOURCE_PERMISSIONS
1035                 )
1036
1037                 # Needed for distutils/pip
1038                 # get the last part of the include dir, will be 'python{version}{abiflag}',
1039                 get_filename_component(_py_inc_suffix ${PYTHON_INCLUDE_DIR} NAME)
1040                 install(
1041                         FILES ${PYTHON_INCLUDE_DIR}/pyconfig.h
1042                         DESTINATION ${TARGETDIR_VER}/python/include/${_py_inc_suffix}
1043                 )
1044                 unset(_py_inc_suffix)
1045         endif()
1046         
1047         # install blenderplayer bundle - copy of blender.app above. re-using macros et al
1048         # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it
1049         if(WITH_GAMEENGINE AND WITH_PLAYER)
1050                 set(OSX_APP_PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blenderplayer.app)
1051                 set(PLAYER_SOURCEINFO ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Info.plist)
1052                 set(PLAYER_TARGETDIR_VER blenderplayer.app/Contents/Resources/${BLENDER_VERSION})
1053
1054
1055                 # important to make a clean  install each time else old scripts get loaded.
1056                 install(
1057                         CODE
1058                         "file(REMOVE_RECURSE ${PLAYER_TARGETDIR_VER})"
1059                 )
1060
1061                 # Give the bundle actual creation/modification date
1062                 execute_process(COMMAND SetFile -d ${SETFILE_DATE} -m ${SETFILE_DATE}
1063                                 ${EXECUTABLE_OUTPUT_PATH}/blenderplayer.app)
1064
1065                 install(
1066                         FILES ${OSX_APP_PLAYER_SOURCEDIR}/Contents/PkgInfo
1067                         DESTINATION blenderplayer.app/Contents
1068                 )
1069
1070                 install_dir(
1071                         ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Resources
1072                         blenderplayer.app/Contents/
1073                 )
1074
1075                 if(WITH_OPENMP AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
1076                         install(
1077                                 FILES ${LIBDIR}/openmp/lib/libiomp5.dylib
1078                                 DESTINATION blenderplayer.app/Contents/Resources/lib/
1079                         )
1080                 endif()
1081
1082
1083                 # python
1084                 if(WITH_PYTHON AND NOT WITH_PYTHON_FRAMEWORK)
1085                         add_custom_command(
1086                                 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
1087                                 COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
1088                                 COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/python/"
1089                                 COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/python/"
1090                                         ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}"
1091                                 DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
1092
1093                         # copy extracted python files
1094                         install_dir(
1095                                 ${CMAKE_CURRENT_BINARY_DIR}/python
1096                                 \${PLAYER_TARGETDIR_VER}
1097                         )
1098                 endif()
1099
1100         endif()
1101
1102 endif()
1103
1104 # -----------------------------------------------------------------------------
1105 # Generic Install, for all targets
1106
1107 if(DEFINED BLENDER_TEXT_FILES_DESTINATION)
1108
1109         install(
1110                 CODE
1111                 "
1112                 file(READ \"${CMAKE_SOURCE_DIR}/release/text/readme.html\" DATA_SRC)
1113                 string(REGEX REPLACE \"BLENDER_VERSION\" \"${BLENDER_VERSION}\" DATA_DST \"\${DATA_SRC}\")
1114                 file(WRITE \"${CMAKE_BINARY_DIR}/release/text/readme.html\" \"\${DATA_DST}\")
1115                 unset(DATA_SRC)
1116                 unset(DATA_DST)
1117                 "
1118         )
1119         list(APPEND BLENDER_TEXT_FILES
1120                 ${CMAKE_BINARY_DIR}/release/text/readme.html
1121         )
1122
1123         install(
1124                 FILES ${BLENDER_TEXT_FILES}
1125                 DESTINATION "${BLENDER_TEXT_FILES_DESTINATION}"
1126         )
1127 endif()
1128
1129 # install more files specified elsewhere
1130 delayed_do_install(${TARGETDIR_VER})
1131
1132 unset(BLENDER_TEXT_FILES)
1133 unset(BLENDER_TEXT_FILES_DESTINATION)
1134
1135
1136 # -----------------------------------------------------------------------------
1137 # Setup link libs
1138
1139 add_dependencies(blender makesdna)
1140
1141 setup_blender_sorted_libs()
1142 target_link_libraries(blender ${BLENDER_SORTED_LIBS})
1143
1144 setup_liblinks(blender)
1145
1146 # -----------------------------------------------------------------------------
1147 # Setup launcher
1148
1149 if(WIN32 AND NOT WITH_PYTHON_MODULE)
1150         install(
1151                 TARGETS blender
1152                 COMPONENT Blender
1153                 DESTINATION "."
1154         )
1155
1156         if(MSVC12_REDIST_DIR)
1157                 if(CMAKE_CL_64)
1158                         set(_WIN_PLATFORM x64)
1159                 else()
1160                         set(_WIN_PLATFORM x86)
1161                 endif()
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 endif()