forked from takkaO/OpenFontRender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Export_CMakeLists.sh
46 lines (38 loc) · 1.32 KB
/
Export_CMakeLists.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
42
43
44
45
46
#!/bin/bash
# -------------------------------------------------------
# Export_CMakeLists.sh
#
# Copyright (c) 2022 takkaO
#
# If you use, modify, or redistribute this file independently
# of the original repository, this program is licensed under
# the MIT License.
#
# If you use, modify or redistribute this file as part of
# the original repository, please follow the repository's license.
#
# -------------------------------------------------------
echo "** Start create CMakeLists.txt **"
## Clean CMakeLists.txt
echo "Processing clear old CMakeLists.txt"
echo -e "# This file was automatically created by \"Export_CMakeLists\" script.\n" > CMakeLists.txt
## Search source files
echo "Processing search C/C++ source files"
lst=$(find "./src" -type f -name "*.c" -or -name "*.cpp")
echo "set(srcs " >> CMakeLists.txt
for f in $lst; do
# Space for indent
echo " "\"$f\" >> CMakeLists.txt
done
echo ")" >> CMakeLists.txt
## Search include directory
echo "Processing search include directories"
lst=$(find "./src" -type d)
echo "idf_component_register(SRCS \${srcs}" >> CMakeLists.txt
echo " INCLUDE_DIRS " >> CMakeLists.txt
for f in $lst; do
# Space for indent
echo " "\"$f\" >> CMakeLists.txt
done
echo ")" >> CMakeLists.txt
echo "** Finish create CMakeLists.txt **"