Fix opengl sample on macOS and disable on Linux
This commit is contained in:
committed by
SvyatoslavScherbina
parent
a16ddcef76
commit
6382215b9d
@@ -1,18 +1,7 @@
|
|||||||
apply plugin: 'konan'
|
apply plugin: 'konan'
|
||||||
|
|
||||||
konanInterop {
|
|
||||||
opengl { }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
konanArtifacts {
|
konanArtifacts {
|
||||||
OpenGlTeapotMacbook {
|
OpenGlTeapot {
|
||||||
useInterop 'opengl'
|
|
||||||
target "macbook"
|
target "macbook"
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGlTeapotLinux {
|
|
||||||
useInterop 'opengl'
|
|
||||||
target "linux"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-11
@@ -6,23 +6,13 @@ PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH
|
|||||||
if [ x$TARGET == x ]; then
|
if [ x$TARGET == x ]; then
|
||||||
case "$OSTYPE" in
|
case "$OSTYPE" in
|
||||||
darwin*) TARGET=macbook ;;
|
darwin*) TARGET=macbook ;;
|
||||||
linux*) TARGET=linux ;;
|
|
||||||
*) echo "unknown: $OSTYPE" && exit 1;;
|
*) echo "unknown: $OSTYPE" && exit 1;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
var=CFLAGS_${TARGET}
|
|
||||||
CFLAGS=${!var}
|
|
||||||
var=COMPILER_ARGS_${TARGET}
|
|
||||||
COMPILER_ARGS=${!var} # add -opt for an optimized build.
|
|
||||||
|
|
||||||
mkdir -p $DIR/build/c_interop/
|
|
||||||
mkdir -p $DIR/build/bin/
|
mkdir -p $DIR/build/bin/
|
||||||
|
|
||||||
cinterop -def $DIR/src/main/c_interop/opengl.def -target $TARGET \
|
konanc -target $TARGET $DIR/src/main/kotlin/OpenGlTeapot.kt \
|
||||||
-o $DIR/build/c_interop/opengl || exit 1
|
|
||||||
|
|
||||||
konanc -target $TARGET $DIR/src/main/kotlin/OpenGlTeapot.kt -library $DIR/build/c_interop/opengl \
|
|
||||||
-o $DIR/build/bin/OpenGlTeapot || exit 1
|
-o $DIR/build/bin/OpenGlTeapot || exit 1
|
||||||
|
|
||||||
echo "Artifact path is $DIR/build/bin/OpenGlTeapot.kexe"
|
echo "Artifact path is $DIR/build/bin/OpenGlTeapot.kexe"
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
headers.osx = OpenGL/gl.h OpenGL/glu.h GLUT/glut.h
|
|
||||||
headers.linux = GL/glut.h
|
|
||||||
compilerOpts.osx = -framework OpenGL -framework GLUT
|
|
||||||
compilerOpts.linux = -I/usr/include
|
|
||||||
excludeDependentModules.osx = true
|
|
||||||
linkerOpts.osx = -framework OpenGL -framework GLUT
|
|
||||||
linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -lglut -lGL -lGLU
|
|
||||||
@@ -15,7 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import kotlinx.cinterop.*
|
import kotlinx.cinterop.*
|
||||||
import opengl.*
|
import platform.GLUT.*
|
||||||
|
import platform.OpenGL.*
|
||||||
|
import platform.OpenGLCommon.*
|
||||||
|
|
||||||
// Ported from http://openglsamples.sourceforge.net/projects/index.php/blog/index/
|
// Ported from http://openglsamples.sourceforge.net/projects/index.php/blog/index/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user