CMake: removed blenderplayer from install target by accident with recent commit.
[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         )
173 else()
174         add_executable(blender ${EXETYPE} ${SRC})
175 endif()
176
177 if(WITH_BUILDINFO)
178         # explicitly say that the executable depends on the buildinfo
179         add_dependencies(blender buildinfo)
180 endif()
181
182 # Post build steps for bundling/packaging.
183
184
185 if(MSVC)
186         # ${CMAKE_CFG_INTDIR} should replace \${BUILD_TYPE} when using add_command
187         set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
188 elseif(APPLE)
189         set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
190 else()
191         set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH})
192 endif()
193
194 if(WITH_INSTALL)
195
196         if(UNIX)
197                 add_custom_command(TARGET blender
198                         POST_BUILD
199                         MAIN_DEPENDENCY blender
200                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/
201                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/
202                 )
203         endif()
204
205         if(UNIX AND NOT APPLE)
206
207                 if(WITH_INSTALL_PORTABLE)
208                         set(TARGETDIR_VER ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/${BLENDER_VERSION})
209                 else()
210                         set(TARGETDIR_VER ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
211                 endif()
212
213                 # important to make a clean  install each time
214                 # else old scripts get loaded.
215                 install(
216                         CODE
217                         "file(REMOVE_RECURSE ${TARGETDIR_VER})"
218                 )
219
220                 # there are a few differences between portable and system install
221                 if(WITH_INSTALL_PORTABLE)
222                         install(
223                                 FILES
224                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
225                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/blender.svg
226                                 ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
227                                 DESTINATION ${TARGETDIR}
228                         )
229
230                         install(
231                                 PROGRAMS
232                                 ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
233                                 DESTINATION ${TARGETDIR}
234                         )
235
236                         install(
237                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
238                                 DESTINATION ${TARGETDIR}
239                                 PATTERN ".svn" EXCLUDE
240                         )
241
242                 else()
243                         # main blender binary
244                         install(
245                                 PROGRAMS ${TARGETDIR}/blender
246                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
247                         )
248
249                         if(WITH_GAMEENGINE AND WITH_PLAYER)
250                                 install(
251                                         PROGRAMS ${TARGETDIR}/blenderplayer
252                                         DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
253                                 )
254                         endif()
255
256                         # misc files
257                         install(
258                                 FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
259                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
260                         )
261                         install(
262                                 FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/blender.svg
263                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps
264                         )
265                         install(
266                                 PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
267                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
268                         )
269                         install(
270                                 FILES ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
271                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
272                         )
273                         install(
274                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
275                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
276                                 PATTERN ".svn" EXCLUDE
277                         )
278                 endif()
279
280                 install(
281                         FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
282                         DESTINATION ${TARGETDIR_VER}/config
283                 )
284
285                 if(WITH_INTERNATIONAL)
286                         install(
287                                 FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
288                                 DESTINATION ${TARGETDIR_VER}/config
289                         )
290
291                         install(
292                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
293                                 DESTINATION ${TARGETDIR_VER}/datafiles/
294                                 PATTERN ".svn" EXCLUDE
295                         )
296                 endif()
297
298                         install(
299                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
300                                 DESTINATION ${TARGETDIR_VER}/
301                                 PATTERN ".svn" EXCLUDE
302                         )
303
304                 if(WITH_PYTHON)
305                         # install(CODE "message(\"copying blender scripts...\")")
306                         install(
307                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
308                                 DESTINATION ${TARGETDIR_VER}/
309                                 PATTERN ".svn" EXCLUDE
310                                 PATTERN "__pycache__" EXCLUDE
311                         )
312
313                         if(WITH_PYTHON_INSTALL)
314                                 # Copy the systems python into the install directory
315                                 # Scons copy in tools/Blender.py
316                                 # install(CODE "message(\"copying a subset of the systems python...\")")
317                                 install(
318                                         DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}
319                                         DESTINATION ${TARGETDIR_VER}/python/lib/
320                                         PATTERN ".svn" EXCLUDE
321                                         PATTERN "__pycache__" EXCLUDE               # ./distutils
322                                         PATTERN "distutils" EXCLUDE                 # ./distutils
323                                         PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
324                                         PATTERN "config" EXCLUDE                    # ./config
325                                         PATTERN "config-*" EXCLUDE                  # ./config-*
326                                         PATTERN "site-packages/*" EXCLUDE           # ./site-packages/*
327                                         PATTERN "tkinter" EXCLUDE                   # ./tkinter
328                                         PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
329                                         PATTERN "test" EXCLUDE                      # ./test
330                                         PATTERN "turtledemo" EXCLUDE                # ./turtledemo
331                                 )
332
333                                 # # doesnt work, todo
334                                 # install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
335                         endif()
336                 endif()
337         elseif(WIN32)
338
339                 set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
340
341                 install(  # same as linux!, deduplicate
342                         CODE
343                         "file(REMOVE_RECURSE ${TARGETDIR_VER})"
344                 )
345
346                 install(  # same as linux!, deduplicate
347                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
348                         DESTINATION ${TARGETDIR_VER}/../
349                         PATTERN ".svn" EXCLUDE
350                 )
351
352                 install(  # same as linux!, deduplicate
353                         FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
354                         DESTINATION ${TARGETDIR_VER}/config
355                 )
356
357                 if(WITH_INTERNATIONAL) # same as linux!, deduplicate
358                         install(
359                                 FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
360                                 DESTINATION ${TARGETDIR_VER}/config
361                         )
362                         install(
363                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
364                                 DESTINATION ${TARGETDIR_VER}/datafiles/
365                                 PATTERN ".svn" EXCLUDE
366                         )
367
368                         install(
369                                 FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
370                                 DESTINATION ${TARGETDIR}/
371                         )
372
373                         if(NOT CMAKE_CL_64)
374                                 install(
375                                         FILES ${LIBDIR}/iconv/lib/iconv.dll
376                                         DESTINATION ${TARGETDIR}/
377                                 )
378                         endif()
379                 endif()
380
381                 install( # same as linux!, deduplicate
382                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
383                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION}/datafiles/locale
384                         PATTERN ".svn" EXCLUDE
385                 )
386
387                 install( # same as linux!, deduplicate
388                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
389                         DESTINATION ${TARGETDIR_VER}/../
390                         PATTERN ".svn" EXCLUDE
391                 )
392
393                 install(  # TODO, copy to linux
394                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
395                         DESTINATION ${TARGETDIR_VER}/
396                         PATTERN ".svn" EXCLUDE
397                 )
398
399                 if(WITH_PYTHON)
400                         # install(CODE "message(\"copying blender scripts...\")")
401                         install(  # same as linux!, deduplicate
402                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
403                                 DESTINATION ${TARGETDIR_VER}/
404                                 PATTERN ".svn" EXCLUDE
405                                 PATTERN "__pycache__" EXCLUDE
406                         )
407
408                         # TODO, multiple targets?
409                         install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS Release)
410                         install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS RelWithDebInfo)
411                         install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS MinSizeRel)
412
413                         install(
414                                 FILES ${LIBDIR}/python/lib/python32_d.dll
415                                 DESTINATION ${TARGETDIR}/
416                                 CONFIGURATIONS Debug
417                         )
418
419                         if(WITH_PYTHON_INSTALL)
420                                 #~ # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
421                                 # install(CODE "message(\"copying a subset of the systems python...\")")
422
423                                 install(
424                                         CODE
425                                         "execute_process(COMMAND ${CMAKE_COMMAND}
426                                         -E make_directory ${TARGETDIR_VER}/python/lib/)"
427                                 )
428
429                                 install(
430                                         CODE
431                                         "
432                                         if(BUILD_TYPE MATCHES \"Debug\")
433                                                 set(PYBUNDLE \"python32_d.tar.gz\")
434                                         else()
435                                                 set(PYBUNDLE \"python32.tar.gz\")
436                                         endif()
437
438                                         execute_process(COMMAND ${CMAKE_COMMAND}
439                                                 -E chdir ${TARGETDIR_VER}/python/lib/
440                                                 ${CMAKE_COMMAND} -E tar xzfv ${LIBDIR}/release/\${PYBUNDLE})
441                                         "
442                                 )
443
444                                 # doesnt work, todo
445                                 # install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
446                         endif()
447                 endif()
448
449                 if(CMAKE_CL_64)
450                         # gettext and png are statically linked on win64
451                         install(
452                                 FILES ${LIBDIR}/zlib/lib/zlib.dll
453                                 DESTINATION ${TARGETDIR}/
454                         )
455                 else()
456                         install(
457                                 FILES
458                                 ${LIBDIR}/png/lib/libpng.dll
459                                 ${LIBDIR}/zlib/lib/zlib.dll
460                                 DESTINATION ${TARGETDIR}/
461                         )
462                 endif()
463
464                 if(MSVC)
465                         install(
466                                 FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
467                                 DESTINATION ${TARGETDIR}/
468                         )
469                 else()
470                         install(
471                                 FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
472                                 DESTINATION ${TARGETDIR}/
473                         )
474                 endif()
475
476                 if(WITH_CODEC_FFMPEG)
477                         install(
478                                 FILES
479                                 ${LIBDIR}/ffmpeg/lib/avcodec-52.dll
480                                 ${LIBDIR}/ffmpeg/lib/avformat-52.dll
481                                 ${LIBDIR}/ffmpeg/lib/avdevice-52.dll
482                                 ${LIBDIR}/ffmpeg/lib/avutil-50.dll
483                                 ${LIBDIR}/ffmpeg/lib/swscale-0.dll
484                                 DESTINATION ${TARGETDIR}/
485                         )
486
487                 endif()
488
489                 if(WITH_CODEC_SNDFILE)
490                         install(
491                                 FILES
492                                 ${LIBDIR}/sndfile/lib/libsndfile-1.dll
493                                 DESTINATION ${TARGETDIR}/
494                         )
495                 endif()
496
497                 if(WITH_OPENAL)
498                         install(
499                                 FILES
500                                 ${LIBDIR}/openal/lib/OpenAL32.dll
501                                 ${LIBDIR}/openal/lib/wrap_oal.dll
502                                 DESTINATION ${TARGETDIR}/
503                         )
504                 endif()
505
506                 if(WITH_SDL)
507                         if(NOT CMAKE_CL_64)
508                                 install(
509                                         FILES
510                                         ${LIBDIR}/sdl/lib/SDL.dll
511                                         DESTINATION ${TARGETDIR}/
512                                 )
513                         endif()
514                 endif()
515
516         elseif(APPLE)
517                 set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
518                 set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
519                 set(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
520
521                 add_custom_command(
522                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
523                         COMMAND cp -Rf ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
524                         COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
525                         COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
526                         COMMAND cat ${SOURCEINFO} | sed s/VERSION/${BLENDER_VERSION}${BLENDER_VERSION_CHAR}/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
527                         COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
528                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
529                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
530                         COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
531                 )
532
533                 if(WITH_INTERNATIONAL)
534                         add_custom_command(
535                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
536                                 COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
537                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
538                         )
539                 endif()
540
541                 if(WITH_PYTHON)
542                         set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
543                         add_custom_command(
544                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
545                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/
546                                 COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
547                                 COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
548                                 COMMAND find ${TARGETDIR}/blender.app -name '*.py[co]' -prune -exec rm -rf {} '\;'
549                                 COMMAND find ${TARGETDIR}/blender.app -name '__pycache__' -exec rmdir {} '+'
550                         )
551                 endif()
552
553                 add_custom_command(
554                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
555                         COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
556                         COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
557                         COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
558                 )
559         endif()
560
561 endif()
562
563 add_dependencies(blender makesdna)
564
565 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
566
567 set(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render)
568
569 if(WITH_MOD_FLUID)
570         list(APPEND BLENDER_LINK_LIBS bf_intern_elbeem)
571 endif()
572
573
574 #if(UNIX)
575         # Sort libraries
576         set(BLENDER_SORTED_LIBS
577                 bf_windowmanager
578
579                 bf_editor_space_api
580                 bf_editor_space_action
581                 bf_editor_space_buttons
582                 bf_editor_space_console
583                 bf_editor_space_file
584                 bf_editor_space_graph
585                 bf_editor_space_image
586                 bf_editor_space_info
587                 bf_editor_space_logic
588                 bf_editor_space_nla
589                 bf_editor_space_node
590                 bf_editor_space_outliner
591                 bf_editor_space_script
592                 bf_editor_space_sequencer
593                 bf_editor_space_sound
594                 bf_editor_space_time
595                 bf_editor_space_userpref
596                 bf_editor_space_view3d
597
598                 bf_editor_text
599                 bf_editor_transform
600                 bf_editor_util
601                 bf_editor_uvedit
602                 bf_editor_curve
603                 bf_editor_armature
604                 bf_editor_gpencil
605                 bf_editor_interface
606                 bf_editor_mesh
607                 bf_editor_metaball
608                 bf_editor_object
609                 bf_editor_physics
610                 bf_editor_render
611                 bf_editor_screen
612                 bf_editor_sculpt_paint
613                 bf_editor_sound
614                 bf_editor_animation
615                 bf_editor_datafiles
616
617                 bf_render
618                 bf_intern_opennl
619                 bf_python
620                 bf_python_ext
621                 bf_ikplugin
622                 bf_modifiers
623                 bf_blenkernel
624                 bf_nodes
625                 bf_gpu
626                 bf_blenloader
627                 bf_blenlib
628                 bf_intern_ghost
629                 bf_intern_string
630                 bf_blenpluginapi
631                 bf_imbuf
632                 bf_avi
633                 bf_imbuf_cineon
634                 bf_imbuf_openexr
635                 bf_imbuf_dds
636                 bf_readblenfile
637                 bf_collada
638                 bf_intern_bsp
639                 bf_intern_bop
640                 bf_gen_system
641                 bf_intern_decimate
642                 bf_intern_elbeem
643                 bf_intern_ik
644                 bf_intern_memutil
645                 bf_intern_guardedalloc
646                 bf_intern_ctr
647                 ge_blen_routines
648                 ge_converter
649                 ge_phys_dummy
650                 ge_phys_bullet
651                 bf_intern_smoke
652                 extern_minilzo
653                 extern_lzma
654                 ge_logic_ketsji
655                 ge_phys_common
656                 ge_logic
657                 ge_rasterizer
658                 ge_oglrasterizer
659                 ge_logic_expressions
660                 ge_scenegraph
661                 ge_logic_network
662                 bf_gen_system
663                 bf_python # duplicate for BPY_driver_exec
664                 ge_logic_ngnetwork
665                 extern_bullet
666                 ge_logic_loopbacknetwork
667                 bf_intern_moto
668                 extern_glew
669                 extern_openjpeg
670                 extern_redcode
671                 ge_videotex
672                 bf_rna
673                 bf_dna
674                 bf_blenfont
675                 bf_intern_audaspace
676                 bf_intern_mikktspace
677         )
678
679         if(WITH_BINRELOC)
680                 list(APPEND BLENDER_SORTED_LIBS extern_binreloc)
681         endif()
682
683         if(WITH_CXX_GUARDEDALLOC)
684                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
685         endif()
686
687         if(WITH_IK_ITASC)
688                 list(APPEND BLENDER_SORTED_LIBS bf_intern_itasc)
689         endif()
690
691         if(WITH_CODEC_QUICKTIME)
692                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
693         endif()
694
695         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
696                 set(REMLIB ${SORTLIB})
697                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
698                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
699                                 set(REMLIB "")
700                         endif()
701                 endforeach()
702                 if(REMLIB)
703                         # message(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
704                         list(APPEND REM_MSG ${REMLIB})
705                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
706                 endif()
707         endforeach()
708         if(REM_MSG)
709                 list(SORT REM_MSG)
710                 message(STATUS "Blender Skipping: (${REM_MSG})")
711         endif()
712         target_link_libraries(blender ${BLENDER_SORTED_LIBS})
713 #else()
714 #       target_link_libraries(blender ${BLENDER_LINK_LIBS})
715 #endif()
716
717 setup_liblinks(blender)