Re: [AD] acodec build system

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2010-04-05, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> Attached is a patch to make the examples more flexible regarding audio codecs.
> 
> In short, it:
> 
> * updates cmake.common "add_our_executable" to accept preprocessor
> defines (-DFOO)
> * updates the examples' cmake file to append -DALLEGRO_CFG_ACODEC_*
> for supported types at Allegro compile time
> * updates the examples to include acodec.h (NOT a system file) for
> common acodec init code
> 
> If none of the current three codecs are available, the examples will
> still compile with WAV support.

Great.

> @@ -187,11 +193,15 @@
>      add_executable(${nm} ${EXECUTABLE_TYPE} ${srcs})
>      target_link_libraries(${nm} ${libs})
>      if(WANT_POPUP_EXAMPLES AND SUPPORT_NATIVE_DIALOG)
> -        set_target_properties(${nm} PROPERTIES COMPILE_FLAGS "-DALLEGRO_POPUP_EXAMPLES")
> +        list(APPEND defines, "-DALLEGRO_POPUP_EXAMPLES")
>      endif()
>      if(NOT BUILD_SHARED_LIBS)
> -        set_target_properties(${nm} PROPERTIES COMPILE_FLAGS "-DALLEGRO_STATICLINK")
> +        list(APPEND defines, "-DALLEGRO_STATICLINK")
>      endif(NOT BUILD_SHARED_LIBS)
> +
> +    string(REGEX REPLACE ";" " " defines "${defines}")
> +    set_target_properties(${nm} PROPERTIES COMPILE_FLAGS "${defines}")
> +

If you use set(defines "${defines} -Dfoo") you won't need to replace the
semicolons later.

We probably actually should use the COMPILE_DEFINITIONS property as some
compilers might not use -D syntax.

> Index: examples/acodec.h
> ===================================================================
> --- examples/acodec.h	(revision 0)
> +++ examples/acodec.h	(revision 0)
> @@ -0,0 +1,28 @@

I suggest adding a comment at the top of this file.

Peter




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/