build.sh (860B)
1 #!/bin/sh 2 3 set -ex 4 5 CC="clang" 6 7 WARNINGS="-Wall -Wextra -Wpedantic -Werror -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable" 8 9 # NOTE: clang only emits working pdbs with the following options: 10 # - '-fuse-ld=lld' : only LLD supports PDB file generation 11 # - '-O0' : prevents optimisations from breaking the debug info 12 # - '-g -gcodeview' : generates CodeView debug informations 13 # - '-fmsc-version=xxxx' : defines the MSVC toolchain version 14 # - '-Wl,--pdb=' : outputs a PDB file 15 # SEEALSO: https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170 16 17 CFLAGS="-std=c11 -O0 -g -gcodeview $WARNINGS" 18 #CPPFLAGS="-fmsc-version=1935" 19 LDFLAGS="-fuse-ld=lld -Wl,/debug:full,/pdb:" 20 21 WIN32_LIBS="-luser32 -lgdi32 -lwinmm -lavrt -lole32" 22 23 $CC -static -o wasapidemo.exe src/wasapidemo.c $CFLAGS $CPPFLAGS $LDFLAGS $WIN32_LIBS