Fix opengl sample on macOS and disable on Linux

This commit is contained in:
Svyatoslav Scherbina
2017-10-17 14:26:41 +03:00
committed by SvyatoslavScherbina
parent a16ddcef76
commit 6382215b9d
4 changed files with 5 additions and 31 deletions
+1 -12
View File
@@ -1,18 +1,7 @@
apply plugin: 'konan'
konanInterop {
opengl { }
}
konanArtifacts {
OpenGlTeapotMacbook {
useInterop 'opengl'
OpenGlTeapot {
target "macbook"
}
OpenGlTeapotLinux {
useInterop 'opengl'
target "linux"
}
}
+1 -11
View File
@@ -6,23 +6,13 @@ PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH
if [ x$TARGET == x ]; then
case "$OSTYPE" in
darwin*) TARGET=macbook ;;
linux*) TARGET=linux ;;
*) echo "unknown: $OSTYPE" && exit 1;;
esac
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/
cinterop -def $DIR/src/main/c_interop/opengl.def -target $TARGET \
-o $DIR/build/c_interop/opengl || exit 1
konanc -target $TARGET $DIR/src/main/kotlin/OpenGlTeapot.kt -library $DIR/build/c_interop/opengl \
konanc -target $TARGET $DIR/src/main/kotlin/OpenGlTeapot.kt \
-o $DIR/build/bin/OpenGlTeapot || exit 1
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 opengl.*
import platform.GLUT.*
import platform.OpenGL.*
import platform.OpenGLCommon.*
// Ported from http://openglsamples.sourceforge.net/projects/index.php/blog/index/