From: <ai...@us...> - 2013-11-19 04:07:26
|
Revision: 12718 http://sourceforge.net/p/plplot/code/12718 Author: airwin Date: 2013-11-19 04:07:23 +0000 (Tue, 19 Nov 2013) Log Message: ----------- Create a new library called plplottcltk_Main whose source code is bindings/tcl/tclMain.c and bindings/tk/tkMain.c. Both of those files contain code that should not be part of plplottcltk since such code destroys the possibility of treating plplottcktk as a pure Tcl/Tk extension which can depend on the stub versions of the Tcl/Tk libraries. This new library is helpful when starting C applications (pltcl, plserver, xtk01, xtk02, and xtk04) which depend on the plplottcltk library so use it to link those applications. Tested by Alan W. Irwin <ai...@us...> on Linux using the -DENABLE_tcl=ON, -DENABLE_itcl=ON, -DENABLE_tk=ON, -DENABLE_itk=ON, and -DUSE_TCL_TK_STUBS=ON CMake options using the test_noninteractive, test_interactive, and test_wish_standard_examples target in the build tree. All was well other than the known issue that the latter target still has a segfault at the end that occurs on execution of the Tcl exit command. These good test results mean there is only one more thing that needs to be done before we can make -DUSE_TCL_TK_STUBS=ON the default; make build-system changes so the tkwin "device" (the shared object that needs to be built so that "package require Plplotter" will work) will build and work properly for the -DUSE_TCL_TK_STUBS=ON case. Modified Paths: -------------- trunk/bindings/tcl/CMakeLists.txt trunk/bindings/tk/CMakeLists.txt trunk/cmake/modules/plplot_version.cmake trunk/examples/tk/CMakeLists.txt trunk/utils/CMakeLists.txt Modified: trunk/bindings/tcl/CMakeLists.txt =================================================================== --- trunk/bindings/tcl/CMakeLists.txt 2013-11-18 22:52:41 UTC (rev 12717) +++ trunk/bindings/tcl/CMakeLists.txt 2013-11-19 04:07:23 UTC (rev 12718) @@ -57,21 +57,18 @@ ) if(BUILD_SHARED_LIBS) - SET_SOURCE_FILES_PROPERTIES(${tclmatrix${LIB_TAG}_LIB_SRCS} + set_source_files_properties(${tclmatrix${LIB_TAG}_LIB_SRCS} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(BUILD_SHARED_LIBS) - if(USE_TCL_TK_STUBS) - set_source_files_properties( - ${tclmatrix${LIB_TAG}_LIB_SRCS} - PROPERTIES COMPILE_DEFINITIONS USE_TCL_STUBS - ) - endif(USE_TCL_TK_STUBS) - add_library(tclmatrix${LIB_TAG} ${tclmatrix${LIB_TAG}_LIB_SRCS}) if(USE_TCL_TK_STUBS) target_link_libraries(tclmatrix${LIB_TAG} ${TCL_STUB_LIBRARY}) + set_target_properties( + tclmatrix${LIB_TAG} + PROPERTIES COMPILE_DEFINITIONS USE_TCL_STUBS + ) else(USE_TCL_TK_STUBS) target_link_libraries(tclmatrix${LIB_TAG} ${TCL_LIBRARY}) endif(USE_TCL_TK_STUBS) @@ -137,12 +134,19 @@ set(plplottcltk${LIB_TAG}_LIB_SRCS tclAPI.c - #tclMain.c ) + + set(plplottcltk_Main${LIB_TAG}_LIB_SRCS + tclMain.c + ) + if(BUILD_SHARED_LIBS) set_source_files_properties(${plplottcltk${LIB_TAG}_LIB_SRCS} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) + set_source_files_properties(${plplottcltk_Main${LIB_TAG}_LIB_SRCS} + PROPERTIES COMPILE_FLAGS "-DUSINGDLL" + ) endif(BUILD_SHARED_LIBS) if(USE_TCL_TK_STUBS) @@ -171,6 +175,16 @@ ) endif(USE_TCL_TK_STUBS) + set( + plplottcltk_Main${LIB_TAG}_link_libraries + plplot${LIB_TAG} + ${TCL_LIBRARY} + ) + set( + libplplottcltk_Main${LIB_TAG}_LINK_FLAGS + ${TCL_LIBRARY} + ) + if(ENABLE_itcl) include_directories(${ITCL_INCLUDE_PATH}) set( @@ -186,6 +200,20 @@ ${libplplottcltk${LIB_TAG}_LINK_FLAGS} ${ITCL_LIBRARY} ) + + set( + libplplottcltk_Main${LIB_TAG}_COMPILE_FLAGS + "${libplplottcltk_Main${LIB_TAG}_COMPILE_FLAGS} -I${ITCL_INCLUDE_PATH}" + ) + set(plplottcltk_Main${LIB_TAG}_link_libraries + ${plplottcltk_Main${LIB_TAG}_link_libraries} + ${ITCL_LIBRARY} + ) + set( + libplplottcltk_Main${LIB_TAG}_LINK_FLAGS + ${libplplottcltk_Main${LIB_TAG}_LINK_FLAGS} + ${ITCL_LIBRARY} + ) endif(ENABLE_itcl) if(ENABLE_tk) @@ -195,8 +223,13 @@ ${CMAKE_SOURCE_DIR}/bindings/tk/plframe.c ${CMAKE_SOURCE_DIR}/bindings/tk/plr.c ${CMAKE_SOURCE_DIR}/bindings/tk/tcpip.c + ) + + set(plplottcltk_Main${LIB_TAG}_LIB_SRCS + ${plplottcltk_Main${LIB_TAG}_LIB_SRCS} ${CMAKE_SOURCE_DIR}/bindings/tk/tkMain.c ) + include_directories(${TK_INCLUDE_PATH}) # Transform TK_INCLUDE_PATH (which is a list) to blank-delimited flag form. string(REGEX REPLACE ";" " -I" TKLIB_COMPILE_FLAGS "-I${TK_INCLUDE_PATH}") @@ -204,21 +237,56 @@ libplplottcltk${LIB_TAG}_COMPILE_FLAGS "${libplplottcltk${LIB_TAG}_COMPILE_FLAGS} ${TKLIB_COMPILE_FLAGS}" ) + + set( + libplplottcltk_Main${LIB_TAG}_COMPILE_FLAGS + "${libplplottcltk_Main${LIB_TAG}_COMPILE_FLAGS} ${TKLIB_COMPILE_FLAGS}" + ) + if(BUILD_SHARED_LIBS) set_source_files_properties(${plplottcltk${LIB_TAG}_LIB_SRCS} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) + set_source_files_properties(${plplottcltk_Main${LIB_TAG}_LIB_SRCS} + PROPERTIES COMPILE_FLAGS "-DUSINGDLL" + ) endif(BUILD_SHARED_LIBS) - set(plplottcltk${LIB_TAG}_link_libraries - ${plplottcltk${LIB_TAG}_link_libraries} + + if(USE_TCL_TK_STUBS) + set(plplottcltk${LIB_TAG}_link_libraries + ${plplottcltk${LIB_TAG}_link_libraries} + ${TK_STUB_LIBRARY} + ${X11_X11_LIB} + ) + set( + libplplottcltk${LIB_TAG}_LINK_FLAGS + ${libplplottcltk${LIB_TAG}_LINK_FLAGS} + ${TK_STUB_LIBRARY} + ) + else(USE_TCL_TK_STUBS) + set(plplottcltk${LIB_TAG}_link_libraries + ${plplottcltk${LIB_TAG}_link_libraries} + ${TK_LIBRARY} + ${X11_X11_LIB} + ) + set( + libplplottcltk${LIB_TAG}_LINK_FLAGS + ${libplplottcltk${LIB_TAG}_LINK_FLAGS} + ${TK_LIBRARY} + ) + endif(USE_TCL_TK_STUBS) + + set(plplottcltk_Main${LIB_TAG}_link_libraries + ${plplottcltk_Main${LIB_TAG}_link_libraries} ${TK_LIBRARY} ${X11_X11_LIB} ) set( - libplplottcltk${LIB_TAG}_LINK_FLAGS - ${libplplottcltk${LIB_TAG}_LINK_FLAGS} + libplplottcltk_Main${LIB_TAG}_LINK_FLAGS + ${libplplottcltk_Main${LIB_TAG}_LINK_FLAGS} ${TK_LIBRARY} ) + if(ENABLE_itk) include_directories(${ITK_INCLUDE_PATH}) set( @@ -234,6 +302,20 @@ ${libplplottcltk${LIB_TAG}_LINK_FLAGS} ${ITK_LIBRARY} ) + + set( + libplplottcltk_Main${LIB_TAG}_COMPILE_FLAGS + "${libplplottcltk_Main${LIB_TAG}_COMPILE_FLAGS} -I${ITK_INCLUDE_PATH}" + ) + set(plplottcltk_Main${LIB_TAG}_link_libraries + ${plplottcltk_Main${LIB_TAG}_link_libraries} + ${ITK_LIBRARY} + ) + set( + libplplottcltk_Main${LIB_TAG}_LINK_FLAGS + ${libplplottcltk_Main${LIB_TAG}_LINK_FLAGS} + ${ITK_LIBRARY} + ) endif(ENABLE_itk) endif(ENABLE_tk) @@ -244,20 +326,34 @@ "${libplplottcltk${LIB_TAG}_LINK_FLAGS}" ) + pkg_config_link_flags( + libplplottcltk_Main${LIB_TAG}_LINK_FLAGS + "${libplplottcltk_Main${LIB_TAG}_LINK_FLAGS}" + ) + + add_library(plplottcltk${LIB_TAG} ${plplottcltk${LIB_TAG}_LIB_SRCS}) + add_library(plplottcltk_Main${LIB_TAG} ${plplottcltk_Main${LIB_TAG}_LIB_SRCS}) + if(USE_TCL_TK_STUBS) - set_source_files_properties( - ${plplottcltk${LIB_TAG}_LIB_SRCS} - PROPERTIES COMPILE_DEFINITIONS USE_TCL_STUBS - ) + if(ENABLE_tk) + set_target_properties( + plplottcltk${LIB_TAG} + PROPERTIES COMPILE_DEFINITIONS "USE_TCL_STUBS;USE_TK_STUBS" + ) + else(ENABLE_tk) + set_target_properties( + plplottcltk${LIB_TAG} + PROPERTIES COMPILE_DEFINITIONS USE_TCL_STUBS + ) + endif(ENABLE_tk) endif(USE_TCL_TK_STUBS) - add_library(plplottcltk${LIB_TAG} ${plplottcltk${LIB_TAG}_LIB_SRCS}) - if(NON_TRANSITIVE) # empty list ==> non-transitive linking for everything that links to # libtclmatrixd and libplplottcltkd in the shared libraries case. target_link_libraries(tclmatrix${LIB_TAG} LINK_INTERFACE_LIBRARIES) target_link_libraries(plplottcltk${LIB_TAG} LINK_INTERFACE_LIBRARIES) + target_link_libraries(plplottcltk_Main${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) @@ -274,6 +370,11 @@ ${plplottcltk${LIB_TAG}_link_libraries} ) + target_link_libraries( + plplottcltk_Main${LIB_TAG} + ${plplottcltk_Main${LIB_TAG}_link_libraries} + ) + if(USE_RPATH) get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH) set_target_properties(plplottcltk${LIB_TAG} @@ -283,6 +384,14 @@ INSTALL_RPATH "${LIB_INSTALL_RPATH}" INSTALL_NAME_DIR "${LIB_DIR}" ) + + set_target_properties(plplottcltk_Main${LIB_TAG} + PROPERTIES + SOVERSION ${plplottcltk_Main_SOVERSION} + VERSION ${plplottcltk_Main_VERSION} + INSTALL_RPATH "${LIB_INSTALL_RPATH}" + INSTALL_NAME_DIR "${LIB_DIR}" + ) else(USE_RPATH) set_target_properties(plplottcltk${LIB_TAG} PROPERTIES @@ -290,6 +399,14 @@ VERSION ${plplottcltk_VERSION} INSTALL_NAME_DIR "${LIB_DIR}" ) + + set_target_properties(plplottcltk_Main${LIB_TAG} + PROPERTIES + SOVERSION ${plplottcltk_Main_SOVERSION} + VERSION ${plplottcltk_Main_VERSION} + INSTALL_NAME_DIR "${LIB_DIR}" + ) + endif(USE_RPATH) install(TARGETS plplottcltk${LIB_TAG} @@ -299,6 +416,13 @@ RUNTIME DESTINATION ${BIN_DIR} ) + install(TARGETS plplottcltk_Main${LIB_TAG} + EXPORT export_plplot + ARCHIVE DESTINATION ${LIB_DIR} + LIBRARY DESTINATION ${LIB_DIR} + RUNTIME DESTINATION ${BIN_DIR} + ) + set(plplottcltk${LIB_TAG}_INSTALLED_HEADERS pltcl.h ) @@ -439,5 +563,29 @@ @ONLY ) install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR}) + + set(PC_DATA "tcl:Tcl/Tk:Tcl/Tk bindings, :plplottcltk_Main${LIB_TAG}") + + string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA}) + set(PC_FILE_SUFFIX "-${BINDING}") + set(PC_REQUIRES "plplot${LIB_TAG}") + string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" PC_SHORT_NAME ${PC_DATA}) + string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" PC_LONG_NAME ${PC_DATA}) + string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" PC_LIBRARY_NAME ${PC_DATA}) + set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}") + set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}") + if(NON_TRANSITIVE) + set(PC_LINK_FLAGS "-lplplot${LIB_TAG} ${PC_LINK_FLAGS}") + endif(NON_TRANSITIVE) + set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}") + set(PC_CONFIGURED_FILE + ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc + ) + configure_file( + ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.in + ${PC_CONFIGURED_FILE} + @ONLY + ) + install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR}) endif(PKG_CONFIG_EXECUTABLE) endif(ENABLE_tcl) Modified: trunk/bindings/tk/CMakeLists.txt =================================================================== --- trunk/bindings/tk/CMakeLists.txt 2013-11-18 22:52:41 UTC (rev 12717) +++ trunk/bindings/tk/CMakeLists.txt 2013-11-19 04:07:23 UTC (rev 12718) @@ -103,7 +103,7 @@ endif(BUILD_SHARED_LIBS) add_executable(plserver plserver.c) - target_link_libraries(plserver plplot${LIB_TAG} plplottcltk${LIB_TAG} ${TK_LIBRARY} ${TCL_LIBRARY}) + target_link_libraries(plserver plplot${LIB_TAG} plplottcltk_Main${LIB_TAG} plplottcltk${LIB_TAG} ${TK_LIBRARY} ${TCL_LIBRARY}) if(USE_RPATH) get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH) Modified: trunk/cmake/modules/plplot_version.cmake =================================================================== --- trunk/cmake/modules/plplot_version.cmake 2013-11-18 22:52:41 UTC (rev 12717) +++ trunk/cmake/modules/plplot_version.cmake 2013-11-19 04:07:23 UTC (rev 12718) @@ -67,6 +67,9 @@ set(plplottcltk_SOVERSION 10) set(plplottcltk_VERSION ${plplottcltk_SOVERSION}.0.0) +set(plplottcltk_Main_SOVERSION 0) +set(plplottcltk_Main_VERSION ${plplottcltk_Main_SOVERSION}.0.0) + set(plplotwxwidgets_SOVERSION 0) set(plplotwxwidgets_VERSION ${plplotwxwidgets_SOVERSION}.0.0) Modified: trunk/examples/tk/CMakeLists.txt =================================================================== --- trunk/examples/tk/CMakeLists.txt 2013-11-18 22:52:41 UTC (rev 12717) +++ trunk/examples/tk/CMakeLists.txt 2013-11-19 04:07:23 UTC (rev 12718) @@ -174,7 +174,7 @@ set_source_files_properties(${TK_SRC_FILE} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(BUILD_SHARED_LIBS AND CORE_BUILD) - target_link_libraries(${TK_EXE} plplottcltk${LIB_TAG} tclmatrix${LIB_TAG} plplot${LIB_TAG} ${TK_LIBRARY} ${TCL_LIBRARY} ${MATH_LIB}) + target_link_libraries(${TK_EXE} plplottcltk_Main${LIB_TAG} plplottcltk${LIB_TAG} tclmatrix${LIB_TAG} plplot${LIB_TAG} ${TK_LIBRARY} ${TCL_LIBRARY} ${MATH_LIB}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk ${TK_EXE}) endforeach(TK_SRC_FILE ${tk_SRC}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk tclIndex_examples_tk) Modified: trunk/utils/CMakeLists.txt =================================================================== --- trunk/utils/CMakeLists.txt 2013-11-18 22:52:41 UTC (rev 12717) +++ trunk/utils/CMakeLists.txt 2013-11-19 04:07:23 UTC (rev 12718) @@ -78,9 +78,9 @@ include_directories(${ITCL_INCLUDE_PATH}) endif(HAVE_ITCL) - add_executable(pltcl pltcl.c ${CMAKE_SOURCE_DIR}/bindings/tcl/tclMain.c) + add_executable(pltcl pltcl.c) - target_link_libraries(pltcl plplot${LIB_TAG} plplottcltk${LIB_TAG} ${ITCL_LIBRARY} ${TCL_LIBRARY}) + target_link_libraries(pltcl plplot${LIB_TAG} plplottcltk_Main${LIB_TAG} plplottcltk${LIB_TAG} ${ITCL_LIBRARY} ${TCL_LIBRARY}) if(USE_RPATH) set_target_properties(pltcl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |