| 1 | = Direct exploitation of requirements by CMake = |
| 2 | |
| 3 | == Development environnement |
| 4 | |
| 5 | Code management in SVN is at: |
| 6 | |
| 7 | https://svn.lal.in2p3.fr/projects/CMT2 |
| 8 | |
| 9 | * CMake modules are in https://svn.lal.in2p3.fr/projects/CMT2/cmake |
| 10 | * Tests environnements are in https://svn.lal.in2p3.fr/projects/CMT2/test |
| 11 | |
| 12 | == Principle |
| 13 | |
| 14 | We start from a CMake module (CMTLib.cmake) strictly written in CMake language acting as follows: |
| 15 | |
| 16 | * it parses the requirements syntax |
| 17 | * it's able to follow the use graph using both the CMTPROJECTPATH (and/or CMTPATH) and the use statements found in the requirements and project.cmt files |
| 18 | * then it applies the application or library statements dynamically, generating the add_library add_application statements |
| 19 | * it can convert a CMT macro into a CMake variable |
| 20 | |
| 21 | The structural convention applied is based on the model that we set up in Atlas: one 'installarea' per 'project' |
| 22 | |
| 23 | The result is 100% generic and only refers to requirements files and is meant to be applied to an existing software base structured à-la-CMT. |
| 24 | |
| 25 | A simple test sofware base is used: |
| 26 | * two projects: one for the test application and one for the libraries |
| 27 | * several packages for the libraries |
| 28 | * No manual construction of any CMakeLists.txt file. |
| 29 | * The build is done within each installarea, the sources are left CMT-based and strictly unchanged |
| 30 | |
| 31 | Of course many aspects still need developments and thoughts, among which (the list is not closed): |
| 32 | |
| 33 | * mapping between CMT conventional macros to CMake variables (eg cxxflags ...) |
| 34 | * conversion of make fragments into CMake generators |
| 35 | * conversion of patterns |
| 36 | |
| 37 | == System properties to hold the CMT database: |
| 38 | |
| 39 | ||`CMTPROJECTPATH`||contains the CMTPROJECTPATH env var|| |
| 40 | ||`CMTPATH`||contains the CMTPATH env var|| |
| 41 | ||`CMT_CURRENT_PROJECT`||contains the current project path|| |
| 42 | ||`CMT_PROJECTS`||dictionary of project names|| |
| 43 | ||`CMT_USES`||dictionary of package names|| |
| 44 | ||`_CMT_<name>_USEPROPERTIES`||context of the macro <name> (gives path & package that defined this macro)|| |
| 45 | ||`CMT_MACROS`||dictionary of macro names|| |
| 46 | ||`_CMT_<name>`||default value of the macro <name>|| |
| 47 | ||`_CMT_<name>_MACROPROPERTIES`||context of the macro <name> (gives path & package that defined this macro)|| |
| 48 | ||`_CMT_<name>[<tag>]`||tagged value of the macro <name>|| |
| 49 | |
| 50 | |
| 51 | == step 1: |
| 52 | |
| 53 | At least, I have been able to apply my simplistic model both on Visual and Unix without any manual action nor any special manual configuration (the CMTLib.cmake module knows nothing to the plateforme) |
| 54 | |
| 55 | What I have done is not yet a 'demonstration' that 100% of the CMT concepts can be automatically converted. But at least it demonstrates that one of the main issues that I put focus on, say |
| 56 | |
| 57 | * the use graph management, |
| 58 | * the declarative approach |
| 59 | * the genericity |
| 60 | |
| 61 | can be preserved (perhaps with some editing of the requirements files) |
| 62 | |
| 63 | No conceptual showstopper yet. |
| 64 | |
| 65 | == step 2 |
| 66 | |
| 67 | === new features inCMTLib.cmake: |
| 68 | |
| 69 | * implementing CMT macros: |
| 70 | * converted into GLOBAL 'property' |
| 71 | * each macro goes into the "_CMT_<name>" property |
| 72 | * or "_CMT_<name>[<tag>]" when a value is associated with a tag |
| 73 | * all _CMT_<name> properties are referenced in a dictionary CMT_MACROS (which is itself a GLOBAL property) providing the query functions: |
| 74 | * cmt_show_macros |
| 75 | * cmt_has_macro |
| 76 | * cmt_get_macro_value |
| 77 | |
| 78 | * Some policies are still hard-coded : |
| 79 | * all packages install their headers into the installarea of their project |
| 80 | * It makes use of the 'configure_file' function |
| 81 | * binaries are built in the installarea of the projet |
| 82 | * thus, every project declare its installarea as 'link_libraries' location |
| 83 | * linking of applications is still driven by the '<app>_linkopts' macro but this macro only contains the library names (since CMake will automatically add the '-l' options) |
| 84 | |
| 85 | |
| 86 | == step 3 |
| 87 | |
| 88 | * implement cmt_show_uses |
| 89 | * follow trailing \ to parse CMT statements |
| 90 | |
| 91 | == step 4 (''to be done'') |
| 92 | |
| 93 | * converting tags |
| 94 | * exploiting 'include_dirs' & 'include_path' statements so as to deduce installation of headers into 'installarea' |
| 95 | * implementing cmt_show_xxx |