forked from omoultosEthTuDelft/OCTP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8558408
commit 602f079
Showing
2 changed files
with
90 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
# Suppress warning msgs | ||
cmake_policy(SET CMP0135 NEW) | ||
|
||
project(octptests) | ||
|
||
# TRUE if tests are run as part of GitHub Actions workflow, FALSE otherwise | ||
set (TEST_IN_GITHUB_ACTIONS FALSE) | ||
|
||
# GoogleTest requires at least C++14 | ||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
include(FetchContent) | ||
|
||
# Fetch and download Google Test | ||
FetchContent_Declare( | ||
googletest | ||
URL https://github.com/google/googletest/archive/b796f7d44681514f58a683a3a71ff17c94edb0c1.zip | ||
) | ||
# Windows: Prevent overriding the parent project's compiler/linker settings | ||
# Currently no parent CMake project, but good to keep for the future | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
FetchContent_MakeAvailable(googletest) | ||
|
||
#Enable testing in CMake | ||
enable_testing() | ||
|
||
# Create an executable for the tests | ||
add_executable( | ||
testoctp | ||
testoctp.cpp | ||
) | ||
|
||
# link the googletest library to the tests | ||
target_link_libraries( | ||
testoctp | ||
GTest::gtest_main | ||
) | ||
|
||
# Enable CMake’s test runner to discover the tests included in the binary, | ||
# using the GoogleTest CMake module. | ||
include(GoogleTest) | ||
gtest_discover_tests(testoctp) | ||
|
||
|
||
if (TEST_IN_GITHUB_ACTIONS) | ||
# lammps was previously downloaded and built as part of the workflow | ||
set (LAMMPS_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../lammps/src/") | ||
else() | ||
message(STATUS "Downloading LAMMPS") | ||
# download lammps | ||
FetchContent_Declare( | ||
lammps | ||
URL https://github.com/lammps/lammps/archive/refs/tags/stable_23Jun2022_update4.zip | ||
) | ||
FetchContent_Populate(lammps) | ||
set (LAMMPS_SOURCE_DIR "${lammps_SOURCE_DIR}/src/") | ||
# copy octp files to lammps dir | ||
file(GLOB filesToCopy "${CMAKE_SOURCE_DIR}/../src/*") | ||
file(COPY ${filesToCopy} DESTINATION ${LAMMPS_SOURCE_DIR}) | ||
# build lammps+octp as a post-build event of the testoctp | ||
add_custom_command( | ||
TARGET testoctp POST_BUILD | ||
COMMAND cd ${LAMMPS_SOURCE_DIR} && | ||
make yes-asphere && | ||
make yes-body && | ||
make yes-class2 && | ||
make yes-dipole && | ||
make yes-granular && | ||
make yes-kspace && | ||
make yes-manybody && | ||
make yes-molecule && | ||
make yes-rigid && | ||
make yes-shock && | ||
make -j 8 mpi | ||
WORKING_DIRECTORY ${lammps_SOURCE_DIR} | ||
VERBATIM | ||
COMMENT "Build LAMMPS with OCTP plugin" | ||
) | ||
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <gtest/gtest.h> | ||
|
||
class OctpTest : public testing::Test {}; | ||
|
||
TEST_F(OctpTest, DummyTest) { | ||
EXPECT_TRUE(true); | ||
} |