added glad generator and a glad runtime

This commit is contained in:
Hartmut Seichter 2017-06-29 07:15:32 +02:00
parent 2017f6195e
commit ac18a84a9c
62 changed files with 32373 additions and 10 deletions

View file

@ -0,0 +1,156 @@
#!/bin/bash -xe
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 -Werror -ansi -c"
GPP_FLAGS="-o build/tmp.o -Wall -Wextra -Wsign-conversion -Wcast-qual -Werror -c"
function mingwc_compile {
i686-w64-mingw32-gcc $@
x86_64-w64-mingw32-gcc $@
}
function c_compile {
gcc $@ -ldl
mingwc_compile $@
}
function mingwcpp_compile {
i686-w64-mingw32-g++ $@
x86_64-w64-mingw32-g++ $@
}
function cpp_compile {
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++: ======================"
function c_egl {
rm -rf build
${PYTHON} -m glad --spec=egl --out-path=build $@
download_if_required build/include/EGL/eglplatform.h "https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/master/api/EGL/eglplatform.h"
download_if_required build/include/KHR/khrplatform.h "https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/master/api/KHR/khrplatform.h"
c_compile -Ibuild/include build/src/glad_egl.c ${GCC_FLAGS}
cpp_compile -Ibuild/include build/src/glad_egl.c ${GPP_FLAGS}
}
function c_gl {
rm -rf build
${PYTHON} -m glad --spec=gl --out-path=build $@
c_compile -Ibuild/include build/src/glad.c ${GCC_FLAGS}
cpp_compile -Ibuild/include build/src/glad.c ${GPP_FLAGS}
}
function c_glx {
rm -rf build
${PYTHON} -m glad --spec=gl --out-path=build $@
${PYTHON} -m glad --spec=glx --out-path=build $@
gcc -Ibuild/include build/src/glad_glx.c ${GCC_FLAGS}
g++ -Ibuild/include build/src/glad_glx.c ${GPP_FLAGS}
}
function c_wgl {
rm -rf build
${PYTHON} -m glad --spec=gl --out-path=build $1
${PYTHON} -m glad --spec=wgl --out-path=build $@
mingwc_compile -Ibuild/include build/src/glad_wgl.c ${GCC_FLAGS}
mingwcpp_compile -Ibuild/include build/src/glad_wgl.c ${GPP_FLAGS}
}
function c_example {
${PYTHON} -m glad --spec=gl --out-path=build $@
gcc example/c/simple.c -o build/simple -Ibuild/include build/src/glad.c -lglut -ldl
mingwc_compile example/c/simple.c -o build/simple -Ibuild/include build/src/glad.c -lfreeglut
g++ example/c++/hellowindow2.cpp -o build/hellowindow2 -Ibuild/include build/src/glad.c -lglfw -ldl
mingwcpp_compile example/c++/hellowindow2.cpp -o build/hellowindow2 -Ibuild/include build/src/glad.c -lglfw3 -luser32 -lgdi32
}
c_egl --generator=c
c_egl --generator=c --extensions=
c_glx --generator=c
c_glx --generator=c --extensions=
c_wgl --generator=c
c_wgl --generator=c --extensions=WGL_ARB_extensions_string,WGL_EXT_extensions_string
c_example --generator=c
c_example --generator=c --extensions=
# C-Debug
echo -e "====================== Generating and compiling C/C++ Debug: ======================"
c_egl --generator=c-debug
c_egl --generator=c-debug --extensions=
c_glx --generator=c-debug
c_glx --generator=c-debug --extensions=
c_wgl --generator=c-debug
c_wgl --generator=c-debug --extensions=WGL_ARB_extensions_string,WGL_EXT_extensions_string
c_example --generator=c-debug
c_example --generator=c-debug --extensions=
# D
echo -e "\n====================== Generating and compiling D: ======================"
rm -rf build
${PYTHON} -m glad --generator=d --spec=egl --out-path=build
dmd -o- build/glad/egl/*.d -c
rm -rf build
${PYTHON} -m glad --generator=d --spec=gl --api="gl=,gles1=,gles2=" --out-path=build
dmd -o- build/glad/gl/*.d -c
rm -rf build
${PYTHON} -m glad --generator=d --spec=gl --out-path=build
${PYTHON} -m glad --generator=d --spec=glx --out-path=build
dmd -o- build/glad/glx/*.d -c
rm -rf build
${PYTHON} -m glad --generator=d --spec=gl --out-path=build
${PYTHON} -m glad --generator=d --spec=wgl --out-path=build
dmd -o- build/glad/wgl/*.d -c
# Volt TODO
echo -e "\n====================== Generating Volt: ======================"
rm -rf build
${PYTHON} -m glad --generator=volt --spec=egl --out-path=build
${PYTHON} -m glad --generator=volt --spec=gl --out-path=build
${PYTHON} -m glad --generator=volt --spec=glx --out-path=build
${PYTHON} -m glad --generator=volt --spec=wgl --out-path=build
rm -rf build

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
rm -f egl.xml
wget -O egl.xml https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/master/api/egl.xml
rm -f gl.xml
wget -O gl.xml https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/master/xml/gl.xml
rm -f glx.xml
wget -O glx.xml https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/master/xml/glx.xml
rm -f wgl.xml
wget -O wgl.xml https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/master/xml/wgl.xml
rm -f khrplatform.h
wget -O khrplatform.h https://raw.githubusercontent.com/KhronosGroup/EGL-Registry/master/api/KHR/khrplatform.h

View 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

View 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