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