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