Issue #2 duplicate

Using qrc files as sources doesn't work with variant_dir

dirkbaechle
repo owner created an issue

Originally reported by https://launchpad.net/~comaddcor (Corni)

The following setup

SConstruct: env = Environment() envDebug = env.Clone() envDebug.Append(CPPFLAGS=['-g','-O0','-D_REENTRANT']) envRelease = env.Clone() envRelease.Append(CPPFLAGS=['-O3','-D_REENTRANT']) envDebug.SConscript('src/SConscript', variant_dir='build/debug', duplicate=0, exports={'env':envDebug}) envRelease.SConscript('src/SConscript', variant_dir='build/release', duplicate=0, exports={'env':envRelease})

SConscript: Import("env") env['QTDIR']='/usr/bin' env.Tool('qt4') env.Uic4(Glob('src/.ui')) env.Append(CPPPATH=['/usr/share/qt/mkspecs/linux-g++', '/usr/include/QtCore', '/usr/include/QtGui', '/usr/include']) env.Append(LIBS=['QtGui','QtCore', 'pthread']) env.Program(target='pokercalculator', source=Glob('.cpp')+Glob('*.qrc'))

results in the following error message: scons: warning: Two different environments were specified for target /pokercalculator/src/qrc_cards.cc, but they appear to have the same action: $QT4_RCC $QT4_QRCFLAGS -name cards $SOURCE -o $TARGET File "/pokercalculator/src/SConscript", line 10, in <module>

scons: *** Multiple ways to build the same target were specified for: /pokercalculator/src/qrc_cards.cc (from ['/pokercalculator/src/cards.qrc'] and from ['/pokercalculator/src/cards.qrc']) File "/pokercalculator/src/SConscript", line 10, in <module>

Comments (4)

  1. dirkbaechle reporter

    Hi,

    the problem here is that you specify "duplicate=0", such that generated files are created in the source directory. SCons then gets confused when you do this twice from different environments. You need to set duplicate=1, this should fix your problem.

    Best regards,

    Dirk

  2. dirkbaechle reporter

    Corni:

    Would you say that in principle i should be able to use that with duplicate=0 if i want to?

    As an intermediate fix i found that using an explicit call like this: qrccc = env.Qrc4('cards') env.Program(target='pokercalculator', source=Glob('*.cpp')+qrccc)

    works even though duplicate=0 is set.

  3. dirkbaechle reporter

    Corni:

    Also by setting duplicate=1 the qrc file gets copied but the resource files which it points to a naturally not detected by scons as a dependency and are therefore not automatically copied. Being able to use it with duplicate=0 would therefore be the preferred way. I therefore have to disagree with you decision to mark the bug as invalid. Maybe low priority would be more appropriate.

  4. Log in to comment