Skip to content

Commit da02c09

Browse files
committed
Added Android configuration.
1 parent 4e6cb64 commit da02c09

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

OpenGLRaw.cabal

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,17 @@ flag UseNativeWindowsLibraries
4848

4949
flag UseGlXGetProcAddress
5050
description:
51-
Use glXGetProcAddress instead of dlsym on non-Windows/-Darwin platforms.
51+
Use glXGetProcAddress instead of dlsym on non-Windows/-Darwin/-Android platforms.
52+
53+
flag UseGLES2
54+
description:
55+
Use OpenGL ES 2.x instead of OpenGL ES 3.x on Android.
56+
57+
flag OsAndroid
58+
description:
59+
Compile for Android. This flag goes away when cabal supports os(android).
60+
default:
61+
False
5262

5363
library
5464
exposed-modules:
@@ -596,18 +606,25 @@ library
596606
extra-libraries: opengl32
597607
else
598608
cpp-options: "-DCALLCONV=ccall"
599-
if !os(darwin) && !os(ios) && flag(UseGlXGetProcAddress)
600-
cc-options: "-DUSE_GLXGETPROCADDRESS"
601-
else
609+
if os(darwin) || os(ios) || flag(OsAndroid) || !flag(UseGlXGetProcAddress)
610+
-- TODO: Figure out if/when eglGetProcAddress should be used.
602611
cc-options: "-DUSE_DLSYM"
612+
else
613+
cc-options: "-DUSE_GLXGETPROCADDRESS"
603614
if os(darwin)
604615
cpp-options: "-DHANDLE_IS_POINTER"
605616
frameworks: OpenGL
606617
else
607618
if os(ios)
608619
frameworks: OpenGLES
609620
else
610-
extra-libraries: GL
621+
if flag(OsAndroid)
622+
if flag(UseGLES2)
623+
extra-libraries: GLESv2
624+
else
625+
extra-libraries: GLESv3
626+
else
627+
extra-libraries: GL
611628

612629
source-repository head
613630
type: git

0 commit comments

Comments
 (0)