diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c8897f6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,74 @@ +name: Clang Build CI + +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_dispatch: + push: + paths: + - '.github/workflows/build.yml' + - 'src/*.c' + - 'src/*.h' + - 'configure.ac' + - 'Makefile.am' + +env: + GCC_ARGS: src/*.c src/*.h -lglfw -lGL -lm -lasound -Iinclude hashmap.c/hashmap.c log.c/src/log.c -DGLFW_INCLUDE_NONE -DGLFW_NATIVE_INCLUDE_NONE + GCC_ARGS_VIDEO: -DGLFW_EXPOSE_NATIVE_EGL -DVIDEO_IN + PACKAGES: "libglfw3-dev libgl-dev libasound2-dev libbsd-dev" + PACKAGES_VIDEO: "libv4l-dev" + TARGET: forge + TEST_ARGS: "--help" + +jobs: + build-release: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES $PACKAGES_VIDEO + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: aclocal + run: aclocal + - name: autoconf + run: autoconf + - name: automake + run: automake --add-missing + - name: configure + run: ./configure + - name: make + run: make + - name: make distcheck + run: make distcheck + + run-no-video: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: gcc + run: mkdir -p build && gcc $GCC_ARGS -o build/$TARGET + - name: run program + run: ./build/$TARGET $TEST_ARGS + + run-video: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES $PACKAGES_VIDEO + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: gcc + run: mkdir -p build && gcc $GCC_ARGS $GCC_ARGS_VIDEO -o build/$TARGET + - name: run program + run: ./build/$TARGET $TEST_ARGS diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index a4aa176..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: C-lang CI - -on: - push: - branches: ["master"] - pull_request: - branches: ["master"] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: install libs - run: sudo apt install -y libglfw3-dev libgl-dev libv4l-dev libasound2-dev libbsd-dev - - name: gcc - run: mkdir -p build && gcc -v -Wall -Wextra -Werror -Wno-format-truncation src/*.c src/*.h -lglfw -lGL -lm -lasound -lbsd -Iinclude hashmap.c/hashmap.c log.c/src/log.c -DGLFW_INCLUDE_NONE -DGLFW_EXPOSE_NATIVE_EGL -DGLFW_NATIVE_INCLUDE_NONE -DVIDEO_IN - - build-no-video: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: install libs - run: sudo apt install -y libglfw3-dev libgl-dev libasound2-dev libbsd-dev - - name: gcc - run: mkdir -p build && gcc -v -Werror src/*.c src/*.h -lglfw -lGL -lm -lasound -lbsd -Iinclude hashmap.c/hashmap.c log.c/src/log.c -DGLFW_INCLUDE_NONE -DGLFW_EXPOSE_NATIVE_EGL -DGLFW_NATIVE_INCLUDE_NONE - - build-release: - needs: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'true' - - name: install libs - run: sudo apt install -y libglfw3-dev libgl-dev libv4l-dev libasound2-dev libbsd-dev - - name: aclocal - run: aclocal - - name: autoconf - run: autoconf - - name: automake - run: automake --add-missing - - name: configure - run: ./configure - - name: make - run: make - - name: make distcheck - run: make distcheck diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..9d826d1 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,44 @@ +name: Clang Lint CI + +concurrency: + group: lint-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_dispatch: + push: + paths: + - '.github/workflows/lint.yml' + - 'src/*.c' + - 'src/*.h' + +env: + GCC_ARGS: src/*.c src/*.h -lglfw -lGL -lm -lasound -Iinclude hashmap.c/hashmap.c log.c/src/log.c -DGLFW_INCLUDE_NONE -DGLFW_NATIVE_INCLUDE_NONE + GCC_ARGS_VIDEO: -DGLFW_EXPOSE_NATIVE_EGL -DVIDEO_IN + PACKAGES: "libglfw3-dev libgl-dev libasound2-dev libbsd-dev" + PACKAGES_VIDEO: "libv4l-dev" + +jobs: + lint-video: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: gcc + run: gcc -v -Wall -Wextra -Werror -Wno-format-truncation -Wunused-parameter $GCC_ARGS + + lint-no-video: + runs-on: ubuntu-latest + steps: + - name: Install packages + run: apt update && apt install -y $PACKAGES $PACKAGES_VIDEO + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: 'true' + - name: gcc + run: gcc -v -Wall -Wextra -Werror -Wno-format-truncation $GCC_ARGS $GCC_ARGS_VIDEO diff --git a/.gitignore b/.gitignore index a689f8a..3ca9a57 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ confdeps.* conftest.* *.txt error.glsl -draft/ \ No newline at end of file +draft/ +*.gch diff --git a/Makefile.dev b/Makefile.dev index e01931c..63ec3c0 100644 --- a/Makefile.dev +++ b/Makefile.dev @@ -25,6 +25,23 @@ build: -o build/$(TARGET) \ -g -Og +.PHONY: build-no-video +build-no-video: + @mkdir -p build + gcc \ + src/*.h src/*.c \ + -Iinclude \ + hashmap.c/hashmap.c \ + log.c/src/log.c \ + -lm -lGL -lglfw -lasound -lbsd \ + -Wall -Wextra \ + -Wno-format-truncation \ + -DGLFW_INCLUDE_NONE \ + -DGLFW_NATIVE_INCLUDE_NONE \ + -DLOG_USE_COLOR \ + -o build/$(TARGET) \ + -g -Og + .PHONY: format format: clang-format -i src/* @@ -50,25 +67,7 @@ valgrind: build .PHONY: clean-release clean-release: - @rm -rf \ - autom4te.cache \ - aclocal.m4 \ - compile \ - config.* \ - configure \ - configure~ \ - depcomp \ - **/.deps \ - **/**/.deps \ - $(TARGET) \ - $(TARGET)-*.tar.gz \ - $(TARGET)-*.pkg.tar.zst \ - install-sh \ - Makefile \ - Makefile.in \ - missing \ - src/.* \ - src/*.o + git clone -f -x .PHONY: test-release test-release: clean clean-release diff --git a/src/shaders.c b/src/shaders.c index 72df2f0..cb6ff87 100644 --- a/src/shaders.c +++ b/src/shaders.c @@ -48,6 +48,7 @@ bool check_glerror(ShaderProgram *program, const char *context) { } bool check_eglerror_ro(const char *context) { +#ifdef VIDEO_IN unsigned int code; code = eglGetError(); @@ -56,7 +57,7 @@ bool check_eglerror_ro(const char *context) { log_warn("EGL Error: %04x (%s)", code, context); return true; } - +#endif /* VIDEO_IN */ return false; }