[Scons-users] Building a C++ program
    Christopher Dimech 
    dimech.christopher at gmail.com
       
    Wed Nov 25 14:59:10 EST 2015
    
    
  
I have a c++ program with files as follows.
I want to use g++ from the following path
     /home/cdi/Local/gcc-5-20150201/bin/g++
The program is raytrac.cpp and I use header files
for some classes
Currently my scons file looks as follows
path = ['/bin', '/usr/bin']
env = Environment (
  ENV = {'PATH' : path},
  CPPPATH='/home/cdi/Local/gcc-5-20150201/bin/g++',
  CPPPATH='adt',
  LINK='/home/cdi/Local/gcc-5-20150201/bin/g++',
  LINKFLAGS='-g'
)
env.VariantDir (
  variant_dir = 'build/larsa',
  src_dir = 'larsa',
  duplicate = 0
)
env.VariantDir (
  variant_dir = 'build/meidum',
  src_dir = 'meidum',
  duplicate = 0
)
env.VariantDir (
  variant_dir = 'build/adt',
  src_dir = 'adt',
  duplicate = 0
)
env.VariantDir (
  variant_dir = 'build/main',
  src_dir = 'main',
  duplicate = 0
)
sources = [
  'build/raytrac.cpp'
]
# Constructs object files without the .mod
allobjs = env.Object (sources)
env.Program (
  target = 'build/bin/raytrac.x',
  source = objs
)
Here is the file structure.
├── larsa
│   ├── error.hpp
│   ├── parseel.hpp
│   ├── parse.hpp
│   └── string.hpp
├── meidum
│   ├── complex.hpp
│   ├── matrix.hpp
│   ├── numeric.hpp
│   └── vector.hpp
├── adt
│   ├── graph.hpp
│   ├── list.hpp
│   ├── stack.hpp
│   └── tree.hpp
├── main
│   ├── raytrac.cpp
    
    
More information about the Scons-users
mailing list