- blender player builds again with CMake.
[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(CMAKE_SYSTEM_NAME MATCHES "Linux")
86         ADD_DEFINITIONS(-DWITH_BINRELOC)
87         INCLUDE_DIRECTORIES(${BINRELOC_INC})
88 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
89
90 # Setup the exe sources and buildinfo
91 SET(EXESRC creator.c)
92
93 IF(WIN32)
94         LIST(APPEND EXESRC ../icons/winblender.rc)
95 ENDIF(WIN32)
96
97 IF(WITH_BUILDINFO)
98         ADD_DEFINITIONS(
99                 -DBUILD_DATE="${BUILD_DATE}"
100                 -DBUILD_TIME="${BUILD_TIME}"
101                 -DBUILD_REV="${BUILD_REV}"
102                 -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}"
103                 -DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
104         )
105
106         LIST(APPEND EXESRC buildinfo.c)
107 ENDIF(WITH_BUILDINFO)
108
109 MESSAGE(STATUS "Configuring blender")
110
111 ADD_EXECUTABLE(blender ${EXETYPE} ${EXESRC})
112
113 # Post build steps for bundling/packaging.
114
115 SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
116
117 IF(WITH_INSTALL)
118
119         IF(UNIX)
120                 ADD_CUSTOM_COMMAND(TARGET blender
121                         POST_BUILD
122                         MAIN_DEPENDENCY blender
123                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/
124                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/
125                 )
126         ENDIF(UNIX)
127
128         IF(UNIX AND NOT APPLE)
129                 
130                 # Local installation, "make install" can be done after this optionally
131                 
132                 ADD_CUSTOM_COMMAND(
133                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
134                         COMMAND rm -Rf ${TARGETDIR}/${BLENDER_VERSION}
135                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/
136                         COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/${BLENDER_VERSION}/
137                 )
138         
139                 IF(WITH_INTERNATIONAL)
140                         ADD_CUSTOM_COMMAND(
141                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
142                                 COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/${BLENDER_VERSION}/
143                                 COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/${BLENDER_VERSION}/
144                         )
145                 ENDIF(WITH_INTERNATIONAL)
146         
147                 IF(WITH_PYTHON)
148                         ADD_CUSTOM_COMMAND(
149                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
150                                 COMMENT "copying blender scripts..."
151                                 COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/${BLENDER_VERSION}/
152                                 COMMAND find ${TARGETDIR} -name "*.py?" -prune -exec rm -rf {} "\;"
153                         )
154                         IF(WITH_PYTHON_INSTALL)
155                                 # Copy the systems python into the install directory
156                                 # Scons copy in tools/Blender.py
157                                 ADD_CUSTOM_COMMAND(
158                                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
159                                         COMMENT "copying a subset of the systems python..."
160
161                                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python # PYTHONPATH and PYTHONHOME is set here
162                                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python/lib/
163                                         COMMAND cp -R ${PYTHON_LIBPATH}/python${PYTHON_VERSION} ${TARGETDIR}/${BLENDER_VERSION}/python/lib/
164
165                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/distutils
166                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/lib2to3
167                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/idlelib
168                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/tkinter
169                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/config
170
171                                         COMMAND rm -rf ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/site-packages
172                                         COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/site-packages  # python needs it.
173
174                                         COMMAND rm -f ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/lib-dynload/_tkinter.so
175                                         COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "test" -prune -exec rm -rf {} "\;"
176                                         COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.py?" -exec rm -rf {} "\;"
177                                         COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.so"-exec strip -s {} "\;"
178                                 )
179                         ENDIF(WITH_PYTHON_INSTALL)
180                 ENDIF(WITH_PYTHON)
181           
182                 ADD_CUSTOM_COMMAND(
183                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
184                         COMMAND find ${TARGETDIR} -name .svn -prune -exec rm -rf {} "\;"
185                 )
186         
187         
188                 # Above we bundle a portable distribution in ./bin
189                 # This is an optional "make install" which installs blender on the system.
190                 INSTALL(
191                         PROGRAMS ${TARGETDIR}/blender
192                         DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
193                 )
194
195                 IF(WITH_GAMEENGINE AND WITH_PLAYER)
196                         INSTALL(
197                                 PROGRAMS ${TARGETDIR}/blenderplayer
198                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
199                         )
200                 ENDIF(WITH_GAMEENGINE AND WITH_PLAYER)
201
202                 INSTALL(
203                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
204                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
205                 )
206                 INSTALL(
207                         FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/blender.svg
208                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps
209                 )
210                 INSTALL(
211                         PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
212                         DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
213                 )
214                 INSTALL(
215                         FILES ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
216                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
217                 )
218                 INSTALL(
219                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
220                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
221                         PATTERN ".svn" EXCLUDE
222                 )
223                 INSTALL(
224                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts/
225                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION}/scripts
226                         PATTERN ".svn" EXCLUDE
227                         PATTERN "*.pyc" EXCLUDE
228                 )
229                 INSTALL(
230                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/datafiles/brushicons/
231                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION}/datafiles/brushicons
232                         PATTERN ".svn" EXCLUDE
233                 )
234                 IF(WITH_INTERNATIONAL)
235                         INSTALL(
236                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
237                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION}/datafiles/locale
238                                 PATTERN ".svn" EXCLUDE
239                         )
240                 ENDIF(WITH_INTERNATIONAL)
241                 
242                 # end "make install"
243         
244         ENDIF(UNIX AND NOT APPLE)
245
246         IF(APPLE)
247                 SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
248                 SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
249                 SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
250
251                 ADD_CUSTOM_COMMAND(
252                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
253                         COMMAND cp -Rf ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
254                         COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
255                         COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
256                         COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
257                         COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
258                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
259                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
260                         COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/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/${BLENDER_VERSION}/datafiles/
267                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/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/${BLENDER_VERSION}/
276                                 COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
277                                 COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
278                                 COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;"
279                         )
280                 ENDIF(WITH_PYTHON)        
281         
282                 ADD_CUSTOM_COMMAND(
283                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender       
284                         COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
285                         COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
286                                         COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
287                 )
288         ENDIF(APPLE)
289
290         IF(WIN32)
291                 # notice 'xcopy /Y /H' on .bfont.ttf, this is needed when building over samba
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 xcopy /Y /H \"${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
455 #IF(UNIX)
456         # Sort libraries
457         SET(BLENDER_SORTED_LIBS
458                 bf_windowmanager
459
460                 bf_editor_space_api
461                 bf_editor_space_action
462                 bf_editor_space_buttons
463                 bf_editor_space_console
464                 bf_editor_space_file
465                 bf_editor_space_graph
466                 bf_editor_space_image
467                 bf_editor_space_info
468                 bf_editor_space_logic
469                 bf_editor_space_nla
470                 bf_editor_space_node
471                 bf_editor_space_outliner
472                 bf_editor_space_script
473                 bf_editor_space_sequencer
474                 bf_editor_space_sound
475                 bf_editor_space_time
476                 bf_editor_space_userpref
477                 bf_editor_space_view3d
478
479                 bf_editor_text
480                 bf_editor_transform
481                 bf_editor_util
482                 bf_editor_uvedit
483                 bf_editor_curve
484                 bf_editor_armature
485                 bf_editor_gpencil
486                 bf_editor_interface
487                 bf_editor_mesh
488                 bf_editor_metaball
489                 bf_editor_object
490                 bf_editor_physics
491                 bf_editor_render
492                 bf_editor_screen
493                 bf_editor_sculpt_paint
494                 bf_editor_sound
495                 bf_editor_animation
496                 bf_editor_datafiles
497
498                 bf_render 
499                 bf_intern_opennl 
500                 bf_python 
501                 bf_python_ext 
502                 bf_ikplugin
503                 bf_modifiers
504                 bf_blenkernel
505                 bf_nodes
506                 bf_gpu
507                 bf_blenloader
508                 bf_blenlib
509                 bf_intern_ghost
510                 bf_intern_string
511                 bf_blenpluginapi 
512                 bf_imbuf 
513                 bf_avi 
514                 bf_cineon 
515                 bf_openexr 
516                 bf_dds
517                 bf_readblenfile
518                 bf_collada
519                 bf_intern_bsp 
520                 bf_intern_bop 
521                 bf_kernel 
522                 bf_intern_decimate 
523                 bf_intern_elbeem 
524                 bf_intern_ik 
525                 bf_intern_memutil 
526                 bf_intern_guardedalloc 
527                 bf_intern_ctr 
528                 bf_blroutines 
529                 bf_converter 
530                 bf_dummy 
531                 bf_bullet 
532                 bf_intern_smoke
533                 extern_minilzo
534                 extern_lzma
535                 bf_common 
536                 bf_ketsji 
537                 bf_logic 
538                 bf_rasterizer 
539                 bf_oglrasterizer 
540                 bf_expressions 
541                 bf_scenegraph 
542                 kx_network 
543                 bf_kernel
544                 bf_python # duplicate for BPY_eval_driver
545                 bf_ngnetwork 
546                 extern_bullet 
547                 bf_loopbacknetwork 
548                 bf_intern_moto 
549                 extern_glew
550                 extern_openjpeg
551                 bf_videotex
552                 bf_rna
553                 bf_dna
554                 bf_blenfont
555                 bf_intern_audaspace
556         )
557
558         IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
559                 LIST(APPEND BLENDER_SORTED_LIBS extern_binreloc)
560         ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
561
562         IF(WITH_CXX_GUARDEDALLOC)
563                 LIST(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
564         ENDIF(WITH_CXX_GUARDEDALLOC)
565
566         IF(WITH_IK_ITASC)
567                 LIST(APPEND BLENDER_SORTED_LIBS bf_intern_itasc)
568         ENDIF(WITH_IK_ITASC)
569
570         IF(WITH_QUICKTIME)
571                 LIST(APPEND BLENDER_SORTED_LIBS bf_quicktime)
572         ENDIF(WITH_QUICKTIME)
573
574
575         FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
576                 SET(REMLIB ${SORTLIB})
577                 FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS})
578                         IF(${SEARCHLIB} STREQUAL ${SORTLIB})
579                                 SET(REMLIB "")
580                         ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
581                 ENDFOREACH(SEARCHLIB)
582                 IF(REMLIB)
583                         MESSAGE(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
584                         LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
585                 ENDIF(REMLIB)
586         ENDFOREACH(SORTLIB)
587         TARGET_LINK_LIBRARIES(blender ${BLENDER_SORTED_LIBS})
588 #ELSE(UNIX)
589 #       TARGET_LINK_LIBRARIES(blender ${BLENDER_LINK_LIBS})
590 #ENDIF(UNIX)
591
592 SETUP_LIBLINKS(blender)