2004-08-04 22:00:41 +00:00
#!/usr/bin/env python
2011-10-23 19:54:06 +00:00
#
2008-04-16 22:40:48 +00:00
# ***** BEGIN GPL LICENSE BLOCK *****
2006-02-04 14:15:10 +00:00
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
2008-04-16 22:40:48 +00:00
# of the License, or (at your option) any later version.
2006-02-04 14:15:10 +00:00
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
2012-12-17 08:01:43 +00:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2006-02-04 14:15:10 +00:00
#
2006-02-25 14:53:27 +00:00
# The Original Code is Copyright (C) 2006, Blender Foundation
2006-02-04 14:15:10 +00:00
# All rights reserved.
#
2006-02-25 14:53:27 +00:00
# The Original Code is: all of this file.
2006-02-04 14:15:10 +00:00
#
# Contributor(s): Nathan Letwory.
#
2008-04-16 22:40:48 +00:00
# ***** END GPL LICENSE BLOCK *****
2006-02-04 14:15:10 +00:00
#
# Main entry-point for the SCons building system
# Set up some custom actions and target/argument handling
# Then read all SConscripts and build
2011-01-17 10:43:51 +00:00
#
2011-01-17 10:47:31 +00:00
# TODO: fix /FORCE:MULTIPLE on windows to get proper debug builds.
2011-10-23 19:54:06 +00:00
# TODO: directory copy functions are far too complicated, see:
# http://wiki.blender.org/index.php/User:Ideasman42/SConsNotSimpleInstallingFiles
2004-01-04 21:11:59 +00:00
2006-02-04 14:15:10 +00:00
import sys
import os
import os . path
import string
import shutil
2006-02-07 21:24:36 +00:00
import re
2006-02-04 14:15:10 +00:00
2014-05-01 23:52:56 +00:00
# store path to tools and modules
2010-07-19 09:02:27 +00:00
toolpath = os . path . join ( " . " , " build_files " , " scons " , " tools " )
2014-05-01 23:52:56 +00:00
modulespath = os . path . join ( " . " , " build_files " , " scons " , " Modules " )
2010-07-19 09:02:27 +00:00
2014-05-01 23:52:56 +00:00
# needed for importing tools and modules
2010-07-19 09:02:27 +00:00
sys . path . append ( toolpath )
2014-05-01 23:52:56 +00:00
sys . path . append ( modulespath )
2010-07-12 18:26:35 +00:00
2010-07-14 16:38:09 +00:00
import Blender
import btools
2006-02-04 14:15:10 +00:00
2008-10-30 23:55:07 +00:00
EnsureSConsVersion ( 1 , 0 , 0 )
2011-02-18 09:39:15 +00:00
# Before we do anything, let's check if we have a sane os.environ
if not btools . check_environ ( ) :
Exit ( )
2010-07-14 16:38:09 +00:00
BlenderEnvironment = Blender . BlenderEnvironment
B = Blender
2006-02-04 14:15:10 +00:00
2010-07-14 16:38:09 +00:00
VERSION = btools . VERSION # This is used in creating the local config directories
2011-11-17 19:43:59 +00:00
VERSION_RELEASE_CYCLE = btools . VERSION_RELEASE_CYCLE
2010-07-05 07:06:19 +00:00
2006-02-04 14:15:10 +00:00
### globals ###
platform = sys . platform
quickie = None
2006-03-17 16:38:39 +00:00
quickdebug = None
2006-02-04 14:15:10 +00:00
##### BEGIN SETUP #####
2014-08-05 07:57:50 +00:00
B . possible_types = [ ' core ' , ' player ' , ' player2 ' , ' intern ' , ' extern ' , ' system ' ]
2006-02-04 14:15:10 +00:00
2006-02-05 11:28:28 +00:00
B . binarykind = [ ' blender ' , ' blenderplayer ' ]
2006-02-04 14:15:10 +00:00
##################################
# target and argument validation #
##################################
# XX cheating for BF_FANCY, we check for BF_FANCY before args are validated
use_color = ARGUMENTS . get ( ' BF_FANCY ' , ' 1 ' )
if platform == ' win32 ' :
2010-08-29 20:52:05 +00:00
use_color = None
2006-02-04 14:15:10 +00:00
if not use_color == ' 1 ' :
2010-08-29 20:52:05 +00:00
B . bc . disable ( )
2012-08-10 08:19:45 +00:00
2007-05-19 22:57:28 +00:00
#on defaut white Os X terminal, some colors are totally unlegible
if platform == ' darwin ' :
2010-08-29 20:52:05 +00:00
B . bc . OKGREEN = ' \033 [34m '
B . bc . WARNING = ' \033 [36m '
2006-02-04 14:15:10 +00:00
# arguments
print B . bc . HEADER + ' Command-line arguments ' + B . bc . ENDC
B . arguments = btools . validate_arguments ( ARGUMENTS , B . bc )
btools . print_arguments ( B . arguments , B . bc )
# targets
print B . bc . HEADER + ' Command-line targets ' + B . bc . ENDC
B . targets = btools . validate_targets ( COMMAND_LINE_TARGETS , B . bc )
btools . print_targets ( B . targets , B . bc )
##########################
# setting up environment #
##########################
# handling cmd line arguments & config file
2011-08-02 18:33:39 +00:00
# bitness stuff
2014-02-04 17:55:32 +00:00
tempbitness = int ( B . arguments . get ( ' BF_BITNESS ' , B . bitness ) ) # default to bitness found as per starting python
if tempbitness in B . allowed_bitnesses . values ( ) :
2011-12-08 19:16:43 +00:00
B . bitness = tempbitness
2012-08-10 08:19:45 +00:00
2006-02-04 14:15:10 +00:00
# first check cmdline for toolset and we create env to work on
quickie = B . arguments . get ( ' BF_QUICK ' , None )
2006-03-17 16:38:39 +00:00
quickdebug = B . arguments . get ( ' BF_QUICKDEBUG ' , None )
if quickdebug :
2010-08-29 20:52:05 +00:00
B . quickdebug = string . split ( quickdebug , ' , ' )
2006-03-17 16:38:39 +00:00
else :
2010-08-29 20:52:05 +00:00
B . quickdebug = [ ]
2006-10-18 05:45:47 +00:00
2006-02-04 14:15:10 +00:00
if quickie :
2010-08-29 20:52:05 +00:00
B . quickie = string . split ( quickie , ' , ' )
2004-08-04 22:00:41 +00:00
else :
2010-08-29 20:52:05 +00:00
B . quickie = [ ]
2012-08-10 08:19:45 +00:00
2006-02-04 14:15:10 +00:00
toolset = B . arguments . get ( ' BF_TOOLSET ' , None )
2014-08-07 08:06:13 +00:00
vcver = B . arguments . get ( ' MSVS_VERSION ' , ' 12.0 ' )
2013-06-18 11:55:32 +00:00
2006-02-04 14:15:10 +00:00
if toolset :
2010-08-29 20:52:05 +00:00
print " Using " + toolset
if toolset == ' mstoolkit ' :
env = BlenderEnvironment ( ENV = os . environ )
env . Tool ( ' mstoolkit ' , [ toolpath ] )
else :
env = BlenderEnvironment ( tools = [ toolset ] , ENV = os . environ )
2012-01-17 10:32:17 +00:00
if env :
btools . SetupSpawn ( env )
2004-07-18 19:02:56 +00:00
else :
2014-02-04 17:55:32 +00:00
if B . bitness == 64 and platform == ' win32 ' :
2013-06-18 11:55:32 +00:00
env = BlenderEnvironment ( ENV = os . environ , MSVS_ARCH = ' amd64 ' , TARGET_ARCH = ' x86_64 ' , MSVC_VERSION = vcver )
2010-08-29 20:52:05 +00:00
else :
2013-06-18 11:55:32 +00:00
env = BlenderEnvironment ( ENV = os . environ , TARGET_ARCH = ' x86 ' , MSVC_VERSION = vcver )
2004-01-04 21:11:59 +00:00
2006-02-04 14:15:10 +00:00
if not env :
2010-08-29 20:52:05 +00:00
print " Could not create a build environment "
Exit ( )
2004-01-04 21:11:59 +00:00
2006-02-23 21:08:40 +00:00
cc = B . arguments . get ( ' CC ' , None )
cxx = B . arguments . get ( ' CXX ' , None )
if cc :
2010-08-29 20:52:05 +00:00
env [ ' CC ' ] = cc
2006-02-23 21:08:40 +00:00
if cxx :
2010-08-29 20:52:05 +00:00
env [ ' CXX ' ] = cxx
2006-02-23 21:08:40 +00:00
2011-03-29 13:00:03 +00:00
if sys . platform == ' win32 ' :
if env [ ' CC ' ] in [ ' cl ' , ' cl.exe ' ] :
2014-02-04 17:55:32 +00:00
platform = ' win64-vc ' if B . bitness == 64 else ' win32-vc '
2011-03-29 13:00:03 +00:00
elif env [ ' CC ' ] in [ ' gcc ' ] :
2014-02-04 17:55:32 +00:00
platform = ' win64-mingw ' if B . bitness == 64 else ' win32-mingw '
2004-01-04 21:11:59 +00:00
2013-06-15 21:20:06 +00:00
if ' mingw ' in platform :
print " Setting custom spawn function "
btools . SetupSpawn ( env )
2007-05-31 07:42:54 +00:00
env . SConscriptChdir ( 0 )
2006-11-30 12:39:09 +00:00
2011-08-21 13:31:46 +00:00
# Remove major kernel version from linux platform.
# After Linus switched kernel to new version model this major version
# shouldn't take much sense for building rules.
if re . match ( ' linux[0-9]+ ' , platform ) :
platform = ' linux '
2006-02-04 14:15:10 +00:00
crossbuild = B . arguments . get ( ' BF_CROSS ' , None )
2009-02-20 22:08:02 +00:00
if crossbuild and platform not in ( ' win32-vc ' , ' win64-vc ' ) :
2010-08-29 20:52:05 +00:00
platform = ' linuxcross '
2004-01-04 21:11:59 +00:00
2006-02-04 14:15:10 +00:00
env [ ' OURPLATFORM ' ] = platform
2004-01-04 21:11:59 +00:00
2010-07-12 18:26:35 +00:00
configfile = os . path . join ( " build_files " , " scons " , " config " , platform + " -config.py " )
2004-03-02 08:40:19 +00:00
2006-02-04 14:15:10 +00:00
if os . path . exists ( configfile ) :
2010-08-29 20:52:05 +00:00
print B . bc . OKGREEN + " Using config file: " + B . bc . ENDC + configfile
2004-01-04 21:11:59 +00:00
else :
2010-08-29 20:52:05 +00:00
print B . bc . FAIL + configfile + " doesn ' t exist " + B . bc . ENDC
2006-02-04 14:15:10 +00:00
if crossbuild and env [ ' PLATFORM ' ] != ' win32 ' :
2010-08-29 20:52:05 +00:00
print B . bc . HEADER + " Preparing for crossbuild " + B . bc . ENDC
env . Tool ( ' crossmingw ' , [ toolpath ] )
# todo: determine proper libs/includes etc.
# Needed for gui programs, console programs should do without it
2010-02-01 18:39:41 +00:00
2010-08-29 20:52:05 +00:00
# Now we don't need this option to have console window
# env.Append(LINKFLAGS=['-mwindows'])
2006-02-04 14:15:10 +00:00
2008-04-27 20:17:14 +00:00
userconfig = B . arguments . get ( ' BF_CONFIG ' , ' user-config.py ' )
2006-02-04 14:15:10 +00:00
# first read platform config. B.arguments will override
optfiles = [ configfile ]
2008-04-27 20:17:14 +00:00
if os . path . exists ( userconfig ) :
2010-08-29 20:52:05 +00:00
print B . bc . OKGREEN + " Using user-config file: " + B . bc . ENDC + userconfig
optfiles + = [ userconfig ]
2004-02-07 20:44:43 +00:00
else :
2010-08-29 20:52:05 +00:00
print B . bc . WARNING + userconfig + " not found, no user overrides " + B . bc . ENDC
2006-02-04 14:15:10 +00:00
2010-05-23 21:20:13 +00:00
opts = btools . read_opts ( env , optfiles , B . arguments )
2006-02-04 14:15:10 +00:00
opts . Update ( env )
2011-03-29 13:00:03 +00:00
if sys . platform == ' win32 ' :
2014-02-04 17:55:32 +00:00
if B . bitness == 64 :
2011-10-21 04:23:26 +00:00
env . Append ( CPPFLAGS = [ ' -DWIN64 ' ] ) # -DWIN32 needed too, as it's used all over to target Windows generally
2011-03-29 13:00:03 +00:00
2014-08-27 08:48:35 +00:00
if env [ ' BF_DEBUG ' ] :
env . Append ( CPPDEFINES = [ ' _DEBUG ' , ' DEBUG ' ] )
else :
env . Append ( CPPDEFINES = [ ' NDEBUG ' ] )
2007-12-20 17:52:57 +00:00
if not env [ ' BF_FANCY ' ] :
2010-08-29 20:52:05 +00:00
B . bc . disable ( )
2007-12-20 17:52:57 +00:00
2014-11-17 11:35:36 +00:00
if env [ ' WITH_BF_SDL_DYNLOAD ' ] :
env [ ' BF_SDL_INC ' ] = ' #extern/sdlew/include/SDL2 '
2010-02-11 22:02:27 +00:00
# remove install dir so old and new files are not mixed.
2010-02-12 09:18:10 +00:00
# NOTE: only do the scripts directory for now, otherwise is too disruptive for developers
# TODO: perhaps we need an option (off by default) to not do this altogether...
2010-02-12 12:29:39 +00:00
if not env [ ' WITHOUT_BF_INSTALL ' ] and not env [ ' WITHOUT_BF_OVERWRITE_INSTALL ' ] :
2010-08-29 20:52:05 +00:00
scriptsDir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' scripts ' )
if os . path . isdir ( scriptsDir ) :
print B . bc . OKGREEN + " Clearing installation directory %s : %s " % ( B . bc . ENDC , os . path . abspath ( scriptsDir ) )
shutil . rmtree ( scriptsDir )
2010-02-11 22:02:27 +00:00
2008-10-30 23:55:07 +00:00
SetOption ( ' num_jobs ' , int ( env [ ' BF_NUMJOBS ' ] ) )
2010-02-11 22:02:27 +00:00
print B . bc . OKGREEN + " Build with parallel jobs %s : %s " % ( B . bc . ENDC , GetOption ( ' num_jobs ' ) )
2010-06-05 11:56:55 +00:00
print B . bc . OKGREEN + " Build with debug symbols %s : %s " % ( B . bc . ENDC , env [ ' BF_DEBUG ' ] )
2008-10-30 23:55:07 +00:00
2010-08-02 16:27:41 +00:00
if ' blenderlite ' in B . targets :
2010-08-29 20:52:05 +00:00
target_env_defs = { }
target_env_defs [ ' WITH_BF_GAMEENGINE ' ] = False
2012-06-21 12:27:57 +00:00
target_env_defs [ ' WITH_BF_CYCLES ' ] = False
2010-08-29 20:52:05 +00:00
target_env_defs [ ' WITH_BF_OPENAL ' ] = False
target_env_defs [ ' WITH_BF_OPENEXR ' ] = False
2013-10-08 21:17:24 +00:00
target_env_defs [ ' WITH_BF_PSD ' ] = False
2010-08-29 20:52:05 +00:00
target_env_defs [ ' WITH_BF_OPENMP ' ] = False
target_env_defs [ ' WITH_BF_ICONV ' ] = False
target_env_defs [ ' WITH_BF_INTERNATIONAL ' ] = False
target_env_defs [ ' WITH_BF_OPENJPEG ' ] = False
target_env_defs [ ' WITH_BF_FFMPEG ' ] = False
target_env_defs [ ' WITH_BF_QUICKTIME ' ] = False
target_env_defs [ ' WITH_BF_REDCODE ' ] = False
target_env_defs [ ' WITH_BF_DDS ' ] = False
target_env_defs [ ' WITH_BF_CINEON ' ] = False
2012-04-14 22:33:48 +00:00
target_env_defs [ ' WITH_BF_FRAMESERVER ' ] = False
2010-08-29 20:52:05 +00:00
target_env_defs [ ' WITH_BF_HDR ' ] = False
target_env_defs [ ' WITH_BF_ZLIB ' ] = False
target_env_defs [ ' WITH_BF_SDL ' ] = False
target_env_defs [ ' WITH_BF_JPEG ' ] = False
target_env_defs [ ' WITH_BF_PNG ' ] = False
target_env_defs [ ' WITH_BF_BULLET ' ] = False
target_env_defs [ ' WITH_BF_BINRELOC ' ] = False
target_env_defs [ ' BF_BUILDINFO ' ] = False
2011-10-29 23:56:07 +00:00
target_env_defs [ ' WITH_BF_FLUID ' ] = False
2011-11-13 12:17:27 +00:00
target_env_defs [ ' WITH_BF_OCEANSIM ' ] = False
2012-04-14 22:33:48 +00:00
target_env_defs [ ' WITH_BF_SMOKE ' ] = False
2011-10-29 23:56:07 +00:00
target_env_defs [ ' WITH_BF_BOOLEAN ' ] = False
2011-12-31 03:34:44 +00:00
target_env_defs [ ' WITH_BF_REMESH ' ] = False
2010-08-29 20:52:05 +00:00
target_env_defs [ ' WITH_BF_PYTHON ' ] = False
2014-12-06 23:58:17 +00:00
target_env_defs [ ' WITH_BF_IME ' ] = False
2011-08-02 07:02:40 +00:00
target_env_defs [ ' WITH_BF_3DMOUSE ' ] = False
2012-03-08 03:25:53 +00:00
target_env_defs [ ' WITH_BF_LIBMV ' ] = False
2012-12-20 07:57:26 +00:00
target_env_defs [ ' WITH_BF_FREESTYLE ' ] = False
2012-08-10 08:19:45 +00:00
2010-08-29 20:52:05 +00:00
# Merge blenderlite, let command line to override
for k , v in target_env_defs . iteritems ( ) :
if k not in B . arguments :
env [ k ] = v
2009-09-21 03:16:26 +00:00
2013-01-10 08:01:07 +00:00
if ' cudakernels ' in B . targets :
2013-01-10 08:01:19 +00:00
env [ ' WITH_BF_CYCLES ' ] = True
2013-01-10 08:01:07 +00:00
env [ ' WITH_BF_CYCLES_CUDA_BINARIES ' ] = True
2013-01-10 08:01:19 +00:00
env [ ' WITH_BF_PYTHON ' ] = False
2014-07-10 04:56:38 +00:00
env [ ' WITH_BF_LIBMV ' ] = False
2013-01-10 08:01:07 +00:00
2013-11-28 13:06:35 +00:00
# Configure paths for automated configuration test programs
env [ ' CONFIGUREDIR ' ] = os . path . abspath ( os . path . normpath ( os . path . join ( env [ ' BF_BUILDDIR ' ] , " sconf_temp " ) ) )
env [ ' CONFIGURELOG ' ] = os . path . abspath ( os . path . normpath ( os . path . join ( env [ ' BF_BUILDDIR ' ] , " config.log " ) ) )
2013-11-06 20:59:04 +00:00
#############################################################################
################### Automatic configuration for OSX ##################
#############################################################################
2011-08-04 08:46:17 +00:00
if env [ ' OURPLATFORM ' ] == ' darwin ' :
2013-11-06 20:59:04 +00:00
import commands
2013-12-06 16:06:37 +00:00
import subprocess
command = [ " %s " % env [ ' CC ' ] , " --version " ]
2014-06-26 10:03:52 +00:00
line = btools . get_command_output ( command )
2014-02-10 13:55:34 +00:00
ver = re . search ( r ' [0-9]+( \ .[0-9]+[svn]+)+ ' , line ) or re . search ( r ' [0-9]+( \ .[0-9]+)+ ' , line ) # read the "based on LLVM x.xsvn" version here, not the Apple version
2013-12-06 16:06:37 +00:00
if ver :
2014-02-10 13:55:34 +00:00
env [ ' CCVERSION ' ] = ver . group ( 0 ) . strip ( ' svn ' )
2013-12-07 17:05:27 +00:00
frontend = re . search ( r ' gcc ' , line ) or re . search ( r ' clang ' , line ) or re . search ( r ' llvm-gcc ' , line ) or re . search ( r ' icc ' , line )
2013-12-06 16:06:37 +00:00
if frontend :
2013-12-08 14:35:06 +00:00
env [ ' C_COMPILER_ID ' ] = frontend . group ( 0 )
2014-02-18 16:18:25 +00:00
vendor = re . search ( r ' Apple ' , line )
if vendor :
C_VENDOR = vendor . group ( 0 )
else :
C_VENDOR = ' Open Source '
2013-12-06 16:06:37 +00:00
2014-02-18 16:18:25 +00:00
print B . bc . OKGREEN + " Using Compiler: " + B . bc . ENDC + env [ ' C_COMPILER_ID ' ] + ' - ' + env [ ' CCVERSION ' ] + ' ( ' + C_VENDOR + ' ) '
2013-11-08 13:44:10 +00:00
2013-11-06 20:59:04 +00:00
cmd = ' sw_vers -productVersion '
MAC_CUR_VER = cmd_res = commands . getoutput ( cmd )
cmd = ' xcodebuild -version '
cmd_xcode = commands . getoutput ( cmd )
env [ ' XCODE_CUR_VER ' ] = cmd_xcode [ 6 : ] [ : 3 ] # truncate output to major.minor version
cmd = ' xcodebuild -showsdks '
cmd_sdk = commands . getoutput ( cmd )
2013-11-08 13:44:10 +00:00
MACOSX_SDK_CHECK = cmd_sdk
2013-11-06 20:59:04 +00:00
cmd = ' xcode-select --print-path '
XCODE_SELECT_PATH = commands . getoutput ( cmd )
if XCODE_SELECT_PATH . endswith ( " /Contents/Developer " ) :
XCODE_BUNDLE = XCODE_SELECT_PATH [ : - 19 ]
else :
XCODE_BUNDLE = XCODE_SELECT_PATH
2012-02-25 11:21:20 +00:00
print B . bc . OKGREEN + " Detected Xcode version: -- " + B . bc . ENDC + env [ ' XCODE_CUR_VER ' ] + " -- "
2013-11-09 13:31:20 +00:00
print B . bc . OKGREEN + " Available SDK ' s: \n " + B . bc . ENDC + MACOSX_SDK_CHECK . replace ( ' \t ' , ' ' )
2013-11-06 20:59:04 +00:00
if env [ ' MACOSX_SDK ' ] == ' ' : # no set sdk, choosing best one found
2014-08-03 10:51:26 +00:00
if ' OS X 10.10 ' in MACOSX_SDK_CHECK :
env [ ' MACOSX_DEPLOYMENT_TARGET ' ] = ' 10.6 '
env [ ' MACOSX_SDK ' ] = ' /Developer/SDKs/MacOSX10.10.sdk '
elif ' OS X 10.9 ' in MACOSX_SDK_CHECK :
2013-11-06 20:59:04 +00:00
env [ ' MACOSX_DEPLOYMENT_TARGET ' ] = ' 10.6 '
env [ ' MACOSX_SDK ' ] = ' /Developer/SDKs/MacOSX10.9.sdk '
2013-11-08 13:44:10 +00:00
elif ' OS X 10.8 ' in MACOSX_SDK_CHECK :
2013-11-06 20:59:04 +00:00
env [ ' MACOSX_DEPLOYMENT_TARGET ' ] = ' 10.6 '
env [ ' MACOSX_SDK ' ] = ' /Developer/SDKs/MacOSX10.8.sdk '
2013-11-08 13:44:10 +00:00
elif ' OS X 10.7 ' in MACOSX_SDK_CHECK :
2013-11-06 20:59:04 +00:00
env [ ' MACOSX_DEPLOYMENT_TARGET ' ] = ' 10.6 '
env [ ' MACOSX_SDK ' ] = ' /Developer/SDKs/MacOSX10.7.sdk '
2013-11-08 13:44:10 +00:00
elif ' OS X 10.6 ' in MACOSX_SDK_CHECK :
2013-11-06 20:59:04 +00:00
env [ ' MACOSX_DEPLOYMENT_TARGET ' ] = ' 10.6 '
env [ ' MACOSX_SDK ' ] = ' /Developer/SDKs/MacOSX10.6.sdk '
2013-11-08 13:44:10 +00:00
elif ' OS X 10.5 ' in MACOSX_SDK_CHECK :
2013-11-06 20:59:04 +00:00
env [ ' MACOSX_DEPLOYMENT_TARGET ' ] = ' 10.5 '
env [ ' MACOSX_SDK ' ] = ' /Developer/SDKs/MacOSX10.5.sdk '
else :
env [ ' MACOSX_SDK ' ] = ' /Developer/SDKs/MacOSX ' + env [ ' MACOSX_SDK ' ] + ' .sdk '
if env [ ' XCODE_CUR_VER ' ] > = ' 4.3 ' : ## since version 4.3, XCode and developer dir are bundled ##
env [ ' MACOSX_SDK ' ] = XCODE_BUNDLE + ' /Contents/Developer/Platforms/MacOSX.platform ' + env [ ' MACOSX_SDK ' ]
2013-11-08 13:19:51 +00:00
2013-11-06 20:59:04 +00:00
print B . bc . OKGREEN + " Using OSX SDK : " + B . bc . ENDC + env [ ' MACOSX_SDK ' ]
if not env [ ' WITH_OSX_STATICPYTHON ' ] == 1 :
# python 3.3 uses Python-framework additionally installed in /Library/Frameworks
env [ ' BF_PYTHON ' ] = ' /Library/Frameworks/Python.framework/Versions/ '
env [ ' BF_PYTHON_INC ' ] = env [ ' BF_PYTHON ' ] + env [ ' BF_PYTHON_VERSION ' ] + ' /include/python ' + env [ ' BF_PYTHON_VERSION ' ] + ' m '
env [ ' BF_PYTHON_BINARY ' ] = env [ ' BF_PYTHON ' ] + env [ ' BF_PYTHON_VERSION ' ] + ' /bin/python ' + env [ ' BF_PYTHON_VERSION ' ]
env [ ' BF_PYTHON_LIB ' ] = ' '
env [ ' BF_PYTHON_LIBPATH ' ] = env [ ' BF_PYTHON ' ] + env [ ' BF_PYTHON_VERSION ' ] + ' /lib/python ' + env [ ' BF_PYTHON_VERSION ' ] + ' /config- ' + env [ ' BF_PYTHON_VERSION ' ] + ' m '
2013-11-07 14:06:21 +00:00
env [ ' PLATFORM_LINKFLAGS ' ] = env [ ' PLATFORM_LINKFLAGS ' ] + [ ' -framework ' , ' Python ' ] # link to python framework
2013-11-06 20:59:04 +00:00
#Ray trace optimization
if env [ ' WITH_BF_RAYOPTIMIZATION ' ] == 1 :
if env [ ' MACOSX_ARCHITECTURE ' ] == ' x86_64 ' or env [ ' MACOSX_ARCHITECTURE ' ] == ' i386 ' :
env [ ' WITH_BF_RAYOPTIMIZATION ' ] = 1
else :
env [ ' WITH_BF_RAYOPTIMIZATION ' ] = 0
if env [ ' MACOSX_ARCHITECTURE ' ] == ' i386 ' :
env [ ' BF_RAYOPTIMIZATION_SSE_FLAGS ' ] = env [ ' BF_RAYOPTIMIZATION_SSE_FLAGS ' ] + [ ' -msse ' ]
elif env [ ' MACOSX_ARCHITECTURE ' ] == ' x86_64 ' :
env [ ' BF_RAYOPTIMIZATION_SSE_FLAGS ' ] = env [ ' BF_RAYOPTIMIZATION_SSE_FLAGS ' ] + [ ' -msse ' , ' -msse2 ' ]
if env [ ' MACOSX_ARCHITECTURE ' ] == ' x86_64 ' or env [ ' MACOSX_ARCHITECTURE ' ] == ' ppc64 ' :
ARCH_FLAGS = [ ' -m64 ' ]
2011-08-07 16:54:40 +00:00
else :
2013-11-06 20:59:04 +00:00
ARCH_FLAGS = [ ' -m32 ' ]
2013-11-07 13:56:40 +00:00
env . Append ( CPPFLAGS = ARCH_FLAGS )
2013-11-06 20:59:04 +00:00
SDK_FLAGS = [ ' -isysroot ' , env [ ' MACOSX_SDK ' ] , ' -mmacosx-version-min= ' + env [ ' MACOSX_DEPLOYMENT_TARGET ' ] , ' -arch ' , env [ ' MACOSX_ARCHITECTURE ' ] ] # always used
2013-11-07 14:06:21 +00:00
env [ ' PLATFORM_LINKFLAGS ' ] = [ ' -mmacosx-version-min= ' + env [ ' MACOSX_DEPLOYMENT_TARGET ' ] , ' -isysroot ' , env [ ' MACOSX_SDK ' ] , ' -arch ' , env [ ' MACOSX_ARCHITECTURE ' ] ] + ARCH_FLAGS + env [ ' PLATFORM_LINKFLAGS ' ]
2013-11-06 20:59:04 +00:00
env [ ' CCFLAGS ' ] = SDK_FLAGS + env [ ' CCFLAGS ' ]
env [ ' CXXFLAGS ' ] = SDK_FLAGS + env [ ' CXXFLAGS ' ]
2013-11-07 14:06:21 +00:00
2013-11-06 20:59:04 +00:00
#Intel Macs are CoreDuo and Up
if env [ ' MACOSX_ARCHITECTURE ' ] == ' i386 ' or env [ ' MACOSX_ARCHITECTURE ' ] == ' x86_64 ' :
2013-12-04 22:15:29 +00:00
env [ ' REL_CCFLAGS ' ] = env [ ' REL_CCFLAGS ' ] + [ ' -msse ' , ' -msse2 ' , ' -msse3 ' ]
2014-02-10 14:56:37 +00:00
if env [ ' C_COMPILER_ID ' ] != ' clang ' or ( env [ ' C_COMPILER_ID ' ] == ' clang ' and env [ ' CCVERSION ' ] > = ' 3.3 ' ) :
2013-12-04 22:15:29 +00:00
env [ ' REL_CCFLAGS ' ] = env [ ' REL_CCFLAGS ' ] + [ ' -ftree-vectorize ' ] # clang xcode 4 does not accept flag
2013-11-06 20:59:04 +00:00
else :
env [ ' CCFLAGS ' ] = env [ ' CCFLAGS ' ] + [ ' -fno-strict-aliasing ' ]
# Intel 64bit Macs are Core2Duo and up
if env [ ' MACOSX_ARCHITECTURE ' ] == ' x86_64 ' :
env [ ' REL_CCFLAGS ' ] = env [ ' REL_CCFLAGS ' ] + [ ' -mssse3 ' ]
2014-02-10 14:05:19 +00:00
if env [ ' C_COMPILER_ID ' ] == ' clang ' and env [ ' CCVERSION ' ] > = ' 3.3 ' :
2013-09-10 12:55:36 +00:00
env [ ' CCFLAGS ' ] . append ( ' -ftemplate-depth=1024 ' ) # only valid for clang bundled with xcode 5
2011-08-07 16:54:40 +00:00
2013-11-09 16:00:08 +00:00
# 3DconnexionClient.framework, optionally install
2011-08-25 15:18:54 +00:00
if env [ ' WITH_BF_3DMOUSE ' ] == 1 :
2011-08-25 15:12:57 +00:00
if not os . path . exists ( ' /Library/Frameworks/3DconnexionClient.framework ' ) :
env [ ' WITH_BF_3DMOUSE ' ] = 0
2013-11-09 16:32:10 +00:00
print B . bc . OKGREEN + " 3DconnexionClient install not found, disabling WITH_BF_3DMOUSE " # avoid build errors !
2011-08-25 15:12:57 +00:00
else :
2012-12-12 19:54:14 +00:00
env . Append ( LINKFLAGS = [ ' -F/Library/Frameworks ' , ' -Xlinker ' , ' -weak_framework ' , ' -Xlinker ' , ' 3DconnexionClient ' ] )
env [ ' BF_3DMOUSE_INC ' ] = ' /Library/Frameworks/3DconnexionClient.framework/Headers '
2013-11-09 16:32:10 +00:00
print B . bc . OKGREEN + " Using 3Dconnexion "
2009-09-21 03:16:26 +00:00
2013-11-09 16:00:08 +00:00
# Jackmp.framework, optionally install
2011-12-12 22:17:02 +00:00
if env [ ' WITH_BF_JACK ' ] == 1 :
if not os . path . exists ( ' /Library/Frameworks/Jackmp.framework ' ) :
env [ ' WITH_BF_JACK ' ] = 0
2013-11-09 16:32:10 +00:00
print B . bc . OKGREEN + " JackOSX install not found, disabling WITH_BF_JACK " # avoid build errors !
2011-12-12 22:17:02 +00:00
else :
2013-09-10 18:40:07 +00:00
env . Append ( LINKFLAGS = [ ' -F/Library/Frameworks ' , ' -Xlinker ' , ' -weak_framework ' , ' -Xlinker ' , ' Jackmp ' ] )
2013-11-09 16:32:10 +00:00
print B . bc . OKGREEN + " Using Jack "
2011-12-12 22:17:02 +00:00
2014-11-19 18:41:41 +00:00
if env [ ' WITH_BF_SDL ' ] :
env . Append ( LINKFLAGS = [ ' -lazy_framework ' , ' ForceFeedback ' ] )
2013-11-06 20:59:04 +00:00
if env [ ' WITH_BF_QUICKTIME ' ] == 1 :
env [ ' PLATFORM_LINKFLAGS ' ] = env [ ' PLATFORM_LINKFLAGS ' ] + [ ' -framework ' , ' QTKit ' ]
#Defaults openMP to true if compiler handles it ( only gcc 4.6.1 and newer )
# if your compiler does not have accurate suffix you may have to enable it by hand !
2013-11-06 23:19:01 +00:00
if env [ ' WITH_BF_OPENMP ' ] == 1 :
2014-02-18 16:18:25 +00:00
if env [ ' C_COMPILER_ID ' ] == ' gcc ' and env [ ' CCVERSION ' ] > = ' 4.6.1 ' or env [ ' C_COMPILER_ID ' ] == ' clang ' and env [ ' CCVERSION ' ] > = ' 3.4 ' and C_VENDOR != ' Apple ' :
2013-11-06 23:19:01 +00:00
env [ ' WITH_BF_OPENMP ' ] = 1 # multithreading for fluids, cloth, sculpt and smoke
2013-11-07 15:05:59 +00:00
print B . bc . OKGREEN + " Using OpenMP "
2014-02-18 16:18:25 +00:00
if env [ ' C_COMPILER_ID ' ] == ' clang ' and env [ ' CCVERSION ' ] > = ' 3.4 ' :
OSX_OMP_LIBPATH = Dir ( env . subst ( env [ ' LCGDIR ' ] ) ) . abspath
env . Append ( BF_PROGRAM_LINKFLAGS = [ ' -L ' + OSX_OMP_LIBPATH + ' /openmp/lib ' , ' -liomp5 ' ] )
env [ ' CCFLAGS ' ] . append ( ' -I ' + OSX_OMP_LIBPATH + ' /openmp/include ' ) # include for omp.h
2013-11-06 23:19:01 +00:00
else :
env [ ' WITH_BF_OPENMP ' ] = 0
2013-11-09 16:32:10 +00:00
print B . bc . OKGREEN + " Disabled OpenMP, not supported by compiler "
2013-11-06 20:59:04 +00:00
2013-06-15 21:20:06 +00:00
if env [ ' WITH_BF_CYCLES_OSL ' ] == 1 :
2014-08-14 10:15:59 +00:00
env [ ' WITH_BF_LLVM ' ] = 1
2012-11-19 17:15:33 +00:00
OSX_OSL_LIBPATH = Dir ( env . subst ( env [ ' BF_OSL_LIBPATH ' ] ) ) . abspath
# we need 2 variants of passing the oslexec with the force_load option, string and list type atm
2014-02-09 17:03:13 +00:00
if env [ ' C_COMPILER_ID ' ] == ' gcc ' and env [ ' CCVERSION ' ] > = ' 4.8 ' or env [ ' C_COMPILER_ID ' ] == ' clang ' and env [ ' CCVERSION ' ] > = ' 3.4 ' :
2013-11-06 20:59:04 +00:00
env . Append ( LINKFLAGS = [ ' -L ' + OSX_OSL_LIBPATH , ' -loslcomp ' , ' -loslexec ' , ' -loslquery ' ] )
2013-09-28 18:42:14 +00:00
else :
env . Append ( LINKFLAGS = [ ' -L ' + OSX_OSL_LIBPATH , ' -loslcomp ' , ' -force_load ' + OSX_OSL_LIBPATH + ' /liboslexec.a ' , ' -loslquery ' ] )
2012-11-19 17:15:33 +00:00
env . Append ( BF_PROGRAM_LINKFLAGS = [ ' -Xlinker ' , ' -force_load ' , ' -Xlinker ' , OSX_OSL_LIBPATH + ' /liboslexec.a ' ] )
2014-08-14 10:15:59 +00:00
else :
env [ ' WITH_BF_LLVM ' ] = 0
2012-11-19 17:15:33 +00:00
2014-07-29 08:59:57 +00:00
if env [ ' WITH_BF_LLVM ' ] == 0 :
# Due duplicated generic UTF functions, we pull them either from LLVMSupport or COLLADA
env . Append ( BF_OPENCOLLADA_LIB = ' UTF ' )
2013-11-09 16:00:08 +00:00
# Trying to get rid of eventually clashes, we export some symbols explicite as local
2012-11-27 11:38:59 +00:00
env . Append ( LINKFLAGS = [ ' -Xlinker ' , ' -unexported_symbols_list ' , ' -Xlinker ' , ' ./source/creator/osx_locals.map ' ] )
2013-11-06 20:59:04 +00:00
#for < 10.7.sdk, SystemStubs needs to be linked
if env [ ' MACOSX_SDK ' ] . endswith ( " 10.6.sdk " ) or env [ ' MACOSX_SDK ' ] . endswith ( " 10.5.sdk " ) :
env [ ' LLIBS ' ] . append ( ' SystemStubs ' )
#############################################################################
################### End Automatic configuration for OSX ##################
#############################################################################
2012-11-27 11:38:59 +00:00
2008-01-29 21:01:12 +00:00
if env [ ' WITH_BF_OPENMP ' ] == 1 :
2010-08-29 20:52:05 +00:00
if env [ ' OURPLATFORM ' ] in ( ' win32-vc ' , ' win64-vc ' ) :
env [ ' CCFLAGS ' ] . append ( ' /openmp ' )
else :
if env [ ' CC ' ] . endswith ( ' icc ' ) : # to be able to handle CC=/opt/bla/icc case
env . Append ( LINKFLAGS = [ ' -openmp ' , ' -static-intel ' ] )
env [ ' CCFLAGS ' ] . append ( ' -openmp ' )
else :
2013-06-15 21:20:06 +00:00
env . Append ( CCFLAGS = [ ' -fopenmp ' ] )
2008-01-29 21:01:12 +00:00
2006-03-17 16:38:39 +00:00
#check for additional debug libnames
if env . has_key ( ' BF_DEBUG_LIBS ' ) :
2010-08-29 20:52:05 +00:00
B . quickdebug + = env [ ' BF_DEBUG_LIBS ' ]
2006-03-17 16:38:39 +00:00
printdebug = B . arguments . get ( ' BF_LISTDEBUG ' , 0 )
if len ( B . quickdebug ) > 0 and printdebug != 0 :
2010-08-29 20:52:05 +00:00
print B . bc . OKGREEN + " Buildings these libs with debug symbols: " + B . bc . ENDC
for l in B . quickdebug :
print " \t " + l
2006-03-17 16:38:39 +00:00
2008-09-18 03:05:02 +00:00
# remove stdc++ from LLIBS if we are building a statc linked CXXFLAGS
if env [ ' WITH_BF_STATICCXX ' ] :
2010-08-29 20:52:05 +00:00
if ' stdc++ ' in env [ ' LLIBS ' ] :
env [ ' LLIBS ' ] . remove ( ' stdc++ ' )
else :
print ' \t could not remove stdc++ library from LLIBS, WITH_BF_STATICCXX may not work for your platform '
2008-09-18 03:05:02 +00:00
2006-02-04 14:15:10 +00:00
# check target for blenderplayer. Set WITH_BF_PLAYER if found on cmdline
if ' blenderplayer ' in B . targets :
2010-08-29 20:52:05 +00:00
env [ ' WITH_BF_PLAYER ' ] = True
2006-02-04 14:15:10 +00:00
2006-02-04 15:10:59 +00:00
if ' blendernogame ' in B . targets :
2010-08-29 20:52:05 +00:00
env [ ' WITH_BF_GAMEENGINE ' ] = False
2006-02-04 15:10:59 +00:00
2014-01-11 03:54:57 +00:00
if not env [ ' WITH_BF_GAMEENGINE ' ] :
env [ ' WITH_BF_PLAYER ' ] = False
2011-10-29 23:56:07 +00:00
# build without elbeem (fluidsim)?
if env [ ' WITH_BF_FLUID ' ] == 1 :
env [ ' CPPFLAGS ' ] . append ( ' -DWITH_MOD_FLUID ' )
2010-02-11 22:02:27 +00:00
2011-11-13 12:17:27 +00:00
# build with ocean sim?
if env [ ' WITH_BF_OCEANSIM ' ] == 1 :
2013-06-15 21:20:06 +00:00
env [ ' WITH_BF_FFTW3 ' ] = 1 # ocean needs fftw3 so enable it
2011-11-13 12:17:27 +00:00
env [ ' CPPFLAGS ' ] . append ( ' -DWITH_MOD_OCEANSIM ' )
2011-09-19 08:02:17 +00:00
2011-10-05 23:17:40 +00:00
if btools . ENDIAN == " big " :
2011-09-19 08:02:17 +00:00
env [ ' CPPFLAGS ' ] . append ( ' -D__BIG_ENDIAN__ ' )
else :
env [ ' CPPFLAGS ' ] . append ( ' -D__LITTLE_ENDIAN__ ' )
2013-01-01 12:47:58 +00:00
# TODO, make optional (as with CMake)
2011-06-23 09:27:56 +00:00
env [ ' CPPFLAGS ' ] . append ( ' -DWITH_AUDASPACE ' )
2012-10-08 02:51:42 +00:00
env [ ' CPPFLAGS ' ] . append ( ' -DWITH_AVI ' )
2013-11-25 04:33:41 +00:00
env [ ' CPPFLAGS ' ] . append ( ' -DWITH_OPENNL ' )
2011-06-23 09:27:56 +00:00
2013-03-24 12:13:13 +00:00
if env [ ' OURPLATFORM ' ] not in ( ' win32-vc ' , ' win64-vc ' ) :
env [ ' CPPFLAGS ' ] . append ( ' -DHAVE_STDBOOL_H ' )
2011-06-23 09:27:56 +00:00
2014-10-07 20:46:19 +00:00
# OpenGL
if env [ ' WITH_BF_GL_PROFILE_COMPAT ' ] :
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' WITH_GL_PROFILE_COMPAT ' )
if env [ ' WITH_BF_GL_PROFILE_CORE ' ] :
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' WITH_GL_PROFILE_CORE ' )
if env [ ' WITH_BF_GL_PROFILE_ES20 ' ] :
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' WITH_GL_PROFILE_ES20 ' )
if env [ ' WITH_BF_GL_EGL ' ] :
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' WITH_EGL ' )
# GLEW
if env [ ' WITH_BF_GLEW_MX ' ] :
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' WITH_GLEW_MX ' )
if env [ ' WITH_BF_GLEW_ES ' ] :
env [ ' BF_GLEW_INC ' ] = ' #extern/glew-es/include '
env [ ' BF_GL_DEFINITIONS ' ] + = [ ' GLEW_STATIC ' , ' WITH_GLEW_ES ' ]
if not env [ ' WITH_BF_GL_PROFILE_ES20 ' ] :
# No ES functions are needed
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' GLEW_NO_ES ' )
elif not ( env [ ' WITH_BF_GL_PROFILE_CORE ' ] or env [ ' WITH_BF_GL_PROFILE_COMPAT ' ] ) :
# ES is enabled, but the other functions are all disabled
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' GLEW_ES_ONLY ' )
if env [ ' WITH_BF_GL_PROFILE_ES20 ' ] :
if env [ ' WITH_BF_GL_EGL ' ] :
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' GLEW_USE_LIB_ES20 ' )
if env [ ' WITH_BF_GL_EGL ' ] :
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' GLEW_INC_EGL ' )
else :
env [ ' BF_GLEW_INC ' ] = ' #extern/glew/include '
env [ ' BF_GL_DEFINITIONS ' ] . append ( ' GLEW_STATIC ' )
2006-02-04 14:15:10 +00:00
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
B . root_build_dir = env [ ' BF_BUILDDIR ' ]
2010-08-02 16:27:41 +00:00
B . doc_build_dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , ' doc ' )
2006-02-04 14:15:10 +00:00
if not B . root_build_dir [ - 1 ] == os . sep :
2010-08-29 20:52:05 +00:00
B . root_build_dir + = os . sep
2008-10-19 22:01:46 +00:00
if not B . doc_build_dir [ - 1 ] == os . sep :
2010-08-29 20:52:05 +00:00
B . doc_build_dir + = os . sep
2012-08-10 08:19:45 +00:00
2006-02-04 14:15:10 +00:00
# We do a shortcut for clean when no quicklist is given: just delete
# builddir without reading in SConscripts
do_clean = None
if ' clean ' in B . targets :
2010-08-29 20:52:05 +00:00
do_clean = True
2006-02-04 14:15:10 +00:00
if not quickie and do_clean :
2010-08-29 20:52:05 +00:00
if os . path . exists ( B . doc_build_dir ) :
print B . bc . HEADER + ' Cleaning doc dir... ' + B . bc . ENDC
dirs = os . listdir ( B . doc_build_dir )
for entry in dirs :
if os . path . isdir ( B . doc_build_dir + entry ) == 1 :
print " clean dir %s " % ( B . doc_build_dir + entry )
shutil . rmtree ( B . doc_build_dir + entry )
else : # remove file
print " remove file %s " % ( B . doc_build_dir + entry )
os . remove ( B . root_build_dir + entry )
if os . path . exists ( B . root_build_dir ) :
print B . bc . HEADER + ' Cleaning build dir... ' + B . bc . ENDC
dirs = os . listdir ( B . root_build_dir )
for entry in dirs :
if os . path . isdir ( B . root_build_dir + entry ) == 1 :
print " clean dir %s " % ( B . root_build_dir + entry )
shutil . rmtree ( B . root_build_dir + entry )
else : # remove file
print " remove file %s " % ( B . root_build_dir + entry )
os . remove ( B . root_build_dir + entry )
for confile in [ ' extern/ffmpeg/config.mak ' , ' extern/x264/config.mak ' ,
' extern/xvidcore/build/generic/platform.inc ' , ' extern/ffmpeg/include ' ] :
if os . path . exists ( confile ) :
print " clean file %s " % confile
if os . path . isdir ( confile ) :
for root , dirs , files in os . walk ( confile ) :
for name in files :
os . remove ( os . path . join ( root , name ) )
else :
os . remove ( confile )
print B . bc . OKGREEN + ' ...done ' + B . bc . ENDC
else :
print B . bc . HEADER + ' Already Clean, nothing to do. ' + B . bc . ENDC
Exit ( )
2006-02-04 14:15:10 +00:00
2011-07-16 06:55:45 +00:00
# ensure python header is found since detection can fail, this could happen
# with _any_ library but since we used a fixed python version this tends to
# be most problematic.
if env [ ' WITH_BF_PYTHON ' ] :
2012-11-12 18:31:15 +00:00
found_python_h = found_pyconfig_h = False
for bf_python_inc in env . subst ( ' $ {BF_PYTHON_INC} ' ) . split ( ) :
py_h = os . path . join ( Dir ( bf_python_inc ) . abspath , " Python.h " )
if os . path . exists ( py_h ) :
found_python_h = True
py_h = os . path . join ( Dir ( bf_python_inc ) . abspath , " pyconfig.h " )
if os . path . exists ( py_h ) :
found_pyconfig_h = True
if not ( found_python_h and found_pyconfig_h ) :
2012-12-28 12:12:04 +00:00
print ( """ \n Missing: Python.h and/or pyconfig.h in " %s "
Set ' BF_PYTHON_INC ' to point to valid include path ( s ) ,
containing Python . h and pyconfig . h for Python version " %s " .
2011-07-16 06:55:45 +00:00
2012-12-28 12:12:04 +00:00
Example : python scons / scons . py BF_PYTHON_INC = . . / Python / include
""" % (env.subst( ' $ {BF_PYTHON_INC} ' ), env.subst( ' $ {BF_PYTHON_VERSION} ' )))
2012-08-10 08:19:45 +00:00
Exit ( )
2011-07-16 06:55:45 +00:00
2006-02-04 14:15:10 +00:00
if not os . path . isdir ( B . root_build_dir ) :
2010-08-29 20:52:05 +00:00
os . makedirs ( B . root_build_dir )
os . makedirs ( B . root_build_dir + ' source ' )
os . makedirs ( B . root_build_dir + ' intern ' )
os . makedirs ( B . root_build_dir + ' extern ' )
os . makedirs ( B . root_build_dir + ' lib ' )
os . makedirs ( B . root_build_dir + ' bin ' )
2010-08-02 16:27:41 +00:00
# # Docs not working with epy anymore
# if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']:
2010-08-29 20:52:05 +00:00
# os.makedirs ( B.doc_build_dir )
2006-02-04 14:15:10 +00:00
2014-06-29 14:26:59 +00:00
2012-08-09 19:59:36 +00:00
###################################
# Ensure all data files are valid #
###################################
if not os . path . isdir ( B . root_build_dir + ' data_headers ' ) :
2012-08-10 08:19:45 +00:00
os . makedirs ( B . root_build_dir + ' data_headers ' )
2012-08-11 12:26:43 +00:00
if not os . path . isdir ( B . root_build_dir + ' data_sources ' ) :
os . makedirs ( B . root_build_dir + ' data_sources ' )
2012-08-09 19:59:36 +00:00
# use for includes
2012-08-10 15:25:54 +00:00
env [ ' DATA_HEADERS ' ] = os . path . join ( os . path . abspath ( env [ ' BF_BUILDDIR ' ] ) , " data_headers " )
2012-08-11 12:26:43 +00:00
env [ ' DATA_SOURCES ' ] = os . path . join ( os . path . abspath ( env [ ' BF_BUILDDIR ' ] ) , " data_sources " )
2012-08-11 14:40:09 +00:00
def data_to_c ( FILE_FROM , FILE_TO , VAR_NAME ) :
2012-08-10 08:19:45 +00:00
if os . sep == " \\ " :
FILE_FROM = FILE_FROM . replace ( " / " , " \\ " )
FILE_TO = FILE_TO . replace ( " / " , " \\ " )
2012-08-09 19:59:36 +00:00
2014-09-12 16:56:11 +00:00
try :
# first check if we need to bother.
if os . path . exists ( FILE_TO ) :
if os . path . getmtime ( FILE_FROM ) < os . path . getmtime ( FILE_TO ) :
return
print ( B . bc . HEADER + " Generating: " + B . bc . ENDC + " %r " % os . path . basename ( FILE_TO ) )
fpin = open ( FILE_FROM , " rb " )
fpin . seek ( 0 , os . SEEK_END )
size = fpin . tell ( )
fpin . seek ( 0 )
fpout = open ( FILE_TO , " w " )
fpout . write ( " int %s _size = %d ; \n " % ( VAR_NAME , size ) )
fpout . write ( " char %s [] = { \n " % VAR_NAME )
while size > 0 :
size - = 1
if size % 32 == 31 :
fpout . write ( " \n " )
fpout . write ( " %3d , " % ord ( fpin . read ( 1 ) ) )
fpout . write ( " \n 0}; \n \n " )
fpin . close ( )
fpout . close ( )
except KeyboardInterrupt :
if os . path . exists ( FILE_TO ) :
os . remove ( FILE_TO )
raise KeyboardInterrupt
2012-08-09 19:59:36 +00:00
2012-08-11 14:40:09 +00:00
def data_to_c_simple ( FILE_FROM ) :
filename_only = os . path . basename ( FILE_FROM )
FILE_TO = os . path . join ( env [ ' DATA_SOURCES ' ] , filename_only + " .c " )
VAR_NAME = " datatoc_ " + filename_only . replace ( " . " , " _ " )
2013-06-15 21:20:06 +00:00
2012-08-11 14:40:09 +00:00
data_to_c ( FILE_FROM , FILE_TO , VAR_NAME )
2013-06-15 21:20:06 +00:00
2012-08-09 19:59:36 +00:00
2014-01-13 12:47:33 +00:00
def data_to_c_simple_icon ( PATH_FROM ) :
# first handle import
import sys
path = " source/blender/datatoc "
if path not in sys . path :
sys . path . append ( path )
# convert the pixmaps to a png
import datatoc_icon
filename_only = os . path . basename ( PATH_FROM )
FILE_TO_PNG = os . path . join ( env [ ' DATA_SOURCES ' ] , filename_only + " .png " )
FILE_TO = FILE_TO_PNG + " .c "
argv = [ PATH_FROM , FILE_TO_PNG ]
2014-09-12 16:56:11 +00:00
try :
datatoc_icon . main_ex ( argv )
except KeyboardInterrupt :
if os . path . exists ( FILE_TO_PNG ) :
os . remove ( FILE_TO_PNG )
raise KeyboardInterrupt
2014-01-13 12:47:33 +00:00
# then the png to a c file
data_to_c_simple ( FILE_TO_PNG )
2013-02-12 11:44:02 +00:00
if B . targets != [ ' cudakernels ' ] :
data_to_c ( " source/blender/compositor/operations/COM_OpenCLKernels.cl " ,
B . root_build_dir + " data_headers/COM_OpenCLKernels.cl.h " ,
" datatoc_COM_OpenCLKernels_cl " )
data_to_c_simple ( " release/datafiles/startup.blend " )
data_to_c_simple ( " release/datafiles/preview.blend " )
data_to_c_simple ( " release/datafiles/preview_cycles.blend " )
# --- glsl ---
2013-03-10 15:38:23 +00:00
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_simple_frag.glsl " )
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_simple_vert.glsl " )
2013-02-26 00:49:42 +00:00
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_material.glsl " )
2013-02-12 11:44:02 +00:00
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_material.glsl " )
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl " )
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_vert.glsl " )
2013-02-26 00:49:42 +00:00
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_vertex.glsl " )
2014-11-24 16:18:56 +00:00
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_vertex_world.glsl " )
2013-02-12 11:44:02 +00:00
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl " )
data_to_c_simple ( " source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl " )
2013-10-09 15:57:32 +00:00
data_to_c_simple ( " intern/opencolorio/gpu_shader_display_transform.glsl " )
2013-02-12 11:44:02 +00:00
# --- blender ---
data_to_c_simple ( " release/datafiles/bfont.pfb " )
data_to_c_simple ( " release/datafiles/bfont.ttf " )
data_to_c_simple ( " release/datafiles/bmonofont.ttf " )
data_to_c_simple ( " release/datafiles/splash.png " )
2014-02-17 20:52:20 +00:00
data_to_c_simple ( " release/datafiles/splash_2x.png " )
2014-01-13 12:47:33 +00:00
# data_to_c_simple("release/datafiles/blender_icons16.png")
# data_to_c_simple("release/datafiles/blender_icons32.png")
data_to_c_simple_icon ( " release/datafiles/blender_icons16 " )
data_to_c_simple_icon ( " release/datafiles/blender_icons32 " )
2013-02-12 11:44:02 +00:00
data_to_c_simple ( " release/datafiles/prvicons.png " )
data_to_c_simple ( " release/datafiles/brushicons/add.png " )
data_to_c_simple ( " release/datafiles/brushicons/blob.png " )
data_to_c_simple ( " release/datafiles/brushicons/blur.png " )
data_to_c_simple ( " release/datafiles/brushicons/clay.png " )
data_to_c_simple ( " release/datafiles/brushicons/claystrips.png " )
data_to_c_simple ( " release/datafiles/brushicons/clone.png " )
data_to_c_simple ( " release/datafiles/brushicons/crease.png " )
data_to_c_simple ( " release/datafiles/brushicons/darken.png " )
data_to_c_simple ( " release/datafiles/brushicons/draw.png " )
data_to_c_simple ( " release/datafiles/brushicons/fill.png " )
data_to_c_simple ( " release/datafiles/brushicons/flatten.png " )
data_to_c_simple ( " release/datafiles/brushicons/grab.png " )
data_to_c_simple ( " release/datafiles/brushicons/inflate.png " )
data_to_c_simple ( " release/datafiles/brushicons/layer.png " )
data_to_c_simple ( " release/datafiles/brushicons/lighten.png " )
data_to_c_simple ( " release/datafiles/brushicons/mask.png " )
data_to_c_simple ( " release/datafiles/brushicons/mix.png " )
data_to_c_simple ( " release/datafiles/brushicons/multiply.png " )
data_to_c_simple ( " release/datafiles/brushicons/nudge.png " )
data_to_c_simple ( " release/datafiles/brushicons/pinch.png " )
data_to_c_simple ( " release/datafiles/brushicons/scrape.png " )
data_to_c_simple ( " release/datafiles/brushicons/smear.png " )
data_to_c_simple ( " release/datafiles/brushicons/smooth.png " )
data_to_c_simple ( " release/datafiles/brushicons/snake_hook.png " )
data_to_c_simple ( " release/datafiles/brushicons/soften.png " )
data_to_c_simple ( " release/datafiles/brushicons/subtract.png " )
data_to_c_simple ( " release/datafiles/brushicons/texdraw.png " )
2014-07-21 10:02:05 +00:00
data_to_c_simple ( " release/datafiles/brushicons/texfill.png " )
data_to_c_simple ( " release/datafiles/brushicons/texmask.png " )
2013-02-12 11:44:02 +00:00
data_to_c_simple ( " release/datafiles/brushicons/thumb.png " )
data_to_c_simple ( " release/datafiles/brushicons/twist.png " )
data_to_c_simple ( " release/datafiles/brushicons/vertexdraw.png " )
data_to_c_simple ( " release/datafiles/matcaps/mc01.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc02.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc03.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc04.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc05.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc06.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc07.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc08.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc09.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc10.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc11.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc12.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc13.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc14.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc15.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc16.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc17.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc18.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc19.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc20.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc21.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc22.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc23.jpg " )
data_to_c_simple ( " release/datafiles/matcaps/mc24.jpg " )
2013-01-22 11:37:12 +00:00
2012-08-09 19:59:36 +00:00
##### END DATAFILES ##########
2006-02-04 14:15:10 +00:00
Help ( opts . GenerateHelpText ( env ) )
2012-08-10 08:19:45 +00:00
# default is new quieter output, but if you need to see the
2006-02-04 14:15:10 +00:00
# commands, do 'scons BF_QUIET=0'
bf_quietoutput = B . arguments . get ( ' BF_QUIET ' , ' 1 ' )
2008-03-19 17:23:14 +00:00
if env [ ' BF_QUIET ' ] :
2010-08-29 20:52:05 +00:00
B . set_quiet_output ( env )
2004-02-07 20:44:43 +00:00
else :
2010-08-29 20:52:05 +00:00
if toolset == ' msvc ' :
B . msvc_hack ( env )
2006-02-04 14:15:10 +00:00
2010-02-11 22:02:27 +00:00
print B . bc . HEADER + ' Building in: ' + B . bc . ENDC + os . path . abspath ( B . root_build_dir )
2006-02-04 14:15:10 +00:00
env . SConsignFile ( B . root_build_dir + ' scons-signatures ' )
B . init_lib_dict ( )
##### END SETUP ##########
2014-07-10 04:47:01 +00:00
if B . targets != [ ' cudakernels ' ] :
# Put all auto configuration run-time tests here
2014-07-09 21:53:37 +00:00
2014-07-10 04:47:01 +00:00
from FindSharedPtr import FindSharedPtr
from FindUnorderedMap import FindUnorderedMap
2014-07-09 21:53:37 +00:00
2014-07-10 04:47:01 +00:00
conf = Configure ( env )
2014-11-20 14:27:10 +00:00
old_linkflags = conf . env [ ' LINKFLAGS ' ]
2014-07-10 04:47:01 +00:00
conf . env . Append ( LINKFLAGS = env [ ' PLATFORM_LINKFLAGS ' ] )
FindSharedPtr ( conf )
FindUnorderedMap ( conf )
2014-11-20 14:27:10 +00:00
conf . env [ ' LINKFLAGS ' ] = old_linkflags
2014-07-10 04:47:01 +00:00
env = conf . Finish ( )
2014-07-09 21:53:37 +00:00
# End of auto configuration
2006-02-04 14:15:10 +00:00
Export ( ' env ' )
2012-11-17 05:16:54 +00:00
VariantDir ( B . root_build_dir + ' /source ' , ' source ' , duplicate = 0 )
2011-11-08 20:40:02 +00:00
SConscript ( B . root_build_dir + ' /source/SConscript ' )
2012-11-17 05:16:54 +00:00
VariantDir ( B . root_build_dir + ' /intern ' , ' intern ' , duplicate = 0 )
2006-02-04 14:15:10 +00:00
SConscript ( B . root_build_dir + ' /intern/SConscript ' )
2012-11-17 05:16:54 +00:00
VariantDir ( B . root_build_dir + ' /extern ' , ' extern ' , duplicate = 0 )
2006-02-04 14:15:10 +00:00
SConscript ( B . root_build_dir + ' /extern/SConscript ' )
# now that we have read all SConscripts, we know what
# libraries will be built. Create list of
# libraries to give as objects to linking phase
mainlist = [ ]
for tp in B . possible_types :
2014-08-05 07:57:50 +00:00
if ( not tp == ' player ' ) and ( not tp == ' player2 ' ) and ( not tp == ' system ' ) :
2010-08-29 20:52:05 +00:00
mainlist + = B . create_blender_liblist ( env , tp )
2006-02-04 14:15:10 +00:00
if B . arguments . get ( ' BF_PRIORITYLIST ' , ' 0 ' ) == ' 1 ' :
2010-08-29 20:52:05 +00:00
B . propose_priorities ( )
2006-02-04 14:15:10 +00:00
2006-03-10 20:47:34 +00:00
dobj = B . buildinfo ( env , " dynamic " ) + B . resources
2011-06-08 11:53:07 +00:00
creob = B . creator ( env )
2006-02-04 14:15:10 +00:00
thestatlibs , thelibincs = B . setup_staticlibs ( env )
thesyslibs = B . setup_syslibs ( env )
2008-10-19 21:25:17 +00:00
if ' blender ' in B . targets or not env [ ' WITH_BF_NOBLENDER ' ] :
2014-08-07 14:01:20 +00:00
blender_progname = " blender "
if env [ ' OURPLATFORM ' ] in ( ' win32-vc ' , ' win32-mingw ' , ' win64-vc ' , ' linuxcross ' ) :
blender_progname = " blender-app "
lenv = env . Clone ( )
lenv . Append ( LINKFLAGS = env [ ' PLATFORM_LINKFLAGS ' ] )
targetpath = B . root_build_dir + ' /blender '
launcher_obj = [ env . Object ( B . root_build_dir + ' source/creator/creator/creator_launch_win ' , [ ' #source/creator/creator_launch_win.c ' ] ) ]
2014-08-29 17:05:14 +00:00
env . BlenderProg ( B . root_build_dir , ' blender ' , [ launcher_obj ] + B . resources , [ ' bf_utfconv ' ] + thesyslibs , [ B . root_build_dir + ' /lib ' ] + thelibincs , ' blender ' )
2014-08-07 14:01:20 +00:00
env . BlenderProg ( B . root_build_dir , blender_progname , creob + mainlist + thestatlibs + dobj , thesyslibs , [ B . root_build_dir + ' /lib ' ] + thelibincs , ' blender ' )
2006-02-04 14:15:10 +00:00
if env [ ' WITH_BF_PLAYER ' ] :
2010-08-29 20:52:05 +00:00
playerlist = B . create_blender_liblist ( env , ' player ' )
2010-12-21 00:21:42 +00:00
playerlist + = B . create_blender_liblist ( env , ' player2 ' )
2010-08-29 20:52:05 +00:00
playerlist + = B . create_blender_liblist ( env , ' intern ' )
playerlist + = B . create_blender_liblist ( env , ' extern ' )
2011-06-08 11:53:07 +00:00
env . BlenderProg ( B . root_build_dir , " blenderplayer " , dobj + playerlist + thestatlibs , thesyslibs , [ B . root_build_dir + ' /lib ' ] + thelibincs , ' blenderplayer ' )
2006-02-04 14:15:10 +00:00
##### Now define some targets
#------------ INSTALL
2007-03-29 04:28:29 +00:00
#-- binaries
blenderinstall = [ ]
if env [ ' OURPLATFORM ' ] == ' darwin ' :
2010-08-29 20:52:05 +00:00
for prg in B . program_list :
bundle = ' %s .app ' % prg [ 0 ]
bundledir = os . path . dirname ( bundle )
for dp , dn , df in os . walk ( bundle ) :
if ' .svn ' in dn :
dn . remove ( ' .svn ' )
if ' _svn ' in dn :
dn . remove ( ' _svn ' )
2013-11-16 18:18:21 +00:00
if ' .git ' in df :
df . remove ( ' .git ' )
2010-08-29 20:52:05 +00:00
dir = env [ ' BF_INSTALLDIR ' ] + dp [ len ( bundledir ) : ]
source = [ dp + os . sep + f for f in df ]
blenderinstall . append ( env . Install ( dir = dir , source = source ) )
2007-03-29 04:28:29 +00:00
else :
2010-08-29 20:52:05 +00:00
blenderinstall = env . Install ( dir = env [ ' BF_INSTALLDIR ' ] , source = B . program_list )
2006-02-04 14:15:10 +00:00
2010-07-05 07:06:19 +00:00
#-- local path = config files in install dir: installdir\VERSION
#- dont do config and scripts for darwin, it is already in the bundle
2006-02-04 14:15:10 +00:00
dotblendlist = [ ]
2010-07-04 15:35:23 +00:00
datafileslist = [ ]
datafilestargetlist = [ ]
2006-02-04 14:15:10 +00:00
dottargetlist = [ ]
2006-05-15 16:56:32 +00:00
scriptinstall = [ ]
2013-01-10 08:01:07 +00:00
cubininstall = [ ]
2008-03-22 01:39:11 +00:00
2011-08-29 06:28:09 +00:00
if env [ ' OURPLATFORM ' ] != ' darwin ' :
2011-10-21 03:16:01 +00:00
dotblenderinstall = [ ]
for targetdir , srcfile in zip ( dottargetlist , dotblendlist ) :
td , tf = os . path . split ( targetdir )
dotblenderinstall . append ( env . Install ( dir = td , source = srcfile ) )
for targetdir , srcfile in zip ( datafilestargetlist , datafileslist ) :
td , tf = os . path . split ( targetdir )
dotblenderinstall . append ( env . Install ( dir = td , source = srcfile ) )
2012-08-10 08:19:45 +00:00
2014-08-11 11:26:20 +00:00
if env [ ' OURPLATFORM ' ] in ( ' win32-vc ' , ' win32-mingw ' , ' win64-vc ' , ' linuxcross ' ) :
scriptinstall . append ( env . InstallAs ( env [ ' BF_INSTALLDIR ' ] + ' /blender-app.exe.manifest ' ,
' source/icons/blender.exe.manifest ' ) )
2014-08-07 14:01:20 +00:00
2011-10-21 03:16:01 +00:00
if env [ ' WITH_BF_PYTHON ' ] :
#-- local/VERSION/scripts
scriptpaths = [ ' release/scripts ' ]
for scriptpath in scriptpaths :
for dp , dn , df in os . walk ( scriptpath ) :
2013-11-16 18:18:21 +00:00
if ' .git ' in df :
df . remove ( ' .git ' )
2011-10-21 03:16:01 +00:00
if ' __pycache__ ' in dn : # py3.2 cache dir
dn . remove ( ' __pycache__ ' )
2011-11-17 19:43:59 +00:00
# only for testing builds
if VERSION_RELEASE_CYCLE == " release " and " addons_contrib " in dn :
dn . remove ( ' addons_contrib ' )
2012-12-20 07:57:26 +00:00
# do not install freestyle if disabled
if not env [ ' WITH_BF_FREESTYLE ' ] and " freestyle " in dn :
dn . remove ( " freestyle " )
2011-10-21 03:16:01 +00:00
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION )
dir + = os . sep + os . path . basename ( scriptpath ) + dp [ len ( scriptpath ) : ]
source = [ os . path . join ( dp , f ) for f in df if not f . endswith ( " .pyc " ) ]
# To ensure empty dirs are created too
2012-05-23 04:15:50 +00:00
if len ( source ) == 0 and not os . path . exists ( dir ) :
2011-10-21 03:16:01 +00:00
env . Execute ( Mkdir ( dir ) )
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
2011-11-08 20:40:02 +00:00
if env [ ' WITH_BF_CYCLES ' ] :
# cycles python code
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' scripts ' , ' addons ' , ' cycles ' )
source = os . listdir ( ' intern/cycles/blender/addon ' )
if ' __pycache__ ' in source : source . remove ( ' __pycache__ ' )
source = [ ' intern/cycles/blender/addon/ ' + s for s in source ]
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
# cycles kernel code
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' scripts ' , ' addons ' , ' cycles ' , ' kernel ' )
source = os . listdir ( ' intern/cycles/kernel ' )
if ' __pycache__ ' in source : source . remove ( ' __pycache__ ' )
source . remove ( ' kernel.cpp ' )
source . remove ( ' CMakeLists.txt ' )
source . remove ( ' svm ' )
2012-12-03 16:51:05 +00:00
source . remove ( ' closure ' )
2014-04-04 11:07:23 +00:00
source . remove ( ' geom ' )
2012-12-03 16:51:05 +00:00
source . remove ( ' shaders ' )
2011-11-08 20:40:02 +00:00
source . remove ( ' osl ' )
source = [ ' intern/cycles/kernel/ ' + s for s in source ]
source . append ( ' intern/cycles/util/util_color.h ' )
2014-01-16 23:33:32 +00:00
source . append ( ' intern/cycles/util/util_half.h ' )
2011-11-08 20:40:02 +00:00
source . append ( ' intern/cycles/util/util_math.h ' )
source . append ( ' intern/cycles/util/util_transform.h ' )
source . append ( ' intern/cycles/util/util_types.h ' )
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
# svm
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' scripts ' , ' addons ' , ' cycles ' , ' kernel ' , ' svm ' )
source = os . listdir ( ' intern/cycles/kernel/svm ' )
if ' __pycache__ ' in source : source . remove ( ' __pycache__ ' )
source = [ ' intern/cycles/kernel/svm/ ' + s for s in source ]
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
2012-12-03 16:51:05 +00:00
# closure
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' scripts ' , ' addons ' , ' cycles ' , ' kernel ' , ' closure ' )
source = os . listdir ( ' intern/cycles/kernel/closure ' )
if ' __pycache__ ' in source : source . remove ( ' __pycache__ ' )
source = [ ' intern/cycles/kernel/closure/ ' + s for s in source ]
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
2014-04-04 11:07:23 +00:00
# geom
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' scripts ' , ' addons ' , ' cycles ' , ' kernel ' , ' geom ' )
source = os . listdir ( ' intern/cycles/kernel/geom ' )
if ' __pycache__ ' in source : source . remove ( ' __pycache__ ' )
source = [ ' intern/cycles/kernel/geom/ ' + s for s in source ]
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
2011-11-08 20:40:02 +00:00
# licenses
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' scripts ' , ' addons ' , ' cycles ' , ' license ' )
source = os . listdir ( ' intern/cycles/doc/license ' )
if ' __pycache__ ' in source : source . remove ( ' __pycache__ ' )
source . remove ( ' CMakeLists.txt ' )
source = [ ' intern/cycles/doc/license/ ' + s for s in source ]
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
2011-12-01 16:33:21 +00:00
2013-01-10 08:55:44 +00:00
if env [ ' WITH_BF_CYCLES ' ] :
# cuda binaries
if env [ ' WITH_BF_CYCLES_CUDA_BINARIES ' ] :
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' scripts ' , ' addons ' , ' cycles ' , ' lib ' )
for arch in env [ ' BF_CYCLES_CUDA_BINARIES_ARCH ' ] :
kernel_build_dir = os . path . join ( B . root_build_dir , ' intern/cycles/kernel ' )
2014-08-26 15:02:03 +00:00
for suffix in ( ' ' , ' _experimental ' ) :
cubin_file = os . path . join ( kernel_build_dir , " kernel %s _ %s .cubin " % ( suffix , arch ) )
cubininstall . append ( env . Install ( dir = dir , source = cubin_file ) )
2012-08-10 08:19:45 +00:00
2013-01-10 08:55:44 +00:00
# osl shaders
if env [ ' WITH_BF_CYCLES_OSL ' ] :
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' scripts ' , ' addons ' , ' cycles ' , ' shader ' )
2012-11-15 13:11:12 +00:00
2013-01-10 08:55:44 +00:00
osl_source_dir = Dir ( ' ./intern/cycles/kernel/shaders ' ) . srcnode ( ) . path
oso_build_dir = os . path . join ( B . root_build_dir , ' intern/cycles/kernel/shaders ' )
2012-11-15 13:11:12 +00:00
2013-01-10 08:55:44 +00:00
headers = ' node_color.h node_fresnel.h node_texture.h oslutil.h stdosl.h ' . split ( )
source = [ ' intern/cycles/kernel/shaders/ ' + s for s in headers ]
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
2012-11-15 13:11:12 +00:00
2013-01-10 08:55:44 +00:00
for f in os . listdir ( osl_source_dir ) :
if f . endswith ( ' .osl ' ) :
oso_file = os . path . join ( oso_build_dir , f . replace ( ' .osl ' , ' .oso ' ) )
scriptinstall . append ( env . Install ( dir = dir , source = oso_file ) )
2012-11-15 13:11:12 +00:00
2012-09-15 10:03:17 +00:00
if env [ ' WITH_BF_OCIO ' ] :
colormanagement = os . path . join ( ' release ' , ' datafiles ' , ' colormanagement ' )
for dp , dn , df in os . walk ( colormanagement ) :
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION , ' datafiles ' )
dir + = os . sep + os . path . basename ( colormanagement ) + dp [ len ( colormanagement ) : ]
source = [ os . path . join ( dp , f ) for f in df if not f . endswith ( " .pyc " ) ]
# To ensure empty dirs are created too
if len ( source ) == 0 :
env . Execute ( Mkdir ( dir ) )
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
2011-10-21 03:16:01 +00:00
if env [ ' WITH_BF_INTERNATIONAL ' ] :
internationalpaths = [ ' release ' + os . sep + ' datafiles ' ]
2012-08-10 08:19:45 +00:00
2011-10-21 03:16:01 +00:00
def check_path ( path , member ) :
return ( member in path . split ( os . sep ) )
2012-08-10 08:19:45 +00:00
2013-11-08 20:44:48 +00:00
po_dir = os . path . join ( " release " , " datafiles " , " locale " , " po " )
2013-12-12 04:56:56 +00:00
# font files
2011-10-21 03:16:01 +00:00
for intpath in internationalpaths :
for dp , dn , df in os . walk ( intpath ) :
2013-11-16 18:18:21 +00:00
if ' .git ' in df :
df . remove ( ' .git ' )
2011-10-21 03:16:01 +00:00
# we only care about release/datafiles/fonts, release/datafiles/locales
2013-11-16 18:09:03 +00:00
if check_path ( dp , " fonts " ) :
2011-10-21 03:16:01 +00:00
pass
else :
continue
2012-08-10 08:19:45 +00:00
2011-10-21 03:16:01 +00:00
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION )
dir + = os . sep + os . path . basename ( intpath ) + dp [ len ( intpath ) : ]
source = [ os . path . join ( dp , f ) for f in df if not f . endswith ( " .pyc " ) ]
# To ensure empty dirs are created too
if len ( source ) == 0 :
env . Execute ( Mkdir ( dir ) )
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
2009-04-11 02:18:24 +00:00
2013-12-12 04:56:56 +00:00
# .mo files
2013-11-16 18:09:03 +00:00
for f in os . listdir ( po_dir ) :
if not f . endswith ( " .po " ) :
continue
2013-11-08 20:44:48 +00:00
2013-11-16 18:09:03 +00:00
locale_name = os . path . splitext ( f ) [ 0 ]
2013-11-08 20:44:48 +00:00
2013-11-16 18:09:03 +00:00
mo_file = os . path . join ( B . root_build_dir , " locale " , locale_name + " .mo " )
2013-11-08 20:44:48 +00:00
2013-11-16 18:09:03 +00:00
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION )
dir = os . path . join ( dir , " datafiles " , " locale " , locale_name , " LC_MESSAGES " )
scriptinstall . append ( env . InstallAs ( os . path . join ( dir , " blender.mo " ) , mo_file ) )
2013-11-08 20:44:48 +00:00
2013-12-12 04:56:56 +00:00
# languages file
dir = os . path . join ( env [ ' BF_INSTALLDIR ' ] , VERSION )
dir = os . path . join ( dir , " datafiles " , " locale " )
languages_file = os . path . join ( " release " , " datafiles " , " locale " , " languages " )
scriptinstall . append ( env . InstallAs ( os . path . join ( dir , " languages " ) , languages_file ) )
2008-09-19 21:00:45 +00:00
#-- icons
2011-08-21 13:31:46 +00:00
if env [ ' OURPLATFORM ' ] == ' linux ' :
2010-08-29 20:52:05 +00:00
iconlist = [ ]
icontargetlist = [ ]
for tp , tn , tf in os . walk ( ' release/freedesktop/icons ' ) :
for f in tf :
iconlist . append ( os . path . join ( tp , f ) )
icontargetlist . append ( os . path . join ( * ( [ env [ ' BF_INSTALLDIR ' ] ] + tp . split ( os . sep ) [ 2 : ] + [ f ] ) ) )
iconinstall = [ ]
for targetdir , srcfile in zip ( icontargetlist , iconlist ) :
td , tf = os . path . split ( targetdir )
iconinstall . append ( env . Install ( dir = td , source = srcfile ) )
2008-09-19 21:00:45 +00:00
2013-02-13 08:55:03 +00:00
scriptinstall . append ( env . Install ( dir = env [ ' BF_INSTALLDIR ' ] , source = ' release/bin/blender-thumbnailer.py ' ) )
2008-12-14 17:32:24 +00:00
# dlls for linuxcross
# TODO - add more libs, for now this lets blenderlite run
if env [ ' OURPLATFORM ' ] == ' linuxcross ' :
2010-08-29 20:52:05 +00:00
dir = env [ ' BF_INSTALLDIR ' ]
source = [ ]
2010-02-01 18:39:41 +00:00
2010-08-29 20:52:05 +00:00
if env [ ' WITH_BF_OPENMP ' ] :
source + = [ ' ../lib/windows/pthreads/lib/pthreadGC2.dll ' ]
2010-02-01 18:39:41 +00:00
2010-08-29 20:52:05 +00:00
scriptinstall . append ( env . Install ( dir = dir , source = source ) )
2008-12-14 17:32:24 +00:00
2006-02-04 14:15:10 +00:00
textlist = [ ]
texttargetlist = [ ]
for tp , tn , tf in os . walk ( ' release/text ' ) :
2010-08-29 20:52:05 +00:00
for f in tf :
textlist . append ( tp + os . sep + f )
2006-02-04 14:15:10 +00:00
2013-09-25 08:35:43 +00:00
# Font licenses
2013-09-25 19:18:28 +00:00
textlist . append ( ' release/datafiles/LICENSE-bfont.ttf.txt ' )
2013-09-25 08:35:43 +00:00
if env [ ' WITH_BF_INTERNATIONAL ' ] :
2013-09-25 19:18:28 +00:00
textlist + = [ ' release/datafiles/LICENSE-droidsans.ttf.txt ' , ' release/datafiles/LICENSE-bmonofont-i18n.ttf.txt ' ]
2013-09-25 08:35:43 +00:00
2010-08-02 16:27:41 +00:00
textinstall = env . Install ( dir = env [ ' BF_INSTALLDIR ' ] , source = textlist )
2006-02-04 14:15:10 +00:00
2008-03-22 01:39:11 +00:00
if env [ ' OURPLATFORM ' ] == ' darwin ' :
2012-05-29 12:13:45 +00:00
allinstall = [ blenderinstall , textinstall ]
2011-08-21 13:31:46 +00:00
elif env [ ' OURPLATFORM ' ] == ' linux ' :
2013-01-10 08:01:07 +00:00
allinstall = [ blenderinstall , dotblenderinstall , scriptinstall , textinstall , iconinstall , cubininstall ]
2008-03-22 01:39:11 +00:00
else :
2013-01-10 08:01:07 +00:00
allinstall = [ blenderinstall , dotblenderinstall , scriptinstall , textinstall , cubininstall ]
2006-02-04 14:15:10 +00:00
2010-02-01 18:39:41 +00:00
if env [ ' OURPLATFORM ' ] in ( ' win32-vc ' , ' win32-mingw ' , ' win64-vc ' , ' linuxcross ' ) :
2010-08-29 20:52:05 +00:00
dllsources = [ ]
# Used when linking to libtiff was dynamic
# keep it here until compilation on all platform would be ok
# dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
if env [ ' OURPLATFORM ' ] != ' linuxcross ' :
# pthreads library is already added
dllsources + = [ ' $ {BF_PTHREADS_LIBPATH} /$ {BF_PTHREADS_LIB} .dll ' ]
if env [ ' WITH_BF_SDL ' ] :
2014-11-13 15:19:57 +00:00
dllsources . append ( ' $ {BF_SDL_LIBPATH} /SDL2.dll ' )
2010-08-29 20:52:05 +00:00
if env [ ' WITH_BF_PYTHON ' ] :
if env [ ' BF_DEBUG ' ] :
dllsources . append ( ' $ {BF_PYTHON_LIBPATH} /$ {BF_PYTHON_DLL} _d.dll ' )
2014-08-31 07:08:07 +00:00
dllsources . append ( ' $ {BF_PYTHON_LIBPATH} /sqlite3_d.dll ' )
2010-08-29 20:52:05 +00:00
else :
dllsources . append ( ' $ {BF_PYTHON_LIBPATH} /$ {BF_PYTHON_DLL} .dll ' )
2014-08-31 07:08:07 +00:00
dllsources . append ( ' $ {BF_PYTHON_LIBPATH} /sqlite3.dll ' )
2010-08-29 20:52:05 +00:00
if env [ ' WITH_BF_ICONV ' ] :
if env [ ' OURPLATFORM ' ] == ' win64-vc ' :
pass # we link statically to iconv on win64
elif not env [ ' OURPLATFORM ' ] in ( ' win32-mingw ' , ' linuxcross ' ) :
#gettext for MinGW and cross-compilation is compiled staticly
dllsources + = [ ' $ {BF_ICONV_LIBPATH} /iconv.dll ' ]
if env [ ' WITH_BF_OPENAL ' ] :
dllsources . append ( ' $ {LCGDIR} /openal/lib/OpenAL32.dll ' )
2014-05-15 06:12:15 +00:00
dllsources . append ( ' $ {LCGDIR} /openal/lib/wrap_oal.dll ' )
2010-08-29 20:52:05 +00:00
if env [ ' WITH_BF_SNDFILE ' ] :
dllsources . append ( ' $ {LCGDIR} /sndfile/lib/libsndfile-1.dll ' )
if env [ ' WITH_BF_FFMPEG ' ] :
2011-08-03 10:50:21 +00:00
dllsources + = env [ ' BF_FFMPEG_DLL ' ] . split ( )
2011-03-29 13:00:03 +00:00
# Since the thumb handler is loaded by Explorer, architecture is
# strict: the x86 build fails on x64 Windows. We need to ship
# both builds in x86 packages.
2014-02-04 17:55:32 +00:00
if B . bitness == 32 :
2012-08-10 08:19:45 +00:00
dllsources . append ( ' $ {LCGDIR} /thumbhandler/lib/BlendThumb.dll ' )
2011-03-29 13:00:03 +00:00
dllsources . append ( ' $ {LCGDIR} /thumbhandler/lib/BlendThumb64.dll ' )
2012-09-16 18:05:32 +00:00
if env [ ' WITH_BF_OCIO ' ] :
if not env [ ' OURPLATFORM ' ] in ( ' win32-mingw ' , ' linuxcross ' ) :
dllsources . append ( ' $ {LCGDIR} /opencolorio/bin/OpenColorIO.dll ' )
2012-09-15 10:03:17 +00:00
2012-09-16 18:05:32 +00:00
else :
dllsources . append ( ' $ {LCGDIR} /opencolorio/bin/libOpenColorIO.dll ' )
2013-06-15 21:20:06 +00:00
2011-03-29 13:00:03 +00:00
dllsources . append ( ' #source/icons/blender.exe.manifest ' )
2010-08-29 20:52:05 +00:00
windlls = env . Install ( dir = env [ ' BF_INSTALLDIR ' ] , source = dllsources )
allinstall + = windlls
2006-02-04 14:15:10 +00:00
2012-04-24 12:57:58 +00:00
if env [ ' OURPLATFORM ' ] == ' win64-mingw ' :
dllsources = [ ]
2012-08-10 08:19:45 +00:00
2012-04-24 12:57:58 +00:00
if env [ ' WITH_BF_PYTHON ' ] :
if env [ ' BF_DEBUG ' ] :
dllsources . append ( ' $ {BF_PYTHON_LIBPATH} /$ {BF_PYTHON_DLL} _d.dll ' )
else :
dllsources . append ( ' $ {BF_PYTHON_LIBPATH} /$ {BF_PYTHON_DLL} .dll ' )
if env [ ' WITH_BF_FFMPEG ' ] :
dllsources + = env [ ' BF_FFMPEG_DLL ' ] . split ( )
if env [ ' WITH_BF_OPENAL ' ] :
dllsources . append ( ' $ {LCGDIR} /openal/lib/OpenAL32.dll ' )
dllsources . append ( ' $ {LCGDIR} /openal/lib/wrap_oal.dll ' )
if env [ ' WITH_BF_SNDFILE ' ] :
dllsources . append ( ' $ {LCGDIR} /sndfile/lib/libsndfile-1.dll ' )
if env [ ' WITH_BF_SDL ' ] :
dllsources . append ( ' $ {LCGDIR} /sdl/lib/SDL.dll ' )
2012-08-10 08:19:45 +00:00
if ( env [ ' WITH_BF_OPENMP ' ] ) :
dllsources . append ( ' $ {LCGDIR} /binaries/libgomp-1.dll ' )
2013-06-15 21:20:06 +00:00
2012-09-16 18:05:32 +00:00
if env [ ' WITH_BF_OCIO ' ] :
dllsources . append ( ' $ {LCGDIR} /opencolorio/bin/libOpenColorIO.dll ' )
2012-08-10 08:19:45 +00:00
2012-04-24 12:57:58 +00:00
dllsources . append ( ' $ {LCGDIR} /thumbhandler/lib/BlendThumb64.dll ' )
2012-07-05 11:39:11 +00:00
dllsources . append ( ' $ {LCGDIR} /binaries/libgcc_s_sjlj-1.dll ' )
2012-07-05 11:45:28 +00:00
dllsources . append ( ' $ {LCGDIR} /binaries/libwinpthread-1.dll ' )
2012-07-06 13:36:54 +00:00
dllsources . append ( ' $ {LCGDIR} /binaries/libstdc++-6.dll ' )
2012-04-24 12:57:58 +00:00
dllsources . append ( ' #source/icons/blender.exe.manifest ' )
windlls = env . Install ( dir = env [ ' BF_INSTALLDIR ' ] , source = dllsources )
allinstall + = windlls
2006-02-05 17:50:19 +00:00
installtarget = env . Alias ( ' install ' , allinstall )
2006-02-04 14:15:10 +00:00
bininstalltarget = env . Alias ( ' install-bin ' , blenderinstall )
2007-05-31 11:15:47 +00:00
nsisaction = env . Action ( btools . NSIS_Installer , btools . NSIS_print )
nsiscmd = env . Command ( ' nsisinstaller ' , None , nsisaction )
nsisalias = env . Alias ( ' nsis ' , nsiscmd )
2008-10-19 21:25:17 +00:00
if ' blender ' in B . targets :
2010-08-29 20:52:05 +00:00
blenderexe = env . Alias ( ' blender ' , B . program_list )
Depends ( blenderexe , installtarget )
2008-10-19 21:25:17 +00:00
2006-02-04 14:15:10 +00:00
if env [ ' WITH_BF_PLAYER ' ] :
2010-08-29 20:52:05 +00:00
blenderplayer = env . Alias ( ' blenderplayer ' , B . program_list )
Depends ( blenderplayer , installtarget )
2006-02-04 15:10:59 +00:00
if not env [ ' WITH_BF_GAMEENGINE ' ] :
2010-08-29 20:52:05 +00:00
blendernogame = env . Alias ( ' blendernogame ' , B . program_list )
Depends ( blendernogame , installtarget )
2006-02-07 22:41:17 +00:00
2008-09-16 06:31:55 +00:00
if ' blenderlite ' in B . targets :
2010-08-29 20:52:05 +00:00
blenderlite = env . Alias ( ' blenderlite ' , B . program_list )
Depends ( blenderlite , installtarget )
2008-09-16 06:31:55 +00:00
2007-05-31 11:15:47 +00:00
Depends ( nsiscmd , allinstall )
2011-03-22 10:26:53 +00:00
buildslave_action = env . Action ( btools . buildslave , btools . buildslave_print )
buildslave_cmd = env . Command ( ' buildslave_exec ' , None , buildslave_action )
buildslave_alias = env . Alias ( ' buildslave ' , buildslave_cmd )
Depends ( buildslave_cmd , allinstall )
2013-01-10 08:01:07 +00:00
cudakernels_action = env . Action ( btools . cudakernels , btools . cudakernels_print )
cudakernels_cmd = env . Command ( ' cudakernels_exec ' , None , cudakernels_action )
cudakernels_alias = env . Alias ( ' cudakernels ' , cudakernels_cmd )
cudakernel_dir = os . path . join ( os . path . abspath ( os . path . normpath ( B . root_build_dir ) ) , ' intern/cycles/kernel ' )
cuda_kernels = [ ]
for x in env [ ' BF_CYCLES_CUDA_BINARIES_ARCH ' ] :
cubin = os . path . join ( cudakernel_dir , ' kernel_ ' + x + ' .cubin ' )
cuda_kernels . append ( cubin )
Depends ( cudakernels_cmd , cuda_kernels )
Depends ( cudakernels_cmd , cubininstall )
2006-02-04 14:15:10 +00:00
Default ( B . program_list )
2007-08-14 20:55:59 +00:00
if not env [ ' WITHOUT_BF_INSTALL ' ] :
2010-08-29 20:52:05 +00:00
Default ( installtarget )
2011-03-22 10:26:53 +00:00