Skip to content

Commit

Permalink
improve build system
Browse files Browse the repository at this point in the history
test suite and release builds
  • Loading branch information
jaromil committed Jul 22, 2024
1 parent e2d15f8 commit 3ab2427
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 13 deletions.
27 changes: 26 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
all: release-gcc-ninja

debug: debug-gcc

debug:
release-gcc:
mkdir -p build
cd build && cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release ..
cd build && make

release-gcc-ninja:
mkdir -p build
cd build && cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -G 'Ninja' ..
cd build && ninja

release-clang:
mkdir -p build
cd build && cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release ..
cd build && make

release-clang-ninja:
mkdir -p build
cd build && cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -G 'Ninja' ..
cd build && ninja

debug-gcc:
mkdir -p build
cd build && cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG='-ggdb -fno-omit-frame-pointer -fsanitize=address' -DCMAKE_C_FLAGS_DEBUG='-ggdb -fno-omit-frame-pointer -fsanitize=address' ..
cd build && make
Expand All @@ -10,3 +32,6 @@ debug-clang-ninja:
mkdir -p build
cd build && cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG='-ggdb -fno-omit-frame-pointer -fsanitize=address' -DCMAKE_C_FLAGS_DEBUG='-ggdb -fno-omit-frame-pointer -fsanitize=address' -G 'Ninja' ..
cd build && ninja

clean:
rm -rf build
33 changes: 21 additions & 12 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,34 @@ PLUGINDIR ?= ../build/src
CXX ?= g++
DEBUG_FLAGS ?= -O0 -g -ggdb -Wl,-undefined -Wl,dynamic_lookup -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -fsanitize-address-use-after-scope

all: test-utils
all: frei0r-meta frei0r-run
@echo "Test targets available:"
@echo "scan-meta :: scan all plugins and produce metadata"
@echo "check-asan :: run all tests on all plugins"
@echo "frei0r-meta :: build metadata plugin scanner"
@echo "frei0r-run :: build ASAN test utility"


# build scan-plugins

frei0r-test: CVFLAGS := $(shell pkg-config --libs --cflags opencv4)
frei0r-test: frei0r-test.c
${CXX} ${DEBUG_FLAGS} -ggdb -O0 -I../include -o frei0r-test frei0r-test.c ${CVFLAGS} -ldl
frei0r-run: CVFLAGS := $(shell pkg-config --libs --cflags opencv4)
frei0r-run: frei0r-run.c
$(info Build frei0r plugin test run utility)
${CXX} ${DEBUG_FLAGS} -ggdb -O0 -I../include -o frei0r-run frei0r-run.c ${CVFLAGS} -ldl

test-all-filters: frei0r-test
check-asan: frei0r-run
@$(if $(wildcard ${PLUGINDIR}),,>&2 echo "Scan dir not found: ${PLUGINDIR}" && exit 1)
@find ${PLUGINDIR} -type f -name '*.so' -exec ./frei0r-test -t -v ${HOME}/Downloads/frei0r-all.webm -p {} \;
@find ${PLUGINDIR} -type f -name '*.so' -exec ./frei0r-run -t -v ${HOME}/Downloads/frei0r-all.webm -p {} \;

# @$(if $(wildcard frei0r-test),,make test-utils)

scan-plugins:
frei0r-meta: frei0r-meta.c
$(info Build frei0r meta-data parsing utility)
${CC} -o frei0r-meta -ggdb frei0r-meta.c ${INCLUDES}

scan-meta: frei0r-meta
@$(if $(wildcard ${PLUGINDIR}),,>&2 echo "Scan dir not found: ${PLUGINDIR}" && exit 1)
@find ${PLUGINDIR} -type f -name '*.so' -exec ./frei0r-info {} \; > tmp.json
@find ${PLUGINDIR} -type f -name '*.so' -exec ./frei0r-meta {} \; > tmp.json
@echo "[" > frei0r-plugin-list.json
@head -n -1 tmp.json >> frei0r-plugin-list.json
@echo "}\n]" >> frei0r-plugin-list.json
Expand All @@ -34,10 +46,7 @@ generate-metadata:
@$(if $(wildcard ${PLUGINDIR}),,>&2 echo "Scan dir not found: ${PLUGINDIR}" && exit 1)
sh extract-plugin-info.sh ${EXTENSION} ${PLUGINDIR}

build:
@${CC} -o frei0r-info -ggdb frei0r-info.c ${INCLUDES}

clean:
rm -f *.o
rm -f frei0r-info frei0r-test
rm -f frei0r-run frei0r-meta
rm -f *.json
File renamed without changes.
File renamed without changes.

0 comments on commit 3ab2427

Please sign in to comment.