~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

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