-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_project.sh
41 lines (31 loc) · 1019 Bytes
/
create_project.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
if [ -z "$1" ]; then
echo "usage: create_project.sh \$name"
exit 1
fi
name=${1/_PROJECT/}
ls .. | grep -q "${name}" && echo "project already exist" && exit 1
cp -r projects/project_template ../$name
sed -i "s/project_template/$name/g" ../$name/CMakeLists.txt
mv -v ../$name/functions_project_template.hpp ../$name/functions_$name.hpp
mv -v ../$name/functions_project_template.cpp ../$name/functions_$name.cpp
mv -v ../$name/project_template.cpp ../$name/$name.cpp
sed -i "s/project_template/$name/g" ../$name/functions_$name.hpp
sed -i "s/project_template/$name/g" ../$name/functions_$name.cpp
sed -i "s/project_template/$name/g" ../$name/$name.cpp
mkdir ../$name/build
here=$(pwd)
cat > ../$name/build/do_cmake.sh << EOF
cmake -DCMAKE_PREFIX_PATH=${here}/build/install_dir \\
-DCMAKE_CXX_FLAGS="-g -O2 -fopenmp" \\
-DWITH_ARB=OFF \\
$2 \\
..
EOF
cat > ../$name/build/make_both.sh << EOF
cd ${here}/build
make && make install
cd -
make
EOF
cp .gitignore ../$name/