support for blender as a module on win32.
[blender.git] / source / creator / CMakeLists.txt
1 # -*- mode: cmake; indent-tabs-mode: t; -*-
2 # $Id$
3 # ***** BEGIN GPL LICENSE BLOCK *****
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #
19 # The Original Code is Copyright (C) 2006, Blender Foundation
20 # All rights reserved.
21 #
22 # The Original Code is: all of this file.
23 #
24 # Contributor(s): Jacques Beaurain.
25 #
26 # ***** END GPL LICENSE BLOCK *****
27
28 # So BUILDINFO and BLENDERPATH strings are automatically quoted
29 cmake_policy(SET CMP0005 NEW)
30
31 setup_libdirs()
32
33 blender_include_dirs(
34         ../../intern/guardedalloc
35         ../blender/blenlib
36         ../blender/blenkernel
37         ../blender/blenloader
38         ../blender/editors/include
39         ../blender/makesrna
40         ../blender/imbuf
41         ../blender/render/extern/include
42         ../blender/makesdna
43         ../blender/gpu
44         ../blender/windowmanager
45 )
46
47 if(WITH_CODEC_QUICKTIME)
48         add_definitions(-DWITH_QUICKTIME)
49 endif()
50
51 if(WITH_IMAGE_OPENEXR)
52         add_definitions(-DWITH_OPENEXR)
53 endif()
54
55 if(WITH_IMAGE_OPENJPEG)
56         add_definitions(-DWITH_OPENJPEG)
57 endif()
58
59 if(WITH_IMAGE_TIFF)
60         add_definitions(-DWITH_TIFF)
61 endif()
62
63 if(WITH_IMAGE_DDS)
64         add_definitions(-DWITH_DDS)
65 endif()
66
67 if(WITH_IMAGE_CINEON)
68         add_definitions(-DWITH_CINEON)
69 endif()
70
71 if(WITH_IMAGE_HDR)
72         add_definitions(-DWITH_HDR)
73 endif()
74
75 if(WITH_PYTHON)
76         blender_include_dirs(../blender/python)
77         add_definitions(-DWITH_PYTHON)
78 endif()
79
80 if(WITH_GAMEENGINE)
81         blender_include_dirs(
82                 ../kernel/gen_messaging
83                 ../kernel/gen_system
84         )
85
86         add_definitions(-DWITH_GAMEENGINE)
87 endif()
88
89 if(NOT WITH_SDL)
90         add_definitions(-DDISABLE_SDL)
91 endif()
92
93 if(WITH_BINRELOC)
94         add_definitions(-DWITH_BINRELOC)
95         blender_include_dirs(${BINRELOC_INC})
96 endif()
97
98 # Setup the exe sources and buildinfo
99 set(SRC
100         creator.c
101 )
102
103 if(WIN32 AND NOT UNIX)
104         list(APPEND SRC
105                 ../icons/winblender.rc
106         )
107 endif()
108
109 if(WITH_BUILDINFO)
110         # --------------------------------------------------------------------------
111         # These defines could all be moved into the header below
112         string(REPLACE " " "\ " BUILDINFO_CFLAGS "${CMAKE_C_FLAGS}")
113         string(REPLACE " " "\ " BUILDINFO_CXXFLAGS "${CMAKE_CXX_FLAGS}")
114         string(REPLACE " " "\ " BUILDINFO_LINKFLAGS "${PLATFORM_LINKFLAGS}")
115         add_definitions(
116                 # # define in header now, else these get out of date on rebuilds.
117                 # -DBUILD_DATE="${BUILD_DATE}"
118                 # -DBUILD_TIME="${BUILD_TIME}"
119                 # -DBUILD_REV="${BUILD_REV}"
120                 -DWITH_BUILDINFO_HEADER # alternative to lines above
121                 -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}"
122                 -DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
123                 -DBUILD_CFLAGS="${BUILDINFO_CFLAGS}"
124                 -DBUILD_CXXFLAGS="${BUILDINFO_CXXFLAGS}"
125                 -DBUILD_LINKFLAGS="${BUILDINFO_LINKFLAGS}"
126                 -DBUILD_SYSTEM="CMake"
127         )
128
129         # --------------------------------------------------------------------------
130         # write header for values that change each build
131         # note, generaed file is in build dir's source/creator
132         #       except when used as an include path.
133
134         # include the output directory, where the buildinfo.h file is generated
135         include_directories(${CMAKE_BINARY_DIR}/source/creator)
136
137         # a custom target that is always built
138         add_custom_target(buildinfo ALL
139                 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h)
140
141         # creates svnheader.h using cmake script
142         add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h
143                 COMMAND ${CMAKE_COMMAND}
144                 -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
145                 -P ${CMAKE_SOURCE_DIR}/build_files/cmake/buildinfo.cmake)
146
147         # buildinfo.h is a generated file
148         set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h
149                 PROPERTIES GENERATED TRUE
150                 HEADER_FILE_ONLY TRUE)
151
152         # add deps below, after adding blender
153         # -------------- done with header values.
154
155         list(APPEND SRC
156                 buildinfo.c
157         )
158 endif()
159
160 # message(STATUS "Configuring blender")
161 if(WITH_PYTHON_MODULE)
162         add_definitions(-DWITH_PYTHON_MODULE)
163
164         # creates ./bin/bpy.so which can be imported as a python module.
165         add_library(blender SHARED ${SRC})
166         set_target_properties(
167                 blender
168                 PROPERTIES
169                          PREFIX ""
170                          OUTPUT_NAME bpy
171                          LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/
172                          RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/  # only needed on windows
173         )
174         
175         if(WIN32)
176                 # python modules use this
177                 set_target_properties(
178                         blender
179                         PROPERTIES
180                                  SUFFIX ".pyd"
181                 )       
182         endif()
183         
184 else()
185         add_executable(blender ${EXETYPE} ${SRC})
186 endif()
187
188 if(WITH_BUILDINFO)
189         # explicitly say that the executable depends on the buildinfo
190         add_dependencies(blender buildinfo)
191 endif()
192
193 # Post build steps for bundling/packaging.
194
195
196 if(MSVC)
197         # ${CMAKE_CFG_INTDIR} should replace \${BUILD_TYPE} when using add_command
198         set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
199 elseif(APPLE)
200         set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
201 else()
202         set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH})
203 endif()
204
205 # install target
206 if(UNIX AND NOT APPLE)
207
208         if(WITH_INSTALL_PORTABLE)
209                 set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
210         else()
211                 set(TARGETDIR_VER ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
212         endif()
213
214         # important to make a clean  install each time
215         # else old scripts get loaded.
216         install(
217                 CODE
218                 "file(REMOVE_RECURSE ${TARGETDIR_VER})"
219         )
220
221         # message after building.
222         add_custom_command(
223                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
224                 COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}'
225         )
226
227         # there are a few differences between portable and system install
228         if(WITH_INSTALL_PORTABLE)
229                 install(
230                         FILES
231                         ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
232                         ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/blender.svg
233                         ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
234                         DESTINATION ${TARGETDIR}
235                 )
236
237                 install(
238                         PROGRAMS
239                         ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
240                         DESTINATION ${TARGETDIR}
241                 )
242
243                 install(
244                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
245                         DESTINATION ${TARGETDIR}
246                         PATTERN ".svn" EXCLUDE
247                 )
248
249         else()
250                 # main blender binary
251                 install(
252                         PROGRAMS ${TARGETDIR}/blender
253                         DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
254                 )
255
256                 if(WITH_GAMEENGINE AND WITH_PLAYER)
257                         install(
258                                 PROGRAMS ${TARGETDIR}/blenderplayer
259                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
260                         )
261                 endif()
262
263                 # misc files
264                 install(
265                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
266                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
267                 )
268                 install(
269                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/blender.svg
270                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps
271                 )
272                 install(
273                         PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
274                         DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
275                 )
276                 install(
277                         FILES ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
278                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
279                 )
280                 install(
281                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
282                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
283                         PATTERN ".svn" EXCLUDE
284                 )
285         endif()
286
287         install(
288                 FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
289                 DESTINATION ${TARGETDIR_VER}/config
290         )
291
292         if(WITH_INTERNATIONAL)
293                 install(
294                         FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
295                         DESTINATION ${TARGETDIR_VER}/config
296                 )
297
298                 install(
299                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
300                         DESTINATION ${TARGETDIR_VER}/datafiles/
301                         PATTERN ".svn" EXCLUDE
302                 )
303         endif()
304
305                 # plugins in blender 2.5 don't work at the moment.
306                 #
307                 # install(
308                 #       DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
309                 #       DESTINATION ${TARGETDIR_VER}/
310                 #       PATTERN ".svn" EXCLUDE
311                 # )
312
313         if(WITH_PYTHON)
314                 # install(CODE "message(\"copying blender scripts...\")")
315                 install(
316                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
317                         DESTINATION ${TARGETDIR_VER}/
318                         PATTERN ".svn" EXCLUDE
319                         PATTERN "__pycache__" EXCLUDE
320                 )
321
322                 if(WITH_PYTHON_INSTALL)
323                         # Copy the systems python into the install directory
324                         # Scons copy in tools/Blender.py
325                         # install(CODE "message(\"copying a subset of the systems python...\")")
326                         install(
327                                 DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}
328                                 DESTINATION ${TARGETDIR_VER}/python/lib/
329                                 PATTERN ".svn" EXCLUDE
330                                 PATTERN "__pycache__" EXCLUDE               # ./distutils
331                                 PATTERN "distutils" EXCLUDE                 # ./distutils
332                                 PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
333                                 PATTERN "config" EXCLUDE                    # ./config
334                                 PATTERN "config-*" EXCLUDE                  # ./config-*
335                                 PATTERN "site-packages/*" EXCLUDE           # ./site-packages/*
336                                 PATTERN "tkinter" EXCLUDE                   # ./tkinter
337                                 PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
338                                 PATTERN "test" EXCLUDE                      # ./test
339                                 PATTERN "turtledemo" EXCLUDE                # ./turtledemo
340                         )
341
342                         # # doesnt work, todo
343                         # install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
344                 endif()
345         endif()
346 elseif(WIN32)
347
348         set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
349
350         install(  # same as linux!, deduplicate
351                 CODE
352                 "file(REMOVE_RECURSE ${TARGETDIR_VER})"
353         )
354
355         install(  # same as linux!, deduplicate
356                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
357                 DESTINATION ${TARGETDIR}/
358                 PATTERN ".svn" EXCLUDE
359         )
360
361         install(  # same as linux!, deduplicate
362                 FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
363                 DESTINATION ${TARGETDIR_VER}/config
364         )
365
366         if(WITH_INTERNATIONAL) # same as linux!, deduplicate
367                 install(
368                         FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
369                         DESTINATION ${TARGETDIR_VER}/config
370                 )
371                 install(
372                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
373                         DESTINATION ${TARGETDIR_VER}/datafiles/
374                         PATTERN ".svn" EXCLUDE
375                 )
376
377                 if(NOT CMAKE_CL_64)
378                         install(
379                                 FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
380                                 DESTINATION ${TARGETDIR}/
381                         )
382
383                         install(
384                                 FILES ${LIBDIR}/iconv/lib/iconv.dll
385                                 DESTINATION ${TARGETDIR}/
386                         )
387                 endif()
388         endif()
389
390         install( # same as linux!, deduplicate
391                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
392                 DESTINATION ${TARGETDIR_VER}/datafiles/locale
393                 PATTERN ".svn" EXCLUDE
394         )
395
396         # plugins in blender 2.5 don't work at the moment.
397         #
398         # install(
399         #       DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
400         #       DESTINATION ${TARGETDIR_VER}/
401         #       PATTERN ".svn" EXCLUDE
402         # )
403
404         if(WITH_PYTHON)
405                 # install(CODE "message(\"copying blender scripts...\")")
406                 install(  # same as linux!, deduplicate
407                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
408                         DESTINATION ${TARGETDIR_VER}/
409                         PATTERN ".svn" EXCLUDE
410                         PATTERN "__pycache__" EXCLUDE
411                 )
412
413                 # TODO, multiple targets?
414                 install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS Release)
415                 install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS RelWithDebInfo)
416                 install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS MinSizeRel)
417
418                 install(
419                         FILES ${LIBDIR}/python/lib/python32_d.dll
420                         DESTINATION ${TARGETDIR}/
421                         CONFIGURATIONS Debug
422                 )
423
424                 if(WITH_PYTHON_INSTALL)
425                         #~ # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
426
427                         # create the directory in multiple steps, so it actually gets created when it doesn't exist yet
428                         install(CODE "
429                         message(\"creating ${TARGETDIR_VER}/python/lib\")
430                         file(MAKE_DIRECTORY ${TARGETDIR_VER}/python/)
431                         file(MAKE_DIRECTORY ${TARGETDIR_VER}/python/lib/)
432                         message(\"done creating dir\")
433                         ")
434
435                         install(
436                                 CODE
437                                 "
438                                 execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
439                                         \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
440                                 "
441                                 CONFIGURATIONS Release
442                         )
443                         install(
444                                 CODE
445                                 "
446                                 execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
447                                         \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
448                                 "
449                                 CONFIGURATIONS RelWithDebInfo
450                         )
451                         install(
452                                 CODE
453                                 "
454                                 execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
455                                         \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
456                                 "
457                                 CONFIGURATIONS MinSizeRel
458                         )
459                         install(
460                                 CODE
461                                 "
462                                 execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
463                                         \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32_d.tar.gz\")
464                                 "
465                                 CONFIGURATIONS Debug
466                         )
467
468                         # doesnt work, todo
469                         # install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
470                 endif()
471         endif()
472
473         if(CMAKE_CL_64)
474                 # gettext and png are statically linked on win64
475                 install(
476                         FILES ${LIBDIR}/zlib/lib/zlib.dll
477                         DESTINATION ${TARGETDIR}/
478                 )
479         else()
480                 install(
481                         FILES
482                         ${LIBDIR}/png/lib/libpng.dll
483                         ${LIBDIR}/zlib/lib/zlib.dll
484                         DESTINATION ${TARGETDIR}/
485                 )
486         endif()
487
488         if(MSVC)
489                 install(
490                         FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
491                         DESTINATION ${TARGETDIR}/
492                 )
493         else()
494                 install(
495                         FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
496                         DESTINATION ${TARGETDIR}/
497                 )
498         endif()
499
500         if(WITH_CODEC_FFMPEG)
501                 install(
502                         FILES
503                         ${LIBDIR}/ffmpeg/lib/avcodec-52.dll
504                         ${LIBDIR}/ffmpeg/lib/avformat-52.dll
505                         ${LIBDIR}/ffmpeg/lib/avdevice-52.dll
506                         ${LIBDIR}/ffmpeg/lib/avutil-50.dll
507                         ${LIBDIR}/ffmpeg/lib/swscale-0.dll
508                         DESTINATION ${TARGETDIR}/
509                 )
510
511         endif()
512
513         if(WITH_CODEC_SNDFILE)
514                 install(
515                         FILES
516                         ${LIBDIR}/sndfile/lib/libsndfile-1.dll
517                         DESTINATION ${TARGETDIR}/
518                 )
519         endif()
520
521         if(WITH_OPENAL)
522                 install(
523                         FILES
524                         ${LIBDIR}/openal/lib/OpenAL32.dll
525                         ${LIBDIR}/openal/lib/wrap_oal.dll
526                         DESTINATION ${TARGETDIR}/
527                 )
528         endif()
529
530         if(WITH_SDL)
531                 if(NOT CMAKE_CL_64)
532                         install(
533                                 FILES
534                                 ${LIBDIR}/sdl/lib/SDL.dll
535                                 DESTINATION ${TARGETDIR}/
536                         )
537                 endif()
538         endif()
539
540 elseif(APPLE)
541         set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
542         set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
543         set(TARGETDIR_VER ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION})
544
545         # setup Info.plist
546         execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
547
548         set_target_properties(blender PROPERTIES
549                 MACOSX_BUNDLE_INFO_PLIST ${SOURCEINFO}
550                 MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
551                 MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
552
553         # important to make a clean  install each time else old scripts get loaded.
554         install(
555                 CODE
556                 "file(REMOVE_RECURSE ${TARGETDIR_VER})"
557         )
558
559         # message after building.
560         add_custom_command(
561                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
562                 COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}'
563         )
564
565         # handy install macro to exclude files, we use \$ escape for the "to"
566         # argument when calling so ${BUILD_TYPE} does not get expanded
567         macro(install_dir from to)
568                 install(
569                         DIRECTORY ${from}
570                         DESTINATION ${to}
571                         PATTERN ".svn" EXCLUDE
572                         PATTERN "*.pyc" EXCLUDE
573                         PATTERN "*.pyo" EXCLUDE
574                         PATTERN "*.orig" EXCLUDE
575                         PATTERN "*.rej" EXCLUDE
576                         PATTERN "__pycache__" EXCLUDE
577                         PATTERN "__MACOSX" EXCLUDE
578                         PATTERN ".DS_Store" EXCLUDE
579                 )
580         endmacro()
581
582         # install release and app files
583         install_dir(
584                 ${CMAKE_SOURCE_DIR}/release/text/
585                 \${TARGETDIR}
586         )
587
588         install(
589                 FILES ${SOURCEDIR}/Contents/PkgInfo
590                 DESTINATION ${TARGETDIR}/blender.app/Contents/
591         )
592
593         install_dir(
594                 ${SOURCEDIR}/Contents/Resources
595                 \${TARGETDIR}/blender.app/Contents/
596         )
597
598         install(
599                 FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
600                 DESTINATION ${TARGETDIR_VER}/datafiles
601         )
602
603         # localization
604         if(WITH_INTERNATIONAL)
605                 install(
606                         FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
607                         DESTINATION ${TARGETDIR_VER}/datafiles
608                 )
609
610                 install_dir(
611                         ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
612                         \${TARGETDIR_VER}/datafiles/locale
613                 )
614         endif()
615
616         # python
617         if(WITH_PYTHON)
618                 # the python zip is first extract as part of the build process,
619                 # and then later installed as part of make install. this is much
620                 # quicker, and means we can easily exclude files on copy
621                 add_custom_target(
622                         extractpyzip
623                         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/python)
624
625                 set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
626                         
627                 add_custom_command(
628                         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
629                         COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/
630                         COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/
631                         COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/
632                         DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
633                 
634                 add_dependencies(blender extractpyzip)
635
636                 # copy extracted python files
637                 install_dir(
638                         ${CMAKE_CURRENT_BINARY_DIR}/python
639                         \${TARGETDIR_VER}
640                 )
641
642                 # copy scripts
643                 install_dir(
644                         ${CMAKE_SOURCE_DIR}/release/scripts
645                         \${TARGETDIR_VER}
646                 )
647         endif()
648 endif()
649
650 add_dependencies(blender makesdna)
651
652 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
653
654 set(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render)
655
656 if(WITH_MOD_FLUID)
657         list(APPEND BLENDER_LINK_LIBS bf_intern_elbeem)
658 endif()
659
660
661 #if(UNIX)
662         # Sort libraries
663         set(BLENDER_SORTED_LIBS
664                 bf_windowmanager
665
666                 bf_editor_space_api
667                 bf_editor_space_action
668                 bf_editor_space_buttons
669                 bf_editor_space_console
670                 bf_editor_space_file
671                 bf_editor_space_graph
672                 bf_editor_space_image
673                 bf_editor_space_info
674                 bf_editor_space_logic
675                 bf_editor_space_nla
676                 bf_editor_space_node
677                 bf_editor_space_outliner
678                 bf_editor_space_script
679                 bf_editor_space_sequencer
680                 bf_editor_space_sound
681                 bf_editor_space_time
682                 bf_editor_space_userpref
683                 bf_editor_space_view3d
684
685                 bf_editor_text
686                 bf_editor_transform
687                 bf_editor_util
688                 bf_editor_uvedit
689                 bf_editor_curve
690                 bf_editor_armature
691                 bf_editor_gpencil
692                 bf_editor_interface
693                 bf_editor_mesh
694                 bf_editor_metaball
695                 bf_editor_object
696                 bf_editor_physics
697                 bf_editor_render
698                 bf_editor_screen
699                 bf_editor_sculpt_paint
700                 bf_editor_sound
701                 bf_editor_animation
702                 bf_editor_datafiles
703
704                 bf_render
705                 bf_intern_opennl
706                 bf_python
707                 bf_python_ext
708                 bf_ikplugin
709                 bf_modifiers
710                 bf_blenkernel
711                 bf_nodes
712                 bf_gpu
713                 bf_blenloader
714                 bf_blenlib
715                 bf_intern_ghost
716                 bf_intern_string
717                 bf_blenpluginapi
718                 bf_imbuf
719                 bf_avi
720                 bf_imbuf_cineon
721                 bf_imbuf_openexr
722                 bf_imbuf_dds
723                 bf_readblenfile
724                 bf_collada
725                 bf_intern_bsp
726                 bf_intern_bop
727                 bf_gen_system
728                 bf_intern_decimate
729                 bf_intern_elbeem
730                 bf_intern_ik
731                 bf_intern_memutil
732                 bf_intern_guardedalloc
733                 bf_intern_ctr
734                 ge_blen_routines
735                 ge_converter
736                 ge_phys_dummy
737                 ge_phys_bullet
738                 bf_intern_smoke
739                 extern_minilzo
740                 extern_lzma
741                 ge_logic_ketsji
742                 ge_phys_common
743                 ge_logic
744                 ge_rasterizer
745                 ge_oglrasterizer
746                 ge_logic_expressions
747                 ge_scenegraph
748                 ge_logic_network
749                 bf_gen_system
750                 bf_python # duplicate for BPY_driver_exec
751                 ge_logic_ngnetwork
752                 extern_bullet
753                 ge_logic_loopbacknetwork
754                 bf_intern_moto
755                 extern_glew
756                 extern_openjpeg
757                 extern_redcode
758                 ge_videotex
759                 bf_rna
760                 bf_dna
761                 bf_blenfont
762                 bf_intern_audaspace
763                 bf_intern_mikktspace
764         )
765
766         if(WITH_BINRELOC)
767                 list(APPEND BLENDER_SORTED_LIBS extern_binreloc)
768         endif()
769
770         if(WITH_CXX_GUARDEDALLOC)
771                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
772         endif()
773
774         if(WITH_IK_ITASC)
775                 list(APPEND BLENDER_SORTED_LIBS bf_intern_itasc)
776         endif()
777
778         if(WITH_CODEC_QUICKTIME)
779                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
780         endif()
781
782         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
783                 set(REMLIB ${SORTLIB})
784                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
785                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
786                                 set(REMLIB "")
787                         endif()
788                 endforeach()
789                 if(REMLIB)
790                         # message(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
791                         list(APPEND REM_MSG ${REMLIB})
792                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
793                 endif()
794         endforeach()
795         if(REM_MSG)
796                 list(SORT REM_MSG)
797                 message(STATUS "Blender Skipping: (${REM_MSG})")
798         endif()
799         target_link_libraries(blender ${BLENDER_SORTED_LIBS})
800 #else()
801 #       target_link_libraries(blender ${BLENDER_LINK_LIBS})
802 #endif()
803
804 setup_liblinks(blender)