15from SCons.Script
import EnsurePythonVersion, EnsureSConsVersion, Variables, Decider
17from LumieraEnvironment
import *
18from Buildhelper
import *
26TOOLDIR =
'./admin/scons'
28CUSTOPTFILE =
'custom-options'
32buildLib =
'$TARGDIR/modules'
33buildPlug =
'$TARGDIR/modules'
34buildIcon =
'$TARGDIR/gui/icons'
35buildUIRes =
'$TARGDIR/gui/'
36buildConf =
'$TARGDIR/config'
37installExe =
'$DESTDIR/lib/lumiera'
38installLib =
'$DESTDIR/lib/lumiera/modules'
39installPlug =
'$DESTDIR/lib/lumiera/modules'
40installIcon =
'$DESTDIR/share/lumiera/icons'
41installUIRes =
'$DESTDIR/share/lumiera/'
42installConf =
'$DESTDIR/lib/lumiera/config'
43installDoc =
'$DESTDIR/share/doc/lumiera/'
55 """ create a custom build environment,
56 define the basic compiler and linker flags,
57 define locations in source and target tree,
58 parse the commandline and pick up options
60 EnsureSConsVersion(4,0)
61 EnsurePythonVersion(3,10)
62 Decider(
'content-timestamp')
64 buildVars = Variables([OPTCACHE, CUSTOPTFILE])
68 env.Replace( CPPPATH =[
"#src"]
69 , CPPDEFINES=[
'LUMIERA_VERSION='+VERSION ]
70 , CCFLAGS=
'-Wall -Wextra -Wformat-security'
71 , CXXFLAGS=
'-std=gnu++23 -Wno-enum-compare'
74 env.Append(LINKFLAGS=
'-Wl,--no-undefined')
75 env.Append(LINKFLAGS=
'-Wl,--as-needed')
79 env.Append(CPPDEFINES =
'_GNU_SOURCE')
83 appendVal(env,
'OPTIMIZE',
'CCFLAGS', val=
' -O3')
84 appendVal(env,
'DEBUG',
'CCFLAGS', val=
' -ggdb')
89 buildVars.Save(OPTCACHE, env)
96 env.Append(CPPDEFINES = env.subst(cppVar) )
98 env.Append(CPPDEFINES = env.subst(elseVal))
102 env.Append( **{targetVar: env.subst(val)
or env[var]})
106 """ set the build level for NoBug.
107 Release builds imply no DEBUG
108 whereas ALPHA and BETA require DEBUG
110 level = env[
'BUILDLEVEL']
111 if level
in [
'ALPHA',
'BETA']:
113 print(
'Warning: NoBug ALPHA or BETA builds requires DEBUG=yes, switching DEBUG on!')
114 env.Replace( DEBUG = 1 )
115 env.Append(CPPDEFINES =
'EBUG_'+level)
116 elif level ==
'RELEASE':
117 env.Replace( DEBUG = 0 )
121 """ toggle verbose build output """
122 if not env[
'VERBOSE']:
124 env[
'CCCOMSTR'] = env[
'SHCCCOMSTR'] =
" Compiling $SOURCE"
125 env[
'CXXCOMSTR'] = env[
'SHCXXCOMSTR'] =
" Compiling++ $SOURCE"
126 env[
'LINKCOMSTR'] =
" Linking --> $TARGET"
127 env[
'LDMODULECOMSTR'] =
" creating module [ $TARGET ]"
a set of properties with record style access.
Custom SCons build environment for Lumiera This allows us to carry structured config data without usi...
prepareOptionsHelp(buildVars, env)
defineCmdlineVariables(buildVars)
several toggles and configuration variables can be set on the commandline, current settings will be p...
appendVal(env, var, targetVar, val=None)
handleNoBugSwitches(env)
set the build level for NoBug.
defineBuildEnvironment()
create a custom build environment, define the basic compiler and linker flags, define locations in so...
handleVerboseMessages(env)
toggle verbose build output
appendCppDefine(env, var, cppVar, elseVal='')