def configure_environment(env, vars=None): if vars is None: vars = create_variables() # Modify the environment based on any of our variables. Be sure # to do this before configuring packages, as we want project flags # to influence how packages are checked. if env['BUILD'] == 'debug': env.MergeFlags('-g -O0') elif env['BUILD'] == 'optimised': env.MergeFlags('-DNDEBUG -O2') if env['BITS'] == '64': env.MergeFlags('-m64') env.AppendUnique(LINKFLAGS=['-m64']) elif env['BITS'] == '32': env.MergeFlags('-m32') env.AppendUnique(LINKFLAGS=['-m32']) if env['PROF']: env.MergeFlags('-g -pg') env.AppendUnique(LINKFLAGS=['-pg']) if env['WITH_GCOV']: env.AppendUnique(CFLAGS=['-fprofile-arcs', '-ftest-coverage']) env.AppendUnique(CCFLAGS=['-fprofile-arcs', '-ftest-coverage']) env.AppendUnique(LINKFLAGS=['-fprofile-arcs', '-ftest-coverage']) if env['WITH_TAU']: env['CC'] = 'tau_cc.sh' env['CXX'] = 'tau_cxx.sh' env.AppendUnique(CPPDEFINES=['WITH_TAU']) env.AppendUnique(CPPDEFINES=['NDEBUG']) # Run the configuration and save it to file. config.configure(env, vars) # Make sure we can find CxxTest. env.PrependUnique(CPPPATH=['#cxxtest/include']) # Make sure our source code can locate installed headers and # libraries. env['BUILD'] = 'build-' + env['BUILD'] env.PrependUnique(CPPPATH=[ '#' + env['BUILD'] + '/include', ]) env.PrependUnique(LIBPATH=['#' + env['BUILD'] + '/lib'])
def configure_environment(env, vars=None): if vars is None: vars = create_variables() # Configure for build type. if env['BUILD'] == 'debug': env.MergeFlags('-g -O0') elif env['BUILD'] == 'testopt': env.MergeFlags('-g -O2 -DNDEBUG') elif env['BUILD'] == 'dbgopt': env.MergeFlags('-g -O2') elif env['BUILD'] == 'optimised': env.MergeFlags('-DNDEBUG -O2') env.MergeFlags('-DNLOGTRIVIAL -DNLOGDEBUG') # Configure the bit architecture. if env['BITS'] == '64': env.MergeFlags('-m64') env.AppendUnique(LINKFLAGS=['-m64']) elif env['BITS'] == '32': env.MergeFlags('-m32') env.AppendUnique(LINKFLAGS=['-m32']) if env['PROF']: env.MergeFlags('-g -pg') env.AppendUnique(LINKFLAGS=['-pg']) if env['WITH_GCOV']: env.AppendUnique(CFLAGS=['-fprofile-arcs', '-ftest-coverage']) env.AppendUnique(CCFLAGS=['-fprofile-arcs', '-ftest-coverage']) env.AppendUnique(LINKFLAGS=['-fprofile-arcs', '-ftest-coverage']) if env['WITH_TAU']: env['CC'] = 'tau_cc.sh' env['CXX'] = 'tau_cxx.sh' env.AppendUnique(CPPDEFINES=['WITH_TAU']) env.AppendUnique(CPPDEFINES=['NDEBUG']) # Configure for OpenMP. if env['WITH_OPENMP']: env.MergeFlags('-fopenmp') # Configure logging. if not env['LOG']: env.MergeFlags('-DNLOG') # if not env['LOG_TRIVIAL']: # env.MergeFlags('-DNLOGTRIVIAL') # if not env['LOG_DEBUG']: # env.MergeFlags('-DNLOGDEBUG') # Run the configuration and save it to file. config.configure(env, vars) # Make sure we can find CxxTest. env.PrependUnique(CPPPATH=['#cxxtest/include']) # Make sure our source code can locate installed headers and # libraries. env['BUILD'] = 'build-' + env['BUILD'] env.PrependUnique(CPPPATH=[ '#' + env['BUILD'] + '/include', ]) env.PrependUnique(LIBPATH=['#' + env['BUILD'] + '/lib'])