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