[Scons-users] Compile and launch

Dirk Bächle tshortik at gmx.de
Tue Nov 4 13:41:31 EST 2014


Hi again,

I tinkered a little myself with Madagascar for the last hour, please 
find my resulting SConstruct file attached.

On 04.11.2014 16:26, Sven Lars Tobias Stål wrote:
> Hi
>
> Thank you so much for assistance! I hope not to disturb too much, but 
> I really appreciate any assistance.
>
> When I use SCons to compile (e.g with help of your example) I don’t 
> get any error codes, but the application just doesn’t work...
>
> [...]
>
> The reason why I’d like to include the compilation of seg2segy.c and 
> not just compile it once in the shell, is that later I’ll need to add 
> conditional choice of code.
>
In Madagascar it seems to be the required approach to create an own 
"user" folder, where you store the C files. You then actually have to 
compile these helper programs *and* install them to "/usr/bin" such that 
they get found on the standard PATH.
In the SConstruct that I attached, I hacked around this by adding "." to 
the environment path. Please, don't use this method for your further 
development, but stick to the Madagascar rules only.
Then directly accessing "rsf.proj.project" for setting the PATH and 
adding a dependency to the program shouldn't be needed anymore.

Tip: For checking the dependencies, you can start SCons with the option 
"--tree=all". This will show you the dependency tree for the current 
target(s)...

I'd also like to redirect you to the Madagascar community (forums, 
mailing lists, ...) for further questions regarding its usage, or the 
development of new programs/modules. From what I saw so far, the Wiki 
seems to have a lot of material on that...and skimming through the 
already existing user directories will definitely give you some new ideas.

Good luck with your project(s) and best regards,

Dirk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20141104/f7a410ec/attachment.html>
-------------- next part --------------
from rsf.proj import *
from math import *
import os

# Setting up environment
env = Environment()
# Adding '-m32' to the flags for compiling C files
env.Append(CCFLAGS=['-m32'])
# Creating a program from the source file
seg2segy = env.Program('seg2segy.c')

# Adding the current path to the "default" environment,
# such that seg2segy gets found locally.
rsf.proj.project.AppendENVPath('PATH','.')
# Download a simple test file
Fetch('Txx.HH','septour')
# Define a "flow", which pipes Txx.HH into our program,
# and writes the result to the file myout
myout = Flow('myout','Txx.HH','seg2segy tst=1')
# Optional: let the output file depend on our program
rsf.proj.project.Depends(myout, seg2segy)

End()



More information about the Scons-users mailing list