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