Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,23 @@ fi
PLATFORM="$(uname -s)"
if [ "$PLATFORM" = "Linux" ]; then
RAYLIB_NAME='raylib-5.5_linux_amd64'
OMP_LIB=-lomp5
SANITIZE_FLAGS=(-fsanitize=address,undefined,bounds,pointer-overflow,leak -fno-omit-frame-pointer)
INCLUDES=()
STANDALONE_LDFLAGS=(-lGL)
SHARED_LDFLAGS=(-Bsymbolic-functions)
else
command -v brew &>/dev/null || { echo "Error: Homebrew not found" && exit 1; }
brew ls --versions llvm &>/dev/null || { echo "Error: Homebrew LLVM not found('brew install llvm')" && exit 1; }
RAYLIB_NAME='raylib-5.5_macos'
OMP_LIB=-lomp
SANITIZE_FLAGS=()
STANDALONE_LDFLAGS=(-framework Cocoa -framework IOKit -framework CoreVideo -framework OpenGL)
SHARED_LDFLAGS=(-framework Cocoa -framework OpenGL -framework IOKit -undefined dynamic_lookup)
# Homebrew "real" clang setup on mac
LLVM_PREFIX=$(brew --prefix llvm)
export CC=${CC:-$LLVM_PREFIX/bin/clang}
export CXX=${CXX:-$LLVM_PREFIX/bin/clang++}
ln -sf $LLVM_PREFIX/lib/libomp.dylib $LLVM_PREFIX/lib/libomp5.dylib #f-ing mac
INCLUDES=(-I$LLVM_PREFIX/include)
STANDALONE_LDFLAGS=(-framework Cocoa -framework IOKit -framework CoreVideo -framework OpenGL -L$LLVM_PREFIX/lib)
SHARED_LDFLAGS=(-framework Cocoa -framework OpenGL -framework IOKit -undefined dynamic_lookup -L$LLVM_PREFIX/lib)
fi

CLANG_WARN=(
Expand Down Expand Up @@ -95,7 +102,7 @@ else
fi

RAYLIB_A="$RAYLIB_NAME/lib/libraylib.a"
INCLUDES=(-I./$RAYLIB_NAME/include -I./src -I./vendor)
INCLUDES+=(-I./$RAYLIB_NAME/include -I./src -I./vendor)
LINK_ARCHIVES=("$RAYLIB_A")
EXTRA_SRC=""

Expand Down Expand Up @@ -252,7 +259,7 @@ if [ -z "$MODE" ]; then
build/bindings.o "$STATIC_LIB" "$RAYLIB_A"
-L$CUDA_HOME/lib64 $CUDNN_LFLAG
-lcudart -lnccl -lnvidia-ml -lcublas -lcusolver -lcurand -lcudnn
$OMP_LIB $LINK_OPT
-lomp5 $LINK_OPT
"${SHARED_LDFLAGS[@]}"
-o "$OUTPUT"
)
Expand All @@ -274,7 +281,7 @@ elif [ "$MODE" = "cpu" ]; then
LINK_CMD=(
${CXX:-g++} -shared -fPIC -fopenmp
build/bindings_cpu.o "$STATIC_LIB" "$RAYLIB_A"
-lm -lpthread $OMP_LIB $LINK_OPT
-lm -lpthread -lomp5 $LINK_OPT
"${SHARED_LDFLAGS[@]}"
-o "$OUTPUT"
)
Expand All @@ -294,7 +301,7 @@ elif [ "$MODE" = "profile" ]; then
tests/profile_kernels.cu vendor/ini.c \
"$STATIC_LIB" "$RAYLIB_A" \
-lnccl -lnvidia-ml -lcublas -lcurand -lcudnn \
-lGL -lm -lpthread $OMP_LIB \
-lGL -lm -lpthread -lomp5 \
-o profile
echo "Built: ./profile"
fi
Loading