The cmake structure of a
package |
To be easy to use together via cmake, the
mmx packages share the following structure.
Moreover, with this structure, the configuration files can be updated
automatically using mmxmake. We will detail it for a
package called hereafter pkg, corresponding to the
folder pkg:
pkg
|-- include
| |-- pkg
| |-- file1.hpp
| |--…
|-- src
| |-- src_file1.cpp
| |-- …
|-- glue
| |-- glue_file1.cpp
| |-- …
|-- app
| |-- tool1.cpp
| |-- …
|-- test
| | …
|-- axl
| |-- QPlugin1
| | |-- …
| | …
|-- specif
| |-- pkg-cmake.mmx
| |-- …
|-- CMakeModules
| |-- FindPkg.cmake.in
| |-- …
|-- CMakeLists.txt
|-- … |
To describe how this structure is exploited in the configuration step,
we assume that we run cmake in a folder build,
where the binary files will be compiled:
1.The header files
The header files are put in pkg/include/pkg. Their
suffix is .hpp. They are used with the instruction in
C++ files as follows:
2.The source files for the library
The source files are put in pkg/src. Their suffix is
.cpp. All the files in this folder are used to
construct the library libpkg(.a,.so,.dyl,…) which is put in build/lib.
3.The application files
The application files are put in pkg/app. Their suffix
is .cpp. For each file f.cpp in pkg/app, a binary application f is
compiled and put in build/bin.
4.The test files
The test files are put in pkg/test. Their suffix is
.cpp. For each file t.cpp in pkg/test, a binary application pkg_test_t
is compiled in build/test. This files will be compiled
if the option TEST is ON. They will
executed with:
5.The glue files for the interpreter
The glue files are put in pkg/glue. Their suffix is
.cpp. All the files in this folder are used to
construct the library libmmxpkg(.a,.so,.dyl,…) which is put in build/lib. This library can be loaded in the interpreter
with the command use:
6.The files for the axel
plugins
The files for the axel plugins are put in pkg/axl. For each subfolder, of the form pkg/axl/QPlugin
(starting with a Q), a plugin libQPlugin(.so,.dyl,…) will be constructed an
put in build/plugins. All the files of the form pkg/axl/QPlugin/f.cpp (ending with .cpp)
will be used to make this plugin. A plugin plugin/libQPlugin.*
will be automatically loaded by axel.
© 2007 Bernard Mourrain
Permission is granted to copy, distribute and/or modify this document
under the terms of the
GNU General Public License. If you
don't have this file, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.