D13910: Workbench: Port shaders to use GPUShaderCreateInfo
[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 # ***** END GPL LICENSE BLOCK *****
20
21 blender_include_dirs(
22   ../../intern/clog
23   ../../intern/glew-mx
24   ../../intern/guardedalloc
25   ../blender/blenkernel
26   ../blender/blenlib
27   ../blender/blenloader
28   ../blender/depsgraph
29   ../blender/editors/include
30   ../blender/gpu
31   ../blender/imbuf
32   ../blender/makesdna
33   ../blender/makesrna
34   ../blender/render
35   ../blender/windowmanager
36 )
37
38 set(LIB
39   bf_windowmanager
40 )
41
42 if(WITH_TBB)
43   # Force TBB libraries to be in front of MKL (part of OpenImageDenoise), so
44   # that it is initialized before MKL and static library initialization order
45   # issues are avoided.
46   #
47   # This isn't fully robust but seems to work.
48   list(INSERT LIB 0 ${TBB_LIBRARIES})
49   list(INSERT LIB 0 bf_blenkernel)
50 endif()
51
52 if(WIN32)
53   blender_include_dirs(../../intern/utfconv)
54 endif()
55
56 if(WITH_LIBMV)
57   blender_include_dirs(../../intern/libmv)
58   add_definitions(-DWITH_LIBMV)
59 endif()
60
61 if(WITH_CYCLES)
62   if(WITH_CYCLES_LOGGING)
63     blender_include_dirs(../../intern/cycles/blender)
64     add_definitions(-DWITH_CYCLES_LOGGING)
65   endif()
66 endif()
67
68 if(WITH_CODEC_FFMPEG)
69   add_definitions(-DWITH_FFMPEG)
70 endif()
71
72 if(WITH_TBB)
73   blender_include_dirs(${TBB_INCLUDE_DIRS})
74   if(WIN32)
75     # For pragma that links tbbmalloc_proxy.lib
76     link_directories(${LIBDIR}/tbb/lib)
77   endif()
78 endif()
79
80
81 if(WITH_PYTHON)
82   blender_include_dirs(../blender/python)
83   add_definitions(-DWITH_PYTHON)
84
85   if(WITH_PYTHON_SECURITY)
86     add_definitions(-DWITH_PYTHON_SECURITY)
87   endif()
88 endif()
89
90 if(WITH_HEADLESS)
91   add_definitions(-DWITH_HEADLESS)
92 endif()
93
94 if(WITH_SDL)
95   if(WITH_SDL_DYNLOAD)
96     blender_include_dirs(../../extern/sdlew/include)
97     add_definitions(-DWITH_SDL_DYNLOAD)
98   endif()
99   add_definitions(-DWITH_SDL)
100 endif()
101
102 if(WITH_BINRELOC)
103   blender_include_dirs(${BINRELOC_INCLUDE_DIRS})
104   add_definitions(-DWITH_BINRELOC)
105 endif()
106
107 if(WITH_FREESTYLE)
108   blender_include_dirs(../blender/freestyle)
109   add_definitions(-DWITH_FREESTYLE)
110 endif()
111
112 if(WITH_XR_OPENXR)
113   add_definitions(-DWITH_XR_OPENXR)
114 endif()
115
116 if(WITH_GMP)
117   blender_include_dirs(${GMP_INCLUDE_DIRS})
118   add_definitions(-DWITH_GMP)
119 endif()
120
121 if(WITH_OPENCOLORIO)
122   add_definitions(-DWITH_OCIO)
123 endif()
124
125 # Setup the exe sources and buildinfo
126 set(SRC
127   creator.c
128   creator_args.c
129   creator_signals.c
130
131   creator_intern.h
132 )
133
134 # MSVC 2010 gives linking errors with the manifest
135 if(WIN32 AND NOT UNIX)
136   add_definitions(
137     -DBLEN_VER_RC_STR="${BLENDER_VERSION}"
138     -DBLEN_VER_RC_1=${BLENDER_VERSION_MAJOR}
139     -DBLEN_VER_RC_2=${BLENDER_VERSION_MINOR}
140     -DBLEN_VER_RC_3=${BLENDER_VERSION_PATCH}
141     -DBLEN_VER_RC_4=0
142   )
143
144
145   list(APPEND SRC
146     ${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.rc
147     ${CMAKE_BINARY_DIR}/blender.exe.manifest
148   )
149 endif()
150
151 if(WITH_BUILDINFO)
152   add_definitions(-DWITH_BUILDINFO)
153   # --------------------------------------------------------------------------
154   # These defines could all be moved into the header below
155
156   # Write strings into a separate header since we can escape C-strings
157   # in a way that's not practical when passing defines.
158   set(BUILD_PLATFORM "${CMAKE_SYSTEM_NAME}")
159   set(BUILD_TYPE "${CMAKE_BUILD_TYPE}")
160   set(BUILD_CFLAGS "${CMAKE_C_FLAGS}")
161   set(BUILD_CXXFLAGS "${CMAKE_CXX_FLAGS}")
162   set(BUILD_LINKFLAGS "${PLATFORM_LINKFLAGS}")
163   set(BUILD_SYSTEM "CMake")
164
165   if(WITH_COMPILER_SHORT_FILE_MACRO)
166     # It's not necessary to include path information
167     # about the system building Blender in the executable.
168     string(REPLACE "${PLATFORM_CFLAGS_FMACRO_PREFIX_MAP}" " " BUILD_CFLAGS "${BUILD_CFLAGS}")
169     string(REPLACE "${PLATFORM_CFLAGS_FMACRO_PREFIX_MAP}" " " BUILD_CXXFLAGS "${BUILD_CXXFLAGS}")
170   endif()
171
172   # Use `configure_file` instead of definitions since properly
173   # escaping the multiple command line arguments which themselves
174   # contain strings and spaces becomes overly error-prone & complicated.
175   configure_file(
176     "${CMAKE_SOURCE_DIR}/build_files/cmake/buildinfo_static.h.in"
177     "${CMAKE_CURRENT_BINARY_DIR}/buildinfo_static.h"
178     ESCAPE_QUOTES
179     @ONLY
180   )
181
182   unset(BUILD_PLATFORM)
183   unset(BUILD_TYPE)
184   unset(BUILD_CFLAGS)
185   unset(BUILD_CXXFLAGS)
186   unset(BUILD_LINKFLAGS)
187   unset(BUILD_SYSTEM)
188
189   # --------------------------------------------------------------------------
190   # write header for values that change each build
191   # note, generated file is in build dir's source/creator
192   #       except when used as an include path.
193
194   add_definitions(-DWITH_BUILDINFO_HEADER)
195
196   # include the output directory, where the buildinfo.h file is generated
197   include_directories(${CMAKE_CURRENT_BINARY_DIR})
198
199
200   # XXX, ${buildinfo_h_fake} is used here,
201   # because we rely on that file being detected as missing
202   # every build so that the real header "buildinfo.h" is updated.
203   #
204   # Keep this until we find a better way to resolve!
205
206   set(buildinfo_h_real "${CMAKE_CURRENT_BINARY_DIR}/buildinfo.h")
207   set(buildinfo_h_fake "${CMAKE_CURRENT_BINARY_DIR}/buildinfo.h_fake")
208
209   if(EXISTS ${buildinfo_h_fake})
210     message(FATAL_ERROR "File \"${buildinfo_h_fake}\" found, this should never be created, remove!")
211   endif()
212
213   # From the cmake documentation "If the output of the custom command is not actually created as a
214   # file on disk it should be marked with the SYMBOLIC source file property."
215   #
216   # Not doing this leads to build warnings for the not generated file on windows when using msbuild
217   SET_SOURCE_FILES_PROPERTIES(${buildinfo_h_fake} PROPERTIES SYMBOLIC TRUE)
218
219   # a custom target that is always built
220   add_custom_target(buildinfo ALL
221     DEPENDS ${buildinfo_h_fake})
222
223   # creates buildinfo.h using cmake script
224   add_custom_command(
225     OUTPUT
226       ${buildinfo_h_fake}  # ensure we always run
227       ${buildinfo_h_real}
228     COMMAND ${CMAKE_COMMAND}
229     -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
230     # overrides only used when non-empty strings
231     -DBUILD_DATE=${BUILDINFO_OVERRIDE_DATE}
232     -DBUILD_TIME=${BUILDINFO_OVERRIDE_TIME}
233     -P ${CMAKE_SOURCE_DIR}/build_files/cmake/buildinfo.cmake)
234
235   # buildinfo.h is a generated file
236   set_source_files_properties(
237     ${buildinfo_h_real}
238     PROPERTIES GENERATED TRUE
239     HEADER_FILE_ONLY TRUE)
240
241   unset(buildinfo_h_real)
242   unset(buildinfo_h_fake)
243
244   # add deps below, after adding blender
245   # -------------- done with header values.
246
247   list(APPEND SRC
248     buildinfo.c
249   )
250
251   # make an object library so can load with it in tests
252   add_library(buildinfoobj OBJECT buildinfo.c)
253   add_dependencies(buildinfoobj buildinfo)
254 endif()
255
256 add_cc_flags_custom_test(blender)
257
258 # message(STATUS "Configuring blender")
259 if(WITH_PYTHON_MODULE)
260   add_definitions(-DWITH_PYTHON_MODULE)
261
262   # creates ./bin/bpy.so which can be imported as a python module.
263   #
264   # note that 'SHARED' works on Linux and Windows,
265   # but not OSX which _must_ be 'MODULE'
266   add_library(blender MODULE ${SRC})
267   set_target_properties(
268     blender
269     PROPERTIES
270       PREFIX ""
271       OUTPUT_NAME bpy
272       LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
273       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin  # only needed on windows
274   )
275
276   if(APPLE)
277     set_target_properties(blender PROPERTIES MACOSX_BUNDLE TRUE)
278   endif()
279
280   if(WIN32)
281     # python modules use this
282     set_target_properties(
283       blender
284       PROPERTIES
285       SUFFIX ".pyd"
286     )
287   endif()
288
289 else()
290   add_executable(blender ${EXETYPE} ${SRC})
291   if(WIN32)
292       add_executable(blender-launcher WIN32
293         blender_launcher_win32.c
294         ${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.rc
295         ${CMAKE_BINARY_DIR}/blender.exe.manifest
296       )
297       target_compile_definitions (blender-launcher PRIVATE -D_UNICODE -DUNICODE)
298       target_link_libraries(blender-launcher Pathcch.lib)
299   endif()
300 endif()
301
302 if(WITH_BUILDINFO)
303   # explicitly say that the executable depends on the buildinfo
304   add_dependencies(blender buildinfo)
305 endif()
306
307
308 set(BLENDER_TEXT_FILES
309   ${CMAKE_SOURCE_DIR}/release/text/copyright.txt
310   # generate this file
311   # ${CMAKE_SOURCE_DIR}/release/text/readme.html
312 )
313
314
315 # -----------------------------------------------------------------------------
316 # Platform Specific Var: TARGETDIR_VER
317
318 if(UNIX AND NOT APPLE)
319   if(WITH_PYTHON_MODULE)
320     if(WITH_INSTALL_PORTABLE)
321       set(TARGETDIR_VER ${BLENDER_VERSION})
322     else()
323       set(TARGETDIR_VER ${PYTHON_SITE_PACKAGES}/${BLENDER_VERSION})
324     endif()
325   else()
326     if(WITH_INSTALL_PORTABLE)
327       set(TARGETDIR_VER ${BLENDER_VERSION})
328     else()
329       set(TARGETDIR_VER share/blender/${BLENDER_VERSION})
330     endif()
331   endif()
332
333 elseif(WIN32)
334   set(TARGETDIR_VER ${BLENDER_VERSION})
335
336 elseif(APPLE)
337   if(WITH_PYTHON_MODULE)
338     if(WITH_INSTALL_PORTABLE)
339       set(TARGETDIR_VER $<TARGET_FILE_DIR:blender>/../Resources/${BLENDER_VERSION})
340       # Keep the `BLENDER_VERSION` folder and bpy.so in the build folder.
341       set(INSTALL_BPY_TO_SITE_PACKAGES OFF)
342     else()
343       set(TARGETDIR_VER "${PYTHON_LIBPATH}/Resources/${BLENDER_VERSION}")
344       set(INSTALL_BPY_TO_SITE_PACKAGES ON)
345     endif()
346   else()
347     set(TARGETDIR_VER Blender.app/Contents/Resources/${BLENDER_VERSION})
348   endif()
349   set(MAC_BLENDER_TARGET_DYLIBS_DIR "${TARGETDIR_VER}/lib")
350   # Skip relinking on cpack / install
351   set_target_properties(blender PROPERTIES BUILD_WITH_INSTALL_RPATH true)
352 endif()
353
354
355 # -----------------------------------------------------------------------------
356 # Install Targets (Generic, All Platforms)
357
358
359 # important to make a clean  install each time, else old scripts get loaded.
360 install(
361   CODE
362   "file(REMOVE_RECURSE ${TARGETDIR_VER})"
363 )
364
365 if(WITH_PYTHON)
366   # install(CODE "message(\"copying blender scripts...\")")
367
368   # exclude addons_contrib if release
369   if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR
370      "${BLENDER_VERSION_CYCLE}" STREQUAL "rc")
371     set(ADDON_EXCLUDE_CONDITIONAL "addons_contrib/*")
372   else()
373     set(ADDON_EXCLUDE_CONDITIONAL "_addons_contrib/*")  # dummy, won't do anything
374   endif()
375
376   # do not install freestyle dir if disabled
377   if(NOT WITH_FREESTYLE)
378     set(FREESTYLE_EXCLUDE_CONDITIONAL "freestyle/*")
379   else()
380     set(FREESTYLE_EXCLUDE_CONDITIONAL "_freestyle/*")  # dummy, won't do anything
381   endif()
382
383   install(
384     DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
385     DESTINATION ${TARGETDIR_VER}
386     PATTERN ".git" EXCLUDE
387     PATTERN ".gitignore" EXCLUDE
388     PATTERN ".arcconfig" EXCLUDE
389     PATTERN "__pycache__" EXCLUDE
390     PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE
391     PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE
392   )
393
394   unset(ADDON_EXCLUDE_CONDITIONAL)
395   unset(FREESTYLE_EXCLUDE_CONDITIONAL)
396 endif()
397
398 # fonts
399 install(
400   DIRECTORY
401     ${CMAKE_SOURCE_DIR}/release/datafiles/fonts
402   DESTINATION ${TARGETDIR_VER}/datafiles
403 )
404
405 # localization
406 if(WITH_INTERNATIONAL)
407   set(_locale_dir "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
408   set(_locale_target_dir ${TARGETDIR_VER}/datafiles/locale)
409
410   file(GLOB _po_files "${_locale_dir}/po/*.po")
411   foreach(_po_file ${_po_files})
412     msgfmt_simple(${_po_file} _all_mo_files)
413   endforeach()
414
415   # Create a custom target which will compile all po to mo
416   add_custom_target(
417     locales
418     DEPENDS ${_all_mo_files})
419
420   add_dependencies(blender locales)
421
422   # Generate INSTALL rules
423   install(
424     FILES ${_locale_dir}/languages
425     DESTINATION ${_locale_target_dir}
426   )
427
428   foreach(_mo_file ${_all_mo_files})
429     get_filename_component(_locale_name ${_mo_file} NAME_WE)
430     install(
431       FILES ${_mo_file}
432       DESTINATION ${_locale_target_dir}/${_locale_name}/LC_MESSAGES
433       RENAME blender.mo
434     )
435     unset(_locale_name)
436   endforeach()
437
438   unset(_all_mo_files)
439   unset(_po_files)
440   unset(_po_file)
441   unset(_mo_file)
442   unset(_locale_target_dir)
443
444   unset(_locale_dir)
445 endif()
446
447 # color management
448 if(WITH_OPENCOLORIO)
449   install(
450     DIRECTORY ${CMAKE_SOURCE_DIR}/release/datafiles/colormanagement
451     DESTINATION ${TARGETDIR_VER}/datafiles
452   )
453 endif()
454
455 # helpful tip when using make
456 if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*")
457   # message after building.
458   add_custom_command(
459     TARGET blender POST_BUILD MAIN_DEPENDENCY blender
460     COMMAND ${CMAKE_COMMAND} -E
461             echo 'now run: \"make install\" to copy runtime files and scripts to ${TARGETDIR_VER}'
462   )
463 endif()
464
465
466 # -----------------------------------------------------------------------------
467 # Install Targets (Platform Specific)
468
469 if(UNIX AND NOT APPLE)
470
471   if(NOT WITH_PYTHON_MODULE)
472     if(WITH_DOC_MANPAGE)
473       add_custom_target(
474         blender_man_page ALL
475         COMMAND ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py
476                 --blender ${EXECUTABLE_OUTPUT_PATH}/blender
477                 --output ${CMAKE_CURRENT_BINARY_DIR}/blender.1)
478       add_dependencies(blender_man_page blender)
479     endif()
480   endif()
481
482   # there are a few differences between portable and system install
483   if(WITH_PYTHON_MODULE)
484     if(WITH_INSTALL_PORTABLE)
485       install(
486         TARGETS blender
487         DESTINATION "."
488       )
489     else()
490       install(
491         TARGETS blender
492         LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES}
493       )
494     endif()
495     # none of the other files are needed currently
496   elseif(WITH_INSTALL_PORTABLE)
497     install(
498       TARGETS blender
499       DESTINATION "."
500     )
501
502     if(WITH_DOC_MANPAGE)
503       install(
504         FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
505         DESTINATION "."
506       )
507     endif()
508     install(
509       FILES
510         ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
511         ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
512         ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/symbolic/apps/blender-symbolic.svg
513       DESTINATION "."
514     )
515
516     if(WITH_BLENDER_THUMBNAILER)
517       install(
518         TARGETS blender-thumbnailer
519         DESTINATION "."
520       )
521     endif()
522
523     if(EXISTS ${LIBDIR}/mesa)
524       install(DIRECTORY ${LIBDIR}/mesa/lib DESTINATION ".")
525
526       install(
527         PROGRAMS
528         ${CMAKE_SOURCE_DIR}/release/bin/blender-softwaregl
529         DESTINATION "."
530       )
531     endif()
532
533     set(BLENDER_TEXT_FILES_DESTINATION ".")
534   else()
535     # main blender binary
536     install(
537       TARGETS blender
538       DESTINATION bin
539     )
540     if(WITH_DOC_MANPAGE)
541       # manpage only with 'blender' binary
542       install(
543         FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
544         DESTINATION share/man/man1
545       )
546     endif()
547
548     # misc files
549     install(
550       FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
551       DESTINATION share/applications
552     )
553     install(
554       FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
555       DESTINATION share/icons/hicolor/scalable/apps
556     )
557     install(
558       FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/symbolic/apps/blender-symbolic.svg
559       DESTINATION share/icons/hicolor/symbolic/apps
560     )
561     if(WITH_BLENDER_THUMBNAILER)
562       install(
563         TARGETS blender-thumbnailer
564         DESTINATION bin
565       )
566     endif()
567     set(BLENDER_TEXT_FILES_DESTINATION share/doc/blender)
568   endif()
569
570   if(WITH_PYTHON)
571     if(WITH_PYTHON_INSTALL)
572
573       install(
574         PROGRAMS ${PYTHON_EXECUTABLE}
575         DESTINATION ${TARGETDIR_VER}/python/bin
576       )
577
578       # on some platforms (like openSUSE) Python is linked
579       # to be used from lib64 folder.
580       # determine this from Python's libraries path
581       #
582       # ugh, its possible 'lib64' is just a symlink to 'lib' which causes incorrect use of 'lib64'
583       get_filename_component(_pypath_real ${PYTHON_LIBPATH} REALPATH)
584       if(${_pypath_real} MATCHES "lib64$")
585         set(_target_LIB "lib64")
586       else()
587         set(_target_LIB "lib")
588       endif()
589       unset(_pypath_real)
590
591       # Copy the systems python into the install directory
592       # install(CODE "message(\"copying a subset of the systems python...\")")
593       install(
594         DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}
595         DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}
596         PATTERN "__pycache__" EXCLUDE               # * any cache *
597         PATTERN "config-${PYTHON_VERSION}/*.a" EXCLUDE  # static lib
598         PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
599         PATTERN "site-packages/*" EXCLUDE           # ./site-packages/*
600         PATTERN "tkinter" EXCLUDE                   # ./tkinter
601         PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
602         PATTERN "idlelib" EXCLUDE                   # ./idlelib
603         PATTERN "test" EXCLUDE                      # ./test
604         PATTERN "turtledemo" EXCLUDE                # ./turtledemo
605         PATTERN "turtle.py" EXCLUDE                 # ./turtle.py
606         PATTERN "wininst*.exe" EXCLUDE              # from distutils, avoid malware false positive
607       )
608
609       # Needed for distutils/pip
610       # get the last part of the include dir, will be 'python{version}{abiflag}',
611       get_filename_component(_py_inc_suffix ${PYTHON_INCLUDE_DIR} NAME)
612       install(
613         FILES ${PYTHON_INCLUDE_DIR}/pyconfig.h
614         DESTINATION ${TARGETDIR_VER}/python/include/${_py_inc_suffix}
615       )
616       unset(_py_inc_suffix)
617
618       if(WITH_PYTHON_INSTALL_NUMPY)
619         # Install to the same directory as the source, so debian-like
620         # distros are happy with their policy.
621         set(_suffix "site-packages")
622         if(${PYTHON_NUMPY_PATH} MATCHES "dist-packages")
623           set(_suffix "dist-packages")
624         endif()
625         install(
626           DIRECTORY ${PYTHON_NUMPY_PATH}/numpy
627           DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
628           PATTERN ".svn" EXCLUDE
629           PATTERN "__pycache__" EXCLUDE           # * any cache *
630           PATTERN "*.pyc" EXCLUDE                 # * any cache *
631           PATTERN "*.pyo" EXCLUDE                 # * any cache *
632           PATTERN "oldnumeric" EXCLUDE            # ./oldnumeric
633           PATTERN "doc" EXCLUDE                   # ./doc
634           PATTERN "tests" EXCLUDE                 # ./tests
635           PATTERN "f2py" EXCLUDE                  # ./f2py - fortran/python interface code, not for blender.
636           PATTERN "include" EXCLUDE               # include dirs all over, we won't use NumPy/CAPI
637           PATTERN "*.h" EXCLUDE                   # some includes are not in include dirs
638           PATTERN "*.a" EXCLUDE                   # ./core/lib/libnpymath.a - for linking, we don't need.
639         )
640         install(
641           DIRECTORY ${PYTHON_NUMPY_PATH}/Cython
642           DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
643           PATTERN ".svn" EXCLUDE
644           PATTERN "__pycache__" EXCLUDE           # * any cache *
645           PATTERN "*.pyc" EXCLUDE                 # * any cache *
646           PATTERN "*.pyo" EXCLUDE                 # * any cache *
647         )
648         install(
649           FILES ${PYTHON_NUMPY_PATH}/cython.py
650           DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
651         )
652         unset(_suffix)
653       endif()
654
655       if(WITH_PYTHON_INSTALL_ZSTANDARD)
656         # Install to the same directory as the source, so debian-like
657         # distros are happy with their policy.
658         set(_suffix "site-packages")
659         if(${PYTHON_ZSTANDARD_PATH} MATCHES "dist-packages")
660           set(_suffix "dist-packages")
661         endif()
662         install(
663           DIRECTORY ${PYTHON_ZSTANDARD_PATH}/zstandard
664           DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
665           PATTERN ".svn" EXCLUDE
666           PATTERN "__pycache__" EXCLUDE           # * any cache *
667           PATTERN "*.pyc" EXCLUDE                 # * any cache *
668           PATTERN "*.pyo" EXCLUDE                 # * any cache *
669         )
670         unset(_suffix)
671       endif()
672
673       # Copy requests, we need to generalize site-packages
674       if(WITH_PYTHON_INSTALL_REQUESTS)
675         set(_suffix "site-packages")
676         if(${PYTHON_REQUESTS_PATH} MATCHES "dist-packages")
677           set(_suffix "dist-packages")
678         endif()
679         install(
680           DIRECTORY ${PYTHON_REQUESTS_PATH}/requests
681           DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
682           PATTERN ".svn" EXCLUDE
683           PATTERN "__pycache__" EXCLUDE           # * any cache *
684           PATTERN "*.pyc" EXCLUDE                 # * any cache *
685           PATTERN "*.pyo" EXCLUDE                 # * any cache *
686         )
687         # On some platforms requests does have extra dependencies.
688         set(_requests_deps "certifi" "chardet" "idna" "urllib3")
689         foreach(_requests_dep ${_requests_deps})
690           if(EXISTS ${PYTHON_REQUESTS_PATH}/${_requests_dep})
691             install(
692               DIRECTORY ${PYTHON_REQUESTS_PATH}/${_requests_dep}
693               DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
694               PATTERN ".svn" EXCLUDE
695               PATTERN "__pycache__" EXCLUDE           # * any cache *
696               PATTERN "*.pyc" EXCLUDE                 # * any cache *
697               PATTERN "*.pyo" EXCLUDE                 # * any cache *
698             )
699           endif()
700         endforeach()
701         if(EXISTS ${PYTHON_REQUESTS_PATH}/six.py)
702           install(
703             FILES ${PYTHON_REQUESTS_PATH}/six.py
704             DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}/python${PYTHON_VERSION}/${_suffix}
705           )
706         endif()
707         unset(_requests_dep)
708         unset(_requests_deps)
709         unset(_suffix)
710       endif()
711       unset(_target_LIB)
712
713     endif()
714   endif()
715
716   if(WITH_DRACO)
717     install(
718       PROGRAMS $<TARGET_FILE:extern_draco>
719       DESTINATION ${TARGETDIR_VER}/python/lib/python${PYTHON_VERSION}/site-packages
720     )
721   endif()
722 elseif(WIN32)
723
724   set(BLENDER_TEXT_FILES_DESTINATION ".")
725
726   if(WITH_OPENMP AND MSVC_CLANG)
727     install(
728           FILES ${CLANG_OPENMP_DLL}
729           DESTINATION "."
730     )
731   endif()
732
733   if(WITH_FFTW3)
734     install(
735           FILES ${LIBDIR}/fftw3/lib/libfftw3-3.dll
736           DESTINATION "."
737     )
738   endif()
739   if(MSVC_ASAN)
740     # The asan dll's can be found in the same folder as the compiler, this is the easiest way to find these.
741     string(REPLACE "cl.exe" "clang_rt.asan_dynamic-x86_64.dll" ASAN_DLL ${CMAKE_C_COMPILER})
742     string(REPLACE "cl.exe" "clang_rt.asan_dbg_dynamic-x86_64.dll" ASAN_DEBUG_DLL ${CMAKE_C_COMPILER})
743     if(NOT EXISTS "${ASAN_DLL}")
744       message(FATAL_ERROR "Asan is enabled, but the ASAN runtime is not detected, this is an optional component during the MSVC install, please install it")
745     endif()
746     install(
747           FILES ${ASAN_DLL}
748           DESTINATION "."
749           CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
750     )
751     install(
752           FILES ${ASAN_DEBUG_DLL}
753           DESTINATION "."
754           CONFIGURATIONS Debug
755     )
756     unset(ASAN_DLL)
757     unset(ASAN_DEBUG_DLL)
758   endif()
759
760   if(WITH_GMP)
761     install(
762           FILES ${LIBDIR}/gmp/lib/libgmp-10.dll
763           DESTINATION "."
764     )
765     install(
766           FILES ${LIBDIR}/gmp/lib/libgmpxx.dll
767           DESTINATION "."
768           CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
769     )
770     install(
771           FILES ${LIBDIR}/gmp/lib/libgmpxx_d.dll
772           DESTINATION "."
773           CONFIGURATIONS Debug
774     )
775   endif()
776
777   if(WITH_WINDOWS_PDB)
778     if(WITH_WINDOWS_STRIPPED_PDB)
779       # Icky hack for older cmake from https://stackoverflow.com/a/21198501
780       # $<CONFIG> will work in newer cmake but the version currently (3.12)
781       # on the buildbot does not support this endavour.
782       install(FILES ${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/blender_public.pdb DESTINATION . RENAME blender.pdb)
783     else()
784       install(FILES $<TARGET_PDB_FILE:blender> DESTINATION . RENAME blender.pdb)
785     endif()
786   endif()
787
788   if(WITH_OPENVDB)
789       install(
790         FILES ${LIBDIR}/openvdb/bin/openvdb.dll
791         DESTINATION "."
792         CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
793       )
794       install(
795         FILES ${LIBDIR}/openvdb/bin/openvdb_d.dll
796         DESTINATION "."
797         CONFIGURATIONS Debug
798       )
799   endif()
800
801   if(WITH_PYTHON)
802     string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
803
804     if(NOT CMAKE_COMPILER_IS_GNUCC)
805       install(
806         FILES ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python${_PYTHON_VERSION_NO_DOTS}.dll
807               ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python3.dll
808         DESTINATION "."
809         CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
810       )
811
812       install(
813         FILES ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python${_PYTHON_VERSION_NO_DOTS}_d.dll
814               ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python3_d.dll
815         DESTINATION "."
816         CONFIGURATIONS Debug
817       )
818     endif()
819
820     if(WITH_PYTHON_INSTALL)
821       # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
822
823       install(DIRECTORY DESTINATION ${TARGETDIR_VER}/python)
824       install(DIRECTORY DESTINATION ${TARGETDIR_VER}/python/lib)
825
826       install(
827         DIRECTORY ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/lib
828         DESTINATION ${BLENDER_VERSION}/python/
829         CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
830         PATTERN ".svn" EXCLUDE
831         PATTERN "*_d.*" EXCLUDE                  # * debug libraries *
832         PATTERN "__pycache__" EXCLUDE           # * any cache *
833         PATTERN "*.pyc" EXCLUDE                 # * any cache *
834         PATTERN "*.pyo" EXCLUDE                 # * any cache *
835       )
836
837       install(
838         DIRECTORY ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/lib
839         DESTINATION ${BLENDER_VERSION}/python/
840         CONFIGURATIONS Debug
841         PATTERN ".svn" EXCLUDE
842         PATTERN "__pycache__" EXCLUDE           # * any cache *
843         PATTERN "*.pyc" EXCLUDE                 # * any cache *
844         PATTERN "*.pyo" EXCLUDE                 # * any cache *)
845       )
846
847       install(
848         DIRECTORY ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/DLLs
849         DESTINATION ${BLENDER_VERSION}/python
850         CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
851         PATTERN "*.pdb" EXCLUDE
852         PATTERN "*_d.*" EXCLUDE
853       )
854
855       install(
856         DIRECTORY ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/DLLs
857         DESTINATION ${BLENDER_VERSION}/python
858         CONFIGURATIONS Debug
859       )
860
861       install(
862         FILES ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python${_PYTHON_VERSION_NO_DOTS}.dll
863               ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python.exe
864         DESTINATION ${BLENDER_VERSION}/python/bin
865         CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
866       )
867       install(
868         FILES ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python${_PYTHON_VERSION_NO_DOTS}_d.dll
869               ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python_d.exe
870         DESTINATION ${BLENDER_VERSION}/python/bin
871         CONFIGURATIONS Debug
872       )
873
874       if(WINDOWS_PYTHON_DEBUG)
875         install(
876           FILES ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}.pdb
877           DESTINATION "."
878           CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
879         )
880
881         install(
882           FILES ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}_d.pdb
883           DESTINATION "."
884           CONFIGURATIONS Debug
885         )
886       endif()
887     endif()
888
889     unset(_PYTHON_VERSION_NO_DOTS)
890   endif()
891
892   # EGL Runtime Components
893   if(WITH_GL_EGL)
894     if(WIN32)
895       install(FILES "${OPENGLES_DLL}"     DESTINATION ".")
896       install(FILES "${OPENGLES_EGL_DLL}" DESTINATION ".")
897
898       if(WITH_GL_ANGLE)
899         install(FILES "${D3DCOMPILER_DLL}" DESTINATION ".")
900       endif()
901     endif()
902   endif()
903
904   if(WITH_CODEC_FFMPEG)
905     install(
906       FILES
907         ${LIBDIR}/ffmpeg/lib/avcodec-58.dll
908         ${LIBDIR}/ffmpeg/lib/avformat-58.dll
909         ${LIBDIR}/ffmpeg/lib/avdevice-58.dll
910         ${LIBDIR}/ffmpeg/lib/avutil-56.dll
911         ${LIBDIR}/ffmpeg/lib/swscale-5.dll
912         ${LIBDIR}/ffmpeg/lib/swresample-3.dll
913       DESTINATION "."
914     )
915   endif()
916   if(WITH_TBB)
917     install(
918       FILES
919         ${LIBDIR}/tbb/bin/tbb.dll
920       DESTINATION "."
921       CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
922     )
923     install(
924       FILES
925         ${LIBDIR}/tbb/bin/tbb_debug.dll
926       DESTINATION "."
927       CONFIGURATIONS Debug
928     )
929   endif()
930   if(WITH_TBB_MALLOC_PROXY)
931     install(
932       FILES
933         ${LIBDIR}/tbb/bin/tbbmalloc.dll
934         ${LIBDIR}/tbb/bin/tbbmalloc_proxy.dll
935       DESTINATION "."
936       CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
937     )
938     install(
939       FILES
940         ${LIBDIR}/tbb/bin/tbbmalloc_debug.dll
941         ${LIBDIR}/tbb/bin/tbbmalloc_proxy_debug.dll
942       DESTINATION "."
943       CONFIGURATIONS Debug
944     )
945     list(APPEND LIB ${TBB_MALLOC_LIBRARIES})
946   endif()
947
948   if(WITH_CODEC_SNDFILE)
949     install(
950       FILES ${LIBDIR}/sndfile/lib/libsndfile-1.dll
951       DESTINATION "."
952     )
953   endif()
954
955   if(WITH_OPENAL)
956     install(
957       FILES
958         ${LIBDIR}/openal/lib/OpenAL32.dll
959       DESTINATION "."
960     )
961   endif()
962
963   if(WITH_SDL)
964     install(
965       FILES ${LIBDIR}/sdl/lib/SDL2.dll
966       DESTINATION "."
967     )
968   endif()
969
970   if(WITH_SYSTEM_AUDASPACE)
971     install(
972       FILES
973         ${LIBDIR}/audaspace/lib/audaspace.dll
974         ${LIBDIR}/audaspace/lib/audaspace-c.dll
975         ${LIBDIR}/audaspace/lib/audaspace-py.dll
976       DESTINATION "."
977     )
978   endif()
979
980   install(
981     FILES
982       ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_debug_gpu.cmd
983       ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_debug_gpu_glitchworkaround.cmd
984       ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_debug_log.cmd
985       ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_factory_startup.cmd
986       ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_oculus.cmd
987       ${CMAKE_SOURCE_DIR}/release/windows/batch/oculus.json
988     DESTINATION "."
989   )
990
991   if(WITH_BLENDER_THUMBNAILER)
992     install(
993       TARGETS BlendThumb
994       DESTINATION "."
995     )
996   endif()
997
998   if(WITH_DRACO)
999     install(
1000       PROGRAMS $<TARGET_FILE:extern_draco>
1001       DESTINATION ${TARGETDIR_VER}/python/lib/site-packages
1002     )
1003   endif()
1004 elseif(APPLE)
1005   if(NOT WITH_PYTHON_MODULE)
1006     # Uppercase name for app bundle
1007     set_target_properties(blender PROPERTIES OUTPUT_NAME Blender)
1008   endif()
1009
1010   # handy install macro to exclude files, we use \$ escape for the "to"
1011   # argument when calling so ${BUILD_TYPE} does not get expanded
1012   macro(install_dir from to)
1013     install(
1014       DIRECTORY ${from}
1015       DESTINATION ${to}
1016       PATTERN ".git" EXCLUDE
1017       PATTERN ".svn" EXCLUDE
1018       PATTERN "*.pyc" EXCLUDE
1019       PATTERN "*.pyo" EXCLUDE
1020       PATTERN "*.orig" EXCLUDE
1021       PATTERN "*.rej" EXCLUDE
1022       PATTERN "__pycache__" EXCLUDE
1023       PATTERN "__MACOSX" EXCLUDE
1024       PATTERN ".DS_Store" EXCLUDE
1025       PATTERN "config-${PYTHON_VERSION}/*.a" EXCLUDE  # static lib
1026       PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
1027       PATTERN "tkinter" EXCLUDE                   # ./tkinter
1028       PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
1029       PATTERN "idlelib" EXCLUDE                   # ./idlelib
1030       PATTERN "test" EXCLUDE                      # ./test
1031       PATTERN "turtledemo" EXCLUDE                # ./turtledemo
1032       PATTERN "turtle.py" EXCLUDE                 # ./turtle.py
1033       PATTERN "wininst*.exe" EXCLUDE              # from distutils, avoid malware false positive
1034     )
1035   endmacro()
1036
1037   set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/Blender.app)
1038
1039   # setup Info.plist
1040   execute_process(COMMAND date "+%Y-%m-%d"
1041                   OUTPUT_VARIABLE BLENDER_DATE
1042                   OUTPUT_STRIP_TRAILING_WHITESPACE)
1043
1044   set_target_properties(blender PROPERTIES
1045     MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist
1046     MACOSX_BUNDLE_SHORT_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH}"
1047     MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH} ${BLENDER_DATE}")
1048
1049   # Gather the date in finder-style
1050   execute_process(COMMAND date "+%m/%d/%Y/%H:%M"
1051   OUTPUT_VARIABLE SETFILE_DATE
1052   OUTPUT_STRIP_TRAILING_WHITESPACE)
1053
1054   # Give the bundle actual creation/modification date
1055   #
1056   # Note that the directory might not yet exist, which happens when CMake is first run.
1057   if(NOT EXISTS ${EXECUTABLE_OUTPUT_PATH}/Blender.app)
1058     file(MAKE_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/Blender.app)
1059   endif()
1060   execute_process(COMMAND SetFile -d ${SETFILE_DATE} -m ${SETFILE_DATE}
1061                   ${EXECUTABLE_OUTPUT_PATH}/Blender.app)
1062
1063   install(
1064     TARGETS blender
1065     DESTINATION "."
1066   )
1067
1068   # install release and app files
1069   set(BLENDER_TEXT_FILES_DESTINATION Blender.app/Contents/Resources/text)
1070
1071   install(
1072     FILES ${OSX_APP_SOURCEDIR}/Contents/PkgInfo
1073     DESTINATION Blender.app/Contents
1074   )
1075
1076   install_dir(
1077     ${OSX_APP_SOURCEDIR}/Contents/Resources
1078     Blender.app/Contents/
1079   )
1080
1081   if(WITH_OPENMP AND OPENMP_CUSTOM)
1082     install(
1083       FILES "${OpenMP_LIBRARY}"
1084       DESTINATION "${MAC_BLENDER_TARGET_DYLIBS_DIR}"
1085     )
1086   endif()
1087
1088   if(WITH_COMPILER_ASAN)
1089     install(
1090       FILES "${COMPILER_ASAN_LIBRARY}"
1091       DESTINATION "${MAC_BLENDER_TARGET_DYLIBS_DIR}"
1092     )
1093   endif()
1094
1095   # python
1096   if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
1097     # Copy the python libs into the install directory
1098     install_dir(
1099       ${PYTHON_LIBPATH}
1100       ${TARGETDIR_VER}/python/lib
1101     )
1102
1103     install(DIRECTORY ${LIBDIR}/python/bin
1104       DESTINATION ${TARGETDIR_VER}/python
1105       USE_SOURCE_PERMISSIONS
1106     )
1107
1108     # Needed for distutils/pip
1109     # get the last part of the include dir, will be 'python{version}{abiflag}',
1110     get_filename_component(_py_inc_suffix ${PYTHON_INCLUDE_DIR} NAME)
1111     install(
1112       FILES ${PYTHON_INCLUDE_DIR}/pyconfig.h
1113       DESTINATION ${TARGETDIR_VER}/python/include/${_py_inc_suffix}
1114     )
1115     unset(_py_inc_suffix)
1116   endif()
1117   if(WITH_PYTHON_MODULE)
1118     if(INSTALL_BPY_TO_SITE_PACKAGES)
1119       install(
1120         TARGETS blender
1121         LIBRARY DESTINATION ${PYTHON_LIBPATH}/site-packages
1122       )
1123     endif()
1124   endif()
1125
1126   if(WITH_DRACO)
1127     install(
1128       PROGRAMS $<TARGET_FILE:extern_draco>
1129       DESTINATION ${TARGETDIR_VER}/python/lib/python${PYTHON_VERSION}/site-packages
1130     )
1131   endif()
1132 endif()
1133
1134 # -----------------------------------------------------------------------------
1135 # Generic Install, for all targets
1136
1137 if(DEFINED BLENDER_TEXT_FILES_DESTINATION)
1138
1139   install(
1140     CODE
1141     "
1142     file(READ \"${CMAKE_SOURCE_DIR}/release/text/readme.html\" DATA_SRC)
1143     string(REGEX REPLACE \"BLENDER_VERSION\" \"${BLENDER_VERSION}\" DATA_DST \"\${DATA_SRC}\")
1144     file(WRITE \"${CMAKE_BINARY_DIR}/release/text/readme.html\" \"\${DATA_DST}\")
1145     unset(DATA_SRC)
1146     unset(DATA_DST)
1147     "
1148   )
1149   list(APPEND BLENDER_TEXT_FILES
1150     ${CMAKE_BINARY_DIR}/release/text/readme.html
1151   )
1152
1153   install(
1154     FILES ${BLENDER_TEXT_FILES}
1155     DESTINATION "${BLENDER_TEXT_FILES_DESTINATION}"
1156   )
1157
1158   install(
1159     DIRECTORY
1160     ${CMAKE_SOURCE_DIR}/release/license
1161     DESTINATION "${BLENDER_TEXT_FILES_DESTINATION}"
1162 )
1163 endif()
1164
1165 # install more files specified elsewhere
1166 delayed_do_install(${TARGETDIR_VER})
1167
1168 unset(BLENDER_TEXT_FILES)
1169 unset(BLENDER_TEXT_FILES_DESTINATION)
1170
1171
1172 # -----------------------------------------------------------------------------
1173 # Geometry Icons
1174
1175 # Geometry icons.
1176 get_property(_icon_names GLOBAL PROPERTY ICON_GEOM_NAMES)
1177 set(_icon_files)
1178 foreach(_f ${_icon_names})
1179   list(APPEND _icon_files
1180     "${CMAKE_SOURCE_DIR}/release/datafiles/icons/${_f}.dat"
1181   )
1182 endforeach()
1183 install(
1184   FILES ${_icon_files}
1185   DESTINATION ${TARGETDIR_VER}/datafiles/icons
1186 )
1187
1188 unset(_icon_names)
1189 unset(_icon_files)
1190 unset(_f)
1191
1192 # -----------------------------------------------------------------------------
1193 # Studio Lights
1194 install(
1195   DIRECTORY
1196     ${CMAKE_SOURCE_DIR}/release/datafiles/studiolights
1197   DESTINATION ${TARGETDIR_VER}/datafiles
1198 )
1199
1200 # -----------------------------------------------------------------------------
1201 # Setup link libs
1202
1203 add_dependencies(blender makesdna)
1204 target_link_libraries(blender ${LIB})
1205 unset(LIB)
1206
1207 setup_platform_linker_flags(blender)
1208 setup_platform_linker_libs(blender)
1209
1210 if(APPLE)
1211   set_target_properties(blender PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/osx_locals.map)
1212 elseif(UNIX)
1213   set_target_properties(blender PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/blender.map)
1214 endif()
1215
1216 # -----------------------------------------------------------------------------
1217 # USD registry.
1218 # USD requires a set of JSON files that define the standard schemas. These
1219 # files are required at runtime.
1220 if(WITH_USD)
1221   add_definitions(-DWITH_USD)
1222   install(DIRECTORY
1223     ${USD_LIBRARY_DIR}/usd
1224     DESTINATION "${TARGETDIR_VER}/datafiles"
1225   )
1226 endif()
1227
1228
1229 # vcpkg substitutes our libs with theirs, which will cause issues when you
1230 # you run these builds on other systems due to missing dlls. So we opt out
1231 # the use of vcpkg
1232 if(WIN32)
1233   set_target_properties(blender PROPERTIES VS_GLOBAL_VcpkgEnabled "false")
1234   set_target_properties(blender PROPERTIES
1235     PDB_NAME "blender_private"
1236     PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
1237     if(WITH_WINDOWS_PDB AND WITH_WINDOWS_STRIPPED_PDB)
1238       # This is slightly messy, but single target generators like ninja will not have the
1239       # CMAKE_CFG_INTDIR variable and multitarget generators like msbuild will not have
1240       # CMAKE_BUILD_TYPE. This can be simplified by target_link_options and the $<CONFIG>
1241       # generator expression in newer cmake (2.13+) but until that time this fill have suffice.
1242       if(CMAKE_BUILD_TYPE)
1243         set_property(TARGET blender APPEND_STRING PROPERTY LINK_FLAGS  " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/blender_public.pdb")
1244       else()
1245         set_property(TARGET blender APPEND_STRING PROPERTY LINK_FLAGS  " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/blender_public.pdb")
1246       endif()
1247   endif()
1248 endif()
1249
1250 # -----------------------------------------------------------------------------
1251 # Setup launcher
1252
1253 if(WIN32 AND NOT WITH_PYTHON_MODULE)
1254   install(
1255     TARGETS blender blender-launcher
1256     COMPONENT Blender
1257     DESTINATION "."
1258   )
1259   set_target_properties(
1260     blender
1261     PROPERTIES
1262       VS_USER_PROPS "blender.Cpp.user.props"
1263   )
1264 endif()
1265
1266 # -----------------------------------------------------------------------------
1267 # Post-install script
1268
1269 if(POSTINSTALL_SCRIPT)
1270   install(SCRIPT ${POSTINSTALL_SCRIPT})
1271 endif()