ea6507bfc7b19faadb47c7371c52dcd01fdcd20f
[blender-staging.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/windowmanager
43         ../kernel/gen_messaging
44         ../kernel/gen_system
45 )
46
47 IF(WIN32)
48         INCLUDE_DIRECTORIES(${PTHREADS_INC})
49 ENDIF(WIN32)
50
51 IF(WITH_QUICKTIME)
52         ADD_DEFINITIONS(-DWITH_QUICKTIME)
53 ENDIF(WITH_QUICKTIME)
54
55 IF(WITH_IMAGE_OPENEXR)
56         ADD_DEFINITIONS(-DWITH_OPENEXR)
57 ENDIF(WITH_IMAGE_OPENEXR)
58
59 IF(WITH_IMAGE_TIFF)
60         ADD_DEFINITIONS(-DWITH_TIFF)
61 ENDIF(WITH_IMAGE_TIFF)
62
63 IF(WITH_IMAGE_DDS)
64         ADD_DEFINITIONS(-DWITH_DDS)
65 ENDIF(WITH_IMAGE_DDS)
66
67 IF(WITH_IMAGE_CINEON)
68         ADD_DEFINITIONS(-DWITH_CINEON)
69 ENDIF(WITH_IMAGE_CINEON)
70
71 IF(WITH_IMAGE_HDR)
72         ADD_DEFINITIONS(-DWITH_HDR)
73 ENDIF(WITH_IMAGE_HDR)
74
75 IF(WITH_PYTHON)
76         INCLUDE_DIRECTORIES(../blender/python)
77 ELSE(WITH_PYTHON)
78         ADD_DEFINITIONS(-DDISABLE_PYTHON)
79 ENDIF(WITH_PYTHON)
80
81 IF(NOT WITH_SDL)
82         ADD_DEFINITIONS(-DDISABLE_SDL)
83 ENDIF(NOT WITH_SDL)
84
85 IF(UNIX AND NOT APPLE)
86         SET(BLENDERPATH ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
87         # blender_path in creator.c
88         ADD_DEFINITIONS(-DBLENDERPATH="${BLENDERPATH}")
89 ENDIF(UNIX AND NOT APPLE)
90
91 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
92         ADD_DEFINITIONS(-DWITH_BINRELOC)
93         INCLUDE_DIRECTORIES(${BINRELOC_INC})
94 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
95
96 # Setup the exe sources and buildinfo
97 SET(EXESRC creator.c)
98
99 IF(WIN32)
100         SET(EXESRC ${EXESRC} ../icons/winblender.rc)
101 ENDIF(WIN32)
102
103 IF(WITH_BUILDINFO)
104         ADD_DEFINITIONS(-DBUILD_DATE="${BUILD_DATE}")
105         ADD_DEFINITIONS(-DBUILD_TIME="${BUILD_TIME}")
106         ADD_DEFINITIONS(-DBUILD_REV="${BUILD_REV}")
107         ADD_DEFINITIONS(-DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}")
108         ADD_DEFINITIONS(-DBUILD_TYPE="${CMAKE_BUILD_TYPE}")
109         
110         SET(EXESRC ${EXESRC} buildinfo.c)
111 ENDIF(WITH_BUILDINFO)
112
113 MESSAGE(STATUS "Configuring blender")
114
115 ADD_EXECUTABLE(blender ${EXETYPE} ${EXESRC})
116
117 # Post build steps for bundling/packaging.
118
119 SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
120
121 IF(WITH_INSTALL)
122
123         IF(UNIX)
124                 ADD_CUSTOM_COMMAND(TARGET blender
125                         POST_BUILD
126                         MAIN_DEPENDENCY blender
127                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/
128                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/
129                 )
130         ENDIF(UNIX)
131
132         IF(UNIX AND NOT APPLE)
133                 
134                 # Local installation, "make install" can be done after this optionally
135                 
136                 ADD_CUSTOM_COMMAND(
137                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
138                         COMMAND rm -Rf ${TARGETDIR}/${BLENDER_VERSION}
139                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/
140                         COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/${BLENDER_VERSION}/
141                 )
142         
143                 IF(WITH_INTERNATIONAL)
144                         ADD_CUSTOM_COMMAND(
145                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
146                                 COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/${BLENDER_VERSION}/
147                                 COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/${BLENDER_VERSION}/
148                         )
149                 ENDIF(WITH_INTERNATIONAL)
150         
151                 IF(WITH_PYTHON)
152                         ADD_CUSTOM_COMMAND(
153                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
154                                 COMMENT "copying blender scripts..."
155                                 COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/${BLENDER_VERSION}/
156                                 COMMAND find ${TARGETDIR} -name "*.py?" -prune -exec rm -rf {} "\;"
157                         )
158                         IF(WITH_PYTHON_INSTALL)
159                                 # Copy the systems python into the install directory
160                                 # Scons copy in tools/Blender.py
161                                 ADD_CUSTOM_COMMAND(
162                                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
163                                         COMMENT "copying a subset of the systems python..."
164
165                                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python # PYTHONPATH and PYTHONHOME is set here
166                                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python/lib/
167                                         COMMAND cp -R ${PYTHON_LIBPATH}/python${PYTHON_VERSION} ${TARGETDIR}/${BLENDER_VERSION}/python/lib/
168
169                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/distutils
170                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/lib2to3
171                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/idlelib
172                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/tkinter
173                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/config
174
175                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/site-packages
176                                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/site-packages  # python needs it.
177
178                                         COMMAND rm -f ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/lib-dynload/_tkinter.so
179                                         COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "test" -prune -exec rm -rf {} "\;"
180                                         COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.py?" -exec rm -rf {} "\;"
181                                         COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.so"-exec strip -s {} "\;"
182                                 )
183                         ENDIF(WITH_PYTHON_INSTALL)
184                 ENDIF(WITH_PYTHON)
185           
186                 ADD_CUSTOM_COMMAND(
187                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
188                         COMMAND find ${TARGETDIR} -name .svn -prune -exec rm -rf {} "\;"
189                 )
190         
191         
192                 # Above we bundle a portable distribution in ./bin
193                 # This is an optional "make install" which installs blender on the system.
194                 INSTALL(
195                         PROGRAMS ${TARGETDIR}/blender
196                         DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
197                 )
198
199                 IF(WITH_GAMEENGINE AND WITH_PLAYER)
200                         INSTALL(
201                                 PROGRAMS ${TARGETDIR}/blenderplayer
202                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
203                         )
204                 ENDIF(WITH_GAMEENGINE AND WITH_PLAYER)
205
206                 INSTALL(
207                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
208                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
209                 )
210                 INSTALL(
211                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/blender.svg
212                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps
213                 )
214                 INSTALL(
215                         PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
216                         DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
217                 )
218                 INSTALL(
219                         FILES ${CMAKE_SOURCE_DIR}/doc/blender.1
220                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
221                 )
222                 INSTALL(
223                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
224                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
225                         PATTERN ".svn" EXCLUDE
226                 )
227                 INSTALL(
228                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts/
229                         DESTINATION ${BLENDERPATH}/scripts
230                         PATTERN ".svn" EXCLUDE
231                         PATTERN "*.pyc" EXCLUDE
232                 )
233                 INSTALL(
234                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/datafiles/brushicons/
235                         DESTINATION ${BLENDERPATH}/datafiles/brushicons
236                         PATTERN ".svn" EXCLUDE
237                 )
238                 IF(WITH_INTERNATIONAL)
239                         INSTALL(
240                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
241                                 DESTINATION ${BLENDERPATH}/datafiles/locale
242                                 PATTERN ".svn" EXCLUDE
243                         )
244                 ENDIF(WITH_INTERNATIONAL)
245                 
246                 # end "make install"
247         
248         ENDIF(UNIX AND NOT APPLE)
249
250         IF(APPLE)
251                 SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
252                 SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
253                 SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
254
255                 ADD_CUSTOM_COMMAND(
256                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
257                         COMMAND cp -Rf ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
258                         COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
259                         COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
260                         COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
261                         COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles
262                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
263                         COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
264                 )
265           
266                 IF(WITH_INTERNATIONAL)
267                         ADD_CUSTOM_COMMAND(
268                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
269                                 COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
270                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/datafiles/
271                         )
272                 ENDIF(WITH_INTERNATIONAL)
273           
274                 IF(WITH_PYTHON)
275                         SET(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
276                         ADD_CUSTOM_COMMAND(
277                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
278                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/
279                                 COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/python/
280                                 COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/python/
281                                 COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/python/
282                                 COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;"
283                         )
284                 ENDIF(WITH_PYTHON)        
285         
286                 ADD_CUSTOM_COMMAND(
287                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender       
288                         COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
289                         COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
290                                         COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
291                 )
292         ENDIF(APPLE)
293
294         IF(WIN32)
295                 ADD_CUSTOM_COMMAND(TARGET blender
296                         POST_BUILD
297                         MAIN_DEPENDENCY blender
298                         COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\"
299                         COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\scripts\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\scripts\"
300                         COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\config\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\config\"
301                         COMMAND if not exist \"${TARGETDIR}\\plugins\" mkdir \"${TARGETDIR}\\plugins\"
302                         COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\\"
303                         COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\scripts\\\"
304                         COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\plugins\\\"
305                         COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\\\"
306                 )
307         
308                 IF(CMAKE_CL_64)
309                         # gettext and png are statically linked on win64
310                         ADD_CUSTOM_COMMAND(TARGET blender
311                                 POST_BUILD
312                                 MAIN_DEPENDENCY blender
313                                 COMMAND copy /Y \"${LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\"
314                                 COMMAND copy /Y \"${LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\"
315                                 # COMMAND copy /Y \"${LIBDIR}\\samplerate\\lib\\libsamplerate-0.dll\" \"${TARGETDIR}\\\"
316                         )
317                 ELSE(CMAKE_CL_64)
318                         ADD_CUSTOM_COMMAND(TARGET blender
319                                 POST_BUILD
320                                 MAIN_DEPENDENCY blender
321                                 COMMAND copy /Y \"${LIBDIR}\\gettext\\lib\\gnu_gettext.dll\" \"${TARGETDIR}\\\"
322                                 COMMAND copy /Y \"${LIBDIR}\\png\\lib\\libpng.dll\" \"${TARGETDIR}\\\"
323                                 COMMAND copy /Y \"${LIBDIR}\\zlib\\lib\\zlib.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                 ENDIF(CMAKE_CL_64)
328
329                 IF(WITH_PYTHON)
330                         IF(NOT CMAKE_BUILD_TYPE) # hack: with multi-configuration generator this is "", so for now copy both python31.dll/zip and python31_d.dll/zip
331                                 ADD_CUSTOM_COMMAND(TARGET blender
332                                         POST_BUILD
333                                         MAIN_DEPENDENCY blender
334                                         COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
335                                         COMMAND copy /Y \"${LIBDIR}\\release\\python31_d.zip\" \"${TARGETDIR}\\\"
336                                         COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
337                                         COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
338                                 )
339                         ELSE(NOT CMAKE_BUILD_TYPE)
340                                 IF(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
341                                         ADD_CUSTOM_COMMAND(TARGET blender
342                                                 POST_BUILD
343                                                 MAIN_DEPENDENCY blender
344                                                 COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
345                                                 COMMAND copy /Y \"${LIBDIR}\\release\\python31_d.zip\" \"${TARGETDIR}\\\"
346                                         )
347                                 ELSE(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
348                                         ADD_CUSTOM_COMMAND(TARGET blender
349                                                 POST_BUILD
350                                                 MAIN_DEPENDENCY blender
351                                                 COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
352                                                 COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
353                                         )
354                                 ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
355                         ENDIF(NOT CMAKE_BUILD_TYPE)
356                 ENDIF(WITH_PYTHON)
357
358                 IF(WITH_INTERNATIONAL)
359                         IF(CMAKE_CL_64)
360                                 # iconv is statically linked on win64
361                                 ADD_CUSTOM_COMMAND(TARGET blender
362                                         POST_BUILD
363                                         MAIN_DEPENDENCY blender
364                                         COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\"
365                                         COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\\" 
366                                         COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\\\"
367                                 )
368                         ELSE(CMAKE_CL_64)
369                                 ADD_CUSTOM_COMMAND(TARGET blender
370                                         POST_BUILD
371                                         MAIN_DEPENDENCY blender
372                                         COMMAND copy /Y \"${LIBDIR}\\iconv\\lib\\iconv.dll\" \"${TARGETDIR}\\\"
373                                         COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\"
374                                         COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\\" 
375                                         COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\\\"
376                                 )
377                         ENDIF(CMAKE_CL_64)
378                 ENDIF(WITH_INTERNATIONAL)
379
380                 IF(WITH_FFMPEG)
381                         ADD_CUSTOM_COMMAND(TARGET blender
382                                 POST_BUILD
383                                 MAIN_DEPENDENCY blender
384                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\avcodec-52.dll\" \"${TARGETDIR}\\\"
385                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\avformat-52.dll\" \"${TARGETDIR}\\\"
386                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\avdevice-52.dll\" \"${TARGETDIR}\\\"
387                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\avutil-50.dll\" \"${TARGETDIR}\\\"
388                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\libfaac-0.dll\" \"${TARGETDIR}\\\"
389                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\libfaad-2.dll\" \"${TARGETDIR}\\\"
390                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\libmp3lame-0.dll\" \"${TARGETDIR}\\\"
391                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\libx264-67.dll\" \"${TARGETDIR}\\\"
392                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\swscale-0.dll\" \"${TARGETDIR}\\\"
393                                 COMMAND copy /Y \"${LIBDIR}\\ffmpeg\\lib\\xvidcore.dll\" \"${TARGETDIR}\\\"
394                         )
395                 ENDIF(WITH_FFMPEG)
396
397                 IF(WITH_SNDFILE)
398                         ADD_CUSTOM_COMMAND(TARGET blender
399                                 POST_BUILD
400                                 MAIN_DEPENDENCY blender
401                                 COMMAND copy /Y \"${LIBDIR}\\sndfile\\lib\\libsndfile-1.dll\" \"${TARGETDIR}\\\"
402                         )
403                 ENDIF(WITH_SNDFILE)
404
405                 IF(WITH_JACK)
406                         ADD_CUSTOM_COMMAND(TARGET blender
407                                 POST_BUILD
408                                 MAIN_DEPENDENCY blender
409                                 COMMAND copy /Y \"${LIBDIR}\\jack\\lib\\libjack.dll\" \"${TARGETDIR}\\\"
410                         )
411                 ENDIF(WITH_JACK)
412
413                 IF(WITH_OPENAL)
414                         ADD_CUSTOM_COMMAND(TARGET blender
415                                 POST_BUILD
416                                 MAIN_DEPENDENCY blender
417                                 COMMAND copy /Y \"${LIBDIR}\\openal\\lib\\OpenAL32.dll\" \"${TARGETDIR}\\\"
418                                 COMMAND copy /Y \"${LIBDIR}\\openal\\lib\\wrap_oal.dll\" \"${TARGETDIR}\\\"
419
420                         )
421                 ENDIF(WITH_OPENAL)
422
423                 IF(WITH_SDL)
424                         IF(NOT CMAKE_CL_64)
425                                 ADD_CUSTOM_COMMAND(TARGET blender
426                                         POST_BUILD
427                                         MAIN_DEPENDENCY blender
428                                         COMMAND copy /Y \"${LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\"
429                                 )
430                         ENDIF(NOT CMAKE_CL_64)
431                 ENDIF(WITH_SDL)
432
433         ENDIF(WIN32)
434 ENDIF(WITH_INSTALL)
435
436 ADD_DEPENDENCIES(blender makesdna)
437
438 FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
439
440 SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render)
441
442 IF(WITH_FLUID)
443         SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} bf_intern_elbeem)
444 ENDIF(WITH_FLUID)
445
446 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
447         SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc)
448 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
449
450 #IF(UNIX)
451         # Sort libraries
452         SET(BLENDER_SORTED_LIBS
453                 bf_windowmanager
454
455                 bf_editor_space_api
456                 bf_editor_space_action
457                 bf_editor_space_buttons
458                 bf_editor_space_console
459                 bf_editor_space_file
460                 bf_editor_space_graph
461                 bf_editor_space_image
462                 bf_editor_space_info
463                 bf_editor_space_logic
464                 bf_editor_space_nla
465                 bf_editor_space_node
466                 bf_editor_space_outliner
467                 bf_editor_space_script
468                 bf_editor_space_sequencer
469                 bf_editor_space_sound
470                 bf_editor_space_time
471                 bf_editor_space_userpref
472                 bf_editor_space_view3d
473
474                 bf_editor_text
475                 bf_editor_transform
476                 bf_editor_util
477                 bf_editor_uvedit
478                 bf_editor_curve
479                 bf_editor_armature
480                 bf_editor_gpencil
481                 bf_editor_interface
482                 bf_editor_mesh
483                 bf_editor_metaball
484                 bf_editor_object
485                 bf_editor_physics
486                 bf_editor_render
487                 bf_editor_screen
488                 bf_editor_sculpt_paint
489                 bf_editor_sound
490                 bf_editor_animation
491                 bf_editor_datafiles
492
493                 bf_intern_bsp 
494                 bf_render 
495                 bf_intern_opennl 
496                 bf_python 
497                 bf_python_ext 
498                 bf_ikplugin
499                 bf_modifiers
500                 bf_blenkernel
501                 bf_nodes
502                 bf_gpu
503                 bf_blenloader
504                 bf_blenlib
505                 bf_intern_ghost
506                 bf_intern_string
507                 bf_blenpluginapi 
508                 bf_imbuf 
509                 bf_avi 
510                 bf_cineon 
511                 bf_openexr 
512                 bf_dds
513                 bf_readblenfile
514                 bf_collada
515                 bf_intern_bsp 
516                 bf_intern_bop 
517                 bf_kernel 
518                 bf_intern_decimate 
519                 bf_intern_elbeem 
520                 bf_intern_ik 
521                 bf_intern_memutil 
522                 bf_intern_guardedalloc 
523                 bf_intern_ctr 
524                 bf_intern_moto 
525                 bf_windowmanager
526                 bf_blroutines 
527                 bf_converter 
528                 bf_dummy 
529                 bf_bullet 
530                 bf_intern_smoke
531                 extern_minilzo
532                 extern_lzma
533                 bf_common 
534                 bf_ketsji 
535                 bf_logic 
536                 bf_rasterizer 
537                 bf_oglrasterizer 
538                 bf_expressions 
539                 bf_scenegraph 
540                 bf_intern_moto 
541                 bf_blroutines 
542                 kx_network 
543                 bf_kernel 
544                 bf_ngnetwork 
545                 extern_bullet 
546                 bf_loopbacknetwork 
547                 bf_intern_itasc
548                 bf_common 
549                 bf_intern_moto 
550                 bf_python
551                 bf_python_ext
552                 extern_binreloc
553                 extern_glew
554                 extern_openjpeg
555                 bf_videotex
556                 bf_rna
557                 bf_dna
558                 bf_blenfont
559                 bf_intern_audaspace
560                 bf_intern_decimate
561
562         )
563
564         IF(WITH_CXX_GUARDEDALLOC)
565                 SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_intern_guardedalloc_cpp)
566         ENDIF(WITH_CXX_GUARDEDALLOC)
567
568         IF(WITH_QUICKTIME)
569                 SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_quicktime)
570         ENDIF(WITH_QUICKTIME)
571
572
573         FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
574                 SET(REMLIB ${SORTLIB})
575                 FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS})
576                         IF(${SEARCHLIB} STREQUAL ${SORTLIB})
577                                 SET(REMLIB "")
578                         ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
579                 ENDFOREACH(SEARCHLIB)
580                 IF(REMLIB)
581                         MESSAGE(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
582                         LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
583                 ENDIF(REMLIB)
584         ENDFOREACH(SORTLIB)
585         TARGET_LINK_LIBRARIES(blender ${BLENDER_SORTED_LIBS})
586 #ELSE(UNIX)
587 #       TARGET_LINK_LIBRARIES(blender ${BLENDER_LINK_LIBS})
588 #ENDIF(UNIX)
589
590 SETUP_LIBLINKS(blender)