Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 49 lines (37 sloc) 1.377 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
# -*- mode: python; -*-

# This SConscript describes construction of buildinfo.cpp, which is independent of the
# build variant's target.

import os
import sys

import buildscripts.utils

Import('env windows')

def getSysInfo():
    if windows:
        return "windows " + str( sys.getwindowsversion() )
    else:
        return " ".join( os.uname() )

buildinfo_filename = '#build/buildinfo.cpp'

buildinfo_template = '''
#include <string>
#include <boost/version.hpp>

#include "mango/util/version.h"

namespace mango {
    const char * gitVersion() { return "%(git_version)s"; }
    std::string sysInfo() { return "%(sys_info)s BOOST_LIB_VERSION=" BOOST_LIB_VERSION ; }
} // namespace mango
'''

def generate_buildinfo(env, target, source, **kw):
    git_version = buildscripts.utils.getGitVersion()
    if env["MANGO_MODULES"]:
        git_version += " modules: %s" % (", ".join(env["MANGO_MODULES"].keys()))

    contents = str(source[0]) % dict(git_version=git_version,
                                     sys_info=getSysInfo())
    out = open(str(target[0]), 'wb')
    try:
        out.write(contents)
    finally:
        out.close()

env.Command(buildinfo_filename, Value(buildinfo_template), generate_buildinfo)
env.AlwaysBuild(buildinfo_filename)
env.Install('$BUILD_DIR/mango', buildinfo_filename)
env.Install('$BUILD_DIR/client_build/mango', buildinfo_filename)
Something went wrong with that request. Please try again.