[Scons-users] Includes from sibling directory
Gaurav Juvekar
gauravjuvekar at gmail.com
Sat Apr 1 13:43:35 EDT 2017
Hi,
I didn't get any replies on about this question posted in January. Can anyone confirm if this is a bug. Should I raise it on the tigris bug tracker?
I'm re-attaching the test case.
On 2017-01-16 15:43, Gaurav Juvekar wrote:
> Hi,
>
> Manually adding a
> env.Depends("a.o", "../include/a.h")
> in src/SConscript works.
>
> Is this a bug in the C file scanner?
>
> I am attaching a test case based on test/VariantDir/include-subdir.py
> Regards,
> Gaurav Juvekar
>
> On 01/11/2017 10:26 AM, Gaurav Juvekar wrote:
>> Hi,
>>
>> Does SCons properly set dependencies for header files in a sibling
>> directory in a variant build?
>>
>> I have a structure like
>> src/a.c
>> include/a.h
>> tests/test_a.c
>>
>> where a.c has #include "../include/a.h"
>>
>> The include dependency is not automatically tracked by SCons.
>>
>> I've set up the example at
>> https://github.com/gauravjuvekar/scons-includes-in-parent-dep-scan
>>
>> I know that it will work if I add the include directory to CPPPATH. Is
>> there a way to do it without changing CPPPATH?
>>
--
Regards,
Gaurav Juvekar
-------------- next part --------------
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Test VariantDir handling of #include files in sibling directories.
When a source file #includes a file that is not in a sibling directory,
we have to make sure that the file gets copied to the variant dir.
"""
import TestSCons
test = TestSCons.TestSCons()
#-------------------------------------------------------------------------------
#1- Create dep.cpp and the SConstruct. dep.h is missing and the build is
#expected to fail with 2.
#-------------------------------------------------------------------------------
test.subdir('src')
test.subdir('include')
test.write(['src', 'main.cpp'], """\
#include "main.h"
#include "../include/util.h"
int main(int argc, char* argv[])
{
return MAIN_VALUE+UTIL_VALUE;
}
""")
test.write(['src', 'main.h'], """\
#define MAIN_VALUE 2
""")
test.write(['include', 'util.h'], """\
#define UTIL_VALUE -2
""")
test.write('SConstruct', """
env = Environment()
env.VariantDir('bin', '.')
o = env.Object('bin/src/main', 'bin/src/main.cpp')
# env.Depends('bin/src/main.cpp', 'bin/include/util.h')
env.Program('bin/src/main', o)
""")
test.run(arguments = '.')
test.pass_test()
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170401/a3ec3c1e/attachment.pgp>
More information about the Scons-users
mailing list