Initial commit - some engine bugs stopping compiling
This commit is contained in:
44
third-party/glad/utility/bump_version.sh
vendored
Executable file
44
third-party/glad/utility/bump_version.sh
vendored
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "No version supplied"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
VERSION_PYTHON="__version__ = '${VERSION}'"
|
||||
|
||||
OLD_VERSION=$(python -c "import glad; print(glad.__version__)")
|
||||
|
||||
echo "Old Version: $OLD_VERSION"
|
||||
echo "New Version: $VERSION"
|
||||
echo
|
||||
|
||||
if [ "$VERSION" == "$OLD_VERSION" ]
|
||||
then
|
||||
echo "Version equals the old version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Python: $VERSION_PYTHON"
|
||||
read -p "Do you want to update to version $VERSION? [y/n]: " -n 1 -r
|
||||
echo
|
||||
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
echo "Aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo -e "\n$VERSION_PYTHON\n" > glad/__init__.py
|
||||
|
||||
git commit -am "setup: Bumped version: $VERSION."
|
||||
git tag "v$VERSION"
|
||||
|
||||
rm -rf build/
|
||||
rm -rf dist/
|
||||
|
||||
python -m build
|
||||
twine upload dist/*
|
||||
|
||||
177
third-party/glad/utility/compiletest.sh
vendored
Executable file
177
third-party/glad/utility/compiletest.sh
vendored
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z ${PYTHON+x} ]; then
|
||||
PYTHON="/usr/bin/env python"
|
||||
fi
|
||||
|
||||
echo "Using python \"$PYTHON\""
|
||||
|
||||
if [ "$1" != "no-download" ]; then
|
||||
./utility/download.sh
|
||||
fi
|
||||
|
||||
GCC_FLAGS="-o build/tmp.o -Wall -Wextra -Wsign-conversion -Wcast-qual -Wstrict-prototypes -Werror -ansi -c"
|
||||
GPP_FLAGS="-o build/tmp.o -Wall -Wextra -Wsign-conversion -Wcast-qual -Werror -c"
|
||||
|
||||
|
||||
function echorun {
|
||||
echo $@
|
||||
$@
|
||||
}
|
||||
|
||||
function mingwc_compile {
|
||||
echorun i686-w64-mingw32-gcc $@
|
||||
echorun x86_64-w64-mingw32-gcc $@
|
||||
}
|
||||
|
||||
function c_compile {
|
||||
echorun gcc $@ -ldl
|
||||
mingwc_compile $@
|
||||
}
|
||||
|
||||
function mingwcpp_compile {
|
||||
echorun i686-w64-mingw32-g++ $@
|
||||
echorun x86_64-w64-mingw32-g++ $@
|
||||
}
|
||||
|
||||
function cpp_compile {
|
||||
echorun g++ $@ -ldl
|
||||
mingwcpp_compile $@
|
||||
}
|
||||
|
||||
|
||||
function download_if_required {
|
||||
if [ ! -f $1 ]; then
|
||||
mkdir -p $(dirname "${1}")
|
||||
filename=$(basename "${1}")
|
||||
if [ ! -f ${filename} ]; then
|
||||
wget -O ${filename} $2
|
||||
fi
|
||||
cp ${filename} $1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# C
|
||||
echo -e "====================== Generating and compiling C/C++: ======================"
|
||||
|
||||
rm -rf build
|
||||
download_if_required build/include/EGL/eglplatform.h "https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/main/api/EGL/eglplatform.h"
|
||||
download_if_required build/include/KHR/khrplatform.h "https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/main/api/KHR/khrplatform.h"
|
||||
${PYTHON} -m glad --api="egl" --out-path=build c
|
||||
c_compile -Ibuild/include build/src/egl.c ${GCC_FLAGS}
|
||||
cpp_compile -Ibuild/include build/src/egl.c ${GPP_FLAGS}
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:compatibility" --out-path=build c
|
||||
c_compile -Ibuild/include build/src/gl.c ${GCC_FLAGS}
|
||||
cpp_compile -Ibuild/include build/src/gl.c ${GPP_FLAGS}
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:core" --out-path=build c
|
||||
c_compile -Ibuild/include build/src/gl.c ${GCC_FLAGS}
|
||||
cpp_compile -Ibuild/include build/src/gl.c ${GPP_FLAGS}
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:core=2.1" --out-path=build c
|
||||
c_compile -Ibuild/include build/src/gl.c ${GCC_FLAGS}
|
||||
cpp_compile -Ibuild/include build/src/gl.c ${GPP_FLAGS}
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:core" --out-path=build c
|
||||
${PYTHON} -m glad --api="glx" --out-path=build c
|
||||
echorun gcc -Ibuild/include build/src/glx.c ${GCC_FLAGS}
|
||||
echorun g++ -Ibuild/include build/src/glx.c ${GPP_FLAGS}
|
||||
|
||||
# Example
|
||||
# echorun gcc example/c/simple.c -o build/simple -Ibuild/include build/src/gl.c -lglut -ldl
|
||||
# mingwc_compile example/c/simple.c -o build/simple -Ibuild/include build/src/gl.c -lfreeglut
|
||||
# echorun g++ example/c++/hellowindow2.cpp -o build/hellowindow2 -Ibuild/include build/src/gl.c -lglfw -ldl
|
||||
# mingwcpp_compile example/c++/hellowindow2.cpp -o build/hellowindow2 -Ibuild/include build/src/gl.c -lglfw3 -lgdi32
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:core" --out-path=build c
|
||||
${PYTHON} -m glad --api="wgl" --out-path=build c
|
||||
mingwc_compile -Ibuild/include build/src/wgl.c ${GCC_FLAGS}
|
||||
mingwcpp_compile -Ibuild/include build/src/wgl.c ${GPP_FLAGS}
|
||||
|
||||
|
||||
# C-Debug
|
||||
echo -e "====================== Generating and compiling C/C++ Debug: ======================"
|
||||
|
||||
rm -rf build
|
||||
download_if_required build/include/EGL/eglplatform.h "https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/main/api/EGL/eglplatform.h"
|
||||
download_if_required build/include/KHR/khrplatform.h "https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/main/api/KHR/khrplatform.h"
|
||||
${PYTHON} -m glad --api="egl" --out-path=build c --debug
|
||||
c_compile -Ibuild/include build/src/egl.c ${GCC_FLAGS}
|
||||
cpp_compile -Ibuild/include build/src/egl.c ${GPP_FLAGS}
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:compatibility" --out-path=build c --debug
|
||||
c_compile -Ibuild/include build/src/gl.c ${GCC_FLAGS}
|
||||
cpp_compile -Ibuild/include build/src/gl.c ${GPP_FLAGS}
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:core" --out-path=build c --debug
|
||||
c_compile -Ibuild/include build/src/gl.c ${GCC_FLAGS}
|
||||
cpp_compile -Ibuild/include build/src/gl.c ${GPP_FLAGS}
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:core=2.1" --out-path=build c --debug
|
||||
c_compile -Ibuild/include build/src/gl.c ${GCC_FLAGS}
|
||||
cpp_compile -Ibuild/include build/src/gl.c ${GPP_FLAGS}
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:core" --out-path=build c --debug
|
||||
${PYTHON} -m glad --api="glx" --out-path=build c --debug
|
||||
echorun gcc -Ibuild/include build/src/glx.c ${GCC_FLAGS}
|
||||
echorun g++ -Ibuild/include build/src/glx.c ${GPP_FLAGS}
|
||||
|
||||
# Example
|
||||
# echorun gcc example/c/simple.c -o build/simple -Ibuild/include build/src/gl.c -lglut -ldl
|
||||
# mingwc_compile example/c/simple.c -o build/simple -Ibuild/include build/src/gl.c -lfreeglut
|
||||
# echorun g++ example/c++/hellowindow2.cpp -o build/hellowindow2 -Ibuild/include build/src/gl.c -lglfw -ldl
|
||||
# mingwcpp_compile example/c++/hellowindow2.cpp -o build/hellowindow2 -Ibuild/include build/src/gl.c -lglfw3 -lgdi32
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl:core" --out-path=build c --debug
|
||||
${PYTHON} -m glad --api="wgl" --out-path=build c --debug
|
||||
mingwc_compile -Ibuild/include build/src/wgl.c ${GCC_FLAGS}
|
||||
mingwcpp_compile -Ibuild/include build/src/wgl.c ${GPP_FLAGS}
|
||||
|
||||
|
||||
# D
|
||||
echo -e "\n====================== Generating and compiling D: ======================"
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="egl=" --out-path=build d
|
||||
echorun dmd -o- build/glad/egl/*.d -c
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="gl=,gles1=,gles2=" --out-path=build d
|
||||
echorun dmd -o- build/glad/gl/*.d -c
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --generator=d --api="gl=" --out-path=build d
|
||||
${PYTHON} -m glad --generator=d --api="glx=" --out-path=build d
|
||||
echorun dmd -o- build/glad/glx/*.d -c
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --generator=d --api="gl=" --out-path=build d
|
||||
${PYTHON} -m glad --generator=d --api="wgl=" --out-path=build d
|
||||
echorun dmd -o- build/glad/wgl/*.d -c
|
||||
|
||||
|
||||
# Volt TODO
|
||||
echo -e "\n====================== Generating Volt: ======================"
|
||||
|
||||
rm -rf build
|
||||
${PYTHON} -m glad --api="egl=" --out-path=build volt
|
||||
${PYTHON} -m glad --api="gl=" --out-path=build volt
|
||||
${PYTHON} -m glad --api="glx=" --out-path=build volt
|
||||
${PYTHON} -m glad --api="wgl=" --out-path=build volt
|
||||
|
||||
|
||||
rm -rf build
|
||||
54
third-party/glad/utility/download.sh
vendored
Executable file
54
third-party/glad/utility/download.sh
vendored
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
TARGET=${TARGET:="."}
|
||||
|
||||
|
||||
rm -f "${TARGET}/egl.xml"
|
||||
wget -O "${TARGET}/egl.xml" https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/main/api/egl.xml
|
||||
|
||||
rm -f "${TARGET}/gl.xml"
|
||||
wget -O "${TARGET}/gl.xml" https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/gl.xml
|
||||
|
||||
rm -f "${TARGET}/glx.xml"
|
||||
wget -O "${TARGET}/glx.xml" https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/glx.xml
|
||||
|
||||
rm -f "${TARGET}/wgl.xml"
|
||||
wget -O "${TARGET}/wgl.xml" https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/wgl.xml
|
||||
|
||||
rm -f "${TARGET}/vk.xml"
|
||||
wget -O "${TARGET}/vk.xml" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/xml/vk.xml
|
||||
|
||||
rm -f "${TARGET}/khrplatform.h"
|
||||
wget -O "${TARGET}/khrplatform.h" https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/main/api/KHR/khrplatform.h
|
||||
|
||||
rm -f "${TARGET}/eglplatform.h"
|
||||
wget -O "${TARGET}/eglplatform.h" https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/main/api/EGL/eglplatform.h
|
||||
|
||||
rm -f "${TARGET}/vk_platform.h"
|
||||
wget -O "${TARGET}/vk_platform.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/include/vulkan/vk_platform.h
|
||||
|
||||
rm -f "${TARGET}/vulkan_video_codecs_common.h"
|
||||
wget -O "${TARGET}/vulkan_video_codecs_common.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codecs_common.h
|
||||
|
||||
rm -f "${TARGET}/vulkan_video_codec_h264std.h"
|
||||
wget -O "${TARGET}/vulkan_video_codec_h264std.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h264std.h
|
||||
rm -f "${TARGET}/vulkan_video_codec_h264std_decode.h"
|
||||
wget -O "${TARGET}/vulkan_video_codec_h264std_decode.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h264std_decode.h
|
||||
rm -f "${TARGET}/vulkan_video_codec_h264std_encode.h"
|
||||
wget -O "${TARGET}/vulkan_video_codec_h264std_encode.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h264std_encode.h
|
||||
|
||||
rm -f "${TARGET}/vulkan_video_codec_h265std.h"
|
||||
wget -O "${TARGET}/vulkan_video_codec_h265std.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h265std.h
|
||||
rm -f "${TARGET}/vulkan_video_codec_h265std_decode.h"
|
||||
wget -O "${TARGET}/vulkan_video_codec_h265std_decode.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h265std_decode.h
|
||||
rm -f "${TARGET}/vulkan_video_codec_h265std_encode.h"
|
||||
wget -O "${TARGET}/vulkan_video_codec_h265std_encode.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_h265std_encode.h
|
||||
|
||||
|
||||
rm -f "${TARGET}/vulkan_video_codec_av1std.h"
|
||||
wget -O "${TARGET}/vulkan_video_codec_av1std.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_av1std.h
|
||||
rm -f "${TARGET}/vulkan_video_codec_av1std_decode.h"
|
||||
wget -O "${TARGET}/vulkan_video_codec_av1std_decode.h" https://raw.githubusercontent.com/KhronosGroup/Vulkan-Headers/main/include/vk_video/vulkan_video_codec_av1std_decode.h
|
||||
100
third-party/glad/utility/examples.sh
vendored
Executable file
100
third-party/glad/utility/examples.sh
vendored
Executable file
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
TMP=${TMP:="./build"}
|
||||
|
||||
PYTHON=${PYTHON:="python"}
|
||||
GLAD=${GLAD:="$PYTHON -m glad --quiet"}
|
||||
|
||||
_GCC=${_GCC:="gcc"}
|
||||
_GPP=${_GPP:="g++"}
|
||||
_MINGW_GCC=${_MINGW_GCC:="x86_64-w64-mingw32-gcc"}
|
||||
_GCC_FLAGS="-Wall -Wextra -Werror -Wno-unused-parameter"
|
||||
|
||||
GCC=${GCC:="$_GCC $_GCC_FLAGS"}
|
||||
GPP=${GPP:="$_GPP $_GCC_FLAGS"}
|
||||
MINGW_GCC=${MINGW_GCC:="$_MINGW_GCC $_GCC_FLAGS"}
|
||||
|
||||
WINE=${WINE:="wine"}
|
||||
|
||||
|
||||
function start {
|
||||
echo "-------> ${1}"
|
||||
rm -rf ${TMP}
|
||||
}
|
||||
|
||||
function end {
|
||||
echo
|
||||
}
|
||||
|
||||
start "egl_glfw.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gles1" c --loader
|
||||
${GLAD} --out-path="${TMP}" --api="egl" c --loader
|
||||
${GCC} example/c/egl_glfw.c -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lglfw && ${TMP}/run
|
||||
end
|
||||
|
||||
start "egl_x11.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gles2" c --loader
|
||||
${GLAD} --out-path="${TMP}" --api="egl" c --loader
|
||||
${GCC} example/c/egl_x11/egl_x11.c -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lX11 && ${TMP}/run
|
||||
end
|
||||
|
||||
start "gl_glfw.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c
|
||||
${GCC} example/c/gl_glfw.c -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lglfw && ${TMP}/run
|
||||
end
|
||||
|
||||
start "gl_sdl2.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c
|
||||
${GCC} example/c/gl_sdl2.c -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl `sdl2-config --libs --cflags` && ${TMP}/run
|
||||
end
|
||||
|
||||
start "glut.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c --loader
|
||||
${GCC} example/c/glut.c -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lglut && ${TMP}/run
|
||||
end
|
||||
|
||||
start "glx.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c --loader
|
||||
${GLAD} --out-path="${TMP}" --api="glx" c --loader
|
||||
${GCC} example/c/glx.c -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lX11 && ${TMP}/run
|
||||
end
|
||||
|
||||
start "glx_modern.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c --loader
|
||||
${GLAD} --out-path="${TMP}" --api="glx" c --loader
|
||||
${GCC} example/c/glx_modern.c -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lX11 && ${TMP}/run
|
||||
end
|
||||
|
||||
start "vulkan_tri_glfw.c"
|
||||
${GLAD} --out-path="${TMP}" --api="vulkan" c --loader
|
||||
${GCC} example/c/vulkan_tri_glfw/vulkan_tri_glfw.c -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lglfw && ${TMP}/run
|
||||
end
|
||||
|
||||
start "wgl.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c --loader
|
||||
${GLAD} --out-path="${TMP}" --api="wgl" c --loader
|
||||
${MINGW_GCC} example/c/wgl.c -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -lgdi32 -lopengl32 && ${WINE} ${TMP}/run
|
||||
end
|
||||
|
||||
start "hellowindow2.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c --loader
|
||||
${GPP} example/c++/hellowindow2.cpp -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lglfw && ${TMP}/run
|
||||
end
|
||||
|
||||
start "hellowindow2_macro.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c --loader --header-only
|
||||
${GPP} example/c++/hellowindow2_macro.cpp -o ${TMP}/run -Ibuild/include -ldl -lglfw && ${TMP}/run
|
||||
end
|
||||
|
||||
start "hellowindow2_mx.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c --loader --mx
|
||||
${GPP} example/c++/hellowindow2_mx.cpp -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lglfw && ${TMP}/run
|
||||
end
|
||||
|
||||
start "multiwin_mx.c"
|
||||
${GLAD} --out-path="${TMP}" --api="gl:core" c --loader --mx
|
||||
${GPP} example/c++/multiwin_mx/multiwin_mx.cpp -o ${TMP}/run -Ibuild/include ${TMP}/src/*.c -ldl -lglfw && ${TMP}/run
|
||||
end
|
||||
|
||||
31
third-party/glad/utility/generateall.sh
vendored
Executable file
31
third-party/glad/utility/generateall.sh
vendored
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z ${PYTHON+x} ]; then
|
||||
PYTHON="/usr/bin/env python"
|
||||
fi
|
||||
|
||||
echo "Using python \"$PYTHON\""
|
||||
|
||||
if [ "$1" != "no-download" ]; then
|
||||
./utility/download.sh
|
||||
fi
|
||||
|
||||
|
||||
rm -rf build
|
||||
echo "Generating C"
|
||||
$PYTHON -m glad --out-path=build --spec=egl --generator=c
|
||||
$PYTHON -m glad --out-path=build --spec=gl --api="gl=,gles1=,gles2=" --generator=c
|
||||
$PYTHON -m glad --out-path=build --spec=glx --generator=c
|
||||
$PYTHON -m glad --out-path=build --spec=wgl --generator=c
|
||||
echo "Generating D"
|
||||
$PYTHON -m glad --out-path=build --spec=egl --generator=d
|
||||
$PYTHON -m glad --out-path=build --spec=gl --api="gl=,gles1=,gles2=" --generator=d
|
||||
$PYTHON -m glad --out-path=build --spec=glx --generator=d
|
||||
$PYTHON -m glad --out-path=build --spec=wgl --generator=d
|
||||
echo "Generating Volt"
|
||||
$PYTHON -m glad --out-path=build --spec=egl --generator=volt
|
||||
$PYTHON -m glad --out-path=build --spec=gl --api="gl=,gles1=,gles2=" --generator=volt
|
||||
$PYTHON -m glad --out-path=build --spec=glx --generator=volt
|
||||
$PYTHON -m glad --out-path=build --spec=wgl --generator=volt
|
||||
170
third-party/glad/utility/test.sh
vendored
Executable file
170
third-party/glad/utility/test.sh
vendored
Executable file
@@ -0,0 +1,170 @@
|
||||
#!/bin/bash
|
||||
|
||||
EXIT_ON_FAILURE=${EXIT_ON_FAILURE:=0}
|
||||
PRINT_MESSAGE=${PRINT_MESSAGE:=0}
|
||||
|
||||
PYTHON=${PYTHON:="python"}
|
||||
GLAD_ARGS=${GLAD_ARGS:="--reproducible"}
|
||||
GLAD=${GLAD:="$PYTHON -m glad ${GLAD_ARGS}"}
|
||||
|
||||
_GCC=${_GCC:="gcc"}
|
||||
_MINGW_GCC=${_MINGW_GCC:="x86_64-w64-mingw32-gcc"}
|
||||
_GCC_FLAGS="-Wall -Wextra -Werror -Wsign-conversion -Wcast-qual -Wstrict-prototypes -ansi -pedantic"
|
||||
|
||||
GCC=${GCC:="$_GCC $_GCC_FLAGS"}
|
||||
MINGW_GCC=${MINGW_GCC:="$_MINGW_GCC $_GCC_FLAGS"}
|
||||
|
||||
WINE=${WINE:="wine"}
|
||||
|
||||
TEST_TMP=$(realpath ${TEST_TMP:="build"})
|
||||
|
||||
TEST_DIRECTORY=${TEST_DIRECTORY:="test"}
|
||||
TEST_PATTERN=${TEST_PATTERN:="test.*"}
|
||||
|
||||
TESTS=(${TESTS:=$(find "${TEST_DIRECTORY}" -iname "${TEST_PATTERN}" | sort)})
|
||||
|
||||
TEST_REPORT_ENABLED=${TEST_REPORT_ENABLED:=1}
|
||||
TEST_REPORT=${TEST_REPORT:="test-report.xml"}
|
||||
|
||||
|
||||
function run_test {
|
||||
local test="$1"
|
||||
|
||||
local glad=$(extract "GLAD" "$test")
|
||||
local compile=$(extract "COMPILE" "$test")
|
||||
local run=$(extract "RUN" "$test")
|
||||
|
||||
rm -rf "${TEST_TMP}"
|
||||
mkdir -p "${TEST_TMP}"
|
||||
|
||||
local time=$(date +%s)
|
||||
|
||||
local wd=$(pwd)
|
||||
|
||||
local output;
|
||||
output=$({
|
||||
execute ${glad} && \
|
||||
execute ${compile} && \
|
||||
execute ${run}
|
||||
} 2>& 1)
|
||||
local status=$?
|
||||
|
||||
time=$(($(date +%s) - ${time}))
|
||||
|
||||
cd "$wd"
|
||||
|
||||
log_failure "${status}" "${output}"
|
||||
report_test "${test}" "${status}" "${time}" "${output}"
|
||||
|
||||
return ${status}
|
||||
}
|
||||
|
||||
function report_start {
|
||||
if [ ${TEST_REPORT_ENABLED} -eq 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>' > ${TEST_REPORT}
|
||||
echo '<testsuite>' >> ${TEST_REPORT}
|
||||
}
|
||||
|
||||
function report_test {
|
||||
if [ ${TEST_REPORT_ENABLED} -eq 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local test=${1#*/}
|
||||
local status="$2"
|
||||
local time="$3"
|
||||
local output=$(echo "$4" | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g')
|
||||
|
||||
local class_name=${test%%/*}
|
||||
local test_name_with_suffix=${test#*/}
|
||||
local test_name=${test_name_with_suffix%/*}
|
||||
|
||||
echo " <testcase name=\"${test_name//\//.}\" classname=\"${class_name}\" time=\"${time}\">" >> ${TEST_REPORT}
|
||||
if [ $status -ne 0 ]; then
|
||||
echo " <failure />" >> ${TEST_REPORT}
|
||||
fi
|
||||
echo " <system-out>${output}</system-out>" >> ${TEST_REPORT}
|
||||
echo " </testcase>" >> ${TEST_REPORT}
|
||||
}
|
||||
|
||||
function report_end {
|
||||
if [ ${TEST_REPORT_ENABLED} -eq 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo '</testsuite>' >> ${TEST_REPORT}
|
||||
}
|
||||
|
||||
function extract {
|
||||
local variable="$1"
|
||||
local test="$2"
|
||||
|
||||
local content;
|
||||
content=$(grep -oP "(?<=$variable: ).*" "$test")
|
||||
|
||||
log_failure $? "Unable to extract variable '$variable'"
|
||||
|
||||
echo "$content"
|
||||
}
|
||||
|
||||
function execute {
|
||||
# define variables for use in test
|
||||
local tmp="$TEST_TMP"
|
||||
local test_dir="$(dirname ${test})"
|
||||
|
||||
eval $@
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
function log_failure {
|
||||
local status="$1"
|
||||
local message="$2"
|
||||
|
||||
if [ $status -ne 0 ]; then
|
||||
if [ $PRINT_MESSAGE -ne 0 ]; then
|
||||
echo
|
||||
echo "$message" >&2
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
_tests_total=${#TESTS[@]}
|
||||
_tests_ran=0
|
||||
_tests_failed=0
|
||||
|
||||
report_start
|
||||
|
||||
for test in "${TESTS[@]}"; do
|
||||
_tests_ran=$((_tests_ran+1))
|
||||
|
||||
echo -n " 🡒 $test "
|
||||
test=$(realpath $test)
|
||||
run_test $test
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "| ✕"
|
||||
_tests_failed=$((_tests_failed+1))
|
||||
|
||||
if [ $EXIT_ON_FAILURE -eq 1 ]; then
|
||||
report_end
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "| ✓"
|
||||
fi
|
||||
done
|
||||
|
||||
report_end
|
||||
|
||||
echo
|
||||
echo "Total tests: $_tests_total, Tests ran: $_tests_ran, Tests failed: $_tests_failed"
|
||||
|
||||
if [ $_tests_failed -gt 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
35
third-party/glad/utility/updatesub.sh
vendored
Executable file
35
third-party/glad/utility/updatesub.sh
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
git checkout master
|
||||
./utility/generateall.sh
|
||||
|
||||
echo "Updating C"
|
||||
git checkout c
|
||||
git rm -rf include
|
||||
git rm -rf src
|
||||
mv build/include include/
|
||||
mv build/src src/
|
||||
git add --all include
|
||||
git add --all src
|
||||
git commit -am "automatically updated"
|
||||
git push origin c:c
|
||||
|
||||
echo "Updating D"
|
||||
git checkout d
|
||||
git rm -rf glad
|
||||
mv build/glad glad/
|
||||
git add --all glad
|
||||
git commit -am "automatically updated"
|
||||
git push origin d:d
|
||||
|
||||
echo "Updating Volt"
|
||||
git checkout volt
|
||||
git rm -rf amp
|
||||
mv build/amp amp/
|
||||
git add --all amp
|
||||
git commit -am "automatically updated"
|
||||
git push origin volt:volt
|
||||
|
||||
git checkout master
|
||||
Reference in New Issue
Block a user