diff --git a/.gitignore b/.gitignore index e85ec29741..cbac3cd960 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ makefile.dep /config.* /autom4* /stamp-h +build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..833ca58035 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.20.2) + + + +project(Plumed2 LANGUAGES CXX) + +set(PLUMED_VERSION_SHORT "2.10") +set(PLUMED_VERSION_LONG "2.10.0-dev") +#set(PLUMED_VERSION_GIT "23e754fd4-dirty") +execute_process( + COMMAND git describe --long --dirty --always + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE PLUMED_VERSION_GIT + OUTPUT_STRIP_TRAILING_WHITESPACE +) +set(PLUMED_VERSION_MAJOR 2) +set(PLUMED_VERSION_MINOR 10) +set(PLUMED_VERSION_PATCH 0) +#as now CMake is only experimental, it can be useful if you use vscode or other +#IDE that have an interface with it, but we are not still confident that it is ready +#for installation purposes +set(CMAKE_SKIP_INSTALL_RULES YES) +option(risk_accepted "CMake is experimental use at your own risk" OFF) +if(NOT risk_accepted) + message(FATAL_ERROR "You must accept the risk to use the experimental cmake compilation: -Drisk_accepted=ON") +endif(NOT risk_accepted) + + +add_subdirectory(src) diff --git a/src/.gitignore b/src/.gitignore index 258add5ef0..4f935271f3 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -55,6 +55,7 @@ !/s2cm !/pytorch !/membranefusion +!CMakeLists.txt # And just ignore these files *.xxd diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000000..c5f3940f1d --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,344 @@ +cmake_minimum_required(VERSION 3.20.2) + +project(Plumed2 LANGUAGES C CXX) + +set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS None Debug Release RelWithDebInfo MinSizeRel) +#some settingsvalues +set(program_name "plumed" CACHE STRING "the name of the main executable") +set(SOEXT "so" CACHE STRING "The extension of dynamic libraries (so/dylib)") +set_property(CACHE SOEXT PROPERTY STRINGS "so" "dylib") + +set (PLUMED_SRC ${CMAKE_CURRENT_SOURCE_DIR}) +set (PLUMED_MAKETOOLS ${PLUMED_SRC}/maketools ) +cmake_path (GET PLUMED_SRC PARENT_PATH PLUMED_MAIN_DIR) +set (PLUMED_SCRIPTS ${PLUMED_MAIN_DIR}/scripts) +set (PLUMED_PATCHES ${PLUMED_MAIN_DIR}/patches) + +option(all_modules "Activates all modules, if on ignores the values of module_name when compiling" OFF) + +set(modulesForKernel "") + +################################################################################ +#Setting up global options +################################################################################ +#this may be deactivated when we want to copile something more static +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +# --enable-basic-warnings enable basic warnings, default: yes +option(enable_warnings_basic "enable basic warnings" ON) +if(enable_warnings_basic) + if(MSVC) + add_compile_options(/W4) + else() + add_compile_options(-Wall) + endif(MSVC) +endif(enable_warnings_basic) +# --enable-fussy enable fussy warnings, default: no +option(enable_warnings_fussy "enable fussy warnings" OFF) +if(enable_warnings_fussy) + if(MSVC) + add_compile_options(/Wall) + else() + add_compile_options( + -Wall + -Wextra # reasonable and standard + -Wshadow # warn the user if a variable declaration shadows one from a# parent context + -Wnon-virtual-dtor # warn the user if a class with virtual functions has a# non-virtual destructor. + -Wold-style-cast # warn for c-style casts + -Wcast-align # warn for potential performance problem casts + -Wunused # warn on anything being unused + -Woverloaded-virtual # warn if you overload (not override) a virtual func + -Wpedantic # warn if non-standard C++ is used + -Wconversion # warn on type conversions that may lose data + -Wsign-conversion # warn on sign conversions + -Wnull-dereference # warn if a null dereference is detected + -Wdouble-promotion # warn if float is implicit promoted to double + -Wformat=2 # warn on security issues around functions that format output# (ie printf) + -Wduplicated-cond # warn if if / else chain has duplicated conditions + -Wduplicated-branches # warn if if / else branches have duplicated code + -Wlogical-op # warn about logical operations being used where bitwise were# probably wanted + -Wuseless-cast # warn if you perform a cast to the same type + -Wlifetime # /// + ) + endif(MSVC) +endif(enable_warnings_fussy) +option(enable_warnings_errors "enable stop compilation on warnings" OFF) +if(enable_warnings_errors) + if(MSVC) + add_compile_options(/WX) + else() + add_compile_options(-Werror -Wfatal-errors) + endif(MSVC) +endif(enable_warnings_errors) +# --enable-fussy enable fussy warnings, default: no + + +################################################################################ +#Macro definitions +################################################################################ +MACRO(SUBDIRLIST result curdir) + #This macro is from a lot of posts on stackoverflow + FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) + SET(dirlist "") + FOREACH(child ${children}) + IF(IS_DIRECTORY ${curdir}/${child}) + LIST(APPEND dirlist ${child}) + ENDIF() + ENDFOREACH() + SET(${result} ${dirlist}) +ENDMACRO() + +MACRO(ADDMODULETOKERNEL module_name) + #use: ADDMODULETOKERNEL(module_name listOfSources) + #Please write the source files explicitly + if(${module_${module_name}} ) + set(OTHERARGS ${ARGV}) + list(REMOVE_ITEM OTHERARGS ${module_name}) + add_library(${module_name} OBJECT ${OTHERARGS} ) + target_include_directories(${module_name} PRIVATE ${PLUMED_SRC}) + list(APPEND modulesForKernel ${module_name}) + set(modulesForKernel ${modulesForKernel} PARENT_SCOPE) + endif(${module_${module_name}}) +ENDMACRO(ADDMODULETOKERNEL) + +MACRO(ADDMODULENEEDS module_name) + #use: ADDMODULENEEDS(module_name listOfModules) + + set(OTHERARGS ${ARGV}) + list(REMOVE_ITEM OTHERARGS ${module_name}) + set(moduleNeeds_${module_name} ${OTHERARGS} PARENT_SCOPE) + +ENDMACRO(ADDMODULENEEDS) + +MACRO(ADDMODULEDEPENDENCIES module_name) + #use: ADDMODULEDEPENDENCIES(module_name listOfModules) + #adds the module on which this depends on (for compile definitions and so on) + #NB you may create circular dependencies + #NB this is particularly experimental + if(${module_${module_name}} ) + set(OTHERARGS ${ARGV}) + list(REMOVE_ITEM OTHERARGS ${module_name}) + foreach(lib ${OTHERARGS}) + #message("${module_name} is linked with ${lib}") + target_link_libraries(${module_name} PUBLIC ${lib}) + endforeach(lib ${OTHERARGS}) + endif(${module_${module_name}}) +ENDMACRO(ADDMODULEDEPENDENCIES) + +function(print_target_property target_name property) + get_target_property(tempvar ${target_name} ${property}) + message("${target_name} <${property}>: ${tempvar}") + unset(tempvar) +endfunction(print_target_property) + +################################################################################ +#Setting up Modules +################################################################################ + +SUBDIRLIST(alldirs ${CMAKE_CURRENT_SOURCE_DIR})# CACHE INTERNAL FORCE) +set(dirs ${alldirs})# CACHE INTERNAL FORCE) +#directories that do not contain modules +set(utildirs lib include maketools cmake) +#these are the diretory to compile that do not have a module.type inside +set(execDirs config wrapper) #removed main +#these are directory with codes that may be external +set(mayBeExternal blas lapack molfile) +list(REMOVE_ITEM dirs main ${utildirs} ${execDirs} ${mayBeExternal}) +#this is needed for making "all_modules" work +set(toggabledirs ${dirs}) +list(REMOVE_ITEM toggabledirs core tools lepton blas lapack asmjit) + +foreach(dir ${execDirs}) + add_subdirectory(${dir}) +endforeach(dir ${execDirs}) + +foreach(dir ${mayBeExternal}) + add_subdirectory(${dir}) +endforeach(dir ${mayBeExternal}) + +foreach(dir ${dirs}) + add_subdirectory(${dir}) +endforeach(dir ${dirs}) +if(all_modules) + message("All module will be forced ON") + foreach(dir ${toggabledirs}) + set(module_${dir} ON CACHE BOOL "activate module ${dir}" FORCE) + endforeach(dir ${toggabledirs}) +endif() + +#options ## options are already done +## --bindir=DIR user executables [EPREFIX/bin] +## --sbindir=DIR system admin executables [EPREFIX/sbin] +# --libexecdir=DIR program executables [EPREFIX/libexec] +## --sysconfdir=DIR read-only single-machine data [PREFIX/etc] +# --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] +# --localstatedir=DIR modifiable single-machine data [PREFIX/var] +## --libdir=DIR object code libraries [EPREFIX/lib] +## --includedir=DIR C header files [PREFIX/include] +# --oldincludedir=DIR C header files for non-gcc [/usr/include] +# --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] +# --datadir=DIR read-only architecture-independent data [DATAROOTDIR] +# --infodir=DIR info documentation [DATAROOTDIR/info] +# --localedir=DIR locale-dependent data [DATAROOTDIR/locale] +# --mandir=DIR man documentation [DATAROOTDIR/man] +# --docdir=DIR documentation root [DATAROOTDIR/doc/plumed] +# --htmldir=DIR html documentation [DOCDIR] +# --dvidir=DIR dvi documentation [DOCDIR] +# --pdfdir=DIR pdf documentation [DOCDIR] +# --psdir=DIR ps documentation [DOCDIR] +# +#Program names: +# --program-prefix=PREFIX prepend PREFIX to installed program names +# --program-suffix=SUFFIX append SUFFIX to installed program names +# --program-transform-name=PROGRAM run sed PROGRAM on installed program names +# +#Optional Features: +# --disable-option-checking ignore unrecognized --enable/--with options +# --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) +# --enable-FEATURE[=ARG] include FEATURE [ARG=yes] +# --enable-libsearch enable search for libraries, default: yes +# --enable-static-patch enable allow statically linking plumed, default: yes +# --enable-doc enable documentation, default: yes +# --enable-pdfdoc enable pdf version of the manual, default: no +# --enable-debug enable debugging, default: no +# --enable-gcov enable gcov to estimate code coverage, default: no +# --enable-cxx 11 or 14. To link libraries with headers that need +# this C++ level. Use --enable-cxx=none to remove +# -std=c++ flag +# --enable-debug-glibcxx enable enable boundary check, default: no +# --enable-shared enable shared libs, default: yes +# --enable-dependency-tracking +# enable dependency tracking, default: yes +# --enable-rpath enable store rpath, default: no +# --enable-absolute-soname +# enable store absolute soname (Linux only - this is +# the default behavior on OSX). Only enable for +# testing!, default: no +# --enable-absolute-install-name +# enable store absolute relative (OSX only - disable +# to have a behavior similar to Linux). Only disable +# for testing!, default: yes +# --enable-loader-path enable use @loader_path to find +# libplumedKernel.dylib (OSX only), default: yes +# --enable-bsymbolic enable use -Bsymbolic flag in making shared +# libraries (Linux only), default: yes +# --enable-ld-r enable group object files, default: yes +# --enable-ar-cr enable use ar to build libplumedWrapper.a, default: +# yes +# --enable-static-archive enable try to build libplumed.a for static linking, +# default: yes +# --enable-asmjit enable enable embedded asmjit, default: yes +# --enable-mpi enable search for mpi, default: yes +# --enable-molfile-plugins +# enable use molfile_plugins, default: yes +# --enable-external-molfile-plugins +# enable search for external molfile_plugins, default: +# yes +# --enable-readdir-r enable search for readdir_r (threadsafe), default: +# no +# --enable-cregex enable search for C regular expression, default: yes +# --enable-rtld_default enable search for RTLD_DEFAULT macro, default: yes +# --enable-chdir enable search for chdir function, default: yes +# --enable-subprocess enable search for functions needed to manage a +# subprocess, default: yes +# --enable-getcwd enable search for getcwd function, default: yes +# --enable-popen enable search for popen, default: yes +# --enable-execinfo enable search for execinfo, default: yes +# --enable-gsl enable search for gsl, default: yes +# --enable-boost_graph enable search for boost graph, default: no +# --enable-boost_serialization +# enable search for boost serialization, default: no +# --enable-fftw enable search for fftw, default: yes +# --enable-python enable search for python, default: yes +# --enable-af_ocl enable search for arrayfire_ocl, default: no +# --enable-af_cuda enable search for arrayfire_cuda, default: no +# --enable-af_cpu enable search for arrayfire_cpu, default: no +# --enable-libtorch enable search for libtorch, default: no + + +#for debugging purpose +#foreach(dir ${dirs} ${execDirs} ${mayBeExternal}) +# message("${dir}: ${module_${dir}}") +#endforeach(dir ${dirs} ${execDirs} ${mayBeExternal}) + +#check module dependencies +foreach(dir ${dirs} ${mayBeExternal}) + if(${module_${dir}}) + set(notFound "") + #message("${dir} ${moduleNeeds_${dir}}") + foreach(otherModule ${moduleNeeds_${dir}}) + if (NOT module_${otherModule}) + list(FIND mayBeExternal ${otherModule} isExternal) + if(${isExternal}) + string(TOUPPER ${otherModule} capsName) + if(${capsName}_FOUND) + continue() + endif(${capsName}_FOUND) + endif(${isExternal}) + list(APPEND notFound ${otherModule}) + set (modulesDependenciesProblems ON) + endif(NOT module_${otherModule}) + endforeach(otherModule moduleNeeds_${dir}) + if (notFound) + message(SEND_ERROR "Module \"${dir}\" needs the following modules active: ${notFound}") + endif(notFound) + unset(notFound) + endif(${module_${dir}}) +endforeach(dir ${dirs}) +if (${modulesDependenciesProblems}) + message(FATAL_ERROR "Problems in module dependencies") +endif(${modulesDependenciesProblems}) +################################################################################ +#Setting up the main libraries +################################################################################ + +set(KernelTargets "") + +foreach(activeModule ${modulesForKernel}) + list(APPEND KernelTargets $) +endforeach(activeModule ${modulesForKernel}) + +#these targets build the two libPlumedKernel.so +#building the shared libraries with the collected modules +add_library(sharedplumedKernel SHARED) +set_target_properties(sharedplumedKernel + PROPERTIES + LIBRARY_OUTPUT_NAME ${program_name}Kernel + #SUFFIX .${SOEXT} #I think that cmake will set so or dlyb by itself + ) +target_link_libraries(sharedplumedKernel PUBLIC + ${modulesForKernel} # OBJ_KERNEL without config + Config #within OBJ_KERNEL + ) + +add_library(archiveplumedKernel STATIC) +set_target_properties(archiveplumedKernel + PROPERTIES + #LIBRARY_OUTPUT_NAME ${program_name} + ARCHIVE_OUTPUT_NAME ${program_name} + #SUFFIX .${SOEXT} + ) +target_link_libraries(archiveplumedKernel PUBLIC + ${modulesForKernel} # OBJ_KERNEL without config + Config #within OBJ_KERNEL + ) +#add_library(libplumedStatic OBJECT ${KernelTargets}) +#target_link_libraries(libplumedStatic INTERFACE ${modulesForKernel}) + +add_subdirectory(main) + +#print_target_property(cltools COMPILE_DEFINITIONS) +#print_target_property(molfile COMPILE_DEFINITIONS) + +# foreach(module_name blas lapack) +# print_target_property(${module_name} COMPILE_OPTIONS) +# print_target_property(${module_name} COMPILE_DEFINITIONS) +# print_target_property(${module_name} INTERFACE_COMPILE_DEFINITIONS) +# endforeach() +################################################################################ +#One can also use -DCMAKE_EXPORT_COMPILE_COMMANDS=ON in that case, such that we +#have all the commands in the file compile_commands.json without actually +#building the sources. +#-DCMAKE_EXPORT_COMPILE_COMMANDS=ON +#thanks https://stackoverflow.com/questions/2670121/using-cmake-with-gnu-make-how-can-i-see-the-exact-commands#comment112625585_2673355 +################################################################################ diff --git a/src/adjmat/.gitignore b/src/adjmat/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/adjmat/.gitignore +++ b/src/adjmat/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/adjmat/CMakeLists.txt b/src/adjmat/CMakeLists.txt new file mode 100644 index 0000000000..8ecf5caf4b --- /dev/null +++ b/src/adjmat/CMakeLists.txt @@ -0,0 +1,37 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "adjmat") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +ActionWithInputMatrix.cpp +AdjacencyMatrixBase.cpp +AdjacencyMatrixVessel.cpp +AlignedMatrixBase.cpp +ClusterAnalysisBase.cpp +ClusterDiameter.cpp +ClusterDistribution.cpp +ClusteringBase.cpp +ClusterProperties.cpp +ClusterSize.cpp +ClusterWithSurface.cpp +ContactAlignedMatrix.cpp +ContactMatrix.cpp +DFSClustering.cpp +DumpGraph.cpp +HbondMatrix.cpp +MatrixColumnSums.cpp +MatrixRowSums.cpp +OutputCluster.cpp +SMACMatrix.cpp +Sprint.cpp +TopologyMatrix.cpp +) +ADDMODULENEEDS(${module_name} + core tools vesselbase multicolvar +) +ADDMODULEDEPENDENCIES(${module_name} + #core #tools depends on + #tools #vesselbase depends on + #vesselbase # multicolvar depends on + multicolvar +) diff --git a/src/analysis/.gitignore b/src/analysis/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/analysis/.gitignore +++ b/src/analysis/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/analysis/CMakeLists.txt b/src/analysis/CMakeLists.txt new file mode 100644 index 0000000000..77aea99e1d --- /dev/null +++ b/src/analysis/CMakeLists.txt @@ -0,0 +1,35 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "analysis") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +AnalysisBase.cpp +Average.cpp +AverageVessel.cpp +Committor.cpp +DataCollectionObject.cpp +EuclideanDissimilarityMatrix.cpp +FarthestPointSampling.cpp +Histogram.cpp +LandmarkSelectionBase.cpp +LandmarkStaged.cpp +OutputColvarFile.cpp +OutputPDBFile.cpp +PrintDissimilarityMatrix.cpp +ReadAnalysisFrames.cpp +ReadDissimilarityMatrix.cpp +ReselectLandmarks.cpp +SelectRandomFrames.cpp +SelectWithStride.cpp +WhamHistogram.cpp +WhamWeights.cpp +) +ADDMODULENEEDS(${module_name} + core tools reference vesselbase gridtools multicolvar bias +) +ADDMODULEDEPENDENCIES(${module_name} + reference #core + #TODO: resolve THIS circular dependency: + #vesselbase gridtools multicolvar# it does actually depend on them, but it is better to avid cyclic dependencies + bias #tools core +) diff --git a/src/annfunc/.gitignore b/src/annfunc/.gitignore index f51ff1c574..d30b99acd8 100644 --- a/src/annfunc/.gitignore +++ b/src/annfunc/.gitignore @@ -2,3 +2,4 @@ core/** deps/** function/** *.o +!/CMakeLists.txt diff --git a/src/annfunc/CMakeLists.txt b/src/annfunc/CMakeLists.txt new file mode 100644 index 0000000000..6267c04a6e --- /dev/null +++ b/src/annfunc/CMakeLists.txt @@ -0,0 +1,13 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "annfunc") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +ANN.cpp +) +ADDMODULENEEDS(${module_name} + core function +) +ADDMODULEDEPENDENCIES(${module_name} + function #reference tools core lepton +) diff --git a/src/asmjit/CMakeLists.txt b/src/asmjit/CMakeLists.txt new file mode 100644 index 0000000000..c862d8307d --- /dev/null +++ b/src/asmjit/CMakeLists.txt @@ -0,0 +1,42 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "asmjit") +#Note that the macros here require this directory added as a subdir of plumed/src +set(module_${module_name} ON CACHE INTERNAL "always active module ${module_name}") +ADDMODULETOKERNEL(${module_name} +arch.cpp +assembler.cpp +codebuilder.cpp +codecompiler.cpp +codeemitter.cpp +codeholder.cpp +constpool.cpp +cpuinfo.cpp +func.cpp +globals.cpp +inst.cpp +logging.cpp +operand.cpp +osutils.cpp +regalloc.cpp +runtime.cpp +string.cpp +utils.cpp +vmem.cpp +x86assembler.cpp +x86builder.cpp +x86compiler.cpp +x86inst.cpp +x86instimpl.cpp +x86internal.cpp +x86logging.cpp +x86operand.cpp +x86operand_regs.cpp +x86regalloc.cpp +zone.cpp +) +ADDMODULENEEDS(${module_name} + +) +ADDMODULEDEPENDENCIES(${module_name} + +) diff --git a/src/bias/.gitignore b/src/bias/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/bias/.gitignore +++ b/src/bias/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/bias/CMakeLists.txt b/src/bias/CMakeLists.txt new file mode 100644 index 0000000000..f5fbaeea4e --- /dev/null +++ b/src/bias/CMakeLists.txt @@ -0,0 +1,29 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "bias") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +ABMD.cpp +Bias.cpp +BiasValue.cpp +ExtendedLagrangian.cpp +External.cpp +LWalls.cpp +MaxEnt.cpp +MetaD.cpp +MovingRestraint.cpp +PBMetaD.cpp +Restraint.cpp +ReweightBase.cpp +ReweightBias.cpp +ReweightMetad.cpp +ReweightTemperaturePressure.cpp +ReweightWham.cpp +UWalls.cpp +) +ADDMODULENEEDS(${module_name} + core tools +) +ADDMODULEDEPENDENCIES(${module_name} + core #tools +) diff --git a/src/blas/.gitignore b/src/blas/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/blas/.gitignore +++ b/src/blas/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/blas/CMakeLists.txt b/src/blas/CMakeLists.txt new file mode 100644 index 0000000000..64762b9d5c --- /dev/null +++ b/src/blas/CMakeLists.txt @@ -0,0 +1,65 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "blas") +string(TOUPPER ${module_name} externalLib) +#Note that the macros here require this directory added as a subdir of plumed/src +set(module_${module_name} ON CACHE INTERNAL "always active module ${module_name}") +option(useExternal_${externalLib} "enable search for external ${externalLib}, default ON" ON) +ADDMODULETOKERNEL(${module_name} +blas.cpp +) +#ADDMODULENEEDS(${module_name} +# +#) + +#include(FortranCInterface) +if (useExternal_${externalLib}) + find_package(${externalLib}) +endif (useExternal_${externalLib}) + +if (${externalLib}_FOUND) + target_compile_definitions(${module_name} + PUBLIC + __PLUMED_HAS_EXTERNAL_BLAS=1) + include(CheckSourceCompiles) + #From the manual:The check is only performed once, with the result cached in + #the variable named by . Every subsequent CMake run will re-use + #this cached value rather than performing the check again, even if the + # changes. In order to force the check to be re-evaluated, the + #variable named by must be manually removed from the cache. + set(CMAKE_REQUIRED_LIBRARIES "BLAS::BLAS") + check_source_compiles(C #using C to not use extern "C" + "int main(void) { + double a,b,c,s; + srotg_(&a,&b,&c,&s); + }" + UnderscodeBlas) + check_source_compiles(C #using C to not use extern "C" + "int main(void) { + double a,b,c,s; + srotg(&a,&b,&c,&s); + }" + noUnderscodeBlas + ) + unset(CMAKE_REQUIRED_LIBRARIES) + + if(noUnderscodeBlas AND NOT UnderscodeBlas) + target_compile_definitions(${module_name} + PUBLIC + F77_NO_UNDERSCORE) + elseif(NOT noUnderscodeBlas AND NOT UnderscodeBlas) + message(WARNING "both srtog_ and srtog are not linkable") + elseif(noUnderscodeBlas AND UnderscodeBlas) + message(WARNING "both srtog_ and srtog are linkable") + endif(noUnderscodeBlas AND NOT UnderscodeBlas) + + target_link_libraries(${module_name} + PUBLIC + ${externalLib}::${externalLib}) +else() + set(${externalLib}_FOUND OFF) +endif (${externalLib}_FOUND) +set (${externalLib}_FOUND ${externalLib}_FOUND PARENT_SCOPE) + +# print_target_property(${module_name} COMPILE_OPTIONS) +# print_target_property(${module_name} COMPILE_DEFINITIONS) +# print_target_property(${module_name} INTERFACE_COMPILE_DEFINITIONS) diff --git a/src/blas/blas.h b/src/blas/blas.h index e34024129d..e7049d0e6e 100644 --- a/src/blas/blas.h +++ b/src/blas/blas.h @@ -90,7 +90,7 @@ Erik Lindahl, 2008-10-07. #ifndef __PLUMED_BLAS_RETURNS_FLOAT #define __PLUMED_BLAS_RETURNS_FLOAT float -#endif +#endif //ifndef __PLUMED_BLAS_RETURNS_FLOAT #if ! defined (__PLUMED_HAS_EXTERNAL_BLAS) #include "def_internal.h" namespace PLMD{ @@ -98,14 +98,14 @@ namespace blas{ #else namespace PLMD{ namespace blas{ -} -} +}/*PLMD*/ +}/*blas*/ #include "def_external.h" extern "C"{ -#endif +#endif //! defined (__PLUMED_HAS_EXTERNAL_BLAS) #if 0 } -#endif +#endif //0 /* Double precision versions */ double @@ -245,9 +245,9 @@ int } #if ! defined (__PLUMED_HAS_EXTERNAL_BLAS) } -#endif +#endif //! defined (__PLUMED_HAS_EXTERNAL_BLAS) /*! \endcond */ #endif /* GMX_BLAS_H */ -#endif +#endif //__PLUMED_blas_blas_h diff --git a/src/blas/def_external.h b/src/blas/def_external.h index 6031e7e6e1..5a31a6c5e1 100644 --- a/src/blas/def_external.h +++ b/src/blas/def_external.h @@ -58,4 +58,4 @@ Erik Lindahl, 2008-10-07. #define plumed_blas_strmv PLUMED_BLAS_F77_FUNC(strmv,STRMV) #define plumed_blas_strsm PLUMED_BLAS_F77_FUNC(strsm,STRSM) #define plumed_blas_isamax PLUMED_BLAS_F77_FUNC(isamax,ISAMAX) -#endif +#endif //__PLUMED_blas_def_external_h diff --git a/src/blas/def_internal.h b/src/blas/def_internal.h index 240d8a5a2a..1eeb425b25 100644 --- a/src/blas/def_internal.h +++ b/src/blas/def_internal.h @@ -94,4 +94,4 @@ Erik Lindahl, 2008-10-07. #define plumed_blas_strsm PLMD::blas::PLUMED_BLAS_F77_FUNC(strsm,STRSM) /** \ingroup internal-blas */ #define plumed_blas_isamax PLMD::blas::PLUMED_BLAS_F77_FUNC(isamax,ISAMAX) -#endif +#endif //__PLUMED_blas_def_internal_h diff --git a/src/cltools/.gitignore b/src/cltools/.gitignore index 3ad7042f02..08bb696c89 100644 --- a/src/cltools/.gitignore +++ b/src/cltools/.gitignore @@ -8,3 +8,4 @@ !/README !/module.type !/*.sh +!/CMakeLists.txt diff --git a/src/cltools/CMakeLists.txt b/src/cltools/CMakeLists.txt new file mode 100644 index 0000000000..8a96a169dd --- /dev/null +++ b/src/cltools/CMakeLists.txt @@ -0,0 +1,60 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "cltools") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +CLTool.cpp +Completion.cpp +Driver.cpp +DriverDouble.cpp +DriverFloat.cpp +GenExample.cpp +GenJson.cpp +GenTemplate.cpp +Info.cpp +kT.cpp +Manual.cpp +PdbRenumber.cpp +pesmd.cpp +SimpleMD.cpp +SumHills.cpp +#generated file +completion.xxd +) +ADDMODULENEEDS(${module_name} +core config tools molfile xdrfile +) +ADDMODULEDEPENDENCIES(${module_name} + molfile + core #tools #config + xdrfile +) + +#get_target_property(t ${module_name} INCLUDE_DIRECTORIES) +#message("id: ${t}") +target_include_directories(${module_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +#get_target_property(t ${module_name} INCLUDE_DIRECTORIES) +#message("id: ${t}") +#this file once compiled reproduces +#completion.xxd: completion.sh ../../scripts/*.sh ../../patches/*.sh +# { ../maketools/make-scripts-options.sh ; cat completion.sh ; }| ../maketools/xxd > completion.xxd +configure_file(completion.xxd.compiler.sh.in completion.xxd.compiler.sh @ONLY) +#this is used to test completion.xxd.compiler.sh +#execute_process( +# COMMAND bash completion.xxd.compiler.sh +# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +# #OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/completion.xxd +#) + +file(GLOB script_deps ${PLUMED_SCRIPTS}/*.sh) +file(GLOB patches_deps ${PLUMED_PATCHES}/*.sh) + +add_custom_command(OUTPUT completion.xxd + DEPENDS completion.sh ${script_deps} ${patches_deps} + COMMAND bash completion.xxd.compiler.sh + COMMENT "Generationc completion.xxd" + #WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +#message("scripts ${script_deps} ${PLUMED_SCRIPTS}") +#message("patches ${patches_deps} ${PLUMED_PATCHES}") \ No newline at end of file diff --git a/src/cltools/completion.xxd.compiler.sh.in b/src/cltools/completion.xxd.compiler.sh.in new file mode 100755 index 0000000000..96858b23a3 --- /dev/null +++ b/src/cltools/completion.xxd.compiler.sh.in @@ -0,0 +1,15 @@ +{ + #TODO: this may be configured in a more general environment + #replaces make-scripts-options.sh + for file in @PLUMED_SCRIPTS@/*.sh + do + name=${file##*/} + name=${name%.sh} + name=${name//-/_} + echo -n "local cmd_keys_${name}=\"" + echo -n $(PLUMED_ROOT=@PLUMED_MAIN_DIR@ $file --options) + echo "\"" + done + #end TODO + cat @CMAKE_CURRENT_SOURCE_DIR@/completion.sh +} | @PLUMED_MAKETOOLS@/xxd > completion.xxd \ No newline at end of file diff --git a/src/colvar/.gitignore b/src/colvar/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/colvar/.gitignore +++ b/src/colvar/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/colvar/CMakeLists.txt b/src/colvar/CMakeLists.txt new file mode 100644 index 0000000000..8932253ff7 --- /dev/null +++ b/src/colvar/CMakeLists.txt @@ -0,0 +1,43 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "colvar") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +Angle.cpp +Cell.cpp +Colvar.cpp +Constant.cpp +ContactMap.cpp +CoordinationBase.cpp +Coordination.cpp +DHEnergy.cpp +Dimer.cpp +Dipole.cpp +Distance.cpp +DRMSD.cpp +EEFSolv.cpp +Energy.cpp +ERMSD.cpp +ExtraCV.cpp +Fake.cpp +GHBFIX.cpp +Gyration.cpp +MultiRMSD.cpp +PathMSDBase.cpp +PathMSD.cpp +PCARMSD.cpp +Position.cpp +ProjectionOnAxis.cpp +PropertyMap.cpp +Puckering.cpp +RMSD.cpp +Template.cpp +Torsion.cpp +Volume.cpp +) +ADDMODULENEEDS(${module_name} + core reference tools +) +ADDMODULEDEPENDENCIES(${module_name} + reference #tools core +) diff --git a/src/config/CMakeLists.txt b/src/config/CMakeLists.txt new file mode 100644 index 0000000000..be6a4c289a --- /dev/null +++ b/src/config/CMakeLists.txt @@ -0,0 +1,75 @@ +set(module_name config) +#this is not a module, this is set up to make easier the dependency interface +set(module_${module_name} ON CACHE INTERNAL "always active core module ${module_name}") +#set this before or maybe let only one config e +set(plumed_install_flag ON) +#SOEXT is set in ./src +if(plumed_install_flag) +set(ISINSTALLED "true") +#must go to /lib/plumed + set(PLUMED_ROOT ${CMAKE_INSTALL_PREFIX}/${program_name}) + set (htmldir ${htmldir}) + set (includedir ${includedir}) + set (program_name ${program_name}) + set (libdir ${libdir}) + configure_file(Config.inc.in ConfigInstall.inc) + add_library(Config OBJECT ConfigInstall.cpp Makefile.conf.xxd) +else() + set(ISINSTALLED "false") + set (PLUMED_ROOT ${CMAKE_SOURCE_DIR}) + set (htmldir "xxxxNAxxxx") + set (includedir "xxxxNAxxxx") + set (program_name "xxxxNAxxxx") + configure_file(Config.inc.in Config.inc) + add_library(Config OBJECT Config.cpp Makefile.conf.xxd) +endif(plumed_install_flag) +#TODO: verify if the version number are not set +configure_file(version.h.in version.h) +################################################################################ +#The config interface library holds a lot of options that must be inherited by # +#everithing, more specialized options will be found in the respective modules # +# licke blas and lapack +################################################################################ +add_library(config INTERFACE) +################################################################################ +# options # +################################################################################ +option(enable_dlopen "enable search for dlopen" ON) +if(enable_dlopen) + if(CMAKE_DL_LIBS) + target_link_libraries(config INTERFACE ${CMAKE_DL_LIBS}) + target_compile_definitions(config INTERFACE __PLUMED_HAS_DLOPEN) + endif(CMAKE_DL_LIBS) +endif(enable_dlopen) +# --disable-openmp do not use OpenMP +option(enable_openmp "enable search for openmp" ON) +if(enable_openmp) + find_package(OpenMP) + if(OpenMP_CXX_FOUND) + target_link_libraries(config INTERFACE OpenMP::OpenMP_CXX) + endif(OpenMP_CXX_FOUND) +endif(enable_openmp) + +option(enable_zlib "enable search for zlib" ON) +if(enable_zlib) + find_package(ZLIB) + if(ZLIB_FOUND) + target_link_libraries(config INTERFACE ZLIB::ZLIB) + target_compile_definitions(config INTERFACE __PLUMED_HAS_ZLIB) + endif(ZLIB_FOUND) +endif(enable_zlib) + +target_link_libraries(Config PUBLIC config) +target_include_directories(Config PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + + +configure_file(Makefile.conf.xxd.compiler.sh.in Makefile.conf.xxd.compiler.sh @ONLY) +configure_file(${PLUMED_MAIN_DIR}/Makefile.conf.in Makefile.cmakeMocked.conf @ONLY) +add_custom_command(OUTPUT Makefile.conf.xxd + DEPENDS ${PLUMED_MAIN_DIR}/Makefile.conf.in + COMMAND bash Makefile.conf.xxd.compiler.sh + COMMENT "Generationc completion.xxd" + #WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +#print_target_property(ConfigInstall INCLUDE_DIRECTORIES) diff --git a/src/config/Makefile.conf.xxd.compiler.sh.in b/src/config/Makefile.conf.xxd.compiler.sh.in new file mode 100755 index 0000000000..f2a0601aaf --- /dev/null +++ b/src/config/Makefile.conf.xxd.compiler.sh.in @@ -0,0 +1 @@ +cat @CMAKE_CURRENT_BINARY_DIR@/Makefile.cmakeMocked.conf | @PLUMED_MAKETOOLS@/xxd > Makefile.conf.xxd \ No newline at end of file diff --git a/src/config/version.h.in b/src/config/version.h.in new file mode 100644 index 0000000000..1608633a92 --- /dev/null +++ b/src/config/version.h.in @@ -0,0 +1,9 @@ +#ifndef __PLUMED_config_version_h +#define __PLUMED_config_version_h +#define PLUMED_VERSION_SHORT "@PLUMED_VERSION_SHORT@" +#define PLUMED_VERSION_LONG "@PLUMED_VERSION_LONG@" +#define PLUMED_VERSION_GIT "@PLUMED_VERSION_GIT@" +#define PLUMED_VERSION_MAJOR @PLUMED_VERSION_MAJOR@ +#define PLUMED_VERSION_MINOR @PLUMED_VERSION_MINOR@ +#define PLUMED_VERSION_PATCH @PLUMED_VERSION_PATCH@ +#endif diff --git a/src/core/.gitignore b/src/core/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/core/.gitignore +++ b/src/core/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt new file mode 100644 index 0000000000..417ae4a84e --- /dev/null +++ b/src/core/CMakeLists.txt @@ -0,0 +1,78 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "core") +#Note that the macros here require this directory added as a subdir of plumed/src +set(module_${module_name} ON CACHE INTERNAL "always active module ${module_name}") +ADDMODULETOKERNEL(${module_name} +ActionAnyorder.cpp +ActionAtomistic.cpp +Action.cpp +ActionPilot.cpp +ActionRegister.cpp +ActionSet.cpp +ActionSetup.cpp +ActionShortcut.cpp +ActionWithArguments.cpp +ActionWithValue.cpp +ActionWithVirtualAtom.cpp +Atoms.cpp +CLTool.cpp +CLToolMain.cpp +CLToolRegister.cpp +Colvar.cpp +DataFetchingObject.cpp +ExchangePatterns.cpp +FlexibleBin.cpp +GenericMolInfo.cpp +GREX.cpp +MDAtoms.cpp +PlumedMain.cpp +PlumedMainInitializer.cpp +TargetDist.cpp +Value.cpp +WithCmd.cpp +#file generated during the build process +PlumedMainMap.inc PlumedMainEnum.inc +GREXMap.inc GREXEnum.inc +CLToolMainMap.inc CLToolMainEnum.inc +) + +ADDMODULENEEDS(${module_name} +config tools lepton +) +#tools depends on more modules that define COMPILE_DEFINITIONS, so +#it is better to make core dependent of tools, and then solve the circularity +#in a second time +ADDMODULEDEPENDENCIES(${module_name} + tools #lepton #lapack #blas #config +) + +#ADDMODULENEEDS(${module_name} +####################################### +# TODO SOLVE THIS################## +####################################### +# tools #commenting this avoids circular references error +#) + +#execute_process( +# COMMAND bash ${PLUMED_MAKETOOLS}/makecmd_cmake map "${CMAKE_CURRENT_SOURCE_DIR}/PlumedMain.cpp" PlumedMainMap.inc +# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +#) +target_include_directories(${module_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +MACRO(CREATEINC cppFile type outputFile) + add_custom_command(OUTPUT ${outputFile} + DEPENDS ${cppFile} + COMMAND bash ${PLUMED_MAKETOOLS}/makecmd_cmake ${type} "${CMAKE_CURRENT_SOURCE_DIR}/${cppFile}" ${outputFile} + COMMENT "Generating ${outputFile}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +ENDMACRO() + +CREATEINC(PlumedMain.cpp map PlumedMainMap.inc) +CREATEINC(PlumedMain.cpp enum PlumedMainEnum.inc) +CREATEINC(GREX.cpp map GREXMap.inc) +CREATEINC(GREX.cpp enum GREXEnum.inc) +CREATEINC(CLToolMain.cpp map CLToolMainMap.inc) +CREATEINC(CLToolMain.cpp enum CLToolMainEnum.inc) + + + diff --git a/src/createCMakeLists.sh b/src/createCMakeLists.sh new file mode 100755 index 0000000000..c949d02723 --- /dev/null +++ b/src/createCMakeLists.sh @@ -0,0 +1,63 @@ +#!/bin/bash +#small utilty that recurses the src folder and creates a standard CMakeListst.txt +#for modules where is not present +#thinked to be launched in repodir/src + +createCMakeLists (){ + dir=$1 + if test -f "$dir/module.type" ; then + if test -f $dir/CMakeLists.txt ;then + echo "$dir has the CMakeLists.txt" + # if grep -q "automatically generated CMakeLists.txt, if it does not work" $dir/CMakeLists.txt; then + #this update non modified CMakeLists.txt, decomment if needed + # rm -v $dir/CMakeLists.txt + # fi + else + echo "$dir" + fi + + if test ! -f $dir/CMakeLists.txt + then + ( + cd $dir ||exit + { + echo "message(WARNING \"${dir} has an automatically generated CMakeLists.txt, if it does not work modify it and remove this warning\")" + echo "#the variable module_name is set up as a sugar to reduce \"copy-paste\" errors" + echo "set (module_name \"${dir}\")" + echo "#Note that the macros here require this directory added as a subdir of plumed/src" + + if [[ $(wc -l < Makefile) -gt 4 ]]; then + echo "message (FATAL_ERROR \"\${module_name} has a non standard Makefile (more than 4 lines) you need to modify the CMakeLists.txt!\")" + fi + + case "$(cat "module.type")" in + (always) echo "set(module_\${module_name} ON CACHE INTERNAL \"always active module \${module_name}\")";; + (default-on) echo "option(module_\${module_name} \"activate module \${module_name}\" ON)" ;; + (default-off) echo "option(module_\${module_name} \"activate module \${module_name}\" OFF)" ;; + esac + echo "ADDMODULETOKERNEL(\${module_name}" + ls -1 *.cpp + echo ")" + if grep -q USE Makefile; then + echo "ADDMODULENEEDS(\${module_name}" + t=$(awk '/USE=/{print }' < Makefile) + echo -e "\t${t#USE*=}" + echo ")" + echo "ADDMODULEDEPENDENCIES(\${module_name}" + t=$(awk '/USE=/{print }' < Makefile) + echo -e "\t${t#USE*=}" + echo ")" + fi + } > CMakeLists.txt + if ! grep -q "!/CMakeLists.txt" .gitignore && [[ -f .gitignore ]]; then + echo "!/CMakeLists.txt" >>.gitignore + fi + ) + fi + fi +} + + +for dir in */; do + createCMakeLists "${dir///}" +done diff --git a/src/crystallization/.gitignore b/src/crystallization/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/crystallization/.gitignore +++ b/src/crystallization/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/crystallization/CMakeLists.txt b/src/crystallization/CMakeLists.txt new file mode 100644 index 0000000000..ece9070535 --- /dev/null +++ b/src/crystallization/CMakeLists.txt @@ -0,0 +1,34 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "crystallization") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +BondOrientation.cpp +CubicHarmonicBase.cpp +EnvironmentSimilarity.cpp +Fccubic.cpp +Gradient.cpp +GradientVessel.cpp +InterMolecularTorsions.cpp +LocalSteinhardt.cpp +MoleculeOrientation.cpp +MoleculePlane.cpp +OrientationSphere.cpp +PolymerAngles.cpp +Q3.cpp +Q4.cpp +Q6.cpp +SimpleCubic.cpp +SMAC.cpp +Steinhardt.cpp +Tetrahedral.cpp +VectorMean.cpp +VectorMultiColvar.cpp +VectorSum.cpp +) +ADDMODULENEEDS(${module_name} + core tools vesselbase multicolvar +) +ADDMODULEDEPENDENCIES(${module_name} + multicolvar #vesselbase tools core +) diff --git a/src/dimred/.gitignore b/src/dimred/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/dimred/.gitignore +++ b/src/dimred/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/dimred/CMakeLists.txt b/src/dimred/CMakeLists.txt new file mode 100644 index 0000000000..3495bd78d3 --- /dev/null +++ b/src/dimred/CMakeLists.txt @@ -0,0 +1,26 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "dimred") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +ClassicalMultiDimensionalScaling.cpp +DimensionalityReductionBase.cpp +OutputPCAProjections.cpp +PCA.cpp +ProjectNonLandmarkPoints.cpp +SketchMapBase.cpp +SketchMapConjGrad.cpp +SketchMap.cpp +SketchMapPointwise.cpp +SketchMapRead.cpp +SketchMapSmacof.cpp +SMACOF.cpp +SmacoffMDS.cpp +) +ADDMODULENEEDS(${module_name} + core tools reference gridtools analysis +) +ADDMODULEDEPENDENCIES(${module_name} + #core #tools + gridtools #analysis bias reference tools core +) diff --git a/src/drr/.gitignore b/src/drr/.gitignore index 8a5c88d566..b6d0926269 100644 --- a/src/drr/.gitignore +++ b/src/drr/.gitignore @@ -9,3 +9,4 @@ !/README.md !/COPYRIGHT !/module.type +!/CMakeLists.txt diff --git a/src/drr/CMakeLists.txt b/src/drr/CMakeLists.txt new file mode 100644 index 0000000000..fc3ec19df5 --- /dev/null +++ b/src/drr/CMakeLists.txt @@ -0,0 +1,17 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "drr") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +colvar_UIestimator.cpp +DRR.cpp +drrtool.cpp +DynamicReferenceRestraining.cpp +) +ADDMODULENEEDS(${module_name} + core tools bias cltools config +) +ADDMODULEDEPENDENCIES(${module_name} + bias# tools core + cltools #config +) diff --git a/src/eds/.gitignore b/src/eds/.gitignore index 8a5c88d566..b6d0926269 100644 --- a/src/eds/.gitignore +++ b/src/eds/.gitignore @@ -9,3 +9,4 @@ !/README.md !/COPYRIGHT !/module.type +!/CMakeLists.txt diff --git a/src/eds/CMakeLists.txt b/src/eds/CMakeLists.txt new file mode 100644 index 0000000000..221e011a0a --- /dev/null +++ b/src/eds/CMakeLists.txt @@ -0,0 +1,13 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "eds") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +EDS.cpp +) +ADDMODULENEEDS(${module_name} + core tools bias +) +ADDMODULEDEPENDENCIES(${module_name} + bias #tools core +) diff --git a/src/fisst/.gitignore b/src/fisst/.gitignore index 25449c7172..bc1f5d9091 100644 --- a/src/fisst/.gitignore +++ b/src/fisst/.gitignore @@ -8,3 +8,4 @@ !/README !/module.type !/COPYRIGHT +!/CMakeLists.txt diff --git a/src/fisst/CMakeLists.txt b/src/fisst/CMakeLists.txt new file mode 100644 index 0000000000..1b806611a4 --- /dev/null +++ b/src/fisst/CMakeLists.txt @@ -0,0 +1,14 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "fisst") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +FISST.cpp +legendre_rule_fast.cpp +) +ADDMODULENEEDS(${module_name} + core tools bias +) +ADDMODULEDEPENDENCIES(${module_name} + bias #tools core +) diff --git a/src/function/.gitignore b/src/function/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/function/.gitignore +++ b/src/function/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/function/CMakeLists.txt b/src/function/CMakeLists.txt new file mode 100644 index 0000000000..071fbe6ea0 --- /dev/null +++ b/src/function/CMakeLists.txt @@ -0,0 +1,25 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "function") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +Combine.cpp +Custom.cpp +Ensemble.cpp +FuncPathGeneral.cpp +FuncPathMSD.cpp +FuncSumHills.cpp +Function.cpp +LocalEnsemble.cpp +Piecewise.cpp +Sort.cpp +Stats.cpp +Target.cpp +) +ADDMODULENEEDS(${module_name} + core reference tools lepton +) +ADDMODULEDEPENDENCIES(${module_name} + reference #tools core + #tools #lepton +) diff --git a/src/funnel/.gitignore b/src/funnel/.gitignore index 25449c7172..bc1f5d9091 100644 --- a/src/funnel/.gitignore +++ b/src/funnel/.gitignore @@ -8,3 +8,4 @@ !/README !/module.type !/COPYRIGHT +!/CMakeLists.txt diff --git a/src/funnel/CMakeLists.txt b/src/funnel/CMakeLists.txt new file mode 100644 index 0000000000..deef6a0004 --- /dev/null +++ b/src/funnel/CMakeLists.txt @@ -0,0 +1,15 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "funnel") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +FPS.cpp +Funnel.cpp +) +ADDMODULENEEDS(${module_name} + core tools colvar bias +) +ADDMODULEDEPENDENCIES(${module_name} + bias #tools core + colvar#tools core +) diff --git a/src/generic/.gitignore b/src/generic/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/generic/.gitignore +++ b/src/generic/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/generic/CMakeLists.txt b/src/generic/CMakeLists.txt new file mode 100644 index 0000000000..3268261a99 --- /dev/null +++ b/src/generic/CMakeLists.txt @@ -0,0 +1,35 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "generic") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +Debug.cpp +DumpAtoms.cpp +DumpDerivatives.cpp +DumpForces.cpp +DumpMassCharge.cpp +DumpProjections.cpp +EffectiveEnergyDrift.cpp +EndPlumed.cpp +FitToTemplate.cpp +Flush.cpp +Group.cpp +Include.cpp +MolInfo.cpp +Plumed.cpp +Print.cpp +RandomExchanges.cpp +Read.cpp +ResetCell.cpp +Time.cpp +UpdateIf.cpp +WholeMolecules.cpp +WrapAround.cpp +) +ADDMODULENEEDS(${module_name} + core tools xdrfile +) +ADDMODULEDEPENDENCIES(${module_name} + core #tools + xdrfile +) diff --git a/src/gridtools/.gitignore b/src/gridtools/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/gridtools/.gitignore +++ b/src/gridtools/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/gridtools/CMakeLists.txt b/src/gridtools/CMakeLists.txt new file mode 100644 index 0000000000..f4509e644b --- /dev/null +++ b/src/gridtools/CMakeLists.txt @@ -0,0 +1,31 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "gridtools") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +ActionWithGrid.cpp +ActionWithInputGrid.cpp +ActionWithIntegral.cpp +AverageOnGrid.cpp +ContourFindingBase.cpp +ConvertToFES.cpp +DumpCube.cpp +DumpGrid.cpp +FindContour.cpp +FindContourSurface.cpp +FindSphericalContour.cpp +FourierTransform.cpp +GridPrintingBase.cpp +GridSearch.cpp +GridToXYZ.cpp +GridVessel.cpp +HistogramOnGrid.cpp +IntegrateGrid.cpp +InterpolateGrid.cpp +) +ADDMODULENEEDS(${module_name} + core tools vesselbase +) +ADDMODULEDEPENDENCIES(${module_name} + vesselbase #tools core +) diff --git a/src/isdb/.gitignore b/src/isdb/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/isdb/.gitignore +++ b/src/isdb/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/isdb/CMakeLists.txt b/src/isdb/CMakeLists.txt new file mode 100644 index 0000000000..8c9294a0ee --- /dev/null +++ b/src/isdb/CMakeLists.txt @@ -0,0 +1,28 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "isdb") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +Caliber.cpp +CS2Backbone.cpp +EMMI.cpp +FretEfficiency.cpp +Jcoupling.cpp +MetainferenceBase.cpp +Metainference.cpp +NOE.cpp +PRE.cpp +RDC.cpp +Rescale.cpp +SAXS.cpp +Select.cpp +Selector.cpp +) +ADDMODULENEEDS(${module_name} + bias colvar core reference tools function +) +ADDMODULEDEPENDENCIES(${module_name} + bias #tools core + colvar #reference tools + function #reference +) diff --git a/src/lapack/.gitignore b/src/lapack/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/lapack/.gitignore +++ b/src/lapack/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/lapack/CMakeLists.txt b/src/lapack/CMakeLists.txt new file mode 100644 index 0000000000..3b1a56fb9f --- /dev/null +++ b/src/lapack/CMakeLists.txt @@ -0,0 +1,37 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "lapack") +string(TOUPPER ${module_name} externalLib) +#Note that the macros here require this directory added as a subdir of plumed/src +set(module_${module_name} ON CACHE INTERNAL "always active module ${module_name}") +option(useExternal_${externalLib} "enable search for external ${externalLib}, default ON" ON) +ADDMODULETOKERNEL(${module_name} + lapack.cpp +) +ADDMODULENEEDS(${module_name} + blas +) + +ADDMODULEDEPENDENCIES(${module_name} + blas +) + +if (useExternal_${externalLib} AND ${BLAS_FOUND}) + find_package(${externalLib}) +endif (useExternal_${externalLib} AND ${BLAS_FOUND}) + +if (${externalLib}_FOUND) + target_compile_definitions(${module_name} + PUBLIC + __PLUMED_HAS_EXTERNAL_LAPACK=1) + target_compile_options(${module_name} PRIVATE ${BLAS_LINKER_FLAGS}) + target_link_libraries(${module_name} + PUBLIC + ${externalLib}::${externalLib}) +else() + set(${externalLib}_FOUND OFF) +endif (${externalLib}_FOUND) +set (${externalLib}_FOUND ${externalLib}_FOUND PARENT_SCOPE) + +# print_target_property(${module_name} COMPILE_OPTIONS) +# print_target_property(${module_name} COMPILE_DEFINITIONS) +# print_target_property(${module_name} INTERFACE_COMPILE_DEFINITIONS) diff --git a/src/lepton/.gitignore b/src/lepton/.gitignore index 64daaf4527..3ea3aefd38 100644 --- a/src/lepton/.gitignore +++ b/src/lepton/.gitignore @@ -9,3 +9,4 @@ !/module.type !/COPYRIGHT !/import.sh +!/CMakeLists.txt diff --git a/src/lepton/CMakeLists.txt b/src/lepton/CMakeLists.txt new file mode 100644 index 0000000000..02ee3885e1 --- /dev/null +++ b/src/lepton/CMakeLists.txt @@ -0,0 +1,18 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "lepton") +#Note that the macros here require this directory added as a subdir of plumed/src +set(module_${module_name} ON CACHE INTERNAL "always active module ${module_name}") +ADDMODULETOKERNEL(${module_name} +CompiledExpression.cpp +ExpressionProgram.cpp +ExpressionTreeNode.cpp +Operation.cpp +ParsedExpression.cpp +Parser.cpp +) +ADDMODULENEEDS(${module_name} + asmjit +) +ADDMODULEDEPENDENCIES(${module_name} + asmjit +) diff --git a/src/logmfd/.gitignore b/src/logmfd/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/logmfd/.gitignore +++ b/src/logmfd/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/logmfd/CMakeLists.txt b/src/logmfd/CMakeLists.txt new file mode 100644 index 0000000000..86114033e8 --- /dev/null +++ b/src/logmfd/CMakeLists.txt @@ -0,0 +1,13 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "logmfd") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +LogMFD.cpp +) +ADDMODULENEEDS(${module_name} + core tools bias +) +ADDMODULEDEPENDENCIES(${module_name} + bias #tools core +) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt new file mode 100644 index 0000000000..5d6fc8d30f --- /dev/null +++ b/src/main/CMakeLists.txt @@ -0,0 +1,49 @@ +#this is not a module, this is set up to make easier the dependency interface +set(module_name main) +set(module_${module_name} ON CACHE INTERNAL "always active core module ${module_name}") + +#dynamically linked plumed +#$(PLUMED_MAIN_SHARED): $(OBJ_MAIN) $(OBJ_WRAPPER) $(PLUMED_KERNEL) +add_executable(plumed_bin main.cpp)#OBJ_MAIN +target_link_libraries(plumed_bin PUBLIC + sharedplumedKernel #PLUMED_KERNEL + PlumedStaticWrapper #OBJ_WRAPPER + ) +set_target_properties(plumed_bin + PROPERTIES RUNTIME_OUTPUT_NAME ${program_name} + ) +target_include_directories(plumed_bin PRIVATE ${PLUMED_SRC}) +#statically linked plumed +#$(PLUMED_MAIN_STATIC): $(OBJ_MAIN) $(OBJ_KERNEL) $(OBJ_WRAPPER) +add_executable(plumed_bin_static main.cpp) #$(OBJ_MAIN) +target_link_libraries(plumed_bin_static PUBLIC + PlumedStaticWrapper #$(OBJ_WRAPPER) + archiveplumedKernel + #${modulesForKernel} #$(OBJ_KERNEL) + #Config #extra options (are within OBJ_KERNEL in original Makefile) +) +set_target_properties(plumed_bin_static + PROPERTIES RUNTIME_OUTPUT_NAME ${program_name}-static + ) +target_include_directories(plumed_bin_static PRIVATE ${PLUMED_SRC}) +#runtime linked plumed +#$(PLUMED_MAIN_RUNTIME): $(OBJ_MAIN) $(OBJ_DYNAMIC_WRAPPER) +add_executable(plumed_bin_runtime main.cpp) +target_link_libraries(plumed_bin_runtime + PUBLIC + PlumedDynamicWrapper #OBJ_DYNAMIC_WRAPPER + ) +set_target_properties(plumed_bin_runtime + PROPERTIES RUNTIME_OUTPUT_NAME ${program_name}-runtime + ) +target_include_directories(plumed_bin_runtime PRIVATE ${PLUMED_SRC}) + +#consider adding install manifest: +#install(CODE "string(REPLACE \";\" \"\\n\" MY_CMAKE_INSTALL_MANIFEST_CONTENT \"\$\{CMAKE_INSTALL_MANIFEST_FILES\}\")\n\ +# file(WRITE my_install_manifest.txt \"\$\{MY_CMAKE_INSTALL_MANIFEST_CONTENT\}\")") +#thanks https://stackoverflow.com/a/66804151 + + +#installation +#here there is an exampe ot multiple installation positions +#https://cmake.org/cmake/help/v3.2/command/install.html#installing-targets diff --git a/src/maketools/makecmd_cmake b/src/maketools/makecmd_cmake new file mode 100644 index 0000000000..11bb8375a9 --- /dev/null +++ b/src/maketools/makecmd_cmake @@ -0,0 +1,5 @@ +#! /usr/bin/env bash +#workaround to call makecmd with add_custom_command +SCRIPTPATH=$(dirname "$(realpath -s "$0")") + +${SCRIPTPATH}/makecmd "$1" < "$2" > "$3" \ No newline at end of file diff --git a/src/manyrestraints/.gitignore b/src/manyrestraints/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/manyrestraints/.gitignore +++ b/src/manyrestraints/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/manyrestraints/CMakeLists.txt b/src/manyrestraints/CMakeLists.txt new file mode 100644 index 0000000000..dcd8c54097 --- /dev/null +++ b/src/manyrestraints/CMakeLists.txt @@ -0,0 +1,15 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "manyrestraints") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +LWalls.cpp +ManyRestraintsBase.cpp +UWalls.cpp +) +ADDMODULENEEDS(${module_name} + core tools vesselbase +) +ADDMODULEDEPENDENCIES(${module_name} + vesselbase #bias tools core +) diff --git a/src/mapping/.gitignore b/src/mapping/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/mapping/.gitignore +++ b/src/mapping/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/mapping/CMakeLists.txt b/src/mapping/CMakeLists.txt new file mode 100644 index 0000000000..5a173fae9e --- /dev/null +++ b/src/mapping/CMakeLists.txt @@ -0,0 +1,25 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "mapping") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +AdaptivePath.cpp +Mapping.cpp +PathBase.cpp +Path.cpp +PathReparameterization.cpp +PathTools.cpp +PCAVars.cpp +PropertyMap.cpp +SpathVessel.cpp +TrigonometricPathVessel.cpp +ZpathVessel.cpp +) +ADDMODULENEEDS(${module_name} + core tools cltools reference vesselbase +) +ADDMODULEDEPENDENCIES(${module_name} + cltools #tools core + reference #tools core + vesselbase #tools core +) diff --git a/src/maze/.gitignore b/src/maze/.gitignore index b920aee1b1..97db3530c8 100644 --- a/src/maze/.gitignore +++ b/src/maze/.gitignore @@ -9,3 +9,4 @@ !/README.md !/module.type !/COPYRIGHT +!/CMakeLists.txt diff --git a/src/maze/CMakeLists.txt b/src/maze/CMakeLists.txt new file mode 100644 index 0000000000..7c5ceaebe0 --- /dev/null +++ b/src/maze/CMakeLists.txt @@ -0,0 +1,25 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "maze") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +Core.cpp +Loss.cpp +Member.cpp +Memetic.cpp +Optimizer_Bias.cpp +Optimizer.cpp +Random_Acceleration_MD.cpp +Random_MT.cpp +Random_Walk.cpp +Simulated_Annealing.cpp +Steered_MD.cpp +Tools.cpp +) +ADDMODULENEEDS(${module_name} + core tools colvar bias +) +ADDMODULEDEPENDENCIES(${module_name} + colvar #tools core + bias #tools core +) diff --git a/src/membranefusion/.gitignore b/src/membranefusion/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/membranefusion/.gitignore +++ b/src/membranefusion/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/membranefusion/CMakeLists.txt b/src/membranefusion/CMakeLists.txt new file mode 100644 index 0000000000..dfbaf9a820 --- /dev/null +++ b/src/membranefusion/CMakeLists.txt @@ -0,0 +1,15 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "membranefusion") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +FusionPoreExpansionP.cpp +FusionPoreNucleationP.cpp +MemFusionP.cpp +) +ADDMODULENEEDS(${module_name} + core reference tools colvar +) +ADDMODULEDEPENDENCIES(${module_name} + colvar #reference tools core +) diff --git a/src/molfile/CMakeLists.txt b/src/molfile/CMakeLists.txt new file mode 100644 index 0000000000..04446ce989 --- /dev/null +++ b/src/molfile/CMakeLists.txt @@ -0,0 +1,31 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "molfile") +string(TOUPPER ${module_name} externalLib) +#Note that the macros here require this directory added as a subdir of plumed/src +option(useExternal_${module_name} "enable search for external ${module_name}, default OFF" OFF) +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +crdplugin.cpp +dcdplugin.cpp +gromacsplugin.cpp +pdbplugin.cpp +) +# to find external molfile +list(APPEND CMAKE_MODULE_PATH "${PLUMED_SRC}/cmake") +#ADDMODULENEEDS(${module_name} +# +#) + +#The following lines should mimic the following line +#CPPFLAGS+=-DSTATIC_PLUGIN -DVMDPLUGIN=molfile_$(patsubst %.o,%,$@) +target_compile_definitions(${module_name} PRIVATE STATIC_PLUGIN) +get_target_property(MY_PROJECT_SOURCES ${module_name} SOURCES) +foreach(sourcefile ${MY_PROJECT_SOURCES}) + string(REPLACE ".cpp" "" simpleName ${sourcefile}) + set_source_files_properties(${sourcefile} + PROPERTIES COMPILE_DEFINITIONS VMDPLUGIN=molfile_${simpleName}) + +endforeach(sourcefile in ${MY_PROJECT_SOURCES}) + +#this should propagate the compile definition to the main +target_compile_definitions(${module_name} PUBLIC __PLUMED_HAS_MOLFILE_PLUGINS) \ No newline at end of file diff --git a/src/multicolvar/.gitignore b/src/multicolvar/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/multicolvar/.gitignore +++ b/src/multicolvar/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/multicolvar/CMakeLists.txt b/src/multicolvar/CMakeLists.txt new file mode 100644 index 0000000000..b3efda7305 --- /dev/null +++ b/src/multicolvar/CMakeLists.txt @@ -0,0 +1,49 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "multicolvar") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +ActionVolume.cpp +AlphaBeta.cpp +Angles.cpp +AtomValuePack.cpp +Bridge.cpp +BridgedMultiColvarFunction.cpp +CatomPack.cpp +CenterOfMultiColvar.cpp +CoordinationNumbers.cpp +Density.cpp +DihedralCorrelation.cpp +DistanceFromContour.cpp +Distances.cpp +DumpMultiColvar.cpp +FilterBetween.cpp +FilterLessThan.cpp +FilterMoreThan.cpp +InPlaneDistances.cpp +LocalAverage.cpp +MultiColvarBase.cpp +MultiColvarCombine.cpp +MultiColvarDensity.cpp +MultiColvarFilter.cpp +MultiColvarProduct.cpp +NumberOfLinks.cpp +Torsions.cpp +VolumeAround.cpp +VolumeBetweenContours.cpp +VolumeCavity.cpp +VolumeGradientBase.cpp +VolumeInCylinder.cpp +VolumeInSphere.cpp +VolumeTetrapore.cpp +XAngle.cpp +XDistances.cpp +XYDistances.cpp +XYTorsion.cpp +) +ADDMODULENEEDS(${module_name} + core tools vesselbase gridtools +) +ADDMODULEDEPENDENCIES(${module_name} + gridtools #vesselbase bias tools core +) diff --git a/src/opes/.gitignore b/src/opes/.gitignore index d22daff42d..d8cc7be903 100644 --- a/src/opes/.gitignore +++ b/src/opes/.gitignore @@ -9,3 +9,4 @@ !/COPYRIGHT !/module.type !/postprocessing +!/CMakeLists.txt diff --git a/src/opes/CMakeLists.txt b/src/opes/CMakeLists.txt new file mode 100644 index 0000000000..e91ba69ecf --- /dev/null +++ b/src/opes/CMakeLists.txt @@ -0,0 +1,21 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "opes") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +ECVcustom.cpp +ECVlinear.cpp +ECVmultiThermalBaric.cpp +ECVmultiThermal.cpp +ECVumbrellasFile.cpp +ECVumbrellasLine.cpp +ExpansionCVs.cpp +OPESexpanded.cpp +OPESmetad.cpp +) +ADDMODULENEEDS(${module_name} + bias core tools +) +ADDMODULEDEPENDENCIES(${module_name} + bias #tools core +) diff --git a/src/pamm/.gitignore b/src/pamm/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/pamm/.gitignore +++ b/src/pamm/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/pamm/CMakeLists.txt b/src/pamm/CMakeLists.txt new file mode 100644 index 0000000000..be8a6fe0b2 --- /dev/null +++ b/src/pamm/CMakeLists.txt @@ -0,0 +1,17 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "pamm") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +HBPammHydrogens.cpp +HBPammMatrix.cpp +HBPammObject.cpp +PAMM.cpp +PammObject.cpp +) +ADDMODULENEEDS(${module_name} + core tools vesselbase multicolvar adjmat +) +ADDMODULEDEPENDENCIES(${module_name} + adjmat #multicolvar vesselbase bias tools core +) diff --git a/src/piv/.gitignore b/src/piv/.gitignore index b920aee1b1..97db3530c8 100644 --- a/src/piv/.gitignore +++ b/src/piv/.gitignore @@ -9,3 +9,4 @@ !/README.md !/module.type !/COPYRIGHT +!/CMakeLists.txt diff --git a/src/piv/CMakeLists.txt b/src/piv/CMakeLists.txt new file mode 100644 index 0000000000..4d5a1d87e3 --- /dev/null +++ b/src/piv/CMakeLists.txt @@ -0,0 +1,14 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "piv") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +PIV.cpp +) +ADDMODULENEEDS(${module_name} + core tools bias colvar +) +ADDMODULEDEPENDENCIES(${module_name} + colvar #tools core + bias #tools core +) diff --git a/src/pytorch/.gitignore b/src/pytorch/.gitignore index d22daff42d..d8cc7be903 100644 --- a/src/pytorch/.gitignore +++ b/src/pytorch/.gitignore @@ -9,3 +9,4 @@ !/COPYRIGHT !/module.type !/postprocessing +!/CMakeLists.txt diff --git a/src/pytorch/CMakeLists.txt b/src/pytorch/CMakeLists.txt new file mode 100644 index 0000000000..c05b7ef52d --- /dev/null +++ b/src/pytorch/CMakeLists.txt @@ -0,0 +1,13 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "pytorch") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +PytorchModel.cpp +) +ADDMODULENEEDS(${module_name} + core function +) +ADDMODULEDEPENDENCIES(${module_name} + function #reference tools core lepton +) diff --git a/src/reference/.gitignore b/src/reference/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/reference/.gitignore +++ b/src/reference/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/reference/CMakeLists.txt b/src/reference/CMakeLists.txt new file mode 100644 index 0000000000..99ed09767d --- /dev/null +++ b/src/reference/CMakeLists.txt @@ -0,0 +1,32 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "reference") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +ArgumentOnlyDistance.cpp +Direction.cpp +DotProductDistance.cpp +DRMSD.cpp +EuclideanDistance.cpp +FakeFrame.cpp +IntermolecularDRMSD.cpp +IntramolecularDRMSD.cpp +MahalanobisDistance.cpp +MetricRegister.cpp +MultiDomainRMSD.cpp +NormalizedEuclideanDistance.cpp +OptimalRMSD.cpp +ReferenceArguments.cpp +ReferenceAtoms.cpp +ReferenceConfiguration.cpp +ReferenceValuePack.cpp +RMSDBase.cpp +SimpleRMSD.cpp +SingleDomainRMSD.cpp +) +ADDMODULENEEDS(${module_name} + core tools +) +ADDMODULEDEPENDENCIES(${module_name} + core #tools +) diff --git a/src/s2cm/.gitignore b/src/s2cm/.gitignore index fccfac3dd0..ad9c181bc0 100644 --- a/src/s2cm/.gitignore +++ b/src/s2cm/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/COPYRIGHT !/module.type +!/CMakeLists.txt diff --git a/src/s2cm/CMakeLists.txt b/src/s2cm/CMakeLists.txt new file mode 100644 index 0000000000..0106d72ed7 --- /dev/null +++ b/src/s2cm/CMakeLists.txt @@ -0,0 +1,13 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "s2cm") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +S2ContactModel.cpp +) +ADDMODULENEEDS(${module_name} + core tools colvar +) +ADDMODULEDEPENDENCIES(${module_name} + colvar #tools core +) diff --git a/src/sasa/.gitignore b/src/sasa/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/sasa/.gitignore +++ b/src/sasa/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/sasa/CMakeLists.txt b/src/sasa/CMakeLists.txt new file mode 100644 index 0000000000..1ef887148f --- /dev/null +++ b/src/sasa/CMakeLists.txt @@ -0,0 +1,15 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "sasa") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +Sasa.cpp +sasa_HASEL.cpp +sasa_LCPO.cpp +) +ADDMODULENEEDS(${module_name} + core tools config +) +ADDMODULEDEPENDENCIES(${module_name} + core #tools #config +) diff --git a/src/secondarystructure/.gitignore b/src/secondarystructure/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/secondarystructure/.gitignore +++ b/src/secondarystructure/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/secondarystructure/CMakeLists.txt b/src/secondarystructure/CMakeLists.txt new file mode 100644 index 0000000000..a03b05b0e2 --- /dev/null +++ b/src/secondarystructure/CMakeLists.txt @@ -0,0 +1,17 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "secondarystructure") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +AlphaRMSD.cpp +AntibetaRMSD.cpp +ParabetaRMSD.cpp +SecondaryStructureRMSD.cpp +) +ADDMODULENEEDS(${module_name} + core tools reference vesselbase +) +ADDMODULEDEPENDENCIES(${module_name} + #reference#tools core + vesselbase #analisys tools core reference +) diff --git a/src/setup/.gitignore b/src/setup/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/setup/.gitignore +++ b/src/setup/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/setup/CMakeLists.txt b/src/setup/CMakeLists.txt new file mode 100644 index 0000000000..e3872afc70 --- /dev/null +++ b/src/setup/CMakeLists.txt @@ -0,0 +1,15 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "setup") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +Load.cpp +Restart.cpp +Units.cpp +) +ADDMODULENEEDS(${module_name} + core tools +) +ADDMODULEDEPENDENCIES(${module_name} + core #tools +) diff --git a/src/tools/.gitignore b/src/tools/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/tools/.gitignore +++ b/src/tools/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt new file mode 100644 index 0000000000..847b8e9b70 --- /dev/null +++ b/src/tools/CMakeLists.txt @@ -0,0 +1,62 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "tools") +#Note that the macros here require this directory added as a subdir of plumed/src +set(module_${module_name} ON CACHE INTERNAL "always active module ${module_name}") +ADDMODULETOKERNEL(${module_name} +Angle.cpp +AtomNumber.cpp +BiasRepresentation.cpp +Brent1DRootSearch.cpp +Citations.cpp +Communicator.cpp +ConjugateGradient.cpp +DLLoader.cpp +DynamicList.cpp +ERMSD.cpp +Exception.cpp +FileBase.cpp +ForwardDecl.cpp +Grid.cpp +h36.cpp +HistogramBead.cpp +IFile.cpp +KernelFunctions.cpp +Keywords.cpp +LatticeReduction.cpp +LinkCells.cpp +Log.cpp +LoopUnroller.cpp +Matrix.cpp +MatrixSquareBracketsAccess.cpp +Minimise1DBrent.cpp +MinimiseBase.cpp +MolDataClass.cpp +MultiValue.cpp +NeighborList.cpp +OFile.cpp +OpenMP.cpp +Pbc.cpp +PDB.cpp +PlumedHandle.cpp +Random.cpp +RMSD.cpp +RootFindingBase.cpp +Stopwatch.cpp +Subprocess.cpp +SwitchingFunction.cpp +Tensor.cpp +Tools.cpp +Torsion.cpp +Tree.cpp +TypesafePtr.cpp +Units.cpp +Vector.cpp +) +ADDMODULENEEDS(${module_name} + core lapack lepton +) +ADDMODULEDEPENDENCIES(${module_name} + lapack #blas + lepton + config +) diff --git a/src/vatom/.gitignore b/src/vatom/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/vatom/.gitignore +++ b/src/vatom/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/vatom/CMakeLists.txt b/src/vatom/CMakeLists.txt new file mode 100644 index 0000000000..a366a06394 --- /dev/null +++ b/src/vatom/CMakeLists.txt @@ -0,0 +1,16 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "vatom") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +ActionWithVirtualAtom.cpp +Center.cpp +FixedAtom.cpp +Ghost.cpp +) +ADDMODULENEEDS(${module_name} + core tools +) +ADDMODULEDEPENDENCIES(${module_name} + core #tools +) diff --git a/src/ves/.gitignore b/src/ves/.gitignore index 3dcf47bc7b..197c9dd0bd 100644 --- a/src/ves/.gitignore +++ b/src/ves/.gitignore @@ -9,3 +9,4 @@ !/COPYRIGHT !/PEOPLE-VES !/module.type +!/CMakeLists.txt diff --git a/src/ves/CMakeLists.txt b/src/ves/CMakeLists.txt new file mode 100644 index 0000000000..b3d415f546 --- /dev/null +++ b/src/ves/CMakeLists.txt @@ -0,0 +1,69 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "ves") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" OFF) +ADDMODULETOKERNEL(${module_name} +BasisFunctions.cpp +BF_Chebyshev.cpp +BF_Combined.cpp +BF_Cosine.cpp +BF_CubicBsplines.cpp +BF_Custom.cpp +BF_Fourier.cpp +BF_Gaussians.cpp +BF_Legendre.cpp +BF_Powers.cpp +BF_Sine.cpp +BF_Wavelets.cpp +CoeffsBase.cpp +CoeffsMatrix.cpp +CoeffsVector.cpp +FermiSwitchingFunction.cpp +GridIntegrationWeights.cpp +GridLinearInterpolation.cpp +GridProjWeights.cpp +LinearBasisSetExpansion.cpp +MD_LinearExpansionPES.cpp +Opt_Adam.cpp +Opt_BachAveragedSGD.cpp +Opt_Dummy.cpp +Optimizer.cpp +Opt_RobbinsMonroSGD.cpp +OutputBasisFunctions.cpp +OutputFesBias.cpp +OutputTargetDistribution.cpp +TargetDistModifer.cpp +TargetDistribution.cpp +TD_Chi.cpp +TD_ChiSquared.cpp +TD_Custom.cpp +TD_Exponential.cpp +TD_ExponentiallyModifiedGaussian.cpp +TD_Gaussian.cpp +TD_GeneralizedExtremeValue.cpp +TD_GeneralizedNormal.cpp +TD_Grid.cpp +TD_LinearCombination.cpp +TD_Multicanonical.cpp +TD_MultithermalMultibaric.cpp +TD_ProductCombination.cpp +TD_ProductDistribution.cpp +TD_Uniform.cpp +TD_VonMises.cpp +TD_WellTempered.cpp +VesBias.cpp +VesDeltaF.cpp +VesLinearExpansion.cpp +VesTools.cpp +WaveletCoeffs.cpp +WaveletGrid.cpp +) +ADDMODULENEEDS(${module_name} + bias cltools colvar config core tools lepton +) +ADDMODULEDEPENDENCIES(${module_name} + #tools #lepton + cltools #config + colvar #tools core + bias #tools core +) diff --git a/src/vesselbase/.gitignore b/src/vesselbase/.gitignore index 4888552338..7a6d8238fd 100644 --- a/src/vesselbase/.gitignore +++ b/src/vesselbase/.gitignore @@ -7,3 +7,4 @@ !/Makefile !/README !/module.type +!/CMakeLists.txt diff --git a/src/vesselbase/CMakeLists.txt b/src/vesselbase/CMakeLists.txt new file mode 100644 index 0000000000..59a1c11cad --- /dev/null +++ b/src/vesselbase/CMakeLists.txt @@ -0,0 +1,36 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "vesselbase") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +ActionWithAveraging.cpp +ActionWithInputVessel.cpp +ActionWithVessel.cpp +AltMin.cpp +AveragingVessel.cpp +Between.cpp +BridgeVessel.cpp +FunctionVessel.cpp +Highest.cpp +Histogram.cpp +LessThan.cpp +Lowest.cpp +Max.cpp +Mean.cpp +Min.cpp +Moments.cpp +MoreThan.cpp +OrderingVessel.cpp +ShortcutVessel.cpp +StoreDataVessel.cpp +Sum.cpp +ValueVessel.cpp +Vessel.cpp +VesselRegister.cpp +) +ADDMODULENEEDS(${module_name} + core tools bias analysis +) +ADDMODULEDEPENDENCIES(${module_name} + analysis #bias tools core +) diff --git a/src/wrapper/CMakeLists.txt b/src/wrapper/CMakeLists.txt new file mode 100644 index 0000000000..11c80110df --- /dev/null +++ b/src/wrapper/CMakeLists.txt @@ -0,0 +1,13 @@ +set(module_name wrapper) +#this is not a module, this is set up to make easier the dependency interface +set(module_${module_name} ON CACHE INTERNAL "always active core module ${module_name}") +add_library(PlumedStaticWrapper OBJECT PlumedStatic.cpp) +add_library(PlumedDynamicWrapper OBJECT Plumed.c) +foreach(lib PlumedStaticWrapper PlumedDynamicWrapper) + target_link_libraries(${lib} PUBLIC config) +endforeach(lib PlumedStaticWrapper PlumedDynamicWrapper) + + +#add here the lib so and the lib static for Plumed.so and PlumedKernel.so +#find a way to add all the activated libraries here or add them to tha main CMakeList.txt? +#Then cmake should short all the mess for you, hopefully \ No newline at end of file diff --git a/src/xdrfile/.gitignore b/src/xdrfile/.gitignore index 64daaf4527..3ea3aefd38 100644 --- a/src/xdrfile/.gitignore +++ b/src/xdrfile/.gitignore @@ -9,3 +9,4 @@ !/module.type !/COPYRIGHT !/import.sh +!/CMakeLists.txt diff --git a/src/xdrfile/CMakeLists.txt b/src/xdrfile/CMakeLists.txt new file mode 100644 index 0000000000..ec1e759de9 --- /dev/null +++ b/src/xdrfile/CMakeLists.txt @@ -0,0 +1,9 @@ +#the variable module_name is set up as a sugar to reduce "copy-paste" errors +set (module_name "xdrfile") +#Note that the macros here require this directory added as a subdir of plumed/src +option(module_${module_name} "activate module ${module_name}" ON) +ADDMODULETOKERNEL(${module_name} +xdrfile.cpp +xdrfile_trr.cpp +xdrfile_xtc.cpp +)