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