install compiled plugins into the current working directory of the tester
This commit is contained in:
@ -3,17 +3,22 @@
|
|||||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
ExternalProject_Add(plugins
|
ExternalProject_Add(plugins
|
||||||
SOURCE_DIR "${LAMMPS_DIR}/examples/plugins"
|
SOURCE_DIR "${LAMMPS_DIR}/examples/plugins"
|
||||||
BINARY_DIR "${CMAKE_BINARY_DIR}/plugins"
|
BINARY_DIR ${CMAKE_BINARY_DIR}/build-plugins
|
||||||
|
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
||||||
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
CMAKE_ARGS ${CMAKE_REQUEST_PIC}
|
||||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||||
BUILD_BYPRODUCTS <BINARY_DIR>/morse2plugin${CMAKE_STATIC_LIBRARY_SUFFIX}
|
BUILD_BYPRODUCTS <BINARY_DIR>/morse2plugin${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
<BINARY_DIR>/nve2plugin${CMAKE_STATIC_LIBRARY_SUFFIX}
|
<BINARY_DIR>/nve2plugin${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
<BINARY_DIR>/helloplugin${CMAKE_STATIC_LIBRARY_SUFFIX}
|
<BINARY_DIR>/helloplugin${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
<BINARY_DIR>/morse2plugin${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
<BINARY_DIR>/nve2plugin${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
<BINARY_DIR>/helloplugin${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
TEST_COMMAND "")
|
TEST_COMMAND "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -347,9 +347,9 @@ TEST_F(SimpleCommandsTest, Units)
|
|||||||
TEST_F(SimpleCommandsTest, Plugin)
|
TEST_F(SimpleCommandsTest, Plugin)
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
std::string loadfmt("plugin load plugins/{}plugin.dylib");
|
std::string loadfmt("plugin load {}plugin.dylib");
|
||||||
#else
|
#else
|
||||||
std::string loadfmt("plugin load plugins/{}plugin.so");
|
std::string loadfmt("plugin load {}plugin.so");
|
||||||
#endif
|
#endif
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
lmp->input->one(fmt::format(loadfmt, "hello"));
|
lmp->input->one(fmt::format(loadfmt, "hello"));
|
||||||
@ -361,7 +361,7 @@ TEST_F(SimpleCommandsTest, Plugin)
|
|||||||
lmp->input->one(fmt::format(loadfmt, "xxx"));
|
lmp->input->one(fmt::format(loadfmt, "xxx"));
|
||||||
text = ::testing::internal::GetCapturedStdout();
|
text = ::testing::internal::GetCapturedStdout();
|
||||||
if (verbose) std::cout << text;
|
if (verbose) std::cout << text;
|
||||||
ASSERT_THAT(text, MatchesRegex(".*Open of file plugins/xxx.* failed.*"));
|
ASSERT_THAT(text, MatchesRegex(".*Open of file xxx.* failed.*"));
|
||||||
|
|
||||||
::testing::internal::CaptureStdout();
|
::testing::internal::CaptureStdout();
|
||||||
lmp->input->one(fmt::format(loadfmt, "nve2"));
|
lmp->input->one(fmt::format(loadfmt, "nve2"));
|
||||||
|
|||||||
Reference in New Issue
Block a user