-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetSourceList.sh
More file actions
55 lines (43 loc) · 1.52 KB
/
Copy pathgetSourceList.sh
File metadata and controls
55 lines (43 loc) · 1.52 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
#!/bin/bash
# Run .\getSourceList.sh in terminal to generate an updated list of source for CMake
# Define the path to the source code
APP_PATH='Application/*'
CORE_PATH='Core/*'
DRIVERS_PATH='Drivers/*'
# FATFS_PATH='FATFS/*'
MIDWARE_PATH='Middlewares/*'
# USB_PATH='USB_Device/*'
# Clear the file
> cmake/SourceList.cmake
# Print find result
if [ -n "$APP_PATH" ]; then
APP_SRC="$(eval find "$APP_PATH" -type f -name '*.c' -o -name '*.cpp' -o -name '*.s')"
printf "$APP_SRC\n" >> cmake/SourceList.cmake
fi
if [ -n "$CORE_PATH" ]; then
CORE_SRC="$(eval find "$CORE_PATH" -type f -name '*.c' -o -name '*.cpp' -o -name '*.s')"
printf "$CORE_SRC\n" >> cmake/SourceList.cmake
fi
if [ -n "$DRIVERS_PATH" ]; then
DRIVERS_SRC="$(eval find "$DRIVERS_PATH" -type f -name '*.c')"
printf "$DRIVERS_SRC\n" >> cmake/SourceList.cmake
fi
if [ -n "$FATFS_PATH" ]; then
FATFS_SRC="$(eval find "$FATFS_PATH" -type f -name '*.c')"
printf "$FATFS_SRC\n" >> cmake/SourceList.cmake
fi
if [ -n "$MIDWARE_PATH" ]; then
MIDWARE_SRC="$(eval find "$MIDWARE_PATH" -type f -name '*.c')"
printf "$MIDWARE_SRC\n" >> cmake/SourceList.cmake
fi
if [ -n "$USB_PATH" ]; then
USB_SRC="$(eval find "$USB_PATH" -type f -name '*.c')"
printf "$USB_SRC\n" >> cmake/SourceList.cmake
fi
# Remove Empty Line
sed -i '/./!d' cmake/IncludeList.cmake
# Adding ${PROJ_PATH}/ to beginning of each line
sed -i 's/^/${PROJ_PATH}\//' cmake/SourceList.cmake
# Struct cmake format
sed -i '1 i\set(source_list ${source_list}' cmake/SourceList.cmake
sed -i -e '$a)' cmake/SourceList.cmake