[Spice-devel] [vdagent-win PATCH 13/13] build: Base cmake support

Frediano Ziglio fziglio at redhat.com
Mon May 28 13:41:35 UTC 2018


> 
> Lacking some rationale in the commit log I think ;)
> vdagent-win already has 2 build systems (mingw+autotools and VS), there
> are patches to port other spice components to meson, so why cmake here?
> 
> Christophe
> 

Was going to add a big RFC in front.
The reason of not using VS projects is that every version is different,
currently there are only project files for an old VS version.
Why cmake instead of meson:
- zlib and libpng, agent dependencies provide cmake support;
- VS provides cmake support;
- cmake is more mature on Windows providing different macros for it,
  meson works fine with project providing meson or using pkg-config
  but this does not work well on Windows.

I generated some njnia files on Windows (and this took hours!) at the
end the build files where looping infinitely. This cmake script took
one hour or less. Not that I'm saying is complete.

> 
> On Mon, May 28, 2018 at 09:58:06AM +0100, Frediano Ziglio wrote:
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> >  CMakeLists.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> >  Makefile.am    |  3 ++-
> >  2 files changed, 50 insertions(+), 1 deletion(-)
> >  create mode 100644 CMakeLists.txt
> > 
> > diff --git a/CMakeLists.txt b/CMakeLists.txt
> > new file mode 100644
> > index 0000000..c4b8b95
> > --- /dev/null
> > +++ b/CMakeLists.txt
> > @@ -0,0 +1,48 @@
> > +cmake_minimum_required(VERSION 2.6)
> > +
> > +# TODO missing libpng flags
> > +# EXPERIMENTAL
> > +#set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
> > +
> > +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -s")
> > +
> > +find_package(PNG REQUIRED)
> > +
> > +include_directories(common . spice-protocol ${PNG_INCLUDE_DIR})
> > +add_definitions(-DUNICODE -D_UNICODE -DOLDMSVCRT)
> > +add_executable(vdagent
> > +	common/vdcommon.cpp
> > +	common/vdcommon.h
> > +	common/vdlog.cpp
> > +	common/vdlog.h
> > +	vdagent/display_configuration.cpp
> > +	vdagent/display_configuration.h
> > +	vdagent/desktop_layout.cpp
> > +	vdagent/desktop_layout.h
> > +	vdagent/display_setting.cpp
> > +	vdagent/display_setting.h
> > +	vdagent/file_xfer.cpp
> > +	vdagent/file_xfer.h
> > +	vdagent/vdagent.cpp
> > +	vdagent/as_user.cpp
> > +	vdagent/as_user.h
> > +	vdagent/image.cpp
> > +	vdagent/image.h
> > +	vdagent/imagepng.cpp
> > +	vdagent/imagepng.h
> > +    vdagent/vdagent.rc
> > +)
> > +target_link_libraries(vdagent ${PNG_LIBRARY} ${ZLIB_LIBRARY} wtsapi32)
> > +set_target_properties(vdagent PROPERTIES LINK_FLAGS -mwindows)
> > +
> > +add_executable(vdservice
> > +	common/stdint.h
> > +	common/vdcommon.cpp
> > +	common/vdcommon.h
> > +	common/vdlog.cpp
> > +	common/vdlog.h
> > +	vdservice/vdservice.cpp
> > +    vdservice/vdservice.rc
> > +)
> > +target_link_libraries(vdservice wtsapi32)
> > +set_target_properties(vdservice PROPERTIES LINK_FLAGS -mconsole)
> > diff --git a/Makefile.am b/Makefile.am
> > index 3020824..79f6951 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -129,7 +129,8 @@ EXTRA_DIST +=			\
> >  	vdagent/vdagent.vcproj	\
> >  	vdservice/resource.h	\
> >  	vdservice/vdservice.rc	\
> > -	vdservice/vdservice.vcproj
> > +	vdservice/vdservice.vcproj \
> > +	CMakeLists.txt
> >  
> >  # see git-version-gen
> >  dist-hook:

Frediano


More information about the Spice-devel mailing list