From: <ai...@us...> - 2011-11-24 23:41:38
|
Revision: 12042 http://plplot.svn.sourceforge.net/plplot/?rev=12042&view=rev Author: airwin Date: 2011-11-24 23:41:32 +0000 (Thu, 24 Nov 2011) Log Message: ----------- Confirmed that the experimental plplotdmd_SHARED option (which builds the libplplotdmdd library for the D bindings as shared) does not work for Debian stable. The reason is the linker includes a static D library that is not built with the -fPIC flag so cannot be linked to a shared version of libplplotdmdd. Set the plplotdmd_SHARED option globally. Configure the traditional Makefile for the installed examples to use the pkg-config --static flag when appropriate (e.g., for the default plplotdmd_SHARED OFF case). In anticipation that plplotdmd_SHARED will work some day, implement non-transitive linking of libplplotdmd. However, this is a no-op for the current default plplotdmd_SHARED OFF case where libplplotdmd is built statically so the build-tree and traditional installed examples tree D examples have many unused direct dependencies as a result. These changes have been built and run-time tested for the build tree and traditional installed examples tree. The only way to test whether these changes suppress unnecessary linking is (i) find a platform where -Dplplotdmd_SHARED=ON works, and (ii) on that platform try -DNON_TRANSITIVE=ON for both the build tree and the traditional installed examples tree. Modified Paths: -------------- trunk/bindings/d/CMakeLists.txt trunk/cmake/modules/d.cmake trunk/examples/d/CMakeLists.txt trunk/examples/d/Makefile.examples.in Modified: trunk/bindings/d/CMakeLists.txt =================================================================== --- trunk/bindings/d/CMakeLists.txt 2011-11-24 21:33:53 UTC (rev 12041) +++ trunk/bindings/d/CMakeLists.txt 2011-11-24 23:41:32 UTC (rev 12042) @@ -30,11 +30,13 @@ plplot.d ) # Set this option to OFF by default since the STATIC library is - # the only one that seems to work for now on Debian Lenny and + # the only one that seems to work for now on Debian Squeeze and # potentially other Linux systems. option(plplotdmd_SHARED "Treat libplplotdmd as a shared library" OFF) if(plplotdmd_SHARED) + # pkg-config does not use --static option for d examples build. + set(PC_STATIC_OPTION_D) add_library(plplotdmd${LIB_TAG} ${plplotdmd${LIB_TAG}_LIB_SRCS}) if(BUILD_SHARED_LIBS) @@ -62,10 +64,23 @@ ) endif(USE_RPATH) else(plplotdmd_SHARED) + # pkg-config uses --static option for d examples build. + set(PC_STATIC_OPTION_D "--static") add_library(plplotdmd${LIB_TAG} STATIC ${plplotdmd${LIB_TAG}_LIB_SRCS}) target_link_libraries(plplotdmd${LIB_TAG} plplot${LIB_TAG}) endif(plplotdmd_SHARED) + if(NON_TRANSITIVE) + # empty list ==> non-transitive linking for everything that links to + # libplplotadad in the shared libraries case. + target_link_libraries(plplotdmd${LIB_TAG} LINK_INTERFACE_LIBRARIES) + # This configures the pkg-config method to use non-transitive linking. + set(PC_REQUIRES_TAG "Requires.private") + else(NON_TRANSITIVE) + # This configures the pkg-config method to use transitive linking + set(PC_REQUIRES_TAG "Requires") + endif(NON_TRANSITIVE) + install(TARGETS plplotdmd${LIB_TAG} EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} Modified: trunk/cmake/modules/d.cmake =================================================================== --- trunk/cmake/modules/d.cmake 2011-11-24 21:33:53 UTC (rev 12041) +++ trunk/cmake/modules/d.cmake 2011-11-24 23:41:32 UTC (rev 12042) @@ -46,3 +46,10 @@ endif(NOT CMAKE_D_COMPILER_WORKS) endif(ENABLE_d) +if(ENABLE_d) + # Set this option to OFF by default since the STATIC library is + # the only one that seems to work for now on Debian Squeeze and + # potentially other Linux systems. + option(plplotdmd_SHARED "Treat libplplotdmd as a shared library" OFF) +endif(ENABLE_d) + Modified: trunk/examples/d/CMakeLists.txt =================================================================== --- trunk/examples/d/CMakeLists.txt 2011-11-24 21:33:53 UTC (rev 12041) +++ trunk/examples/d/CMakeLists.txt 2011-11-24 23:41:32 UTC (rev 12042) @@ -71,6 +71,21 @@ ) set(DC ${CMAKE_D_COMPILER}) + + if(NON_TRANSITIVE) + if(plplotdmd_SHARED AND BUILD_SHARED_LIBS) + # pkg-config does not use --static option for d examples build. + set(PC_STATIC_OPTION_D) + else(plplotdmd_SHARED AND BUILD_SHARED_LIBS) + # pkg-config uses --static option for d examples build. + set(PC_STATIC_OPTION_D "--static") + endif(plplotdmd_SHARED AND BUILD_SHARED_LIBS) + else(NON_TRANSITIVE) + # pkg-config never uses the --static option for the d examples build + # for the transitive case. + set(PC_STATIC_OPTION_D) + endif(NON_TRANSITIVE) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples Modified: trunk/examples/d/Makefile.examples.in =================================================================== --- trunk/examples/d/Makefile.examples.in 2011-11-24 21:33:53 UTC (rev 12041) +++ trunk/examples/d/Makefile.examples.in 2011-11-24 23:41:32 UTC (rev 12042) @@ -66,6 +66,6 @@ rm -f $(EXECUTABLES_list) .d$(EXEEXT): -@pkg_config_true@ $(DC) $< -o $@ $(RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config --cflags --libs plplot$(LIB_TAG)-d` +@pkg_config_true@ $(DC) $< -o $@ $(RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION_D@ --cflags --libs plplot$(LIB_TAG)-d` .SUFFIXES: .d $(EXEEXT) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |