~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to .pc/0008-do_not_use_version_number_in_system_path.patch/source/creator/CMakeLists.txt

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- mode: cmake; indent-tabs-mode: t; -*-
 
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
setup_libdirs()
 
28
 
 
29
blender_include_dirs(
 
30
        ../../intern/guardedalloc
 
31
        ../blender/blenlib
 
32
        ../blender/blenkernel
 
33
        ../blender/blenloader
 
34
        ../blender/editors/include
 
35
        ../blender/makesrna
 
36
        ../blender/imbuf
 
37
        ../blender/render/extern/include
 
38
        ../blender/makesdna
 
39
        ../blender/gpu
 
40
        ../blender/windowmanager
 
41
)
 
42
 
 
43
if(WIN32)
 
44
        blender_include_dirs(../../intern/utfconv)
 
45
endif()
 
46
 
 
47
if(WITH_LIBMV)
 
48
        blender_include_dirs(../../extern/libmv)
 
49
        add_definitions(-DWITH_LIBMV)
 
50
endif()
 
51
 
 
52
if(WITH_CODEC_FFMPEG)
 
53
        add_definitions(-DWITH_FFMPEG)
 
54
endif()
 
55
 
 
56
if(WITH_PYTHON)
 
57
        blender_include_dirs(../blender/python)
 
58
        add_definitions(-DWITH_PYTHON)
 
59
 
 
60
        if(WITH_PYTHON_SECURITY)
 
61
                add_definitions(-DWITH_PYTHON_SECURITY)
 
62
        endif()
 
63
endif()
 
64
 
 
65
if(WITH_HEADLESS)
 
66
        add_definitions(-DWITH_HEADLESS)
 
67
endif()
 
68
 
 
69
if(WITH_GAMEENGINE)
 
70
        blender_include_dirs(../gameengine/BlenderRoutines)
 
71
 
 
72
        add_definitions(-DWITH_GAMEENGINE)
 
73
endif()
 
74
 
 
75
if(WITH_SDL)
 
76
        add_definitions(-DWITH_SDL)
 
77
endif()
 
78
 
 
79
if(WITH_BINRELOC)
 
80
        add_definitions(-DWITH_BINRELOC)
 
81
        blender_include_dirs(${BINRELOC_INCLUDE_DIRS})
 
82
endif()
 
83
 
 
84
# Setup the exe sources and buildinfo
 
85
set(SRC
 
86
        creator.c
 
87
)
 
88
 
 
89
# MSVC 2010 gives linking errors with the manifest
 
90
if(WIN32 AND NOT UNIX)
 
91
        string(SUBSTRING ${BLENDER_VERSION} 0 1 bver1)
 
92
        string(SUBSTRING ${BLENDER_VERSION} 2 1 bver2)
 
93
        string(SUBSTRING ${BLENDER_VERSION} 3 1 bver3)
 
94
        if(MINGW)
 
95
                add_definitions(
 
96
                        -DWINDRES
 
97
                        -DBLEN_VER_RC_STR_M=${BLENDER_VERSION}
 
98
                        -DBLEN_VER_RC_1=${bver1}
 
99
                        -DBLEN_VER_RC_2=${bver2}
 
100
                        -DBLEN_VER_RC_3=${bver3}
 
101
                        -DBLEN_VER_RC_4=0
 
102
                )
 
103
        else()
 
104
                add_definitions(
 
105
                        -DBLEN_VER_RC_STR=${BLENDER_VERSION}
 
106
                        -DBLEN_VER_RC_1=${bver1}
 
107
                        -DBLEN_VER_RC_2=${bver2}
 
108
                        -DBLEN_VER_RC_3=${bver3}
 
109
                        -DBLEN_VER_RC_4=0
 
110
                )
 
111
        endif()
 
112
 
 
113
 
 
114
        list(APPEND SRC
 
115
                ../icons/winblender.rc
 
116
        )
 
117
endif()
 
118
 
 
119
if(WITH_BUILDINFO)
 
120
        add_definitions(-DWITH_BUILDINFO)
 
121
        # --------------------------------------------------------------------------
 
122
        # These defines could all be moved into the header below
 
123
        string(REPLACE " " "\ " BUILDINFO_CFLAGS "${CMAKE_C_FLAGS}")
 
124
        string(REPLACE " " "\ " BUILDINFO_CXXFLAGS "${CMAKE_CXX_FLAGS}")
 
125
        string(REPLACE " " "\ " BUILDINFO_LINKFLAGS "${PLATFORM_LINKFLAGS}")
 
