[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: scons
From:       Alexander Neundorf <neundorf () kde ! org>
Date:       2005-02-12 19:03:36
Message-ID: 200502122003.36862.neundorf () kde ! org
[Download RAW message or body]

> > > > >  - Add new target types
> >
> > what do you mean with new target type ?
>
> Something currently unsupported. Like kcfg(c) files. Let us say that we have 
> some inputfiles, some intermediate files, some outputs and a series of 
> commands to get us from inputs->intermediates->outputs.

As e.g. with uic files ?
Here's my custom uic support macro:

#set the path to uic
SET(_UIC2 /usr/src/qt-2.3.8-built/bin/uic)

MACRO(QT_ADD_UI_FILES _sources )
   FOREACH (_current_FILE ${ARGN})          #iterate through all ui files
      GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
      GET_FILENAME_COMPONENT(_path ${_current_FILE} PATH)
      SET(_header ${_path}/${_basename}.h)  #build the filenames
      SET(_src ${_path}/${_basename}.cpp)

      ADD_CUSTOM_COMMAND(OUTPUT ${_header}  #command to generate the ui.h file
         COMMAND ${_UIC2}
         ARGS  -o ${_header} ${_current_FILE}
         DEPENDS ${_current_FILE}         #executed when the .ui file changes
      )                
      ADD_CUSTOM_COMMAND(OUTPUT ${_src}   #command to generate the ui.cpp file
         COMMAND ${_UIC2}
         ARGS -o ${_src} -impl ${_header} ${_current_FILE} 
         DEPENDS ${_header}               #executed when the ui.h file changes 
      )                
      SET(${_sources} ${${_sources}} ${_src}) # add the generated ui.cpp file
                                              # to the list of sources
      
      QT_ADD_MOC_FILES(${_sources} "moc.cpp" ${_header}) #it needs moc
               
   ENDFOREACH (_current_FILE)
ENDMACRO(QT_ADD_UI_FILES)

Usage goes like this:

SET(foo_SRCS main.cpp myapp.cpp my_widget_impl.cpp foo_widget_impl.cpp)
SET(uic_SRCS my_widget.ui foo_widget.ui)

QT_ADD_UI_FILES(foo_SRCS ${uic_SRCS}) # call the macro

ADD_EXECUTABLE(kfoo ${foo_SRCS})

TARGET_LINK_LIBRARIES(kfoo $(QT_LIBRARIES) kdecore kdeui)  # or something

whereas "the_sources" is the list of source files belonging to the project, 
and qt_uic_SRCS is the list of .ui files belonging to the project.

> > Maintainers:
> > -active and responsive, outside of KDE
>
> But also a company, which could bankrupt. Not a catastrophe, but certainly
> a road bump. I didn't find a public bug system.

http://www.cmake.org/Bug/

Ok, and a last point: when building CMake, internally a libcmake.a is built. 
This one features functions to get the list of source files, dependancies, to 
run cmake on it and other things. It is not planned to turn this into an 
installable libcmake.so, but at least there is already a first hand 
implementation how to parse cmake files with C++ (hint: kdevelop and friends)

Bye
Alex
-- 
Work: alexander.neundorf@jenoptik.com - http://www.jenoptik-los.de
Home: neundorf@kde.org                - http://www.kde.org
      alex@neundorf.net               - http://www.neundorf.net
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic