cmake and asm?

Boudewijn Rempt boud at valdyas.org
Wed Jan 24 22:44:19 CET 2007


On Sunday 21 January 2007 01:41, Alexander Neundorf wrote:
> Hi,
>
> On Saturday 20 January 2007 21:38, Boudewijn Rempt wrote:
> > On Saturday 20 January 2007 17:36, Alexander Neundorf wrote:
> > > For now it should be possible to do something like the following:
> > > create a custom command which processes the asm file:
> > >
> > > add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/asm_scale.o
> > >                    COMMAND as ...
> > > ${CMAKE_CURRENT_SOURCE_DIR}/asm_scale.S
> >
> > Eh... What do I put in place of the triple dots? I'm very much a newbie
> > so cmake is a black box to me.
>
> The call to the assembler (as).
> See the cmake manpage for the documentation for add_custom_command() and
> autotools generated makefile for the exact call to as.

Okay! I got it working:

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/asm_scale.o
                   COMMAND gcc -c  -DHAVE_X86_MMX -DHAVE_X86_SSE -DHAVE_X86_SSE2 -DHAVE_X86_3DNOW ${CMAKE_CURRENT_SOURCE_DIR}/asm_scale.S
                   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/asm_scale.S )

I need to use gcc, not as, because it needs to go through the 
preprocessor first. (There are things like #ifdef HAVE_X86_MMX 
in the file).

Now, of course, I need to somehow parametrize it. I've got a file called
config-processor.h.cmake that contains the following:

/********** processor stuff *************/

/* Defined to 1 if the assembler supports MMX instructions. */
#cmakedefine HAVE_X86_MMX

/* Defined to 1 if the assembler supports SSE instructions. */
#cmakedefine HAVE_X86_SSE

/* Defined to 1 if the assembler supports SSE2 instructions. */
#cmakedefine HAVE_X86_SSE2

/* Defined to 1 if the assembler supports AltiVec instructions. */
#cmakedefine HAVE_PPC_ALTIVEC

And a call in my CMakeLists.txt file as follows:

configure_file(config-processor.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-processor.h )

So, how do I make sure that only the right -D's are in the COMMAND section?

-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20070124/61470b44/attachment.pgp 


More information about the Kde-buildsystem mailing list