126
        add_definitions(
 
127
                # # define in header now, else these get out of date on rebuilds.
 
128
                # -DBUILD_DATE="${BUILD_DATE}"
 
129
                # -DBUILD_TIME="${BUILD_TIME}"
 
130
                # -DBUILD_REV="${BUILD_REV}"
 
131
                -DWITH_BUILDINFO_HEADER # alternative to lines above
 
132
                -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}"
 
133
                -DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
 
134
                -DBUILD_CFLAGS="${BUILDINFO_CFLAGS}"
 
135
                -DBUILD_CXXFLAGS="${BUILDINFO_CXXFLAGS}"
 
136
                -DBUILD_LINKFLAGS="${BUILDINFO_LINKFLAGS}"
 
137
                -DBUILD_SYSTEM="CMake"
 
138
        )
 
139
 
 
140
        # --------------------------------------------------------------------------
 
141
        # write header for values that change each build
 
142
        # note, generaed file is in build dir's source/creator
 
143
        #       except when used as an include path.
 
144
 
 
145
        # include the output directory, where the buildinfo.h file is generated
 
146
        include_directories(${CMAKE_BINARY_DIR}/source/creator)
 
147
 
 
148
        # a custom target that is always built
 
149
        add_custom_target(buildinfo ALL
 
150
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h)
 
151
 
 
152
        # creates svnheader.h using cmake script
 
153
        add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h
 
154
                COMMAND ${CMAKE_COMMAND}
 
155
                -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
 
156
                -P ${CMAKE_SOURCE_DIR}/build_files/cmake/buildinfo.cmake)
 
157
 
 
158
        # buildinfo.h is a generated file
 
159
        set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/buildinfo.h
 
160
                PROPERTIES GENERATED TRUE
 
161
                HEADER_FILE_ONLY TRUE)
 
162
 
 
163
        # add deps below, after adding blender
 
164
        # -------------- done with header values.
 
165
 
 
166
        list(APPEND SRC
 
167
                buildinfo.c
 
168
        )
 
169
endif()
 
170
 
 
171
# message(STATUS "Configuring blender")
 
172
if(WITH_PYTHON_MODULE)
 
173
        add_definitions(-DWITH_PYTHON_MODULE)
 
174
 
 
175
        # creates ./bin/bpy.so which can be imported as a python module.
 
176
        #
 
177
        # note that 'SHARED' works on Linux and Windows,
 
178
        # but not OSX which _must_ be 'MODULE'
 
179
        add_library(blender MODULE ${SRC})
 
180
        set_target_properties(
 
181
                blender
 
182
                PROPERTIES
 
183
                        PREFIX ""
 
184
                        OUTPUT_NAME bpy
 
185
                        LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
 
186
                        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin  # only needed on windows
 
187
        )
 
188
 
 
189
        if(APPLE)
 
190
                set_target_properties(
 
191
                        blender
 
192
                        PROPERTIES
 
193
                                LINK_FLAGS_RELEASE "${PLATFORM_LINKFLAGS}"
 
194
                                LINK_FLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG}"
 
195
                )
 
196
        endif()
 
197
 
 
198
        if(WIN32)
 
199
                # python modules use this
 
200
                set_target_properties(
 
201
                        blender
 
202
                        PROPERTIES
 
203
                        SUFFIX ".pyd"
 
204
                )
 
205
        endif()
 
206
 
 
207
else()
 
208
        add_executable(blender ${EXETYPE} ${SRC})
 
209
endif()
 
210
 
 
211
if(WITH_BUILDINFO)
 
212
        # explicitly say that the executable depends on the buildinfo
 
213
        add_dependencies(blender buildinfo)
 
214
endif()
 
215
 
 
216
# Post build steps for bundling/packaging.
 
217
 
 
218
 
 
219
if(MSVC_IDE)
 
220
        # ${CMAKE_CFG_INTDIR} should replace \${BUILD_TYPE} when using add_command
 
221
        set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
 
222
elseif(APPLE)
 
223
        set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
 
224
else()
 
225
        set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH})
 
226
endif()
 
227
 
 
228
set(BLENDER_TEXT_FILES
 
229
        ${CMAKE_SOURCE_DIR}/release/text/copyright.txt
 
230
        ${CMAKE_SOURCE_DIR}/release/text/readme.html
 
231
)
 
232
 
 
233
 
 
234
# -----------------------------------------------------------------------------
 
235
# Platform Specific Var: TARGETDIR_VER
 
