ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | LICENSE

build.sh (2286B)


      1 #!/bin/sh
      2 set -e
      3 
      4 cflags="-march=native -std=c11 -O3 -Wall -I./external/include"
      5 #cflags="${cflags} -fproc-stat-report"
      6 #cflags="${cflags} -Rpass-missed=.*"
      7 libcflags="$cflags -fPIC -shared -Wno-unused-variable"
      8 ldflags="-lm"
      9 
     10 debug=${DEBUG}
     11 
     12 cc=${CC:-cc}
     13 main=main_generic.c
     14 
     15 case $(uname -sm) in
     16 MINGW64*)
     17 	ldflags="$ldflags -lgdi32 -lwinmm"
     18 	if [ ! ${NO_MATLAB} ] && [ -d "C:/Program Files/MATLAB/R2022a/extern/lib/win64/microsoft" ]; then
     19 		libcflags="$libcflags -DMATLAB_CONSOLE"
     20 		extra_ldflags="-llibmat -llibmex"
     21 	fi
     22 	libname="beamformer.dll"
     23 	${cc} $libcflags helpers/ogl_beamformer_lib.c -o helpers/ogl_beamformer_lib.dll \
     24 		-L'C:/Program Files/MATLAB/R2022a/extern/lib/win64/microsoft' \
     25 		$extra_ldflags
     26 	;;
     27 Linux*)
     28 	cflags="$cflags -D_DEFAULT_SOURCE"
     29 	libname="beamformer.so"
     30 	${cc} $libcflags helpers/ogl_beamformer_lib.c -o helpers/ogl_beamformer_lib.so
     31 	;;
     32 esac
     33 
     34 if [ ! -f external/lib/libraylib.a ]; then
     35 	git submodule update --init --depth=1 external/raylib
     36 	cmake --install-prefix="${PWD}/external" \
     37 		-G "Ninja" -B external/raylib/build_static -S external/raylib \
     38 		-D CMAKE_INSTALL_LIBDIR=lib -D CMAKE_BUILD_TYPE="Release" \
     39 		-D BUILD_SHARED_LIBS=OFF \
     40 		-DCUSTOMIZE_BUILD=ON -DBUILD_EXAMPLES=OFF -DWITH_PIC=ON \
     41 		-DOPENGL_VERSION=4.3 -DUSE_AUDIO=OFF -DSUPPORT_MODULE_RAUDIO=OFF
     42 	cmake --build   external/raylib/build_static
     43 	cmake --install external/raylib/build_static
     44 
     45 	# NOTE: we also build the dynamic lib for debug purposes
     46 	cmake --install-prefix="${PWD}/external" \
     47 		-G "Ninja" -B external/raylib/build_shared -S external/raylib \
     48 		-D BUILD_SHARED_LIBS=ON \
     49 		-D CMAKE_INSTALL_LIBDIR=lib -D CMAKE_BUILD_TYPE="Release" \
     50 		-DCUSTOMIZE_BUILD=ON -DBUILD_EXAMPLES=OFF -DWITH_PIC=ON \
     51 		-DOPENGL_VERSION=4.3 -DUSE_AUDIO=OFF -DSUPPORT_MODULE_RAUDIO=OFF
     52 	cmake --build   external/raylib/build_shared
     53 	cmake --install external/raylib/build_shared
     54 fi
     55 
     56 # Hot Reloading/Debugging
     57 if [ "$debug" ]; then
     58 	cflags="$cflags -O0 -ggdb -D_DEBUG -Wno-unused-function"
     59 	#cflags="$cflags -fsanitize=address,undefined"
     60 	ldflags="-L./external/lib -lraylib -Wl,-rpath,external/lib/ $ldflags"
     61 	libcflags="$cflags -fPIC -shared"
     62 	${cc} $libcflags beamformer.c -o $libname $ldflags
     63 else
     64 	ldflags="./external/lib/libraylib.a ${ldflags}"
     65 fi
     66 
     67 ${cc} $cflags -o ogl $main $ldflags