ba366c0ee5187d51ca21f7d404bf322bd6465955
[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                         install(
360                                 FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
361                                 DESTINATION ${TARGETDIR}/
362                         )
363
364                         if(NOT CMAKE_CL_64)
365                                 install(
366                                         FILES ${LIBDIR}/iconv/lib/iconv.dll
367                                         DESTINATION ${TARGETDIR}/
368                                 )
369                         endif()
370                 endif()
371
372                 install( # same as linux!, deduplicate
373                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
374                         DESTINATION ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION}/datafiles/locale
375                         PATTERN ".svn" EXCLUDE
376                 )
377
378                 install( # same as linux!, deduplicate
379                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
380                         DESTINATION ${TARGETDIR_VER}/../
381                         PATTERN ".svn" EXCLUDE
382                 )
383
384                 install(  # TODO, copy to linux
385                         DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
386                         DESTINATION ${TARGETDIR_VER}/
387                         PATTERN ".svn" EXCLUDE
388                 )
389
390                 if(WITH_PYTHON)
391                         # install(CODE "message(\"copying blender scripts...\")")
392                         install(  # same as linux!, deduplicate
393                                 DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
394                                 DESTINATION ${TARGETDIR_VER}/
395                                 PATTERN ".svn" EXCLUDE
396                                 PATTERN "__pycache__" EXCLUDE
397                         )
398
399                         # TODO, multiple targets?
400                         install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS Release)
401                         install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS RelWithDebInfo)
402                         install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS MinSizeRel)
403
404                         install(
405                                 FILES ${LIBDIR}/python/lib/python32_d.dll
406                                 DESTINATION ${TARGETDIR}/
407                                 CONFIGURATIONS Debug
408                         )
409
410                         if(WITH_PYTHON_INSTALL)
411                                 #~ # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
412                                 # install(CODE "message(\"copying a subset of the systems python...\")")
413
414                                 install(
415                                         CODE
416                                         "execute_process(COMMAND ${CMAKE_COMMAND}
417                                         -E make_directory ${TARGETDIR_VER}/python/lib/)"
418                                 )
419
420                                 install(
421                                         CODE
422                                         "
423                                         if(BUILD_TYPE MATCHES \"Debug\")
424                                                 set(PYBUNDLE \"python32_d.tar.gz\")
425                                         else()
426                                                 set(PYBUNDLE \"python32.tar.gz\")
427                                         endif()
428
429                                         execute_process(COMMAND ${CMAKE_COMMAND}
430                                                 -E chdir ${TARGETDIR_VER}/python/lib/
431                                                 ${CMAKE_COMMAND} -E tar xzfv ${LIBDIR}/release/\${PYBUNDLE})
432                                         "
433                                 )
434
435                                 # doesnt work, todo
436                                 # install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
437                         endif()
438                 endif()
439
440                 if(CMAKE_CL_64)
441                         # gettext and png are statically linked on win64
442                         install(
443                                 FILES ${LIBDIR}/zlib/lib/zlib.dll
444                                 DESTINATION ${TARGETDIR}/
445                         )
446                 else()
447                         install(
448                                 FILES
449                                 ${LIBDIR}/png/lib/libpng.dll
450                                 ${LIBDIR}/zlib/lib/zlib.dll
451                                 DESTINATION ${TARGETDIR}/
452                         )
453                 endif()
454
455                 if(MSVC)
456                         install(
457                                 FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
458                                 DESTINATION ${TARGETDIR}/
459                         )
460                 else()
461                         install(
462                                 FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
463                                 DESTINATION ${TARGETDIR}/
464                         )
465                 endif()
466
467                 if(WITH_CODEC_FFMPEG)
468                         install(
469                                 FILES
470                                 ${LIBDIR}/ffmpeg/lib/avcodec-52.dll
471                                 ${LIBDIR}/ffmpeg/lib/avformat-52.dll
472                                 ${LIBDIR}/ffmpeg/lib/avdevice-52.dll
473                                 ${LIBDIR}/ffmpeg/lib/avutil-50.dll
474                                 ${LIBDIR}/ffmpeg/lib/swscale-0.dll
475                                 DESTINATION ${TARGETDIR}/
476                         )
477
478                 endif()
479
480                 if(WITH_CODEC_SNDFILE)
481                         install(
482                                 FILES
483                                 ${LIBDIR}/sndfile/lib/libsndfile-1.dll
484                                 DESTINATION ${TARGETDIR}/
485                         )
486                 endif()
487
488                 if(WITH_OPENAL)
489                         install(
490                                 FILES
491                                 ${LIBDIR}/openal/lib/OpenAL32.dll
492                                 ${LIBDIR}/openal/lib/wrap_oal.dll
493                                 DESTINATION ${TARGETDIR}/
494                         )
495                 endif()
496
497                 if(WITH_SDL)
498                         if(NOT CMAKE_CL_64)
499                                 install(
500                                         FILES
501                                         ${LIBDIR}/sdl/lib/SDL.dll
502                                         DESTINATION ${TARGETDIR}/
503                                 )
504                         endif()
505                 endif()
506
507         elseif(APPLE)
508                 set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
509                 set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
510                 set(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
511
512                 add_custom_command(
513                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
514                         COMMAND cp -Rf ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
515                         COMMAND cp -Rf ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
516                         COMMAND cp -Rf ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
517                         COMMAND cat ${SOURCEINFO} | sed s/VERSION/${BLENDER_VERSION}${BLENDER_VERSION_CHAR}/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
518                         COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
519                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}
520                         COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
521                         COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
522                 )
523
524                 if(WITH_INTERNATIONAL)
525                         add_custom_command(
526                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
527                                 COMMAND cp ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
528                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/datafiles/
529                         )
530                 endif()
531
532                 if(WITH_PYTHON)
533                         set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
534                         add_custom_command(
535                                 TARGET blender POST_BUILD MAIN_DEPENDENCY blender
536                                 COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/
537                                 COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
538                                 COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
539                                 COMMAND find ${TARGETDIR}/blender.app -name '*.py[co]' -prune -exec rm -rf {} '\;'
540                                 COMMAND find ${TARGETDIR}/blender.app -name '__pycache__' -exec rmdir {} '+'
541                         )
542                 endif()
543
544                 add_custom_command(
545                         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
546                         COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
547                         COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
548                         COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
549                 )
550         endif()
551
552 endif()
553
554 add_dependencies(blender makesdna)
555
556 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
557
558 set(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render)
559
560 if(WITH_MOD_FLUID)
561         list(APPEND BLENDER_LINK_LIBS bf_intern_elbeem)
562 endif()
563
564
565 #if(UNIX)
566         # Sort libraries
567         set(BLENDER_SORTED_LIBS
568                 bf_windowmanager
569
570                 bf_editor_space_api
571                 bf_editor_space_action
572                 bf_editor_space_buttons
573                 bf_editor_space_console
574                 bf_editor_space_file
575                 bf_editor_space_graph
576                 bf_editor_space_image
577                 bf_editor_space_info
578                 bf_editor_space_logic
579                 bf_editor_space_nla
580                 bf_editor_space_node
581                 bf_editor_space_outliner
582                 bf_editor_space_script
583                 bf_editor_space_sequencer
584                 bf_editor_space_sound
585                 bf_editor_space_time
586                 bf_editor_space_userpref
587                 bf_editor_space_view3d
588
589                 bf_editor_text
590                 bf_editor_transform
591                 bf_editor_util
592                 bf_editor_uvedit
593                 bf_editor_curve
594                 bf_editor_armature
595                 bf_editor_gpencil
596                 bf_editor_interface
597                 bf_editor_mesh
598                 bf_editor_metaball
599                 bf_editor_object
600                 bf_editor_physics
601                 bf_editor_render
602                 bf_editor_screen
603                 bf_editor_sculpt_paint
604                 bf_editor_sound
605                 bf_editor_animation
606                 bf_editor_datafiles
607
608                 bf_render
609                 bf_intern_opennl
610                 bf_python
611                 bf_python_ext
612                 bf_ikplugin
613                 bf_modifiers
614                 bf_blenkernel
615                 bf_nodes
616                 bf_gpu
617                 bf_blenloader
618                 bf_blenlib
619                 bf_intern_ghost
620                 bf_intern_string
621                 bf_blenpluginapi
622                 bf_imbuf
623                 bf_avi
624                 bf_imbuf_cineon
625                 bf_imbuf_openexr
626                 bf_imbuf_dds
627                 bf_readblenfile
628                 bf_collada
629                 bf_intern_bsp
630                 bf_intern_bop
631                 bf_gen_system
632                 bf_intern_decimate
633                 bf_intern_elbeem
634                 bf_intern_ik
635                 bf_intern_memutil
636                 bf_intern_guardedalloc
637                 bf_intern_ctr
638                 ge_blen_routines
639                 ge_converter
640                 ge_phys_dummy
641                 ge_phys_bullet
642                 bf_intern_smoke
643                 extern_minilzo
644                 extern_lzma
645                 ge_logic_ketsji
646                 ge_phys_common
647                 ge_logic
648                 ge_rasterizer
649                 ge_oglrasterizer
650                 ge_logic_expressions
651                 ge_scenegraph
652                 ge_logic_network
653                 bf_gen_system
654                 bf_python # duplicate for BPY_driver_exec
655                 ge_logic_ngnetwork
656                 extern_bullet
657                 ge_logic_loopbacknetwork
658                 bf_intern_moto
659                 extern_glew
660                 extern_openjpeg
661                 extern_redcode
662                 ge_videotex
663                 bf_rna
664                 bf_dna
665                 bf_blenfont
666                 bf_intern_audaspace
667                 bf_intern_mikktspace
668         )
669
670         if(WITH_BINRELOC)
671                 list(APPEND BLENDER_SORTED_LIBS extern_binreloc)
672         endif()
673
674         if(WITH_CXX_GUARDEDALLOC)
675                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
676         endif()
677
678         if(WITH_IK_ITASC)
679                 list(APPEND BLENDER_SORTED_LIBS bf_intern_itasc)
680         endif()
681
682         if(WITH_CODEC_QUICKTIME)
683                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
684         endif()
685
686         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
687                 set(REMLIB ${SORTLIB})
688                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
689                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
690                                 set(REMLIB "")
691                         endif()
692                 endforeach()
693                 if(REMLIB)
694                         # message(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
695                         list(APPEND REM_MSG ${REMLIB})
696                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
697                 endif()
698         endforeach()
699         if(REM_MSG)
700                 list(SORT REM_MSG)
701                 message(STATUS "Blender Skipping: (${REM_MSG})")
702         endif()
703         target_link_libraries(blender ${BLENDER_SORTED_LIBS})
704 #else()
705 #       target_link_libraries(blender ${BLENDER_LINK_LIBS})
706 #endif()
707
708 setup_liblinks(blender)