Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake #934

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft

Cmake #934

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
22fe1d6
starting to add cmake compilation
Iximiel May 2, 2023
81a9ef4
dded findblas and findlapack
Iximiel May 2, 2023
326cf0c
now blas/lapack research works easier
Iximiel May 2, 2023
2a89c5e
added all_modules
Iximiel May 2, 2023
379dfa9
trying to add the "main" plumed directories
Iximiel May 2, 2023
ccb6300
updated gitignores
Iximiel May 3, 2023
a4ff2ef
making some progresses
Iximiel May 3, 2023
3ba4365
autogenerated the CMakeLists.txt for all the noncore modules
Iximiel May 3, 2023
ee2d521
attacking the non standard makefiles
Iximiel May 3, 2023
67d09e6
working on setting up better cltools
Iximiel May 3, 2023
177963b
cltools now should work
Iximiel May 4, 2023
e05e601
small workaround to have target and libraries with the same name
Iximiel May 4, 2023
d252d1b
now also core should work
Iximiel May 4, 2023
a043f10
Now also molfile should be compiled correctly
Iximiel May 4, 2023
b992859
better module depenency set up
Iximiel May 4, 2023
1e6e3e9
working on molfile
Iximiel May 4, 2023
7a2e49e
cosmetic change in cmakefiles
Iximiel May 4, 2023
6d77e8e
cosmetic change in cmakefiles
Iximiel May 4, 2023
a7302cb
Merge branch 'cmake' of https://github.com/Iximiel/plumed2 into cmake
Iximiel May 4, 2023
f8ba2fa
reorganized the main CmakeFile
Iximiel May 5, 2023
f98f8f2
working with dependencies
Iximiel May 5, 2023
23e754f
better way to define fPIC
Iximiel May 5, 2023
8057438
on the way of the compilation
Iximiel May 5, 2023
b0c25d2
set up blas and lapack
Iximiel May 8, 2023
0aad386
added dependencies to the modules
Iximiel May 8, 2023
eb28dc1
removed circular dependencies
Iximiel May 8, 2023
d2bc2ed
added target interface module config to pass options
Iximiel May 8, 2023
f1253af
dienstangled the depenedency net
Iximiel May 8, 2023
63ca38e
remove some other duplicated dependencies
Iximiel May 8, 2023
4ac3f5c
some cosmetic changes
Iximiel May 8, 2023
fed659e
it compiles :D
Iximiel May 9, 2023
c2ddbfa
compiles and runs :D
Iximiel May 9, 2023
7d3bd99
small tweaks in dependencies and move warning explanations
Iximiel May 9, 2023
2343dd1
now plumed-static compile exacly like in the original
Iximiel May 9, 2023
e41baaf
small rationalization of Config
Iximiel May 10, 2023
7ecfe58
It works, there are only ~80 options to implement now
Iximiel May 10, 2023
3613643
F77_NO_UNDERSCORE now should activate automagically
Iximiel May 10, 2023
a111720
changed where the cmake_module_path is
Iximiel May 11, 2023
7812192
removed the message about atomatically generated files where I modifi…
Iximiel May 11, 2023
922eb63
added createCMakeLists.sh to src, maybe moved
Iximiel May 11, 2023
56ea9e9
added zlib
Iximiel May 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ makefile.dep
/config.*
/autom4*
/stamp-h
build
29 changes: 29 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
!/s2cm
!/pytorch
!/membranefusion
!CMakeLists.txt

# And just ignore these files
*.xxd
Expand Down
344 changes: 344 additions & 0 deletions src/CMakeLists.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/adjmat/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
!/Makefile
!/README
!/module.type
!/CMakeLists.txt
37 changes: 37 additions & 0 deletions src/adjmat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
1 change: 1 addition & 0 deletions src/analysis/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
!/Makefile
!/README
!/module.type
!/CMakeLists.txt
35 changes: 35 additions & 0 deletions src/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
1 change: 1 addition & 0 deletions src/annfunc/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ core/**
deps/**
function/**
*.o
!/CMakeLists.txt
13 changes: 13 additions & 0 deletions src/annfunc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
42 changes: 42 additions & 0 deletions src/asmjit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}

)
1 change: 1 addition & 0 deletions src/bias/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
!/Makefile
!/README
!/module.type
!/CMakeLists.txt
29 changes: 29 additions & 0 deletions src/bias/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
1 change: 1 addition & 0 deletions src/blas/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
!/Makefile
!/README
!/module.type
!/CMakeLists.txt
65 changes: 65 additions & 0 deletions src/blas/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 <resultVar>. Every subsequent CMake run will re-use
#this cached value rather than performing the check again, even if the
#<code> changes. In order to force the check to be re-evaluated, the
#variable named by <resultVar> 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)
14 changes: 7 additions & 7 deletions src/blas/blas.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,22 @@ 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{
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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/blas/def_external.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/blas/def_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/cltools/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
!/README
!/module.type
!/*.sh
!/CMakeLists.txt
Loading