Merge pull request #178 from ebassi/osx-ci

Fix build of Epoxy on macOS
macos/v1.5.9
Emmanuele Bassi 7 years ago committed by GitHub
commit 3824efc25c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      .travis.yml
  2. 0
      .travis/epoxy-ci-linux.sh
  3. 19
      .travis/epoxy-ci-osx.sh
  4. 31
      src/dispatch_common.c
  5. 2
      src/dispatch_common.h

@ -7,6 +7,7 @@ branches:
os:
- linux
- osx
compiler:
- gcc
@ -18,13 +19,29 @@ language:
services:
- docker
matrix:
exclude:
- os: osx
compiler: gcc
before_install:
- docker pull ebassi/epoxyci
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
brew install python@3 meson
# Use a Ninja with QuLogic's patch: https://github.com/ninja-build/ninja/issues/1219
mkdir -p $HOME/tools; curl -L http://nirbheek.in/files/binaries/ninja/macos/ninja -o $HOME/tools/ninja; chmod +x $HOME/tools/ninja
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull ebassi/epoxyci ; fi
before_script:
- echo FROM ebassi/epoxyci > Dockerfile
- echo ADD . /root >> Dockerfile
- docker build -t withgit .
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo FROM ebassi/epoxyci > Dockerfile
echo ADD . /root >> Dockerfile
echo WORKDIR /root >> Dockerfile
docker build -t withgit .
fi
env:
- BUILD_OPTS=""
@ -33,4 +50,5 @@ env:
- BUILD_OPTS="-Dx11=false"
script:
- docker run withgit /bin/sh -c "CC=$CC ./epoxy-run-tests.sh $BUILD_OPTS"
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "CC=$CC .travis/epoxy-ci-linux.sh $BUILD_OPTS" ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then /bin/sh -c "CC=$CC .travis/epoxy-ci-osx.sh $BUILD_OPTS" ; fi

@ -0,0 +1,19 @@
#!/bin/sh
export SDKROOT=$( xcodebuild -version -sdk macosx Path )
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
export OBJC=$CC
export PATH=$HOME/tools:$PATH
srcdir=$( pwd )
builddir=$( mktemp -d build_XXXXXX )
meson ${BUILDOPTS} $builddir $srcdir || exit $?
cd $builddir
ninja || exit $?
meson test || exit $?
cd ..
rm -rf $builddir

@ -173,26 +173,24 @@
#include "dispatch_common.h"
#ifdef __APPLE__
#if defined(__APPLE__)
#define GLX_LIB "/opt/X11/lib/libGL.1.dylib"
#define OPENGL_LIB "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
#define GLES1_LIB "libGLESv1_CM.so"
#define GLES2_LIB "libGLESv2.so"
#elif defined(__ANDROID__)
#define GLX_LIB "libGLESv2.so"
#else
#define GLVND_GLX_LIB "libGLX.so.1"
#define GLX_LIB "libGL.so.1"
#endif
#ifdef __ANDROID__
#define EGL_LIB "libEGL.so"
#define GLES1_LIB "libGLESv1_CM.so"
#define GLES2_LIB "libGLESv2.so"
#elif defined _WIN32
#elif defined(_WIN32)
#define EGL_LIB "libEGL.dll"
#define GLES1_LIB "libGLES_CM.dll"
#define GLES2_LIB "libGLESv2.dll"
#define OPENGL_LIB "OPENGL32"
#else
#define GLVND_GLX_LIB "libGLX.so.1"
#define GLX_LIB "libGL.so.1"
#define EGL_LIB "libEGL.so.1"
#define GLES1_LIB "libGLESv1_CM.so.1"
#define GLES2_LIB "libGLESv2.so.2"
@ -553,23 +551,25 @@ epoxy_internal_has_gl_extension(const char *ext, bool invalid_op_mode)
bool
epoxy_load_glx(bool exit_if_fails, bool load)
{
#ifdef GLVND_GLX_LIB
#ifdef PLATFORM_HAS_GLX
# ifdef GLVND_GLX_LIB
/* prefer the glvnd library if it exists */
if (!api.glx_handle)
get_dlopen_handle(&api.glx_handle, GLVND_GLX_LIB, false, load);
#endif
# endif
if (!api.glx_handle)
get_dlopen_handle(&api.glx_handle, GLX_LIB, exit_if_fails, load);
#endif
return api.glx_handle != NULL;
}
void *
epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails)
{
#ifdef PLATFORM_HAS_GLX
if (epoxy_load_glx(exit_if_fails, exit_if_fails))
return do_dlsym(&api.glx_handle, name, exit_if_fails);
#endif
return NULL;
}
@ -636,15 +636,20 @@ epoxy_conservative_has_gl_extension(const char *ext)
bool
epoxy_load_egl(bool exit_if_fails, bool load)
{
#if PLATFORM_HAS_EGL
return get_dlopen_handle(&api.egl_handle, EGL_LIB, exit_if_fails, load);
#else
return false;
#endif
}
void *
epoxy_conservative_egl_dlsym(const char *name, bool exit_if_fails)
{
#if PLATFORM_HAS_EGL
if (epoxy_load_egl(exit_if_fails, exit_if_fails))
return do_dlsym(&api.egl_handle, name, exit_if_fails);
#endif
return NULL;
}

@ -28,7 +28,7 @@
#define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 1
#elif defined(__APPLE__)
#define PLATFORM_HAS_EGL ENABLE_EGL
#define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 0
#elif defined(ANDROID)

Loading…
Cancel
Save