diff --git a/README.md b/README.md index a574409..b7feb59 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Golang bindings for [raylib](http://www.raylib.com/), a simple and easy-to-use l ### Requirements -* [OpenAL Soft](http://kcat.strangesoft.net/openal.html) +* [OpenAL Soft](http://kcat.strangesoft.net/openal.html) NOTE: if you don't need audio you can use `-tags noaudio` during build, OpenAL will not be linked to binary, though none of the audio functions will be available. * [GLFW](http://www.glfw.org/) is included as part of the Go package, but you need to make sure you have dependencies installed, see below. diff --git a/raylib/audio.c b/raylib/audio.c index 06af8ed..a7cd665 100644 --- a/raylib/audio.c +++ b/raylib/audio.c @@ -1,3 +1,5 @@ +// +build !noaudio + /********************************************************************************************** * * raylib.audio - Basic funtionality to work with audio diff --git a/raylib/audio.go b/raylib/audio.go index 2ad7077..4dc8627 100644 --- a/raylib/audio.go +++ b/raylib/audio.go @@ -1,3 +1,5 @@ +// +build !noaudio + package raylib /* diff --git a/raylib/audio.h b/raylib/audio.h index 48ef740..f135fda 100644 --- a/raylib/audio.h +++ b/raylib/audio.h @@ -1,3 +1,5 @@ +// +build !noaudio + /********************************************************************************************** * * raylib.audio - Basic funtionality to work with audio @@ -167,4 +169,4 @@ void StopAudioStream(AudioStream stream); // Stop audio st } #endif -#endif // AUDIO_H \ No newline at end of file +#endif // AUDIO_H diff --git a/raylib/cgo_android.go b/raylib/cgo_android.go index 418925e..5f4310d 100644 --- a/raylib/cgo_android.go +++ b/raylib/cgo_android.go @@ -3,7 +3,9 @@ package raylib /* -#cgo android LDFLAGS: -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lopenal -lm -landroid_native_app_glue +#cgo android LDFLAGS: -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lm -landroid_native_app_glue #cgo android CFLAGS: -DPLATFORM_ANDROID -DGRAPHICS_API_OPENGL_ES2 + +#cgo android,!noaudio LDFLAGS: -lopenal */ import "C" diff --git a/raylib/cgo_darwin.go b/raylib/cgo_darwin.go index 594a714..981a795 100644 --- a/raylib/cgo_darwin.go +++ b/raylib/cgo_darwin.go @@ -18,7 +18,9 @@ package raylib #include "external/glfw/src/posix_tls.c" #include "external/glfw/src/nsgl_context.m" -#cgo darwin LDFLAGS: -framework OpenGL -framework OpenAL -framework Cocoa -framework IOKit -framework CoreVideo +#cgo darwin LDFLAGS: -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo #cgo darwin CFLAGS: -x objective-c -Iexternal/glfw/include -D_GLFW_COCOA -D_GLFW_USE_CHDIR -D_GLFW_USE_MENUBAR -D_GLFW_USE_RETINA -Wno-deprecated-declarations -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 + +#cgo darwin,!noaudio LDFLAGS: -framework OpenAL */ import "C" diff --git a/raylib/cgo_linux.go b/raylib/cgo_linux.go index 62af128..eb9dcd1 100644 --- a/raylib/cgo_linux.go +++ b/raylib/cgo_linux.go @@ -20,10 +20,12 @@ package raylib #include "external/glfw/src/xkb_unicode.c" #include "external/glfw/src/egl_context.c" -#cgo linux,!static LDFLAGS: -lGL -lopenal -lm -pthread -ldl -lrt -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -#cgo linux,!static CFLAGS: -D_GLFW_X11 -Iexternal/glfw/include -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -DSHARED_OPENAL +#cgo linux LDFLAGS: -lGL -lm -pthread -ldl -lrt -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor +#cgo linux CFLAGS: -D_GLFW_X11 -Iexternal/glfw/include -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -#cgo linux,static LDFLAGS: -lGL -lopenal -lm -pthread -ldl -lrt -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -#cgo linux,static CFLAGS: -D_GLFW_X11 -Iexternal/glfw/include -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -DAL_LIBTYPE_STATIC +#cgo linux,!noaudio LDFLAGS: -lopenal + +#cgo linux,!static CFLAGS: -DSHARED_OPENAL +#cgo linux,static CFLAGS: -DAL_LIBTYPE_STATIC */ import "C" diff --git a/raylib/cgo_linux_arm.go b/raylib/cgo_linux_arm.go index 8571690..cbdb4d0 100644 --- a/raylib/cgo_linux_arm.go +++ b/raylib/cgo_linux_arm.go @@ -3,7 +3,9 @@ package raylib /* -#cgo linux,arm LDFLAGS: -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -lvcos -lvchiq_arm -lopenal +#cgo linux,arm LDFLAGS: -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -lvcos -lvchiq_arm #cgo linux,arm CFLAGS: -DPLATFORM_RPI -DGRAPHICS_API_OPENGL_ES2 -I/opt/vc/include -I/opt/vc/include/interface/vcos -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads + +#cgo linux,arm,!noaudio LDFLAGS: -lopenal */ import "C" diff --git a/raylib/cgo_windows.go b/raylib/cgo_windows.go index 4d6721e..3f0c491 100644 --- a/raylib/cgo_windows.go +++ b/raylib/cgo_windows.go @@ -19,10 +19,12 @@ package raylib #include "external/glfw/src/wgl_context.c" #include "external/glfw/src/egl_context.c" -#cgo windows,!static LDFLAGS: -lopengl32 -lgdi32 -lopenal -lwinmm -lole32 -#cgo windows,!static CFLAGS: -D_GLFW_WIN32 -Iexternal/glfw/include -Iexternal/glfw/deps/mingw -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -DSHARED_OPENAL +#cgo windows LDFLAGS: -lopengl32 -lgdi32 -lwinmm -lole32 +#cgo windows CFLAGS: -D_GLFW_WIN32 -Iexternal/glfw/include -Iexternal/glfw/deps/mingw -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -#cgo windows,static LDFLAGS: -lopengl32 -lgdi32 -lopenal -lwinmm -lole32 -#cgo windows,static CFLAGS: -D_GLFW_WIN32 -Iexternal/glfw/include -Iexternal/glfw/deps/mingw -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -DAL_LIBTYPE_STATIC +#cgo windows,!noaudio LDFLAGS: -lopenal + +#cgo windows,!static CFLAGS: -DSHARED_OPENAL +#cgo windows,static CFLAGS: -DAL_LIBTYPE_STATIC */ import "C"