link with -ldl except on Windows for dlopen/dlclose/dlsym support
This commit is contained in:
@ -617,15 +617,12 @@ foreach(PKG_WITH_INCL CORESHELL QEQ OPENMP DPD-SMOOTH KOKKOS OPT INTEL GPU)
|
||||
endforeach()
|
||||
|
||||
if(PKG_PLUGIN)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN)
|
||||
else()
|
||||
message(WARNING "Plugin loading will not work unless BUILD_SHARED_LIBS is enabled")
|
||||
endif()
|
||||
# link with -ldl or equivalent for plugin loading; except on Windows
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN)
|
||||
endif()
|
||||
|
||||
# link with -ldl or equivalent for plugin loading; except on Windows
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(lammps PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
######################################################################
|
||||
|
||||
@ -65,10 +65,8 @@ only enabled if LAMMPS was built with that package.
|
||||
See the :doc:`Build package <Build_package>` page for
|
||||
more info. Plugins are not available on Windows.
|
||||
|
||||
For the loading of plugins to work the LAMMPS library must be
|
||||
:ref:`compiled as a shared library <library>`. If plugins
|
||||
access functions or classes from a package, LAMMPS must have
|
||||
been compiled with that package included.
|
||||
If plugins access functions or classes from a package, LAMMPS must
|
||||
have been compiled with that package included.
|
||||
|
||||
Plugins are dependent on the LAMMPS binary interface (ABI)
|
||||
and particularly the MPI library used. So they are not guaranteed
|
||||
|
||||
@ -65,6 +65,9 @@ JPG_INC =
|
||||
JPG_PATH =
|
||||
JPG_LIB =
|
||||
|
||||
# library for loading shared objects (defaults to -ldl, but should be empty on Windows)
|
||||
|
||||
override DYN_LIB =
|
||||
# ---------------------------------------------------------------------
|
||||
# build rules and dependencies
|
||||
# do not edit this section
|
||||
|
||||
@ -65,6 +65,11 @@ JPG_INC =
|
||||
JPG_PATH =
|
||||
JPG_LIB =
|
||||
|
||||
# library for loading shared objects (defaults to -ldl)
|
||||
# uncomment to change the default
|
||||
|
||||
# override DYN_LIB =
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# build rules and dependencies
|
||||
# do not edit this section
|
||||
|
||||
@ -65,6 +65,11 @@ JPG_INC =
|
||||
JPG_PATH =
|
||||
JPG_LIB =
|
||||
|
||||
# library for loading shared objects (defaults to -ldl, should be empty on Windows)
|
||||
# uncomment to change the default
|
||||
|
||||
# override DYN_LIB =
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# build rules and dependencies
|
||||
# do not edit this section
|
||||
@ -74,7 +79,7 @@ include Makefile.package
|
||||
|
||||
EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
|
||||
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
|
||||
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
|
||||
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB) $(DYN_LIB)
|
||||
EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS)
|
||||
EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS)
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
SHELL = /bin/bash
|
||||
PYTHON = python
|
||||
DYN_LIB = -ldl
|
||||
|
||||
#.IGNORE:
|
||||
|
||||
@ -400,14 +401,14 @@ ifeq ($(mode),static)
|
||||
@cd $(objdir); \
|
||||
$(MAKE) $(MFLAGS) "OBJ = $(OBJLIB)" "INC = $(INC)" "SHFLAGS =" \
|
||||
"LMPLIB = $(ARLIB)" "ARLIB = $(ARLIB)" "SHLIB = $(SHLIB)" \
|
||||
"LMPLINK = $(LMPLINK)" "EXE = ../$(EXE)" ../$(EXE)
|
||||
"LMPLINK = $(LMPLINK)" "DYN_LIB = $(DYN_LIB)" "EXE = ../$(EXE)" ../$(EXE)
|
||||
@ln -s $(ARLIB) $(ARLINK)
|
||||
endif
|
||||
ifeq ($(mode),shared)
|
||||
@cd $(objdir); \
|
||||
$(MAKE) $(MFLAGS) "OBJ = $(OBJLIB)" "INC = $(INC)" \
|
||||
"LMPLIB = $(SHLIB)" "ARLIB = $(ARLIB)" "SHLIB = $(SHLIB)" \
|
||||
"LMPLINK = $(LMPLINK)" "EXE = ../$(EXE)" ../$(EXE)
|
||||
"LMPLINK = $(LMPLINK)" "DYN_LIB = $(DYN_LIB)" "EXE = ../$(EXE)" ../$(EXE)
|
||||
@ln -s $(SHLIB) $(SHLINK)
|
||||
endif
|
||||
# backward compatibility
|
||||
|
||||
Reference in New Issue
Block a user