[CMake] cmake PyQT/SIP
luxInteg
lux-integ at btconnect.com
Sat Dec 4 20:04:10 EST 2010
On Thursday 02 December 2010 07:48:55 Michael Wild wrote:
> >>
> >> Use ADD_CUSTOM_COMMAND.
> >
> > @Michael: that advice is not correct. add_custom_command sets up a
> > command to be run at "make" time. Instead, the execute_process command
> > should be used to run a command at "CMake" time which is what the OP
> > needs to generate his *.cpp files.
> >
> > @LuxInteg: See the CMakeLists.txt file at
> > http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/bindings/qt_gui/pyq
> > t4/
> >
> > for an example of generating source code with sip.
> >
> > Alan
>
> Huh, why can't he run sip at build time? If you do:
>
> find_program(SIP_EXECUTABLE sip)
>
> add_custom_command(OUTPUT
> ${CMAKE_CURRENT_BINARY_DIR}/fileC.cpp
> ${CMAKE_CURRENT_BINARY_DIR}/fileD.cpp
> COMMAND ${SIP_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR}
> ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip
> DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip
> COMMENT "Processing ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip"
> VERBATIM)
>
> add_library(myPythonExtension SHARED
> ${CMAKE_CURRENT_BINARY_DIR}/fileC.cpp
> ${CMAKE_CURRENT_BINARY_DIR}/fileD.cpp)
>
> # possibly link with required libraries here...
>
Thanks for your hep so far
I have been experimenting on the above with the following results:-
When the dependency has other dependencies the above appears to fail; i.e
when filA.sip calls some file say PyQt4/QTCore/somefile.sip. (And I do not
know of anyway of fitting this inside the add_custom_command() function.)
I tried beforehand
this:-
set(PYQt4_SIP_FILES /usr/share/sip/PyQt4)
then
COMMAND ${SIP_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip
${PYQt4_SIP_FILES}/PyQt4/QTCore/somefile.sip
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/fileA.sip
I even tried (the penultimate line) with ${PYQt4_SIP_FILES}/PyQt4/
but each time it comes back with
"sip: Unable to find file "QtCore/somefile.sip" "
I am using a FindSIP.cmake that kde4 uses.
Advice would be appreciated
luxInteg
More information about the CMake
mailing list