| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
import os, string, sys, re, glob, copy, types, traceback, pprint, tempfile, shutil |
|---|
| 5 |
pj = os.path.join |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
try: |
|---|
| 9 |
import wing.wingdbstub |
|---|
| 10 |
print "Loaded wingdb stub for debugging..." |
|---|
| 11 |
except: |
|---|
| 12 |
pass |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
try: |
|---|
| 18 |
import SConsAddons.Util |
|---|
| 19 |
print "Using SConsAddons from: ", os.path.dirname(SConsAddons.Util.__file__) |
|---|
| 20 |
except: |
|---|
| 21 |
sys.path.insert(0,pj('Tools','scons-addons','src')) |
|---|
| 22 |
print "Using SConsAddons from: Tools/scons-addons/src" |
|---|
| 23 |
|
|---|
| 24 |
sys.path.insert(0,pj('Tools','scons-build')) |
|---|
| 25 |
|
|---|
| 26 |
print "-------------------------------------------------" |
|---|
| 27 |
print "WARNING: The build is currently in development. " |
|---|
| 28 |
print " - It needs the svn version of scons-addons" |
|---|
| 29 |
print "WARNING:" |
|---|
| 30 |
|
|---|
| 31 |
import SCons.Environment |
|---|
| 32 |
import SCons |
|---|
| 33 |
import SConsAddons.Util as sca_util |
|---|
| 34 |
import SConsAddons.Options as sca_opts |
|---|
| 35 |
import SConsAddons.Variants as sca_variants |
|---|
| 36 |
import SConsAddons.Builders |
|---|
| 37 |
import SConsAddons.Options.Boost |
|---|
| 38 |
import SConsAddons.Options.VTK |
|---|
| 39 |
from SConsAddons.EnvironmentBuilder import EnvironmentBuilder |
|---|
| 40 |
from LibraryUtils import * |
|---|
| 41 |
from sets import Set |
|---|
| 42 |
from socket import gethostname |
|---|
| 43 |
|
|---|
| 44 |
import OpenSG.AddOnHacks |
|---|
| 45 |
import OpenSG.ColladaOption |
|---|
| 46 |
|
|---|
| 47 |
from BuildInfoScanner import BuildInfoScanner |
|---|
| 48 |
from RevisionTagWriter import RevisionTagWriter |
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
try: |
|---|
| 52 |
import pysvn |
|---|
| 53 |
have_pysvn = True |
|---|
| 54 |
except: |
|---|
| 55 |
have_pysvn = False |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
GetPlatform = sca_util.GetPlatform |
|---|
| 59 |
Export('GetPlatform') |
|---|
| 60 |
verbose_build = False |
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
def registerfcd2codeBuilder(env, required=True): |
|---|
| 82 |
print "Setting up fcd2code builder...", |
|---|
| 83 |
|
|---|
| 84 |
fcd2code_cmd = pj("Tools", "fcd2code","fcd2code") |
|---|
| 85 |
fcd2code_cmd = os.path.abspath(fcd2code_cmd) |
|---|
| 86 |
if not os.path.isfile(fcd2code_cmd): |
|---|
| 87 |
print " Warning: fcd2code not found at: ", fcd2code_cmd |
|---|
| 88 |
if required: |
|---|
| 89 |
sys.exit(1) |
|---|
| 90 |
return |
|---|
| 91 |
|
|---|
| 92 |
template_files = glob.glob(pj("Tools", |
|---|
| 93 |
"fcd2code", |
|---|
| 94 |
"*TemplateFieldContainer*Base*.txt")) |
|---|
| 95 |
|
|---|
| 96 |
template_files.append(glob.glob(pj("Tools", |
|---|
| 97 |
"fcd2code", |
|---|
| 98 |
"*TemplateFieldContainer*Field*.txt"))) |
|---|
| 99 |
|
|---|
| 100 |
template_files.append(glob.glob(pj("Tools", |
|---|
| 101 |
"fcd2code", |
|---|
| 102 |
"*Template*.py"))) |
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
def prop_emitter(target,source,env, template_files=template_files): |
|---|
| 107 |
""" Returns a list of files including all output forms and |
|---|
| 108 |
The input templates as sources. |
|---|
| 109 |
""" |
|---|
| 110 |
assert str(source[0]).endswith(".fcd") |
|---|
| 111 |
assert len(source) == 1 |
|---|
| 112 |
|
|---|
| 113 |
base_name = os.path.splitext(str(source[0]))[0] |
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
target = [] |
|---|
| 117 |
for ext in ["Base.cpp","Base.h","Base.inl","Fields.h"]: |
|---|
| 118 |
target.append(base_name+ext) |
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
source.extend(template_files) |
|---|
| 122 |
|
|---|
| 123 |
return (target, source) |
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
fcd2code_builder = Builder(action = " ".join([sys.executable, fcd2code_cmd]) + ' -c -b -d $SOURCE -p ${TARGET.dir}', |
|---|
| 127 |
src_suffix = '.fcd', |
|---|
| 128 |
suffix = 'unused.h', |
|---|
| 129 |
emitter = prop_emitter) |
|---|
| 130 |
env.Append(BUILDERS = {'fcd2code' : fcd2code_builder}) |
|---|
| 131 |
print "[OK]" |
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
def registerfbd2codeBuilder(env, required=True): |
|---|
| 137 |
print "Setting up fbd2code builder...", |
|---|
| 138 |
|
|---|
| 139 |
fbd2code_cmd = pj("Tools", "fcd2code","fcd2code") |
|---|
| 140 |
fbd2code_cmd = os.path.abspath(fbd2code_cmd) |
|---|
| 141 |
if not os.path.isfile(fbd2code_cmd): |
|---|
| 142 |
print " Warning: fcd2code not found at: ", fbd2code_cmd |
|---|
| 143 |
if required: |
|---|
| 144 |
sys.exit(1) |
|---|
| 145 |
return |
|---|
| 146 |
|
|---|
| 147 |
template_files = glob.glob(pj("Tools", |
|---|
| 148 |
"fcd2code", |
|---|
| 149 |
"*TemplateFieldBundle*Base*.txt")) |
|---|
| 150 |
|
|---|
| 151 |
template_files.append(glob.glob(pj("Tools", |
|---|
| 152 |
"fcd2code", |
|---|
| 153 |
"*TemplateFieldBundle*Field*.txt"))) |
|---|
| 154 |
|
|---|
| 155 |
template_files.append(glob.glob(pj("Tools", |
|---|
| 156 |
"fcd2code", |
|---|
| 157 |
"*Template*.py"))) |
|---|
| 158 |
|
|---|
| 159 |
def prop_emitter(target,source,env, template_files=template_files): |
|---|
| 160 |
""" Returns a list of files including all output forms and |
|---|
| 161 |
The input templates as sources. |
|---|
| 162 |
""" |
|---|
| 163 |
assert str(source[0]).endswith(".fbd") |
|---|
| 164 |
assert len(source) == 1 |
|---|
| 165 |
|
|---|
| 166 |
base_name = os.path.splitext(str(source[0]))[0] |
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
target = [] |
|---|
| 170 |
for ext in ["Base.cpp","Base.h","Base.inl","Fields.h"]: |
|---|
| 171 |
target.append(base_name+ext) |
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
source.extend(template_files) |
|---|
| 175 |
|
|---|
| 176 |
return (target, source) |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
fbd2code_builder = Builder(action = " ".join([sys.executable, |
|---|
| 180 |
fbd2code_cmd]) + ' -c -b -B -d $SOURCE -p ${TARGET.dir}', |
|---|
| 181 |
src_suffix = '.fbd', |
|---|
| 182 |
suffix = 'unused.h', |
|---|
| 183 |
emitter = prop_emitter) |
|---|
| 184 |
env.Append(BUILDERS = {'fbd2code' : fbd2code_builder}) |
|---|
| 185 |
print "[OK]" |
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
def addScanParseSkel(common_env): |
|---|
| 189 |
""" This is an ugly hack to add the lex/yacc support into the build. It is ugly because of a couple of things. |
|---|
| 190 |
- We use some very custom flags |
|---|
| 191 |
- We need to post process the scanner to include a different file then normal. |
|---|
| 192 |
- We are forcing this to be done in the source tree in a subdir without actually going there. |
|---|
| 193 |
- Dependency management seems to be a little messed up right now in the code or scons. |
|---|
| 194 |
- BUGS: Scons does not seem to recognize that the files we are building here are source |
|---|
| 195 |
files for the libraries. This makes it so we have to run the build twice if the files change. |
|---|
| 196 |
Scons cannot recognize whether the existing files are current or not, if they come out of |
|---|
| 197 |
svn. This can result in spurious regens, which break the code if the wrong versions of |
|---|
| 198 |
flex/bison are present. |
|---|
| 199 |
""" |
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
if "yacc" in common_env["TOOLS"]: |
|---|
| 204 |
if common_env["enable_scanparse_regen"]: |
|---|
| 205 |
parser_env = common_env.Copy() |
|---|
| 206 |
parser_env.Append(YACCFLAGS = ["-d","-v","-pOSGScanParseSkel_","-bOSGScanParseSkel_"]) |
|---|
| 207 |
source_file = "Source/System/FileIO/ScanParseSkel/OSGScanParseSkelParser.yy" |
|---|
| 208 |
target_file = "Source/System/FileIO/ScanParseSkel/OSGScanParseSkelParser.cpp" |
|---|
| 209 |
yfiles = parser_env.CXXFile(target=target_file,source=source_file) |
|---|
| 210 |
NoClean(yfiles) |
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
y_cpp_file = str(yfiles[0]).replace("Source/","",1) |
|---|
| 215 |
y_hpp_file = str(yfiles[1]).replace("Source/","",1) |
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
else: |
|---|
| 222 |
print "WARNING: enable_scanparse_regen disabled. If you change .yy files they will not be rebuilt." |
|---|
| 223 |
common_env["TOOLS"].remove('yacc') |
|---|
| 224 |
else: |
|---|
| 225 |
print "WARNING: bison not available. If you change .yy files they cannot be rebuilt." |
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 |
if "lex" in common_env["TOOLS"]: |
|---|
| 231 |
def filter_header(target, source, env): |
|---|
| 232 |
""" Custom filter to change the include file for the flexlexer.h""" |
|---|
| 233 |
fname = str(target[0]) |
|---|
| 234 |
contents = open(fname).readlines() |
|---|
| 235 |
for i in range(len(contents)): |
|---|
| 236 |
if contents[i] == "#include <FlexLexer.h>\n": |
|---|
| 237 |
contents[i] = "#include \"%s\"\n" % os.path.split(OSG_flexlexer_h)[1] |
|---|
| 238 |
break |
|---|
| 239 |
open(fname,'w').writelines(contents) |
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 |
if common_env["enable_scanparse_regen"]: |
|---|
| 243 |
lexer_env = common_env.Copy() |
|---|
| 244 |
lexer_env.Append(LEXFLAGS = ["-+","-POSGScanParseSkel_"]) |
|---|
| 245 |
|
|---|
| 246 |
lexer_dir = pj('Source','System','FileIO','ScanParseSkel') |
|---|
| 247 |
sys_flexlexer_h = "/usr/include/FlexLexer.h" |
|---|
| 248 |
OSG_flexlexer_h = pj(lexer_dir,"OSGScanParseSkelScanner_FlexLexer.h") |
|---|
| 249 |
source_file = pj(lexer_dir,"OSGScanParseSkelScanner.ll") |
|---|
| 250 |
target_file = pj(lexer_dir,"OSGScanParseSkelScanner.cpp") |
|---|
| 251 |
|
|---|
| 252 |
|
|---|
| 253 |
std_lex_action = Action("$LEXCOM", "$LEXCOMSTR") |
|---|
| 254 |
filter_action = Action(filter_header, lambda t,s,e: "Filtering header: %s %s"%(str(t),str(s))) |
|---|
| 255 |
cxx_file_builder = lexer_env['BUILDERS']['CXXFile'] |
|---|
| 256 |
cxx_file_builder.add_action('.ll', Action([std_lex_action, filter_action])) |
|---|
| 257 |
lfiles = lexer_env.CXXFile(target=target_file,source=source_file) |
|---|
| 258 |
NoClean(lfiles) |
|---|
| 259 |
|
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 |
if os.path.exists(sys_flexlexer_h): |
|---|
| 263 |
flexlex_cp = lexer_env.Command(OSG_flexlexer_h, sys_flexlexer_h,[Copy('$TARGET','$SOURCE'),]) |
|---|
| 264 |
Depends(lfiles, flexlex_cp) |
|---|
| 265 |
|
|---|
| 266 |
|
|---|
| 267 |
if vars().has_key('yfiles'): |
|---|
| 268 |
Depends(lfiles, yfiles) |
|---|
| 269 |
|
|---|
| 270 |
|
|---|
| 271 |
scanner_src = target_file.replace("Source/","",1) |
|---|
| 272 |
|
|---|
| 273 |
|
|---|
| 274 |
|
|---|
| 275 |
else: |
|---|
| 276 |
print "WARNING: enable_scanparse_regen disabled. If you change .ll files they will not be rebuilt." |
|---|
| 277 |
common_env["TOOLS"].remove('lex') |
|---|
| 278 |
else: |
|---|
| 279 |
print "WARNING: flex not available. If you change .ll files they cannot be rebuilt." |
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 |
|
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 |
class SimpleAppendOption(sca_opts.SimpleOption): |
|---|
| 286 |
""" |
|---|
| 287 |
Variant of the simple option wrapper that appends a value to the environment instead |
|---|
| 288 |
of replacing it. |
|---|
| 289 |
""" |
|---|
| 290 |
def __init__(self, name, key, help): |
|---|
| 291 |
""" |
|---|
| 292 |
Create an option |
|---|
| 293 |
name - the name of the commandline option |
|---|
| 294 |
key - the name of the key in the environment to append to |
|---|
| 295 |
help - Help text about the option object |
|---|
| 296 |
""" |
|---|
| 297 |
sca_opts.SimpleOption.__init__(self, name, name, help + " (Use ':' to separate multiple)", \ |
|---|
| 298 |
None, None, None, None) |
|---|
| 299 |
self.key = key |
|---|
| 300 |
|
|---|
| 301 |
""" |
|---|
| 302 |
We want these options to be applied before all others, to have them have effect on e.g. |
|---|
| 303 |
StandardPackageOption tests, so override completeProcess instead of apply. |
|---|
| 304 |
""" |
|---|
| 305 |
def completeProcess(self, env): |
|---|
| 306 |
if self.value: |
|---|
| 307 |
for i in self.value.split(os.pathsep): |
|---|
| 308 |
exec("env.Append(%s = [i])" % self.key) |
|---|
| 309 |
|
|---|
| 310 |
|
|---|
| 311 |
|
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
EnsureSConsVersion(0,96,92) |
|---|
| 315 |
SourceSignatures('MD5') |
|---|
| 316 |
|
|---|
| 317 |
opensg_version_string = file("VERSION").readline().strip() |
|---|
| 318 |
|
|---|
| 319 |
print "Building OpenSG ", opensg_version_string |
|---|
| 320 |
|
|---|
| 321 |
|
|---|
| 322 |
|
|---|
| 323 |
|
|---|
| 324 |
platform = sca_util.GetPlatform() |
|---|
| 325 |
unspecified_prefix = "use-instlinks" |
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
if GetPlatform() == "win32": |
|---|
| 330 |
|
|---|
| 331 |
if ARGUMENTS.has_key("MSVS_VERSION"): |
|---|
| 332 |
common_env = Environment(MSVS_VERSION=ARGUMENTS["MSVS_VERSION"], |
|---|
| 333 |
ENV = os.environ, |
|---|
| 334 |
tools = ['default', 'doxygen'], |
|---|
| 335 |
toolpath = '.') |
|---|
| 336 |
else: |
|---|
| 337 |
common_env = Environment(tools = ['default', 'doxygen'], toolpath = '.') |
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 |
if common_env.has_key("MSVS") and common_env["MSVS"]["VERSION"] >= "8.0": |
|---|
| 341 |
common_env['SHLINKCOM'] = \ |
|---|
| 342 |
[common_env['SHLINKCOM'], |
|---|
| 343 |
'mt.exe -manifest ${TARGET}.manifest -outputresource:$TARGET;2'] |
|---|
| 344 |
else: |
|---|
| 345 |
if ARGUMENTS.has_key("icc"): |
|---|
| 346 |
use_cxxlib_icc = False |
|---|
| 347 |
|
|---|
| 348 |
if ARGUMENTS.has_key("cxxlib-icc"): |
|---|
| 349 |
use_cxxlib_icc = True |
|---|
| 350 |
|
|---|
| 351 |
common_env = Environment(ENV = os.environ, |
|---|
| 352 |
tools=['gnulink', 'intelicc', 'intelicpc', 'doxygen'], |
|---|
| 353 |
cxxlib_icc=use_cxxlib_icc, |
|---|
| 354 |
toolpath = ['.', 'Tools/scons-build/OpenSG/Tools']) |
|---|
| 355 |
else: |
|---|
| 356 |
common_env = Environment(ENV = os.environ, |
|---|
| 357 |
toolpath = '.', |
|---|
| 358 |
tools = ['default', 'doxygen']) |
|---|
| 359 |
|
|---|
| 360 |
dbfile = '.sconsign.' + platform + common_env.subst('$CXX') |
|---|
| 361 |
option_filename = "option.cache." + platform + '.' + common_env.subst('$CXX') |
|---|
| 362 |
|
|---|
| 363 |
if common_env.has_key("MSVS"): |
|---|
| 364 |
msvs_ver = common_env["MSVS"]["VERSION"] |
|---|
| 365 |
dbfile += "." + msvs_ver |
|---|
| 366 |
option_filename += "." + msvs_ver |
|---|
| 367 |
|
|---|
| 368 |
SConsignFile(dbfile) |
|---|
| 369 |
buildDir = "build." + platform + '.' + common_env.subst('$CXX') |
|---|
| 370 |
|
|---|
| 371 |
if ARGUMENTS.has_key("options_file"): |
|---|
| 372 |
opt_file = ARGUMENTS["options_file"] |
|---|
| 373 |
if os.path.exists(opt_file): |
|---|
| 374 |
print "Reading options from: %s" % str(opt_file) |
|---|
| 375 |
option_filename = opt_file |
|---|
| 376 |
else: |
|---|
| 377 |
print "Options file '%s' not found.. will continue with default '%s'" % \ |
|---|
| 378 |
(opt_file, option_filename) |
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
|
|---|
| 382 |
common_env["CONFIGUREDIR"] = '.sconf_temp_'+platform+'_'+common_env.subst('$CXX') |
|---|
| 383 |
common_env["CONFIGURELOG"] = 'sconf.log_'+platform+'_'+common_env.subst('$CXX') |
|---|
| 384 |
if common_env.has_key("MSVS"): |
|---|
| 385 |
common_env["CONFIGUREDIR"] += "." + common_env["MSVS"]["VERSION"] |
|---|
| 386 |
common_env["CONFIGURELOG"] += "." + common_env["MSVS"]["VERSION"] |
|---|
| 387 |
|
|---|
| 388 |
SConsAddons.Builders.registerDefineBuilder(common_env) |
|---|
| 389 |
SConsAddons.Builders.registerSubstBuilder(common_env) |
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 |
variant_helper = sca_variants.VariantsHelper(variantKeys=["type", "arch"]) |
|---|
| 393 |
base_bldr = EnvironmentBuilder() |
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 |
|
|---|
| 412 |
|
|---|
| 413 |
|
|---|
| 414 |
|
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
|
|---|
| 420 |
|
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 |
|
|---|
| 424 |
|
|---|
| 425 |
|
|---|
| 426 |
opts = sca_opts.Options(files = [option_filename, 'options.custom'], |
|---|
| 427 |
args= ARGUMENTS) |
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 |
if "win32" == platform: |
|---|
| 431 |
glut_libname = "glut32" |
|---|
| 432 |
tiff_libname = ["libtiff_i", "libtiff", "tif32"] |
|---|
| 433 |
zlib_libname = ["zlib1", "zlib"] |
|---|
| 434 |
jpeg_libname = "libjpeg" |
|---|
| 435 |
png_libname = ["libpng13", "libpng"] |
|---|
| 436 |
else: |
|---|
| 437 |
glut_libname = "glut" |
|---|
| 438 |
tiff_libname = "tiff" |
|---|
| 439 |
zlib_libname = "z" |
|---|
| 440 |
jpeg_libname = "jpeg" |
|---|
| 441 |
png_libname = "png" |
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 |
build_options = {} |
|---|
| 446 |
build_options["install_prefix"] = sca_opts.SimpleOption( |
|---|
| 447 |
"prefix", "prefix", "Installation prefix", unspecified_prefix, None, None, None) |
|---|
| 448 |
build_options["build_suffix"] = sca_opts.SimpleOption( |
|---|
| 449 |
"build_suffix", "build_suffix", |
|---|
| 450 |
"Suffix to append to build directory. Useful for compiling multiple variations on the same platform", |
|---|
| 451 |
"", None, None, None) |
|---|
| 452 |
build_options["enable_fcd2code"] = sca_opts.BoolOption( |
|---|
| 453 |
"enable_fcd2code", "Enable code generation pass (from .fcd files) during build", False) |
|---|
| 454 |
build_options["enable_fbd2code"] = sca_opts.BoolOption( |
|---|
| 455 |
"enable_fbd2code", "Enable code generation pass (from .fbd files) during build", False) |
|---|
| 456 |
build_options["enable_distcc"] = sca_opts.BoolOption( |
|---|
| 457 |
"enable_distcc", "Enable use of distcc during build. (distcc must be in your path)", False) |
|---|
| 458 |
build_options["enable_unittests"] = sca_opts.BoolOption( |
|---|
| 459 |
"enable_unittests", "Enable building and running of the unit tests after build", True) |
|---|
| 460 |
build_options["enable_revision_tags"] = sca_opts.BoolOption( |
|---|
| 461 |
"enable_revision_tags", "Enable updating of OSG*Def.cpp files with current svn revision numbers", False) |
|---|
| 462 |
build_options["enable_gv_beta"] = sca_opts.BoolOption( |
|---|
| 463 |
"enable_gv_beta", "Enable gv testing stuff", False) |
|---|
| 464 |
|
|---|
| 465 |
|
|---|
| 466 |
required_libs_options = {} |
|---|
| 467 |
if "win32" == platform: |
|---|
| 468 |
|
|---|
| 469 |
toolset = "auto" |
|---|
| 470 |
|
|---|
| 471 |
if common_env.has_key("MSVS"): |
|---|
| 472 |
toolset = 'vc' + common_env["MSVS"]["VERSION"].replace('.', '') |
|---|
| 473 |
|
|---|
| 474 |
required_libs_options["boost"] = sca_opts.Boost.Boost( |
|---|
| 475 |
"boost", "1.31.0", libs = ["filesystem"], required = True, |
|---|
| 476 |
useVersion = True, allowLibNameFallbacks=True, toolset = toolset); |
|---|
| 477 |
else: |
|---|
| 478 |
required_libs_options["boost"] = sca_opts.Boost.Boost( |
|---|
| 479 |
"boost", "1.31.0", libs = ["filesystem"], required = True, useVersion = True, allowLibNameFallbacks=True); |
|---|
| 480 |
|
|---|
| 481 |
|
|---|
| 482 |
optional_libs_options = {} |
|---|
| 483 |
optional_libs_options["jpeg"] = sca_opts.StandardPackageOption( |
|---|
| 484 |
"jpeg", "Location of the JPEG library", library = jpeg_libname, required = False) |
|---|
| 485 |
|
|---|
| 486 |
optional_libs_options["tiff"] = sca_opts.MultiNamePackageOption( |
|---|
| 487 |
"tiff", "Location of the TIFF library", library = tiff_libname, required = False) |
|---|
| 488 |
|
|---|
| 489 |
optional_libs_options["png"] = sca_opts.MultiNamePackageOption( |
|---|
| 490 |
"png", "Location of the PNG library", library = png_libname, required = False) |
|---|
| 491 |
|
|---|
| 492 |
optional_libs_options["glut"] = sca_opts.StandardPackageOption( |
|---|
| 493 |
"glut", "Location of the GLUT library", library = glut_libname, |
|---|
| 494 |
header = "GL/glut.h", required = False) |
|---|
| 495 |
|
|---|
| 496 |
optional_libs_options["freetype"] = sca_opts.StandardPackageOption( |
|---|
| 497 |
"freetype", "Location of freetype2 library", library = "freetype", |
|---|
| 498 |
header = "freetype/config/ftheader.h", required = False) |
|---|
| 499 |
|
|---|
| 500 |
if "win32" != platform: |
|---|
| 501 |
optional_libs_options["freetype"].incDir = '/usr/include/freetype2' |
|---|
| 502 |
|
|---|
| 503 |
optional_libs_options["fontconfig"] = sca_opts.StandardPackageOption( |
|---|
| 504 |
"fontconfig", "Location of fontconfig library", library = "fontconfig", |
|---|
| 505 |
header = "fontconfig/fontconfig.h", required = False) |
|---|
| 506 |
|
|---|
| 507 |
optional_libs_options["zlib"] = sca_opts.MultiNamePackageOption( |
|---|
| 508 |
"zlib", "Location of the zlib compression library", library = zlib_libname, |
|---|
| 509 |
header = "zlib.h", required = False) |
|---|
| 510 |
|
|---|
| 511 |
optional_libs_options["NVPerfSDK"] = sca_opts.StandardPackageOption( |
|---|
| 512 |
"NVPerfSDK", "Location of the NVPerfSDK library", library = "NVPerfSDK", |
|---|
| 513 |
header = "NVPerfSDK.h", required = False) |
|---|
| 514 |
|
|---|
| 515 |
collada_libs = ["collada_dae", "collada_dom"] |
|---|
| 516 |
if "win32" == platform: |
|---|
| 517 |
|
|---|
| 518 |
|
|---|
| 519 |
|
|---|
| 520 |
collada_libs = ["libcollada_dae", "libcollada_dom"] |
|---|
| 521 |
optional_libs_options["collada"] = OpenSG.ColladaOption.ColladaOption( |
|---|
| 522 |
"collada", "Location of the collada dom library", library = collada_libs, |
|---|
| 523 |
header = "dae/daeIntegrationObject.h", required = False) |
|---|
| 524 |
|
|---|
| 525 |
xml2_lib = ["xml2"] |
|---|
| 526 |
if "win32" == platform: |
|---|
| 527 |
xml2_lib = ["libxml2", "libxml2_a"] |
|---|
| 528 |
optional_libs_options["xml2"] = sca_opts.MultiNamePackageOption( |
|---|
| 529 |
"xml2", "Location of the xml2 library", library = xml2_lib, |
|---|
| 530 |
header = "libxml/xmlversion.h", required = False) |
|---|
| 531 |
|
|---|
| 532 |
iconv_lib = "iconv" |
|---|
| 533 |
if "win32" == platform: |
|---|
| 534 |
iconv_lib = ["iconv", "iconv_a"] |
|---|
| 535 |
optional_libs_options["iconv"] = sca_opts.MultiNamePackageOption( |
|---|
| 536 |
"iconv", "Location of the iconv library", library = iconv_lib, |
|---|
| 537 |
required = False) |
|---|
| 538 |
|
|---|
| 539 |
optional_libs_options['vtk'] = sca_opts.VTK.VTK( |
|---|
| 540 |
"vtk", |
|---|
| 541 |
"Location of the vtk libraries", |
|---|
| 542 |
required = False, |
|---|
| 543 |
libList = ['vtkRendering', |
|---|
| 544 |
'vtkIO', |
|---|
| 545 |
'vtkGraphics', |
|---|
| 546 |
'vtkImaging', |
|---|
| 547 |
'vtkFiltering', |
|---|
| 548 |
'vtkCommon', |
|---|
| 549 |
'vtkftgl', |
|---|
| 550 |
'vtkDICOMParser', |
|---|
| 551 |
'vtksys', |
|---|
| 552 |
'vtkMPEG2Encode']) |
|---|
| 553 |
|
|---|
| 554 |
|
|---|
| 555 |
feature_options = {} |
|---|
| 556 |
feature_options["gif"] = sca_opts.BoolOption( |
|---|
| 557 |
"enable_gif", "Enable GIF support", True) |
|---|
| 558 |
|
|---|
| 559 |
feature_options["fcptr_mode"] = sca_opts.EnumOption( |
|---|
| 560 |
"fcptr_mode", "Select the mode for field container pointers", |
|---|
| 561 |
"MT_FCPTR", ["SINGLE_THREAD", "MT_CPTR", "MT_FCPTR"]) |
|---|
| 562 |
|
|---|
| 563 |
feature_options["disable_deprecated"] = sca_opts.BoolOption( |
|---|
| 564 |
"disable_deprecated", "Disable deprecated interfaces and code", False) |
|---|
| 565 |
|
|---|
| 566 |
feature_options["disable_glut_glsubdir"] = sca_opts.BoolOption( |
|---|
| 567 |
"disable_glut_glsubdir", "Do not use GL subdir when including glut.h", False) |
|---|
| 568 |
|
|---|
| 569 |
feature_options["enable_osg1_compat"] = sca_opts.BoolOption( |
|---|
| 570 |
"enable_osg1_compat", "Enable OpenSG 1.x compatibility", False) |
|---|
| 571 |
|
|---|
| 572 |
feature_options["enable_deprecated_props"] = sca_opts.BoolOption( |
|---|
| 573 |
"enable_deprecated_props", "Enable deprecated property types.", False) |
|---|
| 574 |
|
|---|
| 575 |
feature_options["enable_new_osb_io"] = sca_opts.BoolOption( |
|---|
| 576 |
"enable_new_osb_io", "Enable the new OSB IO facilities.", False) |
|---|
| 577 |
|
|---|
| 578 |
feature_options["enable_collada"] = sca_opts.BoolOption( |
|---|
| 579 |
"enable_collada", "Enable the Collada IO facilities.", False) |
|---|
| 580 |
|
|---|
| 581 |
feature_options["enable_scanparse_regen"] = sca_opts.BoolOption( |
|---|
| 582 |
"enable_scanparse_regen", "Enable regenerating the scanner/parser files using flex and bison", False); |
|---|
| 583 |
|
|---|
| 584 |
feature_options["enable_testcontainer"] = sca_opts.BoolOption( |
|---|
| 585 |
"enable_testcontainer", "Enable container used for testing (from Source/Test)", False) |
|---|
| 586 |
|
|---|
| 587 |
feature_options["docs_mode"] = sca_opts.EnumOption( |
|---|
| 588 |
"docs_mode", "Select the mode for documentation generation", |
|---|
| 589 |
"NONE", ["NONE", "STANDALONE", "TRAC", "DEVELOPER"]) |
|---|
| 590 |
|
|---|
| 591 |
feature_options["enable_valgrind_checks"] = sca_opts.BoolOption( |
|---|
| 592 |
"enable_valgrind_checks", "Enable valgrind check code embedded in OpenSG.", False) |
|---|
| 593 |
|
|---|
| 594 |
feature_options["enable_memory_debugging"] = sca_opts.BoolOption( |
|---|
| 595 |
"enable_memory_debugging", "Enable memory debugging checks in OpenSG.", False) |
|---|
| 596 |
|
|---|
| 597 |
feature_options["enable_double_matrix_stack"] = sca_opts.BoolOption( |
|---|
| 598 |
"enable_double_matrix_stack", "Enable double precision matrix stack in render traversal.", False) |
|---|
| 599 |
|
|---|
| 600 |
if "win32" == platform: |
|---|
| 601 |
feature_options["enable_win_localstorage"] = sca_opts.BoolOption( |
|---|
| 602 |
"enable_win_localstorage", "Enable use of local storage instead of __declspec to "+ |
|---|
| 603 |
"get thread local storage on windows", True) |
|---|
| 604 |
|
|---|
| 605 |
if "win32" != platform: |
|---|
| 606 |
feature_options["enable_elf_localstorage"] = sca_opts.BoolOption( |
|---|
| 607 |
"enable_elf_localstorage", "Enable use of elf thread local storage with pthreads", |
|---|
| 608 |
("linux" == platform)) |
|---|
| 609 |
|
|---|
| 610 |
|
|---|
| 611 |
misc_options = {} |
|---|
| 612 |
|
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 |
|
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 |
|
|---|
| 619 |
extra_libs_options = {} |
|---|
| 620 |
extra_libs_options["incdir"] = SimpleAppendOption('add_incdir', 'CPPPATH', 'Additional include dir') |
|---|
| 621 |
extra_libs_options["libdir"] = SimpleAppendOption('add_libdir', 'LIBPATH', 'Additional library dir') |
|---|
| 622 |
extra_libs_options["lib"] = SimpleAppendOption('add_lib', 'LIBS', 'Additional library') |
|---|
| 623 |
|
|---|
| 624 |
|
|---|
| 625 |
image_format_options = {} |
|---|
| 626 |
image_format_options["jpeg"] = optional_libs_options["jpeg"] |
|---|
| 627 |
image_format_options["tiff"] = optional_libs_options["tiff"] |
|---|
| 628 |
image_format_options["png"] = optional_libs_options["png"] |
|---|
| 629 |
image_format_options["gif"] = feature_options["gif"] |
|---|
| 630 |
|
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 |
|
|---|
| 634 |
|
|---|
| 635 |
for opt in extra_libs_options.itervalues(): |
|---|
| 636 |
if opt not in image_format_options.itervalues(): |
|---|
| 637 |
opts.AddOption(opt) |
|---|
| 638 |
|
|---|
| 639 |
opts.AddOption(sca_opts.SeparatorOption("\nBuild/Install settings")) |
|---|
| 640 |
for opt in build_options.itervalues(): |
|---|
| 641 |
if opt not in image_format_options.itervalues(): |
|---|
| 642 |
opts.AddOption(opt) |
|---|
| 643 |
|
|---|
| 644 |
opts.AddOption(sca_opts.SeparatorOption("\nPackage settings (required libs)")) |
|---|
| 645 |
for opt in required_libs_options.itervalues(): |
|---|
| 646 |
if opt not in image_format_options.itervalues(): |
|---|
| 647 |
opts.AddOption(opt) |
|---|
| 648 |
|
|---|
| 649 |
opts.AddOption(sca_opts.SeparatorOption("\nPackage settings (optional libs)")) |
|---|
| 650 |
for opt in optional_libs_options.itervalues(): |
|---|
| 651 |
if opt not in image_format_options.itervalues(): |
|---|
| 652 |
opts.AddOption(opt) |
|---|
| 653 |
|
|---|
| 654 |
for opt in image_format_options.itervalues(): |
|---|
| 655 |
opts.AddOption(opt) |
|---|
| 656 |
|
|---|
| 657 |
|
|---|
| 658 |
opts.AddOption(sca_opts.SeparatorOption("\nAdvanced options")) |
|---|
| 659 |
for opt in feature_options.itervalues(): |
|---|
| 660 |
if opt not in image_format_options.itervalues(): |
|---|
| 661 |
opts.AddOption(opt) |
|---|
| 662 |
|
|---|
| 663 |
for opt in misc_options.itervalues(): |
|---|
| 664 |
if opt not in image_format_options.itervalues(): |
|---|
| 665 |
opts.AddOption(opt) |
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 |
base_bldr.addOptions(opts) |
|---|
| 669 |
|
|---|
| 670 |
|
|---|
| 671 |
variant_helper.addOptions(opts) |
|---|
| 672 |
|
|---|
| 673 |
|
|---|
| 674 |
|
|---|
| 675 |
|
|---|
| 676 |
try: |
|---|
| 677 |
opts.Process(common_env) |
|---|
| 678 |
except Exception, ex: |
|---|
| 679 |
if not SConsAddons.Util.hasHelpFlag(): |
|---|
| 680 |
print "Option error: ", str(ex) |
|---|
| 681 |
traceback.print_exc() |
|---|
| 682 |
sys.exit(1) |
|---|
| 683 |
|
|---|
| 684 |
|
|---|
| 685 |
|
|---|
| 686 |
|
|---|
| 687 |
help_text = \ |
|---|
| 688 |
"""--- OpenSG Build system --- |
|---|
| 689 |
%s |
|---|
| 690 |
Targets: |
|---|
| 691 |
install - Install OpenSG |
|---|
| 692 |
ex: 'scons install prefix=$HOME/software' to install in your account |
|---|
| 693 |
Type 'scons' to just build it |
|---|
| 694 |
|
|---|
| 695 |
""" % (opts.GenerateHelpText(common_env),) |
|---|
| 696 |
|
|---|
| 697 |
Help(help_text) |
|---|
| 698 |
|
|---|
| 699 |
|
|---|
| 700 |
|
|---|
| 701 |
|
|---|
| 702 |
|
|---|
| 703 |
|
|---|
| 704 |
if not SConsAddons.Util.hasHelpFlag(): |
|---|
| 705 |
try: |
|---|
| 706 |
if not ARGUMENTS.has_key("options_file"): |
|---|
| 707 |
opts.Save(option_filename, common_env) |
|---|
| 708 |
except LookupError, le: |
|---|
| 709 |
pass |
|---|
| 710 |
|
|---|
| 711 |
if common_env.has_key("MSVS"): |
|---|
| 712 |
import pprint |
|---|
| 713 |
print "Found MSVS. using version: ", common_env["MSVS"]["VERSION"] |
|---|
| 714 |
pprint.pprint(common_env["MSVS"]) |
|---|
| 715 |
|
|---|
| 716 |
|
|---|
| 717 |
if common_env.has_key("MSVS"): |
|---|
| 718 |
buildDir += "." + common_env["MSVS"]["VERSION"] |
|---|
| 719 |
if common_env["build_suffix"] != "": |
|---|
| 720 |
buildDir += "." + common_env["build_suffix"] |
|---|
| 721 |
|
|---|
| 722 |
|
|---|
| 723 |
if common_env["enable_fcd2code"]: |
|---|
| 724 |
registerfcd2codeBuilder(common_env) |
|---|
| 725 |
|
|---|
| 726 |
fcd_files = [] |
|---|
| 727 |
for root, dirs, files in os.walk(pj(os.getcwd(),'Source')): |
|---|
| 728 |
fcd_files += [pj(root,f) for f in files if f.endswith(".fcd")] |
|---|
| 729 |
|
|---|
| 730 |
for f in fcd_files: |
|---|
| 731 |
fcd_targets = common_env.fcd2code(source=f) |
|---|
| 732 |
NoClean(fcd_targets) |
|---|
| 733 |
|
|---|
| 734 |
|
|---|
| 735 |
if common_env["enable_fbd2code"]: |
|---|
| 736 |
registerfbd2codeBuilder(common_env) |
|---|
| 737 |
|
|---|
| 738 |
fbd_files = [] |
|---|
| 739 |
for root, dirs, files in os.walk(pj(os.getcwd(),'Source')): |
|---|
| 740 |
fbd_files += [pj(root,f) for f in files if f.endswith(".fbd")] |
|---|
| 741 |
|
|---|
| 742 |
for f in fbd_files: |
|---|
| 743 |
fbd_targets = common_env.fbd2code(source=f) |
|---|