From 7cdd6f4c70f9e91fe785bd96bb4378fc307651fb Mon Sep 17 00:00:00 2001 From: redthing1 Date: Thu, 10 Nov 2022 13:17:21 -0800 Subject: [PATCH] support various graphics and platform args --- build-raylib.sh | 67 ++++++++++++++++++++++++------------------------- dub.sdl | 24 +++++++++++++----- 2 files changed, 51 insertions(+), 40 deletions(-) diff --git a/build-raylib.sh b/build-raylib.sh index 790a7cf..f32b043 100755 --- a/build-raylib.sh +++ b/build-raylib.sh @@ -14,42 +14,41 @@ SOURCETREE_DIR="raylib_source" SOURCETREE_BRANCH="4.2.0_patch" LIB_FILE_1="libraylib.a" +BUILD_ARGS=$@ + PACKAGE_DIR=$(dirname "$0") cd "$PACKAGE_DIR" pushd . -if [ ! -f $LIB_FILE_1 ] || [ "$1" == "-f" ]; then - echo "[$HOST] building $LIB_NAME library..." - - # delete $SOURCETREE_DIR to force re-fetch source - if [ -d $SOURCETREE_DIR ] - then - echo "[$HOST] source folder already exists, using it." - else - echo "[$HOST] getting source to build $LIB_NAME" - # git clone $SOURCETREE_URL $SOURCETREE_DIR - git clone --depth 1 --branch $SOURCETREE_BRANCH $SOURCETREE_URL $SOURCETREE_DIR - fi - - cd $SOURCETREE_DIR - git submodule update --init --recursive - - echo "[$HOST] starting build of $LIB_NAME" - # - # START BUILD - # - # build the library - cd src - make -j$(nproc) - # - # END BUILD - # - - echo "[$HOST] finished build of $LIB_NAME" - - echo "[$HOST] copying $LIB_NAME binary ($LIB_FILE_1) to $PACKAGE_DIR" - cp -v $(pwd)/$LIB_FILE_1 $PACKAGE_DIR/$LIB_FILE_1 - popd + +echo "[$HOST] building $LIB_NAME library..." + +# delete $SOURCETREE_DIR to force re-fetch source +if [ -d $SOURCETREE_DIR ] +then + echo "[$HOST] source folder already exists, using it." else - # delete $LIB_FILE_1 to force rebuild - echo "[$HOST] library $LIB_NAME already built." + echo "[$HOST] getting source to build $LIB_NAME" + # git clone $SOURCETREE_URL $SOURCETREE_DIR + git clone --depth 1 --branch $SOURCETREE_BRANCH $SOURCETREE_URL $SOURCETREE_DIR fi + +cd $SOURCETREE_DIR +git submodule update --init --recursive + +echo "[$HOST] starting build of $LIB_NAME" +# +# START BUILD +# +# build the library +cd src +make clean +make -j$(nproc) $BUILD_ARGS +# +# END BUILD +# + +echo "[$HOST] finished build of $LIB_NAME" + +echo "[$HOST] copying $LIB_NAME binary ($LIB_FILE_1) to $PACKAGE_DIR" +ln -vrfs $(pwd)/$LIB_FILE_1 $PACKAGE_DIR/$LIB_FILE_1 +popd diff --git a/dub.sdl b/dub.sdl index 9b11c24..8f03647 100644 --- a/dub.sdl +++ b/dub.sdl @@ -6,10 +6,24 @@ license "apache-2.0" dependency "fluent-asserts" version="~>0.13.3" targetType "library" -configuration "default" { - # on posix platforms, link to raylib static library +configuration "desktop-gl33" { lflags "-L$PACKAGE_DIR" "$PACKAGE_DIR/libraylib.a" platform="posix" - preGenerateCommands "bash $PACKAGE_DIR/build-raylib.sh" platform="posix" + preBuildCommands "bash $PACKAGE_DIR/build-raylib.sh PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_33" platform="posix" +} + +configuration "desktop-gl21" { + lflags "-L$PACKAGE_DIR" "$PACKAGE_DIR/libraylib.a" platform="posix" + preBuildCommands "bash $PACKAGE_DIR/build-raylib.sh PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_21" platform="posix" +} + +configuration "desktop-gles2" { + lflags "-L$PACKAGE_DIR" "$PACKAGE_DIR/libraylib.a" platform="posix" + preBuildCommands "bash $PACKAGE_DIR/build-raylib.sh PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_ES2" platform="posix" +} + +configuration "drm-gles2" { + lflags "-L$PACKAGE_DIR" "$PACKAGE_DIR/libraylib.a" platform="posix" + preBuildCommands "bash $PACKAGE_DIR/build-raylib.sh PLATFORM=PLATFORM_DRM GRAPHICS=GRAPHICS_API_OPENGL_ES2" platform="posix" } configuration "windows" { @@ -19,9 +33,7 @@ configuration "windows" { configuration "windows-cross" { # on windows platforms, link to raylib static library - // lflags "-L$PACKAGE_DIR" "$PACKAGE_DIR/libraylib.lib" platform="windows" lflags "-L$WINLIB_BASE" "-L$WINLIB_MINGW" platform="windows" sourceFiles "$PACKAGE_DIR/raylib.lib" platform="windows" sourceFiles "$PACKAGE_DIR/WinMM.lib" platform="windows" - // preGenerateCommands "$PACKAGE_DIR/build-raylib.bat" platform="windows" -} \ No newline at end of file +}