Merge pull request #2438 from akohlmey/swig-support-fixes

Small updates to SWIG tool for increased portability and correctness
This commit is contained in:
Axel Kohlmeyer 2020-10-21 19:57:23 -04:00 committed by GitHub
commit e79e53c540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 15 deletions

View File

@ -46,7 +46,7 @@ replica tool to reorder LAMMPS replica trajectories according to
singularity Singularity container descriptions suitable for LAMMPS development
smd convert Smooth Mach Dynamics triangles to VTK
spin perform a cubic polynomial interpolation of a GNEB MEP
swig SWIG generated script language wrappers for the LAMMPS C library interface
swig Interface file and demo scripts for SWIG wrappers for the LAMMPS C library interface
valgrind suppression files for use with valgrind's memcheck tool
vim add-ons to VIM editor for editing LAMMPS input scripts
xmgrace a collection of scripts to generate xmgrace plots

View File

@ -45,7 +45,7 @@ if(BUILD_SWIG_JAVA)
find_package(JNI REQUIRED)
target_include_directories(javalammps PRIVATE ${JNI_INCLUDE_DIRS})
swig_link_libraries(javalammps PRIVATE lammps ${JNI_LIBRARIES})
configure_file(run_java_example.sh run_java_example.sh COPYONLY)
configure_file(run_java_example.sh.in run_java_example.sh @ONLY)
endif()
if(BUILD_SWIG_LUA)
@ -54,25 +54,26 @@ if(BUILD_SWIG_LUA)
find_package(Lua REQUIRED)
target_include_directories(lualammps PRIVATE ${LUA_INCLUDE_PATH})
swig_link_libraries(lualammps PRIVATE lammps ${LUA_LIBRARY})
configure_file(run_lua_example.sh run_lua_example.sh COPYONLY)
configure_file(run_lua_example.sh.in run_lua_example.sh @ONLY)
endif()
if(BUILD_SWIG_PERL5)
set_property(SOURCE lammps.i PROPERTY SWIG_MODULE_NAME pllammps)
swig_add_library(pllammps TYPE MODULE LANGUAGE perl5 SOURCES lammps.i)
find_package(Perl)
find_package(PerlLibs REQUIRED 5.0)
target_compile_definitions(pllammps PRIVATE _LARGEFILE64_SOURCE)
target_include_directories(pllammps PRIVATE ${PERL_INCLUDE_PATH})
swig_link_libraries(pllammps PRIVATE lammps ${PERL_LIBRARY})
configure_file(run_perl_example.sh run_perl_example.sh COPYONLY)
configure_file(run_perl_example.sh.in run_perl_example.sh @ONLY)
endif()
if(BUILD_SWIG_PYTHON)
set_property(SOURCE lammps.i PROPERTY SWIG_MODULE_NAME pylammps)
swig_add_library(pylammps TYPE MODULE LANGUAGE python SOURCES lammps.i)
find_package(Python REQUIRED COMPONENTS Development)
swig_link_libraries(pylammps PRIVATE lammps Python::Python)
configure_file(run_python_example.sh run_python_example.sh COPYONLY)
find_package(Python3 REQUIRED COMPONENTS Development Interpreter)
swig_link_libraries(pylammps PRIVATE lammps Python3::Python)
configure_file(run_python_example.sh.in run_python_example.sh @ONLY)
endif()
if(BUILD_SWIG_RUBY)
@ -81,20 +82,22 @@ if(BUILD_SWIG_RUBY)
find_package(Ruby REQUIRED)
target_include_directories(rubylammps PRIVATE ${RUBY_INCLUDE_DIRS})
swig_link_libraries(rubylammps PRIVATE lammps ${RUBY_LIBRARY})
configure_file(run_ruby_example.sh run_ruby_example.sh COPYONLY)
configure_file(run_ruby_example.sh.in run_ruby_example.sh @ONLY)
endif()
if(BUILD_SWIG_TCL)
# build loadable Tcl module
set_property(SOURCE lammps.i PROPERTY SWIG_MODULE_NAME tcllammps)
swig_add_library(tcllammps TYPE MODULE LANGUAGE tcl SOURCES lammps.i)
find_package(TCL REQUIRED)
target_include_directories(tcllammps PRIVATE ${TCL_INCLUDE_PATH})
swig_link_libraries(tcllammps PRIVATE lammps ${TCL_LIBRARY})
configure_file(run_tcl_example.sh run_tcl_example.sh COPYONLY)
# build extended Tcl shell binary
set_property(SOURCE lammps_shell.i PROPERTY SWIG_MODULE_NAME tcllmpsh)
swig_add_library(libtcllmpsh TYPE STATIC LANGUAGE tcl SOURCES lammps_shell.i)
add_executable(tcllmpsh tcldummy.c)
target_include_directories(tcllmpsh PRIVATE ${TCL_INCLUDE_PATH})
target_include_directories(libtcllmpsh PRIVATE ${TCL_INCLUDE_PATH})
target_link_libraries(tcllmpsh PRIVATE libtcllmpsh lammps ${TCL_LIBRARY})
configure_file(run_tcl_example.sh.in run_tcl_example.sh @ONLY)
endif()

View File

@ -59,5 +59,5 @@ LD_LIBRARY_PATH=${PWD}:${LD_LIBARARY_PATH-${PWD}}
export CLASSPATH LD_LIBRARY_PATH
javac *.java
java example
@Java_JAVAC_EXECUTABLE@ *.java
@Java_JAVA_EXECUTABLE@ example

View File

@ -63,4 +63,4 @@ PERL5LIB=${PWD}:${PERL5LIB-${PWD}}
export PERL5LIB
perl example.pl
@PERL_EXECUTABLE@ example.pl

View File

@ -60,4 +60,4 @@ PYTHONPATH=${PWD}:${PYTHONPATH-${PWD}}
export PYTHONPATH
python example.py
@Python3_EXECUTABLE@ example.py

View File

@ -58,7 +58,7 @@ puts "Current size of timestep: \$dt"
lammps_close \$lmp
EOF
tclsh example.tcl
@TCL_TCLSH@ example.tcl
# now try again with static extended shell
echo '====================================================================='