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