236
 
 
237
if(UNIX AND NOT APPLE)
 
238
        if(WITH_INSTALL_PORTABLE)
 
239
                set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
 
240
        else()
 
241
                if(WITH_PYTHON_MODULE)
 
242
                        set(TARGETDIR_VER ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${BLENDER_VERSION})
 
243
                else()
 
244
                        set(TARGETDIR_VER ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
 
245
                endif()
 
246
        endif()
 
247
 
 
248
elseif(WIN32)
 
249
        set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
 
250
 
 
251
elseif(APPLE)
 
252
        if(WITH_PYTHON_MODULE)
 
253
                set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
 
254
        else()
 
255
                set(TARGETDIR_VER ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION})
 
256
        endif()
 
257
 
 
258
endif()
 
259
 
 
260
 
 
261
# -----------------------------------------------------------------------------
 
262
# Install Targets (Generic, All Platforms)
 
263
 
 
264
 
 
265
# important to make a clean  install each time, else old scripts get loaded.
 
266
install(
 
267
        CODE
 
268
        "file(REMOVE_RECURSE ${TARGETDIR_VER})"
 
269
)
 
270
 
 
271
if(WITH_PYTHON)
 
272
        # install(CODE "message(\"copying blender scripts...\")")
 
273
        
 
274
        # exclude addons_contrib if release
 
275
        if("${BLENDER_VERSION_CYCLE}" STREQUAL "release")
 
276
                set(ADDON_EXCLUDE_CONDITIONAL "addons_contrib/*")
 
277
        else()
 
278
                set(ADDON_EXCLUDE_CONDITIONAL "_addons_contrib/*")  # dummy, wont do anything
 
279
        endif()
 
280
 
 
281
        install(
 
282
                DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts/
 
283
                DESTINATION ${CMAKE_INSTALL_PREFIX}/share/blender/scripts/
 
284
                PATTERN ".svn" EXCLUDE
 
285
                PATTERN "__pycache__" EXCLUDE
 
286
                PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE
 
287
        )
 
288
        
 
289
        unset(ADDON_EXCLUDE_CONDITIONAL)
 
290
endif()
 
291
 
 
292
# localization
 
293
if(WITH_INTERNATIONAL)
 
294
        install(
 
295
                DIRECTORY
 
296
                        ${CMAKE_SOURCE_DIR}/release/datafiles/locale/
 
297
                        ${CMAKE_SOURCE_DIR}/release/datafiles/fonts
 
298
                DESTINATION ${CMAKE_INSTALL_PREFIX}/share/locale
 
299
                PATTERN ".svn" EXCLUDE
 
300
        )
 
301
endif()
 
302
 
 
303
# helpful tip when using make
 
304
if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*")
 
305
        # message after building.
 
306
        add_custom_command(
 
307
                TARGET blender POST_BUILD MAIN_DEPENDENCY blender
 
308
                COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files and scripts to ${TARGETDIR_VER}'
 
309
        )
 
310
endif()
 
311
 
 
312
 
 
313
# -----------------------------------------------------------------------------
 
314
# Install Targets (Platform Specific)
 
315
 
 
316
if(UNIX AND NOT APPLE)
 
317
 
 
318
        # there are a few differences between portable and system install
 
319
        if(WITH_INSTALL_PORTABLE)
 
320
                install(
 
321
                        FILES
 
322
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
 
323
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
 
324
                                ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
 
325
                                ${CMAKE_SOURCE_DIR}/doc/manpage/blenderplayer.1
 
326
                        DESTINATION ${TARGETDIR}
 
327
                )
 
328
 
 
329
                install(
 
330
                        PROGRAMS
 
331
                        ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
 
332
                        DESTINATION ${TARGETDIR}
 
333
                )
 
334
 
 
335
                install(
 
336
                        FILES ${BLENDER_TEXT_FILES}
 
337
                        DESTINATION ${TARGETDIR}
 
338
                )
 
339
 
 
340
        else()
 
341
                # main blender binary
 
342
                if(WITH_PYTHON_MODULE)
 
343
                        install(
 
344
                                TARGETS blender
 
345
                                LIBRARY
 
346
                                DESTINATION ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages
 
347
                        )
 
348
                else()
 
349
                        install(
 
350
                                PROGRAMS ${TARGETDIR}/blender
 
351
                                DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
 
352
                        )
 
353
                endif()
 
354
 
 
355
 
 
356
                if(WITH_GAMEENGINE AND WITH_PLAYER)
 
