| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
try: |
|---|
| 8 |
import wing.wingdbstub |
|---|
| 9 |
print "Loaded wingdb stub for debugging..." |
|---|
| 10 |
except: |
|---|
| 11 |
pass |
|---|
| 12 |
|
|---|
| 13 |
import os, string, sys, re, glob, copy, types, traceback, pprint, tempfile, shutil |
|---|
| 14 |
pj = os.path.join |
|---|
| 15 |
|
|---|
| 16 |
print "-------------------------------------------------" |
|---|
| 17 |
print "WARNING: The build is currently in development. " |
|---|
| 18 |
print " - It needs the svn version of scons-addons" |
|---|
| 19 |
print "WARNING:" |
|---|
| 20 |
|
|---|
| 21 |
sys.path.insert(0,pj('Tools','scons-addons','src')) |
|---|
| 22 |
sys.path.insert(0,pj('Tools','scons-build')) |
|---|
| 23 |
|
|---|
| 24 |
import SCons.Environment |
|---|
| 25 |
import SCons |
|---|
| 26 |
import SConsAddons.Util as sca_util |
|---|
| 27 |
import SConsAddons.Options as sca_opts |
|---|
| 28 |
import SConsAddons.Variants as sca_variants |
|---|
| 29 |
import SConsAddons.Builders |
|---|
| 30 |
import SConsAddons.Options.Boost |
|---|
| 31 |
from SConsAddons.EnvironmentBuilder import EnvironmentBuilder |
|---|
| 32 |
from LibraryUtils import * |
|---|
| 33 |
from sets import Set |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
GetPlatform = sca_util.GetPlatform |
|---|
| 37 |
Export('GetPlatform') |
|---|
| 38 |
pj = os.path.join |
|---|
| 39 |
verbose_build = False |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
def registerFcdProcessBuilder(env, required=True): |
|---|
| 56 |
print "Setting up fcdProcess builder...", |
|---|
| 57 |
|
|---|
| 58 |
fcdProcess_cmd = pj("Tools", "fcdProcess","fcdProcess.pl") |
|---|
| 59 |
fcdProcess_cmd = os.path.abspath(fcdProcess_cmd) |
|---|
| 60 |
if not os.path.isfile(fcdProcess_cmd): |
|---|
| 61 |
print " Warning: fcdProcess not found at: ", fcdProcess_cmd |
|---|
| 62 |
if required: |
|---|
| 63 |
sys.exit(1) |
|---|
| 64 |
return |
|---|
| 65 |
|
|---|
| 66 |
template_files = glob.glob(pj("Tools","fcdProcess","*Template*")) |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
def prop_emitter(target,source,env, template_files=template_files): |
|---|
| 70 |
""" Returns a list of files including all output forms and |
|---|
| 71 |
The input templates as sources. |
|---|
| 72 |
""" |
|---|
| 73 |
assert str(source[0]).endswith(".fcd") |
|---|
| 74 |
assert len(source) == 1 |
|---|
| 75 |
|
|---|
| 76 |
base_name = os.path.splitext(str(source[0]))[0] |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
target = [] |
|---|
| 80 |
for ext in ["Base.cpp","Base.h","Base.inl","Fields.h"]: |
|---|
| 81 |
target.append(base_name+ext) |
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
source.extend(template_files) |
|---|
| 85 |
|
|---|
| 86 |
return (target, source) |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
fcdprocess_builder = Builder(action = fcdProcess_cmd + ' -c -b -d $SOURCE -p ${TARGET.dir}', |
|---|
| 90 |
src_suffix = '.fcd', |
|---|
| 91 |
suffix = 'unused.h', |
|---|
| 92 |
emitter = prop_emitter) |
|---|
| 93 |
env.Append(BUILDERS = {'FcdProcess' : fcdprocess_builder}); |
|---|
| 94 |
print "[OK]" |
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
def addScanParseSkel(common_env): |
|---|
| 98 |
""" This is an ugly hack to add the lex/yacc support into the build. It is ugly because of a couple of things. |
|---|
| 99 |
- We use some very custom flags |
|---|
| 100 |
- We need to post process the scanner to include a different file then normal. |
|---|
| 101 |
- We are forcing this to be done in the source tree in a subdir without actually going there. |
|---|
| 102 |
- Dependency management seems to be a little messed up right now in the code or scons. |
|---|
| 103 |
- BUGS: Scons does not seem to recognize that the files we are building here are source |
|---|
| 104 |
files for the libraries. This makes it so we have to run the build twice if the files change. |
|---|
| 105 |
""" |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
if "yacc" in common_env["TOOLS"]: |
|---|
| 110 |
parser_env = common_env.Copy() |
|---|
| 111 |
parser_env.Append(YACCFLAGS = ["-d","-v","-pOSGScanParseSkel_","-bOSGScanParseSkel_"]) |
|---|
| 112 |
source_file = "Source/System/FileIO/ScanParseSkel/OSGScanParseSkelParser.yy" |
|---|
| 113 |
target_file = "Source/System/FileIO/ScanParseSkel/OSGScanParseSkelParser.cpp" |
|---|
| 114 |
yfiles = parser_env.CXXFile(target=target_file,source=source_file) |
|---|
| 115 |
NoClean(yfiles) |
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
y_cpp_file = str(yfiles[0]).replace("Source/","",1) |
|---|
| 120 |
y_hpp_file = str(yfiles[1]).replace("Source/","",1) |
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
else: |
|---|
| 127 |
print "WARNING: bison not available. If you change .yy files they will not be built." |
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
if "lex" in common_env["TOOLS"]: |
|---|
| 133 |
def filter_header(target, source, env): |
|---|
| 134 |
""" Custom filter to change the include file for the flexlexer.h""" |
|---|
| 135 |
fname = str(target[0]) |
|---|
| 136 |
contents = open(fname).readlines() |
|---|
| 137 |
for i in range(len(contents)): |
|---|
| 138 |
if contents[i] == "#include <FlexLexer.h>\n": |
|---|
| 139 |
contents[i] = "#include \"%s\"\n" % os.path.split(OSG_flexlexer_h)[1] |
|---|
| 140 |
break |
|---|
| 141 |
open(fname,'w').writelines(contents) |
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
lexer_env = common_env.Copy() |
|---|
| 145 |
lexer_env.Append(LEXFLAGS = ["-+","-POSGScanParseSkel_"]) |
|---|
| 146 |
|
|---|
| 147 |
lexer_dir = pj('Source','System','FileIO','ScanParseSkel') |
|---|
| 148 |
sys_flexlexer_h = "/usr/include/FlexLexer.h" |
|---|
| 149 |
OSG_flexlexer_h = pj(lexer_dir,"OSGScanParseSkelScanner_FlexLexer.h") |
|---|
| 150 |
source_file = pj(lexer_dir,"OSGScanParseSkelScanner.ll") |
|---|
| 151 |
target_file = pj(lexer_dir,"OSGScanParseSkelScanner.cpp") |
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
std_lex_action = Action("$LEXCOM", "$LEXCOMSTR") |
|---|
| 155 |
filter_action = Action(filter_header, lambda t,s,e: "Filtering header: %s %s"%(str(t),str(s))) |
|---|
| 156 |
cxx_file_builder = lexer_env['BUILDERS']['CXXFile'] |
|---|
| 157 |
cxx_file_builder.add_action('.ll', Action([std_lex_action, filter_action])) |
|---|
| 158 |
lfiles = lexer_env.CXXFile(target=target_file,source=source_file) |
|---|
| 159 |
NoClean(lfiles) |
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
if os.path.exists(sys_flexlexer_h): |
|---|
| 164 |
flexlex_cp = lexer_env.Command(OSG_flexlexer_h, sys_flexlexer_h,[Copy('$TARGET','$SOURCE'),]) |
|---|
| 165 |
Depends(lfiles, flexlex_cp) |
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
if vars().has_key('yfiles'): |
|---|
| 169 |
Depends(lfiles, yfiles) |
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
scanner_src = target_file.replace("Source/","",1) |
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 |
else: |
|---|
| 177 |
print "WARNING: flex not available. If you change .ll files they will not be built." |
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
EnsureSConsVersion(0,96,92) |
|---|
| 183 |
SourceSignatures('MD5') |
|---|
| 184 |
|
|---|
| 185 |
SConsignFile('.sconsign.'+GetPlatform()) |
|---|
| 186 |
opensg_version_string = file("VERSION").readline().strip() |
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
print "Building OpenSG ", opensg_version_string |
|---|
| 190 |
|
|---|
| 191 |
platform = sca_util.GetPlatform() |
|---|
| 192 |
unspecified_prefix = "use-instlinks" |
|---|
| 193 |
buildDir = "build." + platform |
|---|
| 194 |
option_filename = "option.cache." + platform |
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
if GetPlatform() == "win32": |
|---|
| 198 |
common_env = Environment() |
|---|
| 199 |
else: |
|---|
| 200 |
common_env = Environment(ENV = os.environ) |
|---|
| 201 |
|
|---|
| 202 |
common_env["CONFIGUREDIR"] = '.sconf_temp_'+platform |
|---|
| 203 |
common_env["CONFIGURELOG"] = 'sconf.log_'+platform |
|---|
| 204 |
SConsAddons.Builders.registerDefineBuilder(common_env) |
|---|
| 205 |
SConsAddons.Builders.registerSubstBuilder(common_env) |
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
variant_helper = sca_variants.VariantsHelper(variantKeys=["type","arch"]) |
|---|
| 209 |
base_bldr = EnvironmentBuilder() |
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
opts = sca_opts.Options(files = [option_filename, 'options.custom'], |
|---|
| 222 |
args= ARGUMENTS) |
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
boost_options = sca_opts.Boost.Boost("boost","1.31.0",required=True) |
|---|
| 226 |
|
|---|
| 227 |
glut_libname = "glut" |
|---|
| 228 |
tiff_libname = "tiff" |
|---|
| 229 |
if "win32" == platform: |
|---|
| 230 |
glut_libname = "glut32" |
|---|
| 231 |
tiff_libname = "tif32" |
|---|
| 232 |
|
|---|
| 233 |
jpeg_option = sca_opts.StandardPackageOption("jpeg","Jpeg library location", |
|---|
| 234 |
library="jpeg", required=False) |
|---|
| 235 |
tiff_option = sca_opts.StandardPackageOption("tiff","Tiff library location", |
|---|
| 236 |
library=tiff_libname, required=False) |
|---|
| 237 |
png_option = sca_opts.StandardPackageOption("png","PNG library location", |
|---|
| 238 |
library="png", required=False) |
|---|
| 239 |
glut_option = sca_opts.StandardPackageOption("glut","GLUT library location", |
|---|
| 240 |
library=glut_libname, header="GL/glut.h", required=False) |
|---|
| 241 |
zlib_option = sca_opts.StandardPackageOption("zlib","zlib library location", |
|---|
| 242 |
library="z", header="zlib.h", required=False) |
|---|
| 243 |
nvperfsdk_option = sca_opts.StandardPackageOption("NVPerfSDK", "NVPerfSDK library location", header="NVPerfSDK.h", |
|---|
| 244 |
library="NVPerfSDK", required=False) |
|---|
| 245 |
|
|---|
| 246 |
format_options = [jpeg_option,tiff_option,png_option,zlib_option,nvperfsdk_option] |
|---|
| 247 |
|
|---|
| 248 |
opts.AddOption(sca_opts.SeparatorOption("\nStandard settings")) |
|---|
| 249 |
opts.Add('prefix', 'Installation prefix', unspecified_prefix) |
|---|
| 250 |
opts.AddOption(sca_opts.SeparatorOption("\nPackage Options")) |
|---|
| 251 |
opts.AddOption( boost_options ) |
|---|
| 252 |
opts.AddOption( glut_option ) |
|---|
| 253 |
opts.AddOption(sca_opts.SeparatorOption("\nFormat Options")) |
|---|
| 254 |
for o in format_options: |
|---|
| 255 |
opts.AddOption(o) |
|---|
| 256 |
opts.AddOption(sca_opts.BoolOption("enable_gif","Enable GIF support.",True)) |
|---|
| 257 |
|
|---|
| 258 |
opts.AddOption(sca_opts.SeparatorOption("\nAdvanced Options")) |
|---|
| 259 |
opts.AddOption(sca_opts.EnumOption("fcptr_mode","Set the pointer mode to use for field containers", |
|---|
| 260 |
"MT_FCPTR",["SINGLE_THREAD","MT_CPTR","MT_FCPTR"])) |
|---|
| 261 |
opts.AddOption(sca_opts.BoolOption("disable_deprecated","Disable deprecated code.",False)) |
|---|
| 262 |
opts.AddOption(sca_opts.BoolOption("disable_glut_glsubdir","Do not use GL subdir while including glut.h",False)) |
|---|
| 263 |
opts.AddOption(sca_opts.BoolOption("osg_1_compat","Enable opensg 1.x compatibility.",False)) |
|---|
| 264 |
opts.AddOption(sca_opts.BoolOption("osg_deprecated_props","Enable deprecated property types.",False)) |
|---|
| 265 |
opts.Add("build_suffix", "Suffix to append to build directory. Useful for compiling multiple variations on same platform.", "") |
|---|
| 266 |
opts.AddOption(sca_opts.BoolOption("enable_fcdprocess","If true, enable support for fcdProcess in the build.",False)) |
|---|
| 267 |
opts.AddOption(sca_opts.BoolOption("enable_unittests","If true, enable unit tests in the build.",True)) |
|---|
| 268 |
opts.Add("icc_gnu_compat","<GCC Version> to make the icc resultbinary compatible to the given gcc version. (unsupported)") |
|---|
| 269 |
if "win32" == platform: |
|---|
| 270 |
opts.AddOption(sca_opts.BoolOption("win_localstorage", "Use local storage instead of __declspec to get thread local storage on windows", |
|---|
| 271 |
True)) |
|---|
| 272 |
if "win32" != platform: |
|---|
| 273 |
opts.AddOption(sca_opts.BoolOption("pthread_elf_tls", "Enable elf thread local storage with pthreads.", |
|---|
| 274 |
("linux"==platform))) |
|---|
| 275 |
|
|---|
| 276 |
|
|---|
| 277 |
base_bldr.addOptions(opts) |
|---|
| 278 |
variant_helper.addOptions(opts) |
|---|
| 279 |
|
|---|
| 280 |
try: |
|---|
| 281 |
opts.Process(common_env) |
|---|
| 282 |
except Exception, ex: |
|---|
| 283 |
if not SConsAddons.Util.hasHelpFlag(): |
|---|
| 284 |
print "Option error: ", str(ex) |
|---|
| 285 |
traceback.print_exc() |
|---|
| 286 |
sys.exit(1) |
|---|
| 287 |
|
|---|
| 288 |
help_text = """--- OpenSG Build system --- |
|---|
| 289 |
%s |
|---|
| 290 |
Targets: |
|---|
| 291 |
install - Install OpenSG |
|---|
| 292 |
ex: 'scons install prefix=$HOME/software' to install in your account |
|---|
| 293 |
Type 'scons' to just build it |
|---|
| 294 |
|
|---|
| 295 |
"""%(opts.GenerateHelpText(common_env),) |
|---|
| 296 |
|
|---|
| 297 |
|
|---|
| 298 |
Help(help_text) |
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 |
|
|---|
| 302 |
|
|---|
| 303 |
if not SConsAddons.Util.hasHelpFlag(): |
|---|
| 304 |
try: |
|---|
| 305 |
opts.Save(option_filename, common_env) |
|---|
| 306 |
except LookupError, le: |
|---|
| 307 |
pass |
|---|
| 308 |
|
|---|
| 309 |
|
|---|
| 310 |
if common_env["build_suffix"] != "": |
|---|
| 311 |
buildDir = buildDir + "." + common_env["build_suffix"] |
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
if common_env["enable_fcdprocess"]: |
|---|
| 315 |
registerFcdProcessBuilder(common_env) |
|---|
| 316 |
|
|---|
| 317 |
fcd_files = [] |
|---|
| 318 |
for root, dirs, files in os.walk(pj(os.getcwd(),'Source')): |
|---|
| 319 |
fcd_files += [pj(root,f) for f in files if f.endswith(".fcd")] |
|---|
| 320 |
|
|---|
| 321 |
for f in fcd_files: |
|---|
| 322 |
fcd_targets = common_env.FcdProcess(source=f) |
|---|
| 323 |
NoClean(fcd_targets) |
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
|
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
|
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 |
|
|---|
| 341 |
|
|---|
| 342 |
|
|---|
| 343 |
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
|
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
|
|---|
| 351 |
|
|---|
| 352 |
|
|---|
| 353 |
|
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 |
|
|---|
| 358 |
|
|---|
| 359 |
lib_map = {} |
|---|
| 360 |
dir_ignores = [".svn", "ES","EGL"] |
|---|
| 361 |
|
|---|
| 362 |
def scan_libs(base_dir, cur_dir, name_stack): |
|---|
| 363 |
""" Scan library directory. |
|---|
| 364 |
base_dir: Directory to keep all paths relative to |
|---|
| 365 |
cur_dir: Directory to examine. |
|---|
| 366 |
name_stack: Current stack of library names |
|---|
| 367 |
""" |
|---|
| 368 |
global lib_map |
|---|
| 369 |
|
|---|
| 370 |
full_dir = pj(base_dir, cur_dir) |
|---|
| 371 |
dir_contents = [pj(cur_dir,f) for f in os.listdir(full_dir)] |
|---|
| 372 |
files = [f for f in dir_contents if os.path.isfile(pj(base_dir,f))] |
|---|
| 373 |
dirs = [d for d in dir_contents if os.path.isdir(pj(base_dir,d))] |
|---|
| 374 |
have_build_info = os.path.exists(pj(full_dir,"build.info")) |
|---|
| 375 |
cur_lib = None |
|---|
| 376 |
|
|---|
| 377 |
lib_attrib_names = ["osg_dep_libs","libs","cpppath","libpath", |
|---|
| 378 |
"osg_test_libs","other_test_libs","test_cpppath", "test_libpath"] |
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
|
|---|
| 382 |
|
|---|
| 383 |
if have_build_info: |
|---|
| 384 |
bi_filename = pj(full_dir,"build.info") |
|---|
| 385 |
if verbose_build: |
|---|
| 386 |
print " Evaluating: ", bi_filename |
|---|
| 387 |
else: |
|---|
| 388 |
sys.stdout.write(".") |
|---|
| 389 |
|
|---|
| 390 |
|
|---|
| 391 |
ns = {"option_pass":False, |
|---|
| 392 |
"opts":opts, |
|---|
| 393 |
"library":None, |
|---|
| 394 |
"platform":platform, |
|---|
| 395 |
"compiler":common_env["CXX"], |
|---|
| 396 |
"stop_traversal":False |
|---|
| 397 |
} |
|---|
| 398 |
|
|---|
| 399 |
for n in lib_attrib_names: |
|---|
| 400 |
ns[n] = [] |
|---|
| 401 |
|
|---|
| 402 |
execfile(bi_filename, ns) |
|---|
| 403 |
if ns["stop_traversal"]: |
|---|
| 404 |
if verbose_build: |
|---|
| 405 |
print " Pruning traversal." |
|---|
| 406 |
return |
|---|
| 407 |
if not ns.has_key("library"): |
|---|
| 408 |
print "Error: Must specify 'library' value in build.info file:", bi_filename |
|---|
| 409 |
sys.exit(1) |
|---|
| 410 |
lib_name = ns["library"] |
|---|
| 411 |
if not lib_map.has_key(lib_name): |
|---|
| 412 |
lib_map[lib_name] = LibraryInfo(name=lib_name) |
|---|
| 413 |
if verbose_build: |
|---|
| 414 |
print "Created new LibraryInfo: ", lib_name |
|---|
| 415 |
name_stack.append(lib_name) |
|---|
| 416 |
cur_lib = lib_map[lib_name] |
|---|
| 417 |
|
|---|
| 418 |
if verbose_build: |
|---|
| 419 |
print "lib name: ", lib_name |
|---|
| 420 |
|
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 |
for n in lib_attrib_names: |
|---|
| 424 |
attrib_list = getattr(cur_lib,n) |
|---|
| 425 |
attrib_list.extend([x for x in ns[n] if x not in attrib_list]) |
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 |
test_files = [f for f in files if os.path.basename(f).startswith("test") and f.endswith(".cpp")] |
|---|
| 429 |
unittest_files = [f for f in files if os.path.basename(f).endswith("Test.cpp") and\ |
|---|
| 430 |
os.path.basename(f).startswith("OSG")] |
|---|
| 431 |
source_files = [f for f in files if (os.path.splitext(f)[1] in [".cpp",".cc"]) and\ |
|---|
| 432 |
(os.path.basename(f).startswith("OSG") and\ |
|---|
| 433 |
f not in test_files and f not in unittest_files)] |
|---|
| 434 |
header_files = [f for f in files if os.path.splitext(f)[1] in [".h",".inl",".ins",".hpp"] and\ |
|---|
| 435 |
(os.path.basename(f).startswith("OSG"))] |
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 |
if len(test_files) or len(source_files) or len(header_files): |
|---|
| 439 |
if len(name_stack) == 0: |
|---|
| 440 |
print "Error: Attempted to add source with no library build.info specifed. In dir: %s"%pj(base_dir,cur_dir) |
|---|
| 441 |
sys.exit(1) |
|---|
| 442 |
lib_name = name_stack[-1] |
|---|
| 443 |
lib_map[lib_name].source_files += source_files |
|---|
| 444 |
lib_map[lib_name].header_files += header_files |
|---|
| 445 |
lib_map[lib_name].test_files += test_files |
|---|
| 446 |
lib_map[lib_name].unittest_files += unittest_files |
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
for d in dirs: |
|---|
| 450 |
if not os.path.basename(d) in dir_ignores: |
|---|
| 451 |
scan_libs(base_dir, d, copy.copy(name_stack)) |
|---|
| 452 |
|
|---|
| 453 |
|
|---|
| 454 |
if not verbose_build: |
|---|
| 455 |
print "Scanning libraries: ", |
|---|
| 456 |
scan_libs(pj(os.getcwd(),"Source"), '', []) |
|---|
| 457 |
if not verbose_build: |
|---|
| 458 |
print " found %s libraries"%len(lib_map) |
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
addScanParseSkel(common_env) |
|---|
| 462 |
|
|---|
| 463 |
|
|---|
| 464 |
variant_helper.readOptions(common_env) |
|---|
| 465 |
base_bldr.readOptions(common_env) |
|---|
| 466 |
|
|---|
| 467 |
base_bldr.enableWarnings(EnvironmentBuilder.MINIMAL) |
|---|
| 468 |
|
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 |
boost_options.apply(common_env) |
|---|
| 472 |
|
|---|
| 473 |
|
|---|
| 474 |
|
|---|
| 475 |
|
|---|
| 476 |
if common_env['prefix'] == unspecified_prefix: |
|---|
| 477 |
if hasattr(os,'symlink'): |
|---|
| 478 |
common_env['INSTALL'] = SConsAddons.Util.symlinkInstallFunc |
|---|
| 479 |
common_env['prefix'] = pj( Dir('.').get_abspath(), buildDir, 'instlinks') |
|---|
| 480 |
|
|---|
| 481 |
|
|---|
| 482 |
paths = {} |
|---|
| 483 |
paths['base'] = os.path.abspath(common_env['prefix']) |
|---|
| 484 |
paths['lib'] = pj(paths['base'], 'lib') |
|---|
| 485 |
paths['include'] = pj(paths['base'], 'include') |
|---|
| 486 |
paths['bin'] = pj(paths['base'], 'bin') |
|---|
| 487 |
print "Using prefix: ", paths['base'] |
|---|
| 488 |
common_env.Append(CPPPATH = [paths['include'],pj(paths['include'],"OpenSG")]) |
|---|
| 489 |
|
|---|
| 490 |
|
|---|
| 491 |
definemap = {"OSG_DISABLE_DEPRECATED": (common_env["disable_deprecated"], |
|---|
| 492 |
"Disable interface that will go away in the future"), |
|---|
| 493 |
"OSG_NO_GLUT_GLSUBDIR":(common_env["disable_glut_glsubdir"],"Don't use GL subdir for glut"), |
|---|
| 494 |
"OSG_MT_FIELDCONTAINERPTR":("MT_FCPTR" == common_env["fcptr_mode"]), |
|---|
| 495 |
"OSG_MT_CPTR_ASPECT":("MT_CPTR" == common_env["fcptr_mode"]), |
|---|
| 496 |
"OSG_1_COMPAT":common_env["osg_1_compat"], |
|---|
| 497 |
"OSG_DEPRECATED_PROPS":common_env["osg_deprecated_props"], |
|---|
| 498 |
|
|---|
| 499 |
"OSG_WITH_JPG":jpeg_option.isAvailable(), |
|---|
| 500 |
"OSG_WITH_TIF":tiff_option.isAvailable(), |
|---|
| 501 |
"OSG_WITH_PNG":png_option.isAvailable(), |
|---|
| 502 |
"OSG_WITH_GLUT":glut_option.isAvailable(), |
|---|
| 503 |
"OSG_WITH_GIF":common_env["enable_gif"], |
|---|
| 504 |
"OSG_WITH_ZLIB":zlib_option.isAvailable(), |
|---|
| 505 |
"OSG_WITH_NVPERFSDK":nvperfsdk_option.isAvailable() |
|---|
| 506 |
} |
|---|
| 507 |
if "win32" == platform: |
|---|
| 508 |
definemap.update( {"OSG_WIN32_ASPECT_USE_LOCALSTORAGE": common_env["win_localstorage"],} ) |
|---|
| 509 |
else: |
|---|
| 510 |
definemap.update( {"OSG_PTHREAD_ELF_TLS":(common_env["pthread_elf_tls"],"Use elf tls with pthreads."),} ) |
|---|
| 511 |
|
|---|
| 512 |
common_env.DefineBuilder(pj(paths["include"],"OpenSG","OSGConfigured.h"),Value(definemap), |
|---|
| 513 |
definemap=definemap) |
|---|
| 514 |
|
|---|
| 515 |
|
|---|
| 516 |
|
|---|
| 517 |
if common_env["enable_unittests"]: |
|---|
| 518 |
|
|---|
| 519 |
|
|---|
| 520 |
SConscript(pj("Tools", "unittest-cpp.SConstruct")) |
|---|
| 521 |
|
|---|
| 522 |
|
|---|
| 523 |
unittest_inc = pj(os.getcwd(),"Tools","unittest-cpp","UnitTest++","src"); |
|---|
| 524 |
unittest_libpath = pj(os.getcwd(),"Tools","unittest-cpp","UnitTest++"); |
|---|
| 525 |
unittest_lib = "UnitTest++"; |
|---|
| 526 |
unittest_runner = pj(os.getcwd(),"Tools","UnitTestRunner.cpp"); |
|---|
| 527 |
Export('unittest_inc', 'unittest_lib', 'unittest_libpath', 'unittest_runner') |
|---|
| 528 |
|
|---|
| 529 |
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 |
if verbose_build: |
|---|
| 533 |
print "types: ", variant_helper.variants["type"] |
|---|
| 534 |
print "libtypes: ", variant_helper.variants["libtype"] |
|---|
| 535 |
print "archs: ", variant_helper.variants["arch"] |
|---|
| 536 |
|
|---|
| 537 |
|
|---|
| 538 |
default_combo_type = variant_helper.variants["type"][0][0] |
|---|
| 539 |
|
|---|
| 540 |
for combo in variant_helper.iterate(locals(), base_bldr, common_env): |
|---|
| 541 |
|
|---|
| 542 |
print " Processing combo: ", ", ".join(['%s:%s'%(i[0],i[1]) for i in combo.iteritems()]) |
|---|
| 543 |
|
|---|
| 544 |
inst_paths = copy.copy(paths) |
|---|
| 545 |
if "x64" == combo["arch"]: |
|---|
| 546 |
inst_paths['lib'] = inst_paths['lib'] + '64' |
|---|
| 547 |
inst_paths["lib_inst_combo"] = inst_paths["lib"] |
|---|
| 548 |
if GetPlatform() != "win32": |
|---|
| 549 |
if "debug" == combo["type"]: |
|---|
| 550 |
inst_paths["lib_inst_combo"] = pj(inst_paths["lib_inst_combo"],"debug") |
|---|
| 551 |
else: |
|---|
| 552 |
inst_paths["lib_inst_combo"] = pj(inst_paths["lib_inst_combo"],"opt") |
|---|
| 553 |
|
|---|
| 554 |
Export('build_env','inst_paths','opts', 'variant_pass','combo', |
|---|
| 555 |
'lib_map','boost_options', |
|---|
| 556 |
'shared_lib_suffix','static_lib_suffix', |
|---|
| 557 |
'default_combo_type','verbose_build',) |
|---|
| 558 |
|
|---|
| 559 |
|
|---|
| 560 |
sub_dirs = ['Source'] |
|---|
| 561 |
full_build_dir = pj(buildDir,combo_dir) |
|---|
| 562 |
for d in sub_dirs: |
|---|
| 563 |
SConscript(pj(d,'SConscript'), build_dir=pj(full_build_dir, d), duplicate=0) |
|---|
| 564 |
|
|---|
| 565 |
|
|---|
| 566 |
if 0 == variant_pass: |
|---|
| 567 |
|
|---|
| 568 |
lib_map_build_list = [] |
|---|
| 569 |
for (name,lib) in lib_map.iteritems(): |
|---|
| 570 |
lib_map_build_list.append(lib.dump()) |
|---|
| 571 |
|
|---|
| 572 |
|
|---|
| 573 |
Alias(name[3:], [ pj(full_build_dir, "Source", "lib" + name + common_env["SHLIBSUFFIX"]), \ |
|---|
| 574 |
pj(full_build_dir, "unittest", "run" + name)\ |
|---|
| 575 |
]) |
|---|
| 576 |
|
|---|
| 577 |
lib_map_str = pprint.pformat(lib_map_build_list) |
|---|
| 578 |
|
|---|
| 579 |
submap = {'@LIB_MAP_STR@':lib_map_str, |
|---|
| 580 |
'@PREFIX@':common_env["prefix"], |
|---|
| 581 |
'@LIBPATH@':inst_paths["lib"], |
|---|
| 582 |
'@INCPATH@':inst_paths["include"], |
|---|
| 583 |
'@VERSION@':opensg_version_string, |
|---|
| 584 |
'@LIBRARY_UTIL_SRC@':file(pj('Tools','scons-build','LibraryUtils.py')).read()} |
|---|
| 585 |
|
|---|
| 586 |
for n in ["osg-config","osg2-config"]: |
|---|
| 587 |
osg_config = common_env.SubstBuilder(pj(paths['bin'],n), |
|---|
| 588 |
'osg-config.in', submap=submap) |
|---|
| 589 |
common_env.AddPostAction(osg_config, Chmod('$TARGET', 0755)) |
|---|
| 590 |
common_env.Depends(osg_config, Value(lib_map_str)) |
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 |
common_env.Alias('install', paths['base']) |
|---|
| 594 |
|
|---|
| 595 |
|
|---|
| 596 |
Default('.') |
|---|
| 597 |
|
|---|