Yuck!  I am really averse to setting flags specific to building vnc.so
when most people won't be building it.  I'm not sure if I understand how
the new system differs from the old in this respect.  Didn't you have to
specify --with-pic to get PIC code under autotools?  Can't we do the
same thing here and add a WITH_PIC CMake variable?

I asked Martin for information on how he was building the module so I
could reproduce it and come up with a solution, but I never heard anything.

I think that, at minimum, this needs to be turned into a macro.
However, honestly, I would rather that PIC code be specified as part of
a build procedure, not automatically and silently added to the CFLAGS.


On 8/22/11 6:38 AM, ossm...@users.sourceforge.net wrote:
> Revision: 4645
>           http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4645&view=rev
> Author:   ossman_
> Date:     2011-08-22 11:38:35 +0000 (Mon, 22 Aug 2011)
> 
> Log Message:
> -----------
> CMake doesn't handle convenience libraries as nicely as autotools does. We
> need to be explicit with -fPIC here as we use these in libvnc.so.
> 
> Modified Paths:
> --------------
>     trunk/common/Xregion/CMakeLists.txt
>     trunk/common/network/CMakeLists.txt
>     trunk/common/os/CMakeLists.txt
>     trunk/common/rdr/CMakeLists.txt
>     trunk/common/rfb/CMakeLists.txt
>     trunk/common/zlib/CMakeLists.txt
> 
> Modified: trunk/common/Xregion/CMakeLists.txt
> ===================================================================
> --- trunk/common/Xregion/CMakeLists.txt       2011-08-19 16:41:06 UTC (rev 
> 4644)
> +++ trunk/common/Xregion/CMakeLists.txt       2011-08-22 11:38:35 UTC (rev 
> 4645)
> @@ -1,6 +1,14 @@
>  add_library(Xregion STATIC
>    Region.c)
>  
> +# This code goes into libvnc.so, so it needs to be PIC on x86_64.
> +# (It should be on archs as well, but we prefer performance over memory
> +# efficiency. Win64 is excluded because PIC is always on there and it
> +# complains when you give it the explicit flag.)
> +if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT 
> WIN32)
> +  set_target_properties(Xregion PROPERTIES COMPILE_FLAGS -fPIC)
> +endif()
> +
>  if(UNIX)
>    libtool_create_control_file(Xregion)
>  endif()
> 
> Modified: trunk/common/network/CMakeLists.txt
> ===================================================================
> --- trunk/common/network/CMakeLists.txt       2011-08-19 16:41:06 UTC (rev 
> 4644)
> +++ trunk/common/network/CMakeLists.txt       2011-08-22 11:38:35 UTC (rev 
> 4645)
> @@ -3,6 +3,14 @@
>  add_library(network STATIC
>    TcpSocket.cxx)
>  
> +# This code goes into libvnc.so, so it needs to be PIC on x86_64.
> +# (It should be on archs as well, but we prefer performance over memory
> +# efficiency. Win64 is excluded because PIC is always on there and it
> +# complains when you give it the explicit flag.)
> +if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT 
> WIN32)
> +  set_target_properties(network PROPERTIES COMPILE_FLAGS -fPIC)
> +endif()
> +
>  if(UNIX)
>    libtool_create_control_file(network)
>  endif()
> 
> Modified: trunk/common/os/CMakeLists.txt
> ===================================================================
> --- trunk/common/os/CMakeLists.txt    2011-08-19 16:41:06 UTC (rev 4644)
> +++ trunk/common/os/CMakeLists.txt    2011-08-22 11:38:35 UTC (rev 4645)
> @@ -5,3 +5,11 @@
>    net.c
>    os.cxx
>    tls.cxx)
> +
> +# This code goes into libvnc.so, so it needs to be PIC on x86_64.
> +# (It should be on archs as well, but we prefer performance over memory
> +# efficiency. Win64 is excluded because PIC is always on there and it
> +# complains when you give it the explicit flag.)
> +if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT 
> WIN32)
> +  set_target_properties(os PROPERTIES COMPILE_FLAGS -fPIC)
> +endif()
> 
> Modified: trunk/common/rdr/CMakeLists.txt
> ===================================================================
> --- trunk/common/rdr/CMakeLists.txt   2011-08-19 16:41:06 UTC (rev 4644)
> +++ trunk/common/rdr/CMakeLists.txt   2011-08-22 11:38:35 UTC (rev 4645)
> @@ -24,6 +24,14 @@
>  
>  target_link_libraries(rdr ${RDR_LIBRARIES})
>  
> +# This code goes into libvnc.so, so it needs to be PIC on x86_64.
> +# (It should be on archs as well, but we prefer performance over memory
> +# efficiency. Win64 is excluded because PIC is always on there and it
> +# complains when you give it the explicit flag.)
> +if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT 
> WIN32)
> +  set_target_properties(rdr PROPERTIES COMPILE_FLAGS -fPIC)
> +endif()
> +
>  if(UNIX)
>    libtool_create_control_file(rdr)
>  endif()
> 
> Modified: trunk/common/rfb/CMakeLists.txt
> ===================================================================
> --- trunk/common/rfb/CMakeLists.txt   2011-08-19 16:41:06 UTC (rev 4644)
> +++ trunk/common/rfb/CMakeLists.txt   2011-08-22 11:38:35 UTC (rev 4645)
> @@ -95,6 +95,14 @@
>  
>  target_link_libraries(rfb ${RFB_LIBRARIES})
>  
> +# This code goes into libvnc.so, so it needs to be PIC on x86_64.
> +# (It should be on archs as well, but we prefer performance over memory
> +# efficiency. Win64 is excluded because PIC is always on there and it
> +# complains when you give it the explicit flag.)
> +if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT 
> WIN32)
> +  set_target_properties(rfb PROPERTIES COMPILE_FLAGS -fPIC)
> +endif()
> +
>  if(UNIX)
>    libtool_create_control_file(rfb)
>  endif()
> 
> Modified: trunk/common/zlib/CMakeLists.txt
> ===================================================================
> --- trunk/common/zlib/CMakeLists.txt  2011-08-19 16:41:06 UTC (rev 4644)
> +++ trunk/common/zlib/CMakeLists.txt  2011-08-22 11:38:35 UTC (rev 4645)
> @@ -20,3 +20,11 @@
>    trees.c
>    uncompr.c
>    zutil.c)
> +
> +# This code goes into libvnc.so, so it needs to be PIC on x86_64.
> +# (It should be on other archs as well, but we prefer performance over memory
> +# efficiency. Win64 is excluded because PIC is always on there and it
> +# complains when you give it the explicit flag.)
> +if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_SIZEOF_VOID_P MATCHES 8) AND NOT 
> WIN32)
> +  set_target_properties(zlib PROPERTIES COMPILE_FLAGS -fPIC)
> +endif()
> 
> 
> This was sent by the SourceForge.net collaborative development platform, the 
> world's largest Open Source development site.
> 
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model 
> configuration take the hassle out of deploying and managing Subversion and 
> the tools developers use with it. Learn more about uberSVN and get a free 
> download at:  http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> Tigervnc-commits mailing list
> tigervnc-comm...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to