Skip to content

Commit 8d2c5a5

Browse files
author
Alan W. Irwin
committed
Build system: Replace the NON_TRANSITIVE option with the TLL_PUBLIC option which has completely changed semantics
See README.release for further discussion of the important user-visible changes corresponding to this commit. Testing of this change for the static case with (the default) TLL_PUBLIC=OFF showed that the generator expression $<LINK_ONLY:<name-spaced library target name>> was introduced into lists of libraries that a target must be linked to (where a typical example of <name-spaced library target name> is PLPLOT::plplot). For all libraries or applications built with official language support such generator expressions work well, but in the case of the ocaml binding our rather crude custom_command/custom_target build procedure for that language has no understanding of generator expressions so that binding configuration had to be adjusted to replace $<LINK_ONLY:<name-spaced library target name>> in the list of libraries to be linked by <name-spaced library target name> and then (as before) replace <name-spaced library target name> with the real library name. Tested by: Alan W. Irwin <[email protected]> on Linux (Debian Buster = Stable) with the following steps: # Choose these prefixes to assure that the source, build, and install # trees have blanks in their pathnames (to test those cases during # this comprehensive test) COMPREHENSIVE_TEST_PREFIX="/home/software/plplot/HEAD/comprehensive_test_disposeable blank" SOURCE_PREFIX="/home/software/plplot/HEAD/plplot blank .git" # Set CMAKE_PREFIX_PATH to access local versions of lua and libLASi to # avoid important bugs in the Debian Testing versions of those # packages. Also access a local version of libqhull to test that # additional rpath possibility. # Put a local build of CMake-3.15.20190829-g3ec986c first on the PATH to thoroughly # test our build system for a locally built CMake version that includes an # essential fix so that D language support works properly for the ldc2 and dmd compilers. # For this particular test use the gdc D compiler. # Use the -DUSE_INCRTCL_VERSION_4=ON option to help CMake find Tcl/Tk # components. (This step will not be necessary as soon as the PLplot # build system is modified to make Tcl/Tk/Itcl/Itk/Iwidgets finding # more robust.) # Use -DSWIG_EXECUTABLE=/home/software/swig/install/bin/swig to test # swig-4.0.0 that I built for myself. # To save a lot of babysitting of this test, constrain the test by dropping # the interactive component. time (nice -19 env CMAKE_PREFIX_PATH=/home/software/lua/install-5.3.5:/home/software/lasi_svn/install:/home/software/qhull/install PATH=/home/software/cmake/install-3ec986ce8e/bin:"$PATH" DC=gdc "$SOURCE_PREFIX"/scripts/comprehensive_test.sh --prefix "$COMPREHENSIVE_TEST_PREFIX" --cmake_added_options "-DUSE_INCRTCL_VERSION_4=ON -DSWIG_EXECUTABLE=/home/software/swig/install/bin/swig" --build_command "make -j18" --ctest_command "ctest -j18" --do_test_interactive no) The time result on my Ryzen 7 1700 system with 16 hardware threads was real 22m27.889s user 153m50.140s sys 14m14.303s This comprehensive test ran without issues (e.g., hangs or other obvious errors) and was followed up by the evaluation procedure documented in doc/wiki_source/Testing_PLplot. That evaluation showed no configure, build, or obvious run-time errors (i.e., no non-zero return codes for any of the steps in these comprehensive tests), and the difference test results (done with the default svg device) were perfect. N.B. This good result confirmed the above commit did not introduce any regressions (at least in the noninteractive case). However, a preliminary version of this test for the ldc2 D compiler failed because (in this largely unconstrained test case) because of several different sources of leakage of some gcc C compiler and link options into D builds which fail because ldc2 (and presumable dmd as well) does not understand those options. The above test succeeded despite this leakage because gdc does understand those options. And previous tests of ldc2 and dmd worked for PLplot because the tests were constrained to just the C and D components of PLplot and the svg device, and those components do not have the leakage issue. However, there is obviously work to do to stop this leakage in all cases for unconstrained testing before we can successfully repeat the above test for the ldc2 and dmd cases.
1 parent b03b50b commit 8d2c5a5

