-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use import.sh to vendor code from vesin
- Loading branch information
Showing
4 changed files
with
183 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
path=$1 | ||
|
||
if (($# != 1)) ; then | ||
echo "usage: $0 /path/to/vesin" | ||
echo | ||
echo "All the commands to run:" | ||
echo " cd /some/dir/" | ||
echo " git clone https://github.com/luthaf/vesin" | ||
echo " cd /your/plumed2/src/metatensor" | ||
echo " ./import.sh /some/dir/vesin" | ||
exit 0 | ||
fi | ||
|
||
bash -c "$path/create-single-cpp.py > /dev/null" | ||
|
||
cp $path/include/vesin.h vesin.h | ||
mv vesin-single-build.cpp vesin.cpp | ||
|
||
# Patch files to follow PLUMED linter | ||
sed 's|#define VESIN_H|#define VESIN_H\n/*INDENT-OFF*/\n| | ||
s|VESIN_H|__PLUMED_metatensor_vesin_h|g | ||
s|<stddef.h>|<cstddef>| | ||
s|<stdint.h>|<cstdint>| | ||
s|extern "C" {|namespace PLMD {\nnamespace metatensor {\nnamespace vesin {\nextern "C" {| | ||
s|} // extern "C"|} // extern "C"\n} // namespace vesin\n} // namespace metatensor\n} // namespace PLMD| | ||
' vesin.h > tmp | ||
mv tmp vesin.h | ||
|
||
sed '1 s|^|/*INDENT-OFF*/\n#include "vesin.h"\n| | ||
s|<stddef.h>|<cstddef>| | ||
s|<stdint.h>|<cstdint>| | ||
s|vesin::|PLMD::metatensor::vesin::| | ||
s|namespace vesin {|namespace PLMD {\nnamespace metatensor {\nnamespace vesin {| | ||
s|} // namespace vesin|} // namespace vesin\n} // namespace metatensor\n} // namespace PLMD| | ||
s|using namespace PLMD::metatensor::vesin::cpu;|using namespace PLMD::metatensor::vesin;\nusing namespace PLMD::metatensor::vesin::cpu;| | ||
' vesin.cpp > tmp | ||
mv tmp vesin.cpp | ||
|
||
cd .. | ||
./header.sh metatensor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.