# qiBuild documentation

# Source code generation

    qi_generate_src(out [SRC <src> ...]
        [COMMAND <command> ...]
        COMMENT
    )

  Arguments: | out – the generated files in a list SRC – a group of sources to take as input COMMAND – the command to run to generate the files COMMENT – a comment to be displayed while generating the source file

  Generate a source file

  Example of use:

      set(_input ${CMAKE_CURRENT_SOURCE_DIR}/input.data)
      set(_output ${CMAKE_CURRENT_BINARY_DIR}/generated.c)
      qi_generate_src(${_output} SRC ${_input} COMMAND my_script ${_input} -o ${_output})
      qi_create_bin(my_bin ${_output} main.c)

  Note that the base dir of the output will automatically be created, so you do not have to worry about it in your script.

  Also note that you should consider adding an explicit dependency to the command that generates the sources, using the DEPENDS argument:

  For instance, when using a Python script:

       qi_generate_src(...
            COMMAND ${PYTHON2_EXECUTABLE} myscript.py ...
            DEPENDS myscript.py
      )

  Or when using a target:

       find_package(FOO REQUIRED)

       qi_generate_src(...
            COMMAND ${FOO_EXECUTABLE} myscript.py ...
            DEPENDS ${FOO_EXECUTABLE}
      )

    qi_generate_header(out [SRC <src> ...]
        [COMMAND <command> ...]
        COMMENT
    )

  Arguments: | out – the resulting source file SRC – a group of sources to take as input COMMAND – the command to run to generate the source file COMMENT – a comment to be displayed while generating the source file

  Generate a header

  Example of use:

      set(_input ${CMAKE_CURRENT_SOURCE_DIR}/input.data)
      set(_generated_h ${CMAKE_CURRENT_BINARY_DIR}/generated.h)
      qi_generate_header(${_generated_h} SRC ${_input}
       COMMAND my_script ${_input} -o ${_generated_h})
      qi_create_bin(foo ${_generated_h} main.c)
      qi_install_header(${_generated_h})

  Notes:
    - the base dir of the header will automatically be created, so you do not have to worry about it in your script.
    - `include_directories()` will be called with the directory where the header is generated.
    - As with `qi_generate_src`, you should specify a `DEPENDS` argument.

    qi_generate_trampoline(out in [List <list> ...]
        [PYTHON]
    )

  Arguments: | out – name of the output file, will be put in sdk binary dir. in – script source file below src directory List – of dependencies the script uses. PYTHON – set if the script is a python script. The trampoline scripts sets the following variables: - The appropriate LIBRARY__PATH variable for the platform - PYTHONPATH (Not yet supported) - QI_PATH to all the paths added to the other variables warning for maximum portability, always explicitly invoke python when running the trampoline script.

  Generate a trampoline script in stage binary dir that bounces to an other script in source dir

  To be used if your script needs to run from src dir, and access some built libraries or other components.

Changelog CMake index Python index Index