8 files changed

Lines changed: 72 additions & 47 deletions

File tree

README.release

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ CONTENTS
3636

3737
1.1 CMake version compatibility
3838
1.2 Qt5 now the default choice
39+
1.3 Build system option NON_TRANSITIVE now replaced with the TLL_PUBLIC option which has completely changed semantics
3940

4041
2. Improvements relative to the previous release
4142

@@ -109,6 +110,31 @@ dropped with a suitable warning message.
109110

110111
N.B. we currently plan to deprecate Qt4 in our next release (5.17.0) and
111112
drop it altogether in the release after that (5.18.0).
113+
114+
1.3 Build system option NON_TRANSITIVE now replaced with the TLL_PUBLIC option which has completely changed semantics
115+
116+
The semantic differences are as follows:
117+
118+
* Opposite interpretation of the logical value so -DTLL_PUBLIC=ON is
119+
equivalent to the old -DNON_TRANSITIVE=OFF
120+
121+
* TLL_PUBLIC has a smaller scope than NON_TRANSITIVE. That is,
122+
TLL_PUBLIC is only used to control the PUBLIC or PRIVATE nature of
123+
the target_link_libraries commands used for building targets that
124+
will be installed, while NON_TRANSITIVE was used in that context as
125+
well as used to affect other components of the build system (i.e.,
126+
cmake/modules/FindLTDL.cmake and cmake/modules/pkg-config.cmake)
127+
which are now implemented depending on the CMake BUILD_SHARED_LIBS
128+
option rather than the old NON_TRANSITIVE option.
129+
130+
Another important change (non-semantic in this case) is the TLL_PUBLIC
131+
default value is OFF in all cases (to minimize leakage of flags
132+
between library targets as much as possible) while the previous
133+
default value for NON_TRANSITIVE (ON which is the equivalent of the
134+
present default OFF value for TLL_PUBLIC) was only used for the shared
135+
library non-Windows case. So this change means the default treatment
136+
of static libraries and Windows platforms is now quite different.
137+
112138
________________________________________________________________
113139

114140
2. Improvements relative to the previous release

bindings/ada/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ if(ENABLE_ada)
121121

122122
# N.B. nm evidence shows that examples that use
123123
# callbacks (e.g., plfill in x15a.adb) have unresolved references
124-
# to c_plfill, etc. that require a public link to plplot
125-
# regardless of how NON_TRANSITIVE is set.
124+
# to c_plfill, etc. that require a public link to plplot.
126125
target_link_libraries(${WRITEABLE_TARGET}plplotada PUBLIC PLPLOT::plplot)
127126

