Compare commits
10 Commits
cd979b67e9
...
8ed6479c2d
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ed6479c2d | |||
| d4699042d1 | |||
|
|
49ce99e992 | ||
|
|
912f188eb3 | ||
|
|
b2c1289afe | ||
|
|
799fc1a2b1 | ||
|
|
82a38a0c1f | ||
|
|
a90941799f | ||
|
|
0393cd381b | ||
|
|
e854943328 |
96
.clang-format
Normal file
96
.clang-format
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
Language: Cpp
|
||||||
|
# BasedOnStyle: Google
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveAssignments: true
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignEscapedNewlinesLeft: false
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: TopLevelDefinitions
|
||||||
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
|
AlwaysBreakTemplateDeclarations: true
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
BreakBeforeBraces : Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: false
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
BeforeCatch: true
|
||||||
|
BeforeElse: true
|
||||||
|
IndentBraces: false
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 80
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^<.*\.h>'
|
||||||
|
Priority: 1
|
||||||
|
- Regex: '^<.*'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 3
|
||||||
|
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentWidth: 2
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: false
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 1
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 200
|
||||||
|
PointerAlignment: Left
|
||||||
|
ReflowComments: true
|
||||||
|
SortIncludes: true
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 2
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Cpp11
|
||||||
|
TabWidth: 2
|
||||||
|
UseTab: Never
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
64
.cproject
Normal file
64
.cproject
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.1891867734">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.1891867734" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.1891867734" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release">
|
||||||
|
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.1891867734." name="/" resourcePath="">
|
||||||
|
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.1200869658" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.704470878" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||||
|
<builder buildPath="${workspace_loc:/scons}/Release" id="cdt.managedbuild.builder.gnu.cross.1496558127" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.2041788835" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||||
|
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.100898372" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
|
||||||
|
<option id="gnu.c.compiler.option.debugging.level.102916161" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.38314126" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1483936250" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||||
|
<option id="gnu.cpp.compiler.option.optimization.level.130197279" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||||
|
<option id="gnu.cpp.compiler.option.debugging.level.822637018" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1554915344" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.899242295" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1567746957" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.787672451" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.78792473" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1975717274" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.149268296" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="scons.cdt.managedbuild.target.gnu.cross.exe.320713590" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.1891867734;cdt.managedbuild.config.gnu.cross.exe.release.1891867734.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1483936250;cdt.managedbuild.tool.gnu.cpp.compiler.input.1554915344">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.1891867734;cdt.managedbuild.config.gnu.cross.exe.release.1891867734.;cdt.managedbuild.tool.gnu.cross.c.compiler.2041788835;cdt.managedbuild.tool.gnu.c.compiler.input.38314126">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||||
|
</cproject>
|
||||||
41
.gitignore
vendored
Normal file
41
.gitignore
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
*.smod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# scons
|
||||||
|
.sconsign.dblite
|
||||||
|
|
||||||
|
helloworld*
|
||||||
|
env.txt
|
||||||
|
build/
|
||||||
|
install/
|
||||||
|
|
||||||
33
.project
Normal file
33
.project
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>scons</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.python.pydev.PyDevBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
<nature>org.python.pydev.pythonNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
5
.pydevproject
Normal file
5
.pydevproject
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?eclipse-pydev version="1.0"?><pydev_project>
|
||||||
|
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||||
|
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
|
||||||
|
</pydev_project>
|
||||||
14
.settings/language.settings.xml
Normal file
14
.settings/language.settings.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<project>
|
||||||
|
<configuration id="cdt.managedbuild.config.gnu.cross.exe.release.1891867734" name="Release">
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1327539654838326403" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
# scons-presentation
|
# scons-presentation
|
||||||
A presentation titled "SCons; A Python-Based Build System"
|
|
||||||
|
A talk titled "SCons; A Python-Based Build System"
|
||||||
|
|
||||||
|
|||||||
124
execEx/01/SConstruct
Normal file
124
execEx/01/SConstruct
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
|
||||||
|
Help("""
|
||||||
|
|
||||||
|
This is the first scons example. In this example we see a very simple way
|
||||||
|
of calling scons to create an executable
|
||||||
|
|
||||||
|
>> ls
|
||||||
|
main.cpp SConstruct
|
||||||
|
|
||||||
|
>> scons -h (get this help message)
|
||||||
|
>> scons -H (get scons command help)
|
||||||
|
usage: scons [OPTION] [TARGET] ...
|
||||||
|
|
||||||
|
SCons Options:
|
||||||
|
-b, -d, -e, -m, -S, -t, -w, --environment-overrides, --no-keep-going,
|
||||||
|
--no-print-directory, --print-directory, --stop, --touch
|
||||||
|
Ignored for compatibility.
|
||||||
|
-c, --clean, --remove Remove specified targets and dependencies.
|
||||||
|
-C DIR, --directory=DIR Change to DIR before doing anything.
|
||||||
|
--cache-debug=FILE Print CacheDir debug info to FILE.
|
||||||
|
--cache-disable, --no-cache
|
||||||
|
Do not retrieve built targets from CacheDir.
|
||||||
|
--cache-force, --cache-populate
|
||||||
|
Copy already-built targets into the CacheDir.
|
||||||
|
--cache-readonly Do not update CacheDir with built targets.
|
||||||
|
--cache-show Print build actions for files from CacheDir.
|
||||||
|
--config=MODE Controls Configure subsystem: auto, force,
|
||||||
|
cache.
|
||||||
|
-D Search up directory tree for SConstruct,
|
||||||
|
build all Default() targets.
|
||||||
|
--debug=TYPE Print various types of debugging information:
|
||||||
|
count, duplicate, explain, findlibs, includes,
|
||||||
|
memoizer, memory, objects, pdb, prepare,
|
||||||
|
presub, stacktrace, time.
|
||||||
|
--diskcheck=TYPE Enable specific on-disk checks.
|
||||||
|
--duplicate=DUPLICATE Set the preferred duplication methods. Must be
|
||||||
|
one of hard-soft-copy, soft-hard-copy,
|
||||||
|
hard-copy, soft-copy, copy
|
||||||
|
-f FILE, --file=FILE, --makefile=FILE, --sconstruct=FILE
|
||||||
|
Read FILE as the top-level SConstruct file.
|
||||||
|
-h, --help Print defined help message, or this one.
|
||||||
|
-H, --help-options Print this message and exit.
|
||||||
|
-i, --ignore-errors Ignore errors from build actions.
|
||||||
|
-I DIR, --include-dir=DIR Search DIR for imported Python modules.
|
||||||
|
--implicit-cache Cache implicit dependencies
|
||||||
|
--implicit-deps-changed Ignore cached implicit dependencies.
|
||||||
|
--implicit-deps-unchanged Ignore changes in implicit dependencies.
|
||||||
|
--interact, --interactive Run in interactive mode.
|
||||||
|
-j N, --jobs=N Allow N jobs at once.
|
||||||
|
-k, --keep-going Keep going when a target can't be made.
|
||||||
|
--max-drift=N Set maximum system clock drift to N seconds.
|
||||||
|
--md5-chunksize=N Set chunk-size for MD5 signature computation to
|
||||||
|
N kilobytes.
|
||||||
|
-n, --no-exec, --just-print, --dry-run, --recon
|
||||||
|
Don't build; just print commands.
|
||||||
|
--no-site-dir Don't search or use the usual site_scons dir.
|
||||||
|
--profile=FILE Profile SCons and put results in FILE.
|
||||||
|
-q, --question Don't build; exit status says if up to date.
|
||||||
|
-Q Suppress "Reading/Building" progress messages.
|
||||||
|
--random Build dependencies in random order.
|
||||||
|
-s, --silent, --quiet Don't print commands.
|
||||||
|
--site-dir=DIR Use DIR instead of the usual site_scons dir.
|
||||||
|
--stack-size=N Set the stack size of the threads used to run
|
||||||
|
jobs to N kilobytes.
|
||||||
|
--taskmastertrace=FILE Trace Node evaluation to FILE.
|
||||||
|
--tree=OPTIONS Print a dependency tree in various formats: all,
|
||||||
|
derived, prune, status.
|
||||||
|
-u, --up, --search-up Search up directory tree for SConstruct,
|
||||||
|
build targets at or below current directory.
|
||||||
|
-U Search up directory tree for SConstruct,
|
||||||
|
build Default() targets from local SConscript.
|
||||||
|
-v, --version Print the SCons version number and exit.
|
||||||
|
--warn=WARNING-SPEC, --warning=WARNING-SPEC
|
||||||
|
Enable or disable warnings.
|
||||||
|
-Y REPOSITORY, --repository=REPOSITORY, --srcdir=REPOSITORY
|
||||||
|
Search REPOSITORY for source and target files.
|
||||||
|
|
||||||
|
>> scons
|
||||||
|
scons: Reading SConscript files ...
|
||||||
|
scons: done reading SConscript files.
|
||||||
|
scons: Building targets ...
|
||||||
|
g++ -o main.o -c main.cpp
|
||||||
|
g++ -o helloworld main.o
|
||||||
|
scons: done building targets.
|
||||||
|
|
||||||
|
|
||||||
|
>> scons
|
||||||
|
scons: Reading SConscript files ...
|
||||||
|
scons: done reading SConscript files.
|
||||||
|
scons: Building targets ...
|
||||||
|
scons: `.' is up to date.
|
||||||
|
scons: done building targets.
|
||||||
|
|
||||||
|
|
||||||
|
>> ls -a
|
||||||
|
total 32
|
||||||
|
drwxr-xr-x 2 brgirgis users 96 Sep 26 22:50 ./
|
||||||
|
drwxr-xr-x 5 brgirgis users 36 Sep 26 22:44 ../
|
||||||
|
-rwxr-xr-x 1 brgirgis users 13176 Sep 26 22:50 helloworld*
|
||||||
|
-rw-r--r-- 1 brgirgis users 94 Sep 26 22:20 main.cpp
|
||||||
|
-rw-r--r-- 1 brgirgis users 2728 Sep 26 22:50 main.o
|
||||||
|
-rw-r--r-- 1 brgirgis users 1749 Sep 26 22:50 .sconsign.dblite
|
||||||
|
-rw-r--r-- 1 brgirgis users 400 Sep 26 22:50 SConstruct
|
||||||
|
|
||||||
|
>> scons -c
|
||||||
|
scons: Reading SConscript files ...
|
||||||
|
scons: done reading SConscript files.
|
||||||
|
scons: Cleaning targets ...
|
||||||
|
Removed main.o
|
||||||
|
Removed helloworld
|
||||||
|
scons: done cleaning targets.
|
||||||
|
|
||||||
|
|
||||||
|
>> ls -a
|
||||||
|
total 12
|
||||||
|
drwxr-xr-x 2 brgirgis users 64 Sep 26 22:53 ./
|
||||||
|
drwxr-xr-x 5 brgirgis users 36 Sep 26 22:44 ../
|
||||||
|
-rw-r--r-- 1 brgirgis users 94 Sep 26 22:20 main.cpp
|
||||||
|
-rw-r--r-- 1 brgirgis users 1759 Sep 26 22:51 .sconsign.dblite
|
||||||
|
-rw-r--r-- 1 brgirgis users 1178 Sep 26 22:54 SConstruct
|
||||||
|
|
||||||
|
""")
|
||||||
|
|
||||||
|
Program('helloworld', 'main.cpp')
|
||||||
10
execEx/01/main.cpp
Normal file
10
execEx/01/main.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
std::cout << "Hello World!" << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
75
execEx/02/SConstruct
Normal file
75
execEx/02/SConstruct
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
|
||||||
|
Help("""
|
||||||
|
|
||||||
|
This is the second scons example. In this example we explore more options in
|
||||||
|
scons. Once you start doing anything useful with scons other than showing
|
||||||
|
how simple scons works, you will have to create an environment to have more
|
||||||
|
control on the build.
|
||||||
|
|
||||||
|
One can "Dump()" the environment to see all the underlying details. We can
|
||||||
|
also compare between Linux and windows environments.
|
||||||
|
|
||||||
|
>> ls
|
||||||
|
foo.cpp foo.hpp main.cpp SConstruct
|
||||||
|
|
||||||
|
>> scons
|
||||||
|
scons: Reading SConscript files ...
|
||||||
|
------------------>starting
|
||||||
|
------------------>ending
|
||||||
|
scons: done reading SConscript files.
|
||||||
|
scons: Building targets ...
|
||||||
|
g++ -o foo.o -c foo.cpp
|
||||||
|
g++ -o main.o -c main.cpp
|
||||||
|
g++ -o helloworld main.o foo.o
|
||||||
|
scons: done building targets.
|
||||||
|
|
||||||
|
|
||||||
|
>> ls -a
|
||||||
|
total 68
|
||||||
|
drwxr-xr-x 2 brgirgis users 154 Sep 26 23:04 ./
|
||||||
|
drwxr-xr-x 5 brgirgis users 36 Sep 26 22:44 ../
|
||||||
|
-rw-r--r-- 1 brgirgis users 21096 Sep 26 23:04 env.txt
|
||||||
|
-rw-r--r-- 1 brgirgis users 48 Sep 26 22:42 foo.cpp
|
||||||
|
-rw-r--r-- 1 brgirgis users 109 Sep 26 22:40 foo.hpp
|
||||||
|
-rw-r--r-- 1 brgirgis users 1256 Sep 26 23:03 foo.o
|
||||||
|
-rwxr-xr-x 1 brgirgis users 13288 Sep 26 23:03 helloworld*
|
||||||
|
-rw-r--r-- 1 brgirgis users 117 Sep 26 22:41 main.cpp
|
||||||
|
-rw-r--r-- 1 brgirgis users 2872 Sep 26 23:03 main.o
|
||||||
|
-rw-r--r-- 1 brgirgis users 2441 Sep 26 23:04 .sconsign.dblite
|
||||||
|
-rw-r--r-- 1 brgirgis users 1348 Sep 26 23:04 SConstruct
|
||||||
|
|
||||||
|
|
||||||
|
>> scons --tree=all helloworld
|
||||||
|
scons: Reading SConscript files ...
|
||||||
|
------------------>starting
|
||||||
|
------------------>ending
|
||||||
|
scons: done reading SConscript files.
|
||||||
|
scons: Building targets ...
|
||||||
|
scons: `helloworld' is up to date.
|
||||||
|
+-helloworld
|
||||||
|
+-main.o
|
||||||
|
| +-main.cpp
|
||||||
|
| +-foo.hpp
|
||||||
|
| +-/usr/bin/g++
|
||||||
|
+-foo.o
|
||||||
|
| +-foo.cpp
|
||||||
|
| +-foo.hpp
|
||||||
|
| +-/usr/bin/g++
|
||||||
|
+-/usr/bin/g++
|
||||||
|
scons: done building targets.
|
||||||
|
|
||||||
|
|
||||||
|
""")
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
print('------------------>starting')
|
||||||
|
env = Environment(ENV=os.environ)
|
||||||
|
|
||||||
|
open('env.txt', 'w').write(env.Dump())
|
||||||
|
|
||||||
|
env.Program(target='helloworld',
|
||||||
|
source=['main.cpp', 'foo.cpp'])
|
||||||
|
|
||||||
|
print('------------------>ending')
|
||||||
|
|
||||||
8
execEx/02/foo.cpp
Normal file
8
execEx/02/foo.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
#include "foo.hpp"
|
||||||
|
|
||||||
|
int
|
||||||
|
foo()
|
||||||
|
{
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
6
execEx/02/foo.hpp
Normal file
6
execEx/02/foo.hpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef SRC_EXECEX_02_FOO_HPP_
|
||||||
|
#define SRC_EXECEX_02_FOO_HPP_
|
||||||
|
|
||||||
|
int foo();
|
||||||
|
|
||||||
|
#endif // SRC_EXECEX_02_FOO_HPP_
|
||||||
12
execEx/02/main.cpp
Normal file
12
execEx/02/main.cpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
#include "foo.hpp"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
std::cout << "foo = " << foo() << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
6
execEx/03/SConscript
Normal file
6
execEx/03/SConscript
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Import('env')
|
||||||
|
|
||||||
|
prog = env.Program(target='helloworld',
|
||||||
|
source=['main.cpp', 'foo.cpp'])
|
||||||
|
|
||||||
|
env.Install(env.installDir, prog)
|
||||||
92
execEx/03/SConstruct
Normal file
92
execEx/03/SConstruct
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
Help("""
|
||||||
|
|
||||||
|
This is the third scons example. In this example we see more things that we
|
||||||
|
can do with scons. Namely: arguments, variant build directory, and install.
|
||||||
|
|
||||||
|
One can add the help for the expected build arguments using this help
|
||||||
|
function call
|
||||||
|
|
||||||
|
DEBUG=1,0 - enable debug build, default 1
|
||||||
|
ASSERT=1,0 - enable run time assertion, default 1 in DEBUG=1 and 0 otherwise
|
||||||
|
COMPILER=compilerName - compiler name
|
||||||
|
BUILDNAME=buildName - build name
|
||||||
|
|
||||||
|
""")
|
||||||
|
|
||||||
|
"""
|
||||||
|
Processing arguments
|
||||||
|
"""
|
||||||
|
debugArg = ARGUMENTS.get('DEBUG', '1')
|
||||||
|
if debugArg not in ['0', '1']:
|
||||||
|
raise RuntimeError('Check the DEBUG input argument.')
|
||||||
|
|
||||||
|
assertArg = '1' if debugArg == '1' else ARGUMENTS.get('ASSERT', '0')
|
||||||
|
if assertArg not in ['0', '1']:
|
||||||
|
raise RuntimeError('Check the ASSERT input argument.')
|
||||||
|
|
||||||
|
compilerName = ARGUMENTS.get('COMPILER', '')
|
||||||
|
buildName = ARGUMENTS.get('BUILDNAME', 'default')
|
||||||
|
|
||||||
|
"""
|
||||||
|
Initializing the environment
|
||||||
|
"""
|
||||||
|
env = Environment(ENV=os.environ,
|
||||||
|
CC='clang',
|
||||||
|
CXX='clang++')
|
||||||
|
ccFlags = []
|
||||||
|
linkFlags = []
|
||||||
|
if compilerName == 'gcc':
|
||||||
|
env.Replace(CC='gcc',
|
||||||
|
CXX='g++')
|
||||||
|
ccFlags = ["-std=c++1z", "-Wall", "-Wuninitialized", "-Wunused", "-Wconversion", "-fpermissive"]
|
||||||
|
if debugArg == '0':
|
||||||
|
ccFlags += ["-O3"]
|
||||||
|
linkFlags = ["-Wl,--export-dynamic"]
|
||||||
|
else:
|
||||||
|
ccFlags += ["-g", "-O0"]
|
||||||
|
linkFlags = ["-g"]
|
||||||
|
else:
|
||||||
|
ccFlags = ["-std=c++1z", "-Wall", "-Wuninitialized", "-Wunused", "-Wconversion", "-fpermissive"]
|
||||||
|
if debugArg == '0':
|
||||||
|
ccFlags += ["-O3"]
|
||||||
|
linkFlags = ["-Wl,--export-dynamic"]
|
||||||
|
else:
|
||||||
|
ccFlags += ["-g", "-O0"]
|
||||||
|
linkFlags = ["-g"]
|
||||||
|
|
||||||
|
env['CPPFLAGS'] = ccFlags
|
||||||
|
env['LINKFLAGS'] = linkFlags
|
||||||
|
|
||||||
|
cppDefine = {}
|
||||||
|
|
||||||
|
if assertArg == '0':
|
||||||
|
cppDefine['NDEBUG'] = None
|
||||||
|
|
||||||
|
env['CPPDEFINES'] = cppDefine
|
||||||
|
|
||||||
|
"""
|
||||||
|
Paths setup
|
||||||
|
"""
|
||||||
|
|
||||||
|
env.srcDir = Dir('#').abspath
|
||||||
|
|
||||||
|
env.buildDir = os.path.join(env.srcDir, 'build', buildName)
|
||||||
|
env.installDir = os.path.join(env.srcDir, 'install', buildName)
|
||||||
|
|
||||||
|
VariantDir(variant_dir=env.buildDir,
|
||||||
|
src_dir=env.srcDir,
|
||||||
|
duplicate=0)
|
||||||
|
|
||||||
|
Install(env.installDir, os.path.join(env.srcDir, 'bin'))
|
||||||
|
Alias('install', env.installDir)
|
||||||
|
Default('install')
|
||||||
|
|
||||||
|
"""
|
||||||
|
Add build targets
|
||||||
|
"""
|
||||||
|
|
||||||
|
SConscript(os.path.join(env.buildDir, 'SConscript'),
|
||||||
|
exports={'env' : env})
|
||||||
1
execEx/03/bin/badlink
Symbolic link
1
execEx/03/bin/badlink
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
./bad
|
||||||
1
execEx/03/bin/link.sh
Symbolic link
1
execEx/03/bin/link.sh
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
./script.sh
|
||||||
0
execEx/03/bin/script.sh
Executable file
0
execEx/03/bin/script.sh
Executable file
8
execEx/03/foo.cpp
Normal file
8
execEx/03/foo.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
#include "foo.hpp"
|
||||||
|
|
||||||
|
int
|
||||||
|
foo()
|
||||||
|
{
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
6
execEx/03/foo.hpp
Normal file
6
execEx/03/foo.hpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef SRC_EXECEX_02_FOO_HPP_
|
||||||
|
#define SRC_EXECEX_02_FOO_HPP_
|
||||||
|
|
||||||
|
int foo();
|
||||||
|
|
||||||
|
#endif // SRC_EXECEX_02_FOO_HPP_
|
||||||
12
execEx/03/main.cpp
Normal file
12
execEx/03/main.cpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
#include "foo.hpp"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
std::cout << "foo = " << foo() << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
execEx/04/SConstruct
Normal file
9
execEx/04/SConstruct
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
env = Environment(tools=['default', 'cpythongen'])
|
||||||
|
|
||||||
|
hello = File('helloworld.py')
|
||||||
|
|
||||||
|
env.InstallPython('bin', hello)
|
||||||
|
|
||||||
|
env.Alias('install', 'bin')
|
||||||
|
|
||||||
229
execEx/04/site_scons/site_tools/cpythongen.py
Normal file
229
execEx/04/site_scons/site_tools/cpythongen.py
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
"""SCons.Tool.cpython
|
||||||
|
|
||||||
|
Tool-specific initialization for Python binary builder.
|
||||||
|
|
||||||
|
There normally shouldn't be any need to import this module directly.
|
||||||
|
It will usually be imported through the generic SCons.Tool.Tool()
|
||||||
|
selection method.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2001-7,2010 The SCons Foundation
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
# a copy of this software and associated documentation files (the
|
||||||
|
# "Software"), to deal in the Software without restriction, including
|
||||||
|
# without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
# permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
# the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included
|
||||||
|
# in all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||||
|
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||||
|
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
#
|
||||||
|
|
||||||
|
__revision__ = "src/engine/SCons/Tool/python.py 3263 2008/07/31 13:50:51 MatiGruca"
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import SCons.Action
|
||||||
|
import SCons.Builder
|
||||||
|
import SCons.Errors
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# Create Python builder
|
||||||
|
def createPythonBuilder(env):
|
||||||
|
"""This is a utility function that creates the InstallPython
|
||||||
|
Builder in an Environment if it's not there already.
|
||||||
|
|
||||||
|
If it's there already, we return the existing one.
|
||||||
|
|
||||||
|
This builder is based on Install/InstallAs methods. It makes use
|
||||||
|
of those builder's functions: installFunc(), and
|
||||||
|
add_targets_to_INSTALLED_FILES()).
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
PythonInstallBuilder = env['BUILDERS']['InstallPython']
|
||||||
|
except KeyError:
|
||||||
|
from SCons.Tool.install import installFunc, add_targets_to_INSTALLED_FILES
|
||||||
|
installpython_action = SCons.Action.Action(installFunc, '$CPYTHON_PYCOMSTR')
|
||||||
|
PythonInstallBuilder = SCons.Builder.Builder(
|
||||||
|
action = installpython_action,
|
||||||
|
src_suffix = '$CPYTHON_SUFFIX',
|
||||||
|
target_factory = env.fs.Entry,
|
||||||
|
source_factory = env.fs.Entry,
|
||||||
|
multi = 1,
|
||||||
|
emitter = [ add_targets_to_INSTALLED_FILES ],
|
||||||
|
name = 'InstallPythonBuilder')
|
||||||
|
|
||||||
|
return PythonInstallBuilder
|
||||||
|
|
||||||
|
def InstallPython(env, target=None, source=None, dir=None, **kw):
|
||||||
|
"""InstallPython creates .pyc or .pyo files for .py source files
|
||||||
|
and adds them to the list of targets along with the source files.
|
||||||
|
They are later copied to the destination (target) directory.
|
||||||
|
|
||||||
|
InstallPython takes a target (destination) directory as its first
|
||||||
|
argument and a list of source files/directories as a second argument.
|
||||||
|
|
||||||
|
InstallPython returns the list of target files to copy to the
|
||||||
|
target directory.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if target and dir:
|
||||||
|
raise SCons.Errors.UserError, "Both target and dir defined for InstallPython(), only one may be defined."
|
||||||
|
if not dir:
|
||||||
|
dir=target
|
||||||
|
|
||||||
|
try:
|
||||||
|
dnodes = env.arg2nodes(dir, env.fs.Dir)
|
||||||
|
except TypeError:
|
||||||
|
raise SCons.Errors.UserError, "Target `%s' of Install() is a file, but should be a directory. Perhaps you have the InstallPython() arguments backwards?" % str(dir)
|
||||||
|
|
||||||
|
sources = env.arg2nodes(source, env.fs.Entry)
|
||||||
|
tgt = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
import py_compile
|
||||||
|
except ImportError:
|
||||||
|
raise SCons.Errors.InternalError, "Couldn't import py_compile module"
|
||||||
|
|
||||||
|
# import `compileall` module only if there is a dir in sources list
|
||||||
|
import SCons.Node
|
||||||
|
dir_in_sources = [isinstance(i, SCons.Node.FS.Dir) for i in sources]
|
||||||
|
if True in dir_in_sources:
|
||||||
|
try:
|
||||||
|
import compileall
|
||||||
|
except ImportError:
|
||||||
|
raise SCons.Errors.InternalError, "Couldn't import compileall module"
|
||||||
|
import glob
|
||||||
|
|
||||||
|
compile_pyc = True
|
||||||
|
try:
|
||||||
|
if int(env.subst('$CPYTHON_PYC')) == 0:
|
||||||
|
compile_pyc = False
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if compile_pyc:
|
||||||
|
CPYTHON_TARGETSUFFIX = 'c'
|
||||||
|
else:
|
||||||
|
CPYTHON_TARGETSUFFIX = 'o'
|
||||||
|
|
||||||
|
PIB = PythonInstallBuilder
|
||||||
|
|
||||||
|
for dnode in dnodes:
|
||||||
|
for src in sources:
|
||||||
|
# add *.py and *.pyc files from a directory to tgt list
|
||||||
|
if isinstance(src, SCons.Node.FS.Dir) and compile_pyc:
|
||||||
|
compileall.compile_dir(str(src), maxlevels = 0, quiet = 1)
|
||||||
|
globpath = src.path + os.sep + '*.py'
|
||||||
|
py_and_pycs = glob.glob(globpath) + glob.glob(globpath+'c')
|
||||||
|
for filename in py_and_pycs:
|
||||||
|
target = env.fs.Entry('.'+os.sep+filename, dnode)
|
||||||
|
tgt.extend(apply(PIB, (env, target, filename), kw))
|
||||||
|
# add *.py and *.pyo files from a directory to tgt list
|
||||||
|
elif isinstance(src, SCons.Node.FS.Dir):
|
||||||
|
to_compile = []
|
||||||
|
py_files = glob.glob(src.path + os.sep + '*.py')
|
||||||
|
for py_file in py_files:
|
||||||
|
to_compile.append(py_file)
|
||||||
|
target_path = '.' + os.sep + py_file
|
||||||
|
|
||||||
|
# add '.py' file to tgt list
|
||||||
|
py_src = env.fs.Entry(py_file)
|
||||||
|
py_tgt = env.fs.Entry(target_path, dnode)
|
||||||
|
tgt.extend(apply(PIB, (env, py_tgt, py_src), kw))
|
||||||
|
|
||||||
|
# add '.pyo' file to tgt list
|
||||||
|
pyo_src = env.fs.Entry(py_file + CPYTHON_TARGETSUFFIX)
|
||||||
|
pyo_tgt = env.fs.Entry(target_path + CPYTHON_TARGETSUFFIX, dnode)
|
||||||
|
tgt.extend(apply(PIB, (env, pyo_tgt, pyo_src), kw))
|
||||||
|
act = SCons.Action.CommandAction('@$CPYTHON_PYCOM %s' % (' '.join(to_compile)))
|
||||||
|
act([], [], env)
|
||||||
|
# add single '.py' and '.pyc' or '.pyo' file to tgt list
|
||||||
|
else:
|
||||||
|
# add '.py' file to tgt list
|
||||||
|
target = env.fs.Entry('.'+os.sep+src.path, dnode)
|
||||||
|
tgt.extend(apply(PIB, (env, target, src), kw))
|
||||||
|
|
||||||
|
# .pyc or .pyo source and target files
|
||||||
|
pyco_src = env.fs.Entry(src.path + CPYTHON_TARGETSUFFIX)
|
||||||
|
pyco_tgt = env.fs.Entry(target.path + CPYTHON_TARGETSUFFIX)
|
||||||
|
|
||||||
|
if compile_pyc:
|
||||||
|
py_compile.compile(src.path)
|
||||||
|
else:
|
||||||
|
act = SCons.Action.CommandAction('@$CPYTHON_PYCOM %s' % (src.path))
|
||||||
|
act([], [], env)
|
||||||
|
|
||||||
|
# add '.pyc' or '.pyo' file to tgt list
|
||||||
|
tgt.extend(apply(PIB, (env, pyco_tgt, pyco_src), kw))
|
||||||
|
|
||||||
|
return tgt
|
||||||
|
|
||||||
|
def detect_python(env, version):
|
||||||
|
return '/usr/include/python%s' % version
|
||||||
|
|
||||||
|
def detect_python_lib(env, version):
|
||||||
|
return '/usr/lib/python%s' % version
|
||||||
|
|
||||||
|
def generate(env):
|
||||||
|
from SCons.Tool.install import copyFunc
|
||||||
|
|
||||||
|
try:
|
||||||
|
env['INSTALL']
|
||||||
|
except KeyError:
|
||||||
|
env['INSTALL'] = copyFunc
|
||||||
|
|
||||||
|
global PythonInstallBuilder
|
||||||
|
PythonInstallBuilder = createPythonBuilder(env)
|
||||||
|
|
||||||
|
py_version = '2.7'
|
||||||
|
sys_version = sys.version_info[:2]
|
||||||
|
if len(sys_version) == 2:
|
||||||
|
py_version = '%d.%d' % (sys_version[0], sys_version[1])
|
||||||
|
env.SetDefault(
|
||||||
|
CPYTHON_PYC = 1, # generate '.pyc' files by default
|
||||||
|
CPYTHON_EXE = 'python',
|
||||||
|
CPYTHON_PYO_FLAGS = '-O',
|
||||||
|
CPYTHON_PYO_CMD = "-c 'import sys,py_compile; [py_compile.compile(i) for i in sys.argv[1:]]'",
|
||||||
|
CPYTHON_PYCOM = '$CPYTHON_EXE $CPYTHON_PYO_FLAGS $CPYTHON_PYO_CMD',
|
||||||
|
CPYTHON_PYCOMSTR = 'Install file: "$SOURCE" as "$TARGET"',
|
||||||
|
CPYTHON_SUFFIX = '.py', # extension for Python source files
|
||||||
|
|
||||||
|
# Supporting variables for linking Boost.Python wrappers
|
||||||
|
CPYTHON_VERSION = py_version,
|
||||||
|
CPYTHON_INCLUDE = detect_python(env, py_version),
|
||||||
|
CPYTHON_LIB = detect_python_lib(env, py_version),
|
||||||
|
CPYTHON_BOOSTINC = '/usr/include',
|
||||||
|
CPYTHON_BOOSTLIB = '/usr/lib'
|
||||||
|
)
|
||||||
|
|
||||||
|
env.AppendUnique(CXXFLAGS=['-fPIC'])
|
||||||
|
env.Append(CPPPATH=['$CPYTHON_INCLUDE','$CPYTHON_BOOSTINC'])
|
||||||
|
env.AppendUnique(LINKFLAGS=['-shared','-Wl,--export-dynamic'])
|
||||||
|
env.Append(LIBPATH=['$CPYTHON_BOOSTLIB','$CPYTHON_LIB/config'])
|
||||||
|
env.AppendUnique(LIBS=['boost_python','python$CPYTHON_VERSION'])
|
||||||
|
|
||||||
|
try:
|
||||||
|
env.AddMethod(InstallPython, "InstallPython")
|
||||||
|
except AttributeError:
|
||||||
|
# Looks like we use a pre-0.98 version of SCons...
|
||||||
|
from SCons.Script.SConscript import SConsEnvironment
|
||||||
|
SConsEnvironment.InstallPython = InstallPython
|
||||||
|
|
||||||
|
def exists(env):
|
||||||
|
return 1
|
||||||
7
execEx/05/SConstruct
Normal file
7
execEx/05/SConstruct
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
Help("""
|
||||||
|
DEBUG=1,0 - enable debug build, default 1
|
||||||
|
""")
|
||||||
|
|
||||||
|
import sys
|
||||||
|
print('session python path:', str(sys.path).replace(', ', ',\n' + ' ' * 26))
|
||||||
BIN
execEx/05/bug.tar.gz
Normal file
BIN
execEx/05/bug.tar.gz
Normal file
Binary file not shown.
BIN
pptx/SCons.pptx
Normal file
BIN
pptx/SCons.pptx
Normal file
Binary file not shown.
Reference in New Issue
Block a user