Output complete list of libraries for external Makefiles

There is a Makefile include, `vtkm_config.mk`, and a package include,
`vtkm.pc`, that are configured so that external programs that do not use
CMake have a way of importing VTK-m's configuration. However, the set of
libraries was hardcoded. In particular, many of the new filter libraries
were missing.

Rather than try to maintain this list manually, use the module mechanism
in the CMake configuration to get a list of libraries built and
automatically build these lists.
This commit is contained in:
Kenneth Moreland 2022-10-26 16:28:55 -06:00
parent d87316fbf1
commit 73cb38d860
4 changed files with 40 additions and 22 deletions

@ -330,6 +330,33 @@ write_basic_package_version_file(
VERSION ${VTKm_VERSION}
COMPATIBILITY ExactVersion )
#-----------------------------------------------------------------------------
# Create makefile/package files for projects not using CMake
set(lib_args)
vtkm_module_get_list(module_list)
list(REVERSE module_list)
foreach(module IN LISTS module_list)
get_target_property(type ${module} TYPE)
if (NOT type MATCHES "LIBRARY" OR type STREQUAL "INTERFACE_LIBRARY")
continue()
endif()
get_target_property(library ${module} OUTPUT_NAME)
if (NOT library)
continue()
endif()
set(lib_args "${lib_args} \\
-l${library}")
endforeach()
if (TARGET vtkmdiympi)
set(lib_args "${lib_args} \\
-lvtkmdiympi")
endif()
if (TARGET vtkmdiympi_nompi)
set(lib_args "${lib_args} \\
-lvtkmdiympi_nompi")
endif()
configure_file(${VTKm_SOURCE_DIR}/config/vtkm_config.mk.in
${VTKm_BINARY_DIR}/config/vtkm_config.mk @ONLY)
install(FILES ${VTKm_BINARY_DIR}/config/vtkm_config.mk

@ -18,14 +18,4 @@ Name: VTKm
Description: The VTKm library
Version: @VTKm_VERSION@
Cflags: -I${includedir}/vtkm-@CMAKE_INSTALL_PREFIX@
Libs: -L${libdir} \
-lvtkm_rendering-@VTKm_VERSION@ \
-lvtkm_filter_contour-@VTKm_VERSION@ \
-lvtkm_filter_gradient-@VTKm_VERSION@ \
-lvtkm_filter_extra-@VTKm_VERSION@ \
-lvtkm_filter_common-@VTKm_VERSION@ \
-lvtkm_worklet-@VTKm_VERSION@ \
-lvtkm_source-@VTKm_VERSION@ \
-lvtkm_io-@VTKm_VERSION@ \
-lvtkm_cont-@VTKm_VERSION@ \
-lvtkmdiympi_nompi
Libs: -L${libdir}@lib_args@

@ -25,14 +25,4 @@ VTKm_ENABLE_EGL_CONTEXT = @VTKm_ENABLE_EGL_CONTEXT@
VTKm_ENABLE_MPI = @VTKm_ENABLE_MPI@
VTKm_INCLUDE_FLAGS = -I $(VTKm_DIR)/include
VTKm_LIB_FLAGS = -L $(VTKm_DIR)/lib \
-lvtkm_rendering-$(VTKM_VERSION) \
-lvtkm_filter_contour-$(VTKM_VERSION) \
-lvtkm_filter_gradient-$(VTKM_VERSION) \
-lvtkm_filter_extra-$(VTKM_VERSION) \
-lvtkm_filter_common-$(VTKM_VERSION) \
-lvtkm_worklet-$(VTKM_VERSION) \
-lvtkm_source-$(VTKM_VERSION) \
-lvtkm_io-$(VTKM_VERSION) \
-lvtkm_cont-$(VTKM_VERSION) \
-lvtkmdiympi_nompi
VTKm_LIB_FLAGS = -L $(VTKm_DIR)/lib@lib_args@

@ -0,0 +1,11 @@
# Output complete list of libraries for external Makefiles
There is a Makefile include, `vtkm_config.mk`, and a package include,
`vtkm.pc`, that are configured so that external programs that do not use
CMake have a way of importing VTK-m's configuration. However, the set of
libraries was hardcoded. In particular, many of the new filter libraries
were missing.
Rather than try to maintain this list manually, the new module mechanism
in the CMake configuration is used to get a list of libraries built and
automatically build these lists.