357
                        install(
 
358
                                PROGRAMS ${TARGETDIR}/blenderplayer
 
359
                                DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
 
360
                        )
 
361
                endif()
 
362
 
 
363
                # misc files
 
364
                install(
 
365
                        FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
 
366
                        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
 
367
                )
 
368
                install(
 
369
                        DIRECTORY
 
370
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/16x16
 
371
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/22x22
 
372
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/24x24
 
373
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/32x32
 
374
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/48x48
 
375
                                ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/256x256
 
376
                        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor
 
377
                        PATTERN ".svn" EXCLUDE
 
378
                        PATTERN "*.svg" EXCLUDE
 
379
                )
 
380
                install(
 
381
                        FILES ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
 
382
                        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps
 
383
                )
 
384
                install(
 
385
                        PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
 
386
                        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/blender/scripts
 
387
                )
 
388
                install(
 
389
                        FILES
 
390
                                ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
 
391
                                ${CMAKE_SOURCE_DIR}/doc/manpage/blenderplayer.1
 
392
                        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
 
393
                )
 
394
                install(
 
395
                        FILES ${BLENDER_TEXT_FILES}
 
396
                        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
 
397
                )
 
398
        endif()
 
399
 
 
400
                # plugins in blender 2.6 don't work at the moment.
 
401
                #
 
402
                # install(
 
403
                #       DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
 
404
                #       DESTINATION ${TARGETDIR_VER}
 
405
                #       PATTERN ".svn" EXCLUDE
 
406
                # )
 
407
 
 
408
        if(WITH_PYTHON)
 
409
                if(WITH_PYTHON_INSTALL)
 
410
                        # on some platforms (like openSUSE) Python is linked
 
411
                        # to be used from lib64 folder.
 
412
                        # determine this from Python's libraries path
 
413
                        if(${PYTHON_LIBPATH} MATCHES "lib64$")
 
414
                                set(_target_LIB "lib64")
 
415
                        else()
 
416
                                set(_target_LIB "lib")
 
417
                        endif()
 
418
 
 
419
                        # Copy the systems python into the install directory
 
420
                        # Scons copy in tools/Blender.py
 
421
                        # install(CODE "message(\"copying a subset of the systems python...\")")
 
422
                        install(
 
423
                                DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}
 
424
                                DESTINATION ${TARGETDIR_VER}/python/${_target_LIB}
 
425
                                PATTERN ".svn" EXCLUDE
 
426
                                PATTERN "__pycache__" EXCLUDE               # * any cache *
 
427
                                PATTERN "distutils" EXCLUDE                 # ./distutils
 
428
                                PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
 
429
                                PATTERN "config" EXCLUDE                    # ./config
 
430
                                PATTERN "config-*" EXCLUDE                  # ./config-*
 
431
                                PATTERN "site-packages/*" EXCLUDE           # ./site-packages/*
 
432
                                PATTERN "tkinter" EXCLUDE                   # ./tkinter
 
433
                                PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
 
434
                                PATTERN "idlelib" EXCLUDE                   # ./idlelib
 
435
                                PATTERN "test" EXCLUDE                      # ./test
 
436
                                PATTERN "turtledemo" EXCLUDE                # ./turtledemo
 
437
                                PATTERN "turtle.py" EXCLUDE                                     # ./turtle.py
 
438
                        )
 
439
 
 
440
                        # # doesnt work, todo
 
441
                        # install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
 
442
                        unset(_target_LIB)
 
443
                endif()
 
444
        endif()
 
445
elseif(WIN32)
 
446
 
 
447
        install(
 
448
                FILES ${BLENDER_TEXT_FILES}
 
449
                DESTINATION ${TARGETDIR}
 
450
        )
 
451
 
 
452
        if(WITH_INTERNATIONAL AND (NOT WITH_MINGW64))
 
453
                install(
 
454
                        FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
 
455
                        DESTINATION ${TARGETDIR}
 
456
                )
 
457
 
 
458
                if(NOT CMAKE_CL_64)
 
459
                        install(
 
460
                                FILES ${LIBDIR}/iconv/lib/iconv.dll
 
461
                                DESTINATION ${TARGETDIR}
 
462
                        )
 
463
                endif()
 
464
        endif()
 
465
 
 
466
        # plugins in blender 2.6 don't work at the moment.
 
467
        #
 
468
        # install(
 
469
        #       DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
 
470
        #       DESTINATION ${TARGETDIR_VER}
 
471
        #       PATTERN ".svn" EXCLUDE
 
