Merged changes in the trunk up to revision 31190.
[blender.git] / source / creator / CMakeLists.txt
1 # $Id$
2 # ***** BEGIN GPL LICENSE BLOCK *****
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18 # The Original Code is Copyright (C) 2006, Blender Foundation
19 # All rights reserved.
20 #
21 # The Original Code is: all of this file.
22 #
23 # Contributor(s): Jacques Beaurain.
24 #
25 # ***** END GPL LICENSE BLOCK *****
26
27 # So BUILDINFO and BLENDERPATH strings are automatically quoted
28 CMAKE_POLICY(SET CMP0005 NEW)
29
30 SETUP_LIBDIRS()
31
32 INCLUDE_DIRECTORIES(
33         ../../intern/guardedalloc
34         ../blender/blenlib
35         ../blender/blenkernel
36         ../blender/editors/include
37         ../blender/makesrna
38         ../blender/imbuf
39         ../blender/render/extern/include
40         ../blender/makesdna
41         ../blender/gpu
42         ../blender/freestyle
43         ../blender/windowmanager
44         ../kernel/gen_messaging
45         ../kernel/gen_system
46 )
47
48 IF(WIN32)
49         INCLUDE_DIRECTORIES(${PTHREADS_INC})
50 ENDIF(WIN32)
51
52 IF(WITH_QUICKTIME)
53         ADD_DEFINITIONS(-DWITH_QUICKTIME)
54 ENDIF(WITH_QUICKTIME)
55
56 IF(WITH_IMAGE_OPENEXR)
57         ADD_DEFINITIONS(-DWITH_OPENEXR)
58 ENDIF(WITH_IMAGE_OPENEXR)
59
60 IF(WITH_IMAGE_TIFF)
61         ADD_DEFINITIONS(-DWITH_TIFF)
62 ENDIF(WITH_IMAGE_TIFF)
63
64 IF(WITH_IMAGE_DDS)
65         ADD_DEFINITIONS(-DWITH_DDS)
66 ENDIF(WITH_IMAGE_DDS)
67
68 IF(WITH_IMAGE_CINEON)
69         ADD_DEFINITIONS(-DWITH_CINEON)
70 ENDIF(WITH_IMAGE_CINEON)
71
72 IF(WITH_IMAGE_HDR)
73         ADD_DEFINITIONS(-DWITH_HDR)
74 ENDIF(WITH_IMAGE_HDR)
75
76 IF(WITH_PYTHON)
77         INCLUDE_DIRECTORIES(../blender/python)
78 ELSE(WITH_PYTHON)
79         ADD_DEFINITIONS(-DDISABLE_PYTHON)
80 ENDIF(WITH_PYTHON)
81
82 IF(NOT WITH_SDL)
83         ADD_DEFINITIONS(-DDISABLE_SDL)
84 ENDIF(NOT WITH_SDL)
85
86 IF(UNIX AND NOT APPLE)
87         SET(BLENDERPATH ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
88         # blender_path in creator.c
89         ADD_DEFINITIONS(-DBLENDERPATH="${BLENDERPATH}")
90 ENDIF(UNIX AND NOT APPLE)
91
92 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
93         ADD_DEFINITIONS(-DWITH_BINRELOC)
94         INCLUDE_DIRECTORIES(${BINRELOC_INC})
95 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
96
97 # Setup the exe sources and buildinfo
98 SET(EXESRC creator.c)
99
100 IF(WIN32)
101         SET(EXESRC ${EXESRC} ../icons/winblender.rc)
102 ENDIF(WIN32)
103
104 IF(WITH_BUILDINFO)
105         ADD_DEFINITIONS(-DBUILD_DATE="${BUILD_DATE}")
106         ADD_DEFINITIONS(-DBUILD_TIME="${BUILD_TIME}")
107         ADD_DEFINITIONS(-DBUILD_REV="${BUILD_REV}")
108         ADD_DEFINITIONS(-DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}")
109         ADD_DEFINITIONS(-DBUILD_TYPE="${CMAKE_BUILD_TYPE}")
110         
111         SET(EXESRC ${EXESRC} buildinfo.c)
112 ENDIF(WITH_BUILDINFO)
113
114 MESSAGE(STATUS "Configuring blender")
115
116 ADD_EXECUTABLE(blender ${EXETYPE} ${EXESRC})
117
118 # Post build steps for bundling/packaging.
119
120 SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
121
122 IF(WITH_INSTALL)
123
124         IF(UNIX)
125                 ADD_CUSTOM_COMMAND(TARGET blender
126                         POST_BUILD
127                         MAIN_DEPENDENCY blender
128                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/
129                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/
130                 )
131         ENDIF(UNIX)
132
133         IF(UNIX AND NOT APPLE)
134                 
135                 # Local installation, "make install" can be done after this optionally
136                 
137                 ADD_CUSTOM_COMMAND(
138                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
139                         COMMAND rm -Rf ${TARGETDIR}/${BLENDER_VERSION}
140                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/
141                         COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/${BLENDER_VERSION}/
142                 )
143     
144                 IF(WITH_INTERNATIONAL)
145                         ADD_CUSTOM_COMMAND(
146                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
147                                 COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/${BLENDER_VERSION}/
148                                 COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/${BLENDER_VERSION}/
149                         )
150                 ENDIF(WITH_INTERNATIONAL)
151     
152                 IF(WITH_PYTHON)
153                         ADD_CUSTOM_COMMAND(
154                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
155                                 COMMENT "copying blender scripts..."
156                                 COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/${BLENDER_VERSION}/
157                                 COMMAND find ${TARGETDIR} -name "*.py?" -prune -exec rm -rf {} "\;"
158                         )
159                         IF(WITH_PYTHON_INSTALL)
160                                 # Copy the systems python into the install directory
161                                 # Scons copy in tools/Blender.py
162                                 ADD_CUSTOM_COMMAND(
163                                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
164                                         COMMENT "copying a subset of the systems python..."
165
166                                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python # PYTHONPATH and PYTHONHOME is set here
167                                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python/lib/
168                                         COMMAND cp -R ${PYTHON_LIBPATH}/python${PYTHON_VERSION} ${TARGETDIR}/${BLENDER_VERSION}/python/lib/
169
170                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/distutils
171                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/lib2to3
172                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/idlelib
173                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/tkinter
174                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/config
175
176                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/site-packages
177                                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/site-packages    # python needs it.
178
179                                         COMMAND rm -f ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/lib-dynload/_tkinter.so
180                                         COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "test" -prune -exec rm -rf {} "\;"
181                                         COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.py?" -exec rm -rf {} "\;"
182                                         COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.so"-exec strip -s {} "\;"
183                                 )
184                         ENDIF(WITH_PYTHON_INSTALL)
185                 ENDIF(WITH_PYTHON)
186       
187                 ADD_CUSTOM_COMMAND(
188                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
189                         COMMAND find ${TARGETDIR} -name .svn -prune -exec rm -rf {} "\;"
190                 )
191     
192     
193                 # Above we bundle a portable distribution in ./bin
194                 # This is an optional "make install" which installs blender on the system.
195                 INSTALL(
196                         PROGRAMS ${TARGETDIR}/blender
197                         DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
198                 )
199
200                 IF(WITH_GAMEENGINE AND WITH_PLAYER)
201                         INSTALL(
202                                 PROGRAMS ${TARGETDIR}/blenderplayer
203                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
204                         )
205                 ENDIF(WITH_GAMEENGINE AND WITH_PLAYER)
206
207                 INSTALL(
208             FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
209             DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
210         )
211                 INSTALL(
212             FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/blender.svg
213             DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps
214         )
215                 INSTALL(
216                         PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
217                         DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
218                 )
219                 INSTALL(
220             FILES ${CMAKE_SOURCE_DIR}/doc/blender.1
221             DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
222         )
223                 INSTALL(
224             DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
225             DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
226             PATTERN ".svn" EXCLUDE
227         )
228                 INSTALL(
229             DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts/
230             DESTINATION ${BLENDERPATH}/scripts
231             PATTERN ".svn" EXCLUDE
232                         PATTERN "*.pyc" EXCLUDE
233         )
234                 INSTALL(
235                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/datafiles/brushicons/
236                         DESTINATION ${BLENDERPATH}/datafiles/brushicons
237                         PATTERN ".svn" EXCLUDE
238                 )
239                 IF(WITH_INTERNATIONAL)
240                         INSTALL(
241                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
242                 DESTINATION ${BLENDERPATH}/datafiles/locale
243                 PATTERN ".svn" EXCLUDE
244                 )
245                 ENDIF(WITH_INTERNATIONAL)
246         
247                 # end "make install"
248     
249         ENDIF(UNIX AND NOT APPLE)
250
251         IF(APPLE)
252                 SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
253                 SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
254                 SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
255
256                 ADD_CUSTOM_COMMAND(
257                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
258                         COMMAND cp -Rf ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
259                         COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
260                         COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
261                         COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
262                         COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles
263                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
264                         COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
265                 )
266       
267                 IF(WITH_INTERNATIONAL)
268                         ADD_CUSTOM_COMMAND(
269                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
270                                 COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
271                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
272                         )
273                 ENDIF(WITH_INTERNATIONAL)
274       
275                 IF(WITH_PYTHON)
276                         SET(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
277                         ADD_CUSTOM_COMMAND(
278                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
279                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/
280                                 COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/python/
281                                 COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/python/
282                                 COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/python/
283                                 COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;"
284                         )
285                 ENDIF(WITH_PYTHON)      
286     
287                 ADD_CUSTOM_COMMAND(
288                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender    
289                         COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
290                         COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
291                         COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
292                 )
293         ENDIF(APPLE)
294
295         IF(WIN32)
296                 ADD_CUSTOM_COMMAND(TARGET blender
297                         POST_BUILD
298                         MAIN_DEPENDENCY blender
299                         COMMAND if not exist \"${TARGETDIR}\\.blender\" mkdir \"${TARGETDIR}\\.blender\"
300                         COMMAND if not exist \"${TARGETDIR}\\.blender\\locale\" mkdir \"${TARGETDIR}\\.blender\\locale\"
301                         COMMAND if not exist \"${TARGETDIR}\\.blender\\scripts\" mkdir \"${TARGETDIR}\\.blender\\scripts\"
302                         COMMAND if not exist \"${TARGETDIR}\\plugins\" mkdir \"${TARGETDIR}\\plugins\"
303                         COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\.blender\\\" 
304                         COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\.blender\\\"
305                         COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\.blender\\locale\"
306                         COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\.blender\\scripts\"
307                         COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\plugins\"
308                         COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\"
309                         # TODO, copy python bundle
310                         # COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\windows\\extra\\python31.zip\" \"${TARGETDIR}\\\"
311                 )
312     
313                 ADD_CUSTOM_COMMAND(TARGET blender
314                         POST_BUILD
315                         MAIN_DEPENDENCY blender
316                         COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
317                         COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\python31_d.zip\"
318                         COMMAND copy /Y \"${LIBDIR}\\gettext\\lib\\gnu_gettext.dll\" \"${TARGETDIR}\\\"
319                         COMMAND copy /Y \"${LIBDIR}\\png\\lib\\libpng.dll\" \"${TARGETDIR}\\\"
320                         COMMAND copy /Y \"${LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\"
321                         COMMAND copy /Y \"${LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\"
322                         COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
323                         COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
324                         COMMAND copy /Y \"${LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\"
325                         # COMMAND copy /Y \"${LIBDIR}\\samplerate\\lib\\libsamplerate-0.dll\" \"${TARGETDIR}\\\"
326                 )
327
328                 IF(WITH_INTERNATIONAL)
329                         ADD_CUSTOM_COMMAND(TARGET blender
330                                 POST_BUILD
331                                 MAIN_DEPENDENCY blender
332                                 COMMAND copy /Y \"${LIBDIR}\\iconv\\lib\\iconv.dll\" \"${TARGETDIR}\\\"
333                         )
334                 ENDIF(WITH_INTERNATIONAL)
335
336                 IF(WITH_FFMPEG)
337                         ADD_CUSTOM_COMMAND(TARGET blender
338                                 POST_BUILD
339                                 MAIN_DEPENDENCY blender
340                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\avcodec-52.dll\" \"${TARGETDIR}\\\"
341                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\avformat-52.dll\" \"${TARGETDIR}\\\"
342                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\avdevice-52.dll\" \"${TARGETDIR}\\\"
343                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\avutil-50.dll\" \"${TARGETDIR}\\\"
344                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\libfaac-0.dll\" \"${TARGETDIR}\\\"
345                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\libfaad-2.dll\" \"${TARGETDIR}\\\"
346                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\libmp3lame-0.dll\" \"${TARGETDIR}\\\"
347                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\libx264-67.dll\" \"${TARGETDIR}\\\"
348                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\swscale-0.dll\" \"${TARGETDIR}\\\"
349                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\xvidcore.dll\" \"${TARGETDIR}\\\"
350                         )
351                 ENDIF(WITH_FFMPEG)
352
353                 IF(WITH_SNDFILE)
354                         ADD_CUSTOM_COMMAND(TARGET blender
355                                 POST_BUILD
356                                 MAIN_DEPENDENCY blender
357                                 COMMAND copy /Y \"${LIBDIR}\\sndfile\\lib\\libsndfile-1.dll\" \"${TARGETDIR}\\\"
358                         )
359                 ENDIF(WITH_SNDFILE)
360
361                 IF(WITH_JACK)
362                         ADD_CUSTOM_COMMAND(TARGET blender
363                                 POST_BUILD
364                                 MAIN_DEPENDENCY blender
365                                 COMMAND copy /Y \"${LIBDIR}\\jack\\lib\\libjack.dll\" \"${TARGETDIR}\\\"
366                         )
367                 ENDIF(WITH_JACK)
368
369                 IF(WITH_OPENAL)
370                         ADD_CUSTOM_COMMAND(TARGET blender
371                                 POST_BUILD
372                                 MAIN_DEPENDENCY blender
373                                 COMMAND copy /Y \"${LIBDIR}\\openal\\lib\\OpenAL32.dll\" \"${TARGETDIR}\\\"
374                                 COMMAND copy /Y \"${LIBDIR}\\openal\\lib\\wrap_oal.dll\" \"${TARGETDIR}\\\"
375
376                         )
377                 ENDIF(WITH_OPENAL)
378
379
380         ENDIF(WIN32)
381 ENDIF(WITH_INSTALL)
382
383 ADD_DEPENDENCIES(blender makesdna)
384
385 FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
386
387 SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager blender_render)
388
389 IF(WITH_FLUID)
390         SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} bf_elbeem)
391 ENDIF(WITH_FLUID)
392
393 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
394         SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc)
395 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
396
397 #IF(UNIX)
398         # Sort libraries
399         SET(BLENDER_SORTED_LIBS
400                 bf_windowmanager
401
402         bf_editor_space_api
403         bf_editor_space_action
404         bf_editor_space_buttons
405         bf_editor_space_console
406         bf_editor_space_file
407         bf_editor_space_graph
408         bf_editor_space_image
409         bf_editor_space_info
410         bf_editor_space_logic
411         bf_editor_space_nla
412         bf_editor_space_node
413         bf_editor_space_outliner
414         bf_editor_space_script
415         bf_editor_space_sequencer
416         bf_editor_space_sound
417         bf_editor_space_time
418         bf_editor_space_userpref
419         bf_editor_space_view3d
420
421         bf_editor_text
422         bf_editor_transform
423         bf_editor_util
424         bf_editor_uvedit
425         bf_editor_curve
426         bf_editor_armature
427         bf_editor_gpencil
428         bf_editor_interface
429         bf_editor_mesh
430         bf_editor_metaball
431         bf_editor_object
432         bf_editor_physics
433         bf_editor_render
434         bf_editor_screen
435         bf_editor_sculpt_paint
436         bf_editor_sound
437         bf_editor_animation
438         bf_editor_datafiles
439
440                 bf_freestyle
441                 blender_BSP 
442                 blender_render 
443                 blender_ONL 
444                 bf_python 
445                 bf_gen_python 
446                 bf_ikplugin
447                 bf_modifiers
448                 bf_blenkernel
449                 bf_nodes
450                 bf_gpu
451                 bf_blenloader
452                 bf_blenlib
453                 bf_ghost
454                 bf_string
455                 bf_blenpluginapi 
456                 bf_imbuf 
457                 bf_avi 
458                 bf_cineon 
459                 bf_openexr 
460                 bf_dds
461                 bf_readblenfile
462                 bf_collada
463                 blender_BSP 
464                 blender_bop 
465                 bf_kernel 
466                 bf_decimation 
467                 bf_elbeem 
468                 bf_IK 
469                 bf_memutil 
470                 bf_guardedalloc 
471                 blender_CTR 
472                 bf_moto 
473                 bf_windowmanager
474                 bf_blroutines 
475                 bf_converter 
476                 bf_dummy 
477                 bf_bullet 
478                 bf_smoke
479                 bf_minilzo
480                 bf_lzma
481                 bf_common 
482                 bf_ketsji 
483                 bf_logic 
484                 bf_rasterizer 
485                 bf_oglrasterizer 
486                 bf_expressions 
487                 bf_scenegraph 
488                 bf_moto 
489                 bf_blroutines 
490                 kx_network 
491                 bf_kernel 
492                 bf_ngnetwork 
493                 extern_bullet 
494                 bf_loopbacknetwork 
495                 bf_ITASC
496                 bf_common 
497                 bf_moto 
498                 bf_python
499                 bf_gen_python
500                 extern_binreloc
501                 extern_glew
502                 extern_libopenjpeg
503                 bf_videotex
504                 bf_rna
505                 bf_dna
506                 bf_blenfont
507                 bf_audaspace
508                 bf_decimation
509
510         )
511
512         IF(WITH_CXX_GUARDEDALLOC)
513                 SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_guardedalloc_cpp)
514         ENDIF(WITH_CXX_GUARDEDALLOC)
515
516         IF(WITH_QUICKTIME)
517                 SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_quicktime)
518         ENDIF(WITH_QUICKTIME)
519
520
521         FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
522                 SET(REMLIB ${SORTLIB})
523                 FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS})
524                         IF(${SEARCHLIB} STREQUAL ${SORTLIB})
525                                 SET(REMLIB "")
526                         ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
527                 ENDFOREACH(SEARCHLIB)
528                 IF(REMLIB)
529                         MESSAGE(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
530                         LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
531                 ENDIF(REMLIB)
532         ENDFOREACH(SORTLIB)
533         TARGET_LINK_LIBRARIES(blender ${BLENDER_SORTED_LIBS})
534 #ELSE(UNIX)
535 #       TARGET_LINK_LIBRARIES(blender ${BLENDER_LINK_LIBS})
536 #ENDIF(UNIX)
537
538 SETUP_LIBLINKS(blender)