-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
58 lines (44 loc) · 1.17 KB
/
bootstrap.sh
File metadata and controls
58 lines (44 loc) · 1.17 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
#
# Usage:
# ./bootstrap.sh <ProjectName> <NamespaceName>
#
set -e
if [ $# -ne 2 ]; then
echo "Usage: $0 <ProjectName> <NamespaceName>"
exit 1
fi
APP_NAME=$1
APP_NAMESPACE=$2
echo ">>> Generating project '$APP_NAME' with namespace '$APP_NAMESPACE'..."
rm -rf build_bootstrap
mkdir build_bootstrap
cmake -DAPP_NAME="${APP_NAME}" -DAPP_NAMESPACE="${APP_NAMESPACE}" \
-S . -B build_bootstrap
if [ ! -d build_bootstrap/generated ]; then
echo ">>> Error: not found build_bootstrap/generated"
exit 1
fi
mv build_bootstrap/generated "./${APP_NAME}"
if [ -d vcpkg ]; then
echo ">>> Copying vcpkg into ${APP_NAME}..."
cp -R vcpkg "./${APP_NAME}"
else
echo ">>> vcpkg folder not found in current directory, skipping copy."
fi
cd "${APP_NAME}"
git init
git add .
git commit -m "Initial commit of ${APP_NAME} project"
cd ..
echo ">>> Removing template files and build_bootstrap..."
rm -rf build_bootstrap
rm -rf template
rm -rf vcpkg
rm -f bootstrap.CMakeLists.txt
rm -f bootstrap.sh
rm -f bootstrap.bat
rm -f CMakeLists.txt
rm -f LICENSE
echo ">>> Done!"
echo ">>> Folder '${APP_NAME}' is now a standalone C++/CMake/vcpkg project with Git initialized."