[Scons-users] Generated source file is placed in build directory,	missing includes
    Carsten Fuchs 
    carsten.fuchs at cafu.de
       
    Sat Oct 27 06:45:42 EDT 2012
    
    
  
Hi all,
I'm using a Command() builder for generating a C++ source code file that is part of the 
input files for a program builder. Shortened example:
def generateCode(target, source, env):
     with open(str(target[0]), 'w') as f:
         f.write("#include "AppCafu.hpp"\n");
         f.write("// ...\n");
app = env.Program('Ca3DE/Cafu',
     Glob("Ca3DE/*.cpp") +
     envCafu.Command("Ca3DE/AppCafu_GenList.cpp", "", generateCode))
This is in a SConscript file that is called from SConstruct via a call to 
SConscript(..., variant_dir=..., duplicate=0).
It all works, but like all obj and exe files, also the generated source file 
Ca3DE/AppCafu_GenList.cpp is created in the build directory that was specified with 
variant_dir.
The problem is that when Scons next calls the compiler to build the file, it cannot find 
the header specified in the #include statement.
It seems obvious that I can either manipulate the #include "../../../Ca3DE/AppCafu.hpp" 
path so that it points to the proper header file directly, whereas adding another 
parameter CPPPATH=['.', 'Ca3DE'] does not seem to have any effect.
It seems like I'm missing something, but I've not been able to figure out what it is.
What can I do?
Best regards,
Carsten
-- 
    Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
           Learn more at http://www.cafu.de
    
    
More information about the Scons-users
mailing list