// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page qscxmlc.html
    \title Using the Qt SCXML Compiler (qscxmlc)
    \keyword qscxmlc

    \brief The Qt SCXML Compiler, \c qscxmlc, compiles state chart XML
           (.scxml) files to C++ source files.

    The \c qscxmlc tool reads an .scxml file and produces C++ source
    and header files, containing a class that implements a state machine as
    defined in SCXML.

    \section1 Usage

    The \c qscxmlc tool is invoked automatically if the project is linked against
    the \c scxml library in the project file, and the \c .scxml file to use is specified
    using the special build directives \c STATECHARTS or qt6_add_statecharts.

    When using cmake:

    \include qtscxml-module-use.qdocinc cmakebuild
    \include qtscxml-module-use.qdocinc cmakestatecharts

    When using qmake:

    \include qtscxml-module-use.qdocinc qmakebuild
    \include qtscxml-module-use.qdocinc qmakestatecharts

    With above definitions, \c qmake or \c cmake invokes \c qscxmlc to generate
    MyStatemachine.h and MyStatemachine.cpp, and adds them appropriately
    to the project as headers and sources.

    By default, the name of the generated class that implements the state
    machine corresponds with the \e name attribute of the \c <scxml> root
    element.

    The \c qscxmlc tool can also be invoked manually and the resulting header and
    source files can be used as regular source files in a project. When
    using these source files as part of a \c cmake project, one must
    additionally disable automatic moc in the CMakeLists.txt file as
    illustrated by this example:
    \code
    set_source_files_properties(statemachine.h PROPERTIES SKIP_AUTOMOC TRUE)
    \endcode
    If you omit this, you will see duplicate symbol errors during compilation.

    \section1 Command-Line Options

    The \c qscxmlc tool supports the following command-line options:

    \table
      \header
        \li Option
        \li Description
      \row
        \li \c {--namespace <namespace>}
        \li Put the generated class(es) in the specified namespace.
      \row
        \li \c {-o <base/out/name>}
        \li The base name of the output files. This can include a path. If none is specified, the
            basename of the input file is used.
      \row
        \li \c {--header <header/out>}
        \li The name of the output header file. If none is specified, .h is added to the base name.
      \row
        \li \c {--impl <cpp/out>}
        \li The name of the output header file. If none is specified, .cpp is added to the base name.
      \row
        \li \c {--classname <StateMachineClassName>}
        \li The class name of the generated state machine. If none is specified, the value of the
            name attribute of the <scxml> tag is taken. If that attribute is not specified either,
            the basename (excluding path) is taken from the input file name.
      \row
        \li \c --statemethods
        \li Generate extra accessor and signal methods for states. This way you can connect to
            state changes with plain QObject::connect() and directly call a method to find out if
            a state is currently active.
    \endtable

    The \c qmake and \c CMake project files support the following options:

    \table
      \header
        \li Option
        \li Description
      \row
        \li \c {QSCXMLC_DIR|OUTPUT_DIRECTORY <directory>}
        \li \c QSCXMLC_DIR (qmake) or \c OUTPUT_DIRECTORY (cmake) specifies the directory for
               the output files. OUTPUT_DIR (cmake) has been deprecated.
      \row
        \li \c {QSCXMLC_NAMESPACE|NAMESPACE <namespace>}
        \li \c QSCXMLC_NAMESPACE (qmake) or \c NAMESPACE (cmake) specifies the namespace for the
            generated classes.
      \row
        \li \c {QSCXMLC_ARGUMENTS|OPTIONS <options>}
        \li \c QSCXMLC_ARGUMENTS (qmake) or \c OPTIONS (cmake) allows specifying additional
            options for the \c qscxmlc compiler. QSCXMLC_ARGUMENTS with cmake has been
            deprecated.
    \endtable
*/
