Merge branch 'master' into multi-config-support
# Conflicts: # cmake/Modules/Packages/MSCG.cmake # examples/plugins/CMakeLists.txt
This commit is contained in:
@ -31,6 +31,15 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro
|
||||
# and prints lots of pointless warnings about "unsafe" functions
|
||||
#if(MSVC)
|
||||
# add_compile_options(/Zc:__cplusplus)
|
||||
# add_compile_options(/wd4244)
|
||||
# add_compile_options(/wd4267)
|
||||
# add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
#endif()
|
||||
|
||||
# C++11 is required
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
@ -40,11 +49,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") OR (CMAKE_CXX_COMPILER_ID STREQUAL "
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict")
|
||||
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_CURRENT_SOURCE_DIR})
|
||||
include(CheckIncludeFileCXX)
|
||||
if(NOT LAMMPS_DIR)
|
||||
@ -68,14 +72,23 @@ add_library(zero2plugin MODULE zero2plugin.cpp pair_zero2.cpp bond_zero2.cpp
|
||||
angle_zero2.cpp dihedral_zero2.cpp improper_zero2.cpp)
|
||||
target_link_libraries(zero2plugin PRIVATE lammps)
|
||||
|
||||
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES
|
||||
PREFIX ""
|
||||
LINK_FLAGS "-rdynamic")
|
||||
set_target_properties(morse2plugin nve2plugin helloplugin zero2plugin PROPERTIES PREFIX "")
|
||||
|
||||
# MacOS seems to need this
|
||||
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
|
||||
LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
|
||||
LINK_FLAGS "-rdynamic")
|
||||
endif()
|
||||
|
||||
add_custom_target(plugins ALL ${CMAKE_COMMAND} -E echo "Building Plugins"
|
||||
|
||||
Reference in New Issue
Block a user