Skip to content

Commit

Permalink
tests, benchmark, tool makefile and less C lib
Browse files Browse the repository at this point in the history
Add built-in PngSuite tests

Improve the benchmark tool

Add a Makefile for the tools (not intended for the library itself)

Avoid direct usage of memcpy, memset, strlen, strcmp: reimplement them
to avoid issues with C libraries lacking those on tiny platforms.

A few minor optimizations.
  • Loading branch information
lvandeve committed Aug 5, 2019
1 parent 165dfcf commit 39aaf87
Show file tree
Hide file tree
Showing 5 changed files with 475 additions and 403 deletions.
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This makefile only makes the unit test, benchmark and pngdetail and showpng
# utilities. It does not make the PNG codec itself as shared or static library.
# That is because:
# LodePNG itself has only 1 source file (lodepng.cpp, can be renamed to
# lodepng.c) and is intended to be included as source file in other projects and
# their build system directly.


CC ?= gcc
CXX ?= g++

override CFLAGS := -W -Wall -Wextra -ansi -pedantic -O3 -Wno-unused-function $(CFLAGS)
override CXXFLAGS := -W -Wall -Wextra -ansi -pedantic -O3 $(CXXFLAGS)

all: unittest benchmark pngdetail showpng

%.o: %.cpp
@mkdir -p `dirname $@`
$(CXX) -I ./ $(CXXFLAGS) -c $< -o $@

unittest: lodepng.o lodepng_util.o lodepng_unittest.o
$(CXX) $^ $(CXXFLAGS) -o $@

benchmark: lodepng.o lodepng_benchmark.o
$(CXX) $^ $(CXXFLAGS) -lSDL -o $@

pngdetail: lodepng.o lodepng_util.o pngdetail.o
$(CXX) $^ $(CXXFLAGS) -o $@

showpng: lodepng.o examples/example_sdl.o
$(CXX) -I ./ $^ $(CXXFLAGS) -lSDL -o $@

clean:
rm -f unittest benchmark pngdetail showpng lodepng_unittest.o lodepng_benchmark.o lodepng.o lodepng_util.o pngdetail.o examples/example_sdl.o
Loading

0 comments on commit 39aaf87

Please sign in to comment.