enable building plugins for windows
This commit is contained in:
@ -36,11 +36,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# bail out on windows
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
|
|
||||||
message(FATAL_ERROR "LAMMPS plugins are currently not supported on Windows")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
|
||||||
include(CheckIncludeFileCXX)
|
include(CheckIncludeFileCXX)
|
||||||
include(LAMMPSInterfaceCXX)
|
include(LAMMPSInterfaceCXX)
|
||||||
@ -62,12 +57,21 @@ add_library(zero2plugin MODULE zero2plugin.cpp pair_zero2.cpp bond_zero2.cpp
|
|||||||
angle_zero2.cpp dihedral_zero2.cpp improper_zero2.cpp)
|
angle_zero2.cpp dihedral_zero2.cpp improper_zero2.cpp)
|
||||||
target_link_libraries(zero2plugin PRIVATE lammps)
|
target_link_libraries(zero2plugin PRIVATE lammps)
|
||||||
|
|
||||||
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
|
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES PREFIX "")
|
||||||
PREFIX ""
|
|
||||||
LINK_FLAGS "-rdynamic")
|
|
||||||
|
|
||||||
# MacOS seems to need this
|
# MacOS seems to need this
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
|
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin
|
||||||
|
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(morse2plugin nve2plugin helloplugin zero2plugin
|
||||||
|
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
||||||
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin
|
||||||
|
PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
|
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
|
||||||
LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
|
LINK_FLAGS "-rdynamic")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user