.. _scons: |scons_logo| SCons ____________________ SCons can be used both to generate and consume conan packages, via the ``scons`` generator :ref:`generator `. The package recipe ``build()`` method could be similar to: .. code-block:: python class PkgConan(ConanFile): settings = 'os', 'compiler', 'build_type', 'arch' requires = 'Hello/1.0@user/stable' generators = "scons" ... def build(self): debug_opt = '--debug-build' if self.settings.build_type == 'Debug' else '' os.makedirs("build") # FIXME: Compiler, version, arch are hardcoded, not parametrized with tools.chdir("build"): self.run('scons -C {}/src {}'.format(self.source_folder, debug_opt)) ... The ``SConscript`` build script can load the generated ``SConscript_conan`` file that contains the information of the dependencies, and use it to build .. code-block:: python conan = SConscript('{}/SConscript_conan'.format(build_path_relative_to_sconstruct)) if not conan: print 'File `SConscript_conan` is missing.' print 'It should be generated by running `conan install`.' sys.exit(1) flags = conan["conan"] version = flags.pop("VERSION") env.MergeFlags(flags) env.Library("hello", "hello.cpp") A complete example, with a ``test_package`` that also uses SCons is in a github repository, you can try it: .. code-block:: bash $ git clone https://github.com/memsharded/conan-scons-template $ cd conan-scons-template $ conan create . demo/testing > Hello World Release! $ conan create . demo/testing -s build_type=Debug > Hello World Debug! .. |scons_logo| image:: ../images/scons.png