1212
1313jobs :
1414 build :
15- # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
16- # You can convert this to a matrix build if you need cross-platform coverage.
17- # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
1815 runs-on : ubuntu-latest
1916
2017 strategy :
8077 - name : Configure CMake
8178 # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
8279 # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
83- run : CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=${{matrix.cpu}}
80+ run : CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=${{matrix.cpu}} -Wno-dev
8481
8582 - name : Build
8683 # Build your program with the given configuration
9895 ${{github.workspace}}/build/project/klib.memory
9996 ${{github.workspace}}/build/project/klib.hex
10097 ${{github.workspace}}/build/project/klib.bin
101- ${{github.workspace}}/targets/chip/${{matrix.cpu}}/${{matrix.cpu}}.h
98+ ${{github.workspace}}/targets/chip/${{matrix.cpu}}/${{matrix.cpu}}.h
99+
100+ individual-header-build :
101+ name : Build each header individually
102+ runs-on : ubuntu-latest
103+ steps :
104+ - uses : actions/checkout@v4
105+
106+ - name : arm-none-eabi-gcc install
107+ uses : carlosperate/arm-none-eabi-gcc-action@v1.10.1
108+ with :
109+ release : ' 13.2.Rel1'
110+
111+ - name : arm-none-eabi-gcc version
112+ run : arm-none-eabi-gcc --version
113+
114+ - name : getting arm headers
115+ uses : actions/checkout@v4
116+ with :
117+ repository : ARM-software/CMSIS_5
118+ ref : ' develop'
119+ fetch-depth : ' 1'
120+ path : ' ./CMSIS'
121+
122+ - name : moving arm headers
123+ run : |
124+ cp ${{github.workspace}}/CMSIS/CMSIS/Core/Include/* ${{github.workspace}}/targets/arm/
125+
126+ - name : generating header
127+ run : |
128+ mkdir -p ${{github.workspace}}/targets/chip/lpc1756/docs
129+ wget -q -O ${{github.workspace}}/targets/chip/lpc1756/docs/lpc1756.svd https://raw.githubusercontent.com/itzandroidtab/klib-svd/master/lpc1756.svd
130+ wget -q -O ${{github.workspace}}/svdconv.tbz2 https://github.com/Open-CMSIS-Pack/devtools/releases/download/tools%2Fsvdconv%2F3.3.44/svdconv-3.3.44-linux64-amd64.tbz2
131+ tar -xf ${{github.workspace}}/svdconv.tbz2
132+ chmod +x ${{github.workspace}}/svdconv
133+
134+ ${{github.workspace}}/svdconv ${{github.workspace}}/targets/chip/lpc1756/docs/lpc1756.svd --suppress-warnings --generate=header -o ${{github.workspace}}/targets/chip/lpc1756/ || true
135+ sed -i '/#include "system_/d' ${{github.workspace}}/targets/chip/lpc1756/lpc1756.h
136+
137+ - name : Find all header files and build individually
138+ run : |
139+ mkdir -p ${{github.workspace}}/project
140+ HEADER_DIR="${{github.workspace}}/klib/"
141+ BUILD_DIR="${{github.workspace}}/build"
142+
143+ # Find all header files (.hpp and .h)
144+ find "$HEADER_DIR" -type f \( -name "*.hpp" -o -name "*.h" \) | while read header_file; do
145+ # Get a safe name for the build (basename + replace / with _)
146+ header_name=$(basename "$header_file")
147+ safe_name=$(echo "$header_file" | sed 's/[^a-zA-Z0-9]/_/g')
148+
149+ # Create a main.cpp that only includes this header
150+ echo "#include \"${header_file#$HEADER_DIR/}\"" > ${{github.workspace}}/project/main.cpp
151+ echo "int main() { return 0; }" >> ${{github.workspace}}/project/main.cpp
152+ cat ${{github.workspace}}/project/main.cpp
153+
154+ # Optionally: show which header we're building
155+ echo "Building for header: $header_file"
156+
157+ # Configure and build
158+ CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B "$BUILD_DIR/$safe_name" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=lpc1756 -Wno-dev
159+ cmake --build "$BUILD_DIR/$safe_name" --config ${{env.BUILD_TYPE}}
160+ done
0 commit comments