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