Commit Graph
18 Commits
Author SHA1 Message Date
Nigel Tao eb6703425a Tweak build-*.sh "Wuffs root directory" check 2021-10-07 14:59:13 +11:00
Nigel Tao ea4c85bfa2 Add comment re previous commit (strip examples) 2021-10-04 23:37:37 +11:00
Nigel Tao 41fce8a8de Strip examples of unused data and functions
Compile time:
$ time ./build-example.sh
Before: user 0m40.885s
After:  user 0m41.011s

Binary size (for example-toy-genlib):
$ ls -l gen/bin/example-toy-genlib) | awk '{print $5}'
Before: 830168
After:  809896
Note that the majority of this is a statically linked libc.

Binary size (excluding the statically linked example-toy-genlib):
$ ls -l gen/bin/example-* | awk '{print $5 " " $9}'

Before:
 85280 gen/bin/example-cbor-to-json
242216 gen/bin/example-convert-to-nia
 37112 gen/bin/example-crc32
 53328 gen/bin/example-gifplayer
282840 gen/bin/example-imageviewer
 95152 gen/bin/example-json-to-cbor
122720 gen/bin/example-jsonfindptrs
 60448 gen/bin/example-jsonptr
267672 gen/bin/example-sdl-imageviewer
 64792 gen/bin/example-zcat

After:
 73104 gen/bin/example-cbor-to-json
231560 gen/bin/example-convert-to-nia
 34640 gen/bin/example-crc32
 47632 gen/bin/example-gifplayer
269632 gen/bin/example-imageviewer
 83032 gen/bin/example-json-to-cbor
118664 gen/bin/example-jsonfindptrs
 58040 gen/bin/example-jsonptr
253424 gen/bin/example-sdl-imageviewer
 58200 gen/bin/example-zcat

Before total: 1311560
After  total: 1227928
2021-10-04 13:28:42 +11:00
Nigel Tao 774340ae27 Add CFLAGS, CXXFLAGS, LDFLAGS to build-example.sh 2021-10-04 12:31:34 +11:00
Nigel Tao 68acf24515 Remove Makefiles
They don't work for me (on Debian bullseye). For example, from the
example/sdl-imageviewer directory:

$ make
g++   -lSDL2 -lSDL2_image  sdl-imageviewer.cc   -o sdl-imageviewer
/usr/bin/ld: /tmp/cciX1mj2.o: in function `draw(SDL_Window*)':
sdl-imageviewer.cc:(.text+0x36e44): undefined reference to `SDL_GetWindowSurface'
/usr/bin/ld: sdl-imageviewer.cc:(.text+0x36e69): undefined reference to `SDL_CreateRenderer'
/usr/bin/ld: sdl-imageviewer.cc:(.text+0x36e79): undefined reference to `SDL_RenderClear'
etc
collect2: error: ld returned 1 exit status
make: *** [<builtin>: sdl-imageviewer] Error 1

Swapping the g++ args around to

g++ sdl-imageviewer.cc -lSDL2 -lSDL2_image -o sdl-imageviewer

works, but the recommended approach is to use the existing top-level
build-example.sh script instead.
2021-10-03 14:06:16 +11:00
Nigel Tao 10850c17bc Add example/sdl-imageviewer 2021-04-01 23:08:49 +11:00
Nigel Tao ccee207661 Change example/imageviewer from C to C++ 2021-02-27 22:40:32 +11:00
Nigel Tao 4cb6cc5a0d Fix missing echo for building example/jsonfindptrs 2020-09-04 09:26:09 +10:00
Nigel Tao 5396dbd17d Have jsonfindptrs use C++17's std::variant
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real    0m7.333s
After:
real    0m5.970s
Ratio: 1.23x

Using "/usr/bin/time -v" instead of "time"
Before this commit:
Maximum resident set size (kbytes): 2556992
After:
Maximum resident set size (kbytes): 1214812
Ratio: 2.10x
2020-08-29 22:23:15 +10:00
Nigel Tao cf8884d44c Rename example/library to example/toy-genlib 2020-08-05 11:55:51 +10:00
Nigel Tao 1b07349144 Add example/jsonptr 2020-02-16 22:19:12 +11:00
Nigel Tao 8f1fe43abf Add example/imageviewer 2020-01-16 11:42:52 +11:00
Nigel Tao b2d598aac5 Add $CC and $CXX variables to build-*.sh 2018-12-26 12:38:15 +11:00
Nigel Tao 04c91f1410 Generate .c files instead of .h files
The files' contents haven't changed (other than some relative #include's
that refer to other .c files).

Some build systems have difficulty recognizing .h files as things to be
compiled, instead of just things referred to by things to be compiled.
2018-12-22 15:29:00 +11:00
Nigel Tao 10ae70448f Let build scripts take "example/*" arguments 2018-08-18 12:13:36 +10:00
Nigel Tao fce793776c Have build-example run 'out of the box' 2018-08-05 22:36:37 +10:00
Nigel Tao 845ffbeb86 Have build-example.sh build with -O3 2018-08-05 22:24:03 +10:00
Nigel Tao 4c1826ac8e Factor build-all.sh into smaller scripts 2018-08-05 21:55:50 +10:00