use install target for CMake Windows (msvc and mingw), for MinGW you now need to...
[blender.git] / source / creator / CMakeLists.txt
1 # -*- mode: cmake; indent-tabs-mode: t; -*-
2 # $Id$
3 # ***** BEGIN GPL LICENSE BLOCK *****
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #
19 # The Original Code is Copyright (C) 2006, Blender Foundation
20 # All rights reserved.
21 #
22 # The Original Code is: all of this file.
23 #
24 # Contributor(s): Jacques Beaurain.
25 #
26 # ***** END GPL LICENSE BLOCK *****
27
28 # So BUILDINFO and BLENDERPATH strings are automatically quoted
29 cmake_policy(SET CMP0005 NEW)
30
31 setup_libdirs()
32
33 blender_include_dirs(
34         ../../intern/guardedalloc
35         ../blender/blenlib
36         ../blender/blenkernel
37         ../blender/blenloader
38         ../blender/editors/include
39         ../blender/makesrna
40         ../blender/imbuf
41         ../blender/render/extern/include
42         ../blender/makesdna
43         ../blender/gpu
44         ../blender/windowmanager
45 )
46
47 if(WITH_CODEC_QUICKTIME)
48         add_definitions(-DWITH_QUICKTIME)
49 endif()
50
51 if(WITH_IMAGE_OPENEXR)
52         add_definitions(-DWITH_OPENEXR)
53 endif()
54
55 if(WITH_IMAGE_OPENJPEG)
56         add_definitions(-DWITH_OPENJPEG)
57 endif()
58
59 if(WITH_IMAGE_TIFF)
60         add_definitions(-DWITH_TIFF)
61 endif()
62
63 if(WITH_IMAGE_DDS)
64         add_definitions(-DWITH_DDS)
65 endif()
66
67 if(WITH_IMAGE_CINEON)
68         add_definitions(-DWITH_CINEON)
69 endif()
70
71 if(WITH_IMAGE_HDR)
72         add_definitions(-DWITH_HDR)
73 endif()
74
75 if(WITH_PYTHON)
76         blender_include_dirs(../blender/python)
77         add_definitions(-DWITH_PYTHON)
78 endif()
79
80 if(WITH_GAMEENGINE)
81         blender_include_dirs(
82                 ../kernel/gen_messaging
83                 ../kernel/gen_system
84         )
85
86         add_definitions(-DWITH_GAMEENGINE)
87 endif()
88
89 if(NOT WITH_SDL)
90         add_definitions(-DDISABLE_SDL)
91 endif()
92
93 if(WITH_BINRELOC)
94         add_definitions(-DWITH_BINRELOC)
95         blender_include_dirs(${BINRELOC_INC})
96 endif()
97
98 # Setup the exe sources and buildinfo
99 set(SRC
100         creator.c
101 )
102
103 if(WIN32 AND NOT UNIX)
104         list(APPEND SRC
105                 ../icons/winblender.rc
106         )
107 endif()
108
109 if(WITH_BUILDINFO)
110         # --------------------------------------------------------------------------
111         # These defines could all be moved into the header below
112         string(REPLACE " " "\ " BUILDINFO_CFLAGS "${CMAKE_C_FLAGS}")
113         string(REPLACE " " "\ " BUILDINFO_CXXFLAGS "${CMAKE_CXX_FLAGS}")
114         string(REPLACE " " "\ " BUILDINFO_LINKFLAGS "${PLATFORM_LINKFLAGS}")
115         add_definitions(
116                 # # define in header now, else these get out of date on rebuilds.
117                 # -DBUILD_DATE="${BUILD_DATE}"
118                 # -DBUILD_TIME="${BUILD_TIME}"
119                 # -DBUILD_REV="${BUILD_REV}"
120                 -DWITH_BUILDINFO_HEADER # alternative to lines above
121                 -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}"
122                 -DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
123                 -DBUILD_CFLAGS="${BUILDINFO_CFLAGS}"
124                 -DBUILD_CXXFLAGS="${BUILDINFO_CXXFLAGS}"
125                 -DBUILD_LINKFLAGS="${BUILDINFO_LINKFLAGS}"
126                 -DBUILD_SYSTEM="CMake"
127         )
128
129         # --------------------------------------------------------------------------
130         # write header for values that change each build
131         # note, generaed file is in build dir's source/creator
132         #       except when used as an include path.
133
134         # include the output directory, where the buildinfo.h file is generated
135         include_directories(${CMAKE_BINARY_DIR}/source/creator)
136
137         # a custom target that is always built
138         add_custom_target(buildinfo ALL
139                 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h)
140
141         # creates svnheader.h using cmake script
142         add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h
143                 COMMAND ${CMAKE_COMMAND}
144                 -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
145                 -P ${CMAKE_SOURCE_DIR}/build_files/cmake/buildinfo.cmake)
146
147         # buildinfo.h is a generated file
148         set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h
149                 PROPERTIES GENERATED TRUE
150                 HEADER_FILE_ONLY TRUE)
151                 
152         # add deps below, after adding blender
153         # -------------- done with header values.
154
155         list(APPEND SRC
156                 buildinfo.c
157         )
158 endif()
159
160 # message(STATUS "Configuring blender")
161 if(WITH_PYTHON_MODULE)
162         add_definitions(-DWITH_PYTHON_MODULE)
163
164         # creates ./bin/bpy.so which can be imported as a python module.
165         add_library(blender SHARED ${SRC})
166         set_target_properties(
167                 blender
168                 PROPERTIES
169                          PREFIX ""
170                          OUTPUT_NAME bpy
171                          LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/
172         )
173 else()
174         add_executable(blender ${EXETYPE} ${SRC})
175 endif()
176
177 if(WITH_BUILDINFO)
178         # explicitly say that the executable depends on the buildinfo
179         add_dependencies(blender buildinfo)
180 endif()
181
182 # Post build steps for bundling/packaging.
183
184
185 if(MSVC)
186         # ${CMAKE_CFG_INTDIR} should replace \${BUILD_TYPE} when using add_command
187         set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
188 else()
189         set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH})
190 endif()
191
192 if(WITH_INSTALL)
193
194         if(UNIX)
195                 add_custom_command(TARGET blender
196                         POST_BUILD
197                         MAIN_DEPENDENCY blender
198                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/
199                         #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/
200                 )
201         endif()
202
203         if(UNIX AND NOT APPLE)
204
205                 if(WITH_INSTALL_PORTABLE)
206                         set(TARGETDIR_VER ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/${BLENDER_VERSION})
207                 else()
208                         set(TARGETDIR_VER ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
209                 endif()
210
211                 # important to make a clean  install each time
212                 # else old scripts get loaded.
213                 install(
214                         CODE
215                         "file(REMOVE_RECURSE ${TARGETDIR_VER})"
216                 )
217
218                 # there are a few differences between portable and system install
219                 if(WITH_INSTALL_PORTABLE)
220                         install(
221                                 FILES
222                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
223                                 ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/blender.svg
224                                 ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
225                                 DESTINATION ${TARGETDIR}
226                         )
227
228                         install(
229                                 PROGRAMS
230                                 ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
231                                 DESTINATION ${TARGETDIR}
232                         )
233
234                         install(
235                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
236                                 DESTINATION ${TARGETDIR}
237                                 PATTERN ".svn" EXCLUDE
238                         )
239
240                 else()
241                         # main blender binary
242                         install(
243                                 PROGRAMS ${TARGETDIR}/blender
244                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
245                         )
246
247                         # misc files
248                         install(
249                                 FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
250                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
251                         )
252                         install(
253                                 FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/blender.svg
254                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps
255                         )
256                         install(
257                                 PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
258                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
259                         )
260                         install(
261                                 FILES ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
262                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
263                         )
264                         install(
265                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
266                                 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
267                                 PATTERN ".svn" EXCLUDE
268                         )
269                 endif()
270
271                 install(
272                         FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
273                         DESTINATION ${TARGETDIR_VER}/config
274                 )
275
276                 if(WITH_INTERNATIONAL)
277                         install(
278                                 FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
279                                 DESTINATION ${TARGETDIR_VER}/config
280                         )
281
282                         install(
283                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
284                                 DESTINATION ${TARGETDIR_VER}/datafiles/
285                                 PATTERN ".svn" EXCLUDE
286                         )
287                 endif()
288
289                         install(
290                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
291                                 DESTINATION ${TARGETDIR_VER}/
292                                 PATTERN ".svn" EXCLUDE
293                         )
294
295                 if(WITH_PYTHON)
296                         # install(CODE "message(\"copying blender scripts...\")")
297                         install(
298                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
299                                 DESTINATION ${TARGETDIR_VER}/
300                                 PATTERN ".svn" EXCLUDE
301                                 PATTERN "__pycache__" EXCLUDE
302                         )
303
304                         if(WITH_PYTHON_INSTALL)
305                                 # Copy the systems python into the install directory
306                                 # Scons copy in tools/Blender.py
307                                 # install(CODE "message(\"copying a subset of the systems python...\")")
308                                 install(
309                                         DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}
310                                         DESTINATION ${TARGETDIR_VER}/python/lib/
311                                         PATTERN ".svn" EXCLUDE
312                                         PATTERN "__pycache__" EXCLUDE               # ./distutils
313                                         PATTERN "distutils" EXCLUDE                 # ./distutils
314                                         PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
315                                         PATTERN "config" EXCLUDE                    # ./config
316                                         PATTERN "config-*" EXCLUDE                  # ./config-*
317                                         PATTERN "site-packages/*" EXCLUDE           # ./site-packages/*
318                                         PATTERN "tkinter" EXCLUDE                   # ./tkinter
319                                         PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
320                                         PATTERN "test" EXCLUDE                      # ./test
321                                         PATTERN "turtledemo" EXCLUDE                # ./turtledemo
322                                 )
323
324                                 # # doesnt work, todo
325                                 # install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
326                         endif()
327                 endif()
328         elseif(WIN32)
329
330                 set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
331
332                 install(  # same as linux!, deduplicate
333                         CODE
334                         "file(REMOVE_RECURSE ${TARGETDIR_VER})"
335                 )
336
337                 install(  # same as linux!, deduplicate
338                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
339                         DESTINATION ${TARGETDIR_VER}/../
340                         PATTERN ".svn" EXCLUDE
341                 )
342
343                 install(  # same as linux!, deduplicate
344                         FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
345                         DESTINATION ${TARGETDIR_VER}/config
346                 )
347
348                 if(WITH_INTERNATIONAL) # same as linux!, deduplicate
349                         install(
350                                 FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
351                                 DESTINATION ${TARGETDIR_VER}/config
352                         )
353                         install(
354                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
355                                 DESTINATION ${TARGETDIR_VER}/datafiles/
356                                 PATTERN ".svn" EXCLUDE
357                         )
358
359                         if(NOT CMAKE_CL_64)
360                                 install(
361                                         FILES ${LIBDIR}/iconv/lib/iconv.dll
362                                         DESTINATION ${TARGETDIR}/
363                                 )
364                         endif()
365                 endif()
366
367                 install( # same as linux!, deduplicate
368                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
369                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION}/datafiles/locale
370                         PATTERN ".svn" EXCLUDE
371                 )
372
373                 install( # same as linux!, deduplicate
374                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
375                         DESTINATION ${TARGETDIR_VER}/../
376                         PATTERN ".svn" EXCLUDE
377                 )
378
379                 install(  # TODO, copy to linux
380                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
381                         DESTINATION ${TARGETDIR_VER}/
382                         PATTERN ".svn" EXCLUDE
383                 )
384
385                 if(WITH_PYTHON)
386                         # install(CODE "message(\"copying blender scripts...\")")
387                         install(  # same as linux!, deduplicate
388                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
389                                 DESTINATION ${TARGETDIR_VER}/
390                                 PATTERN ".svn" EXCLUDE
391                                 PATTERN "__pycache__" EXCLUDE
392                         )
393
394                         # TODO, multiple targets?
395                         install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS Release)
396                         install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS RelWithDebInfo)
397                         install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS MinSizeRel)
398
399                         install(
400                                 FILES ${LIBDIR}/python/lib/python32_d.dll
401                                 DESTINATION ${TARGETDIR}/
402                                 CONFIGURATIONS Debug
403                         )
404
405                         if(WITH_PYTHON_INSTALL)
406                                 #~ # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
407                                 # install(CODE "message(\"copying a subset of the systems python...\")")
408
409                                 install(
410                                         CODE
411                                         "execute_process(COMMAND ${CMAKE_COMMAND}
412                                         -E make_directory ${TARGETDIR_VER}/python/lib/)"
413                                 )
414
415                                 install(
416                                         CODE
417                                         "
418                                         if(BUILD_TYPE MATCHES \"Debug\")
419                                                 set(PYBUNDLE \"python32_d.tar.gz\")
420                                         else()
421                                                 set(PYBUNDLE \"python32.tar.gz\")
422                                         endif()
423
424                                         execute_process(COMMAND ${CMAKE_COMMAND}
425                                                 -E chdir ${TARGETDIR_VER}/python/lib/
426                                                 ${CMAKE_COMMAND} -E tar xzfv ${LIBDIR}/release/\${PYBUNDLE})
427                                         "
428                                 )
429
430                                 # TODO, debug
431
432                                 # doesnt work, todo
433                                 # install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
434                         endif()
435                 endif()
436
437                 if(CMAKE_CL_64)
438                         # gettext and png are statically linked on win64
439                         install(
440                                 FILES ${LIBDIR}/zlib/lib/zlib.dll
441                                 DESTINATION ${TARGETDIR}/
442                         )
443                 else()
444                         install(
445                                 FILES
446                                 ${LIBDIR}/gettext/lib/gnu_gettext.dll # TODO INTERNATIONAL ONLY!
447                                 ${LIBDIR}/png/lib/libpng.dll
448                                 ${LIBDIR}/zlib/lib/zlib.dll
449                                 DESTINATION ${TARGETDIR}/
450                         )
451                 endif()
452
453                 if(MSVC)
454                         install(
455                                 FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
456                                 DESTINATION ${TARGETDIR}/
457                         )
458                 else()
459                         install(
460                                 FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
461                                 DESTINATION ${TARGETDIR}/
462                         )
463                 endif()
464
465                 if(WITH_CODEC_FFMPEG)
466                         install(
467                                 FILES
468                                 ${LIBDIR}/ffmpeg/lib/avcodec-52.dll
469                                 ${LIBDIR}/ffmpeg/lib/avformat-52.dll
470                                 ${LIBDIR}/ffmpeg/lib/avdevice-52.dll
471                                 ${LIBDIR}/ffmpeg/lib/avutil-50.dll
472                                 ${LIBDIR}/ffmpeg/lib/swscale-0.dll
473                                 DESTINATION ${TARGETDIR}/
474                         )
475                         
476                 endif()
477
478                 if(WITH_CODEC_SNDFILE)
479                         install(
480                                 FILES
481                                 ${LIBDIR}/sndfile/lib/libsndfile-1.dll
482                                 DESTINATION ${TARGETDIR}/
483                         )
484                 endif()
485
486                 if(WITH_OPENAL)
487                         install(
488                                 FILES
489                                 ${LIBDIR}/openal/lib/OpenAL32.dll
490                                 ${LIBDIR}/openal/lib/wrap_oal.dll
491                                 DESTINATION ${TARGETDIR}/
492                         )
493                 endif()
494
495                 if(WITH_SDL)
496                         if(NOT CMAKE_CL_64)
497                                 install(
498                                         FILES
499                                         ${LIBDIR}/sdl/lib/SDL.dll
500                                         DESTINATION ${TARGETDIR}/
501                                 )
502                         endif()
503                 endif()
504
505         elseif(APPLE)
506                 set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
507                 set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
508                 set(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
509
510                 add_custom_command(
511                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
512                         COMMAND cp -Rf ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
513                         COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
514                         COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
515                         COMMAND cat ${SOURCEINFO} | sed s/VERSION/${BLENDER_VERSION}${BLENDER_VERSION_CHAR}/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
516                         COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
517                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
518                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
519                         COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
520                 )
521           
522                 if(WITH_INTERNATIONAL)
523                         add_custom_command(
524                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
525                                 COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
526                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
527                         )
528                 endif()
529           
530                 if(WITH_PYTHON)
531                         set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
532                         add_custom_command(
533                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
534                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/
535                                 COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
536                                 COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
537                                 COMMAND find ${TARGETDIR}/blender.app -name '*.py[co]' -prune -exec rm -rf {} '\;'
538                                 COMMAND find ${TARGETDIR}/blender.app -name '__pycache__' -exec rmdir {} '+'
539                         )
540                 endif()   
541         
542                 add_custom_command(
543                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender       
544                         COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
545                         COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
546                         COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
547                 )
548         endif()
549
550 endif()
551
552 add_dependencies(blender makesdna)
553
554 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
555
556 set(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render)
557
558 if(WITH_MOD_FLUID)
559         list(APPEND BLENDER_LINK_LIBS bf_intern_elbeem)
560 endif()
561
562
563 #if(UNIX)
564         # Sort libraries
565         set(BLENDER_SORTED_LIBS
566                 bf_windowmanager
567
568                 bf_editor_space_api
569                 bf_editor_space_action
570                 bf_editor_space_buttons
571                 bf_editor_space_console
572                 bf_editor_space_file
573                 bf_editor_space_graph
574                 bf_editor_space_image
575                 bf_editor_space_info
576                 bf_editor_space_logic
577                 bf_editor_space_nla
578                 bf_editor_space_node
579                 bf_editor_space_outliner
580                 bf_editor_space_script
581                 bf_editor_space_sequencer
582                 bf_editor_space_sound
583                 bf_editor_space_time
584                 bf_editor_space_userpref
585                 bf_editor_space_view3d
586
587                 bf_editor_text
588                 bf_editor_transform
589                 bf_editor_util
590                 bf_editor_uvedit
591                 bf_editor_curve
592                 bf_editor_armature
593                 bf_editor_gpencil
594                 bf_editor_interface
595                 bf_editor_mesh
596                 bf_editor_metaball
597                 bf_editor_object
598                 bf_editor_physics
599                 bf_editor_render
600                 bf_editor_screen
601                 bf_editor_sculpt_paint
602                 bf_editor_sound
603                 bf_editor_animation
604                 bf_editor_datafiles
605
606                 bf_render 
607                 bf_intern_opennl 
608                 bf_python 
609                 bf_python_ext 
610                 bf_ikplugin
611                 bf_modifiers
612                 bf_blenkernel
613                 bf_nodes
614                 bf_gpu
615                 bf_blenloader
616                 bf_blenlib
617                 bf_intern_ghost
618                 bf_intern_string
619                 bf_blenpluginapi 
620                 bf_imbuf 
621                 bf_avi 
622                 bf_imbuf_cineon 
623                 bf_imbuf_openexr 
624                 bf_imbuf_dds
625                 bf_readblenfile
626                 bf_collada
627                 bf_intern_bsp 
628                 bf_intern_bop 
629                 bf_gen_system 
630                 bf_intern_decimate 
631                 bf_intern_elbeem 
632                 bf_intern_ik 
633                 bf_intern_memutil 
634                 bf_intern_guardedalloc 
635                 bf_intern_ctr 
636                 ge_blen_routines 
637                 ge_converter 
638                 ge_phys_dummy
639                 ge_phys_bullet 
640                 bf_intern_smoke
641                 extern_minilzo
642                 extern_lzma
643                 ge_logic_ketsji 
644                 ge_phys_common
645                 ge_logic 
646                 ge_rasterizer 
647                 ge_oglrasterizer 
648                 ge_logic_expressions 
649                 ge_scenegraph 
650                 ge_logic_network 
651                 bf_gen_system
652                 bf_python # duplicate for BPY_driver_exec
653                 ge_logic_ngnetwork 
654                 extern_bullet 
655                 ge_logic_loopbacknetwork 
656                 bf_intern_moto 
657                 extern_glew
658                 extern_openjpeg
659                 extern_redcode
660                 ge_videotex
661                 bf_rna
662                 bf_dna
663                 bf_blenfont
664                 bf_intern_audaspace
665                 bf_intern_mikktspace
666         )
667
668         if(WITH_BINRELOC)
669                 list(APPEND BLENDER_SORTED_LIBS extern_binreloc)
670         endif()
671
672         if(WITH_CXX_GUARDEDALLOC)
673                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
674         endif()
675
676         if(WITH_IK_ITASC)
677                 list(APPEND BLENDER_SORTED_LIBS bf_intern_itasc)
678         endif()
679
680         if(WITH_CODEC_QUICKTIME)
681                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
682         endif()
683
684         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
685                 set(REMLIB ${SORTLIB})
686                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
687                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
688                                 set(REMLIB "")
689                         endif()
690                 endforeach()
691                 if(REMLIB)
692                         # message(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
693                         list(APPEND REM_MSG ${REMLIB})
694                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
695                 endif()
696         endforeach()
697         if(REM_MSG)
698                 list(SORT REM_MSG)
699                 message(STATUS "Blender Skipping: (${REM_MSG})")
700         endif()
701         target_link_libraries(blender ${BLENDER_SORTED_LIBS})
702 #else()
703 #       target_link_libraries(blender ${BLENDER_LINK_LIBS})
704 #endif()
705
706 setup_liblinks(blender)