472
        # )
 
473
 
 
474
        if(WITH_PYTHON)
 
475
                set_lib_path(PYLIB "python/lib")
 
476
                install(
 
477
                        FILES ${PYLIB}/python32.dll
 
478
                        DESTINATION ${TARGETDIR}
 
479
                        CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
 
480
                )
 
481
 
 
482
                install(
 
483
                        FILES ${PYLIB}/python32_d.dll
 
484
                        DESTINATION ${TARGETDIR}
 
485
                        CONFIGURATIONS Debug
 
486
                )
 
487
 
 
488
                if(WITH_PYTHON_INSTALL)
 
489
                        # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
 
490
 
 
491
                        # create the directory in multiple steps, so it actually gets created when it doesn't exist yet
 
492
                        install(
 
493
                                CODE
 
494
                                "
 
495
                                message(\"creating ${TARGETDIR_VER}/python/lib\")
 
496
                                file(MAKE_DIRECTORY \"${TARGETDIR_VER}/python\")
 
497
                                file(MAKE_DIRECTORY \"${TARGETDIR_VER}/python/lib\")
 
498
                                message(\"done creating dir\")
 
499
                                "
 
500
                        )
 
501
 
 
502
                        install(
 
503
                                CODE
 
504
                                "
 
505
                                if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" STREQUAL \"Debug\")
 
506
                                        execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
 
507
                                                \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32_d.tar.gz\")
 
508
                                else()
 
509
                                        execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
 
510
                                                \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
 
511
                                endif()
 
512
                                "
 
513
                        )
 
514
 
 
515
                        # doesnt work, todo
 
516
                        # install(CODE "execute_process(COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/ -name '*.so' -exec strip -s {} '\;')")
 
517
                endif()
 
518
        endif()
 
519
 
 
520
        if(CMAKE_CL_64)
 
521
                # gettext and png are statically linked on win64
 
522
                install(
 
523
                        FILES ${LIBDIR}/zlib/lib/zlib.dll
 
524
                        DESTINATION ${TARGETDIR}
 
525
                )
 
526
        else()
 
527
                #not needed since we link statically, maybe also unneeded for MinGW?
 
528
                if(NOT WITH_MINGW64)
 
529
                        install(
 
530
                                FILES
 
531
                                        ${LIBDIR}/zlib/lib/zlib.dll
 
532
                                DESTINATION ${TARGETDIR}
 
533
                        )
 
534
                endif()
 
535
        endif()
 
536
 
 
537
        if(MSVC)
 
538
                install(
 
539
                        FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
 
540
                        DESTINATION ${TARGETDIR}
 
541
                )
 
542
        else()
 
543
                #MinGW64 comes with own version. For portable builds it will probaly have to be copied to work
 
544
                if(NOT WITH_MINGW64)
 
545
                        install(
 
546
                                FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
 
547
                                DESTINATION ${TARGETDIR}
 
548
                        )
 
549
                endif()
 
550
        endif()
 
551
 
 
552
        if(WITH_CODEC_FFMPEG)
 
553
                install(
 
554
                        FILES
 
555
                                ${LIBDIR}/ffmpeg/lib/avcodec-53.dll
 
556
                                ${LIBDIR}/ffmpeg/lib/avformat-53.dll
 
557
                                ${LIBDIR}/ffmpeg/lib/avdevice-53.dll
 
558
                                ${LIBDIR}/ffmpeg/lib/avutil-51.dll
 
559
                                ${LIBDIR}/ffmpeg/lib/swscale-2.dll
 
560
                        DESTINATION ${TARGETDIR}
 
561
                )
 
562
 
 
563
        endif()
 
564
 
 
565
        if(WITH_CODEC_SNDFILE)
 
566
                install(
 
567
                        FILES ${LIBDIR}/sndfile/lib/libsndfile-1.dll
 
568
                        DESTINATION ${TARGETDIR}
 
569
                )
 
570
        endif()
 
571
 
 
572
        if(WITH_OPENAL)
 
573
                install(
 
574
                        FILES
 
575
                                ${LIBDIR}/openal/lib/OpenAL32.dll
 
576
                                ${LIBDIR}/openal/lib/wrap_oal.dll
 
577
                        DESTINATION ${TARGETDIR}
 
578
                )
 
579
        endif()
 
580
 
 
581
        if(WITH_SDL)
 
582
                if(NOT CMAKE_CL_64)
 
583
                        install(
 
584
                                FILES ${LIBDIR}/sdl/lib/SDL.dll
 
585
                                DESTINATION ${TARGETDIR}
 
586
                        )
 
587
                endif()
 
588
        endif()
 
589
 
 
590
        if(NOT CMAKE_CL_64)
 
591
                install(
 
592
                        FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll
 
593
                        DESTINATION ${TARGETDIR}
 
594
                )
 
595
        endif()
 
596
                
 
597
        install( # x86 builds can run on x64 Windows, so this is required at all times
 
598
                FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
 
599
                DESTINATION ${TARGETDIR}
 
600
        )       
 
601
 
 
602
        if(WITH_OPENIMAGEIO)
 
603
                if(NOT MINGW)
 
604
                        set_lib_path(OIIOBIN "openimageio/bin")
 
605
                        install(
 
606
                                FILES
 
607
                                        ${OIIOBIN}/OpenImageIO.dll
 
608
                                DESTINATION ${TARGETDIR}
 
609
                        )
 
610
                endif()
 
611
        endif()
 
612
 
 
613
elseif(APPLE)
 
614
 
 
615
        # handy install macro to exclude files, we use \$ escape for the "to"
 
616
        # argument when calling so ${BUILD_TYPE} does not get expanded
 
617
        macro(install_dir from to)
 
618
                install(
 
619
                        DIRECTORY ${from}
 
620
                        DESTINATION ${to}
 
621
                        PATTERN ".svn" EXCLUDE
 
622
                        PATTERN "*.pyc" EXCLUDE
 
623
                        PATTERN "*.pyo" EXCLUDE
 
624
                        PATTERN "*.orig" EXCLUDE
 
625
                        PATTERN "*.rej" EXCLUDE
 
626
                        PATTERN "__pycache__" EXCLUDE
 
627
                        PATTERN "__MACOSX" EXCLUDE
 
628
                        PATTERN ".DS_Store" EXCLUDE
 
629
                )
 
630
        endmacro()
 
631
 
 
632
        set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
 
633
 
 
634
        # setup Info.plist
 
635
        execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
 
636
 
 
637
        set_target_properties(blender PROPERTIES
 
638
                MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist
 
639
                MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
 
640
                MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
 
641
 
 
642
 
 
643
        # install release and app files
 
644
        install(
 
645
                FILES ${BLENDER_TEXT_FILES}
 
646
                DESTINATION ${TARGETDIR}
 
647
        )
 
648
 
 
649
        install(
 
650
                FILES ${OSX_APP_SOURCEDIR}/Contents/PkgInfo
 
651
                DESTINATION ${TARGETDIR}/blender.app/Contents
 
652
        )
 
653
 
 
654
        install_dir(
 
655
                ${OSX_APP_SOURCEDIR}/Contents/Resources
 
656
                \${TARGETDIR}/blender.app/Contents/
 
657
        )
 
658
 
 
659
        # python
 
660
        if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE)
 
661
                # the python zip is first extract as part of the build process,
 
662
                # and then later installed as part of make install. this is much
 
663
                # quicker, and means we can easily exclude files on copy
 
664
                # Not needed for PYTHON_MODULE or WEB_PLUGIN due uses  Pyhon framework
 
665
                add_custom_target(
 
666
                        extractpyzip
 
667
                        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/python)
 
668
 
 
669
                set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip")
 
670
 
 
671
                add_custom_command(
 
672
                        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
 
673
                        COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/
 
674
                        COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/
 
675
                        COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/
 
676
                        DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
 
677
 
 
678
                add_dependencies(blender extractpyzip)
 
679
 
 
680
                # copy extracted python files
 
681
                install_dir(
 
682
                        ${CMAKE_CURRENT_BINARY_DIR}/python
 
683
                        \${TARGETDIR_VER}
 
684
                )
 
685
 
 
686
        endif()
 
687
 
 
688
        # install blenderplayer bundle - copy of blender.app above. re-using macros et al
 
689
        # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it
 
690
        if(WITH_GAMEENGINE AND WITH_PLAYER)
 
691
                set(OSX_APP_PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app)
 
692
                set(PLAYER_SOURCEINFO ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Info.plist)
 
693
                set(PLAYER_TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION})
 
694
 
 
695
 
 
696
                # important to make a clean  install each time else old scripts get loaded.
 
697
                install(
 
698
                        CODE
 
699
                        "file(REMOVE_RECURSE ${PLAYER_TARGETDIR_VER})"
 
700
                )
 
701
 
 
702
                install(
 
703
                        FILES ${OSX_APP_PLAYER_SOURCEDIR}/Contents/PkgInfo
 
704
                        DESTINATION ${TARGETDIR}/blenderplayer.app/Contents
 
705
                )
 
706
 
 
707
                install_dir(
 
708
                        ${OSX_APP_PLAYER_SOURCEDIR}/Contents/Resources
 
709
                        \${TARGETDIR}/blenderplayer.app/Contents/
 
710
                )
 
711
 
 
712
                # python
 
713
                if(WITH_PYTHON)
 
714
                        add_custom_command(
 
715
                                OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python
 
716
                                COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/
 
717
                                COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/
 
718
                                COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/
 
719
                                DEPENDS ${LIBDIR}/release/${PYTHON_ZIP})
 
720
 
 
721
                        # copy extracted python files
 
722
                        install_dir(
 
723
                                ${CMAKE_CURRENT_BINARY_DIR}/python
 
724
                                \${PLAYER_TARGETDIR_VER}
 
725
                        )
 
726
                endif()
 
727
 
 
728
        endif()
 
729
endif()
 
730
 
 
731
# -----------------------------------------------------------------------------
 
732
# Generic Install, for all targets
 
733
 
 
734
 
 
735
 
 
736
# install more files specified elsewhere
 
737
delayed_do_install(${TARGETDIR_VER})
 
738
 
 
739
unset(BLENDER_TEXT_FILES)
 
740
 
 
741
 
 
742
# -----------------------------------------------------------------------------
 
743
# Setup link libs
 
744
 
 
745
add_dependencies(blender makesdna)
 
746
 
 
747
get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
 
748
 
 
749
set(BLENDER_LINK_LIBS
 
750
        ${BLENDER_LINK_LIBS}
 
751
        bf_windowmanager
 
752
        bf_render
 
753
)
 
754
 
 
755
if(WITH_MOD_FLUID)
 
756
        list(APPEND BLENDER_LINK_LIBS bf_intern_elbeem)
 
757
endif()
 
758
 
 
759
if(WITH_CYCLES)
 
760
        list(APPEND BLENDER_LINK_LIBS
 
761
                cycles_render
 
762
                cycles_bvh
 
763
                cycles_device
 
764
                cycles_kernel
 
765
                cycles_util
 
766
                cycles_subd)
 
767
endif()
 
768
 
 
769
#if(UNIX)
 
770
        # Sort libraries
 
771
        set(BLENDER_SORTED_LIBS
 
772
                bf_windowmanager
 
773
 
 
774
                bf_editor_space_api
 
775
                bf_editor_space_action
 
776
                bf_editor_space_buttons
 
777
                bf_editor_space_console
 
778
                bf_editor_space_file
 
779
                bf_editor_space_graph
 
780
                bf_editor_space_image
 
781
                bf_editor_space_info
 
782
                bf_editor_space_logic
 
783
                bf_editor_space_nla
 
784
                bf_editor_space_node
 
785
                bf_editor_space_outliner
 
786
                bf_editor_space_script
 
787
                bf_editor_space_sequencer
 
788
                bf_editor_space_time
 
789
                bf_editor_space_userpref
 
790
                bf_editor_space_view3d
 
791
                bf_editor_space_clip
 
792
 
 
793
                bf_editor_text
 
794
                bf_editor_transform
 
795
                bf_editor_util
 
796
                bf_editor_uvedit
 
797
                bf_editor_curve
 
798
                bf_editor_armature
 
799
                bf_editor_gpencil
 
800
                bf_editor_interface
 
801
                bf_editor_mesh
 
802
                bf_editor_metaball
 
803
                bf_editor_object
 
804
                bf_editor_physics
 
805
                bf_editor_render
 
806
                bf_editor_screen
 
807
                bf_editor_sculpt_paint
 
808
                bf_editor_sound
 
809
                bf_editor_animation
 
810
                bf_editor_datafiles
 
811
 
 
812
                bf_render
 
813
                bf_intern_opennl
 
814
                bf_python
 
815
                bf_python_ext
 
816
                bf_python_mathutils
 
817
                bf_python_bmesh
 
818
                bf_ikplugin
 
819
                bf_modifiers
 
820
                bf_bmesh
 
821
                bf_blenkernel
 
822
                bf_nodes
 
823
                bf_gpu
 
824
                bf_blenloader
 
825
                bf_imbuf
 
826
                bf_blenlib
 
827
                bf_intern_ghost
 
828
                bf_intern_string
 
829
                bf_blenpluginapi
 
830
                bf_avi
 
831
                bf_imbuf_cineon
 
832
                bf_imbuf_openexr
 
833
                bf_imbuf_dds
 
834
                bf_collada
 
835
                bf_intern_bsp
 
836
                bf_intern_bop
 
837
                bf_intern_decimate
 
838
                bf_intern_elbeem
 
839
                bf_intern_ik
 
840
                bf_intern_memutil
 
841
                bf_intern_guardedalloc
 
842
                bf_intern_ctr
 
843
                bf_intern_utfconv
 
844
                ge_blen_routines
 
845
                ge_converter
 
846
                ge_phys_dummy
 
847
                ge_phys_bullet
 
848
                bf_intern_smoke
 
849
                extern_minilzo
 
850
                extern_lzma
 
851
                extern_colamd
 
852
                ge_logic_ketsji
 
853
                extern_recastnavigation
 
854
                ge_phys_common
 
855
                ge_logic
 
856
                ge_rasterizer
 
857
                ge_oglrasterizer
 
858
                ge_logic_expressions
 
859
                ge_scenegraph
 
860
                ge_logic_network
 
861
                ge_logic_ngnetwork
 
862
                extern_bullet
 
863
                ge_logic_loopbacknetwork
 
864
                bf_intern_moto
 
865
                extern_openjpeg
 
866
                extern_redcode
 
867
                ge_videotex
 
868
                bf_rna
 
869
                bf_dna
 
870
                bf_blenfont
 
871
                bf_intern_audaspace
 
872
                bf_intern_mikktspace
 
873
                bf_intern_dualcon
 
874
                bf_intern_cycles
 
875
                cycles_render
 
876
                cycles_bvh
 
877
                cycles_device
 
878
                cycles_kernel
 
879
                cycles_util
 
880
                cycles_subd
 
881
        )
 
882
 
 
883
        if(WITH_LIBMV)
 
884
                list(APPEND BLENDER_SORTED_LIBS extern_libmv)
 
885
        endif()
 
886
 
 
887
        if(WITH_MOD_CLOTH_ELTOPO)
 
888
                list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
 
889
        endif()
 
890
 
 
891
        if(WITH_BUILTIN_GLEW)
 
892
                list(APPEND BLENDER_SORTED_LIBS extern_glew)
 
893
        endif()
 
894
 
 
895
        if(WITH_BINRELOC)
 
896
                list(APPEND BLENDER_SORTED_LIBS extern_binreloc)
 
897
        endif()
 
898
 
 
899
        if(WITH_CXX_GUARDEDALLOC)
 
900
                list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
 
901
        endif()
 
902
 
 
903
        if(WITH_IK_ITASC)
 
904
                list(APPEND BLENDER_SORTED_LIBS bf_intern_itasc)
 
905
        endif()
 
906
 
 
907
        if(WITH_CODEC_QUICKTIME)
 
908
                list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
 
909
        endif()
 
910
 
 
911
        if(WITH_CARVE)
 
912
                list(APPEND BLENDER_SORTED_LIBS extern_carve)
 
913
        endif()
 
914
 
 
915
        if(WITH_GHOST_XDND)
 
916
                list(APPEND BLENDER_SORTED_LIBS extern_xdnd)
 
917
        endif()
 
918
 
 
919
        foreach(SORTLIB ${BLENDER_SORTED_LIBS})
 
920
                set(REMLIB ${SORTLIB})
 
921
                foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
 
922
                        if(${SEARCHLIB} STREQUAL ${SORTLIB})
 
923
                                set(REMLIB "")
 
924
                        endif()
 
925
                endforeach()
 
926
                if(REMLIB)
 
927
                        # message(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
 
928
                        list(APPEND REM_MSG ${REMLIB})
 
929
                        list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
 
930
                endif()
 
931
        endforeach()
 
932
        if(REM_MSG)
 
933
                list(SORT REM_MSG)
 
934
                message(STATUS "Blender Skipping: (${REM_MSG})")
 
935
        endif()
 
936
        target_link_libraries(blender ${BLENDER_SORTED_LIBS})
 
937
 
 
938
        unset(SEARCHLIB)
 
939
        unset(SORTLIB)
 
940
        unset(REMLIB)
 
941
        unset(REM_MSG)
 
942
 
 
943
#else()
 
944
#       target_link_libraries(blender ${BLENDER_LINK_LIBS})
 
945
#endif()
 
946
 
 
947
setup_liblinks(blender)