ogl_beamforming

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

Commit: 02758349963bb84edced94d529b462316c77ae6e
Parent: f8ee00d3562b3f408ecd02bfb3be76f89f11288c
Author: Randy Palamar
Date:   Wed,  2 Oct 2024 15:38:46 -0600

update raylib and also build its dynamic version

With the `-Wl,-rpath,/path/` linker flag we can force the runtime
search path to point to our `external/lib` folder. This means that
our debug build no longer needs a system raylib installation and means
that the debug build should work on windows without modification.

The default "Release" build will prefer to use the statically
linked raylib since this is much more robust (and probably has
better performance).

Diffstat:
Mbuild.sh | 27++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/build.sh b/build.sh @@ -3,12 +3,12 @@ cflags="-march=native -std=c11 -O3 -Wall -I./external/include" #cflags="${cflags} -fproc-stat-report" #cflags="${cflags} -Rpass-missed=.*" libcflags="$cflags -fPIC -shared" -ldflags="-lraylib -lm" +ldflags="-lm" debug=${DEBUG} cc=${CC:-cc} -system_raylib=${USE_SYSTEM_RAYLIB:-$debug} +system_raylib=${USE_SYSTEM_RAYLIB} case $(uname -s) in MINGW64*) @@ -25,18 +25,28 @@ Linux*) esac if [ "$system_raylib" ]; then - ldflags="-L/usr/local/lib $ldflags" + ldflags="$(pkg-config raylib) $ldflags" else - ldflags="-L./external/lib $ldflags" if [ ! -f external/lib/libraylib.a ]; then git submodule update --init --depth=1 external/raylib cmake --install-prefix="${PWD}/external" \ - -G "Ninja" -B external/raylib/build -S external/raylib \ + -G "Ninja" -B external/raylib/build_static -S external/raylib \ -D CMAKE_INSTALL_LIBDIR=lib -D CMAKE_BUILD_TYPE="Release" \ + -D BUILD_SHARED_LIBS=OFF \ -DCUSTOMIZE_BUILD=ON -DBUILD_EXAMPLES=OFF -DWITH_PIC=ON \ -DOPENGL_VERSION=4.3 -DUSE_AUDIO=OFF -DSUPPORT_MODULE_RAUDIO=OFF - cmake --build external/raylib/build - cmake --install external/raylib/build + cmake --build external/raylib/build_static + cmake --install external/raylib/build_static + + # NOTE: we also build the dynamic lib for debug purposes + cmake --install-prefix="${PWD}/external" \ + -G "Ninja" -B external/raylib/build_shared -S external/raylib \ + -D BUILD_SHARED_LIBS=ON \ + -D CMAKE_INSTALL_LIBDIR=lib -D CMAKE_BUILD_TYPE="Release" \ + -DCUSTOMIZE_BUILD=ON -DBUILD_EXAMPLES=OFF -DWITH_PIC=ON \ + -DOPENGL_VERSION=4.3 -DUSE_AUDIO=OFF -DSUPPORT_MODULE_RAUDIO=OFF + cmake --build external/raylib/build_shared + cmake --install external/raylib/build_shared fi fi @@ -60,10 +70,13 @@ esac if [ "$debug" ]; then cflags="$cflags -O0 -ggdb -D_DEBUG -Wno-unused-function" #cflags="$cflags -fsanitize=address,undefined" + ldflags="-L./external/lib -lraylib -Wl,-rpath,external/lib/ $ldflags" libcflags="$cflags -fPIC" libldflags="$ldflags -shared" ${cc} $libcflags beamformer.c -o $libname $libldflags +else + [ ! "$system_raylib" ] && ldflags="./external/lib/libraylib.a $ldflags" fi ${cc} $cflags -o ogl main.c $ldflags