128127
install(FILES ${plplotada_SPEC_SRCS} ${plplotada_BODY_SRCS}

bindings/ocaml/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,12 @@ if(ENABLE_ocaml)
142142
list(APPEND ocaml_LIBRARIES_FLAGS ${LIBRARY_LIST})
143143
endforeach(library in LISTS library_LIST)
144144

145-
# Get rid of internal symbolic targets and symbolic Qt5 targets from the list
146145
#message(STATUS "DEBUG: (original) ocaml_LIBRARIES_FLAGS = ${ocaml_LIBRARIES_FLAGS}")
146+
# Replace $<LINK_ONLY:([^>]*)> by whatever was inside those parentheses.
147+
string(REGEX REPLACE "\\$<LINK_ONLY:([^>]*)>" "\\1" ocaml_LIBRARIES_FLAGS "${ocaml_LIBRARIES_FLAGS}")
148+
#message(STATUS "DEBUG: (\$<LINK_ONLY:...> generator expression replaced by whatever in ellipses) ocaml_LIBRARIES_FLAGS = ${ocaml_LIBRARIES_FLAGS}")
149+
150+
# Get rid of internal and Qt5 symbolic targets from the list.
147151
list(FILTER ocaml_LIBRARIES_FLAGS EXCLUDE REGEX "^PLPLOT::csirocsa$|^PLPLOT::csironn$|^PLPLOT::nistcd$|^PLPLOT::qsastime$|^Qt5::")
148152
#message(STATUS "DEBUG: (filtered) ocaml_LIBRARIES_FLAGS = ${ocaml_LIBRARIES_FLAGS}")
149153

cmake/modules/FindLTDL.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if(LTDL_INCLUDE_DIR)
4040
endif(${_lib})
4141
endmacro(_find_check_libs)
4242

43-
if(NOT NON_TRANSITIVE)
43+
if(NOT BUILD_SHARED_LIBS)
4444
# Find and check platform-dependent libraries which
4545
# libltdl depends upon using model given
4646
# for determining LIBADD_DL in $prefix/share/libtool/libltdl/acinclude.m4
@@ -75,10 +75,9 @@ if(LTDL_INCLUDE_DIR)
7575
set(LTDL_LIBRARIES ${LTDL_LIBRARIES} ${LTDL_LTDL_ADDLIB3})
7676
set(LTDL_FOUND ON)
7777
endif(LTDL_LTDL_HAVE_ADDLIB3)
78-
else(NOT NON_TRANSITIVE)
78+
else(NOT BUILD_SHARED_LIBS)
7979
set(LTDL_FOUND ON)
80-
endif(NOT NON_TRANSITIVE)
81-
80+
endif(NOT BUILD_SHARED_LIBS)
8281
endif(LTDL_LIBRARIES)
8382
endif(LTDL_INCLUDE_DIR)
8483

cmake/modules/pkg-config.cmake

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# cmake/modules/pkg-config.cmake
22
#
3-
# Copyright (C) 2006-2018 Alan W. Irwin
3+
# Copyright (C) 2006-2019 Alan W. Irwin
4+
# Copyright (C) 2007 Arjen Markus
5+
# Copyright (C) 2007-2012 Andrew Ross
6+
# Copyright (C) 2009 Hazen Babcock
7+
# Copyright (C) 2016 Raphael Kubo da Costa
48
#
59
# This file is part of PLplot.
610
#
@@ -363,20 +367,20 @@ function(pkg_config_file BINDING PC_SHORT_NAME PC_LONG_NAME PC_LIBRARY_NAME PC_C
363367
# fields.
364368
# PC_COMPILE_FLAGS - Space-delimited string of compile flags for this library.
365369
# PC_LINK_Flags - List of libraries that this library depends on. These will
366-
# be added to the public libraries for NON_TRANSITIVE OFF
367-
# and added to the private libraries for NON_TRANSITIVE ON
370+
# be added to the public libraries for BUILD_SHARED_LIBS OFF
371+
# and added to the private libraries for BUILD_SHARED_LIBS ON
368372
#
369373
# There may be one additional optional argument (accessed with ${ARGN}) containing
370374
# a list of additional libraries to be added to the public libraries regardless of
371-
# NON_TRANSITIVE value.
375+
# BUILD_SHARED_LIBS value.
372376

373377
# An example of a call of this function using these arguments is
374378
# pkg_config_file("tcl" "Tcl/Tk" "Tcl/Tk bindings, " "plplottcltk" "${libplplottcltk_COMPILE_FLAGS}" "${libplplottcltk_LINK_FLAGS}")
375379

376380
# This function depends on the following non-argument CMake variables being set.
377381
# PKG_CONFIG_EXECUTABLE
378382
# PL_DOUBLE
379-
# NON_TRANSITIVE
383+
# BUILD_SHARED_LIBS
380384
# PKG_CONFIG_DIR
381385
# These last non-argument CMake variables required for configuring
382386
# pkgcfg/plplot-template.pc.in
@@ -413,11 +417,11 @@ function(pkg_config_file BINDING PC_SHORT_NAME PC_LONG_NAME PC_LIBRARY_NAME PC_C
413417
#message(STATUS "input PC_LINK_FLAGS = ${PC_LINK_FLAGS}")
414418
pkg_config_link_flags(PC_LINK_FLAGS "${PC_LINK_FLAGS}")
415419
#message(STATUS "pkg-config form of PC_LINK_FLAGS = ${PC_LINK_FLAGS}")
416-
if(NON_TRANSITIVE)
420+
if(BUILD_SHARED_LIBS)
417421
set(PC_PRIVATE_LINK_FLAGS ${PC_LINK_FLAGS})
418-
else(NON_TRANSITIVE)
422+
else(BUILD_SHARED_LIBS)
419423
set(PC_PUBLIC_LINK_FLAGS ${PC_LINK_FLAGS})
420-
endif(NON_TRANSITIVE)
424+
endif(BUILD_SHARED_LIBS)
421425

422426
if(ARGC EQUAL 7)
423427
#message(STATUS "pkg_config_file called with ARGN = ${ARGN}")
@@ -444,17 +448,17 @@ function(pkg_config_file BINDING PC_SHORT_NAME PC_LONG_NAME PC_LIBRARY_NAME PC_C
444448
set(PC_REQUIRES "plplot")
445449
endif("X${BINDING}X" STREQUAL "XcX")
446450

447-
if(NON_TRANSITIVE)
451+
if(BUILD_SHARED_LIBS)
448452
if("X${BINDING}X" STREQUAL "XocamlX")
449453
# Don't know how to do non-transitive linking for
450454
# Ocaml binding of PLplot.
451455
set(PC_REQUIRES_TAG "Requires")
452456
else("X${BINDING}X" STREQUAL "XocamlX")
453457
set(PC_REQUIRES_TAG "Requires.private")
454458
endif("X${BINDING}X" STREQUAL "XocamlX")
455-
else(NON_TRANSITIVE)
459+
else(BUILD_SHARED_LIBS)
456460
set(PC_REQUIRES_TAG "Requires")
457-
endif(NON_TRANSITIVE)
461+
endif(BUILD_SHARED_LIBS)
458462

459463
# Include library itself in space-separated list of public libraries for
460464
# this package.

cmake/modules/plplot.cmake

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# cmake/modules/plplot.cmake
22
#
3-
# Copyright (C) 2006-2018 Alan W. Irwin
3+
# Copyright (C) 2006 Arjen Markus
4+
# Copyright (C) 2006-2009 Werner Smekal
5+
# Copyright (C) 2006-2013 Andrew Ross
6+
# Copyright (C) 2006-2019 Alan W. Irwin
7+
# Copyright (C) 2007-2010 Hazen Babcock
8+
# Copyright (C) 2009 Hezekiah M. Carty
49
#
510
# This file is part of PLplot.
611
#
@@ -52,19 +57,7 @@ if(FORCE_EXTERNAL_STATIC)
5257
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
5358
endif(FORCE_EXTERNAL_STATIC)
5459

55-
if(BUILD_SHARED_LIBS)
56-
# OFF means shared libraries (but never static libraries) are
57-
# transitively linked by default by CMake and also by pkg-config (used
58-
# to generate compile and link flags for the traditional build and
59-
# test system of the installed examples).
60-
if(WIN32_OR_CYGWIN)
61-
option(NON_TRANSITIVE "Option to use non-transitive linking" OFF)
62-
else(WIN32_OR_CYGWIN)
63-
option(NON_TRANSITIVE "Option to use non-transitive linking" ON)
64-
endif(WIN32_OR_CYGWIN)
65-
else(BUILD_SHARED_LIBS)
66-
set(NON_TRANSITIVE OFF CACHE BOOL "Option to use non-transitive linking" FORCE)
67-
endif(BUILD_SHARED_LIBS)
60+
option(TLL_PUBLIC "Option to use the target_link_libraries PUBLIC signature. Possibly useful for a linking emergency but not recommended in general because of leakage of compile and link options between libraries that can potentially occur for the PUBLIC case" OFF)
6861

6962
# Color maps (discrete and continuous) to use by default
7063
if(NOT DEFAULT_CMAP0_FILE)

cmake/modules/plplot_functions.cmake

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@ function(configure_executable_build executable executable_src tll_arguments lib_
336336
add_executable(${PROJECT_NAMESPACE}${original_executable} ALIAS ${executable})
337337

338338
if(NOT "${tll_arguments}" STREQUAL "")
339-
if(NON_TRANSITIVE)
340-
target_link_libraries(${executable} PRIVATE ${tll_arguments})
341-
else(NON_TRANSITIVE)
339+
if(TLL_PUBLIC)
342340
target_link_libraries(${executable} PUBLIC ${tll_arguments})
343-
endif(NON_TRANSITIVE)
341+
else(TLL_PUBLIC)
342+
target_link_libraries(${executable} PRIVATE ${tll_arguments})
343+
endif(TLL_PUBLIC)
344344
endif(NOT "${tll_arguments}" STREQUAL "")
345345

346346
if(BUILD_SHARED_LIBS)
@@ -432,7 +432,7 @@ function(configure_library_build library library_type library_src tll_arguments
432432

433433
# Global variables which must be defined
434434
#message(STATUS "DEBUG: BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}")
435-
#message(STATUS "DEBUG: NON_TRANSITIVE = ${NON_TRANSITIVE}")
435+
#message(STATUS "DEBUG: TLL_PUBLIC = ${TLL_PUBLIC}")
436436
#message(STATUS "DEBUG: ${library}_SOVERSION = ${${library}_SOVERSION}")
437437
#message(STATUS "DEBUG: ${library}_VERSION = ${${library}_VERSION}")
438438
#message(STATUS "DEBUG: CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}")
@@ -477,7 +477,7 @@ function(configure_library_build library library_type library_src tll_arguments
477477
# above have been DEFINED.
478478
set(variables_list)
479479
list(APPEND variables_list
480-
NON_TRANSITIVE
480+
TLL_PUBLIC
481481
)
482482

483483
set(original_library ${library})
@@ -510,11 +510,11 @@ function(configure_library_build library library_type library_src tll_arguments
510510
add_library(${PROJECT_NAMESPACE}${SWIG_MODULE_${library}_UNPREFIXED_REAL_NAME} ALIAS ${SWIG_MODULE_${library}_REAL_NAME})
511511

512512
if(NOT "${tll_arguments}" STREQUAL "")
513-
if(NON_TRANSITIVE)
514-
target_link_libraries(${SWIG_MODULE_${library}_REAL_NAME} PRIVATE ${tll_arguments})
515-
else(NON_TRANSITIVE)
513+
if(TLL_PUBLIC)
516514
target_link_libraries(${SWIG_MODULE_${library}_REAL_NAME} PUBLIC ${tll_arguments})
517-
endif(NON_TRANSITIVE)
515+
else(TLL_PUBLIC)
516+
target_link_libraries(${SWIG_MODULE_${library}_REAL_NAME} PRIVATE ${tll_arguments})
517+
endif(TLL_PUBLIC)
518518
endif(NOT "${tll_arguments}" STREQUAL "")
519519

520520
set_target_properties(
@@ -580,11 +580,11 @@ function(configure_library_build library library_type library_src tll_arguments
580580
add_library(${PROJECT_NAMESPACE}${original_library} ALIAS ${library})
581581

582582
if(NOT "${tll_arguments}" STREQUAL "")
583-
if(NON_TRANSITIVE)
584-
target_link_libraries(${library} PRIVATE ${tll_arguments})
585-
else(NON_TRANSITIVE)
583+
if(TLL_PUBLIC)
586584
target_link_libraries(${library} PUBLIC ${tll_arguments})
587-
endif(NON_TRANSITIVE)
585+
else(TLL_PUBLIC)
586+
target_link_libraries(${library} PRIVATE ${tll_arguments})
587+
endif(TLL_PUBLIC)
588588
endif(NOT "${tll_arguments}" STREQUAL "")
589589

590590
# Set library target properties

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ if(CORE_BUILD)
202202
# Note that the results configured in the Requires,
203203
# Requires.private, Libs, and Libs.private lines of the PLplot *.pc
204204
# files used in our traditional build of the installed examples
205-
# depend on whether NON_TRANSITIVE is ON or OFF.
205+
# depend on whether libraries are built shared or static.
206206
if(BUILD_SHARED_LIBS)
207207
# pkg-config will not use the --static pkg-config option for the
208208
# traditional installed examples build, i.e., the configured

0 commit comments

Comments
 (0)