``install_tactics.cpp`` and ``mem_initialiszer.cpp`` files between
the CMake and Python build systems.
The problem was that the generated files were
* Senstive to the order component directories were traversed
* For CMake there are two directories (a source and build directory)
for every component rather than a single directory like the
Python build system has.
To fix this a new function ``sorted_headers_by_component()`` has been
added which defines a order that is consistent between both build
systems. This function is then used on lists of paths to discovered
header files.
enum values is not consistent between python 2 or 3. The root cause
of the problem was a dictionary's keys being iterated over which has
no defined order.
This has been fixed by iterating over the dictionary's items and
ordering by values. We could order by key rather than the values but
seeing as these represent an enum, ordering by value makes more sense.
The issue here is that in Python2 ``exec`` is a statement and
``exec`` is a function in Python3. For the ``exec`` statement to
work we would need to write
```
exec line.strip(' \n') in exec_globals, None
```
We could write a wrapper function to do the right thing depending
on the Python version but a better approach is to actually just
use ``eval()`` rather than ``exec()`` because
* ``eval()`` is less "evil" than ``exec()`` because it only evaluates
a single expression. My testing so far seems to indicate that this is
sufficient.
* ``eval()`` is function in both Python 2 and 3 so we don't need
to specialise the code based on Python version.
executables, include files and libraries. We use
``GNUInstallDirs.cmake`` which ships with CMake to do the difficult work
of setting a sensible default and setting up CMake cache variables.
These can be overriden when running CMake by setting the
``CMAKE_INSTALL_BINDIR``, ``CMAKE_INSTALL_INCLUDEDIR`` and
``CMAKE_INSTALL_LIBDIR`` cache variables.
to ``OFF`` to make it clear in ccmake/cmake-gui that the support is
disabled. Previously it would be left as ``ON`` even if support wasn't
actually enabled.
by 03a8ef2795 . This relates to #463
Also leave a note regarding ``compiler_flags_override.cmake`` its
value is a bit dubious now that the compiler flags are almost the CMake
defaults.
Most file generation scripts don't depend on it anymore.
The exceptions are uses of ``update_api.py``. An explicit dependency
has been added here and a ``FIXME`` has been left to indicate that this
should be removed once ``update_api.py`` is completly independent of
``mk_util.py``.
``mk_genfile_common.py``. A new function ``mk_hpp_from_pyg()`` has been added
which provides a more sensible interface (hides the nasty ``exec()`` stuff)
to create the ``*.hpp`` files from ``*.pyg`` files.
Both ``mk_util.py`` and ``pyg2hpp.py`` have been modified to use the new
interface.
Whilst I'm here reindent ``pyg2hpp.py``.
The purpose of this change is to have Python code common to the Python
and CMake build systems separate from Python code that is only used for
the Python build system.
I've tested this change by making sure that the all the ``*.hpp``
files generated from ``*.pyg`` files match the files generated
before this change.
``mk_genfile_common.py`` and adapt ``mk_util.py`` and
``mk_pat_db.py`` to use the code at its new location.
Whilst I'm here reindent ``mk_mem_initializer_cpp.py``.
The purpose of this change is to have Python code common to the Python
and CMake build systems separate from Python code that is only used for
the Python build system.
``mk_genfile_common.py`` and adapt ``mk_util.py`` and
``mk_mem_initializer_cpp.py`` to use the code at its new location. The interface
has been changed slightly so that ``mk_mem_initializer_cpp_internal()`` now
returns the path the generated file. The motivation behind this is so that
clients of the function know the path of the generated file.
Whilst I'm here reindent ``mk_mem_initializer_cpp.py`` and the relevant
code in ``mk_util.py``.
The purpose of this change is to have Python code common to the Python
and CMake build systems separate from Python code that is only used for
the Python build system.