-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into maintenance
# Conflicts: # USER-REBOMOS/CMakeLists.txt
- Loading branch information
Showing
14 changed files
with
765 additions
and
2,328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
########################################## | ||
# CMake build system for plugin examples. | ||
# The is meant to be used as a template for plugins that are | ||
# distributed independent from the LAMMPS package. | ||
########################################## | ||
|
||
cmake_minimum_required(VERSION 3.10) | ||
if(POLICY CMP0077) | ||
cmake_policy(SET CMP0077 NEW) | ||
endif() | ||
|
||
project(bfieldplugin VERSION 1.0 LANGUAGES CXX) | ||
|
||
if(NOT LAMMPS_SOURCE_DIR) | ||
message(FATAL_ERROR "Must set LAMMPS_SOURCE_DIR variable") | ||
endif() | ||
set(CMAKE_MODULE_PATH "${LAMMPS_SOURCE_DIR}/../cmake/Modules") | ||
if (NOT TARGET lammps) | ||
include(CheckIncludeFileCXX) | ||
include(LAMMPSInterfacePlugin) | ||
endif() | ||
|
||
########################## | ||
# building the plugins | ||
|
||
add_library(bfieldplugin MODULE bfieldplugin.cpp ${CMAKE_CURRENT_SOURCE_DIR}/fix_bfield.cpp) | ||
target_link_libraries(bfieldplugin PRIVATE lammps) | ||
set_target_properties(bfieldplugin PROPERTIES PREFIX "" SUFFIX ".so") | ||
|
||
# MacOS seems to need this | ||
if(CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
set_target_properties(bfieldplugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup") | ||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") | ||
# tell CMake to export all symbols to a .dll on Windows with special case for MinGW cross-compilers | ||
set_target_properties(bfieldplugin PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | ||
if(CMAKE_CROSSCOMPILING) | ||
set_target_properties(bfieldplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols") | ||
endif() | ||
|
||
get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h LAMMPS_VERSION) | ||
find_program(MAKENSIS_PATH makensis) | ||
if(MAKENSIS_PATH) | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../lammps.ico | ||
${CMAKE_CURRENT_SOURCE_DIR}/../lammps-text-logo-wide.bmp ${CMAKE_CURRENT_SOURCE_DIR}/bfieldplugin.nsis ${CMAKE_BINARY_DIR}) | ||
if(TARGET package) | ||
set(mytarget package-USER-BFIELD) | ||
else() | ||
set(mytarget package) | ||
endif() | ||
if(BUILD_MPI) | ||
if(USE_MSMPI AND CMAKE_CROSSCOMPILING) | ||
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MSMPI bfieldplugin.nsis | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
DEPENDS bfieldplugin ${CMAKE_BINARY_DIR}/lammps.ico ${CMAKE_BINARY_DIR}/lammps-text-logo-wide.bmp ${CMAKE_BINARY_DIR}/bfieldplugin.nsis | ||
BYPRODUCTS ${CMAKE_BINARY_DIR}/LAMMPS-USER-BFIELD-plugin-${LAMMPS_VERSION}-MSMPI.exe) | ||
else() | ||
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MPI bfieldplugin.nsis | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
DEPENDS bfieldplugin ${CMAKE_BINARY_DIR}/lammps.ico ${CMAKE_BINARY_DIR}/lammps-text-logo-wide.bmp ${CMAKE_BINARY_DIR}/bfieldplugin.nsis | ||
BYPRODUCTS ${CMAKE_BINARY_DIR}/LAMMPS-USER-BFIELD-plugin-${LAMMPS_VERSION}-MPI.exe) | ||
endif() | ||
else() | ||
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION} bfieldplugin.nsis | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
DEPENDS bfieldplugin ${CMAKE_BINARY_DIR}/lammps.ico ${CMAKE_BINARY_DIR}/lammps-text-logo-wide.bmp ${CMAKE_BINARY_DIR}/bfieldplugin.nsis | ||
BYPRODUCTS LAMMPS-USER-BFIELD-plugin-${LAMMPS_VERSION}.exe) | ||
endif() | ||
endif() | ||
else() | ||
set_target_properties(bfieldplugin PROPERTIES LINK_FLAGS "-rdynamic") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
|
||
#include "lammpsplugin.h" | ||
|
||
#include "version.h" | ||
|
||
#include "fix_semigrandcanonical_mc.h" | ||
#include "fix_bfield.h" | ||
|
||
using namespace LAMMPS_NS; | ||
|
||
static Fix *fix_vcscg_creator(LAMMPS *lmp, int argc, char **argv) | ||
static Fix *bfieldcreator(LAMMPS *lmp, int argc, char **argv) | ||
{ | ||
return new FixSemiGrandCanonicalMC(lmp, argc, argv); | ||
return new FixBfield(lmp, argc, argv); | ||
} | ||
|
||
extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc) | ||
{ | ||
lammpsplugin_t plugin; | ||
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc; | ||
|
||
// register pace pair style | ||
// register bfield fix style | ||
plugin.version = LAMMPS_VERSION; | ||
plugin.style = "fix"; | ||
plugin.name = "sgcmc"; | ||
plugin.info = "VCSGC plugin fix style v1.0"; | ||
plugin.name = "bfield"; | ||
plugin.info = "fix bfield plugin v1.0"; | ||
plugin.author = "Axel Kohlmeyer ([email protected])"; | ||
plugin.creator.v2 = (lammpsplugin_factory2 *) &fix_vcscg_creator; | ||
plugin.creator.v2 = (lammpsplugin_factory2 *) &bfieldcreator; | ||
plugin.handle = handle; | ||
(*register_plugin)(&plugin, lmp); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.