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