Skip to content

Commit

Permalink
Integrate libTorch CMake recipe into GROMACS main
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomofiorin committed Dec 1, 2023
1 parent 53188aa commit 0c0ee70
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions gromacs/gromacs-mdmodules/gmxManageColvars.cmake.diff
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
diff --git a/gromacs/gromacs-mdmodules/cmake/gmxManageColvars.cmake b/gromacs/gromacs-mdmodules/cmake/gmxManageColvars.cmake
index 90778221..645b23b5 100644
diff --git a/cmake/gmxManageColvars.cmake b/cmake/gmxManageColvars.cmake
index 9077822166..9a6ed2564d 100644
--- a/cmake/gmxManageColvars.cmake
+++ b/cmake/gmxManageColvars.cmake
@@ -54,6 +54,11 @@ function(gmx_manage_colvars)
@@ -54,6 +54,20 @@ function(gmx_manage_colvars)
target_sources(colvars INTERFACE $<TARGET_OBJECTS:colvars_objlib>)
target_include_directories(colvars SYSTEM INTERFACE $<BUILD_INTERFACE:${COLVARS_DIR}>)

+ if(GMX_OPENMP)
+ target_compile_options(colvars_objlib PRIVATE ${OpenMP_CXX_FLAGS})
+ target_link_libraries(colvars_objlib PRIVATE OpenMP::OpenMP_CXX)
+ endif()
+
+ find_package(Torch)
+ if (Torch_FOUND)
+ set_property(TARGET colvars PROPERTY CXX_STANDARD 17)
+ target_compile_definitions(colvars PRIVATE -DTORCH)
+ target_compile_options(colvars PRIVATE ${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS})
+ target_include_directories(colvars PRIVATE ${TORCH_INCLUDE_DIRS})
+ target_link_libraries(libgromacs PRIVATE "${TORCH_LIBRARIES}")
+ endif()
+
else()
# Create a dummy link target so the calling code doesn't need to know
Expand Down

0 comments on commit 0c0ee70

Please sign in to comment.