On 02/20/2011 09:20 PM, Kristopher Gamrat wrote:
On Mon, Feb 21, 2011 at 3:12 AM, David C. Rankin drankinatty@suddenlinkmail.com wrote:
Guys,
I'm taking a stab at moving application/knemo to CMake. I'm new to cmake, but given a reasonable outline of what to do, I'll bet I can slog through it. knemo seems small enough to serve as a good package to learn with.
<snip>
Serghei started a cmake conversion scrapbook (with macros to help speed things up) on the wiki at http://trinity.pearsoncomputing.net/wiki/bin/view/Developers/CMakeConversion... -- I'm not sure if this is completely finished, I'm not familiar with cmake either, but it should at least help get things started. I remember him saying on IRC that you'll likely have to do some manual editing, but hopefully his stuff will at least get you to where you need to be to finish it off.
That's a good reference, but I need to know where the pieces go before I pick the pieces to figure out what to put in there.
To try and gain a better mental picture of what I'm trying to do, I'm trying to visualize what I need in the knemo directory structure. Here is a stab at visualizing what will be needed -- where. knemo has a simple dir structure in the source:
knemo admin src common kcm knemod translations
Let me know if what I have below is pointing in the right direction or just put '<del>' if not needed or '<add: what's needed>' inline below. That would really help me paint a picture of where I'm trying to go:
knemo | |- CMakeLists.txt |- config.h |- config.h.cmake |- \cmake | - modules (stuff I'll pick through later) |- \src | - kcm | -CMakeLists.txt? | - knemod | -CMakeLists.txt? |- \translations | -CMakeLists.txt?
('?' above shows files I think I need to create)
I'll look through the cmake/modules and patch that up later. First I want to get an outline what I need, then I can read the CMake stuff to find out what goes inside the files after I figure out which files I need :)
Ideally, what I want to do it some up with a "HelloWorld.tde.cmake" directory structure and template CMakeLists.txt that would look something like this:
trinity-app | |- CMakeLists.txt |- cmake | - modules (TDE stuff you need here) |- src |- - put the code here with framework of cmake stuff needed
If I can get a handle on where I need to get to, then I can work backwards (learning as I go) and fill in the gaps. (reverse engineer it for lack of better words ;-)
What I also need is a 'recipe' -- a few hard-&-fast rules for TDE CMakeLists.txt
Something like:
In the top CMakeLists.txt, you will need:
- required checks:
-- project( <name> )
-- include( CheckCXXSourceCompiles ) -- include( CheckFunctionExists ) -- include( CheckIncludeFileCXX ) -- include( CheckStructHasMember ) -- include( CheckSymbolExists ) -- include( CheckTypeSize ) -- include( FindPkgConfig )
-- set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) -- include( TDEMacros )
-- include( TDESetupPaths ) -- tde_setup_paths( )
- for each modules subdirectory in the packages a:
-- option( BUILD_<NAME> "Build <name>" ${BUILD_ALL} ) -- tde_conditional_add_subdirectory( BUILD_<NAME> <name> )
- then continue with:
# in between option() and tde_conditional_add_subdirectory() -- include( ConfigureChecks.cmake )
-- configure_file( config.h.cmake config.h @ONLY )
In each module subdirectory CMakeLists.txt you will need:
-- ???
I apologize if this is all basic stuff, but I don't know cmake. To help Trinity move things to cmake, I need to learn. You can't learn the tde specific stuff from google: 'cmake tutorial'. If I can get it sorted out, then I can add it to the wiki so others can follow my rabbit-trail and help move modules as well. (at least that's my plan)
If we can come up with a coherent 'recipe' for moving modules to cmake, I'm more than happy to write the wiki. From #trinity-desktop on freenode, I take it samelian is the goto guy on the CMakeLists.txt. It seems if we can put a bit of effort into coming up with this recipe, then we can multiply by tenfold the number of monkeys typing the recipe into a keyboard for other trinity-modules.
What say the experts on putting some type of recipe together?